aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/imThaiIc.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/lib/X11/imThaiIc.c')
-rw-r--r--nx-X11/lib/X11/imThaiIc.c77
1 files changed, 37 insertions, 40 deletions
diff --git a/nx-X11/lib/X11/imThaiIc.c b/nx-X11/lib/X11/imThaiIc.c
index 5f022f2fd..72e99ba75 100644
--- a/nx-X11/lib/X11/imThaiIc.c
+++ b/nx-X11/lib/X11/imThaiIc.c
@@ -15,17 +15,17 @@ makes no representations about the suitability of this software for
any purpose. It is provided "as is" without express or implied
warranty.
-FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION DISCLAIM ALL
-WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR
-ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
-IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION DISCLAIM ALL
+WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR
+ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
- Author: Takashi Fujiwara FUJITSU LIMITED
+ Author: Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp
Modifier: Franky Ling Digital Equipment Corporation
frankyling@hgrd01.enet.dec.com
@@ -60,6 +60,8 @@ _XimThaiDestroyIC(
XIC xic)
{
Xic ic = (Xic)xic;
+ DefTreeBase *b = &ic->private.local.base;
+
if(((Xim)ic->core.im)->private.local.current_ic == (XIC)ic) {
_XimThaiUnSetFocus(xic);
}
@@ -68,14 +70,14 @@ _XimThaiDestroyIC(
ic->private.local.ic_resources = NULL;
}
- Xfree(ic->private.local.context->mb);
- Xfree(ic->private.local.context->wc);
- Xfree(ic->private.local.context->utf8);
- Xfree(ic->private.local.context);
- Xfree(ic->private.local.composed->mb);
- Xfree(ic->private.local.composed->wc);
- Xfree(ic->private.local.composed->utf8);
- Xfree(ic->private.local.composed);
+ if (b->tree) Xfree (b->tree);
+ if (b->mb) Xfree (b->mb);
+ if (b->wc) Xfree (b->wc);
+ if (b->utf8) Xfree (b->utf8);
+ b->tree = NULL;
+ b->mb = NULL;
+ b->wc = NULL;
+ b->utf8 = NULL;
return;
}
@@ -105,11 +107,12 @@ _XimThaiReset(
XIC xic)
{
Xic ic = (Xic)xic;
+ DefTreeBase *b = &ic->private.local.base;
ic->private.local.thai.comp_state = 0;
ic->private.local.thai.keysym = 0;
- ic->private.local.composed->mb[0] = '\0';
- ic->private.local.composed->wc[0] = 0;
- ic->private.local.composed->utf8[0] = '\0';
+ b->mb[b->tree[ic->private.local.composed].mb] = '\0';
+ b->wc[b->tree[ic->private.local.composed].wc] = '\0';
+ b->utf8[b->tree[ic->private.local.composed].utf8] = '\0';
}
Private char *
@@ -152,6 +155,7 @@ _XimThaiCreateIC(
XIMResourceList res;
unsigned int num;
int len;
+ DefTree *tree;
if((ic = (Xic)Xmalloc(sizeof(XicRec))) == (Xic)NULL) {
return ((XIC)NULL);
@@ -161,30 +165,23 @@ _XimThaiCreateIC(
ic->methods = &Thai_ic_methods;
ic->core.im = im;
ic->core.filter_events = KeyPressMask;
- if ((ic->private.local.context = (DefTree *)Xmalloc(sizeof(DefTree)))
- == (DefTree *)NULL)
- goto Set_Error;
- if ((ic->private.local.context->mb = (char *)Xmalloc(10))
- == (char *)NULL)
- goto Set_Error;
- if ((ic->private.local.context->wc = (wchar_t *)Xmalloc(10*sizeof(wchar_t)))
- == (wchar_t *)NULL)
- goto Set_Error;
- if ((ic->private.local.context->utf8 = (char *)Xmalloc(10))
- == (char *)NULL)
- goto Set_Error;
- if ((ic->private.local.composed = (DefTree *)Xmalloc(sizeof(DefTree)))
- == (DefTree *)NULL)
+
+ if (! (ic->private.local.base.tree = tree = (DefTree *)Xmalloc(sizeof(DefTree)*3)) )
goto Set_Error;
- if ((ic->private.local.composed->mb = (char *)Xmalloc(10))
- == (char *)NULL)
+ if (! (ic->private.local.base.mb = (char *)Xmalloc(21)) )
goto Set_Error;
- if ((ic->private.local.composed->wc = (wchar_t *)Xmalloc(10*sizeof(wchar_t)))
- == (wchar_t *)NULL)
+ if (! (ic->private.local.base.wc = (wchar_t*)Xmalloc(sizeof(wchar_t)*21)) )
goto Set_Error;
- if ((ic->private.local.composed->utf8 = (char *)Xmalloc(10))
- == (char *)NULL)
+ if (! (ic->private.local.base.utf8 = (char *)Xmalloc(21)) )
goto Set_Error;
+ ic->private.local.context = 1;
+ tree[1].mb = 1;
+ tree[1].wc = 1;
+ tree[1].utf8 = 1;
+ ic->private.local.composed = 2;
+ tree[2].mb = 11;
+ tree[2].wc = 11;
+ tree[2].utf8 = 11;
ic->private.local.thai.comp_state = 0;
ic->private.local.thai.keysym = 0;