[uim-commit] r649 - trunk/uim
tkng at freedesktop.org
tkng at freedesktop.org
Mon Feb 14 13:32:16 PST 2005
Author: tkng
Date: 2005-02-14 13:32:13 -0800 (Mon, 14 Feb 2005)
New Revision: 649
Modified:
trunk/uim/m17nlib.c
Log:
* uim/m17nlib.c: Corresponded to the situation where the language of input
method is nil.
-(pushback_input_method): Don't return if lang is NULL
-(get_input_method_name): Omit lang of input method if it was NULL.
Modified: trunk/uim/m17nlib.c
===================================================================
--- trunk/uim/m17nlib.c 2005-02-14 10:51:35 UTC (rev 648)
+++ trunk/uim/m17nlib.c 2005-02-14 21:32:13 UTC (rev 649)
@@ -128,13 +128,15 @@
char *lib_lang, char *name)
{
char *lang = remap_lang_name(lib_lang);
- if (!lang) {
- return ;
- }
im_array = realloc(im_array,
sizeof(struct im_) * (nr_input_methods + 1));
- im_array[nr_input_methods].lang = strdup(lang);
+
+ if(lang != NULL) {
+ im_array[nr_input_methods].lang = strdup(lang);
+ } else {
+ im_array[nr_input_methods].lang = NULL;
+ }
im_array[nr_input_methods].name = strdup(name);
im_array[nr_input_methods].im = im;
nr_input_methods++;
@@ -452,7 +454,12 @@
int nth = uim_scm_c_int(nth_);
if (nth < nr_input_methods) {
char *name = alloca(strlen(im_array[nth].name) + 20);
- sprintf(name, "m17n-%s-%s", im_array[nth].lang, im_array[nth].name);
+
+ if(im_array[nth].lang != NULL)
+ sprintf(name, "m17n-%s-%s", im_array[nth].lang, im_array[nth].name);
+ else
+ sprintf(name, "m17n-%s", im_array[nth].name);
+
return uim_scm_make_str(name);
}
return uim_scm_f();
@@ -464,7 +471,11 @@
int nth = uim_scm_c_int(nth_);
if (nth < nr_input_methods) {
char *lang = im_array[nth].lang;
- return uim_scm_make_str(lang);
+ if(lang != NULL) {
+ return uim_scm_make_str(lang);
+ } else {
+ return uim_scm_make_str("unknown");
+ }
}
return uim_scm_f();
}
More information about the Uim-commit
mailing list