summaryrefslogtreecommitdiff
path: root/girepository/cmph/chd_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/chd_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/chd_ph.c')
-rw-r--r--girepository/cmph/chd_ph.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/girepository/cmph/chd_ph.c b/girepository/cmph/chd_ph.c
index 71f83fbd..6cd9437a 100644
--- a/girepository/cmph/chd_ph.c
+++ b/girepository/cmph/chd_ph.c
@@ -5,6 +5,7 @@
#include<time.h>
#include<assert.h>
#include<limits.h>
+#include<errno.h>
#include "cmph_structs.h"
#include "chd_structs_ph.h"
@@ -859,6 +860,9 @@ void chd_ph_load(FILE *fd, cmph_t *mphf)
DEBUGP("Reading n and nbuckets\n");
nbytes = fread(&(chd_ph->n), sizeof(cmph_uint32), (size_t)1, fd);
nbytes = fread(&(chd_ph->nbuckets), sizeof(cmph_uint32), (size_t)1, fd);
+ if (nbytes == 0 && ferror(fd)) {
+ fprintf(stderr, "ERROR: %s\n", strerror(errno));
+ }
}
int chd_ph_dump(cmph_t *mphf, FILE *fd)
@@ -885,6 +889,10 @@ int chd_ph_dump(cmph_t *mphf, FILE *fd)
// dumping n and nbuckets
nbytes = fwrite(&(data->n), sizeof(cmph_uint32), (size_t)1, fd);
nbytes = fwrite(&(data->nbuckets), sizeof(cmph_uint32), (size_t)1, fd);
+ if (nbytes == 0 && ferror(fd)) {
+ fprintf(stderr, "ERROR: %s\n", strerror(errno));
+ return 0;
+ }
return 1;
}