summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2016-07-20 12:25:39 +0800
committerPeng Wu <alexepico@gmail.com>2016-07-20 12:25:39 +0800
commit5b5e43db425969d28082e904947b5eb5b5039c31 (patch)
treef0f8778604526970705a7d2ca68a3f0125e9bbae /src
parent049b282689790b23efd95d9ae7ecbe5b30aba4e0 (diff)
downloadibus-libpinyin-5b5e43db425969d28082e904947b5eb5b5039c31.tar.gz
ibus-libpinyin-5b5e43db425969d28082e904947b5eb5b5039c31.tar.xz
ibus-libpinyin-5b5e43db425969d28082e904947b5eb5b5039c31.zip
update pinyin_get_character_offset call
Diffstat (limited to 'src')
-rw-r--r--src/PYPBopomofoEditor.cc17
-rw-r--r--src/PYPPinyinEditor.cc17
2 files changed, 18 insertions, 16 deletions
diff --git a/src/PYPBopomofoEditor.cc b/src/PYPBopomofoEditor.cc
index fd688ad..8d49614 100644
--- a/src/PYPBopomofoEditor.cc
+++ b/src/PYPBopomofoEditor.cc
@@ -310,16 +310,14 @@ BopomofoEditor::updatePreeditText ()
}
m_buffer.clear ();
- char *tmp = NULL;
- pinyin_get_sentence(m_instance, &tmp);
- if (tmp) {
+ char *sentence = NULL;
+ pinyin_get_sentence(m_instance, &sentence);
+ if (sentence) {
if (m_props.modeSimp ()) {
- m_buffer<<tmp;
+ m_buffer<<sentence;
} else {
- SimpTradConverter::simpToTrad (tmp, m_buffer);
+ SimpTradConverter::simpToTrad (sentence, m_buffer);
}
- g_free (tmp);
- tmp = NULL;
}
/* append rest text */
@@ -332,8 +330,11 @@ BopomofoEditor::updatePreeditText ()
size_t offset = 0;
guint cursor = getPinyinCursor ();
- pinyin_get_character_offset(m_instance, cursor, &offset);
+ pinyin_get_character_offset(m_instance, sentence, cursor, &offset);
Editor::updatePreeditText (preedit_text, offset, TRUE);
+
+ if (sentence)
+ g_free (sentence);
}
void
diff --git a/src/PYPPinyinEditor.cc b/src/PYPPinyinEditor.cc
index 2e614f2..b7ab8c3 100644
--- a/src/PYPPinyinEditor.cc
+++ b/src/PYPPinyinEditor.cc
@@ -246,16 +246,14 @@ PinyinEditor::updatePreeditText ()
}
m_buffer.clear ();
- char *tmp = NULL;
- pinyin_get_sentence (m_instance, &tmp);
- if (tmp) {
+ char *sentence = NULL;
+ pinyin_get_sentence (m_instance, &sentence);
+ if (sentence) {
if (m_props.modeSimp ()) {
- m_buffer<<tmp;
+ m_buffer<<sentence;
} else {
- SimpTradConverter::simpToTrad (tmp, m_buffer);
+ SimpTradConverter::simpToTrad (sentence, m_buffer);
}
- g_free (tmp);
- tmp = NULL;
}
/* append rest text */
@@ -268,8 +266,11 @@ PinyinEditor::updatePreeditText ()
size_t offset = 0;
guint cursor = getPinyinCursor ();
- pinyin_get_character_offset(m_instance, cursor, &offset);
+ pinyin_get_character_offset(m_instance, sentence, cursor, &offset);
Editor::updatePreeditText (preedit_text, offset, TRUE);
+
+ if (sentence)
+ g_free (sentence);
}
#if 0