Update to 1.6.0

This commit is contained in:
Peng Wu 2016-09-07 13:31:16 +08:00
parent 6f44b17c38
commit 69b980510d
4 changed files with 8 additions and 66 deletions

1
.gitignore vendored
View File

@ -33,3 +33,4 @@
/libpinyin-1.3.0.tar.gz
/libpinyin-1.5.91.tar.gz
/libpinyin-1.5.92.tar.gz
/libpinyin-1.6.0.tar.gz

View File

@ -1,62 +0,0 @@
diff --git a/src/pinyin.cpp b/src/pinyin.cpp
index ac72623..29c4c8c 100644
--- a/src/pinyin.cpp
+++ b/src/pinyin.cpp
@@ -2488,9 +2488,6 @@ static bool _get_char_offset_recur(pinyin_instance_t * instance,
const size_t newstart = key_rest.m_raw_end;
- if (newstart > offset)
- return true;
-
const ChewingKey zero_key;
if (zero_key == key) {
/* assume only one key here for "'" or the last key. */
@@ -2506,7 +2503,10 @@ static bool _get_char_offset_recur(pinyin_instance_t * instance,
gfloat pinyin_poss = item.get_pronunciation_possibility(&key);
if (pinyin_poss < FLT_EPSILON)
- return false;
+ continue;
+
+ if (newstart > offset)
+ return true;
++length;
@@ -2530,6 +2530,9 @@ bool pinyin_get_character_offset(pinyin_instance_t * instance,
pinyin_context_t * context = instance->m_context;
PhoneticKeyMatrix & matrix = instance->m_matrix;
+ if (0 == matrix.size())
+ return false;
+
assert(offset < matrix.size());
_check_offset(matrix, offset);
@@ -2973,7 +2976,7 @@ static bool _remember_phrase_recur(pinyin_instance_t * instance,
gfloat pinyin_poss = item.get_pronunciation_possibility(&key);
if (pinyin_poss < FLT_EPSILON)
- return false;
+ continue;
/* push value */
g_array_append_val(cached_keys, key);
diff --git a/src/storage/phonetic_key_matrix.cpp b/src/storage/phonetic_key_matrix.cpp
index 8f8bd4a..da8d06f 100644
--- a/src/storage/phonetic_key_matrix.cpp
+++ b/src/storage/phonetic_key_matrix.cpp
@@ -497,8 +497,10 @@ gfloat compute_pronunciation_possibility(PhoneticKeyMatrix * matrix,
PhraseItem & item){
assert(end < matrix->size());
- assert(matrix->get_column_size(start) > 0);
- assert(matrix->get_column_size(end) > 0);
+ if(matrix->get_column_size(start) <= 0)
+ return 0.;
+ if(matrix->get_column_size(end) <= 0)
+ return 0.;
g_array_set_size(cached_keys, 0);
return compute_pronunciation_possibility_recur

View File

@ -1,8 +1,8 @@
%global snapshot 1
%global snapshot 0
Name: libpinyin
Version: 1.5.92
Release: 3%{?dist}
Version: 1.6.0
Release: 1%{?dist}
Summary: Library to deal with pinyin
License: GPLv2+
@ -92,6 +92,9 @@ find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
%changelog
* Wed Sep 7 2016 Peng Wu <pwu@redhat.com> - 1.6.0-1
- Update to 1.6.0
* Mon Aug 15 2016 Peng Wu <pwu@redhat.com> - 1.5.92-3
- Fixes crashes again

View File

@ -1 +1 @@
ce56289e833d493c8285300c87511855 libpinyin-1.5.92.tar.gz
27416347b6903a9d5b7bf36002825a72 libpinyin-1.6.0.tar.gz