Left behind when 15e5eaf628 removed support for building without XCB.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
Flagged by cppcheck 1.62:
[lib/libX11/src/xkb/XKBGeom.c:479] -> [lib/libX11/src/xkb/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>
clear & selectAll are set to 0 already a few lines earlier,
affectWhich is set to XkbMapNotifyMask a few lines later.
None are used between the other assignments and the removed ones.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
See http://sourceware.org/bugzilla/show_bug.cgi?id=10948
Currently, if the locale is UTF-8, no CJK fonts are installed, and someone
does XCreateFontSet() with a font name of "*", we end up asking the server
to list the (non-existent) fonts 11 times for each CJK encoding, which can
take a while.
A * wildcard can match multiple components in a XLFD name in XListFonts(),
so there's no need to try adding more than one to get a match.
We do try once with a leading '*-' in case the fontname isn't a full
well-formed XLFD name, maybe even that isn't needed?
(See also http://invisible-island.net/xterm/xterm.faq.html#slow_menus)
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
C89 or bust! This was documented as being needed for "only Lynx,
Linux-libc5, OS/2" and has never been enabled in modular builds,
since none of those platforms have had anyone step up to add support
since the X11R7 conversion to autotools.
Mostly performed with unifdef -UX_LOCALE, followed by removal of files
left without any purpose, and manual cleanup of remaining references.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
The field2 helper function, to split lines from Xcms.txt files into
two tab delimited fields, contained a check:
if ((*pBuf != '\n') || (*pBuf != '\0')) {
return(XcmsFailure);
which would cause it to return failure unless *pBuf had a value that
was simultaneously equal to both \n & \0, and no one wants to live in
a world where that could ever be true.
This has gone unnoticed since 1991, since this only caused lines
in Xcms.txt that started with whitespace to be rejected, but now
gcc -Wlogicalop has brought it to our attention, and
https://bugs.freedesktop.org/show_bug.cgi?id=70803 was filed.
Now that we see it, and cannot unsee it, we change it to use the
same logic as the check at other points in this function, to return
failure only if we hit \n or \0 before we find the first non-whitespace
character, so that lines starting with whitespace will have the space
skipped over to get to the color name to be defined.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
It's the only thing built in that directory, so we can use AM_CFLAGS
and AM_CPPFLAGS as usual.
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
Few keyboards have an <acute> key, so this adds the much more
accessible and usual compose sequences with <apostrophe>, ánd
the most comfortable ones with <dead_acute>.
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: James Cloos <cloos@jhcloos.com>
Leftover from when these XKB files were shared with the server sources
and could be compiled in either the client or server, with the different
autoconf config files in each.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
We were checking to make sure that the largest keysym value was within
the range of the allocated buffer, but checking against different limits
in the not-yet-allocated vs. the already-allocated branches.
The check should be the same in both, and reflect the size used for the
allocation, which is based on the maximum key code value, so we move it
to be a common check, before we branch, instead of duplicating in each
branch.
map->key_sym_map is an array of XkbSymMapRec structs, [0..max_key_code]
map->syms is the array for which num_syms is recorded, hence is not the
right value to check for ensuring our key_sym_map accesses are in range.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reported-by: Barry Kauler <bkauler@gmail.com>
Tested-by: Barry Kauler <bkauler@gmail.com>
I can find no record of what this file was for. Neither the X11R6.8.2
monolith Imakefile nor any modular release Makefile.am have ever built
it and nothing else references it.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Left one cast behind that is necessary to change from const char *
to char * in src/xlibi18n/lcCharSet.c.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
sizeof() returns size_t, malloc() & calloc() expect sizes in size_t,
don't strip down to unsigned int and re-expand unnecessarily.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
The array is defined as having NUM_LOCALEDIR entries, so use that
instead of hardcoded 256 value (the other two calls already did this).
Reported by parfait:
Buffer overflow (CWE 120): In pointer dereference of argv[argc] with index argc
Pointer size is 64 elements (of 8 bytes each), index is 255
at line 82 of src/xlibi18n/lcFile.c in function 'parse_line'.
called at line 178 in function '_XlcParsePath' with argv = argv.
called at line 722 in function '_XlcLocaleLibDirName' with argv = args, argsize = 256.
at line 82 of src/xlibi18n/lcFile.c in function 'parse_line'.
called at line 178 in function '_XlcParsePath' with argv = argv.
called at line 638 in function '_XlcLocaleDirName' with argv = args, argsize = 256.
[ This bug was found by the Parfait 1.2.0 bug checking tool.
http://labs.oracle.com/pls/apex/f?p=labs:49:::::P49_PROJECT_ID:13 ]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
imRm.c: In function '_XimSetICMode':
imRm.c:2419:37: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
imRm.c:2420:30: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
lcGenConv.c: In function 'byteM_parse_codeset':
lcGenConv.c:345:13: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Add const qualifiers to casts where needed, remove other casts that
are no longer needed.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Instead of reusing the input parameter to store the output, make a
result variable instead, so that there's less const confusion.
Fixes gcc warnings:
lcWrap.c: In function 'XSetLocaleModifiers':
lcWrap.c:87:18: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
lcWrap.c:91:25: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
lcWrap.c:93:12: warning: cast discards '__attribute__((const))' qualifier from pointer target type [-Wcast-qual]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Makes code considerably less crufty and clears gcc warnings:
XlcDL.c: In function '_XlcDynamicLoad':
XlcDL.c:384:44: warning: cast discards '__attribute__((const))' qualifier
from pointer target type [-Wcast-qual]
XlcDL.c:386:51: warning: cast discards '__attribute__((const))' qualifier
from pointer target type [-Wcast-qual]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Strings from the supported_charset_list[] were being copied one by
one to a stack buffer, and then strdup called on that buffer.
Instead, just strdup the original string, without the local copy,
and use a more traditional for loop, so it's easier to figure out
what the code is doing (cleaning up a gcc const-cast warning in
the process).
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr>
This function performs operations on a region, and when finished,
checks to see if it should compact the rectangle list. If the
number of rectangles for which memory is allocated in the list is
more than twice the number used, it tries to shrink. realloc()
should not fail in this case, but if it does, might as well keep
the correct value for the number of allocated rectangles, so we
don't try to grow it unnecessarily later if adding to the region.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Zero out the region size when freeing the region so callers don't think
there's anything there. (Pointer is already set to NULL from the realloc
result itself.) Return 0 to the callers, and have them cascade that back
to their callers to indicate failure, instead of their usual return value
of 1 on success.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Previously, if realloc failed to increase the size, we'd still
record that we had allocated the larger size, but the pointer
to it would be NULL, causing future calls to be broken, and the
previous allocation to be lost/leaked.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr>
Previous code seemed to assume that printf("%s", NULL) would result
in a 0-length string, not "(null)" or similar, but since there's no
point looking for files in "(null)/filepath...", instead we just
skip over NULL entries in search paths when generating file names.
In the *DirName() functions, this effectively just moves the "bail on
NULL in arg[i]" check up from the later code that assigned it to targetdir
and then bailed if that was NULL.
Not sure how there ever could be a NULL in arg[i], given the current
implementation of XlcParsePath, but it's easy enough to check once and
reject up front instead of on every reference.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
File Leak: Leaked File fp
at line 219 of lib/libX11/src/xlibi18n/XlcDL.c in function 'resolve_object'.
fp initialized at line 198 with fopen
[ This bug was found by the Parfait 1.2.0 bug checking tool.
http://labs.oracle.com/pls/apex/f?p=labs:49:::::P49_PROJECT_ID:13 ]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr>
Commits 4076189869 and
f198c6aa98 added two new locales
(sr_CS.UTF-8 and km_KH.UTF-8), but didn't list them in configure.ac,
meaning they're not included in tarballs.
Signed-off-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: James Cloos <cloos@jhcloos.com>
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 <ishikawa@yk.rim.or.jp>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
XSetICFocus() and XUnsetICFocus() are both asynchronous events.
This is a pretty stupid idea: those functions may undo certain
settings on the client side for which requests from the server
may still be in the queue unprocessed. Thus things may be set
in the wrong order ie instead of set -> unest it will be unset -> set.
Moreover there is no way for either the client or the server to
cause the event queue to be flushed - which is pretty bad as
XIM is bidirectional.
The scenario is as follows:
Two ICs are created:
ic1 = XCreateIC(im,
XNInputStyle, XIMPreeditCallbacks | XIMStatusCallbacks,
XNClientWindow, window,
XNPreeditAttributes, preedit_attr,
XNStatusAttributes, status_attr,
NULL);
ic2 = XCreateIC(im, XNInputStyle,
XIMPreeditNothing | XIMStatusNothing,
XNClientWindow, window, NULL);
Then the focus is removed from ic2:
XUnsetICFocus(ic2);
If SCIM is used as the input server it will send a bunch of requests
following an XCreateIC(). One of the requests registers a key release
filter. XUnsetICFocus() unsets both key press and release filters.
Since it is asynchronous, the input server requests to register key
press and release filters may not have been processed, when XUnsetICFocus()
is called. Since there is no explicite way for client programs to enforce
the request queue to be flushed explicitely before an X[Set/Unset]ICFocus()
call it would be safest to make those two calls synchronous in the sense
that they ensure the request queue has been handled before they execute.
The easiest way to do this from Xlib is thru a call to XGetICValues()
which sends a request to the server and subsequently reads the queue
from the server to the client. This will cause all outstanding requests
in the queue to be read and handled.
This is an ugly hack and this could be fixed directly in the client,
however it seems to be easier to fix Xlib than to fix numerous clients.
This problem arose since there is no well documented way how to handle
and synchronize XIM requests and not all input servers send requests
when an IC is created.
This has been discussed extensively in:
https://bugzilla.novell.com/show_bug.cgi?id=221326
Signed-off-by: Egbert Eich <eich@freedesktop.org>
When synthesized key events are sent on commit XIM sets the 'fabricated'
flag so that the keypress handler knows that these were not real events.
This also happens when committing due to the loss of focus. However in this
case the keypress/release filters which consume and unset this flag are no
longer in the filter chain.
So the flag is erronously set when a real keyboard event is received after
focus has been regained. So the first event is wrongly treated as a
fabricated key in the keypress handler which will at the same time reset
the flag so the second key event is treated correctly.
This fix only sets the flag when at least one of the keyboard filters is in
place.
How to reproduce this bug: run scim, choose a Japanese input method start
two instances of xterm: start typing in one xterm (this should pop up an
IM window). Without comitting (hitting 'enter') move focus to the other
xterm, then move focus back. Start typing again. The first character will
be committed immediately without popping up an input window.
With this fix this behavior is gone.
See also: https://bugzilla.novell.com/show_bug.cgi?id=239698
Signed-off-by: Egbert Eich <eich@freedesktop.org>
Upstreaming from changes originally integrated into OpenSolaris
under Sun bug id 6882572.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Thomas Klausner <wiz@NetBSD.org>
On the Xlib side, the only real difference is the mode flag we send
to the server with the address, so just make that an argument to the
function with the common code for packing the address into the request.
(Aside from labels, gcc 4.7.2 generates identical code before & after
this change due to inlining, verified via diff of gcc -S output.)
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Handle arbitrary length data in the same fashion as other calls,
avoiding need to ensure it fits all in the request buffer.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This fixes the two callers of GetReqExtra to check that "req" is non-NULL
to avoid crashing now that GetReqExtra does internal bounds-checking on
the resulting buffer sizes.
Additionally updates comment describing return values to use names
instead of only literal values.
Signed-off-by: Kees Cook <kees@outflux.net>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>