From ff713df50634fd5a2d3e5fd64fe5c57eb45b2b7a Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Thu, 25 Jan 2018 12:58:23 +0800 Subject: fixes fscanf usage --- src/storage/chewing_large_table.cpp | 2 +- src/storage/chewing_large_table2.cpp | 2 +- src/storage/phrase_index.cpp | 2 +- src/storage/phrase_large_table2.cpp | 2 +- src/storage/phrase_large_table3.cpp | 2 +- src/storage/table_info.cpp | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/storage/chewing_large_table.cpp b/src/storage/chewing_large_table.cpp index 8521588..5716c5c 100644 --- a/src/storage/chewing_large_table.cpp +++ b/src/storage/chewing_large_table.cpp @@ -669,7 +669,7 @@ bool ChewingLargeTable::load_text(FILE * infile, TABLE_PHONETIC_TYPE type) { size_t freq; while (!feof(infile)) { - int num = fscanf(infile, "%256s %256s %u %ld", + int num = fscanf(infile, "%255s %255s %u %ld", pinyin, phrase, &token, &freq); if (4 != num) diff --git a/src/storage/chewing_large_table2.cpp b/src/storage/chewing_large_table2.cpp index aa34399..c8f9b06 100644 --- a/src/storage/chewing_large_table2.cpp +++ b/src/storage/chewing_large_table2.cpp @@ -115,7 +115,7 @@ bool ChewingLargeTable2::load_text(FILE * infile, TABLE_PHONETIC_TYPE type) { size_t freq; while (!feof(infile)) { - int num = fscanf(infile, "%256s %256s %u %ld", + int num = fscanf(infile, "%255s %255s %u %ld", pinyin, phrase, &token, &freq); if (4 != num) diff --git a/src/storage/phrase_index.cpp b/src/storage/phrase_index.cpp index c4a7286..06b613f 100644 --- a/src/storage/phrase_index.cpp +++ b/src/storage/phrase_index.cpp @@ -527,7 +527,7 @@ bool FacadePhraseIndex::load_text(guint8 phrase_index, FILE * infile, phrase_token_t cur_token = 0; while (!feof(infile)){ - int num = fscanf(infile, "%256s %256s %u %ld", + int num = fscanf(infile, "%255s %255s %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 0aa6b95..38dafb3 100644 --- a/src/storage/phrase_large_table2.cpp +++ b/src/storage/phrase_large_table2.cpp @@ -472,7 +472,7 @@ bool PhraseLargeTable2::load_text(FILE * infile){ size_t freq; while (!feof(infile)) { - int num = fscanf(infile, "%256s %256s %u %ld", + int num = fscanf(infile, "%255s %255s %u %ld", pinyin, phrase, &token, &freq); if (4 != num) diff --git a/src/storage/phrase_large_table3.cpp b/src/storage/phrase_large_table3.cpp index 37e338b..696c612 100644 --- a/src/storage/phrase_large_table3.cpp +++ b/src/storage/phrase_large_table3.cpp @@ -128,7 +128,7 @@ bool PhraseLargeTable3::load_text(FILE * infile){ size_t freq; while (!feof(infile)) { - int num = fscanf(infile, "%256s %256s %u %ld", + int num = fscanf(infile, "%255s %255s %u %ld", pinyin, phrase, &token, &freq); if (4 != num) diff --git a/src/storage/table_info.cpp b/src/storage/table_info.cpp index bd9b03f..9fe3865 100644 --- a/src/storage/table_info.cpp +++ b/src/storage/table_info.cpp @@ -196,7 +196,7 @@ bool SystemTableInfo2::load(const char * filename) { TABLE_PHONETIC_TYPE type = PINYIN_TABLE; char str[256]; - num = fscanf(input, "source table format:%256s", str); + num = fscanf(input, "source table format:%255s", str); type = to_table_phonetic_type(str); #if 0 @@ -216,7 +216,7 @@ bool SystemTableInfo2::load(const char * filename) { char tableinfo[256], dictstr[256]; char tablefile[256], sysfile[256], userfile[256], filetype[256]; while (!feof(input)) { - num = fscanf(input, "%256s %256s %256s %256s %256s %256s\n", + num = fscanf(input, "%255s %255s %255s %255s %255s %255s\n", tableinfo, dictstr, tablefile, sysfile, userfile, filetype); -- cgit