summaryrefslogtreecommitdiff
path: root/keycodes.c
Commit message (Collapse)AuthorAgeFilesLines
* Mark more pointers as constAlan Coopersmith2023-01-031-8/+7
| | | | | | Some suggested by cppcheck, others by manual code inspection Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Use unsigned ints when shifting to create bitmasksAlan Coopersmith2023-01-031-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>
* Remove unnecessary casts from bzero() callsAlan Coopersmith2022-12-111-3/+3
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Remove unnecessary checks for NULL pointers before calling free()Alan Coopersmith2022-12-111-4/+2
| | | | | | Not needed in C89 and later Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Replace uFree() with direct free() callsAlan Coopersmith2022-12-111-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>
* Replace uAlloc() and uTypedAlloc() with direct malloc() callsAlan Coopersmith2022-12-111-1/+1
| | | | | | All these wrappers did was mess with types. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Variable scope reductionsAlan Coopersmith2022-12-111-18/+8
| | | | | | Some found by cppcheck, some found by manual code inspection Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Remove register keyword from variable declarationsAlan Coopersmith2022-12-101-4/+4
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* keycodes: compress the high keycode warningPeter Hutterer2021-01-211-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>
* keycodes: downgrade the >255 keycode warning to an infoPeter Hutterer2021-01-211-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>
* Replace WARN[1-9], ERROR[1-9], etc. with their unnumbered versionPeter Hutterer2021-01-211-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>
* Remove trailing whitespacesPeter Hutterer2021-01-211-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>
* Fix spelling/wording issuesAlan Coopersmith2020-07-231-2/+2
| | | | | | | Found by using: codespell --builtin clear,rare,usage,informal,code,names Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Suppress high-keycode warnings at the default warning levelAdam Jackson2018-12-111-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>
* Ignore xkb_keycodes.maximum of > 255Peter Hutterer2018-06-081-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>
* keycodes: Ignore high keycodesDaniel Stone2017-04-111-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>
* Don't dereference the pointer whose allocation failedAlan Coopersmith2014-03-101-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>
* Fix gcc warningsDaniel Stone2010-06-151-9/+7
| | | | | | It was right too: printf was being misused in some spots. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
* Correct make distcheck and most gcc and sparse warnings.Paulo Cesar Pereira de Andrade2009-01-211-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.
* sprintf -> snprintf conversionsAlan Coopersmith2008-09-051-1/+1
|
* Remove unused merge parameter from HandleKeyNameVar.Peter Hutterer2008-08-211-2/+2
|
* Don't pass useless handlers around in HandleIncludeKeycodes.Peter Hutterer2008-08-211-12/+9
| | | | What use is a handler if we only ever use one function anyway?
* More comments.Peter Hutterer2008-08-211-11/+51
|
* Silence valgrind warnings.Peter Hutterer2008-08-181-1/+1
| | | | "Conditional jump or move depends on uninitialised value(s)"
* Add some explanatory commentsPeter Hutterer2008-08-181-3/+3
|
* If we're not using XkbDesc, don't require it as a parameter.Peter Hutterer2008-08-121-9/+15
|
* Indent fixes.Peter Hutterer2008-08-121-585/+691
| | | | indent -cbi 0 -nprs -nut -npcs -i4 -bli 0 *.c *.h
* Remove RCS tags.Peter Hutterer2008-08-121-2/+0
|
* Fixed a bunch of const correctness bugs.Tilman Sauerbeck2007-09-231-2/+2
|
* Merging 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-MERGECOMPOSITEWRAPEgbert Eich2004-04-231-1/+1
|
* Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004xf86-4_4_99_1Egbert Eich2004-03-141-1/+1
|
* Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004xf86-4_4_0STSF-CURRENTEgbert Eich2004-03-031-1/+1
|
* readding XFree86's cvs IDsxf86-4_3_99_903Egbert Eich2004-02-261-1/+1
|
* Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004Egbert Eich2004-02-261-1/+1
|
* XFree86 4.3.0.1xf86-4_3_0_1PRE_xf86-4_3_0_1Kaleb Keithley2003-11-141-130/+2
|
* R6.6 is the Xorg base-lineXORG-MAINKaleb Keithley2003-11-141-0/+877