summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-04-01 17:49:41 +0800
committerPeng Wu <alexepico@gmail.com>2013-04-01 17:49:41 +0800
commitdd31367bdfdc250a628a71592e05846302766ddd (patch)
tree7a2a9e523451fe0bf85fdcbc2d2da0a747c26f1b
parent7327a0e4c3ac1b022ea6896ac890312912eea562 (diff)
downloadlibpinyin-dd31367bdfdc250a628a71592e05846302766ddd.tar.gz
libpinyin-dd31367bdfdc250a628a71592e05846302766ddd.tar.xz
libpinyin-dd31367bdfdc250a628a71592e05846302766ddd.zip
polish code
-rw-r--r--tests/storage/test_parser2.cpp13
-rw-r--r--utils/storage/gen_pinyin_table.cpp2
2 files changed, 7 insertions, 8 deletions
diff --git a/tests/storage/test_parser2.cpp b/tests/storage/test_parser2.cpp
index cc330e9..638cd96 100644
--- a/tests/storage/test_parser2.cpp
+++ b/tests/storage/test_parser2.cpp
@@ -52,13 +52,6 @@ using namespace pinyin;
int main(int argc, char * argv[]) {
- PinyinParser2 * parser = NULL;
- ChewingKeyVector keys = g_array_new(FALSE, FALSE, sizeof(ChewingKey));
- ChewingKeyRestVector key_rests =
- g_array_new(FALSE, FALSE, sizeof(ChewingKeyRest));
-
- pinyin_option_t options = PINYIN_CORRECT_ALL | USE_TONE | USE_RESPLIT_TABLE;
-
GError * error = NULL;
GOptionContext * context;
@@ -69,9 +62,15 @@ int main(int argc, char * argv[]) {
exit(EINVAL);
}
+ pinyin_option_t options = PINYIN_CORRECT_ALL | USE_TONE | USE_RESPLIT_TABLE;
if (incomplete)
options |= PINYIN_INCOMPLETE | CHEWING_INCOMPLETE;
+ PinyinParser2 * parser = NULL;
+ ChewingKeyVector keys = g_array_new(FALSE, FALSE, sizeof(ChewingKey));
+ ChewingKeyRestVector key_rests =
+ g_array_new(FALSE, FALSE, sizeof(ChewingKeyRest));
+
/* create the parser */
if (strcmp("fullpinyin", parsername) == 0) {
parser = new FullPinyinParser2();
diff --git a/utils/storage/gen_pinyin_table.cpp b/utils/storage/gen_pinyin_table.cpp
index 42c68cb..8020e22 100644
--- a/utils/storage/gen_pinyin_table.cpp
+++ b/utils/storage/gen_pinyin_table.cpp
@@ -24,8 +24,8 @@
#include <glib.h>
#include "pinyin_internal.h"
-static const gchar * outputfile = "temp.out";
static gint phrase_index = 0;
+static const gchar * outputfile = "temp.out";
static GOptionEntry entries[] =
{