Repository: FreeRDP/FreeRDP (C)

Issue:
2.11.5: build fails with `-Wpointer-sign' and `-Wincompatible-pointer-types` errors
With latest glibc snapshot and `-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3` in $CFLAGS some warnings are turned into errors
<details>
<summary>Build fails with</summary>

```console
[ 52%] Building C object libfreerdp/CMakeFiles/freerdp.dir/core/info.c.o
cd /home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/x86_64-redhat-linux-gnu/libfreerdp && /usr/bin/gcc -DBUILD_TESTING -DCAIRO_FOUND=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DEXT_PATH=\"/usr/lib64/freerdp2/extensions\" -DFREERDP_EXPORTS -DFREERDP_TEST_EXPORTS -DHAVE_AT_LEAST_KRB_V1_13 -DHAVE_CONFIG_H -DWINPR_EXPORTS -DWITH_OPENSSL -DWITH_WAYLAND -DWITH_X11 -DWITH_XKBFILE -D_FILE_OFFSET_BITS=64 -Dfreerdp_EXPORTS -I/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/x86_64-redhat-linux-gnu -I/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/x86_64-redhat-linux-gnu/include -I/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/include -I/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/winpr/include -I/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/x86_64-redhat-linux-gnu/winpr/include -I/usr/include/cairo -I/usr/include/ffmpeg -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -fPIC -Wall -Wno-unused-result -Wno-unused-but-set-variable -Wno-deprecated-declarations -Wimplicit-function-declaration -Wredundant-decls -g -fno-omit-frame-pointer -DWINPR_DLL -DNDEBUG -Wno-builtin-macro-redefined -D__FILE__='"x86_64-redhat-linux-gnu/libfreerdp/CMakeFiles/freerdp.dir/compiler_depend.ts"' -fPIC   -DWITH_GSSAPI -DWITH_GSSAPI_MIT -MD -MT libfreerdp/CMakeFiles/freerdp.dir/core/info.c.o -MF CMakeFiles/freerdp.dir/core/info.c.o.d -o CMakeFiles/freerdp.dir/core/info.c.o -c /home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/libfreerdp/core/info.c
/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/libfreerdp/core/info.c: In function ‘rdp_read_info_null_string’:
/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/libfreerdp/core/info.c:88:39: error: initialization of ‘const WCHAR *’ {aka ‘const short unsigned int *’} from incompatible pointer type ‘BYTE *’ {aka ‘unsigned char *’} [-Wincompatible-pointer-types]
   88 |                 const WCHAR* domain = Stream_Pointer(s);
      |                                       ^~~~~~~~~~~~~~
make[2]: *** [libfreerdp/CMakeFiles/freerdp.dir/build.make:863: libfreerdp/CMakeFiles/freerdp.dir/core/info.c.o] Error 1
[ 52%] Building C object libfreerdp/CMakeFiles/freerdp.dir/core/redirection.c.o
cd /home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/x86_64-redhat-linux-gnu/libfreerdp && /usr/bin/gcc -DBUILD_TESTING -DCAIRO_FOUND=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DEXT_PATH=\"/usr/lib64/freerdp2/extensions\" -DFREERDP_EXPORTS -DFREERDP_TEST_EXPORTS -DHAVE_AT_LEAST_KRB_V1_13 -DHAVE_CONFIG_H -DWINPR_EXPORTS -DWITH_OPENSSL -DWITH_WAYLAND -DWITH_X11 -DWITH_XKBFILE -D_FILE_OFFSET_BITS=64 -Dfreerdp_EXPORTS -I/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/x86_64-redhat-linux-gnu -I/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/x86_64-redhat-linux-gnu/include -I/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/include -I/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/winpr/include -I/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/x86_64-redhat-linux-gnu/winpr/include -I/usr/include/cairo -I/usr/include/ffmpeg -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -fPIC -Wall -Wno-unused-result -Wno-unused-but-set-variable -Wno-deprecated-declarations -Wimplicit-function-declaration -Wredundant-decls -g -fno-omit-frame-pointer -DWINPR_DLL -DNDEBUG -Wno-builtin-macro-redefined -D__FILE__='"x86_64-redhat-linux-gnu/libfreerdp/CMakeFiles/freerdp.dir/compiler_depend.ts"' -fPIC   -DWITH_GSSAPI -DWITH_GSSAPI_MIT -MD -MT libfreerdp/CMakeFiles/freerdp.dir/core/redirection.c.o -MF CMakeFiles/freerdp.dir/core/redirection.c.o.d -o CMakeFiles/freerdp.dir/core/redirection.c.o -c /home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/libfreerdp/core/redirection.c
/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/libfreerdp/core/redirection.c: In function ‘redirection_copy_data’:
/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/libfreerdp/core/redirection.c:91:31: error: passing argument 1 of ‘redirection_free_data’ from incompatible pointer type [-Wincompatible-pointer-types]
   91 |         redirection_free_data(dst, plen);
      |                               ^~~
      |                               |
      |                               char **
/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/libfreerdp/core/redirection.c:80:42: note: expected ‘BYTE **’ {aka ‘unsigned char **’} but argument is of type ‘char **’
   80 | static void redirection_free_data(BYTE** str, UINT32* length)
      |                                   ~~~~~~~^~~
/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/libfreerdp/core/redirection.c: In function ‘freerdp_settings_set_pointer_len’:
/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/libfreerdp/core/redirection.c:112:31: error: assignment to ‘BYTE **’ {aka ‘unsigned char **’} from incompatible pointer type ‘char **’ [-Wincompatible-pointer-types]
  112 |                         pdata = &settings->TargetNetAddress;
      |                               ^
/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/libfreerdp/core/redirection.c:139:38: error: passing argument 1 of ‘redirection_copy_data’ from incompatible pointer type [-Wincompatible-pointer-types]
  139 |         return redirection_copy_data(pdata, plen, data, length);
      |                                      ^~~~~
      |                                      |
      |                                      BYTE ** {aka unsigned char **}
/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/libfreerdp/core/redirection.c:89:42: note: expected ‘char **’ but argument is of type ‘BYTE **’ {aka ‘unsigned char **’}
   89 | static BOOL redirection_copy_data(char** dst, UINT32* plen, const char* str, UINT32 len)
      |                                   ~~~~~~~^~~
/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/libfreerdp/core/redirection.c:139:51: warning: pointer targets in passing argument 3 of ‘redirection_copy_data’ differ in signedness [-Wpointer-sign]
  139 |         return redirection_copy_data(pdata, plen, data, length);
      |                                                   ^~~~
      |                                                   |
      |                                                   const BYTE * {aka const unsigned char *}
/home/tkloczko/rpmbuild/BUILD/FreeRDP-2.11.5/libfreerdp/core/redirection.c:89:73: note: expected ‘const char *’ but argument is of type ‘const BYTE *’ {aka ‘const unsigned char *’}
   89 | static BOOL redirection_copy_data(char** dst, UINT32* plen, const char* str, UINT32 len)
      |                                                             ~~~~~~~~~~~~^~~
make[2]: *** [libfreerdp/CMakeFiles/freerdp.dir/build.make:1115: libfreerdp/CMakeFiles/freerdp.dir/core/redirection.c.o] Error 1
```
</details>

3.4.0: build failure with GCC 14
**Describe the bug**

freerdp-3.4.0 fails to build with GCC 14.

```
FAILED: winpr/libwinpr/CMakeFiles/winpr.dir/clipboard/synthetic_file.c.o
/usr/bin/x86_64-pc-linux-gnu-gcc -DFREERDP_EXPORTS -DUSE_EXECINFO -DUSE_UNWIND -DWINPR_CRITICAL_SECTION_DISABLE_SPINCOUNT -DWINPR_EXPORTS -DWITH_FREERDP_DEPRECATED_COMMANDLINE -DWITH_OP
_EMULATE -DWITH_SMARTCARD_PCSC -DWITH_VERBOSE_WINPR_ASSERT -D_FILE_OFFSET_BITS=64 -Dwinpr_EXPORTS -I/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/winpr/include -I/var/tmp/p
winpr/include -I/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/winpr/libwinpr/utils/.  -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -ggdb3 -Wall
-after-statement -fPIC -Wall -fvisibility=hidden -Wimplicit-function-declaration -Wredundant-decls -g -fno-omit-frame-pointer -DWINPR_DLL -std=gnu11 -fPIC -fdiagnostics-color=always -MD
hetic_file.c.o -MF winpr/libwinpr/CMakeFiles/winpr.dir/clipboard/synthetic_file.c.o.d -o winpr/libwinpr/CMakeFiles/winpr.dir/clipboard/synthetic_file.c.o -c /var/tmp/portage/net-misc/fr
/synthetic_file.c
/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/winpr/libwinpr/clipboard/synthetic_file.c: In function ‘add_directory_contents_to_list’:
/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/winpr/libwinpr/clipboard/synthetic_file.c:279:33: error: initialization of ‘const WCHAR *’ {aka ‘const short unsigned int *’}
-pointer-types]
  279 |         const WCHAR* wildcard = "/\0*\0\0\0";
      |                                 ^~~~~~~~~~~~
```

```
FAILED: libfreerdp/CMakeFiles/freerdp.dir/codec/rfx.c.o
/usr/bin/x86_64-pc-linux-gnu-gcc -DEXT_PATH=\"/usr/lib64/freerdp3/extensions\" -DFREERDP_EXPORTS -DWITH_FREERDP_DEPRECATED_COMMANDLINE -DWITH_OPENSSL -DWITH_SMARTCARD_EMULATE -DWITH_VER
ILE -D_FILE_OFFSET_BITS=64 -Dfreerdp_EXPORTS -I/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/winpr/include -I/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0_buil
.0/work/freerdp-3.4.0_build -I/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0_build/include -I/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/include  -O2 -pipe -m
tches -ggdb3 -Wall -Wpedantic -Wno-padded -Wno-cast-align -Wno-declaration-after-statement -fPIC -Wall -fvisibility=hidden -Wimplicit-function-declaration -Wredundant-decls -g -fno-omit
ays -MD -MT libfreerdp/CMakeFiles/freerdp.dir/codec/rfx.c.o -MF libfreerdp/CMakeFiles/freerdp.dir/codec/rfx.c.o.d -o libfreerdp/CMakeFiles/freerdp.dir/codec/rfx.c.o -c /var/tmp/portage/
dec/rfx.c
/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/libfreerdp/codec/rfx.c: In function ‘rfx_message_get_tiles’:
/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/libfreerdp/codec/rfx.c:1371:23: error: returning ‘RFX_TILE **’ from a function with incompatible return type ‘const RFX_TILE *
 1371 |         return message->tiles;
      |                ~~~~~~~^~~~~~~
```

```
FAILED: client/common/CMakeFiles/freerdp-client.dir/file.c.o
/usr/bin/x86_64-pc-linux-gnu-gcc -DFREERDP_EXPORTS -DWITH_FREERDP_DEPRECATED_COMMANDLINE -DWITH_FUSE -DWITH_OPENSSL -DWITH_SMARTCARD_EMULATE -DWITH_VERBOSE_WINPR_ASSERT -D_FILE_OFFSET_B
misc/freerdp-3.4.0/work/freerdp-3.4.0/winpr/include -I/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0_build/winpr/include -I/var/tmp/portage/net-misc/freerdp-3.4.0/work/freer
0/work/freerdp-3.4.0_build/include -I/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/include -I/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0_build/channels/clien
p-3.4.0/channels/client -I/usr/include/fuse3  -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -ggdb3 -Wall -Wpedantic -Wno-padded -Wno-cast-align -Wno-declarati
plicit-function-declaration -Wredundant-decls -g -fno-omit-frame-pointer -std=gnu11 -fPIC -fdiagnostics-color=always -MD -MT client/common/CMakeFiles/freerdp-client.dir/file.c.o -MF cli
client/common/CMakeFiles/freerdp-client.dir/file.c.o -c /var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/client/common/file.c
/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/client/common/file.c: In function ‘freerdp_client_populate_settings_from_rdp_file’:
/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/client/common/file.c:2303:85: error: passing argument 3 of ‘freerdp_client_add_dynamic_channel’ from incompatible pointer type
 2303 |                 const BOOL rc = freerdp_client_add_dynamic_channel(settings, count, str);
      |                                                                                     ^~~
      |                                                                                     |
      |                                                                                     char **
In file included from /var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/client/common/file.c:31:
/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/include/freerdp/client/cmdline.h:96:74: note: expected ‘const char **’ but argument is of type ‘char **’
   96 |                                                             const char** params);
      |                                                             ~~~~~~~~~~~~~^~~~~~
```

```
FAILED: winpr/libwinpr/CMakeFiles/winpr.dir/smartcard/smartcard_pcsc.c.o
/usr/bin/x86_64-pc-linux-gnu-gcc -DFREERDP_EXPORTS -DUSE_EXECINFO -DUSE_UNWIND -DWINPR_CRITICAL_SECTION_DISABLE_SPINCOUNT -DWINPR_EXPORTS -DWITH_FREERDP_DEPRECATED_COMMANDLINE -DWITH_OP
_EMULATE -DWITH_SMARTCARD_PCSC -DWITH_VERBOSE_WINPR_ASSERT -D_FILE_OFFSET_BITS=64 -Dwinpr_EXPORTS -I/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/winpr/include -I/var/tmp/p
winpr/include -I/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/winpr/libwinpr/utils/.  -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -ggdb3 -Wall
-after-statement -fPIC -Wall -fvisibility=hidden -Wimplicit-function-declaration -Wredundant-decls -g -fno-omit-frame-pointer -DWINPR_DLL -std=gnu11 -fPIC -fdiagnostics-color=always -MD
tcard_pcsc.c.o -MF winpr/libwinpr/CMakeFiles/winpr.dir/smartcard/smartcard_pcsc.c.o.d -o winpr/libwinpr/CMakeFiles/winpr.dir/smartcard/smartcard_pcsc.c.o -c /var/tmp/portage/net-misc/fr
/smartcard_pcsc.c
/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/winpr/libwinpr/smartcard/smartcard_pcsc.c: In function ‘PCSC_SCardListReadersW’:
/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/winpr/libwinpr/smartcard/smartcard_pcsc.c:996:66: error: passing argument 3 of ‘PCSC_SCardListReaders_Internal’ from incompati
  996 |             PCSC_SCardListReaders_Internal(hContext, mszGroupsA, (LPSTR*)&mszReadersA, pcchReaders);
      |                                                                  ^~~~~~~~~~~~~~~~~~~~
      |                                                                  |
      |                                                                  CHAR ** {aka char **}
/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/winpr/libwinpr/smartcard/smartcard_pcsc.c:875:57: note: expected ‘LPSTR’ {aka ‘char *’} but argument is of type ‘CHAR **’ {aka
  875 |                                                   LPSTR mszReaders, LPDWORD pcchReaders)
      |                                                   ~~~~~~^~~~~~~~~~
```

```
FAILED: libfreerdp/CMakeFiles/freerdp.dir/core/license.c.o
/usr/bin/x86_64-pc-linux-gnu-gcc -DEXT_PATH=\"/usr/lib64/freerdp3/extensions\" -DFREERDP_EXPORTS -DWITH_FREERDP_DEPRECATED_COMMANDLINE -DWITH_OPENSSL -DWITH_SMARTCARD_EMULATE -DWITH_VER
ILE -D_FILE_OFFSET_BITS=64 -Dfreerdp_EXPORTS -I/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/winpr/include -I/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0_buil
.0/work/freerdp-3.4.0_build -I/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0_build/include -I/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/include  -O2 -pipe -m
tches -ggdb3 -Wall -Wpedantic -Wno-padded -Wno-cast-align -Wno-declaration-after-statement -fPIC -Wall -fvisibility=hidden -Wimplicit-function-declaration -Wredundant-decls -g -fno-omit
ays -MD -MT libfreerdp/CMakeFiles/freerdp.dir/core/license.c.o -MF libfreerdp/CMakeFiles/freerdp.dir/core/license.c.o.d -o libfreerdp/CMakeFiles/freerdp.dir/core/license.c.o -c /var/tmp
reerdp/core/license.c
/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/libfreerdp/core/license.c: In function ‘license_read_platform_challenge_packet’:
/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/libfreerdp/core/license.c:1956:16: warning: variable ‘ConnectFlags’ set but not used [-Wunused-but-set-variable]
 1956 |         UINT32 ConnectFlags = 0;
      |                ^~~~~~~~~~~~
/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/libfreerdp/core/license.c: In function ‘license_set_string’:
/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/libfreerdp/core/license.c:2813:14: error: assignment to ‘WCHAR *’ {aka ‘short unsigned int *’} from incompatible pointer type
r-types]
 2813 |         *dst = (BYTE*)ConvertUtf8ToWCharAlloc(value, &len);
      |              ^
/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/libfreerdp/core/license.c: In function ‘license_server_configure’:
/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/libfreerdp/core/license.c:2855:63: error: passing argument 3 of ‘license_set_string’ from incompatible pointer type [-Wincompa
 2855 |         if (!license_set_string("pbCompanyName", CompanyName, &license->ProductInfo->pbCompanyName,
      |                                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                               |
      |                                                               BYTE ** {aka unsigned char **}
/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/libfreerdp/core/license.c:2805:77: note: expected ‘WCHAR **’ {aka ‘short unsigned int **’} but argument is of type ‘BYTE **’ {
 2805 | static BOOL license_set_string(const char* what, const char* value, WCHAR** dst, UINT32* dstLen)
      |                                                                     ~~~~~~~~^~~
/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0/libfreerdp/core/license.c:2859:61: error: passing argument 3 of ‘license_set_string’ from incompatible pointer type [-Wincompa
 2859 |         if (!license_set_string("pbProductId", ProductName, &license->ProductInfo->pbProductId,
      |                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                             |
      |                                                             BYTE ** {aka unsigned char **}

```

**To Reproduce**
Steps to reproduce the behavior:
1. Build with GCC 14, or build with CFLAGS="... -Werror=int-conversion -Werror=implicit-int -Werror=implicit-function-declaration -Werror=incompatible-pointer-types" (roughly).

**Expected behavior**

Successful build.


**Application details**
* FreeRDP version (`xfreerdp /version`): 3.4.0
* If you built it yourself add some notes which tag/commit/branch you have used, also your cmake parameters and
  compiler can help: `cmake -C /var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0_build/gentoo_common_config.cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -Wno-dev -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF -DBUILD_TESTING=OFF -DCHANNEL_URBDRC=ON -DWITH_AAD=OFF -DWITH_ALSA=ON -DWITH_CCACHE=OFF -DWITH_CLIENT_SDL=ON -DWITH_CUPS=OFF -DWITH_DEBUG_ALL=OFF -DWITH_MANPAGES=ON -DWITH_FFMPEG=ON -DWITH_FREERDP_DEPRECATED_COMMANDLINE=ON -DWITH_SWSCALE=ON -DWITH_CAIRO=OFF -DWITH_DSP_FFMPEG=ON -DWITH_FUSE=ON -DWITH_GSTREAMER_1_0=OFF -DWITH_JPEG=ON -DWITH_KRB5=OFF -DWITH_NEON=OFF -DWITH_OPENH264=OFF -DWITH_OSS=OFF -DWITH_PCSC=ON -DWITH_PKCS11=ON -DWITH_PULSE=ON -DWITH_SERVER=OFF -DWITH_LIBSYSTEMD=OFF -DWITH_UNICODE_BUILTIN=OFF -DWITH_VALGRIND_MEMCHECK=OFF -DWITH_X11=ON -DWITH_XINERAMA=OFF -DWITH_XV=ON -DWITH_WAYLAND=ON -DWITH_WEBVIEW=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=/var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0_build/gentoo_toolchain.cmake /var/tmp/portage/net-misc/freerdp-3.4.0/work/freerdp-3.4.0` with `gcc version 14.0.1 20240310 (experimental)`.

**Environment (please complete the following information):**
 - OS: Linux
 - Version/Distribution: Gentoo
 - Architecture: amd64

**Additional context**

GCC 14 enables various warnings-as-errors by default. See https://wiki.gentoo.org/wiki/Modern_C_porting#What_changed.3F.


Discussion: BTW 3.2.0 has similar issue but it fails only with `-Wincompatible-pointer-types`.
@kloczek we´re accepting pull requests for oldstable, but that is something we´re not going to fix ourselves.
as for the current stable 3.x branch, I´m going to have a look.
@kloczek I´ve created a patch for current 3.x releases.

Thank you!



Fix (patch):
diff --git a/channels/drive/client/drive_main.c b/channels/drive/client/drive_main.c
index 0fdc2e08ff50..04f8d837fa6b 100644
--- a/channels/drive/client/drive_main.c
+++ b/channels/drive/client/drive_main.c
@@ -511,7 +511,7 @@ static UINT drive_process_irp_query_volume_information(DRIVE_DEVICE* drive, IRP*
 			/* http://msdn.microsoft.com/en-us/library/cc232101.aspx */
 			const WCHAR* diskType =
 			    InitializeConstWCharFromUtf8("FAT32", LabelBuffer, ARRAYSIZE(LabelBuffer));
-			const size_t diskTypeLen = (wcslen(diskType) + 1) * sizeof(WCHAR);
+			const size_t diskTypeLen = (_wcslen(diskType) + 1) * sizeof(WCHAR);
 			const size_t length = 12ul + diskTypeLen;
 			Stream_Write_UINT32(output, length); /* Length */
 
diff --git a/client/common/file.c b/client/common/file.c
index feb37967fc5a..39b08f18c916 100644
--- a/client/common/file.c
+++ b/client/common/file.c
@@ -2299,9 +2299,15 @@ BOOL freerdp_client_populate_settings_from_rdp_file(const rdpFile* file, rdpSett
 	if (~file->RedirectLocation)
 	{
 		size_t count = 0;
-		char** str = CommandLineParseCommaSeparatedValuesEx(LOCATION_CHANNEL_NAME, NULL, &count);
-		const BOOL rc = freerdp_client_add_dynamic_channel(settings, count, str);
-		free(str);
+		union
+		{
+			void* pv;
+			char** str;
+			const char** cstr;
+		} cnv;
+		cnv.str = CommandLineParseCommaSeparatedValuesEx(LOCATION_CHANNEL_NAME, NULL, &count);
+		const BOOL rc = freerdp_client_add_dynamic_channel(settings, count, cnv.cstr);
+		free(cnv.pv);
 		if (!rc)
 			return FALSE;
 	}
diff --git a/libfreerdp/codec/rfx.c b/libfreerdp/codec/rfx.c
index c83cfd5c1ac3..66ed1e04aea2 100644
--- a/libfreerdp/codec/rfx.c
+++ b/libfreerdp/codec/rfx.c
@@ -1368,7 +1368,7 @@ const RFX_TILE** rfx_message_get_tiles(const RFX_MESSAGE* message, UINT16* numTi
 	WINPR_ASSERT(message);
 	if (numTiles)
 		*numTiles = message->numTiles;
-	return message->tiles;
+	return (const RFX_TILE**)message->tiles;
 }
 
 UINT16 rfx_message_get_tile_count(const RFX_MESSAGE* message)
diff --git a/libfreerdp/core/license.c b/libfreerdp/core/license.c
index 99d4fa25fc84..e6c622a6b087 100644
--- a/libfreerdp/core/license.c
+++ b/libfreerdp/core/license.c
@@ -2802,18 +2802,25 @@ BOOL license_server_send_request(rdpLicense* license)
 	return license_set_state(license, LICENSE_STATE_REQUEST);
 }
 
-static BOOL license_set_string(const char* what, const char* value, WCHAR** dst, UINT32* dstLen)
+static BOOL license_set_string(const char* what, const char* value, BYTE** bdst, UINT32* dstLen)
 {
 	WINPR_ASSERT(what);
 	WINPR_ASSERT(value);
-	WINPR_ASSERT(dst);
+	WINPR_ASSERT(bdst);
 	WINPR_ASSERT(dstLen);
 
+	union
+	{
+		WCHAR** w;
+		BYTE** b;
+	} cnv;
+	cnv.b = bdst;
+
 	size_t len = 0;
-	*dst = (BYTE*)ConvertUtf8ToWCharAlloc(value, &len);
-	if (!*dst || (len > UINT32_MAX / sizeof(WCHAR)))
+	*cnv.w = ConvertUtf8ToWCharAlloc(value, &len);
+	if (!*cnv.w || (len > UINT32_MAX / sizeof(WCHAR)))
 	{
-		WLog_ERR(TAG, "license->ProductInfo: %s == %p || %" PRIu32 " > UINT32_MAX", what, *dst,
+		WLog_ERR(TAG, "license->ProductInfo: %s == %p || %" PRIu32 " > UINT32_MAX", what, *cnv.w,
 		         len);
 		return FALSE;
 	}
diff --git a/server/shadow/shadow_client.c b/server/shadow/shadow_client.c
index 0fd52363eb6d..f2a5f63cb188 100644
--- a/server/shadow/shadow_client.c
+++ b/server/shadow/shadow_client.c
@@ -252,7 +252,7 @@ static BOOL shadow_client_context_new(freerdp_peer* peer, rdpContext* context)
 		goto fail;
 
 	region16_init(&(client->invalidRegion));
-	client->vcm = WTSOpenServerA(peer->context);
+	client->vcm = WTSOpenServerA((LPSTR)peer->context);
 
 	if (!client->vcm || client->vcm == INVALID_HANDLE_VALUE)
 		goto fail;
diff --git a/winpr/libwinpr/clipboard/synthetic_file.c b/winpr/libwinpr/clipboard/synthetic_file.c
index 14219806c76e..e748f8bea399 100644
--- a/winpr/libwinpr/clipboard/synthetic_file.c
+++ b/winpr/libwinpr/clipboard/synthetic_file.c
@@ -276,7 +276,13 @@ static BOOL add_directory_contents_to_list(wClipboard* clipboard, const WCHAR* l
                                            const WCHAR* remote_name, wArrayList* files)
 {
 	BOOL result = FALSE;
-	const WCHAR* wildcard = "/\0*\0\0\0";
+	union
+	{
+		const char* c;
+		const WCHAR* w;
+	} wildcard;
+	const char buffer[4] = "/\0*\0\0\0";
+	wildcard.c = buffer;
 	const size_t wildcardLen = 3;
 
 	WINPR_ASSERT(clipboard);
@@ -290,7 +296,7 @@ static BOOL add_directory_contents_to_list(wClipboard* clipboard, const WCHAR* l
 		return FALSE;
 
 	_wcsncat(namebuf, local_name, len);
-	_wcsncat(namebuf, wildcard, wildcardLen);
+	_wcsncat(namebuf, wildcard.w, wildcardLen);
 
 	result = do_add_directory_contents_to_list(clipboard, local_name, remote_name, namebuf, files);
 
diff --git a/winpr/libwinpr/smartcard/smartcard_pcsc.c b/winpr/libwinpr/smartcard/smartcard_pcsc.c
index fb04d5684aa0..c94b4caafe1e 100644
--- a/winpr/libwinpr/smartcard/smartcard_pcsc.c
+++ b/winpr/libwinpr/smartcard/smartcard_pcsc.c
@@ -992,8 +992,14 @@ static LONG WINAPI PCSC_SCardListReadersW(SCARDCONTEXT hContext, LPCWSTR mszGrou
 			return SCARD_E_NO_MEMORY;
 	}
 
-	status =
-	    PCSC_SCardListReaders_Internal(hContext, mszGroupsA, (LPSTR*)&mszReadersA, pcchReaders);
+	union
+	{
+		LPSTR* ppc;
+		LPSTR pc;
+	} cnv;
+	cnv.ppc = &mszReadersA;
+
+	status = PCSC_SCardListReaders_Internal(hContext, mszGroupsA, cnv.pc, pcchReaders);
 	if (status == SCARD_S_SUCCESS)
 	{
 		size_t size = 0;