replace SIZE_T with size_t

This commit is contained in:
akallabeth 2024-10-17 12:26:49 +02:00
parent 7bca994dd2
commit f346b94835
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
16 changed files with 37 additions and 27 deletions

View File

@ -801,7 +801,7 @@ LONG smartcard_irp_device_control_decode(wStream* s, UINT32 CompletionId, UINT32
if (Stream_GetPosition(s) < Stream_Length(s)) if (Stream_GetPosition(s) < Stream_Length(s))
{ {
SIZE_T difference = 0; size_t difference = 0;
difference = Stream_Length(s) - Stream_GetPosition(s); difference = Stream_Length(s) - Stream_GetPosition(s);
WLog_WARN(TAG, WLog_WARN(TAG,
"IRP was not fully parsed %s (%s [0x%08" PRIX32 "]): Actual: %" PRIuz "IRP was not fully parsed %s (%s [0x%08" PRIX32 "]): Actual: %" PRIuz
@ -814,7 +814,7 @@ LONG smartcard_irp_device_control_decode(wStream* s, UINT32 CompletionId, UINT32
if (Stream_GetPosition(s) > Stream_Length(s)) if (Stream_GetPosition(s) > Stream_Length(s))
{ {
SIZE_T difference = 0; size_t difference = 0;
difference = Stream_GetPosition(s) - Stream_Length(s); difference = Stream_GetPosition(s) - Stream_Length(s);
WLog_WARN(TAG, WLog_WARN(TAG,
"IRP was parsed beyond its end %s (0x%08" PRIX32 "): Actual: %" PRIuz "IRP was parsed beyond its end %s (0x%08" PRIX32 "): Actual: %" PRIuz

View File

@ -158,6 +158,10 @@ else()
set(WINPR_VERSION_FULL "${WINPR_VERSION}") set(WINPR_VERSION_FULL "${WINPR_VERSION}")
endif() endif()
include(CheckTypeSize)
check_type_size(ssize_t SSIZE_T)
set(WINPR_HAVE_SSIZE_T ${HAVE_SSIZE_T})
if(NOT IOS) if(NOT IOS)
CHECK_SYMBOL_EXISTS(strndup string.h WINPR_HAVE_STRNDUP) CHECK_SYMBOL_EXISTS(strndup string.h WINPR_HAVE_STRNDUP)
check_include_files(unistd.h WINPR_HAVE_UNISTD_H) check_include_files(unistd.h WINPR_HAVE_UNISTD_H)

View File

@ -23,6 +23,7 @@
#cmakedefine WINPR_HAVE_GETPWUID_R #cmakedefine WINPR_HAVE_GETPWUID_R
#cmakedefine WINPR_HAVE_STRNDUP #cmakedefine WINPR_HAVE_STRNDUP
#cmakedefine WINPR_HAVE_UNWIND_H #cmakedefine WINPR_HAVE_UNWIND_H
#cmakedefine WINPR_HAVE_SSIZE_T
#cmakedefine WINPR_WITH_PNG #cmakedefine WINPR_WITH_PNG
#cmakedefine WINPR_HAVE_STRERROR_R /** @since version 3.3.0 */ #cmakedefine WINPR_HAVE_STRERROR_R /** @since version 3.3.0 */

View File

@ -331,8 +331,13 @@ typedef __uint3264 ULONG_PTR,
typedef __uint3264 DWORD_PTR, typedef __uint3264 DWORD_PTR,
*PDWORD_PTR; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp) *PDWORD_PTR; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef ULONG_PTR SIZE_T, *PSIZE_T; typedef ULONG_PTR SIZE_T, *PSIZE_T; /** deprecated */
#if defined(WINPR_HAVE_SSIZE_T)
#include <sys/types.h>
typedef ssize_t SSIZE_T, *PSSIZE_T;
#else
typedef LONG_PTR SSIZE_T, *PSSIZE_T; typedef LONG_PTR SSIZE_T, *PSSIZE_T;
#endif
typedef float FLOAT; typedef float FLOAT;

View File

@ -129,7 +129,7 @@ extern "C"
{ {
#endif #endif
WINPR_API PVOID SecureZeroMemory(PVOID ptr, SIZE_T cnt); WINPR_API PVOID SecureZeroMemory(PVOID ptr, size_t cnt);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -55,13 +55,13 @@ extern "C"
WINPR_API LPVOID MapViewOfFile(HANDLE hFileMappingObject, DWORD dwDesiredAccess, WINPR_API LPVOID MapViewOfFile(HANDLE hFileMappingObject, DWORD dwDesiredAccess,
DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow,
SIZE_T dwNumberOfBytesToMap); size_t dwNumberOfBytesToMap);
WINPR_API LPVOID MapViewOfFileEx(HANDLE hFileMappingObject, DWORD dwDesiredAccess, WINPR_API LPVOID MapViewOfFileEx(HANDLE hFileMappingObject, DWORD dwDesiredAccess,
DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow,
SIZE_T dwNumberOfBytesToMap, LPVOID lpBaseAddress); size_t dwNumberOfBytesToMap, LPVOID lpBaseAddress);
WINPR_API BOOL FlushViewOfFile(LPCVOID lpBaseAddress, SIZE_T dwNumberOfBytesToFlush); WINPR_API BOOL FlushViewOfFile(LPCVOID lpBaseAddress, size_t dwNumberOfBytesToFlush);
WINPR_API BOOL UnmapViewOfFile(LPCVOID lpBaseAddress); WINPR_API BOOL UnmapViewOfFile(LPCVOID lpBaseAddress);

View File

@ -38,8 +38,8 @@ typedef struct S_TP_POOL TP_POOL, *PTP_POOL;
typedef struct typedef struct
{ {
SIZE_T StackReserve; size_t StackReserve;
SIZE_T StackCommit; size_t StackCommit;
} TP_POOL_STACK_INFORMATION, *PTP_POOL_STACK_INFORMATION; } TP_POOL_STACK_INFORMATION, *PTP_POOL_STACK_INFORMATION;
typedef struct S_TP_CLEANUP_GROUP TP_CLEANUP_GROUP, *PTP_CLEANUP_GROUP; typedef struct S_TP_CLEANUP_GROUP TP_CLEANUP_GROUP, *PTP_CLEANUP_GROUP;

View File

@ -44,11 +44,11 @@
typedef struct typedef struct
{ {
SIZE_T PagedPoolLimit; size_t PagedPoolLimit;
SIZE_T NonPagedPoolLimit; size_t NonPagedPoolLimit;
SIZE_T MinimumWorkingSetSize; size_t MinimumWorkingSetSize;
SIZE_T MaximumWorkingSetSize; size_t MaximumWorkingSetSize;
SIZE_T PagefileLimit; size_t PagefileLimit;
LARGE_INTEGER TimeLimit; LARGE_INTEGER TimeLimit;
} QUOTA_LIMITS, *PQUOTA_LIMITS; } QUOTA_LIMITS, *PQUOTA_LIMITS;

View File

@ -194,7 +194,7 @@ extern "C"
WINPR_API VOID WakeByAddressAll(PVOID Address); WINPR_API VOID WakeByAddressAll(PVOID Address);
WINPR_API VOID WakeByAddressSingle(PVOID Address); WINPR_API VOID WakeByAddressSingle(PVOID Address);
WINPR_API BOOL WaitOnAddress(VOID volatile* Address, PVOID CompareAddress, SIZE_T AddressSize, WINPR_API BOOL WaitOnAddress(VOID volatile* Address, PVOID CompareAddress, size_t AddressSize,
DWORD dwMilliseconds); DWORD dwMilliseconds);
/* Wait */ /* Wait */

View File

@ -231,13 +231,13 @@ extern "C"
#define STACK_SIZE_PARAM_IS_A_RESERVATION 0x00010000 #define STACK_SIZE_PARAM_IS_A_RESERVATION 0x00010000
WINPR_ATTR_MALLOC(CloseHandle, 1) WINPR_ATTR_MALLOC(CloseHandle, 1)
WINPR_API HANDLE CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, WINPR_API HANDLE CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, size_t dwStackSize,
LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter,
DWORD dwCreationFlags, LPDWORD lpThreadId); DWORD dwCreationFlags, LPDWORD lpThreadId);
WINPR_ATTR_MALLOC(CloseHandle, 1) WINPR_ATTR_MALLOC(CloseHandle, 1)
WINPR_API HANDLE CreateRemoteThread(HANDLE hProcess, LPSECURITY_ATTRIBUTES lpThreadAttributes, WINPR_API HANDLE CreateRemoteThread(HANDLE hProcess, LPSECURITY_ATTRIBUTES lpThreadAttributes,
SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, size_t dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress,
LPVOID lpParameter, DWORD dwCreationFlags, LPVOID lpParameter, DWORD dwCreationFlags,
LPDWORD lpThreadId); LPDWORD lpThreadId);

View File

@ -26,7 +26,7 @@
#ifndef _WIN32 #ifndef _WIN32
PVOID SecureZeroMemory(PVOID ptr, SIZE_T cnt) PVOID SecureZeroMemory(PVOID ptr, size_t cnt)
{ {
volatile BYTE* p = ptr; volatile BYTE* p = ptr;

View File

@ -36,7 +36,7 @@
#define EXPECTED_SIZEOF_ULARGE_INTEGER 8 #define EXPECTED_SIZEOF_ULARGE_INTEGER 8
#define EXPECTED_SIZEOF_GUID 16 #define EXPECTED_SIZEOF_GUID 16
#define EXPECTED_SIZEOF_SYSTEMTIME 16 #define EXPECTED_SIZEOF_SYSTEMTIME 16
#define EXPECTED_SIZEOF_SIZE_T sizeof(void*) #define EXPECTED_SIZEOF_size_t sizeof(void*)
#define EXPECTED_SIZEOF_INT_PTR sizeof(void*) #define EXPECTED_SIZEOF_INT_PTR sizeof(void*)
#define EXPECTED_SIZEOF_UINT_PTR sizeof(void*) #define EXPECTED_SIZEOF_UINT_PTR sizeof(void*)
#define EXPECTED_SIZEOF_DWORD_PTR sizeof(void*) #define EXPECTED_SIZEOF_DWORD_PTR sizeof(void*)
@ -104,7 +104,7 @@ int TestTypes(int argc, char* argv[])
TEST_SIZEOF_TYPE(GUID) TEST_SIZEOF_TYPE(GUID)
TEST_SIZEOF_TYPE(SYSTEMTIME) TEST_SIZEOF_TYPE(SYSTEMTIME)
TEST_SIZEOF_TYPE(SIZE_T) TEST_SIZEOF_TYPE(size_t)
TEST_SIZEOF_TYPE(INT_PTR) TEST_SIZEOF_TYPE(INT_PTR)
TEST_SIZEOF_TYPE(UINT_PTR) TEST_SIZEOF_TYPE(UINT_PTR)
TEST_SIZEOF_TYPE(DWORD_PTR) TEST_SIZEOF_TYPE(DWORD_PTR)

View File

@ -104,18 +104,18 @@ HANDLE OpenFileMappingW(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpNa
} }
LPVOID MapViewOfFile(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, LPVOID MapViewOfFile(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh,
DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap) DWORD dwFileOffsetLow, size_t dwNumberOfBytesToMap)
{ {
return NULL; return NULL;
} }
LPVOID MapViewOfFileEx(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, LPVOID MapViewOfFileEx(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh,
DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap, LPVOID lpBaseAddress) DWORD dwFileOffsetLow, size_t dwNumberOfBytesToMap, LPVOID lpBaseAddress)
{ {
return NULL; return NULL;
} }
BOOL FlushViewOfFile(LPCVOID lpBaseAddress, SIZE_T dwNumberOfBytesToFlush) BOOL FlushViewOfFile(LPCVOID lpBaseAddress, size_t dwNumberOfBytesToFlush)
{ {
return TRUE; return TRUE;
} }

View File

@ -37,7 +37,7 @@ VOID WakeByAddressSingle(PVOID Address)
{ {
} }
BOOL WaitOnAddress(VOID volatile* Address, PVOID CompareAddress, SIZE_T AddressSize, BOOL WaitOnAddress(VOID volatile* Address, PVOID CompareAddress, size_t AddressSize,
DWORD dwMilliseconds) DWORD dwMilliseconds)
{ {
return TRUE; return TRUE;

View File

@ -678,7 +678,7 @@ BOOL SetThreadPriority(HANDLE hThread, int nPriority)
#endif #endif
} }
HANDLE CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, HANDLE CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, size_t dwStackSize,
LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter,
DWORD dwCreationFlags, LPDWORD lpThreadId) DWORD dwCreationFlags, LPDWORD lpThreadId)
{ {
@ -814,7 +814,7 @@ BOOL ThreadCloseHandle(HANDLE handle)
} }
HANDLE CreateRemoteThread(HANDLE hProcess, LPSECURITY_ATTRIBUTES lpThreadAttributes, HANDLE CreateRemoteThread(HANDLE hProcess, LPSECURITY_ATTRIBUTES lpThreadAttributes,
SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, size_t dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress,
LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId) LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId)
{ {
WLog_ERR(TAG, "not implemented"); WLog_ERR(TAG, "not implemented");

View File

@ -54,7 +54,7 @@ struct winpr_thread
WINPR_ALIGN64 BOOL exited; WINPR_ALIGN64 BOOL exited;
WINPR_ALIGN64 DWORD dwExitCode; WINPR_ALIGN64 DWORD dwExitCode;
WINPR_ALIGN64 pthread_t thread; WINPR_ALIGN64 pthread_t thread;
WINPR_ALIGN64 SIZE_T dwStackSize; WINPR_ALIGN64 size_t dwStackSize;
WINPR_ALIGN64 LPVOID lpParameter; WINPR_ALIGN64 LPVOID lpParameter;
WINPR_ALIGN64 pthread_mutex_t mutex; WINPR_ALIGN64 pthread_mutex_t mutex;
mux_condition_bundle isRunning; mux_condition_bundle isRunning;