summaryrefslogtreecommitdiff
path: root/psgeom.c
AgeCommit message (Collapse)Author
2023-02-11unifdef -UsgiHEADmasterAlan Coopersmith
SGI's End of Support Life for Irix was December 2013 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-04-16Stop leaking XkbAtomGetString allocationsAlan Coopersmith
XkbAtomGetString is a wrapper around XGetAtomName, and like XGetAtomName returns a newly allocated string (or NULL) on every call, so we should free those strings when done instead of leaking them. Reported by Oracle Parfait static analyser: Error: Memory leak Memory leak [memory-leak] (CWE 401): Memory leak of pointer pointer allocated with XkbAtomGetString(state->dpy, state->geom->name) at line 720 of app/xkbprint/psgeom.c in function 'PSProlog'. Allocated value returned to caller at line 207 of lib/libxkbfile/src/xkbatom.c in function 'XkbAtomGetString' pointer allocated at line 612 of app/xkbprint/psgeom.c in function 'PSProlog' with XkbAtomGetString(state->dpy, state->geom->name) pointer leaks when (i + 1) >= state->geom->num_colors at line 694 and (i + 1) >= state->geom->num_shapes at line 712. Memory leak [memory-leak] (CWE 401): Memory leak of pointer pointer allocated with XkbAtomGetString(state->dpy, state->geom->name) at line 720 of app/xkbprint/psgeom.c in function 'PSProlog'. Allocated value returned to caller at line 207 of lib/libxkbfile/src/xkbatom.c in function 'XkbAtomGetString' pointer allocated at line 657 of app/xkbprint/psgeom.c in function 'PSProlog' with XkbAtomGetString(state->dpy, state->geom->name) pointer leaks when (i + 1) >= state->geom->num_colors at line 694 and (i + 1) >= state->geom->num_shapes at line 712. Error: Memory leak Memory leak [memory-leak] (CWE 401): Memory leak of pointer name allocated with XkbAtomGetString(state->dpy, geom->name) at line 962 of app/xkbprint/psgeom.c in function 'PSPageTrailer'. Allocated value returned to caller at line 207 of lib/libxkbfile/src/xkbatom.c in function 'XkbAtomGetString' name allocated at line 845 of app/xkbprint/psgeom.c in function 'PSPageTrailer' with XkbAtomGetString(state->dpy, geom->name) name leaks when (p + 1) >= state->args->copies at line 926. Memory leak [memory-leak] (CWE 401): Memory leak of pointer sName allocated with XkbAtomGetString(state->dpy, sAtom) at line 962 of app/xkbprint/psgeom.c in function 'PSPageTrailer'. Allocated value returned to caller at line 207 of lib/libxkbfile/src/xkbatom.c in function 'XkbAtomGetString' sName allocated at line 877 of app/xkbprint/psgeom.c in function 'PSPageTrailer' with XkbAtomGetString(state->dpy, sAtom) sName leaks when (p + 1) >= state->args->copies at line 926. Memory leak [memory-leak] (CWE 401): Memory leak of pointer sName allocated with XkbAtomGetString(state->dpy, sAtom) at line 962 of app/xkbprint/psgeom.c in function 'PSPageTrailer'. Allocated value returned to caller at line 207 of lib/libxkbfile/src/xkbatom.c in function 'XkbAtomGetString' sName allocated at line 910 of app/xkbprint/psgeom.c in function 'PSPageTrailer' with XkbAtomGetString(state->dpy, sAtom) sName leaks when (p + 1) >= state->args->copies at line 926. Error: Memory leak Memory leak [memory-leak] (CWE 401): Memory leak of pointer dname allocated with XkbAtomGetString(xkb->dpy, doodad.any.name) at line 1068 of app/xkbprint/psgeom.c in function 'PSDoodad'. Allocated value returned to caller at line 207 of lib/libxkbfile/src/xkbatom.c in function 'XkbAtomGetString' dname allocated at line 974 of app/xkbprint/psgeom.c in function 'PSDoodad' with XkbAtomGetString(xkb->dpy, doodad.any.name) Memory leak [memory-leak] (CWE 401): Memory leak of pointer name allocated with XkbAtomGetString(...) at line 1068 of app/xkbprint/psgeom.c in function 'PSDoodad'. Allocated value returned to caller at line 207 of lib/libxkbfile/src/xkbatom.c in function 'XkbAtomGetString' name allocated at line 980 of app/xkbprint/psgeom.c in function 'PSDoodad' with XkbAtomGetString(...) Memory leak [memory-leak] (CWE 401): Memory leak of pointer name allocated with XkbAtomGetString(...) at line 1068 of app/xkbprint/psgeom.c in function 'PSDoodad'. Allocated value returned to caller at line 207 of lib/libxkbfile/src/xkbatom.c in function 'XkbAtomGetString' name allocated at line 1044 of app/xkbprint/psgeom.c in function 'PSDoodad' with XkbAtomGetString(...) Memory leak [memory-leak] (CWE 401): Memory leak of pointer name allocated with XkbAtomGetString(...) at line 1068 of app/xkbprint/psgeom.c in function 'PSDoodad'. Allocated value returned to caller at line 207 of lib/libxkbfile/src/xkbatom.c in function 'XkbAtomGetString' name allocated at line 1058 of app/xkbprint/psgeom.c in function 'PSDoodad' with XkbAtomGetString(...) Error: Memory leak Memory leak [memory-leak] (CWE 401): Memory leak of pointer pointer allocated with XkbAtomGetString(dpy, section->name) at line 2063 of app/xkbprint/psgeom.c in function 'PSSection'. Allocated value returned to caller at line 207 of lib/libxkbfile/src/xkbatom.c in function 'XkbAtomGetString' pointer allocated at line 1907 of app/xkbprint/psgeom.c in function 'PSSection' with XkbAtomGetString(dpy, section->name) pointer leaks when (k + 1) >= (section->rows + <pointer arithmetic>)->num_keys at line 1936 Memory leak [memory-leak] (CWE 401): Memory leak of pointer pointer allocated with XkbAtomGetString(dpy, shape->name) at line 2063 of app/xkbprint/psgeom.c in function 'PSSection'. Allocated value returned to caller at line 207 of lib/libxkbfile/src/xkbatom.c in function 'XkbAtomGetString' pointer allocated at line 1945 of app/xkbprint/psgeom.c in function 'PSSection' with XkbAtomGetString(dpy, shape->name) pointer leaks when (k + 1) >= (section->rows + <pointer arithmetic>)->num_keys at line 1936 and (r + 1) >= section->num_rows at line 1925. Memory leak [memory-leak] (CWE 401): Memory leak of pointer pointer allocated with XkbAtomGetString(dpy, shape->name) at line 2063 of app/xkbprint/psgeom.c in function 'PSSection'. Allocated value returned to caller at line 207 of lib/libxkbfile/src/xkbatom.c in function 'XkbAtomGetString' pointer allocated at line 1951 of app/xkbprint/psgeom.c in function 'PSSection' with XkbAtomGetString(dpy, shape->name) pointer leaks when (k + 1) >= (section->rows + <pointer arithmetic>)->num_keys at line 1936 and (r + 1) >= section->num_rows at line 1925. Memory leak [memory-leak] (CWE 401): Memory leak of pointer pointer allocated with XkbAtomGetString(dpy, shape->name) at line 2063 of app/xkbprint/psgeom.c in function 'PSSection'. Allocated value returned to caller at line 207 of lib/libxkbfile/src/xkbatom.c in function 'XkbAtomGetString' pointer allocated at line 1960 of app/xkbprint/psgeom.c in function 'PSSection' with XkbAtomGetString(dpy, shape->name) pointer leaks when (k + 1) >= (section->rows + <pointer arithmetic>)->num_keys at line 1936 and (r + 1) >= section->num_rows at line 1925. Memory leak [memory-leak] (CWE 401): Memory leak of pointer pointer allocated with XkbAtomGetString(dpy, shape->name) at line 2063 of app/xkbprint/psgeom.c in function 'PSSection'. Allocated value returned to caller at line 207 of lib/libxkbfile/src/xkbatom.c in function 'XkbAtomGetString' pointer allocated at line 1966 of app/xkbprint/psgeom.c in function 'PSSection' with XkbAtomGetString(dpy, shape->name) pointer leaks when (k + 1) >= (section->rows + <pointer arithmetic>)->num_keys at line 1936 and (r + 1) >= section->num_rows at line 1925. Error: Memory leak Memory leak [memory-leak] (CWE 401): Memory leak of pointer name allocated with XkbAtomGetString(...) at line 2131 of app/xkbprint/psgeom.c in function 'GeometryToPostScript'. Allocated value returned to caller at line 207 of lib/libxkbfile/src/xkbatom.c in function 'XkbAtomGetString' name allocated at line 2110 of app/xkbprint/psgeom.c in function 'GeometryToPostScript' with XkbAtomGetString(...) name leaks when name != NULL at line 2111. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-05-31Remove old CVS id tagsAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-05-31Fix some sign/size conversion warnings from clangAlan Coopersmith
psgeom.c:1320:17: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] if ((sym & (~0xff)) == 0x700) { ~ ^~~~~ psgeom.c:1666:31: warning: implicit conversion changes signedness: 'int' to 'unsigned long' [-Wsign-conversion] else if (((sym & (~0xff)) == 0) && isprint(sym) && (!isspace(sym))) { ~ ^~~~~ psgeom.c:1860:27: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32] int len = strlen(top->label[i]); ~~~ ^~~~~~~~~~~~~~~~~~~~~ xkbprint.c:460:19: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32] int len = strlen(inputFile); ~~~ ^~~~~~~~~~~~~~~~~ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-05-31Move some local variables to the scope in which they liveAlan Coopersmith
Helps both human readers and static code analyzers realize they're not used outside these scopes. Flagged by cppcheck 1.64: [psgeom.c:1761]: (style) The scope of the variable 'keycode' can be reduced. [psgeom.c:1858]: (style) The scope of the variable 'len' can be reduced. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-05-31Combine IsoKeyCaps array of strings into a single stringAlan Coopersmith
Packs more efficiently in binary, reduces number of calls to output, gets rid of ~4k array of pointers to each string in data segment to initialize on program load. "xkbprint -if IsoKeyCaps" generates identical IsoKeyCaps.pfa files before & after this change. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-05-27Replace calls to index() with calls to strchr()Alan Coopersmith
Both were in use in different functions, adopt the ANSI C standard function for all calls. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-05-27Combine repeated sequences of fprintf() calls into single callsAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-05-27Replace remaining sprintf calls with snprintf()Alan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-05-27Replace several malloc+sprintf pairs with asprintf() callsAlan Coopersmith
Includes fallback uAsprintf() for systems without asprintf yet Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-05-27Replace uStringDup() with direct calls to strdup()Alan Coopersmith
strdup is available in Unix98 and later, so part of the X.Org base platform requirements. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-05-27Replace custom uAlloc/uCalloc with plain malloc/callocAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-05-26Replace sole call to uFree() with direct call to free()Alan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-05-26Remove unused debugging & function tracing frameworksAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-05-26Fix many const char * warningsAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-05-26unifdef -Unotyet -UNOTYETAlan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2014-05-26Convert sources to X.Org standard coding styleAlan Coopersmith
Via util/modular/x-indent-all.sh Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2008-11-28Compile warning fixes.Paulo Cesar Pereira de Andrade
Use constant octals instead of constant characters in switch case values to avoid warnings/problems if constant characters are signed. Ansify some functions in utils.c. Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
2008-11-28correct outline with cornerRadiusPavel Kurashov
http://bugs.freedesktop.org/show_bug.cgi?id=12790 https://bugs.freedesktop.org/attachment.cgi?id=12008 Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
2004-04-23Merging XORG-CURRENT into trunkxprint_packagertest_20041217_basexprint_packagertest_20041125_basesco_port_update-baserel-0-6-1lg3d-rel-0-7-0lg3d-rel-0-6-2lg3d-baseXORG-6_8_99_903XORG-6_8_99_902XORG-6_8_99_901XORG-6_8_99_900XORG-6_8_99_9XORG-6_8_99_8XORG-6_8_99_7XORG-6_8_99_6XORG-6_8_99_5XORG-6_8_99_4XORG-6_8_99_3XORG-6_8_99_2XORG-6_8_99_16XORG-6_8_99_15XORG-6_8_99_14XORG-6_8_99_13XORG-6_8_99_12XORG-6_8_99_11XORG-6_8_99_10XORG-6_8_99_1XORG-6_8_2XORG-6_8_1_904XORG-6_8_1_903XORG-6_8_1_902XORG-6_8_1_901XORG-6_8_1XORG-6_8_0XORG-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-MERGExprint_packagertest_20041217xprint_packagertest_20041125sco_port_updatelg3d-masterlg3d-eventlg3d-dev-0-7-1lg3d-dev-0-7-0lg3d-dev-0-6-latestlg3d-dev-0-6-2lg3d-dev-0-6-1-latestlg3d-dev-0-6-1-currentlg3d-dev-0-6-1-1lg3d-dev-0-6-1lg3dXORG-6_8-branchCOMPOSITEWRAPEgbert 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_0STSF-CURRENTEgbert 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
2003-11-25XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folksxf86-4_3_99_903_specialxf86-4_3_99_902xf86-4_3_99_901xf86-4_3_99_16xf86-012804-2330Kaleb 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-MAINXORG-STABLEKaleb Keithley