Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package libchewing for openSUSE:Factory 
checked in at 2021-09-30 23:43:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libchewing (Old)
 and      /work/SRC/openSUSE:Factory/.libchewing.new.2443 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libchewing"

Thu Sep 30 23:43:38 2021 rev:35 rq:922316 version:0.5.1+git20200627.452f622

Changes:
--------
--- /work/SRC/openSUSE:Factory/libchewing/libchewing.changes    2019-08-24 
18:45:56.241760013 +0200
+++ /work/SRC/openSUSE:Factory/.libchewing.new.2443/libchewing.changes  
2021-09-30 23:44:56.816575970 +0200
@@ -1,0 +2,22 @@
+Wed Sep 29 21:35:52 UTC 2021 - mc...@suse.com
+
+- Update to version 0.5.1+git20200627.452f622:
+  * chewing.py supports platforms with 64bit pointer
+  * Change ??? to ???
+  * Don't run tests in parallel
+  * Try Ubuntu 16.04 Xenial
+  * autotools: Build with -fPIC like the CMake-based one does
+  * Show compilation commands if the build system is autotools
+  * Tolerate unused const warnings
+  * Fix LSan
+  * Use internal-sqlite instead of static-sqlite, following 570ab6be
+
+-------------------------------------------------------------------
+Fri Sep 24 07:52:19 UTC 2021 - Steve Kowalik <steven.kowa...@suse.com>
+
+- Remove unneeded BuildRequires on python-devel, and the conflicting
+  old py_* macros. 
+- Remove references to "Python 2", the module supports Python 3.
+- Mark COPYING as license.
+
+-------------------------------------------------------------------

Old:
----
  libchewing-0.5.1+git20171114.3df07c9.tar.xz

New:
----
  _servicedata
  libchewing-0.5.1+git20200627.452f622.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libchewing.spec ++++++
--- /var/tmp/diff_new_pack.3vN5uC/_old  2021-09-30 23:44:57.252576470 +0200
+++ /var/tmp/diff_new_pack.3vN5uC/_new  2021-09-30 23:44:57.256576473 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package libchewing
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2021 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,12 +24,12 @@
 
 Name:           libchewing
 %define soname 3
-Version:        0.5.1+git20171114.3df07c9
+Version:        0.5.1+git20200627.452f622
 Release:        0
 Summary:        Intelligent Phonetic Input Method Library for Traditional 
Chinese
 License:        LGPL-2.1-or-later
 Group:          System/I18n/Chinese
-Url:            https://github.com/chewing
+URL:            https://github.com/chewing
 Source:         %{name}-%{version}.tar.xz
 Source1:        chewing-utils-%{utilver}.tar.gz
 #PATCH-FIX-UPSTREAM yuyic...@gmail.com fix a lot of errors in the code
@@ -42,17 +42,12 @@
 BuildRequires:  gtk2-devel
 %endif
 BuildRequires:  libtool
-%if 0%{?suse_version} >= 1230
 BuildRequires:  makeinfo
-%else
-BuildRequires:  texinfo
-%endif
 BuildRequires:  ncurses-devel
 BuildRequires:  pkg-config
-BuildRequires:  python-devel
 BuildRequires:  sqlite3-devel
 Requires(post):        info
-Requires(postun):      info
+Requires(postun):info
 
 %description
 Intelligent phonetic input method library for traditional Chinese.
@@ -96,9 +91,8 @@
 (usually located at ~/.chewing/uhash.dat).
 
 %package -n python-chewing
-Summary:        Python 2 bindings for %{name}
+Summary:        Python bindings for %{name}
 Group:          Development/Libraries/Python
-%py_requires
 
 %description -n python-chewing
 This package contains python bindings for chewing, an intelligent phonetic
@@ -107,7 +101,6 @@
 Only input method framework written in python (like very old versions of ibus)
 or developers will need it.
 
-
 %prep
 %autosetup -p1
 
@@ -149,11 +142,11 @@
 mkdir -p %{buildroot}%{_bindir}
 cp -r contrib/simple-select %{buildroot}%{_bindir}
 
-# install python 2 bindings
+# install python bindings
 mkdir -p %{buildroot}%{python_sitearch}/chewing/
 cp -r contrib/python/chewing.py %{buildroot}%{python_sitearch}/chewing/
 pushd %{buildroot}%{python_sitearch}/chewing/
-%py_compile -O .
+python3 -m py_compile *.py
 popd
 
 # install chewing-utils
@@ -176,7 +169,8 @@
 %install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz
 
 %files -n %{name}%{soname}
-%doc AUTHORS COPYING NEWS README.md TODO
+%license COPYING
+%doc AUTHORS NEWS README.md TODO
 %{_libdir}/libchewing.so.3
 %{_libdir}/libchewing.so.3.3.1
 

++++++ _servicedata ++++++
<servicedata>
<service name="tar_scm">
                <param name="url">https://github.com/chewing/libchewing/</param>
              <param 
name="changesrevision">9025eeb2bf2cba851073cb4178fd71f71c74391d</param></service></servicedata>++++++
 libchewing-0.5.1+git20171114.3df07c9.tar.xz -> 
libchewing-0.5.1+git20200627.452f622.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libchewing-0.5.1+git20171114.3df07c9/.gitignore 
new/libchewing-0.5.1+git20200627.452f622/.gitignore
--- old/libchewing-0.5.1+git20171114.3df07c9/.gitignore 1970-01-01 
01:00:00.000000000 +0100
+++ new/libchewing-0.5.1+git20200627.452f622/.gitignore 2020-06-27 
10:33:39.000000000 +0200
@@ -0,0 +1,148 @@
+# maintainer files
+
+.dir-locals.el
+ID
+TAGS
+GTAGS
+GPATH
+GRTAGS
+GSYMS
+
+# autotools generated
+INSTALL
+Makefile
+Makefile.in
+aclocal.m4
+mkinstalldirs
+autom4te.cache
+build-aux/
+chewing.pc
+config.log
+config.status
+configure
+libchewing.spec
+libtool
+/m4/libtool.m4
+/m4/lt*.m4
+include/config.h.in~
+
+# compiling output
+*.dat
+*.exe
+*.la
+*.lo
+*.o
+.deps
+.libs
+
+data/gendata_stamp
+
+include/config.h
+include/config.h.in
+include/stamp-h1
+
+# cmake generated files
+config.h
+/libchewing.*
+/libsqlite3_library.a
+/libtesthelper.a
+/libuserphrase.a
+/Testing
+
+# test suite
+test/genkeystroke
+test/performance
+test/randkeystroke
+test/simulate
+test/stress
+test/testchewing
+test/test-bopomofo
+test/test-config
+test/test-easy-symbol
+test/test-error-handling
+test/test-fullshape
+test/test-key2pho
+test/test-keyboard
+test/test-keyboardless
+test/test-logger
+test/test-memory-fail
+test/test-mmap
+test/test-path
+test/test-reset
+test/test-regression
+test/test-symbol
+test/test-struct-size
+test/test-special-symbol
+test/test-userphrase
+test/test-utf8
+test/do-test.xml
+test/test.txt
+test/*.log
+test/*.trs
+test/chewing.sqlite3
+test/test.sqlite3
+thirdparty/sqlite-amalgamation/sqlite3
+
+# Generated tools/headers
+src/tools/init_database
+src/tools/dump_database
+
+# gcov output
+*.gcda
+*.gcno
+*.gcov
+/coverage.info
+/coveragereport
+
+# cscope output
+cscope.*
+
+# info doc
+doc/libchewing.info
+doc/stamp-vti
+doc/version.texi
+doc/libchewing.aux
+doc/libchewing.cp
+doc/libchewing.cps
+doc/libchewing.fn
+doc/libchewing.fns
+doc/libchewing.ky
+doc/libchewing.log
+doc/libchewing.pdf
+doc/libchewing.pg
+doc/libchewing.toc
+doc/libchewing.tp
+doc/libchewing.tps
+doc/libchewing.vr
+doc/libchewing.vrs
+
+# cmake
+/CTestTestfile.cmake
+/CMakeCache.txt
+/CMakeFiles/
+/cmake_install.cmake
+
+# Visual Studio
+*.pdb
+*.vcxproj*
+*.sln
+*.sdf
+*.suo
+*.dir
+*.ilk
+
+# indent backup
+*~
+
+# contrib directory
+contrib/simple-select
+contrib/test.sqlite3
+
+# vi
+*.swp
+
+# OS X
+.DS_Store
+
+# python
+*.pyc
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libchewing-0.5.1+git20171114.3df07c9/.travis.yml 
new/libchewing-0.5.1+git20200627.452f622/.travis.yml
--- old/libchewing-0.5.1+git20171114.3df07c9/.travis.yml        2017-11-14 
14:44:14.000000000 +0100
+++ new/libchewing-0.5.1+git20200627.452f622/.travis.yml        2020-06-27 
10:33:39.000000000 +0200
@@ -1,5 +1,7 @@
 language: c
 
+dist: xenial
+
 # container-based builds
 sudo: false
 
@@ -18,13 +20,15 @@
     - compiler: gcc
       env: BUILD=cmake
     - compiler: clang
+      # LSan does not work in containers 
https://github.com/travis-ci/travis-ci/issues/9033
+      sudo: true
       env: BUILD=cmake CMAKE_OPTION="-DUSE_VALGRIND=no -DNO_UNDEFINED=no" 
CFLAGS="-fsanitize=address -fsanitize=undefined"
     - compiler: gcc
       env: BUILD=cmake CMAKE_OPTION="-DENABLE_GCOV=yes -DUSE_VALGRIND=no" 
COVERALLS=yes
     - compiler: clang
-      env: BUILD=cmake CMAKE_OPTION="-DWITH_STATIC_SQLITE3=yes"
+      env: BUILD=cmake CMAKE_OPTION="-DWITH_INTERNAL_SQLITE3=yes"
     - compiler: gcc
-      env: BUILD=autotools CONFIGURE_OPTION="--with-static_sqlite3=yes"
+      env: BUILD=autotools CONFIGURE_OPTION="--with-internal-sqlite3=yes"
     - compiler: gcc
       env: BUILD=cmake CMAKE_OPTION="-DWITH_SQLITE3=no"
     - compiler: clang
@@ -36,8 +40,8 @@
   - P_JOBS="-j$(getconf _NPROCESSORS_ONLN)"
 
 script:
-  - if [ x$BUILD == xautotools ]; then ./autogen.sh && ./configure 
$CONFIGURE_OPTION && make $P_JOBS CFLAGS="$CFLAGS -Wall -Werror" && make 
$P_JOBS check && make $P_JOBS release && LC_ALL=c sort data/tsi.src > 
data/tsi.src.sort && diff data/tsi.src data/tsi.src.sort; fi
-  - if [ x$BUILD == xcmake ]; then CFLAGS="$CFLAGS -Wall -Werror" cmake . 
$CMAKE_OPTION && make $P_JOBS && make $P_JOBS check && LC_ALL=C sort 
data/tsi.src > data/tsi.src.sort && diff data/tsi.src data/tsi.src.sort; fi
+  - if [ x$BUILD == xautotools ]; then ./autogen.sh && ./configure 
$CONFIGURE_OPTION && make $P_JOBS V=1 CFLAGS="$CFLAGS -Wall -Werror 
-Wno-unused-const-variable" && make -j1 check && make $P_JOBS release && 
LC_ALL=c sort data/tsi.src > data/tsi.src.sort && diff data/tsi.src 
data/tsi.src.sort; fi
+  - if [ x$BUILD == xcmake ]; then CFLAGS="$CFLAGS -Wall -Werror 
-Wno-unused-const-variable" cmake . $CMAKE_OPTION && make $P_JOBS && make 
$P_JOBS check && LC_ALL=C sort data/tsi.src > data/tsi.src.sort && diff 
data/tsi.src data/tsi.src.sort; fi
 
 after_success:
   - if [ x$COVERALLS == xyes ]; then coveralls --exclude src/tools --exclude 
contrib --exclude test --exclude thirdparty --exclude-pattern 
'.*CMake[^/]+\.c(?:pp)?' --exclude-pattern '.*/[_A-Z0-9]+\.c(?:pp)?' 
--exclude-pattern '[^\.]*\.h'; fi
@@ -53,9 +57,6 @@
     build_command: "make $P_JOBS"
     branch_pattern: coverity_scan
   apt:
-    sources:
-    # sources list: 
https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
-    - kalakris-cmake
     packages:
     # packages list: 
https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise
     - cmake
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libchewing-0.5.1+git20171114.3df07c9/configure.ac 
new/libchewing-0.5.1+git20200627.452f622/configure.ac
--- old/libchewing-0.5.1+git20171114.3df07c9/configure.ac       2017-11-14 
14:44:14.000000000 +0100
+++ new/libchewing-0.5.1+git20200627.452f622/configure.ac       2020-06-27 
10:33:39.000000000 +0200
@@ -57,7 +57,7 @@
 AC_CONFIG_HEADERS([include/config.h])
 
 # Init libtool
-LT_INIT([win32-dll])
+LT_INIT([win32-dll pic-only])
 
 # libtool option to control which symbols are exported
 # right now, symbols starting with _ are not exported
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libchewing-0.5.1+git20171114.3df07c9/contrib/python/chewing.py 
new/libchewing-0.5.1+git20200627.452f622/contrib/python/chewing.py
--- old/libchewing-0.5.1+git20171114.3df07c9/contrib/python/chewing.py  
2017-11-14 14:44:14.000000000 +0100
+++ new/libchewing-0.5.1+git20200627.452f622/contrib/python/chewing.py  
2020-06-27 10:33:39.000000000 +0200
@@ -19,6 +19,8 @@
 _libchewing.chewing_zuin_String.restype = c_char_p
 _libchewing.chewing_aux_String.restype = c_char_p
 _libchewing.chewing_get_KBString.restype = c_char_p
+_libchewing.chewing_new.restype = c_void_p
+_libchewing.chewing_new2.restype = c_void_p
 
 
 def Init(datadir, userdir):
@@ -39,12 +41,12 @@
                 None)
 
     def __del__(self):
-        _libchewing.chewing_delete(self.ctx)
+        _libchewing.chewing_delete(c_void_p(self.ctx))
 
     def __getattr__(self, name):
         func = 'chewing_' + name
         if hasattr(_libchewing, func):
-            wrap = partial(getattr(_libchewing, func), self.ctx)
+            wrap = partial(getattr(_libchewing, func), c_void_p(self.ctx))
             setattr(self, name, wrap)
             return wrap
         else:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libchewing-0.5.1+git20171114.3df07c9/data/symbols.dat 
new/libchewing-0.5.1+git20200627.452f622/data/symbols.dat
--- old/libchewing-0.5.1+git20171114.3df07c9/data/symbols.dat   2017-11-14 
14:44:14.000000000 +0100
+++ new/libchewing-0.5.1+git20200627.452f622/data/symbols.dat   2020-06-27 
10:33:39.000000000 +0200
@@ -1,6 +1,6 @@
 ???
 ???
-????????????=????????????????????????????????????????????????????????????????????????????????????????
+????????????=????????????????????????????????????????????????????????????????????????????????????????
 ????????????=??????????????????????????????????????????????????????????????????
 ????????????=????????????????????????????????????????????????
 
????????????=????????????????????????????????????????????????????????????????????????????????????????????????
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libchewing-0.5.1+git20171114.3df07c9/doc/libchewing.texi 
new/libchewing-0.5.1+git20200627.452f622/doc/libchewing.texi
--- old/libchewing-0.5.1+git20171114.3df07c9/doc/libchewing.texi        
2017-11-14 14:44:14.000000000 +0100
+++ new/libchewing-0.5.1+git20200627.452f622/doc/libchewing.texi        
2020-06-27 10:33:39.000000000 +0200
@@ -246,7 +246,7 @@
 There are functions returning pointers of strings or other data
 structures that are allocated on the heap. These memory @emph{must} be
 freed to avoid memory leak. To avoid memory allocator mismatch between
-the Chewing IM and the caller, use this function the free the resource.
+the Chewing IM and the caller, use this function to free the resource.
 
 Do nothing if @var{ptr} is @code{NULL}.
 @end deftypefun
@@ -1029,6 +1029,7 @@
 @deftypefun int chewing_userphrase_get (ChewingContext *@var{ctx}, char
 *@var{phrase_buf}, unsigned int @var{phrase_len}, char *@var{bopomofo_buf},
 unsigned int @var{bopomofo_len})
+
 This function gets the current enumerated userphrase. The @var{phrase_buf} and
 @var{bopomofo_buf} are userphrase and its bopomofo buffers provided by caller.
 The length of buffer @var{phrase_len} and @var{bopomofo_len} can be get by
@@ -1039,6 +1040,7 @@
 
 @deftypefun int chewing_userphrase_add (ChewingContext *@var{ctx}, const char
 *@var{phrase_buf}, const char *@var{bopomofo_buf})
+
 This function adds new userphrase @var{phrase_buf}(@var{bopomofo_buf}).
 
 The return value is how many phrases are added, @code{-1} on failure.
@@ -1046,6 +1048,7 @@
 
 @deftypefun int chewing_userphrase_remove (ChewingContext *@var{ctx}, const
 char *@var{phrase_buf}, const char *@var{bopomofo_buf})
+
 This function removes new userphrase @var{phrase_buf}(@var{bopomofo_buf}).
 
 The return value is how many phrases are removed, @code{-1} on failure.
@@ -1053,6 +1056,7 @@
 
 @deftypefun int chewing_userphrase_lookup (ChewingContext *@var{ctx}, const
 char *@var{phrase_buf}, const char *@var{bopomofo_buf})
+
 This function lookups if userphrase @var{phrase_buf}(@var{bopomofo_buf}) is in
 userphrase.
 
@@ -1150,7 +1154,7 @@
 @deftypefun void chewing_set_easySymbolInput (ChewingContext *@var{ctx}, int 
@var{mode})
 This function sets the current normal/easy symbol mode. In easy symbol mode,
 the key be will changed to its related easy symbol in @file{swkb.dat}. The
-format of @file{swkb.dat} is key symble pair per line. The valid value of key
+format of @file{swkb.dat} is key symbol pair per line. The valid value of key
 is [0-9A-Z]. The lower case character in key will be changed to upper case when
 loading @file{swkb.dat}. However, in easy symbol mode, only [0-9A-Z] are
 accepted.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libchewing-0.5.1+git20171114.3df07c9/src/chewingio.c 
new/libchewing-0.5.1+git20200627.452f622/src/chewingio.c
--- old/libchewing-0.5.1+git20171114.3df07c9/src/chewingio.c    2017-11-14 
14:44:14.000000000 +0100
+++ new/libchewing-0.5.1+git20200627.452f622/src/chewingio.c    2020-06-27 
10:33:39.000000000 +0200
@@ -193,7 +193,7 @@
     chewing_Reset(ctx);
 
     if (syspath) {
-        strncpy(search_path, syspath, sizeof(search_path) - 1);
+        strncpy(search_path, syspath, ARRAY_SIZE(search_path) - 1);
     } else {
         ret = get_search_path(search_path, sizeof(search_path));
         if (ret) {
@@ -694,8 +694,7 @@
 
     if (mode == CHINESE_MODE || mode == SYMBOL_MODE) {
         // remove all data inside buffer as switching mode.
-        BopomofoRemoveAll(&(ctx->data->bopomofoData));
-        MakeOutputWithRtn(ctx->output, ctx->data, KEYSTROKE_ABSORB);
+        chewing_clean_bopomofo_buf(ctx);
         ctx->data->bChiSym = mode;
     }
 }
@@ -928,6 +927,9 @@
         pgdata->chiSymbolCursor = buf;
         pgdata->PointStart = -1;
         pgdata->PointEnd = 0;
+        MakeOutputWithRtn(pgo, pgdata, keystrokeRtn);
+        MakeOutputAddMsgAndCleanInterval(pgo, pgdata);
+        return 0;
     } else {
         keystrokeRtn = KEYSTROKE_COMMIT;
         WriteChiSymbolToCommitBuf(pgdata, pgo, nCommitStr);
@@ -1660,12 +1662,6 @@
     ChewingData *pgdata;
     ChewingOutput *pgo;
     int keystrokeRtn = KEYSTROKE_ABSORB;
-    int newPhraseLen;
-    int i;
-    uint16_t addPhoneSeq[MAX_PHONE_SEQ_LEN];
-    char addWordSeq[MAX_PHONE_SEQ_LEN * MAX_UTF8_SIZE + 1];
-    int phraseState;
-    int cursor;
 
     if (!ctx) {
         return -1;
@@ -1677,11 +1673,10 @@
 
     CheckAndResetRange(pgdata);
 
-    if (pgdata->bSelect)
+    if (pgdata->bSelect || BopomofoIsEntering(&(pgdata->bopomofoData))) {
+        MakeOutputWithRtn(pgo, pgdata, keystrokeRtn);
         return 0;
-
-    CallPhrasing(pgdata, 0);
-    newPhraseLen = key - '0';
+    }
 
     if (key == '0' || key == '1') {
         pgdata->bSelect = 1;
@@ -1693,15 +1688,24 @@
         return 0;
     }
 
-    cursor = PhoneSeqCursor(pgdata);
-    if (!pgdata->config.bAddPhraseForward) {
-        if (newPhraseLen >= 1 && cursor + newPhraseLen - 1 <= 
pgdata->nPhoneSeq) {
-            if (NoSymbolBetween(pgdata, cursor, cursor + newPhraseLen)) {
+    if (key >= '2' && key <= '9') {
+        int i;
+        int newPhraseLen = key - '0';
+        int phraseState = 0;
+        int cursor = PhoneSeqCursor(pgdata);
+        int key_buf_cursor = pgdata->chiSymbolCursor;
+        uint16_t addPhoneSeq[MAX_PHONE_SEQ_LEN];
+        char addWordSeq[MAX_PHONE_SEQ_LEN * MAX_UTF8_SIZE + 1];
+
+        if (!pgdata->config.bAddPhraseForward) {
+            if (cursor + newPhraseLen <= pgdata->nPhoneSeq &&
+                NoSymbolBetween(pgdata, key_buf_cursor, key_buf_cursor + 
newPhraseLen)) {
+
                 /* Manually add phrase to the user phrase database. */
                 memcpy(addPhoneSeq, &pgdata->phoneSeq[cursor], 
sizeof(uint16_t) * newPhraseLen);
                 addPhoneSeq[newPhraseLen] = 0;
 
-                copyStringFromPreeditBuf(pgdata, cursor, newPhraseLen, 
addWordSeq, sizeof(addWordSeq));
+                copyStringFromPreeditBuf(pgdata, key_buf_cursor, newPhraseLen, 
addWordSeq, sizeof(addWordSeq));
 
                 phraseState = UserUpdatePhrase(pgdata, addPhoneSeq, 
addWordSeq);
                 SetUpdatePhraseMsg(pgdata, addWordSeq, newPhraseLen, 
phraseState);
@@ -1710,15 +1714,15 @@
                 for (i = 1; i < newPhraseLen; i++)
                     pgdata->bUserArrBrkpt[cursor + i] = 0;
             }
-        }
-    } else {
-        if (newPhraseLen >= 1 && cursor - newPhraseLen >= 0) {
-            if (NoSymbolBetween(pgdata, cursor - newPhraseLen, cursor)) {
+        } else {
+            if (cursor - newPhraseLen >= 0 &&
+                NoSymbolBetween(pgdata, key_buf_cursor - newPhraseLen, 
key_buf_cursor)) {
+
                 /* Manually add phrase to the user phrase database. */
                 memcpy(addPhoneSeq, &pgdata->phoneSeq[cursor - newPhraseLen], 
sizeof(uint16_t) * newPhraseLen);
                 addPhoneSeq[newPhraseLen] = 0;
 
-                copyStringFromPreeditBuf(pgdata, cursor - newPhraseLen, 
newPhraseLen, addWordSeq, sizeof(addWordSeq));
+                copyStringFromPreeditBuf(pgdata, key_buf_cursor - 
newPhraseLen, newPhraseLen, addWordSeq, sizeof(addWordSeq));
 
                 phraseState = UserUpdatePhrase(pgdata, addPhoneSeq, 
addWordSeq);
                 SetUpdatePhraseMsg(pgdata, addWordSeq, newPhraseLen, 
phraseState);
@@ -1728,11 +1732,22 @@
                     pgdata->bUserArrBrkpt[cursor - newPhraseLen + i] = 0;
             }
         }
+
+        if (!phraseState) {
+            snprintf(pgdata->showMsg, sizeof(pgdata->showMsg),
+                
"\xE5\x8A\xA0\xE8\xA9\x9E\xE5\xA4\xB1\xE6\x95\x97\xEF\xBC\x9A\xE5\xAD\x97\xE6\x95\xB8"
+                
"\xE4\xB8\x8D\xE7\xAC\xA6\xE6\x88\x96\xE5\xA4\xBE\xE9\x9B\x9C\xE7\xAC\xA6\xE8\x99\x9F"
+                /* ?????????????????????????????????????????? */);
+            pgdata->showMsgLen = 14;
+        }
+
+        CallPhrasing(pgdata, 0);
+        MakeOutputWithRtn(pgo, pgdata, keystrokeRtn);
+        MakeOutputAddMsgAndCleanInterval(pgo, pgdata);
+        return 0;
     }
-    CallPhrasing(pgdata, 0);
-    MakeOutputWithRtn(pgo, pgdata, keystrokeRtn);
-    MakeOutputAddMsgAndCleanInterval(pgo, pgdata);
-    return 0;
+
+    return -1;
 }
 
 CHEWING_API int chewing_handle_ShiftSpace(ChewingContext *ctx)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libchewing-0.5.1+git20171114.3df07c9/src/chewingutil.c 
new/libchewing-0.5.1+git20200627.452f622/src/chewingutil.c
--- old/libchewing-0.5.1+git20171114.3df07c9/src/chewingutil.c  2017-11-14 
14:44:14.000000000 +0100
+++ new/libchewing-0.5.1+git20200627.452f622/src/chewingutil.c  2020-06-27 
10:33:39.000000000 +0200
@@ -152,7 +152,7 @@
                 &pgdata->preeditBuf[pgdata->chiSymbolCursor],
                 sizeof(pgdata->preeditBuf[0]) * (pgdata->chiSymbolBufLen - 
pgdata->chiSymbolCursor));
 
-        strncpy(buf->char_, chibuf, sizeof(buf->char_) - 1);
+        strncpy(buf->char_, chibuf, ARRAY_SIZE(buf->char_) - 1);
         buf->category = CHEWING_SYMBOL;
 
         /* Save Symbol Key */
@@ -356,7 +356,7 @@
                 symbol_type = SYMBOL_CHOICE_UPDATE;
             }
         }
-        strncpy(buf->char_, pgdata->choiceInfo.totalChoiceStr[sel_i], 
sizeof(buf->char_) - 1);
+        strncpy(buf->char_, pgdata->choiceInfo.totalChoiceStr[sel_i], 
ARRAY_SIZE(buf->char_) - 1);
         buf->category = CHEWING_SYMBOL;
 
         /* This is very strange */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libchewing-0.5.1+git20171114.3df07c9/src/hash.c 
new/libchewing-0.5.1+git20200627.452f622/src/hash.c
--- old/libchewing-0.5.1+git20171114.3df07c9/src/hash.c 2017-11-14 
14:44:14.000000000 +0100
+++ new/libchewing-0.5.1+git20200627.452f622/src/hash.c 2020-06-27 
10:33:39.000000000 +0200
@@ -522,7 +522,7 @@
     int item_index, hashvalue, iret, fsize, hdrlen, oldest = INT_MAX;
     char *dump, *seekdump;
 
-    strncpy(pgdata->static_data.hashfilename, path, 
sizeof(pgdata->static_data.hashfilename));
+    strncpy(pgdata->static_data.hashfilename, path, 
ARRAY_SIZE(pgdata->static_data.hashfilename) - 1);
     memset(pgdata->static_data.hashtable, 0, 
sizeof(pgdata->static_data.hashtable));
 
   open_hash_file:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libchewing-0.5.1+git20171114.3df07c9/test/Makefile.am 
new/libchewing-0.5.1+git20200627.452f622/test/Makefile.am
--- old/libchewing-0.5.1+git20171114.3df07c9/test/Makefile.am   2017-11-14 
14:44:14.000000000 +0100
+++ new/libchewing-0.5.1+git20200627.452f622/test/Makefile.am   2020-06-27 
10:33:39.000000000 +0200
@@ -84,9 +84,9 @@
        $(NULL)
 
 LDADD = \
-       $(top_builddir)/src/common/libcommon.la \
        $(top_builddir)/src/porting_layer/src/libporting_layer.la \
        $(top_builddir)/test/libtesthelper.la \
+       $(top_builddir)/src/common/libcommon.la \
        $(NULL)
 
 AM_LDFLAGS = -static
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libchewing-0.5.1+git20171114.3df07c9/test/data/symbols.dat 
new/libchewing-0.5.1+git20200627.452f622/test/data/symbols.dat
--- old/libchewing-0.5.1+git20171114.3df07c9/test/data/symbols.dat      
2017-11-14 14:44:14.000000000 +0100
+++ new/libchewing-0.5.1+git20200627.452f622/test/data/symbols.dat      
2020-06-27 10:33:39.000000000 +0200
@@ -1,6 +1,6 @@
 ???
 ???
-????????????=????????????????????????????????????????????????????????????????????????????????????????
+????????????=????????????????????????????????????????????????????????????????????????????????????????
 ????????????=??????????????????????????????????????????????????????????????????
 ????????????=????????????????????????????????????????????????
 
????????????=????????????????????????????????????????????????????????????????????????????????????????????????
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libchewing-0.5.1+git20171114.3df07c9/test/randkeystroke.c 
new/libchewing-0.5.1+git20200627.452f622/test/randkeystroke.c
--- old/libchewing-0.5.1+git20171114.3df07c9/test/randkeystroke.c       
2017-11-14 14:44:14.000000000 +0100
+++ new/libchewing-0.5.1+git20200627.452f622/test/randkeystroke.c       
2020-06-27 10:33:39.000000000 +0200
@@ -37,7 +37,9 @@
 {
     printf("usage: randkeystroke [-r] [-n num] [-h]\n"
            "\t -r     - total random\n"
-           "\t -n num - generate num keystrokes\n" "\t -s seed - random 
seed\n" "\t -h     - help\n");
+           "\t -n num - generate num keystrokes\n"
+           "\t -s seed - random seed\n"
+           "\t -h     - help\n");
 }
 
 int main(int argc, char *argv[])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libchewing-0.5.1+git20171114.3df07c9/test/test-regression.c 
new/libchewing-0.5.1+git20200627.452f622/test/test-regression.c
--- old/libchewing-0.5.1+git20171114.3df07c9/test/test-regression.c     
2017-11-14 14:44:14.000000000 +0100
+++ new/libchewing-0.5.1+git20200627.452f622/test/test-regression.c     
2020-06-27 10:33:39.000000000 +0200
@@ -107,6 +107,24 @@
     chewing_delete(ctx);
 }
 
+void test_libchewing_issue_194()
+{
+    ChewingContext *ctx;
+
+    clean_userphrase();
+
+    ctx = chewing_new();
+    start_testcase(ctx, fd);
+
+    chewing_set_ChiEngMode(ctx, SYMBOL_MODE);
+    type_keystroke_by_string(ctx, "test");
+    chewing_set_ChiEngMode(ctx, CHINESE_MODE);
+
+    ok_commit_buffer(ctx, "t");
+
+    chewing_delete(ctx);
+}
+
 void test_libchewing_data_issue_1()
 {
     const TestData DATA = { "e03y.3", "\xE8\xB6\x95\xE8\xB5\xB0" /* ?????? */  
};
@@ -142,6 +160,7 @@
     test_libchewing_data_issue_1();
     test_libchewing_issue_30();
     test_libchewing_issue_108();
+    test_libchewing_issue_194();
     test_libchewing_googlecode_issue_472();
     test_libchewing_googlecode_issue_473();
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libchewing-0.5.1+git20171114.3df07c9/test/test-symbol.c 
new/libchewing-0.5.1+git20200627.452f622/test/test-symbol.c
--- old/libchewing-0.5.1+git20171114.3df07c9/test/test-symbol.c 2017-11-14 
14:44:14.000000000 +0100
+++ new/libchewing-0.5.1+git20200627.452f622/test/test-symbol.c 2020-06-27 
10:33:39.000000000 +0200
@@ -29,7 +29,7 @@
     {"`35<E>", "\xEF\xBC\x9F" /* ??? */ },
     {"`36<E>", "\xEF\xBC\x81" /* ??? */ },
     {"`37<E>", "\xEF\xBC\x9B" /* ??? */ },
-    {"`38<E>", "\xEF\xB8\xB0" /* ??? */ },
+    {"`38<E>", "\xEF\xBC\x9A" /* ??? */ },
     {"`39<E>", "\xE2\x80\xA7" /* ??? */ },
     {"`30<E>", "\xE2\x80\xA5" /* ??? */ },
     {"`3<R>1<E>", "\xEF\xB9\x90" /* ??? */ },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/libchewing-0.5.1+git20171114.3df07c9/test/test-userphrase.c 
new/libchewing-0.5.1+git20200627.452f622/test/test-userphrase.c
--- old/libchewing-0.5.1+git20171114.3df07c9/test/test-userphrase.c     
2017-11-14 14:44:14.000000000 +0100
+++ new/libchewing-0.5.1+git20200627.452f622/test/test-userphrase.c     
2020-06-27 10:33:39.000000000 +0200
@@ -39,6 +39,8 @@
 {
     static const char phrase[] = "\xE6\xB8\xAC\xE8\xA9\xA6" /* ?????? */ ;
     static const char bopomofo[] = "\xE3\x84\x98\xE3\x84\x9C\xCB\x8B 
\xE3\x84\x95\xCB\x8B" /* ???????? ????? */ ;
+    static const char msg[] = 
"\xE5\x8A\xA0\xE5\x85\xA5\xEF\xBC\x9A\xE6\xB8\xAC\xE8\xA9\xA6" /* 
??????????????? */ ;
+
     int cursor;
     ChewingContext *ctx;
 
@@ -55,6 +57,7 @@
     cursor = chewing_cursor_Current(ctx);
     ok(cursor == 0, "cursor position `%d' shall be 0", cursor);
     ok(has_userphrase(ctx, bopomofo, phrase) == 1, "`%s' shall be in 
userphrase", phrase);
+    ok_aux_buffer(ctx, msg);
 
     chewing_delete(ctx);
 }
@@ -81,6 +84,8 @@
 {
     static const char phrase[] = "\xE6\xB8\xAC\xE8\xA9\xA6" /* ?????? */ ;
     static const char bopomofo[] = "\xE3\x84\x98\xE3\x84\x9C\xCB\x8B 
\xE3\x84\x95\xCB\x8B" /* ???????? ????? */ ;
+    static const char msg[] = 
"\xE5\x8A\xA0\xE5\x85\xA5\xEF\xBC\x9A\xE6\xB8\xAC\xE8\xA9\xA6" /* 
??????????????? */ ;
+
     int cursor;
     ChewingContext *ctx;
 
@@ -97,6 +102,7 @@
     cursor = chewing_cursor_Current(ctx);
     ok(cursor == 2, "cursor position `%d' shall be 2", cursor);
     ok(has_userphrase(ctx, bopomofo, phrase) == 1, "`%s' shall be in 
userphrase", phrase);
+    ok_aux_buffer(ctx, msg);
 
     chewing_delete(ctx);
 }
@@ -114,6 +120,11 @@
     static const char msg[] = 
"\xE5\x8A\xA0\xE5\x85\xA5\xEF\xBC\x9A\xE6\xB8\xAC\xE8\xA9\xA6" /* 
??????????????? */ ;
     static const char msg_already_have[] =
         "\xE5\xB7\xB2\xE6\x9C\x89\xEF\xBC\x9A\xE6\xB8\xAC\xE8\xA9\xA6" /* 
??????????????? */ ;
+    static const char msg_error[] =
+        
"\xE5\x8A\xA0\xE8\xA9\x9E\xE5\xA4\xB1\xE6\x95\x97\xEF\xBC\x9A\xE5\xAD\x97\xE6\x95\xB8"
+        
"\xE4\xB8\x8D\xE7\xAC\xA6\xE6\x88\x96\xE5\xA4\xBE\xE9\x9B\x9C\xE7\xAC\xA6\xE8\x99\x9F"
+        /* ?????????????????????????????????????????? */;
+
     int cursor;
     ChewingContext *ctx;
 
@@ -136,6 +147,9 @@
     type_keystroke_by_string(ctx, "<C2>");
     ok_aux_buffer(ctx, msg_already_have);
 
+    type_keystroke_by_string(ctx, "<EN><C2>");
+    ok_aux_buffer(ctx, msg_error);
+
     chewing_delete(ctx);
 }
 
@@ -146,6 +160,11 @@
     static const char msg_add[] = 
"\xE5\x8A\xA0\xE5\x85\xA5\xEF\xBC\x9A\xE6\xB8\xAC\xE8\xA9\xA6" /* 
??????????????? */ ;
     static const char msg_already_have[] =
         "\xE5\xB7\xB2\xE6\x9C\x89\xEF\xBC\x9A\xE6\xB8\xAC\xE8\xA9\xA6" /* 
??????????????? */ ;
+    static const char msg_error[] =
+        
"\xE5\x8A\xA0\xE8\xA9\x9E\xE5\xA4\xB1\xE6\x95\x97\xEF\xBC\x9A\xE5\xAD\x97\xE6\x95\xB8"
+        
"\xE4\xB8\x8D\xE7\xAC\xA6\xE6\x88\x96\xE5\xA4\xBE\xE9\x9B\x9C\xE7\xAC\xA6\xE8\x99\x9F"
+        /* ?????????????????????????????????????????? */;
+
     int cursor;
     ChewingContext *ctx;
 
@@ -168,6 +187,9 @@
     type_keystroke_by_string(ctx, "<C2>");
     ok_aux_buffer(ctx, msg_already_have);
 
+    type_keystroke_by_string(ctx, "<H><C2>");
+    ok_aux_buffer(ctx, msg_error);
+
     chewing_delete(ctx);
 }
 
@@ -219,12 +241,71 @@
     chewing_delete(ctx);
 }
 
+void test_CtrlNum_add_phrase_right_start_with_symbol()
+{
+    static const char bopomofo[] =
+        "\xE3\x84\x89\xE3\x84\xA4\xCB\x87 \xE3\x84\x8A\xE3\x84\xA8\xCB\x87 
\xE3\x84\x91\xE3\x84\xA7\xE3\x84\xA4\xCB\x8A" /* ???????? ???????? ??????????? 
*/ ;
+    static const char phrase[] = "\xE6\x93\x8B\xE5\x9C\x9F\xE7\x89\x86"; /* 
????????? */
+
+    const char *const_buf;
+    ChewingContext *ctx;
+
+    clean_userphrase();
+    ctx = chewing_new();
+    start_testcase(ctx, fd);
+    chewing_set_maxChiSymbolLen(ctx, 16);
+    chewing_set_addPhraseDirection(ctx, 0);
+
+    ok(has_userphrase(ctx, bopomofo, NULL) == 0, "`%s' shall not be in 
userphrase", bopomofo);
+
+    type_keystroke_by_string(ctx, "`1hk4g42;3wj3fu;6<L><L><L><D>3<C3>");
+    ok(has_userphrase(ctx, bopomofo, NULL) == 1, "`%s' shall be in 
userphrase", bopomofo);
+
+    chewing_cand_open(ctx);
+    chewing_cand_Enumerate(ctx);
+    const_buf = chewing_cand_string_by_index_static(ctx, 0);
+    ok(strcmp(const_buf, phrase) == 0, "first candidate `%s' shall be `%s'", 
const_buf, phrase);
+
+    chewing_delete(ctx);
+} 
+
+void test_CtrlNum_add_phrase_left_start_with_symbol()
+{
+    static const char bopomofo[] =
+        "\xE3\x84\x89\xE3\x84\xA4\xCB\x87 \xE3\x84\x8A\xE3\x84\xA8\xCB\x87 
\xE3\x84\x91\xE3\x84\xA7\xE3\x84\xA4\xCB\x8A" /* ???????? ???????? ??????????? 
*/ ;
+    static const char phrase[] = "\xE6\x93\x8B\xE5\x9C\x9F\xE7\x89\x86"; /* 
????????? */
+
+    const char *const_buf;
+    ChewingContext *ctx;
+
+    clean_userphrase();
+    ctx = chewing_new();
+    start_testcase(ctx, fd);
+    chewing_set_maxChiSymbolLen(ctx, 16);
+    chewing_set_addPhraseDirection(ctx, 1);
+
+    ok(has_userphrase(ctx, bopomofo, NULL) == 0, "`%s' shall not be in 
userphrase", bopomofo);
+
+    type_keystroke_by_string(ctx, "`1hk4g42;3wj3fu;6<L><L><L><D>3<EN><C3>");
+    ok(has_userphrase(ctx, bopomofo, NULL) == 1, "`%s' shall be in 
userphrase", bopomofo);
+
+    type_keystroke_by_string(ctx, "<L><L><L>");
+    chewing_cand_open(ctx);
+    chewing_cand_Enumerate(ctx);
+    const_buf = chewing_cand_string_by_index_static(ctx, 0);
+    ok(strcmp(const_buf, phrase) == 0, "first candidate `%s' shall be `%s'", 
const_buf, phrase);
+
+    chewing_delete(ctx);
+}
+
 void test_CtrlNum()
 {
     test_CtrlNum_add_phrase_right();
     test_CtrlNum_add_phrase_left();
     test_CtrlNum_add_phrase_right_symbol_in_between();
     test_CtrlNum_add_phrase_left_symbol_in_between();
+    test_CtrlNum_add_phrase_right_start_with_symbol();
+    test_CtrlNum_add_phrase_left_start_with_symbol();
 }
 
 void test_userphrase_auto_learn()

Reply via email to