summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2014-03-13 09:40:48 +0800
committerPeng Wu <alexepico@gmail.com>2014-03-13 09:40:48 +0800
commit6a3fd302f0ca63ce02cda81950987fa0cdbea610 (patch)
tree4b7c9937188efc0dc1e923dc61ae7611e073162c
parent740f54eed08e34348b377a33719368a05328e8fa (diff)
downloadlibpinyin-6a3fd302f0ca63ce02cda81950987fa0cdbea610.tar.gz
libpinyin-6a3fd302f0ca63ce02cda81950987fa0cdbea610.tar.xz
libpinyin-6a3fd302f0ca63ce02cda81950987fa0cdbea610.zip
fixes fscanf
-rw-r--r--src/storage/chewing_large_table.cpp2
-rw-r--r--src/storage/phrase_index.cpp2
-rw-r--r--src/storage/phrase_large_table2.cpp2
-rw-r--r--src/storage/table_info.cpp2
-rw-r--r--utils/storage/gen_pinyin_table.cpp2
5 files changed, 5 insertions, 5 deletions
diff --git a/src/storage/chewing_large_table.cpp b/src/storage/chewing_large_table.cpp
index 83c3ccf..5e5bdd8 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 5fe61c2..cdec42d 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 f7d8ae2..c7df3ae 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 63af8e0..6d1159a 100644
--- a/src/storage/table_info.cpp
+++ b/src/storage/table_info.cpp
@@ -162,7 +162,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)
diff --git a/utils/storage/gen_pinyin_table.cpp b/utils/storage/gen_pinyin_table.cpp
index 3b541d1..d900e74 100644
--- a/utils/storage/gen_pinyin_table.cpp
+++ b/utils/storage/gen_pinyin_table.cpp
@@ -143,7 +143,7 @@ void feed_file ( const char * filename){
}
while ( !feof(infile)){
- int num = fscanf(infile, "%s %s %u",
+ int num = fscanf(infile, "%1024s %1024s %u",
phrase, pinyin, &freq);
if (3 != num)