You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libchewing/libchewing-0.3.0-3.bz199353...

52 lines
1.4 KiB

--- libchewing-0.3.0/src/hanyupinyin.c.1-bz199353 2006-05-15 16:49:43.000000000 +1000
+++ libchewing-0.3.0/src/hanyupinyin.c 2006-09-05 10:47:46.000000000 +1000
@@ -95,13 +95,15 @@
* zuinKeySeq[] has at most 3 letters.
*/
keymap key, *res;
- strcpy( key.pinyin, pinyinKeySeq );
+ strncpy( key.pinyin, pinyinKeySeq, 6 );
DEBUG_CHECKPOINT();
res = bsearch( &key, keytable, N_TOTAL, sizeof(keymap), compkey );
- if ( res != NULL )
+ if ( res != NULL ){
strcpy( zuinKeySeq, res->zuin );
+ return 0;
+ }
else
zuinKeySeq = strdup( "" );
- return 0;
+ return 1;
}
--- libchewing-0.3.0/src/zuin.c.1-bz199353 2006-05-15 16:49:43.000000000 +1000
+++ libchewing-0.3.0/src/zuin.c 2006-09-05 10:47:46.000000000 +1000
@@ -392,14 +392,16 @@
static int PinYinInput( ZuinData *pZuin, int key )
{
int err = 0, status, i;
- char zuinKeySeq[ 5 ], buf[ 2 ];
+ char zuinKeySeq[ 5 ];
DEBUG_CHECKPOINT();
if ( IsPinYinEndKey( pZuin, key ) ) {
err = HanyuPinYinToZuin( pZuin->pinYinData.keySeq, zuinKeySeq );
- if (err)
- return ZUIN_KEY_ERROR;
+ if (err){
+ pZuin->pinYinData.keySeq[0] = '\0';
+ return ZUIN_ABSORB;
+ }
DEBUG_OUT( "zuinKeySeq: %s\n", zuinKeySeq );
for ( i = 0; i < strlen( zuinKeySeq ); i++ ) {
@@ -420,6 +422,7 @@
pZuin->pinYinData.keySeq[ 0 ] = '\0';
return EndKeyProcess( pZuin, key, 1 );
}
+ char buf[2];
buf[ 0 ] = key; buf[ 1 ] = '\0';
strcat( pZuin->pinYinData.keySeq, buf );