#include <stdio.h>
#include <assert.h>
#include <string.h>
+#include <errno.h>
//#define DEBUG
#include "debug.h"
#define UNASSIGNED 3U
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: ");
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;
#include <stdio.h>
#include <assert.h>
#include <string.h>
+#include <errno.h>
//#define DEBUG
#include "debug.h"
#define UNASSIGNED 3
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: ");
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;
}
#include <stdio.h>
#include <assert.h>
#include <string.h>
+#include <errno.h>
//#define DEBUG
#include "debug.h"
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: ");
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]);
#include <stdio.h>
#include <assert.h>
#include <string.h>
+#include <errno.h>
//#define DEBUG
#include "debug.h"
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]);
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]);
#include <stdio.h>
#include <assert.h>
#include <string.h>
+#include <errno.h>
#define MAX_BUCKET_SIZE 255
//#define DEBUG
#include "debug.h"
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 *));
// 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;
}
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;
}
#include<time.h>
#include<assert.h>
#include<limits.h>
+#include<errno.h>
#include "cmph_structs.h"
#include "chd_structs.h"
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)
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;
}
#include<time.h>
#include<assert.h>
#include<limits.h>
+#include<errno.h>
#include "cmph_structs.h"
#include "chd_structs_ph.h"
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)
// 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;
}
#include <stdio.h>
#include <assert.h>
#include <string.h>
+#include <errno.h>
//#define DEBUG
#include "debug.h"
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]);
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]);
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;
#include "cmph_structs.h"
#include <string.h>
+#include <errno.h>
//#define DEBUG
#include "debug.h"
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)
{
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;
}
#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"
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: ");
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: ");
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);
{
Header *header;
const gchar *namespace;
- const gchar *version;
g_return_val_if_fail (typelib != NULL, FALSE);
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)
{
{
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);
static int
_callback (int val, void *user_data)
{
- g_assert(user_data == 0xdeadbeef);
+ g_assert((int)user_data == (int)0xdeadbeef);
return val;
}
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,
ret = g_value_get_variant (&return_value);
+ g_free (local_arg);
g_value_unset (&return_value);
g_value_unset (&arguments[0]);
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();