Commit Graph

130 Commits

Author SHA1 Message Date
firewave 64154ea66d enabled and fixed constVariable Cppcheck warnings 2026-03-04 15:49:29 +01:00
firewave 214cf50df5 fixed some unreadVariable Cppcheck warnings 2026-03-03 16:33:51 +01:00
matt335672 d3bfe802cc Code quality: Fix some cppcheck messages
This commit addresses these kind of errors:

portability: Passing NULL after the last typed argument to a variadic function leads to undefined behaviour. [varFuncNullUB]

Reason is that C does not guarantee that all pointer types are the same
size. See C99 6.2.5(27). cppcheck requires some sort of cast when NULL
is used as the last argument in a variadic list.
2026-02-20 16:02:05 +01:00
matt335672 0bf09425c5 Merge pull request #3657 from firewave/missinclude
enabled and fixed `missingInclude` Cppcheck warnings
2025-11-06 11:20:17 +00:00
firewave b4cf498144 fixed -Wold-style-declaration compiler warnings
Example:
```
fontutils/fv1.c:36:1: error: ‘static’ is not at beginning of declaration [-Werror=old-style-declaration]
   36 | const static char FV1_SIGNATURE[] = {'F', 'N', 'T', '1'};
      | ^~~~~
```
2025-11-05 13:51:49 +01:00
firewave d580c8d339 adjusted some includes 2025-11-04 13:41:26 +01:00
matt335672 3700867e87 Add timers module
Allows a polled timer to be set for a future event. The timeout
values are suitable for passing to g_obj_wait() or poll().
2025-08-22 12:29:20 +01:00
matt335672 d015535065 Add CCP support to xrdp
This allows sesexec to send a reason for a connection close
request to xrdp.

xrdp is also updated to support server initiated disconnection sequences
from [MS-RDPBCGR] 1.3.1.4, along with reporting a reason to the client
for the disconnection.
2025-07-21 11:30:14 +01:00
matt335672 7baa27a59f Add set_int type
This type can be used to store sets of integers. It is intended to
be used to keep track of the display numbers allocated to sessions and
SCP connections.

A test suite for the new type is also added.
2025-07-07 15:02:51 +01:00
matt335672 bc0e169451 Rationalise g_htoi() / xrdp_wm_htoi()
xrdp contains two functions which do similar things:-
- g_htoi() converts a hex string to an integer, ignoring unrecognised
  characters
- xrdp_wm_htoi() converts a hex string to an integer, ignoring leading
  whitespace, but terminating on unrecognised characters

An analysis of the uses of g_htoi() shows that the only place where
unrecognised characters might be encountered is parsing lines from
xrdp_keyboard.ini, where all values have an '0x' prefix (i.e. the 'x'
is unrecognised)

An analysis of xrdp_wm_htoi() shows that the functionality to ignore
leading whitespace is not used.

Both functions are replaced with a re-written g_htoi() which is const-
correct and provided with test cases. This function behaves in
the same way as the atoi() library function, in that it terminates on
an unexpected character.

The use of g_htoi() in parsing lines from xrdp_keyboard.ini is replaced
with a call to g_atoix() which handles the '0x' prefix correctly.
2025-03-31 15:36:51 +01:00
matt335672 f9a9ed2a68 Add g_readdir_entries() to OS calls 2025-03-12 10:06:22 +00:00
matt335672 3cc1265adc Add test suite calls for list16
Following a re-write of the list16 module to avoid memory allocation
issues, a test suite is added for the module.
2025-02-27 15:04:11 +00:00
matt335672 2f46ef27a2 Add support for cppcheck 2.17.0
cppcheck 2.17.0 adds checks that a NULL pointer returned from malloc() and
calloc() is not used.

We do this quite a lot.

I've addressed this by adding functions g_malloc_nofail() and
g_calloc_nofail() which either allocate memory or abort.
functions are now called in places where we are not making these
checks.

Many of these checks are in test programs or example programs.

I've modified the list16 module to handle out-of-memory conditions.
2025-02-27 15:04:11 +00:00
Koichiro Iwao ad5b76dd36 x264: make threads configurable
Closes: #3366
(cherry picked from commit e6f5e3b0b59feaa08873c0406f85e5a8632881c7)
2024-12-27 11:15:05 +09:00
Koichiro Iwao 032b9b070b tests: add tests for OpenH264 params and prefered H264 encoder
(cherry picked from commit 92bd0812a398bc8d966e978cac32d3f80ffb1df2)
2024-11-29 20:52:46 +09:00
Koichiro Iwao 4b177dab01 tests: fix tests after OpenH264
(cherry picked from commit 655215f3038b653eb163ad00899c182b68ea8c64)
2024-11-29 20:52:46 +09:00
matt335672 5351511272 Further changes to selectable H.264 support
- Fix CI errors
- tconfig_load_gfx() removes H.264 from the supported codec list
  if significant errors are found loading the H.264 configuration
- tconfig_load_gfx() always produces a usable config, even if the
  specified file can't be loaded
2024-08-29 21:02:36 +09:00
matt335672 1ac216da1d Rework codec order in tconfig
Replaced codec idx values with a list of codecs from the
config file.

Added some logging for debugging
2024-08-28 21:18:05 +09:00
Koichiro Iwao 07e4e23c7b tconfig: add config which to prefer H264 vs RFX 2024-08-27 11:46:47 +09:00
Koichiro Iwao d50c2fd4e4 tconfig: Makefile changes 2024-08-23 10:40:58 +09:00
Koichiro Iwao b3513ba8df tconfig: add new toml config parser for gfx.toml 2024-08-23 10:40:44 +09:00
matt335672 7fe5b3ea34 Move pause key processing from xorgxrdp
This commit moves processing of the pause key from xorgxrdp
back to xrdp itself, so that the key can be passed to the VNC
backend.
2024-08-05 10:44:10 +01:00
matt335672 43d6db45ed Add module test for scancode index conversions 2024-08-05 10:44:10 +01:00
matt335672 c91ef80ca9 Implement scancode indexing
The mapping from scancodes to the indexes used in xrdp_keymap
is not well designed and contains an implicit dependency on
keycode values.

This mapping is alse slightly different from the index used for
the 'keys' map in the xrdp_wm structure.

This commit introduces support for mapping scancodes directly
to 'scancode indexes' suitable for indexing into both structures.

Some renaming is also done; [MS-RDPBCGR] uses the terms scancode
and keyCode interchangeably. An effort is made to use key_code for a
raw value from a TS_KEYBOARD_EVENT, and scancode for a value which is
produced by the scancode module.
2024-08-05 10:44:10 +01:00
matt335672 4d91771cac Add basic keymap loading test 2024-05-24 16:34:30 +01:00
matt335672 1cb2ce06cd Update xrdp to use new keymap file format 2024-05-24 16:33:08 +01:00
matt335672 b0cfc1a12b Add initial scancode module 2024-05-24 16:33:08 +01:00
matt335672 4e77772ea2 Fix problems detected by -fsanitize=address 2024-05-07 12:51:30 +01:00
firewave 5eed76f32b fixed -Wunused-function compiler warnings 2024-04-23 18:38:20 +02:00
firewave fb9c175b11 enabled and fixed -Wmissing-prototypes compiler warnings
Co-authored-by: matt335672 <30179339+matt335672@users.noreply.github.com>
2024-04-23 18:38:20 +02:00
matt335672 4f03b02302 Don't generate a corefile when generating SIGSEGV
One of the tests uses a child process which generates SIGSEGV.
On FreeBSD this generates a corefile by default which breaks
the 'make distcheck' process.
2024-03-14 11:14:49 +00:00
matt335672 bc9b35c38c Rename struct exit_status in os_calls
This conflicts with struct exit_status in <utmp.h>
2024-02-21 09:24:48 +00:00
matt335672 db04b4b54c Increase back-stop timeouts for some tests
The Debian build farm has a number of older and slower machines
which need to run the xrdp test suite.

On these platforms, we occasionally get timeouts where machine load is
high. This results in duplicate issues being raised. It is not obvious
that the issues are duplicates, which wastes time all round.

This commit splits up some test cases into multiple cases and
adds larger timeouts for those cases that are CPU-intensive.
2024-01-04 15:16:23 +00:00
matt335672 62a51dead9 Fix g_strtrim() regression
Commit 36ea4a3 failed to take UTF-8 characters into account on
platforms with signed char.
2024-01-02 11:07:28 +00:00
matt335672 0758fe03a6 Add UTF-16 LE I/O routines
These are intended to replace UTF-16 uses of mbstowcs() / wcstombs()
2023-10-18 10:07:49 +01:00
matt335672 0463e552dc Add UTF-8 / UTF-32 conversion routines
These are intended to replace non-UTF-16 uses of mbstowcs() / wcstombs()
2023-10-18 10:07:49 +01:00
matt335672 ad5916c5e4 Check waitpid is not interrupted by a signal
Checks that the waitpid() call isn't interrupted by a
signal when the handler for the signal is set to not
interrupt the call
2023-10-09 19:53:16 +01:00
matt335672 d098214531 Add tests for signal functions in os_calls.c 2023-10-09 14:10:38 +01:00
matt335672 d11617adbe Remove dependency on signal() function
Replaces uses of signal() with sigaction() which should be far
more portable.
2023-10-09 14:05:29 +01:00
matt335672 ce42e3e12d Replace g_strsignal() with g_sig2text()
This call provides a textual representation of a signal number, i.e.
SIGHUP is mapped to "SIGHUP"

Unit tests are also added.
2023-06-12 16:19:17 +01:00
CynCeyd f4210a20ae Switched os_calls.h and test_common.h include order since HAVE_STDINT_H would get undefined by check.h. 2023-06-04 12:05:33 +02:00
matt335672 d5684e0633 Add module tests for new fifo module 2023-05-22 14:43:22 +01:00
Daniel Richard G 1c0c923ad1 Split g_file_open() into _ro() and _rw() variants
Rename g_file_open() to g_file_open_rw(), and add a new g_file_open_ro()
call that wraps the common g_file_open_ex(file, 1, 0, 0, 0) idiom. This
will make the file access mode more explicit in the code.

Change all calls to g_file_open() to the _ro() or _rw() variant as
appropriate, and replace g_file_open_ex(file, 1, 0, 0, 0) with the _ro()
call.

Lastly, add tests for the two new calls to test_os_calls.c (code
courteously provided by matt335672).
2023-05-15 17:38:31 -04:00
matt335672 ff24984cf3 os_calls: Add g_file_is_open() 2023-05-02 11:55:22 +01:00
matt335672 563cfaf009 Merge pull request #2643 from matt335672/close_unwanted_fds
Fix leaking file descriptors
2023-05-02 11:54:05 +01:00
Jat 2a58ba40c9 remove unnecessary include check.h 2023-04-28 10:25:21 +08:00
matt335672 cf9e07d341 Add basic tests for cloexec and get_open_fds functions 2023-04-24 14:20:14 +01:00
matt335672 c3d697de16 Add list_add_strdup() etc 2023-03-06 15:58:13 +00:00
matt335672 a317c3de5d Fix regression in list module 2023-03-06 15:47:49 +00:00
Nexarian 89e178e7c9 Add function to split string into list.
- With working unit tests.
2023-03-03 18:33:33 -05:00