1
Fork 0
Davi de Castro Reis 2018-12-28 00:51:37 -02:00
parent 9209046797
commit d233b4943f
5 changed files with 8 additions and 8 deletions

View File

@ -19,7 +19,7 @@ int main(int argc, char **argv)
{7, "gggggggggg", 2005}, {8, "hhhhhhhhhh", 2006}, {9, "iiiiiiiiii", 2007},
{10,"jjjjjjjjjj", 2008}};
unsigned int nkeys = 10;
FILE* mphf_fd = fopen("temp_struct_vector.mph", "w");
FILE* mphf_fd = fopen("temp_struct_vector.mph", "wb");
// Source of keys
cmph_io_adapter_t *source = cmph_io_struct_vector_adapter(vector, (cmph_uint32)sizeof(rec_t), (cmph_uint32)sizeof(cmph_uint32), 11, nkeys);
@ -34,7 +34,7 @@ int main(int argc, char **argv)
fclose(mphf_fd);
//Find key
mphf_fd = fopen("temp_struct_vector.mph", "r");
mphf_fd = fopen("temp_struct_vector.mph", "rb");
hash = cmph_load(mphf_fd);
while (i < nkeys) {
const char *key = vector[i].key;

View File

@ -9,7 +9,7 @@ int main(int argc, char **argv)
const char *vector[] = {"aaaaaaaaaa", "bbbbbbbbbb", "cccccccccc", "dddddddddd", "eeeeeeeeee",
"ffffffffff", "gggggggggg", "hhhhhhhhhh", "iiiiiiiiii", "jjjjjjjjjj"};
unsigned int nkeys = 10;
FILE* mphf_fd = fopen("temp.mph", "w");
FILE* mphf_fd = fopen("temp.mph", "wb");
// Source of keys
cmph_io_adapter_t *source = cmph_io_vector_adapter((char **)vector, nkeys);
@ -24,7 +24,7 @@ int main(int argc, char **argv)
fclose(mphf_fd);
//Find key
mphf_fd = fopen("temp.mph", "r");
mphf_fd = fopen("temp.mph", "rb");
hash = cmph_load(mphf_fd);
while (i < nkeys) {
const char *key = vector[i];

View File

@ -248,7 +248,7 @@ int main(int argc, char **argv)
if (generate)
{
//Create mphf
mphf_fd = fopen(mphf_file, "w");
mphf_fd = fopen(mphf_file, "wb");
config = cmph_config_new(source);
cmph_config_set_algo(config, mph_algo);
if (nhashes) cmph_config_set_hashfuncs(config, hashes);
@ -286,7 +286,7 @@ int main(int argc, char **argv)
else
{
cmph_uint8 * hashtable = NULL;
mphf_fd = fopen(mphf_file, "r");
mphf_fd = fopen(mphf_file, "rb");
if (mphf_fd == NULL)
{
fprintf(stderr, "Unable to open input file %s: %s\n", mphf_file, strerror(errno));

View File

@ -107,7 +107,7 @@ int main(int argc, char **argv)
else source = cmph_io_nlnkfile_adapter(keys_fd, nkeys);
cmph_uint8 * hashtable = NULL;
mphf_fd = fopen(mphf_file, "r");
mphf_fd = fopen(mphf_file, "rb");
if (mphf_fd == NULL)
{
fprintf(stderr, "Unable to open input file %s: %s\n", mphf_file, strerror(errno));

View File

@ -122,7 +122,7 @@ int main(int argc, char **argv)
else source = cmph_io_nlnkfile_adapter(keys_fd, nkeys);
cmph_uint8 * hashtable = NULL;
mphf_fd = fopen(mphf_file, "r");
mphf_fd = fopen(mphf_file, "rb");
if (mphf_fd == NULL)
{
fprintf(stderr, "Unable to open input file %s: %s\n", mphf_file, strerror(errno));