diff options
author | Johan Dahlin <johan@gnome.org> | 2012-04-09 14:19:23 -0300 |
---|---|---|
committer | Johan Dahlin <jdahlin@litl.com> | 2012-04-09 14:19:23 -0300 |
commit | 7c4fbbd681e89775dbec67f3002f820feb42300b (patch) | |
tree | a99dc723141fd872f84c488665e973b483ba0a1e /girepository/cmph/brz.c | |
parent | 47d4e9509a8ffde1cab4a6f8d2be4ce232ba1cfb (diff) | |
download | gobject-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/brz.c')
-rwxr-xr-x | girepository/cmph/brz.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/girepository/cmph/brz.c b/girepository/cmph/brz.c index f9c48ef7..f0c91c4b 100755 --- a/girepository/cmph/brz.c +++ b/girepository/cmph/brz.c @@ -15,6 +15,7 @@ #include <stdio.h> #include <assert.h> #include <string.h> +#include <errno.h> #define MAX_BUCKET_SIZE 255 //#define DEBUG #include "debug.h" @@ -370,7 +371,11 @@ static int brz_gen_mphf(cmph_config_t *mph) nbytes = fwrite(&(brz->algo), sizeof(brz->algo), (size_t)1, brz->mphf_fd); nbytes = fwrite(&(brz->k), sizeof(cmph_uint32), (size_t)1, brz->mphf_fd); // number of MPHFs nbytes = fwrite(brz->size, sizeof(cmph_uint8)*(brz->k), (size_t)1, brz->mphf_fd); - + if (nbytes == 0 && ferror(brz->mphf_fd)) { + fprintf(stderr, "ERROR: %s\n", strerror(errno)); + return 0; + } + //tmp_fds = (FILE **)calloc(nflushes, sizeof(FILE *)); buff_manager = buffer_manager_new(brz->memory_availability, nflushes); buffer_merge = (cmph_uint8 **)calloc((size_t)nflushes, sizeof(cmph_uint8 *)); @@ -574,6 +579,10 @@ int brz_dump(cmph_t *mphf, FILE *fd) // Dumping m and the vector offset. nbytes = fwrite(&(data->m), sizeof(cmph_uint32), (size_t)1, fd); nbytes = fwrite(data->offset, sizeof(cmph_uint32)*(data->k), (size_t)1, fd); + if (nbytes == 0 && ferror(fd)) { + fprintf(stderr, "ERROR: %s\n", strerror(errno)); + return 0; + } return 1; } @@ -639,6 +648,9 @@ void brz_load(FILE *f, cmph_t *mphf) nbytes = fread(&(brz->m), sizeof(cmph_uint32), (size_t)1, f); brz->offset = (cmph_uint32 *)malloc(sizeof(cmph_uint32)*brz->k); nbytes = fread(brz->offset, sizeof(cmph_uint32)*(brz->k), (size_t)1, f); + if (nbytes == 0 && ferror(f)) { + fprintf(stderr, "ERROR: %s\n", strerror(errno)); + } return; } |