diff options
author | Peng Wu <alexepico@gmail.com> | 2013-06-17 14:43:40 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2013-06-17 14:43:40 +0800 |
commit | 46af45028fbb166c3a4be4239b0126db39efd2b4 (patch) | |
tree | 5fb1c4adeab50b5cd9108c0cc0536423ceb347aa | |
parent | 4f082982bcdb340b58454526da681169cee4fd9f (diff) | |
download | libpinyin-46af45028fbb166c3a4be4239b0126db39efd2b4.tar.gz libpinyin-46af45028fbb166c3a4be4239b0126db39efd2b4.tar.xz libpinyin-46af45028fbb166c3a4be4239b0126db39efd2b4.zip |
check return values
-rw-r--r-- | tests/storage/test_phrase_index_logger.cpp | 2 | ||||
-rw-r--r-- | utils/training/prune_k_mixture_model.cpp | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/tests/storage/test_phrase_index_logger.cpp b/tests/storage/test_phrase_index_logger.cpp index 74cd5af..c423c40 100644 --- a/tests/storage/test_phrase_index_logger.cpp +++ b/tests/storage/test_phrase_index_logger.cpp @@ -31,7 +31,7 @@ int main(int argc, char * argv[]){ phrase_index.load(1, chunk); PhraseIndexRange range; - phrase_index.get_range(1, range); + assert(ERROR_OK == phrase_index.get_range(1, range)); for (size_t i = range.m_range_begin; i < range.m_range_end; ++i ) { phrase_index.add_unigram_frequency(i, 1); } diff --git a/utils/training/prune_k_mixture_model.cpp b/utils/training/prune_k_mixture_model.cpp index 528d5ce..40dfb87 100644 --- a/utils/training/prune_k_mixture_model.cpp +++ b/utils/training/prune_k_mixture_model.cpp @@ -130,7 +130,11 @@ int main(int argc, char * argv[]){ bigram.attach(bigram_filename, ATTACH_READWRITE); KMixtureModelMagicHeader magic_header; - bigram.get_magic_header(magic_header); + if (!bigram.get_magic_header(magic_header)) { + fprintf(stderr, "no magic header in k mixture model.\n"); + exit(ENODATA); + } + GArray * items = g_array_new(FALSE, FALSE, sizeof(phrase_token_t)); bigram.get_all_items(items); |