summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2018-01-25 12:58:23 +0800
committerPeng Wu <alexepico@gmail.com>2018-01-25 12:58:23 +0800
commitff713df50634fd5a2d3e5fd64fe5c57eb45b2b7a (patch)
tree08a7db240980ab6a8ad99cd523b2bfea72095dea
parent011d3bc3f4f956eac98e98aeb284ef9b085eae19 (diff)
downloadlibpinyin-ff713df50634fd5a2d3e5fd64fe5c57eb45b2b7a.zip
libpinyin-ff713df50634fd5a2d3e5fd64fe5c57eb45b2b7a.tar.gz
libpinyin-ff713df50634fd5a2d3e5fd64fe5c57eb45b2b7a.tar.xz
fixes fscanf usage
-rw-r--r--src/storage/chewing_large_table.cpp2
-rw-r--r--src/storage/chewing_large_table2.cpp2
-rw-r--r--src/storage/phrase_index.cpp2
-rw-r--r--src/storage/phrase_large_table2.cpp2
-rw-r--r--src/storage/phrase_large_table3.cpp2
-rw-r--r--src/storage/table_info.cpp4
-rw-r--r--utils/storage/gen_pinyin_table.cpp2
7 files changed, 8 insertions, 8 deletions
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);
diff --git a/utils/storage/gen_pinyin_table.cpp b/utils/storage/gen_pinyin_table.cpp
index bf0c73b..df3cafa 100644
--- a/utils/storage/gen_pinyin_table.cpp
+++ b/utils/storage/gen_pinyin_table.cpp
@@ -142,7 +142,7 @@ void feed_file ( const char * filename){
}
while ( !feof(infile)){
- int num = fscanf(infile, "%1024s %1024s %u",
+ int num = fscanf(infile, "%1023s %1023s %u",
phrase, pinyin, &freq);
if (3 != num)