From 7d7224d8543e85e3a34a1cddf99f3eac9aa9050b Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 12 Apr 2011 21:27:45 -0700 Subject: Replace Xmalloc+bzero pairs with Xcalloc calls Signed-off-by: Alan Coopersmith Reviewed-by: Jeremy Huddleston Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/imTrans.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'nx-X11/lib/X11/imTrans.c') diff --git a/nx-X11/lib/X11/imTrans.c b/nx-X11/lib/X11/imTrans.c index 0fdc8cd9a..a974c0ca3 100644 --- a/nx-X11/lib/X11/imTrans.c +++ b/nx-X11/lib/X11/imTrans.c @@ -293,13 +293,11 @@ _XimTransConf( if (!(paddr = (char *)Xmalloc(strlen(address) + 1))) return False; - if (!(spec = (TransSpecRec *) Xmalloc(sizeof(TransSpecRec)))) { + if (!(spec = Xcalloc(1, sizeof(TransSpecRec)))) { Xfree(paddr); return False; } - bzero(spec, sizeof(TransSpecRec)); - (void)strcpy(paddr, address); spec->address = paddr; -- cgit v1.2.3 From dde00b2f6848a38e9fdbe1e4c85373c8b12944b4 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 12 Apr 2011 22:30:45 -0700 Subject: Convert malloc(strlen()); strcpy() sets to strdup Signed-off-by: Alan Coopersmith Reviewed-by: Jeremy Huddleston Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/imTrans.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'nx-X11/lib/X11/imTrans.c') diff --git a/nx-X11/lib/X11/imTrans.c b/nx-X11/lib/X11/imTrans.c index a974c0ca3..4c4651599 100644 --- a/nx-X11/lib/X11/imTrans.c +++ b/nx-X11/lib/X11/imTrans.c @@ -290,7 +290,7 @@ _XimTransConf( char *paddr; TransSpecRec *spec; - if (!(paddr = (char *)Xmalloc(strlen(address) + 1))) + if (!(paddr = strdup(address))) return False; if (!(spec = Xcalloc(1, sizeof(TransSpecRec)))) { @@ -298,7 +298,6 @@ _XimTransConf( return False; } - (void)strcpy(paddr, address); spec->address = paddr; im->private.proto.spec = (XPointer)spec; -- cgit v1.2.3 From 11d6dac92b6c3c3f62d49817809ce8c6a61c9293 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 22 Oct 2012 13:54:11 -0500 Subject: XIM: remove Private and Public macros Private is a struct member name in mingw-w64 , causing this useless define in a private header to break the build. Signed-off-by: Yaakov Selkowitz Reviewed-by: Jon TURNEY Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/imTrans.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'nx-X11/lib/X11/imTrans.c') diff --git a/nx-X11/lib/X11/imTrans.c b/nx-X11/lib/X11/imTrans.c index 4c4651599..adfa044f5 100644 --- a/nx-X11/lib/X11/imTrans.c +++ b/nx-X11/lib/X11/imTrans.c @@ -72,7 +72,7 @@ PERFORMANCE OF THIS SOFTWARE. #endif -Private Bool +static Bool _XimTransConnect( Xim im) { @@ -122,7 +122,7 @@ _XimTransConnect( } -Private Bool +static Bool _XimTransShutdown( Xim im) { @@ -142,7 +142,7 @@ _XimTransShutdown( -Public Bool +Bool _XimTransRegisterDispatcher( Xim im, Bool (*callback)( @@ -164,7 +164,7 @@ _XimTransRegisterDispatcher( } -Public void +void _XimFreeTransIntrCallback( Xim im) { @@ -180,7 +180,7 @@ _XimFreeTransIntrCallback( } -Public Bool +Bool _XimTransCallDispatcher(Xim im, INT16 len, XPointer data) { TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; @@ -194,7 +194,7 @@ _XimTransCallDispatcher(Xim im, INT16 len, XPointer data) } -Public Bool +Bool _XimTransFilterWaitEvent( Display *d, Window w, @@ -209,7 +209,7 @@ _XimTransFilterWaitEvent( } -Public void +void _XimTransInternalConnection( Display *d, int fd, @@ -235,7 +235,7 @@ _XimTransInternalConnection( } -Public Bool +Bool _XimTransWrite(Xim im, INT16 len, XPointer data) { TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; @@ -252,7 +252,7 @@ _XimTransWrite(Xim im, INT16 len, XPointer data) } -Public Bool +Bool _XimTransRead( Xim im, XPointer recv_buf, @@ -273,7 +273,7 @@ _XimTransRead( } -Public void +void _XimTransFlush( Xim im) { @@ -282,7 +282,7 @@ _XimTransFlush( -Public Bool +Bool _XimTransConf( Xim im, char *address) -- cgit v1.2.3 From bd43a06402b7499a74de0d4fb5ef8330b490b38f Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 3 Sep 2010 23:11:53 -0700 Subject: Sun's copyrights are now owned by Oracle Signed-off-by: Alan Coopersmith Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/imTrans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/lib/X11/imTrans.c') diff --git a/nx-X11/lib/X11/imTrans.c b/nx-X11/lib/X11/imTrans.c index adfa044f5..f06759f88 100644 --- a/nx-X11/lib/X11/imTrans.c +++ b/nx-X11/lib/X11/imTrans.c @@ -1,5 +1,5 @@ /* - * Copyright 1992 Sun Microsystems, Inc. All rights reserved. + * Copyright 1992 Oracle and/or its affiliates. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), -- cgit v1.2.3 From ce482d4fd8fe565810391b0ac89e4b1ac8fd7212 Mon Sep 17 00:00:00 2001 From: "ISHIKAWA,chiaki" Date: Tue, 18 Dec 2012 15:28:05 +0000 Subject: Fix bogus timestamp generated by XIM Fix bogus timestamp generted by XIM due to uninitialized data field. Also set appropriate serial, too. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=39367 Signed-off-by: Chiaki ISHIKAWA Signed-off-by: Alan Coopersmith Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/imTrans.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'nx-X11/lib/X11/imTrans.c') diff --git a/nx-X11/lib/X11/imTrans.c b/nx-X11/lib/X11/imTrans.c index f06759f88..3cea659f9 100644 --- a/nx-X11/lib/X11/imTrans.c +++ b/nx-X11/lib/X11/imTrans.c @@ -222,12 +222,20 @@ _XimTransInternalConnection( if (spec->is_putback) return; + + bzero(&ev, sizeof(ev)); /* FIXME: other fields may be accessed, too. */ kev = (XKeyEvent *)&ev; kev->type = KeyPress; kev->send_event = False; kev->display = im->core.display; kev->window = spec->window; kev->keycode = 0; + kev->time = 0L; + kev->serial = LastKnownRequestProcessed(im->core.display); +#if 0 + fprintf(stderr,"%s,%d: putback FIXED kev->time=0 kev->serial=%lu\n", __FILE__, __LINE__, kev->serial); +#endif + XPutBackEvent(im->core.display, &ev); XFlush(im->core.display); spec->is_putback = True; -- cgit v1.2.3 From c161df4fee61819a28089682963cc2e721ca22c8 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 10 Aug 2013 23:51:08 -0700 Subject: Remove even more casts of return values from Xmalloc/Xrealloc Signed-off-by: Alan Coopersmith Backported-to-NX-by: Ulrich Sibiller --- nx-X11/lib/X11/imTrans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nx-X11/lib/X11/imTrans.c') diff --git a/nx-X11/lib/X11/imTrans.c b/nx-X11/lib/X11/imTrans.c index 3cea659f9..7f936cff6 100644 --- a/nx-X11/lib/X11/imTrans.c +++ b/nx-X11/lib/X11/imTrans.c @@ -153,7 +153,7 @@ _XimTransRegisterDispatcher( TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; TransIntrCallbackPtr rec; - if (!(rec = (TransIntrCallbackPtr)Xmalloc(sizeof(TransIntrCallbackRec)))) + if (!(rec = Xmalloc(sizeof(TransIntrCallbackRec)))) return False; rec->func = callback; -- cgit v1.2.3