[openi18n-im:01601] Re: 'im-sdk/branches/exp-remake-hotkey-impl' branch

AShiZaWa KaZuNoRi <[email protected]> Fri, 19 May 2006 17:52:12 +0900 (JST)
Newsgroups gmane.comp.internationalization.input-methods
Message-ID <[email protected]>
Hi,

I've just started to look around source code changes.

Date: Mon, 15 May 2006 14:17:35 +0900
From: rev 3133 - in branch
> Index: branches/exp-remake-hotkey-impl/lib/iiimp/data/comp-hotkeys.c
> ===================================================================
> --- branches/exp-remake-hotkey-impl/lib/iiimp/data/comp-hotkeys.c	(revision 3132)
> +++ branches/exp-remake-hotkey-impl/lib/iiimp/data/comp-hotkeys.c	(revision 3133)
> @@ -20,6 +20,11 @@

Good finding that comp-hotkeys.c is incomplete.  Unlike most of
libiiimp.so functions, hotkey related implementations are not
yet fully reviewed.

The problem exists in data life cycle management.  Design policy
of libiiimp.so data life cycle management is: when a parent
object is destroyed, all child objects are destroyed
automatically.

So the fix would be to convert HOTKEY_LIST structure into linked
list like IIIMP_string.  I'll try to fix this later.

By the way, the name HOTKEY_LIST (HOTKEYCTRL, HOTKEY) violates
the other design policy: symbol names must start with IIIMP,
IIIMF, iiimp, or iiimf, to avoid possible name space conflict.
I will fix this name space issue, too.

Thanks,
-- 
kasha


>      size_t                      nbyte = 0;
>      int                         i;
>  
> +    if (count > 0 && hk == NULL) {
> +	data_s->status = IIIMP_DATA_INVALID;
> +	return NULL;
> +    }
> +
>      data = (HOTKEY_LIST *) malloc(sizeof (HOTKEY_LIST));
>      if (NULL == data) {
>  	data_s->status = IIIMP_DATA_MALLOC_ERROR;
> @@ -35,22 +40,21 @@
>  
>      data->nbyte = nbyte ;
>      data->count = count;
> +    data->hotkey = NULL;
>  
> -    if (0 == data) {
> -	data->hotkey = NULL;
> -    } else {
> +    if (count > 0) {
>  	data->hotkey = (HOTKEY *)malloc(nbyte);
>  	if (NULL == data->hotkey) {
> +	    free(data);
> +	    data_s->status = IIIMP_DATA_MALLOC_ERROR;
>  	    return NULL;
>  	}
> -    }
>                                                                                  
> -    if (NULL != hk) {
>  	for (i=0 ; i < count ; i++) {
> -	    data->hotkey[i].hotkeyctrl = hk[i].hotkeyctrl ;
> -	    data->hotkey[i].nbyte = hk[i].hotkeylist->nbyte ;
> -	    data->hotkey[i].hotkeylist = hk[i].hotkeylist;
> -	    data->hotkey[i].label = hk[i].label;
> +	    data->hotkey[i].hotkeyctrl = hk[i].hotkeyctrl;
> +	    data->hotkey[i].nbyte = hk[i].hotkeylist->nbyte;
> +	    data->hotkey[i].hotkeylist = hk[i].hotkeylist;	hk[i].hotkeylist = NULL;
> +	    data->hotkey[i].label = hk[i].label;		hk[i].label = NULL;
>  	}
>      }
>  
> @@ -90,14 +94,17 @@
>  iiimp_hotkey_list_delete(IIIMP_data_s * data_s, HOTKEY_LIST * m)
>  {
>      int i;
> -    if (NULL == m) return;
> +    if (m) {
> +	if (m->hotkey) {
> +	    for (i = 0; i < m->count; i++) {
> +		iiimp_keyevent_list_delete(data_s, m->hotkey[i].hotkeylist);
> +		iiimp_string_delete(data_s, m->hotkey[i].label);
> +	    }
> +	    free (m->hotkey);
> +	}
>  
> -    for (i = 0; i < m->count; i++) {
> -	iiimp_keyevent_list_delete(data_s, m->hotkey[i].hotkeylist);
> -	iiimp_string_delete(data_s, m->hotkey[i].label);
> +	free(m);
>      }
> -    if (m->hotkey) free (m->hotkey);
> -    free(m);
>  }
>  
>  HOTKEY_LIST *


Date: Mon, 15 May 2006 18:00:03 +0900
From: [email protected]:
> I have commit a branch 'im-sdk/branches/exp-remake-hotkey-impl'
> to im-sdk repository.
> This is a trial to remake hotkey implementation.
> 
> The changes are:
> 
> * reconstruct hotkey profile management classes.
> * reconstruct hotkey event handling class.
> * change hotkey event data structure between server and LE.
> * modify language selcting operation. (Ctrl+Shift+SPACE)
>   * select current language initially.
>   * change language lookup choice selection normally. 
>     (UP, DOWN, SPACE key)
> 
> 
> I would like to replace trunk hotkey implementation with this.
> Please, evaluate this branch and give me your comments.
> 
> -- 
> Kenji ABE <[email protected]>