summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgirepository/cmph/bdz.c9
-rwxr-xr-xgirepository/cmph/bdz_ph.c8
-rw-r--r--girepository/cmph/bmz.c9
-rw-r--r--girepository/cmph/bmz8.c9
-rwxr-xr-xgirepository/cmph/brz.c14
-rw-r--r--girepository/cmph/chd.c9
-rw-r--r--girepository/cmph/chd_ph.c8
-rw-r--r--girepository/cmph/chm.c9
-rw-r--r--girepository/cmph/cmph.c3
-rw-r--r--girepository/cmph/cmph_structs.c7
-rw-r--r--girepository/cmph/fch.c9
-rw-r--r--girepository/ginvoke.c2
-rw-r--r--girepository/girepository.c2
-rw-r--r--girepository/girwriter.c2
-rw-r--r--tests/gimarshallingtests.c2
-rw-r--r--tests/scanner/regress.c6
16 files changed, 96 insertions, 12 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;
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;
}
diff --git a/girepository/cmph/bmz.c b/girepository/cmph/bmz.c
index 3eabfb7f..9c6cea00 100644
--- a/girepository/cmph/bmz.c
+++ b/girepository/cmph/bmz.c
@@ -11,6 +11,7 @@
#include <stdio.h>
#include <assert.h>
#include <string.h>
+#include <errno.h>
//#define DEBUG
#include "debug.h"
@@ -469,6 +470,10 @@ int bmz_dump(cmph_t *mphf, FILE *fd)
nbytes = fwrite(&(data->m), sizeof(cmph_uint32), (size_t)1, fd);
nbytes = fwrite(data->g, sizeof(cmph_uint32)*(data->n), (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: ");
@@ -510,6 +515,10 @@ void bmz_load(FILE *f, cmph_t *mphf)
bmz->g = (cmph_uint32 *)malloc(sizeof(cmph_uint32)*bmz->n);
nbytes = fread(bmz->g, bmz->n*sizeof(cmph_uint32), (size_t)1, f);
+ if (nbytes == 0 && ferror(f)) {
+ fprintf(stderr, "ERROR: %s\n", strerror(errno));
+ return;
+ }
#ifdef DEBUG
fprintf(stderr, "G: ");
for (i = 0; i < bmz->n; ++i) fprintf(stderr, "%u ", bmz->g[i]);
diff --git a/girepository/cmph/bmz8.c b/girepository/cmph/bmz8.c
index 4db4dfce..206c48c4 100644
--- a/girepository/cmph/bmz8.c
+++ b/girepository/cmph/bmz8.c
@@ -10,6 +10,7 @@
#include <stdio.h>
#include <assert.h>
#include <string.h>
+#include <errno.h>
//#define DEBUG
#include "debug.h"
@@ -482,6 +483,10 @@ int bmz8_dump(cmph_t *mphf, FILE *fd)
nbytes = fwrite(&(data->m), sizeof(cmph_uint8), (size_t)1, fd);
nbytes = fwrite(data->g, sizeof(cmph_uint8)*(data->n), (size_t)1, fd);
+ if (nbytes == 0 && ferror(fd)) {
+ fprintf(stderr, "ERROR: %s\n", strerror(errno));
+ return 0;
+ }
/* #ifdef DEBUG
fprintf(stderr, "G: ");
for (i = 0; i < data->n; ++i) fprintf(stderr, "%u ", data->g[i]);
@@ -523,6 +528,10 @@ void bmz8_load(FILE *f, cmph_t *mphf)
bmz8->g = (cmph_uint8 *)malloc(sizeof(cmph_uint8)*bmz8->n);
nbytes = fread(bmz8->g, bmz8->n*sizeof(cmph_uint8), (size_t)1, f);
+ if (nbytes == 0 && ferror(f)) {
+ fprintf(stderr, "ERROR: %s\n", strerror(errno));
+ return;
+ }
#ifdef DEBUG
fprintf(stderr, "G: ");
for (i = 0; i < bmz8->n; ++i) fprintf(stderr, "%u ", bmz8->g[i]);
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;
}
diff --git a/girepository/cmph/chd.c b/girepository/cmph/chd.c
index 7fb3b8bb..71579ee3 100644
--- a/girepository/cmph/chd.c
+++ b/girepository/cmph/chd.c
@@ -5,6 +5,7 @@
#include<time.h>
#include<assert.h>
#include<limits.h>
+#include<errno.h>
#include "cmph_structs.h"
#include "chd_structs.h"
@@ -189,6 +190,9 @@ void chd_load(FILE *fd, cmph_t *mphf)
DEBUGP("Loading Compressed rank structure, which has %u bytes\n", chd->packed_cr_size);
chd->packed_cr = (cmph_uint8 *) calloc((size_t)chd->packed_cr_size, (size_t)1);
nbytes = fread(chd->packed_cr, chd->packed_cr_size, (size_t)1, fd);
+ if (nbytes == 0 && ferror(fd)) {
+ fprintf(stderr, "ERROR: %s\n", strerror(errno));
+ }
}
int chd_dump(cmph_t *mphf, FILE *fd)
@@ -206,7 +210,10 @@ int chd_dump(cmph_t *mphf, FILE *fd)
DEBUGP("Dumping compressed rank structure with %u bytes to disk\n", buflen);
nbytes = fwrite(&data->packed_cr_size, sizeof(cmph_uint32), (size_t)1, fd);
nbytes = fwrite(data->packed_cr, data->packed_cr_size, (size_t)1, fd);
-
+ if (nbytes == 0 && ferror(fd)) {
+ fprintf(stderr, "ERROR: %s\n", strerror(errno));
+ return 0;
+ }
return 1;
}
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;
}
diff --git a/girepository/cmph/chm.c b/girepository/cmph/chm.c
index 9cdbf41b..3af8c806 100644
--- a/girepository/cmph/chm.c
+++ b/girepository/cmph/chm.c
@@ -10,6 +10,7 @@
#include <stdio.h>
#include <assert.h>
#include <string.h>
+#include <errno.h>
//#define DEBUG
#include "debug.h"
@@ -225,6 +226,10 @@ int chm_dump(cmph_t *mphf, FILE *fd)
nbytes = fwrite(&(data->m), sizeof(cmph_uint32), (size_t)1, fd);
nbytes = fwrite(data->g, sizeof(cmph_uint32)*data->n, (size_t)1, fd);
+ if (nbytes == 0 && ferror(fd)) {
+ fprintf(stderr, "ERROR: %s\n", strerror(errno));
+ return 0;
+ }
/* #ifdef DEBUG
fprintf(stderr, "G: ");
for (i = 0; i < data->n; ++i) fprintf(stderr, "%u ", data->g[i]);
@@ -265,6 +270,10 @@ void chm_load(FILE *f, cmph_t *mphf)
chm->g = (cmph_uint32 *)malloc(sizeof(cmph_uint32)*chm->n);
nbytes = fread(chm->g, chm->n*sizeof(cmph_uint32), (size_t)1, f);
+ if (nbytes == 0 && ferror(f)) {
+ fprintf(stderr, "ERROR: %s\n", strerror(errno));
+ return;
+ }
#ifdef DEBUG
fprintf(stderr, "G: ");
for (i = 0; i < chm->n; ++i) fprintf(stderr, "%u ", chm->g[i]);
diff --git a/girepository/cmph/cmph.c b/girepository/cmph/cmph.c
index cba735f4..0c4b67d1 100644
--- a/girepository/cmph/cmph.c
+++ b/girepository/cmph/cmph.c
@@ -151,12 +151,11 @@ static void key_vector_rewind(void *data)
static cmph_uint32 count_nlfile_keys(FILE *fd)
{
cmph_uint32 count = 0;
- register char * ptr;
rewind(fd);
while(1)
{
char buf[BUFSIZ];
- ptr = fgets(buf, BUFSIZ, fd);
+ fgets(buf, BUFSIZ, fd);
if (feof(fd)) break;
if (buf[strlen(buf) - 1] != '\n') continue;
++count;
diff --git a/girepository/cmph/cmph_structs.c b/girepository/cmph/cmph_structs.c
index b5634248..9ecf5fc0 100644
--- a/girepository/cmph/cmph_structs.c
+++ b/girepository/cmph/cmph_structs.c
@@ -1,6 +1,7 @@
#include "cmph_structs.h"
#include <string.h>
+#include <errno.h>
//#define DEBUG
#include "debug.h"
@@ -27,6 +28,9 @@ void __cmph_dump(cmph_t *mphf, FILE *fd)
register size_t nbytes;
nbytes = fwrite(cmph_names[mphf->algo], (size_t)(strlen(cmph_names[mphf->algo]) + 1), (size_t)1, fd);
nbytes = fwrite(&(mphf->size), sizeof(mphf->size), (size_t)1, fd);
+ if (nbytes == 0 && ferror(fd)) {
+ fprintf(stderr, "ERROR: %s\n", strerror(errno));
+ }
}
cmph_t *__cmph_load(FILE *f)
{
@@ -62,6 +66,9 @@ cmph_t *__cmph_load(FILE *f)
nbytes = fread(&(mphf->size), sizeof(mphf->size), (size_t)1, f);
mphf->data = NULL;
DEBUGP("Algorithm is %s and mphf is sized %u\n", cmph_names[algo], mphf->size);
+ if (nbytes == 0 && ferror(f)) {
+ fprintf(stderr, "ERROR: %s\n", strerror(errno));
+ }
return mphf;
}
diff --git a/girepository/cmph/fch.c b/girepository/cmph/fch.c
index 67b68fbb..f6e16e34 100644
--- a/girepository/cmph/fch.c
+++ b/girepository/cmph/fch.c
@@ -9,6 +9,7 @@
#include <stdio.h>
#include <assert.h>
#include <string.h>
+#include <errno.h>
#define INDEX 0 /* alignment index within a bucket */
//#define DEBUG
#include "debug.h"
@@ -339,6 +340,10 @@ int fch_dump(cmph_t *mphf, FILE *fd)
nbytes = fwrite(&(data->p1), sizeof(double), (size_t)1, fd);
nbytes = fwrite(&(data->p2), sizeof(double), (size_t)1, fd);
nbytes = fwrite(data->g, sizeof(cmph_uint32)*(data->b), (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: ");
@@ -387,6 +392,10 @@ void fch_load(FILE *f, cmph_t *mphf)
fch->g = (cmph_uint32 *)malloc(sizeof(cmph_uint32)*fch->b);
nbytes = fread(fch->g, fch->b*sizeof(cmph_uint32), (size_t)1, f);
+ if (nbytes == 0 && ferror(f)) {
+ fprintf(stderr, "ERROR: %s\n", strerror(errno));
+ return;
+ }
#ifdef DEBUG
cmph_uint32 i;
fprintf(stderr, "G: ");
diff --git a/girepository/ginvoke.c b/girepository/ginvoke.c
index 6c39c48e..ed4996d9 100644
--- a/girepository/ginvoke.c
+++ b/girepository/ginvoke.c
@@ -172,7 +172,7 @@ g_value_from_ffi_value (GValue *gvalue,
g_value_set_string (gvalue, (gchar*)value->v_pointer);
break;
case G_TYPE_CHAR:
- g_value_set_char (gvalue, (gchar)value->v_long);
+ g_value_set_schar (gvalue, (gchar)value->v_long);
break;
case G_TYPE_UCHAR:
g_value_set_uchar (gvalue, (guchar)value->v_ulong);
diff --git a/girepository/girepository.c b/girepository/girepository.c
index bcc4a1b4..b5c30297 100644
--- a/girepository/girepository.c
+++ b/girepository/girepository.c
@@ -372,7 +372,6 @@ register_internal (GIRepository *repository,
{
Header *header;
const gchar *namespace;
- const gchar *version;
g_return_val_if_fail (typelib != NULL, FALSE);
@@ -381,7 +380,6 @@ register_internal (GIRepository *repository,
g_return_val_if_fail (header != NULL, FALSE);
namespace = g_typelib_get_string (typelib, header->namespace);
- version = g_typelib_get_string (typelib, header->nsversion);
if (lazy)
{
diff --git a/girepository/girwriter.c b/girepository/girwriter.c
index 73088a12..5b39e2de 100644
--- a/girepository/girwriter.c
+++ b/girepository/girwriter.c
@@ -771,11 +771,9 @@ write_constant_info (const gchar *namespace,
{
GITypeInfo *type;
const gchar *name;
- gboolean deprecated;
GIArgument value;
name = g_base_info_get_name ((GIBaseInfo *)info);
- deprecated = g_base_info_is_deprecated ((GIBaseInfo *)info);
xml_start_element (file, "constant");
xml_printf (file, " name=\"%s\"", name);
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 991e2863..fcbad694 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -3826,7 +3826,7 @@ gi_marshalling_tests_object_vfunc_with_callback (GIMarshallingTestsObject *objec
static int
_callback (int val, void *user_data)
{
- g_assert(user_data == 0xdeadbeef);
+ g_assert((int)user_data == (int)0xdeadbeef);
return val;
}
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index 544f895c..5f129603 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -226,11 +226,12 @@ regress_test_closure_variant (GClosure *closure, const GVariant* arg)
GValue return_value = {0, };
GValue arguments[1] = {{0,} };
GVariant *ret;
+ GVariant *local_arg = (GVariant*)g_memdup(arg, sizeof (GVariant*));
g_value_init (&return_value, G_TYPE_VARIANT);
g_value_init (&arguments[0], G_TYPE_VARIANT);
- g_value_set_variant (&arguments[0], arg);
+ g_value_set_variant (&arguments[0], local_arg);
g_closure_invoke (closure,
&return_value,
@@ -239,6 +240,7 @@ regress_test_closure_variant (GClosure *closure, const GVariant* arg)
ret = g_value_get_variant (&return_value);
+ g_free (local_arg);
g_value_unset (&return_value);
g_value_unset (&arguments[0]);
@@ -2610,7 +2612,7 @@ regress_test_obj_null_out (RegressTestObj **obj)
void
regress_test_array_fixed_out_objects (RegressTestObj ***objs)
{
- RegressTestObj **values = g_new(gpointer, 2);
+ RegressTestObj **values = (RegressTestObj**)g_new(gpointer, 2);
values[0] = regress_constructor();
values[1] = regress_constructor();