summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* libXt 1.3.0HEADlibXt-1.3.0masterAlan Coopersmith2023-04-091-2/+2
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* 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-077-15/+264
| | | | | | | | | | 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>
* test: Add unit tests for XtMalloc, XtCalloc, & XtReallocAlan Coopersmith2023-03-073-1/+508
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* configure: Use LT_INIT from libtool 2 instead of deprecated AC_PROG_LIBTOOLAlan Coopersmith2023-03-041-1/+1
| | | | | | | | | | | | | AC_PROG_LIBTOOL was replaced by LT_INIT in libtool 2 in 2008, so it's time to rely on it. Clears autoconf warnings: configure.ac:36: warning: The macro `AC_PROG_LIBTOOL' is obsolete. configure.ac:36: You should run autoupdate. m4/libtool.m4:100: AC_PROG_LIBTOOL is expanded from... configure.ac:36: the top level Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Remove "All rights reserved" from Oracle copyright noticesAlan Coopersmith2023-02-2545-45/+45
| | | | | | 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>
* Add xfilesearchpath to xt.pcAlan Coopersmith2023-02-091-0/+1
| | | | | | | Make setting of --with-xfile-search-path available to other components, without having to link with libXt. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* configure.ac: Replace HAVE_LIBRARY with AC_CHECK_LIBAlan Coopersmith2023-02-061-1/+1
| | | | | | | | | | | | | AC_CHECK_LIB was introduced in autoconf 2.0 (1994) to replace HAVE_LIBRARY Clears autoconf warnings of: configure.ac:108: warning: The macro `AC_HAVE_LIBRARY' is obsolete. configure.ac:108: You should run autoupdate. ./lib/autoconf/libs.m4:138: AC_HAVE_LIBRARY is expanded from... configure.ac:108: the top level Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* tests: Replace g_assert() calls with g_assert_*() callsAlan Coopersmith2022-12-174-17/+20
| | | | | | | | | | | | https://docs.gtk.org/glib/testing.html warns against using g_assert() in test cases, since it is a no-op when compiling with G_DISABLE_ASSERT. The replacement calls also give more detailed messages on failures. Raises the minimum required glib version for building unit tests from 2.16 (released March 2008) to 2.40 (released March 2014) to get support for g_assert_nonnull(). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* tests: Use XORG_MEMORY_CHECK_FLAGS from xorg-macros 1.16Alan Coopersmith2022-12-171-21/+4
| | | | | | | | Replaces previous local copy which had gotten out of date. Raises xorg-macros minimum version from 1.13 (released March 2011) to 1.16 (Dec. 2011). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* tests: update g_test_bug_base url from bugzilla to gitlabAlan Coopersmith2022-12-173-3/+6
| | | | | | | | | | Also adds a call to g_test_bug() for the one existing testcase associated with a bug in a public bug tracker. Otherwise this is mostly a placeholder for now, as no other tests call g_test_bug() yet to report what bugs they test for. 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>
* gitlab CI: stop requiring Signed-off-by in commitsAlan Coopersmith2022-07-171-2/+2
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Fix spelling/wording issuesAlan Coopersmith2022-07-173-5/+5
| | | | | | | Found by using: codespell --builtin clear,rare,usage,informal,code,names Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Build xz tarballs instead of bzip2Alan Coopersmith2022-07-171-1/+1
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* update copyright-dateThomas E. Dickey2022-06-201-1/+1
|
* Support buttons > 5 in translation tables [v2]Keith Packard2022-06-202-16/+48
| | | | | | | | | | | 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-183-1/+6
| | | | 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-1425-53/+53
| | | | Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
* add _X_NORETURN to agree with header-fileThomas E. Dickey2022-06-144-8/+8
| | | | Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
* gitlab CI: add a basic build testAlan Coopersmith2021-12-021-0/+102
| | | | Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
* Fix InternalCallbackRec layout if pointers are bigger than 64 bitsAlex Richardson2021-06-272-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix XrmResource layout if pointers are bigger than longAlex Richardson2021-06-271-4/+9
| | | | | | | | | | | | On CHERI-enabled architectures (e.g. Arm's Morello), pointers are twice the size of addresses (i.e. 128 bits for Morello, 64 bits for 32-bit RISC-V). However, XtArgVal is currently defined as long, so it cannot be used to store pointers on these architectures. Also add a _Static_assert() when compiling with C11 support to check that the offset of the last member matches that of XtResource. 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>
* Use XtUIntPtr for integer types that can hold pointersAlex Richardson2021-06-271-5/+5
| | | | | | | | | | | Various Xt*Id types are integer types that are used to hold pointers. Use uintptr_t for standards-compliant conversion and to support architectures where long cannot hold pointers (e.g. CHERI). 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>
* XtArgVal: Support architectures where pointers are bigger than longAlex Richardson2021-06-271-1/+15
| | | | | | | | | | | | | | | | | | | | On CHERI-enabled architectures (e.g. Arm's Morello), pointers are twice the size of addresses (i.e. 128 bits for Morello, 64 bits for 32-bit RISC-V). However, XtArgVal is currently defined as long, so it cannot be used to store pointers on these architectures. This commit changes XtArgVal to use intptr_t instead, which should be long on most architectures but is larger for CHERI. It also introduces XtIntPtr/XtUIntPtr which will be used in follow-up changes. This commit should also help on LLP64 ABIs where long is 32 bits but pointers are 64 bits. I am not sure what the compiler and C standard requirements are, so I've guarded the use of stdint.h with `#if __STDC_VERSION__ >= 199901L`. I've also added a _Static_assert() when compiling in C11 mode to statically verify that the XtArgVal type requirements are met. Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
* Define LONG64 if __SIZEOF_LONG__ indicates 64-bit longAlex Richardson2021-06-161-1/+5
| | | | | | | | | | | All modern compilers (GCC>=4.6, Clang>=3.0) define this macro, so we can use it to detect 64-bit longs without adding to the architecture list. This change is needed to successfully run xeyes on a FreeBSD CHERI-RISC-V QEMU VM via SSH forwarding. See also https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/merge_requests/41 Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk>
* libXt 1.2.1libXt-1.2.1Matt Turner2021-01-241-1/+1
| | | | Signed-off-by: Matt Turner <mattst88@gmail.com>
* _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-2259-21814/+22521
|\
| * 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>
| * new buildThomas E. Dickey2019-11-091-1/+1
| | | | | | | | 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>
| * bump minor version to reflect code-cleanupThomas E. Dickey2019-07-141-1/+1
| | | | | | | | 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>