summaryrefslogtreecommitdiff
path: root/geometry.c
AgeCommit message (Collapse)Author
2023-01-03Mark more pointers as constAlan Coopersmith
Some suggested by cppcheck, others by manual code inspection Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2023-01-03Handle -Wstringop-truncation warning in HandleOverlayDef()Alan Coopersmith
In function ‘HandleOverlayDef’, inlined from ‘HandleSectionBody’ at geometry.c:2778:18, inlined from ‘HandleSectionDef’ at geometry.c:2818:10, inlined from ‘HandleGeometryFile’ at geometry.c:2864:18: geometry.c:2573:9: warning: ‘strncpy’ output may be truncated copying 4 bytes from a string of length 4 [-Wstringop-truncation] 2573 | strncpy(key->over, keyDef->over, XkbKeyNameLength); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ geometry.c:2574:9: warning: ‘strncpy’ output may be truncated copying 4 bytes from a string of length 4 [-Wstringop-truncation] 2574 | strncpy(key->under, keyDef->under, XkbKeyNameLength); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2023-01-03Use asprintf() if the platform supports itAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-12-11Replace malloc()+bzero() pairs with calloc() callsAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-12-11Remove unnecessary casts from bzero() callsAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-12-11Remove unnecessary checks for NULL pointers before calling free()Alan Coopersmith
Not needed in C89 and later Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-12-11Replace uFree() with direct free() callsAlan Coopersmith
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 uCalloc() and uTypedCalloc() with direct calloc() callsAlan Coopersmith
All these wrappers did was mess with types. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-12-11Replace uAlloc() and uTypedAlloc() with direct malloc() callsAlan Coopersmith
All these wrappers did was mess with types. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-12-11Use C99 struct initializersAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-12-11Variable scope reductionsAlan Coopersmith
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 Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-12-10Eliminate 20 -Wimplicit-fallthrough warningsAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-12-10Avoid possibly dereferencing null pointerLeandro Nini
This addresses issue #21 Signed-off-by: Leandro Nini <drfiemost@email.it>
2021-01-21Replace WARN[1-9], ERROR[1-9], etc. with their unnumbered versionPeter Hutterer
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 Hutterer
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 Coopersmith
Found by using: codespell --builtin clear,rare,usage,informal,code,names Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-03-10Remove useless assignment to 'outline' variableAlan Coopersmith
Flagged by cppcheck 1.64: [app/xkbcomp/geometry.c:2426] -> [app/xkbcomp/geometry.c:2427]: (performance) Variable 'outline' is reassigned a value before the old one has been used. 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>
2013-11-01Fix many const char * warnings from gccAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2013-11-01Convert remaining sprintf calls to snprintfAlan Coopersmith
Most were fixed length or length checked anyway, this just saves time doublechecking that. (A few could be replaced by asprintf, but we don't have a copy guaranteed to be reachable from this program yet.) Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net>
2011-11-11Silence -Wshadow warningsJeremy Huddleston
warning: declaration shadows a local variable [-Wshadow] Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-11Correct our zeroing out of the row in InitRowInfoJeremy Huddleston
geometry.c:369:20: warning: argument to 'sizeof' in '__builtin___memset_chk' call is the same pointer type 'RowInfo *' (aka 'struct _RowInfo *') as the destination; expected 'RowInfo' (aka 'struct _RowInfo') or an explicit length [-Wsizeof-pointer-memaccess] bzero(row, sizeof(RowInfo *)); ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-02-13Inline the oiText macro in the only place it's usedJulien Cristau
Gets rid of a compiler warning: geometry.c: In function 'HandleOverlayDef': geometry.c:2578: warning: the address of 'ol' will always evaluate as 'true' X.Org bug#34219 <https://bugs.freedesktop.org/show_bug.cgi?id=34219> Signed-off-by: Julien Cristau <jcristau@debian.org> Reviewed-by: Dirk Wallenstein <halsmit@t-online.de>
2008-08-12Indent fixes.Peter Hutterer
indent -cbi 0 -nprs -nut -npcs -i4 -bli 0 *.c *.h
2008-08-12Remove RCS tags.Peter Hutterer
2007-09-23Fixed a bunch of const correctness bugs.Tilman Sauerbeck
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 Eich
2004-03-14Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004xf86-4_4_99_1Egbert Eich
2004-03-03Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004xf86-4_4_0Egbert Eich
2004-02-26readding XFree86's cvs IDsxf86-4_3_99_903Egbert Eich
2004-02-26Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004Egbert Eich
2004-01-29Importing vendor version xf86-012804-2330 on Thu Jan 29 00:06:33 PST 2004xf86-4_3_99_903_specialxf86-012804-2330Egbert Eich
2003-11-25XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folksxf86-4_3_99_901xf86-4_3_99_16Kaleb Keithley
2003-11-14XFree86 4.3.0.1xf86-4_3_0_1PRE_xf86-4_3_0_1Kaleb Keithley
2003-11-14R6.6 is the Xorg base-lineXORG-MAINKaleb Keithley