From cba5a56ee74a7c7fc8f02ff473609fcc8c5f0b6f Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Mon, 30 Mar 2026 00:34:33 -0500 Subject: [PATCH] SIZE_T -> size_t --- Minecraft.Client/Platform/Extrax64Stubs.cpp | 10 ++++----- .../Platform/Linux/Linux_Minecraft.cpp | 4 ++-- .../Platform/Linux/Stubs/DirectXMath/sal.h | 2 +- .../Platform/Linux/Stubs/winapi_stubs.h | 21 +++++++++---------- .../Windows64/Miles/include/imssapi.h | 4 ++-- .../Windows64/Windows64_Minecraft.cpp | 4 ++-- Minecraft.World/IO/Streams/Compression.cpp | 16 +++++++------- .../Platform/x64headers/extraX64.h | 7 +++---- 8 files changed, 33 insertions(+), 35 deletions(-) diff --git a/Minecraft.Client/Platform/Extrax64Stubs.cpp b/Minecraft.Client/Platform/Extrax64Stubs.cpp index 0b7e6be93..0a1f89c9f 100644 --- a/Minecraft.Client/Platform/Extrax64Stubs.cpp +++ b/Minecraft.Client/Platform/Extrax64Stubs.cpp @@ -109,7 +109,7 @@ bool IsEqualXUID(PlayerUID a, PlayerUID b) void XMemCpy(void *a, const void *b, size_t s) { memcpy(a, b, s); } void XMemSet(void *a, int t, size_t s) { memset(a, t, s); } void XMemSet128(void *a, int t, size_t s) { memset(a, t, s); } -void *XPhysicalAlloc(SIZE_T a, ULONG_PTR b, ULONG_PTR c, DWORD d) { return malloc(a); } +void *XPhysicalAlloc(size_t a, ULONG_PTR b, ULONG_PTR c, DWORD d) { return malloc(a); } void XPhysicalFree(void *a) { free(a); } D3DXVECTOR3::D3DXVECTOR3() {} @@ -187,9 +187,9 @@ DWORD XUserAreUsersFriends( DWORD dwUserIndex, PPlayerUID pXuids, DWORD dwXuidCo HRESULT XMemDecompress( XMEMDECOMPRESSION_CONTEXT Context, void *pDestination, - SIZE_T *pDestSize, + size_t *pDestSize, void *pSource, - SIZE_T SrcSize + size_t SrcSize ) { memcpy(pDestination, pSource, SrcSize); @@ -218,9 +218,9 @@ HRESULT XMemDecompress( HRESULT XMemCompress( XMEMCOMPRESSION_CONTEXT Context, void *pDestination, - SIZE_T *pDestSize, + size_t *pDestSize, void *pSource, - SIZE_T SrcSize + size_t SrcSize ) { memcpy(pDestination, pSource, SrcSize); diff --git a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp index 86ac86570..743bf4b32 100644 --- a/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp +++ b/Minecraft.Client/Platform/Linux/Linux_Minecraft.cpp @@ -1049,7 +1049,7 @@ volatile int sectCheck = 48; CRITICAL_SECTION memCS; DWORD tlsIdx; -void* XMemAlloc(SIZE_T dwSize, DWORD dwAllocAttributes) { +void* XMemAlloc(size_t dwSize, DWORD dwAllocAttributes) { if (!trackStarted) { void* p = XMemAllocDefault(dwSize, dwAllocAttributes); size_t realSize = XMemSizeDefault(p, dwAllocAttributes); @@ -1132,7 +1132,7 @@ void WINAPI XMemFree(void* pAddress, DWORD dwAllocAttributes) { LeaveCriticalSection(&memCS); } -SIZE_T WINAPI XMemSize(void* pAddress, DWORD dwAllocAttributes) { +size_t WINAPI XMemSize(void* pAddress, DWORD dwAllocAttributes) { if (trackStarted) { return XMemSizeDefault(pAddress, dwAllocAttributes) - 16; } else { diff --git a/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/sal.h b/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/sal.h index eaf7074c3..93d726e40 100644 --- a/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/sal.h +++ b/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/sal.h @@ -2323,7 +2323,7 @@ enum __SAL_YesNo { _SAL_notpresent, _SAL_no, _SAL_maybe, _SAL_yes, _SAL_default // size_t _Count) buffer maybe zero-terminated after the call #define _Post_maybez_ _SAL1_1_Source_(_Post_maybez_, (), _Post1_impl_(__maybezterm_impl)) -// e.g. SIZE_T HeapSize( _In_ HANDLE hHeap, DWORD dwFlags, _Pre_notnull_ _Post_bytecap_(return) +// e.g. size_t HeapSize( _In_ HANDLE hHeap, DWORD dwFlags, _Pre_notnull_ _Post_bytecap_(return) // LPCVOID lpMem ); #define _Post_cap_(size) _SAL1_1_Source_(_Post_cap_, (size), _Post1_impl_(__cap_impl(size))) #define _Post_bytecap_(size) \ diff --git a/Minecraft.Client/Platform/Linux/Stubs/winapi_stubs.h b/Minecraft.Client/Platform/Linux/Stubs/winapi_stubs.h index 4f22379cc..1cd6dc5c8 100644 --- a/Minecraft.Client/Platform/Linux/Stubs/winapi_stubs.h +++ b/Minecraft.Client/Platform/Linux/Stubs/winapi_stubs.h @@ -28,7 +28,7 @@ typedef unsigned int* LPDWORD; typedef char CHAR; typedef uintptr_t ULONG_PTR; typedef long LONG; -typedef uint64_t PlayerUID; +typedef unsigned long long PlayerUID; typedef DWORD WORD; typedef DWORD* PDWORD; @@ -45,7 +45,6 @@ typedef struct { } ULARGE_INTEGER; typedef long long LONGLONG; -typedef size_t SIZE_T; typedef wchar_t *LPWSTR, *PWSTR; typedef unsigned char boolean; // java brainrot #define __debugbreak() @@ -167,12 +166,12 @@ typedef struct _FILETIME { typedef struct _MEMORYSTATUS { DWORD dwLength; DWORD dwMemoryLoad; - SIZE_T dwTotalPhys; - SIZE_T dwAvailPhys; - SIZE_T dwTotalPageFile; - SIZE_T dwAvailPageFile; - SIZE_T dwTotalVirtual; - SIZE_T dwAvailVirtual; + size_t dwTotalPhys; + size_t dwAvailPhys; + size_t dwTotalPageFile; + size_t dwAvailPageFile; + size_t dwTotalVirtual; + size_t dwAvailVirtual; } MEMORYSTATUS, *LPMEMORYSTATUS; typedef struct _WIN32_FIND_DATAA { @@ -957,7 +956,7 @@ static inline DWORD _WaitForThread(struct LinuxThread* lt, static DWORD g_nextThreadId = 1000; -static inline HANDLE CreateThread(void*, SIZE_T stackSize, +static inline HANDLE CreateThread(void*, size_t stackSize, LPTHREAD_START_ROUTINE lpStartAddress, void* lpParameter, DWORD dwCreationFlags, DWORD* lpThreadId) { @@ -1049,7 +1048,7 @@ static inline int swprintf_s(wchar_t* buf, size_t sz, const wchar_t* fmt, ...) { static inline HMODULE GetModuleHandle(const char* lpModuleName) { return 0; } -static inline void* VirtualAlloc(void* lpAddress, SIZE_T dwSize, +static inline void* VirtualAlloc(void* lpAddress, size_t dwSize, DWORD flAllocationType, DWORD flProtect) { // MEM_COMMIT | MEM_RESERVE → mmap anonymous int prot = 0; @@ -1070,7 +1069,7 @@ static inline void* VirtualAlloc(void* lpAddress, SIZE_T dwSize, return p; } -static inline bool VirtualFree(void* lpAddress, SIZE_T dwSize, +static inline bool VirtualFree(void* lpAddress, size_t dwSize, DWORD dwFreeType) { if (lpAddress == nullptr) return FALSE; // MEM_RELEASE (0x8000) frees the whole region diff --git a/Minecraft.Client/Platform/Windows64/Miles/include/imssapi.h b/Minecraft.Client/Platform/Windows64/Miles/include/imssapi.h index 883a6fc13..1f698f086 100644 --- a/Minecraft.Client/Platform/Windows64/Miles/include/imssapi.h +++ b/Minecraft.Client/Platform/Windows64/Miles/include/imssapi.h @@ -2703,7 +2703,7 @@ __stdcall XMemSet( PVOID pDest, INT c, - SIZE_T count + size_t count ); PVOID @@ -2711,7 +2711,7 @@ __stdcall XMemCpy( PVOID pDest, const void* pSrc, - SIZE_T count + size_t count ); char * __cdecl strcpy( char *_Dest, const char * _Source); diff --git a/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp index 29069ff6d..ec705d714 100644 --- a/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Platform/Windows64/Windows64_Minecraft.cpp @@ -935,7 +935,7 @@ volatile int sectCheck = 48; CRITICAL_SECTION memCS; DWORD tlsIdx; -void* XMemAlloc(SIZE_T dwSize, DWORD dwAllocAttributes) { +void* XMemAlloc(size_t dwSize, DWORD dwAllocAttributes) { if (!trackStarted) { void* p = XMemAllocDefault(dwSize, dwAllocAttributes); size_t realSize = XMemSizeDefault(p, dwAllocAttributes); @@ -1018,7 +1018,7 @@ void WINAPI XMemFree(void* pAddress, DWORD dwAllocAttributes) { LeaveCriticalSection(&memCS); } -SIZE_T WINAPI XMemSize(void* pAddress, DWORD dwAllocAttributes) { +size_t WINAPI XMemSize(void* pAddress, DWORD dwAllocAttributes) { if (trackStarted) { return XMemSizeDefault(pAddress, dwAllocAttributes) - 16; } else { diff --git a/Minecraft.World/IO/Streams/Compression.cpp b/Minecraft.World/IO/Streams/Compression.cpp index ceb5447fa..68f65c10c 100644 --- a/Minecraft.World/IO/Streams/Compression.cpp +++ b/Minecraft.World/IO/Streams/Compression.cpp @@ -247,13 +247,13 @@ HRESULT Compression::Compress(void* pDestination, unsigned int* pDestSize, // Using zlib for x64 compression - 360 is using native 360 compression and // PS3 a stubbed non-compressing version of this #if defined(_WIN64) || defined(__linux__) - SIZE_T destSize = (SIZE_T)(*pDestSize); + size_t destSize = (size_t)(*pDestSize); int res = ::compress((Bytef*)pDestination, (uLongf*)&destSize, (Bytef*)pSource, SrcSize); *pDestSize = (unsigned int)destSize; return ((res == Z_OK) ? S_OK : -1); #else - SIZE_T destSize = (SIZE_T)(*pDestSize); + size_t destSize = (size_t)(*pDestSize); HRESULT res = XMemCompress(compressionContext, pDestination, &destSize, pSource, SrcSize); *pDestSize = (unsigned int)destSize; @@ -275,15 +275,15 @@ HRESULT Compression::Decompress(void* pDestination, unsigned int* pDestSize, // Using zlib for x64 compression - 360 is using native 360 compression and // PS3 a stubbed non-compressing version of this #if defined(_WIN64) || defined(__linux__) - SIZE_T destSize = (SIZE_T)(*pDestSize); + size_t destSize = (size_t)(*pDestSize); int res = ::uncompress((Bytef*)pDestination, (uLongf*)&destSize, (Bytef*)pSource, SrcSize); *pDestSize = (unsigned int)destSize; return ((res == Z_OK) ? S_OK : -1); #else - SIZE_T destSize = (SIZE_T)(*pDestSize); + size_t destSize = (size_t)(*pDestSize); HRESULT res = XMemDecompress(decompressionContext, pDestination, - (SIZE_T*)&destSize, pSource, SrcSize); + (size_t*)&destSize, pSource, SrcSize); *pDestSize = (unsigned int)destSize; return res; #endif @@ -293,7 +293,7 @@ HRESULT Compression::Decompress(void* pDestination, unsigned int* pDestSize, // platforms (so no virtual mem stuff) void Compression::VitaVirtualDecompress( void* pDestination, unsigned int* pDestSize, void* pSource, - unsigned int SrcSize) // (void* buf, SIZE_T dwSize, void* dst) + unsigned int SrcSize) // (void* buf, size_t dwSize, void* dst) { std::uint8_t* pSrc = (std::uint8_t*)pSource; int Offset = 0; @@ -333,9 +333,9 @@ HRESULT Compression::DecompressWithType(void* pDestination, return S_OK; case eCompressionType_LZXRLE: { #if defined(_WIN64) - SIZE_T destSize = (SIZE_T)(*pDestSize); + size_t destSize = (size_t)(*pDestSize); HRESULT res = XMemDecompress(decompressionContext, pDestination, - (SIZE_T*)&destSize, pSource, SrcSize); + (size_t*)&destSize, pSource, SrcSize); *pDestSize = (unsigned int)destSize; return res; #else diff --git a/Minecraft.World/Platform/x64headers/extraX64.h b/Minecraft.World/Platform/x64headers/extraX64.h index 97f91554d..4d814dc32 100644 --- a/Minecraft.World/Platform/x64headers/extraX64.h +++ b/Minecraft.World/Platform/x64headers/extraX64.h @@ -14,7 +14,6 @@ #define MULTITHREAD_ENABLE -typedef unsigned char byte; constexpr int MINECRAFT_NET_MAX_PLAYERS = 8; static_assert( @@ -60,7 +59,7 @@ public: void XMemCpy(void* a, const void* b, size_t s); void XMemSet(void* a, int t, size_t s); void XMemSet128(void* a, int t, size_t s); -void* XPhysicalAlloc(SIZE_T a, ULONG_PTR b, ULONG_PTR c, DWORD d); +void* XPhysicalAlloc(size_t a, ULONG_PTR b, ULONG_PTR c, DWORD d); void XPhysicalFree(void* a); class DLCManager; @@ -280,10 +279,10 @@ typedef enum _XMEMCODEC_TYPE { } XMEMCODEC_TYPE; HRESULT XMemDecompress(XMEMDECOMPRESSION_CONTEXT Context, void* pDestination, - SIZE_T* pDestSize, void* pSource, SIZE_T SrcSize); + size_t* pDestSize, void* pSource, size_t SrcSize); HRESULT XMemCompress(XMEMCOMPRESSION_CONTEXT Context, void* pDestination, - SIZE_T* pDestSize, void* pSource, SIZE_T SrcSize); + size_t* pDestSize, void* pSource, size_t SrcSize); HRESULT XMemCreateCompressionContext(XMEMCODEC_TYPE CodecType, const void* pCodecParams, DWORD Flags,