summaryrefslogtreecommitdiff
path: root/girepository/cmph/bdz_ph.c
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2012-04-09 14:19:23 -0300
committerJohan Dahlin <jdahlin@litl.com>2012-04-09 14:19:23 -0300
commit7c4fbbd681e89775dbec67f3002f820feb42300b (patch)
treea99dc723141fd872f84c488665e973b483ba0a1e /girepository/cmph/bdz_ph.c
parent47d4e9509a8ffde1cab4a6f8d2be4ce232ba1cfb (diff)
downloadgobject-introspection-7c4fbbd681e89775dbec67f3002f820feb42300b.tar.gz
Make introspection compile with -Wall -Werror
Address all gcc warnings, -Werror is not enabled yet but at least -Wall -Werror passes on my machine.
Diffstat (limited to 'girepository/cmph/bdz_ph.c')
-rwxr-xr-xgirepository/cmph/bdz_ph.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/girepository/cmph/bdz_ph.c b/girepository/cmph/bdz_ph.c
index 16257c0f..2e986071 100755
--- a/girepository/cmph/bdz_ph.c
+++ b/girepository/cmph/bdz_ph.c
@@ -9,6 +9,7 @@
#include <stdio.h>
#include <assert.h>
#include <string.h>
+#include <errno.h>
//#define DEBUG
#include "debug.h"
#define UNASSIGNED 3
@@ -465,6 +466,10 @@ int bdz_ph_dump(cmph_t *mphf, FILE *fd)
sizeg = (cmph_uint32)ceil(data->n/5.0);
nbytes = fwrite(data->g, sizeof(cmph_uint8)*sizeg, (size_t)1, fd);
+ if (nbytes == 0 && ferror(fd)) {
+ fprintf(stderr, "ERROR: %s\n", strerror(errno));
+ return 0;
+ }
#ifdef DEBUG
cmph_uint32 i;
fprintf(stderr, "G: ");
@@ -501,6 +506,9 @@ void bdz_ph_load(FILE *f, cmph_t *mphf)
bdz_ph->g = (cmph_uint8 *)calloc((size_t)sizeg, sizeof(cmph_uint8));
nbytes = fread(bdz_ph->g, sizeg*sizeof(cmph_uint8), (size_t)1, f);
+ if (nbytes == 0 && ferror(f)) {
+ fprintf(stderr, "ERROR: %s\n", strerror(errno));
+ }
return;
}