aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11
Commit message (Collapse)AuthorAgeFilesLines
* Fixes: warning: variable 'req' set but not,usedwalter harms2016-10-2017-18/+18
| | | | | | | | | | Fixes: warning: variable 'req' set but not used [-Wunused-but-set-variable] by marking req _X_UNUSED Solution was discussed on xorg-devel ML Peter Hutter, Alan Coopersmith Re: [PATCH libX11 3/5] fix: warning: pointer targets in passing argument 2 of '_XSend' differ in signedness [-Wpointer-sign] Signed-off-by: harms wharms@bfs.de
* fix: warning: pointer targets in passing argument 2 of '_XSend' differ in ↵walter harms2016-10-201-2/+2
| | | | | | | signedness [-Wpointer-sign] fix signess warning by casting Signed-off-by: walter harms <wharms@bfs.de>
* no need to check args for Xfree()walter harms2016-10-201-41/+33
| | | | | | simplify code Signed-off-by: walter harms <wharms@bfs.de>
* remove stray externwalter harms2016-10-201-1/+1
| | | | | | remove stray extern Signed-off-by: walter harms <wharms@bfs.de>
* Fix warnings in XlibInt.cUlrich Sibiller2016-10-202-0/+7
| | | | | | | | | | | | XlibInt.c: In function ‘_XIOError’: XlibInt.c:3750:1: warning: ‘noreturn’ function does return [enabled by default] } After fixing the above a new warning came up, which is also fixed now: XlibInt.c: In function ‘_XIOError’: XlibInt.c:3750:1: warning: control reaches end of non-void function [-Wreturn-type] }
* imLcIm.c: Fix unused variablesUlrich Sibiller2016-10-201-3/+4
| | | | | | | | | imLcIm.c: In function ‘_XimCreateDefaultTree’: imLcIm.c:525:11: warning: unused variable ‘cachedir’ [-Wunused-variable] char *cachedir = NULL; ^ imLcIm.c:521:35: warning: variable ‘intname’ set but not used [-Wunused-but-set-variable] char *name, *tmpname = NULL, *intname;
* Pending.c: Fix compilation warningUlrich Sibiller2016-10-201-2/+2
| | | | | | | Pending.c: In function ‘XEventsQueued’: Pending.c:44:5: warning: format ‘%p’ expects argument of type ‘void *’, but argument 3 has type ‘struct Display *’ [-Wformat=] fprintf(stderr, "\nXEventsQueued: Called with a display at [%p].\n", dpy); ^
* Fix libX11 implicit declaration warningsUlrich Sibiller2016-10-201-2/+2
| | | | | | | | all _X11Trans* functions lead to a warnign like this: implicit declaration of function ‘_X11TransOpenCOTSClient’ [-Wimplicit-function-declaration] Fix it by partly reverting d3ae0b2c9559e70448746240caaf5634c78d0eef (which removed too much)
* Drop nx-X11/lib/X11/libX11.elist. Not needed for anything nowadays. Probably ↵Mike Gabriel2016-10-201-41/+0
| | | | never was needed in nx-X11.
* Validation of server responses in XGetImage()Tobias Stoeckmann2016-10-191-9/+20
| | | | | | | | | | Check if enough bytes were received for specified image type and geometry. Otherwise GetPixel and other functions could trigger an out of boundary read later on. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org> Reviewed-by: Matthieu Herrb <matthieu@herrb.eu> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* The validation of server responses avoids out of boundary accesses.Tobias Stoeckmann2016-10-193-11/+27
| | | | | | | | | v2: FontNames.c return a NULL list whenever a single length field from the server is incohent. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org> Reviewed-by: Matthieu Herrb <matthieu@herrb.eu> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* xcms: use size_t for pointer offsets passed to strncmpAlan Coopersmith2016-10-195-10/+10
| | | | | | | | | | | | | instead of converting to int and back Fixes clang warnings of the form: HVC.c:190:43: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] if (strncmp(spec, _XcmsTekHVC_prefix, n) != 0) { ~~~~~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* xcms: use unsigned indexes when looping through unsigned valuesAlan Coopersmith2016-10-196-11/+11
| | | | | | | | | | | | | Clears many gcc warnings of the form: uvY.c: In function ‘XcmsCIEuvYToCIEXYZ’: uvY.c:263:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < nColors; i++, pColor++) { ^ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* xcms: use size_t for strlen/sizeof values instead of converting to int & backAlan Coopersmith2016-10-192-2/+2
| | | | | | | | | | | | | | | | | | | | | Fixes gcc warnings of the form: IdOfPr.c: In function ‘XcmsFormatOfPrefix’: IdOfPr.c:69:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if ((len = strlen(prefix)) >= sizeof(string_buf)) { ^ IdOfPr.c:83:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (len >= sizeof(string_buf)) Xfree(string_lowered); ^ IdOfPr.c:97:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (len >= sizeof(string_buf)) Xfree(string_lowered); ^ IdOfPr.c:104:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (len >= sizeof(string_buf)) Xfree(string_lowered); ^ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Xlib.h: Fix macros imitating C functions.Dominik Muth2016-10-191-17/+17
| | | | | | | | | | | | | | | | | | The basic rule "put parantheses around macro parameters" should be observed where possible. Otherwise code like ConnectionNumber(foo = bar); fails to compile. (It obviously passes if ConnectionNumber is a C function.) There are several other macros amended for the same reason. This bug appeared while building http://ioccc.org/1993/cmills.c, so historically it was not present. Signed-off-by: Dominik Muth <muth@nxdomain.no-ip.biz> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* XKB: fix XkbGetKeyboardByName with Xming serverOlivier Fourdan2016-10-191-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | XkbGetKeyboardByName relies on flags to read the data from the server. If the X server sends us the wrong flags or if a subreply is smaller than it should be, XkbGetKeyboardByName will not read all the available data and leave data in the buffer, which will cause the next _XReply() to fail with: [xcb] Extra reply data still left in queue [xcb] This is most likely caused by a broken X extension library [xcb] Aborting, sorry about that. xcb_io.c:576: _XReply: Assertion `!xcb_xlib_extra_reply_data_left' failed. Aborted Check if there is some extra data left at the end of XkbGetKeyboardByName() and discard that data if any is found. Many thanks to Peter Hutterer <peter.hutterer@who-t.net> for finding the root cause of the issue and Adam Jackson <ajax@redhat.com> for helping with the analysis! Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* lcPubWrap: replace malloc(strlen) + strcpy with strdupAlan Coopersmith2016-10-191-2/+1
| | | | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* XlcDL.c: reduce code duplicationAlan Coopersmith2016-10-191-12/+10
| | | | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* XlcDL.c: replace strcpy+strcat sequences with snprintfAlan Coopersmith2016-10-191-6/+8
| | | | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* XDefaultOMIF: Remove comments referring to ancient Sun bug idsAlan Coopersmith2016-10-191-14/+1
| | | | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* XDefaultOMIF: additional code simplificationAlan Coopersmith2016-10-191-32/+11
| | | | | | | | | | | Don't need to test for a case that we already returned for, don't need to store a count that will only ever be 1 if we didn't return, don't need to increment pointers to allow storing more than one item when we can only ever possibly do one. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* XDefaultOMIF: replace strlen+Xmalloc+strcpy with strdupAlan Coopersmith2016-10-191-15/+8
| | | | | | | | | Code seems to have been originally written to handle appending multiple strings, but only ever operates on a single string. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Use strdup instead of Xmalloc+strcpy in _XDefaultOpenIMAlan Coopersmith2016-10-191-2/+1
| | | | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Delete #if 0 hunks of codeAlan Coopersmith2016-10-194-152/+0
| | | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Bug 93183: _XDefaultOpenIM memory leaks in out-of-memory error pathsAlan Coopersmith2016-10-191-33/+25
| | | | | | | | | | | Rework code to store allocations directly into XIM struct instead of temporary local variables, so we can use _XCloseIM to unwind instead of duplicating it, and consistently jump to error handler on failure, instead of sometimes leaking and sometimes freeing. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93183 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Bug 93184: read_EncodingInfo invalid freeAlan Coopersmith2016-10-191-3/+4
| | | | | | | | Free the correct bits of memory if we run out and need to unwind Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93184 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Remove unused definition of XCONN_CHECK_FREQAlan Coopersmith2016-10-191-8/+0
| | | | | | | | | The only use of XCONN_CHECK_FREQ was removed in commit 15e5eaf62897b3179 when we dropped the old Xlib connection handling in favor of xcb's. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Mark Kettenis <kettenis@openbsd.org> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Get rid of some extraneous ; at the end of C source linesAlan Coopersmith2016-10-193-3/+3
| | | | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Thomas Klausner <wiz@NetBSD.org> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Do not return() after exit().Thomas Klausner2016-10-191-2/+2
| | | | | | Signed-off-by: Thomas Klausner <wiz@NetBSD.org> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Add missing NULL checks to ICWrapRoss Burton2016-10-191-6/+9
| | | | | | | | | | | | | | ICWrap.c dereferences the xim parameter passed in from client code without a NULL check. I have seen mplayer trigger this resulting in a segfault. In this case mplayer had called XOpenIM and NULL was returned which was later passed into XCreateIC. Patch originally by Drew Moseley <drew_moseley@mentor.com>. Signed-off-by: Ross Burton <ross.burton@intel.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Replace Xmalloc+memset pairs with Xcalloc callsAlan Coopersmith2016-10-193-19/+10
| | | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* omGeneric.c: Correct the parameter usage of sizeofBhavi Dhingra2016-10-191-1/+1
| | | | | | | | | | Incorrect parameter usage with sizeof. Earlier passed argument FontData will be 4 bytes always as its a pointer hence the change is needed and FontDataRec should be used for memset. Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Fix three "use of uninitialized variable" coverity warningsPeter Hutterer2016-10-193-3/+3
| | | | | | | | | | False positive, if rlen/nbytes are unset we quit early before using it. Still, initialize it so we don't have to deal with these warnings again. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Fix potential memory leakPeter Hutterer2016-10-191-2/+2
| | | | | | | | | | | If we hit the depth limit, filename leaks. Move the depth check up before we allocate filename. Introduced in 226622349a4b1e16064649d4444a34fb4be4f464. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* compose: fix the description of modifiers in compose sequencesRan Benita2016-10-191-2/+3
| | | | | | | | | | | | | | | | | | The Compose format has a feature which allows specifying certain modifiers must (or must not) be present with a given keysym in the sequence. The grammar in imLcPrs.c and the Compose man page both do not match what the code actually does (see the handling of the variables `modifier_mask` and `modifier` in parseline() in imLcPrs.c, which are eventually matched as `ev->state & modifier_mask == modifier`). Also explicitly list the accepted modifier names, since they are not standard (e.g. "Ctrl" instead of "Control"). Signed-off-by: Ran Benita <ran234@gmail.com> Signed-off-by: James Cloos <cloos@jhcloos.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Use C99 named initializers to fill in events passed to XSendEventAlan Coopersmith2016-10-193-38/+47
| | | | | | | | | | | | | Forces compiler to zero-fill unset fields in the struct (fixing bug 81236) and allows optimizer to order field initialization to best fit cache layout or other considerations. Before & after output of gcc -S on AMD64 shows insertion of "rep stosq" instructions to rapidly zero-fill structs. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Matthieu Herrb <matthieu@herrb.eu> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Fix validation of ctrls parameter to XkbGetPerClientControls()Alan Coopersmith2016-10-191-7/+4
| | | | | | | | | | | | | | | | | | | | Nothing in the XKB spec states that the memory pointed to by ctrls has to be initialized to any given value when passed to the function, only that it is set by the function to the values returned by the X server: http://www.x.org/releases/X11R7.7/doc/libX11/XKB/xkblib.html#The_Miscellaneous_Per_client_Controls The check for the incoming value seems to be copied from XkbSetPerClientControls without explanation. Instead change it to checking if ctrls is non-NULL, since there's no point asking the X server to return a value the caller won't even see. Found while investigating report from cppcheck-1.65: [nx-X11/lib/X11/XKB.c:699] -> [nx-X11/lib/X11/XKB.c:719]: (warning) Possible null pointer dereference: ctrls - otherwise it is redundant to check it against null. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Fix map->num_types check in XkbAddKeyType()Alan Coopersmith2016-10-191-1/+1
| | | | | | | | | | Check is intended to ensure we allocate at least XkbNumRequiredTypes in map, but was accidentally marked with a ! causing the wrong check. Reported-by: Harms <wharms@bfs,de> Reviewed-by: Matthieu Herrb <matthieu@herrb.eu> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* lcDefConv.c: fix use before checkwalter harms2016-10-191-11/+27
| | | | | | | | | | * Do not use variables before checked for NULL. * remove some superfluid spaces (Mark Kettenis) Signed-off-by: Harms <wharms@bfs,de> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* rm redundant null checkswalter harms2016-10-197-70/+52
| | | | | | | | | | remove more redundant NULL checks note that _XkbFree() is really Xfree() Signed-off-by: Harms <wharms@bfs,de> Reviewed-by: Rémi Cardona <remi@gentoo.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* libX11: rm redundante NULL checkswalter harms2016-10-199-65/+44
| | | | | | | | | This patch removes the last remaining NULL checks for Xfree() Signed-off-by: Harms <wharms@bfs,de> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Remove more redundant null checks before Xfree()walter harms2016-10-1911-163/+102
| | | | | | | Signed-off-by: Harms <wharms@bfs,de> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Remove redundant null checks before freewalter harms2016-10-1921-86/+73
| | | | | | | | | | | This patch removes some redundant null checks before free. It should not change the code otherwise. Be aware that this is only the first series. Signed-off-by: Harms <wharms@bfs,de> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* libX11/lcUTF8.c fix: dereferenced before checkwalter harms2016-10-191-1/+3
| | | | | | | | | * Do not use variables before checked for NULL. Signed-off-by: Harms <wharms@bfs,de> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* libX11/XKBNames.c fix: dereferenced before checkwalter harms2016-10-191-2/+7
| | | | | | | | | * Do not use variables before checked for NULL. Signed-off-by: Harms <wharms@bfs,de> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* libX11/lcGenConv.c fix: dereferenced before checkwalter harms2016-10-191-5/+14
| | | | | | | | | * Do not use variables before checked for NULL. Signed-off-by: Harms <wharms@bfs,de> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Fix XNextRequest() after direct usage of XCBOwen W. Taylor2016-10-191-0/+21
| | | | | | | | | | | | | | | | | When XCB owns the X socket, dpy->request is not updated, so NextRequest() and XNextRequest() return the wrong value. There's nothing we can do to fix NextRequest() while retaining ABI compat, but change XNextRequest() to grab the socket back from XCB, updating dpy->request. Signed-off-by: Owen W. Taylor <otaylor@fishsoup.net> Reviewed-by: Uli Schlachter <psychon@znc.in> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>: Added #ifdefs to be aware of changes regarding XCB in case we later switch to XCB.
* Remove dead USE_OWN_COMPOSE-protected codeRan Benita2016-10-192-174/+0
| | | | | | | | | | | | The build doesn't provide any way to define this option. It also refers to files (imComp.h) and functions (e.g. XimCompInitTables(), XimCompProcessSym()) which are not found anywhere, and the ordinary Compose implementation in xim doesn't use any of it. Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* Fix typos in Xrm.c commentsAlan Coopersmith2016-10-191-2/+2
| | | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
* _XkbReadGeomOverlay: check for NULL first, then use pointerAlan Coopersmith2016-10-191-1/+1
| | | | | | | | | | Flagged by cppcheck 1.62: [lib/libX11/nx-X11/lib/X11/XKBGeom.c:479] -> [lib/libX11/nx-X11/lib/X11/XKBGeom.c:480]: (warning) Possible null pointer dereference: row - otherwise it is redundant to check it against null. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>