summaryrefslogtreecommitdiff
path: root/keycodes.c
AgeCommit message (Collapse)AuthorFilesLines
2023-01-03Mark more pointers as constAlan Coopersmith1-8/+7
Some suggested by cppcheck, others by manual code inspection Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2023-01-03Use unsigned ints when shifting to create bitmasksAlan Coopersmith1-2/+2
symbols.c:1057:28: portability: Shifting signed 32-bit value by 31 bits is implementation-defined behaviour. See condition at line 1049. [shiftTooManyBitsSigned] radio_groups |= (1 << (tmp.uval - 1)); ^ symbols.c:1049:41: note: Assuming that condition 'tmp.uval>32' is not redundant if ((tmp.uval < 1) || (tmp.uval > XkbMaxRadioGroups)) ^ symbols.c:1057:28: note: Shift radio_groups |= (1 << (tmp.uval - 1)); ^ symbols.c:1057:28: warning: Either the condition 'tmp.uval>32' is redundant or there is signed integer overflow for expression '1<<(tmp.uval-1)'. [integerOverflowCond] radio_groups |= (1 << (tmp.uval - 1)); ^ symbols.c:1049:41: note: Assuming that condition 'tmp.uval>32' is not redundant if ((tmp.uval < 1) || (tmp.uval > XkbMaxRadioGroups)) ^ symbols.c:1057:28: note: Integer overflow radio_groups |= (1 << (tmp.uval - 1)); ^ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-12-11Remove unnecessary casts from bzero() callsAlan Coopersmith1-3/+3
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-12-11Remove unnecessary checks for NULL pointers before calling free()Alan Coopersmith1-4/+2
Not needed in C89 and later Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-12-11Replace uFree() with direct free() callsAlan Coopersmith1-3/+3
All these wrappers did was mess with types and add a test for NULL pointers that isn't needed in C89 and later. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-12-11Replace uAlloc() and uTypedAlloc() with direct malloc() callsAlan Coopersmith1-1/+1
All these wrappers did was mess with types. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-12-11Variable scope reductionsAlan Coopersmith1-18/+8
Some found by cppcheck, some found by manual code inspection Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-12-10Remove register keyword from variable declarationsAlan Coopersmith1-4/+4
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2021-01-21keycodes: compress the high keycode warningPeter Hutterer1-6/+2
No point spending 3 lines on this, especially given that this warning is always triggered. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-21keycodes: downgrade the >255 keycode warning to an infoPeter Hutterer1-2/+2
This warning will be triggered all the time now that xkeyboard-config has started adding keycodes > 255. Downgrade to an info, there's nothing the user can do about this warning anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-21Replace WARN[1-9], ERROR[1-9], etc. with their unnumbered versionPeter Hutterer1-40/+40
Those macros date back to when varargs weren't a thing but they've been #defined to the same value for 17 years now. Patch generated with: for action in WARN INFO ERROR ACTION FATAL WSGO; do sed -i "s/${action}[1-9]/${action}/g" `git ls-files` done Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-21Remove trailing whitespacesPeter Hutterer1-9/+9
Let's clean this up so I don't have to fight vim and git in removing them. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-23Fix spelling/wording issuesAlan Coopersmith1-2/+2
Found by using: codespell --builtin clear,rare,usage,informal,code,names Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-12-11Suppress high-keycode warnings at the default warning levelAdam Jackson1-2/+2
We expect evdev to have keycodes above 255, there's no reason to warn about this. Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-06-08Ignore xkb_keycodes.maximum of > 255Peter Hutterer1-1/+9
Continuation from 7fdfabd75 "keycodes: Ignore high keycodes" A keymap with a key > 255 will have a xkb_keycodes.maximum of that keycode. Let's not throw a fatal error on that, just crop it back to the maximum of 255. This doesn't set the "high_keycode_warned" on purpose so we get this for the first key that actually matters. Reproducible with xkeyboard-config 2.24 which has a maximum of 374. https://bugzilla.redhat.com/show_bug.cgi?id=1587998 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2017-04-11keycodes: Ignore high keycodesDaniel Stone1-8/+20
Rather than throwing a fatal error when a keycode definition exceeds the declared maximum (i.e. 255), just ignore the definition and continue. This allows xkeyboard-config to start shipping datasets including high keycodes, which will work in xkbcommon as it ignores explicit range declarations. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Ran Benita <ran234@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reported-by: Christian Kellner <gicmo@gnome.org>
2014-03-10Don't dereference the pointer whose allocation failedAlan Coopersmith1-1/+1
Flagged by cppcheck 1.64: [app/xkbcomp/keycodes.c:264] -> [app/xkbcomp/keycodes.c:262]: (warning) Possible null pointer dereference: new - otherwise it is redundant to check it against null. [app/xkbcomp/keytypes.c:600] -> [app/xkbcomp/keytypes.c:597]: (warning) Possible null pointer dereference: old - otherwise it is redundant to check it against null. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2010-06-15Fix gcc warningsDaniel Stone1-9/+7
It was right too: printf was being misused in some spots. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-01-21Correct make distcheck and most gcc and sparse warnings.Paulo Cesar Pereira de Andrade1-1/+1
Remaining warnings are due to macros that check address or vectors on the stack and auto generated yacc code. Compiled with default flags and also as: % make CFLAGS=-DENTRY_TRACKING_ON -DDEBUG_ON -DASSERTIONS_ON to ensure the "simplification" of code like: foo.c: <hash>define DEBUG_VAR foo_VAR <hash>include "foo.h" ... foo.h: <hash>ifdef DEBUG_VAR_NOT_LOCAL extern <hash>endif int DEBUG_VAR; ... did not change the author's "intended" logic.
2008-09-05sprintf -> snprintf conversionsAlan Coopersmith1-1/+1
2008-08-21Remove unused merge parameter from HandleKeyNameVar.Peter Hutterer1-2/+2
2008-08-21Don't pass useless handlers around in HandleIncludeKeycodes.Peter Hutterer1-12/+9
What use is a handler if we only ever use one function anyway?
2008-08-21More comments.Peter Hutterer1-11/+51
2008-08-18Silence valgrind warnings.Peter Hutterer1-1/+1
"Conditional jump or move depends on uninitialised value(s)"
2008-08-18Add some explanatory commentsPeter Hutterer1-3/+3
2008-08-12If we're not using XkbDesc, don't require it as a parameter.Peter Hutterer1-9/+15
2008-08-12Indent fixes.Peter Hutterer1-585/+691
indent -cbi 0 -nprs -nut -npcs -i4 -bli 0 *.c *.h
2008-08-12Remove RCS tags.Peter Hutterer1-2/+0
2007-09-23Fixed a bunch of const correctness bugs.Tilman Sauerbeck1-2/+2
2004-04-23Merging XORG-CURRENT into trunkXORG-6_7_99_904XORG-6_7_99_903XORG-6_7_99_902XORG-6_7_99_901XORG-6_7_99_2XORG-6_7_99_1XACE-SELINUX-MERGEEgbert Eich1-1/+1
2004-03-14Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004xf86-4_4_99_1Egbert Eich1-1/+1
2004-03-03Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004xf86-4_4_0Egbert Eich1-1/+1
2004-02-26readding XFree86's cvs IDsxf86-4_3_99_903Egbert Eich1-1/+1
2004-02-26Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004Egbert Eich1-1/+1
2003-11-14XFree86 4.3.0.1xf86-4_3_0_1PRE_xf86-4_3_0_1Kaleb Keithley1-130/+2
2003-11-14R6.6 is the Xorg base-lineXORG-MAINKaleb Keithley1-0/+877