diff options
Diffstat (limited to 'utils/storage')
-rw-r--r-- | utils/storage/import_interpolation.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/utils/storage/import_interpolation.cpp b/utils/storage/import_interpolation.cpp index 6c97109..bc2da68 100644 --- a/utils/storage/import_interpolation.cpp +++ b/utils/storage/import_interpolation.cpp @@ -97,14 +97,14 @@ bool parse_unigram(FILE * input, PhraseLargeTable * phrases, do { assert(taglib_read(linebuf, line_type, values, required)); - switch(line_type) { + switch (line_type) { case GRAM_1_ITEM_LINE:{ /* handle \item in \1-gram */ const char * string = (const char *) g_ptr_array_index(values, 0); phrase_token_t token = taglib_string_to_token(phrases, string); - char * value = NULL; - assert(g_hash_table_lookup_extended(required, "count", NULL, (gpointer *)&value)); - glong count = atol(value); + gpointer value = NULL; + assert(g_hash_table_lookup_extended(required, "count", NULL, &value)); + glong count = atol((const char *)value); phrase_index->add_unigram_frequency(token, count); break; } @@ -115,7 +115,7 @@ bool parse_unigram(FILE * input, PhraseLargeTable * phrases, default: assert(false); } - } while (my_getline(input) != -1) ; + } while (my_getline(input) != -1); end: taglib_pop_state(); @@ -132,7 +132,7 @@ bool parse_bigram(FILE * input, PhraseLargeTable * phrases, phrase_token_t last_token = 0; SingleGram * last_single_gram = NULL; do { assert(taglib_read(linebuf, line_type, values, required)); - switch(line_type) { + switch (line_type) { case GRAM_2_ITEM_LINE:{ /* handle \item in \2-gram */ /* two tokens */ @@ -141,10 +141,10 @@ bool parse_bigram(FILE * input, PhraseLargeTable * phrases, string = (const char *) g_ptr_array_index(values, 1); phrase_token_t token2 = taglib_string_to_token(phrases, string); + gpointer value = NULL; /* tag: count */ - char * value = NULL; - assert(g_hash_table_lookup_extended(required, "count", NULL, (gpointer *)&value)); - glong count = atol(value); + assert(g_hash_table_lookup_extended(required, "count", NULL, &value)); + glong count = atol((char *)value); if ( last_token != token1 ) { if ( last_token && last_single_gram ) { @@ -166,7 +166,7 @@ bool parse_bigram(FILE * input, PhraseLargeTable * phrases, //save the freq guint32 total_freq = 0; assert(last_single_gram->get_total_freq(total_freq)); - last_single_gram->insert_freq(token2, count); + assert(last_single_gram->insert_freq(token2, count)); total_freq += count; assert(last_single_gram->set_total_freq(total_freq)); break; |