*** empty log message ***

This commit is contained in:
fc_botelho
2008-04-12 06:17:21 +00:00
parent 44e343a040
commit b8d4392b85
39 changed files with 359 additions and 336 deletions

View File

@@ -50,7 +50,7 @@ void chm_config_set_hashfuncs(cmph_config_t *mph, CMPH_HASH *hashfuncs)
}
}
cmph_t *chm_new(cmph_config_t *mph, float c)
cmph_t *chm_new(cmph_config_t *mph, double c)
{
cmph_t *mphf = NULL;
chm_data_t *chmf = NULL;
@@ -107,8 +107,8 @@ cmph_t *chm_new(cmph_config_t *mph, float c)
fprintf(stderr, "Starting assignment step\n");
}
DEBUGP("Assignment step\n");
visited = (cmph_uint8 *)malloc(chm->n/8 + 1);
memset(visited, 0, chm->n/8 + 1);
visited = (cmph_uint8 *)malloc((size_t)(chm->n/8 + 1));
memset(visited, 0, (size_t)(chm->n/8 + 1));
free(chm->g);
chm->g = (cmph_uint32 *)malloc(chm->n * sizeof(cmph_uint32));
assert(chm->g);
@@ -206,23 +206,23 @@ int chm_dump(cmph_t *mphf, FILE *fd)
chm_data_t *data = (chm_data_t *)mphf->data;
__cmph_dump(mphf, fd);
fwrite(&two, sizeof(cmph_uint32), 1, fd);
fwrite(&two, sizeof(cmph_uint32), (size_t)1, fd);
hash_state_dump(data->hashes[0], &buf, &buflen);
DEBUGP("Dumping hash state with %u bytes to disk\n", buflen);
fwrite(&buflen, sizeof(cmph_uint32), 1, fd);
fwrite(buf, buflen, 1, fd);
fwrite(&buflen, sizeof(cmph_uint32), (size_t)1, fd);
fwrite(buf, (size_t)buflen, (size_t)1, fd);
free(buf);
hash_state_dump(data->hashes[1], &buf, &buflen);
DEBUGP("Dumping hash state with %u bytes to disk\n", buflen);
fwrite(&buflen, sizeof(cmph_uint32), 1, fd);
fwrite(buf, buflen, 1, fd);
fwrite(&buflen, sizeof(cmph_uint32), (size_t)1, fd);
fwrite(buf, (size_t)buflen, (size_t)1, fd);
free(buf);
fwrite(&(data->n), sizeof(cmph_uint32), 1, fd);
fwrite(&(data->m), sizeof(cmph_uint32), 1, fd);
fwrite(&(data->n), sizeof(cmph_uint32), (size_t)1, fd);
fwrite(&(data->m), sizeof(cmph_uint32), (size_t)1, fd);
fwrite(data->g, sizeof(cmph_uint32)*data->n, 1, fd);
fwrite(data->g, sizeof(cmph_uint32)*data->n, (size_t)1, fd);
#ifdef DEBUG
fprintf(stderr, "G: ");
for (i = 0; i < data->n; ++i) fprintf(stderr, "%u ", data->g[i]);
@@ -241,28 +241,28 @@ void chm_load(FILE *f, cmph_t *mphf)
DEBUGP("Loading chm mphf\n");
mphf->data = chm;
fread(&nhashes, sizeof(cmph_uint32), 1, f);
fread(&nhashes, sizeof(cmph_uint32), (size_t)1, f);
chm->hashes = (hash_state_t **)malloc(sizeof(hash_state_t *)*(nhashes + 1));
chm->hashes[nhashes] = NULL;
DEBUGP("Reading %u hashes\n", nhashes);
for (i = 0; i < nhashes; ++i)
{
hash_state_t *state = NULL;
fread(&buflen, sizeof(cmph_uint32), 1, f);
fread(&buflen, sizeof(cmph_uint32), (size_t)1, f);
DEBUGP("Hash state has %u bytes\n", buflen);
buf = (char *)malloc(buflen);
fread(buf, buflen, 1, f);
buf = (char *)malloc((size_t)buflen);
fread(buf, (size_t)buflen, (size_t)1, f);
state = hash_state_load(buf, buflen);
chm->hashes[i] = state;
free(buf);
}
DEBUGP("Reading m and n\n");
fread(&(chm->n), sizeof(cmph_uint32), 1, f);
fread(&(chm->m), sizeof(cmph_uint32), 1, f);
fread(&(chm->n), sizeof(cmph_uint32), (size_t)1, f);
fread(&(chm->m), sizeof(cmph_uint32), (size_t)1, f);
chm->g = (cmph_uint32 *)malloc(sizeof(cmph_uint32)*chm->n);
fread(chm->g, chm->n*sizeof(cmph_uint32), 1, f);
fread(chm->g, chm->n*sizeof(cmph_uint32), (size_t)1, f);
#ifdef DEBUG
fprintf(stderr, "G: ");
for (i = 0; i < chm->n; ++i) fprintf(stderr, "%u ", chm->g[i]);