summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2023-03-07Replace XtMalloc() calls with XtMallocArray()Alan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2023-03-07Replace XtRealloc() calls with XtReallocArray()Alan Coopersmith
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2023-03-07Add XtReallocArray() for overflow checking of multiplied argsAlan Coopersmith
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>
2023-02-25Remove "All rights reserved" from Oracle copyright noticesAlan Coopersmith
Oracle no longer includes this term in our copyright & license notices. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2023-02-09TMstate.c: Handle -Wduplicated-branches warningsAlan Coopersmith
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>
2022-08-11Use memcpy() instead of XtMemmove() when buffers are known to differAlan Coopersmith
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>
2022-08-11Use memcpy() instead of memmove() when buffers are known not to overlapAlan Coopersmith
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>
2022-07-17Fix spelling/wording issuesAlan Coopersmith
Found by using: codespell --builtin clear,rare,usage,informal,code,names Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2022-06-20Support buttons > 5 in translation tables [v2]Keith Packard
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>
2022-06-18cppcheck (revise IsDescendant() to fix possible null-dereference)Thomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2022-06-18cppcheck fixes (const, null dereferencing, uninitialized, scope)Thomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2022-06-18fixes for gcc13 warningsThomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2022-06-18cppcheck and clang --analyze fixesThomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2022-06-14codespell-fixesThomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2021-06-27Fix InternalCallbackRec layout if pointers are bigger than 64 bitsAlex Richardson
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>
2021-06-27Cast via intptr_t when converting integers to pointersAlex Richardson
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>
2020-02-05_XtCalloc actually uses a Cardinal, not size_tThomas E. Dickey
2019-12-22add errorhandling to _XtVaToTypedArgList()Walter Harms
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>
2019-12-22Merge branch 'master' of ssh://gitlab.freedesktop.org/xorg/lib/libxtWalter Harms
2019-12-22refactoring, reduce indent levelWalter Harms
Signed-off-by: Walter Harms <wharms@bfs.de>
2019-11-15add a null-pointer check, overlooked in fix for issue #12.Thomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-11-09issue #12: work within existing interface which attempts to obtain theThomas E. Dickey
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>
2019-11-09no need to check arguments for XtFree()Walter Harms
Signed-off-by: Walter Harms <wharms@bfs.de>
2019-11-09issue 12 - DISPLAY=:0.-1 XtScreenDatabase segfaultThomas E. Dickey
Add a null-pointer check XtScreenDatabase(), exit if no display was opened. Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-08-01improved the script used for typedef-options with indent, updated indentationThomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14remove the ARGUSED lines, which confuse GNU indent, ditto for LINTLIBRARYThomas E. Dickey
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
2019-07-14indent'd like "x-indent.sh", but with a more complete set of typedefs - seeThomas E. Dickey
https://github.com/ThomasDickey/cindent-snapshots/blob/master/scripts/xxx-profile Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>