From 2b6fde2addb455fd8b2e1376ced543d777bb78db Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Thu, 13 Mar 2014 09:44:36 +0800 Subject: fixes fscanf --- src/storage/chewing_large_table.cpp | 2 +- src/storage/phrase_index.cpp | 2 +- src/storage/phrase_large_table2.cpp | 2 +- src/storage/table_info.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/storage/chewing_large_table.cpp b/src/storage/chewing_large_table.cpp index 42c5204..e611dab 100644 --- a/src/storage/chewing_large_table.cpp +++ b/src/storage/chewing_large_table.cpp @@ -668,7 +668,7 @@ bool ChewingLargeTable::load_text(FILE * infile) { size_t freq; while (!feof(infile)) { - int num = fscanf(infile, "%s %s %u %ld", + int num = fscanf(infile, "%256s %256s %u %ld", pinyin, phrase, &token, &freq); if (4 != num) diff --git a/src/storage/phrase_index.cpp b/src/storage/phrase_index.cpp index cb04175..69ac938 100644 --- a/src/storage/phrase_index.cpp +++ b/src/storage/phrase_index.cpp @@ -528,7 +528,7 @@ bool FacadePhraseIndex::load_text(guint8 phrase_index, FILE * infile){ phrase_token_t cur_token = 0; while (!feof(infile)){ - int num = fscanf(infile, "%s %s %u %ld", + int num = fscanf(infile, "%256s %256s %u %ld", pinyin, phrase, &token, &freq); if (4 != num) diff --git a/src/storage/phrase_large_table2.cpp b/src/storage/phrase_large_table2.cpp index a952afe..8c2a923 100644 --- a/src/storage/phrase_large_table2.cpp +++ b/src/storage/phrase_large_table2.cpp @@ -473,7 +473,7 @@ bool PhraseLargeTable2::load_text(FILE * infile){ size_t freq; while (!feof(infile)) { - int num = fscanf(infile, "%s %s %u %ld", + int num = fscanf(infile, "%256s %256s %u %ld", pinyin, phrase, &token, &freq); if (4 != num) diff --git a/src/storage/table_info.cpp b/src/storage/table_info.cpp index d79d7be..da240dc 100644 --- a/src/storage/table_info.cpp +++ b/src/storage/table_info.cpp @@ -158,7 +158,7 @@ bool SystemTableInfo::load(const char * filename) { int index = 0; char tablefile[256], sysfile[256], userfile[256], filetype[256]; while (!feof(input)) { - num = fscanf(input, "%d %s %s %s %s\n", + num = fscanf(input, "%d %256s %256s %256s %256s\n", &index, tablefile, sysfile, userfile, filetype); if (5 != num) -- cgit