summaryrefslogtreecommitdiffstats
path: root/src/storage/phrase_large_table2.cpp
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-06-17 13:45:56 +0800
committerPeng Wu <alexepico@gmail.com>2013-06-17 13:51:20 +0800
commitfff35792df8d7ae0e65a20b2e507f7fabbd8becb (patch)
treef539e57fb0bc4288bf43f38dff8fb341a68da271 /src/storage/phrase_large_table2.cpp
parent959bfefcb2a7829231b207c34ab76353f4ad41e5 (diff)
downloadlibpinyin-fff35792df8d7ae0e65a20b2e507f7fabbd8becb.tar.gz
libpinyin-fff35792df8d7ae0e65a20b2e507f7fabbd8becb.tar.xz
libpinyin-fff35792df8d7ae0e65a20b2e507f7fabbd8becb.zip
fixes load_text
Diffstat (limited to 'src/storage/phrase_large_table2.cpp')
-rw-r--r--src/storage/phrase_large_table2.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/storage/phrase_large_table2.cpp b/src/storage/phrase_large_table2.cpp
index fadbbe3..f7d8ae2 100644
--- a/src/storage/phrase_large_table2.cpp
+++ b/src/storage/phrase_large_table2.cpp
@@ -472,13 +472,14 @@ bool PhraseLargeTable2::load_text(FILE * infile){
phrase_token_t token;
size_t freq;
- while ( !feof(infile) ) {
- fscanf(infile, "%s", pinyin);
- fscanf(infile, "%s", phrase);
- fscanf(infile, "%u", &token);
- fscanf(infile, "%ld", &freq);
+ while (!feof(infile)) {
+ int num = fscanf(infile, "%s %s %u %ld",
+ pinyin, phrase, &token, &freq);
- if ( feof(infile) )
+ if (4 != num)
+ continue;
+
+ if (feof(infile))
break;
glong phrase_len = g_utf8_strlen(phrase, -1);