summaryrefslogtreecommitdiff
path: root/girepository/cmph/bdz.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.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.c')
-rwxr-xr-xgirepository/cmph/bdz.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/girepository/cmph/bdz.c b/girepository/cmph/bdz.c
index a57f70f8..a385b152 100755
--- a/girepository/cmph/bdz.c
+++ b/girepository/cmph/bdz.c
@@ -9,6 +9,7 @@
#include <stdio.h>
#include <assert.h>
#include <string.h>
+#include <errno.h>
//#define DEBUG
#include "debug.h"
#define UNASSIGNED 3U
@@ -508,6 +509,10 @@ int bdz_dump(cmph_t *mphf, FILE *fd)
nbytes = fwrite(&(data->ranktablesize), sizeof(cmph_uint32), (size_t)1, fd);
nbytes = fwrite(data->ranktable, sizeof(cmph_uint32)*(data->ranktablesize), (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: ");
@@ -549,6 +554,10 @@ void bdz_load(FILE *f, cmph_t *mphf)
bdz->ranktable = (cmph_uint32 *)calloc((size_t)bdz->ranktablesize, sizeof(cmph_uint32));
nbytes = fread(bdz->ranktable, sizeof(cmph_uint32)*(bdz->ranktablesize), (size_t)1, f);
+ if (nbytes == 0 && ferror(f)) {
+ fprintf(stderr, "ERROR: %s\n", strerror(errno));
+ return;
+ }
#ifdef DEBUG
cmph_uint32 i = 0;