From 944e222f32febfb3d86dc230e84bcbc9a0ec5cf6 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Mon, 13 Feb 2012 11:25:51 +0800 Subject: [PATCH] update patches --- libpinyin-0.5.x-head.patch | 124 ------------------------------------- libpinyin-0.6.x-head.patch | 0 libpinyin.spec | 2 +- 3 files changed, 1 insertion(+), 125 deletions(-) delete mode 100644 libpinyin-0.5.x-head.patch create mode 100644 libpinyin-0.6.x-head.patch diff --git a/libpinyin-0.5.x-head.patch b/libpinyin-0.5.x-head.patch deleted file mode 100644 index 963ad1e..0000000 --- a/libpinyin-0.5.x-head.patch +++ /dev/null @@ -1,124 +0,0 @@ -From b54a7e1600ba00d9886a0d17b0f923e40cf9672c Mon Sep 17 00:00:00 2001 -From: Peng Wu -Date: Sun, 29 Jan 2012 10:26:17 +0800 -Subject: [PATCH 1/3] fixes pinyin parsers - ---- - src/storage/pinyin_parser2.cpp | 4 +++- - 1 files changed, 3 insertions(+), 1 deletions(-) - -diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp -index deef306..4ab36aa 100644 ---- a/src/storage/pinyin_parser2.cpp -+++ b/src/storage/pinyin_parser2.cpp -@@ -526,6 +526,7 @@ bool FullPinyinParser2::post_process(pinyin_option_t options, - bool DoublePinyinParser2::parse_one_key(pinyin_option_t options, - ChewingKey & key, - const char *str, int len) const { -+ options &= ~(PINYIN_CORRECT_ALL|PINYIN_AMB_ALL); - - if (1 == len) { - if (!(options & PINYIN_INCOMPLETE)) -@@ -548,7 +549,7 @@ bool DoublePinyinParser2::parse_one_key(pinyin_option_t options, - } - - ChewingTone tone = CHEWING_ZERO_TONE; -- options &= ~(PINYIN_CORRECT_ALL|PINYIN_AMB_ALL); -+ options &= ~(PINYIN_INCOMPLETE|CHEWING_INCOMPLETE); - - /* parse tone */ - if (3 == len) { -@@ -718,6 +719,7 @@ static bool search_chewing_tones(const chewing_tone_item_t * tone_table, - bool ChewingParser2::parse_one_key(pinyin_option_t options, - ChewingKey & key, - const char *str, int len) const { -+ options &= ~(PINYIN_CORRECT_ALL|PINYIN_AMB_ALL); - char tone = CHEWING_ZERO_TONE; - - int symbols_len = len; --- -1.7.7.5 - - -From 06668708392d044b0656b5f8e7569c71c169fb16 Mon Sep 17 00:00:00 2001 -From: Peng Wu -Date: Sun, 29 Jan 2012 11:06:48 +0800 -Subject: [PATCH 2/3] fixes parse one key - ---- - src/storage/pinyin_parser2.cpp | 6 ++++++ - 1 files changed, 6 insertions(+), 0 deletions(-) - -diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp -index 4ab36aa..0437440 100644 ---- a/src/storage/pinyin_parser2.cpp -+++ b/src/storage/pinyin_parser2.cpp -@@ -582,6 +582,9 @@ bool DoublePinyinParser2::parse_one_key(pinyin_option_t options, - charid = ch == ';' ? 26 : ch - 'a'; - /* first yunmu */ - const char * yun = m_yunmu_table[charid].m_yunmus[0]; -+ if (NULL == yun) -+ return false; -+ - gchar * pinyin = g_strdup_printf("%s%s", sheng, yun); - if (search_pinyin_index(options, pinyin, key)) { - key.m_tone = tone; -@@ -592,6 +595,9 @@ bool DoublePinyinParser2::parse_one_key(pinyin_option_t options, - - /* second yunmu */ - yun = m_yunmu_table[charid].m_yunmus[1]; -+ if (NULL == yun) -+ return false; -+ - pinyin = g_strdup_printf("%s%s", sheng, yun); - if (search_pinyin_index(options, pinyin, key)) { - key.m_tone = tone; --- -1.7.7.5 - - -From 741f495134ac477631126358f204034507f1d5f3 Mon Sep 17 00:00:00 2001 -From: Peng Wu -Date: Sun, 29 Jan 2012 13:17:33 +0800 -Subject: [PATCH 3/3] fixes post process in full pinyin parser - ---- - src/storage/pinyin_parser2.cpp | 14 ++++++-------- - 1 files changed, 6 insertions(+), 8 deletions(-) - -diff --git a/src/storage/pinyin_parser2.cpp b/src/storage/pinyin_parser2.cpp -index 0437440..ab8330c 100644 ---- a/src/storage/pinyin_parser2.cpp -+++ b/src/storage/pinyin_parser2.cpp -@@ -464,22 +464,20 @@ bool FullPinyinParser2::post_process(pinyin_option_t options, - guint16 next_tone = CHEWING_ZERO_TONE; - - for (i = 0; i < num_keys - 1; ++i) { -- cur_key = &g_array_index(keys, ChewingKey, i); -- next_key = &g_array_index(keys, ChewingKey, i + 1); -+ cur_rest = &g_array_index(key_rests, ChewingKeyRest, i); -+ next_rest = &g_array_index(key_rests, ChewingKeyRest, i + 1); - - /* some "'" here */ -- if (0 == cur_key->get_table_index()) -- continue; -- if (0 == next_key->get_table_index()) -+ if (cur_rest->m_raw_end != next_rest->m_raw_begin) - continue; - -+ cur_key = &g_array_index(keys, ChewingKey, i); -+ next_key = &g_array_index(keys, ChewingKey, i + 1); -+ - /* some tone here */ - if (CHEWING_ZERO_TONE != cur_key->m_tone) - continue; - -- cur_rest = &g_array_index(key_rests, ChewingKeyRest, i); -- next_rest = &g_array_index(key_rests, ChewingKeyRest, i + 1); -- - if (options & USE_TONE) { - next_tone = next_key->m_tone; - next_key->m_tone = CHEWING_ZERO_TONE; --- -1.7.7.5 - diff --git a/libpinyin-0.6.x-head.patch b/libpinyin-0.6.x-head.patch new file mode 100644 index 0000000..e69de29 diff --git a/libpinyin.spec b/libpinyin.spec index 74c41f4..e9bc5ca 100644 --- a/libpinyin.spec +++ b/libpinyin.spec @@ -6,7 +6,7 @@ Summary: Library to deal with pinyin License: GPLv2+ URL: https://github.com/libpinyin/libpinyin Source0: https://github.com/downloads/libpinyin/libpinyin/%{name}-%{version}.tar.gz -Patch0: libpinyin-0.5.x-head.patch +Patch0: libpinyin-0.6.x-head.patch BuildRequires: db4-devel, glib2-devel Requires: %{name}-data = %{version}-%{release}