summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Replace XtMalloc() calls with XtMallocArray()Alan Coopersmith2023-03-0722-114/+91
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Replace XtRealloc() calls with XtReallocArray()Alan Coopersmith2023-03-0717-106/+79
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Add XtReallocArray() for overflow checking of multiplied argsAlan Coopersmith2023-03-071-1/+51
| | | | | | | | | | Uses reallocarray() if available, otherwise checks for overflow itself, if overflow is possible (i.e. in ILP32 & ILP64 environments, but not LP64 with 32-bit ints). Includes unit tests and XtMallocArray() helper macro. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Remove "All rights reserved" from Oracle copyright noticesAlan Coopersmith2023-02-2543-43/+43
| | | | | | Oracle no longer includes this term in our copyright & license notices. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* TMstate.c: Handle -Wduplicated-branches warningsAlan Coopersmith2023-02-091-16/+8
| | | | | | | | | | | | | | | | | Gets rid of these messages from gcc: TMstate.c: In function ‘GetBranchHead’: TMstate.c:128:12: warning: this condition has identical branches [-Wduplicated-branches] if (parseTree->branchHeadTblSize == 0) ^ TMstate.c: In function ‘_XtGetQuarkIndex’: TMstate.c:183:16: warning: this condition has identical branches [-Wduplicated-branches] if (parseTree->quarkTblSize == 0) ^ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Use memcpy() instead of XtMemmove() when buffers are known to differAlan Coopersmith2022-08-113-18/+16
| | | | | | | | | | | | | Most of these came from a mass XtBCopy() -> XtMemmove() substitution in 1993 with a commit comment of "ANSIfication". But include/X11/IntrinsicI.h now defines XtMemmmove() as just calling memcpy() as long as src & dst differ, so remove an unnecessary check when we've just allocated a buffer, and reduce the chance that someone thinks we'll actually call memmove() instead of memcpy() Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Use memcpy() instead of memmove() when buffers are known not to overlapAlan Coopersmith2022-08-1112-64/+60
| | | | | | | Most of these came from a mass bcopy() -> memmove() substitution in 1993 with a commit comment of "ANSIfication". Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Fix spelling/wording issuesAlan Coopersmith2022-07-172-4/+4
| | | | | | | Found by using: codespell --builtin clear,rare,usage,informal,code,names Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Support buttons > 5 in translation tables [v2]Keith Packard2022-06-201-14/+46
| | | | | | | | | | | Add support for arbitrary button numbers by replacing the table-driven detail parsing for BtnDown/ButtonPress and BtnUp/ButtonRelease with a custom parser that allows for an arbitrary button number (1-255) after the 'Button' prefix. Document what this syntax looks like in the table of detail information. Signed-off-by: Keith Packard <keithp@keithp.com>
* cppcheck (revise IsDescendant() to fix possible null-dereference)Thomas E. Dickey2022-06-181-4/+3
| | | | Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
* cppcheck fixes (const, null dereferencing, uninitialized, scope)Thomas E. Dickey2022-06-1816-48/+53
| | | | Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
* fixes for gcc13 warningsThomas E. Dickey2022-06-182-1/+4
| | | | Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
* cppcheck and clang --analyze fixesThomas E. Dickey2022-06-1812-19/+28
| | | | Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
* codespell-fixesThomas E. Dickey2022-06-1411-26/+26
| | | | Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
* Fix InternalCallbackRec layout if pointers are bigger than 64 bitsAlex Richardson2021-06-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | When running `xeyes` via `SSH -X` on CHERI-RISC-V FreeBSD, I was getting a Bus Error (unaligned store) in the `cl->callback = callback;` line of _XtAddCallback. The `cl` variable (created using `ToList(icl)`) was only aligned to 8 bytes, but for CHERI-RISC-V pointer-type loads and stores require 16-byte alignment. In order to fix this, I added a C99 flexible array member to internalCallbackRec when compiling for C99 or newer. This ensures that sizeof(InternalCallbackRec) is 16 (since it now includes the required 12 byte padding up to the first XtCallbackRec). This also ensures that alignof(InternalCallbackRec) is 16, but that doesn't matter in this case since malloc() will always return a sufficiently-aligned pointer. I also changed ToList(p) to use the flexible array member directly when compiling for C99. This is not a functional change since it will evaluate to the same pointer, but it does add additional type checking and ensures that only a `InternalCallbackRec *` can be passed to the macro. Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
* Cast via intptr_t when converting integers to pointersAlex Richardson2021-06-276-8/+8
| | | | | | | I found these by compiling libXt with the CHERI Clang compiler, as it warns about conversions from integer to pointer that do not use intptr_t. Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
* _XtCalloc actually uses a Cardinal, not size_tThomas E. Dickey2020-02-051-2/+2
|
* add errorhandling to _XtVaToTypedArgList()Walter Harms2019-12-221-6/+15
| | | | | | | | to make it behave like _XtVaToTypedArgList() add some checks and make sure that all args are propper initialized. also replace Malloc with Calloc and get arg check for free Signed-off-by: Walter Harms <wharms@bfs.de>
* Merge branch 'master' of ssh://gitlab.freedesktop.org/xorg/lib/libxtWalter Harms2019-12-2255-21321/+21972
|\
| * add a null-pointer check, overlooked in fix for issue #12.Thomas E. Dickey2019-11-151-12/+14
| | | | | | | | Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * issue #12: work within existing interface which attempts to obtain theThomas E. Dickey2019-11-091-0/+14
| | | | | | | | | | | | | | | | | | display-pointer from the screen-pointer but fails when the screen-pointer itself is invalid. Ensure that the screen-pointer is valid by checking the default_screen value against the valid range, and forcing it to zero if it is out of bounds. Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * issue 12 - DISPLAY=:0.-1 XtScreenDatabase segfaultThomas E. Dickey2019-11-091-0/+6
| | | | | | | | | | | | Add a null-pointer check XtScreenDatabase(), exit if no display was opened. Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * improved the script used for typedef-options with indent, updated indentationThomas E. Dickey2019-08-0148-568/+557
| | | | | | | | Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * remove the ARGUSED lines, which confuse GNU indent, ditto for LINTLIBRARYThomas E. Dickey2019-07-1411-44/+16
| | | | | | | | Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-46/+41
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-51/+56
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-136/+140
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-509/+540
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-19/+17
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-109/+112
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-115/+115
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-53/+59
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-56/+54
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-516/+527
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-797/+840
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-580/+521
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-269/+290
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-1112/+1164
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-135/+143
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-508/+473
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-85/+84
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-19/+13
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-63/+59
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-733/+719
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-829/+889
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-1260/+1298
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-1522/+1601
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-27/+26
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-270/+287
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
| * indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey2019-07-141-45/+43
| | | | | | | | | | | | https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>