LONG64 -> int64_t

This commit is contained in:
Tropical 2026-03-30 00:21:16 -05:00
parent c8f59b4a99
commit a518b51754
9 changed files with 20 additions and 23 deletions

View file

@ -204,8 +204,8 @@ LevelChunk* MultiPlayerChunkCache::create(int x, int z) {
#if (defined _WIN64 || defined __LP64__)
if (InterlockedCompareExchangeRelease64(
(LONG64*)&cache[idx], (LONG64)chunk, (LONG64)lastChunk) ==
(LONG64)lastChunk)
(int64_t*)&cache[idx], (int64_t)chunk, (int64_t)lastChunk) ==
(int64_t)lastChunk)
#else
if (InterlockedCompareExchangeRelease((LONG*)&cache[idx], (LONG)chunk,
(LONG)lastChunk) ==

View file

@ -163,8 +163,8 @@ LevelChunk* ServerChunkCache::create(
#if defined(_WIN64) || defined(__LP64__)
if (InterlockedCompareExchangeRelease64(
(LONG64*)&cache[idx], (LONG64)chunk, (LONG64)lastChunk) ==
(LONG64)lastChunk)
(int64_t*)&cache[idx], (int64_t)chunk, (int64_t)lastChunk) ==
(int64_t)lastChunk)
#else
if (InterlockedCompareExchangeRelease((LONG*)&cache[idx], (LONG)chunk,
(LONG)lastChunk) ==

View file

@ -474,7 +474,7 @@ void C4JStorage::SetSaveDisabled(bool bDisable) {}
bool C4JStorage::GetSaveDisabled(void) { return false; }
unsigned int C4JStorage::GetSaveSize() { return 0; }
void C4JStorage::GetSaveData(void *pvData,unsigned int *pulBytes) {}
PVOID C4JStorage::AllocateSaveData(unsigned int ulBytes) { return new char[ulBytes]; }
void* C4JStorage::AllocateSaveData(unsigned int ulBytes) { return new char[ulBytes]; }
void C4JStorage::SaveSaveData(unsigned int ulBytes,PBYTE pbThumbnail,DWORD cbThumbnail,PBYTE pbTextData, DWORD dwTextLen) {}
void C4JStorage::CopySaveDataToNewSave(std::uint8_t *pbThumbnail,unsigned int cbThumbnail,WCHAR *wchNewName,int ( *Func)(void* lpParam, bool), void* lpParam) {}
void C4JStorage::SetSaveDeviceSelected(unsigned int uiPad,bool bSelected) {}

View file

@ -1100,7 +1100,7 @@ void operator delete(void* p) {
XALLOC_MEMPROTECT_READWRITE, FALSE, XALLOC_MEMTYPE_HEAP));
}
void WINAPI XMemFree(PVOID pAddress, DWORD dwAllocAttributes) {
void WINAPI XMemFree(void* pAddress, DWORD dwAllocAttributes) {
bool special = false;
if (dwAllocAttributes == 0) {
dwAllocAttributes = MAKE_XALLOC_ATTRIBUTES(
@ -1132,7 +1132,7 @@ void WINAPI XMemFree(PVOID pAddress, DWORD dwAllocAttributes) {
LeaveCriticalSection(&memCS);
}
SIZE_T WINAPI XMemSize(PVOID pAddress, DWORD dwAllocAttributes) {
SIZE_T WINAPI XMemSize(void* pAddress, DWORD dwAllocAttributes) {
if (trackStarted) {
return XMemSizeDefault(pAddress, dwAllocAttributes) - 16;
} else {

View file

@ -29,12 +29,9 @@ typedef void* HANDLE;
typedef int INT;
typedef long* PLONG;
typedef unsigned int* LPDWORD;
typedef const void* LPCVOID;
typedef char CHAR;
typedef void* PVOID;
typedef uintptr_t ULONG_PTR;
typedef long LONG;
typedef long LONG64, *PLONG64;
typedef void VOID;
typedef ULONGLONG PlayerUID;
typedef DWORD WORD;
@ -307,15 +304,15 @@ static inline VOID GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer) {
static inline DWORD GetLastError(VOID) { return errno; }
#ifdef __LP64__
static inline LONG64 InterlockedCompareExchangeRelease64(
LONG64 volatile* Destination, LONG64 Exchange, LONG64 Comperand) {
LONG64 expected = Comperand;
static inline int64_t InterlockedCompareExchangeRelease64(
int64_t volatile* Destination, int64_t Exchange, int64_t Comperand) {
int64_t expected = Comperand;
__atomic_compare_exchange_n(Destination, &expected, Exchange, false,
__ATOMIC_RELEASE, __ATOMIC_RELAXED);
return expected;
}
#else
static inline LONG64 InterlockedCompareExchangeRelease(
static inline int64_t InterlockedCompareExchangeRelease(
LONG volatile* Destination, LONG Exchange, LONG Comperand) {
LONG expected = Comperand;
__atomic_compare_exchange_n(Destination, &expected, Exchange, false,

View file

@ -260,7 +260,7 @@ public:
bool GetSaveDisabled(void);
unsigned int GetSaveSize();
void GetSaveData(void *pvData,unsigned int *puiBytes);
PVOID AllocateSaveData(unsigned int uiBytes);
void* AllocateSaveData(unsigned int uiBytes);
void SetSaveImages( PBYTE pbThumbnail,DWORD dwThumbnailBytes,PBYTE pbImage,DWORD dwImageBytes, PBYTE pbTextData ,DWORD dwTextDataBytes); // Sets the thumbnail & image for the save, optionally setting the metadata in the png
C4JStorage::ESaveGameState SaveSaveData(int( *Func)(void* ,const bool),void* lpParam);
void CopySaveDataToNewSave(PBYTE pbThumbnail,DWORD cbThumbnail,WCHAR *wchNewName,int ( *Func)(void* lpParam, bool), void* lpParam);

View file

@ -986,7 +986,7 @@ void operator delete(void* p) {
XALLOC_MEMPROTECT_READWRITE, FALSE, XALLOC_MEMTYPE_HEAP));
}
void WINAPI XMemFree(PVOID pAddress, DWORD dwAllocAttributes) {
void WINAPI XMemFree(void* pAddress, DWORD dwAllocAttributes) {
bool special = false;
if (dwAllocAttributes == 0) {
dwAllocAttributes = MAKE_XALLOC_ATTRIBUTES(
@ -1018,7 +1018,7 @@ void WINAPI XMemFree(PVOID pAddress, DWORD dwAllocAttributes) {
LeaveCriticalSection(&memCS);
}
SIZE_T WINAPI XMemSize(PVOID pAddress, DWORD dwAllocAttributes) {
SIZE_T WINAPI XMemSize(void* pAddress, DWORD dwAllocAttributes) {
if (trackStarted) {
return XMemSizeDefault(pAddress, dwAllocAttributes) - 16;
} else {

View file

@ -415,7 +415,7 @@ void SparseDataStorage::addNewPlane(int y) {
// lastDataAndCount, and will return the value present just before the
// write took place
int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64(
(LONG64*)&dataAndCount, newDataAndCount, lastDataAndCount);
(int64_t*)&dataAndCount, newDataAndCount, lastDataAndCount);
if (lastDataAndCount2 == lastDataAndCount) {
success = true;
@ -489,7 +489,7 @@ void SparseDataStorage::updateDataAndCount(int64_t newDataAndCount) {
// lastDataAndCount, and will return the value present just before the
// write took place
int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64(
(LONG64*)&dataAndCount, newDataAndCount, lastDataAndCount);
(int64_t*)&dataAndCount, newDataAndCount, lastDataAndCount);
if (lastDataAndCount2 == lastDataAndCount) {
success = true;
@ -564,7 +564,7 @@ int SparseDataStorage::compress() {
// lastDataAndCount, and will return the value present just before the
// write took place
int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64(
(LONG64*)&dataAndCount, newDataAndCount, lastDataAndCount);
(int64_t*)&dataAndCount, newDataAndCount, lastDataAndCount);
if (lastDataAndCount2 != lastDataAndCount) {
// Failed to write. Don't bother trying again... being very

View file

@ -418,7 +418,7 @@ void SparseLightStorage::addNewPlane(int y) {
// lastDataAndCount, and will return the value present just before the
// write took place
int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64(
(LONG64*)&dataAndCount, newDataAndCount, lastDataAndCount);
(int64_t*)&dataAndCount, newDataAndCount, lastDataAndCount);
if (lastDataAndCount2 == lastDataAndCount) {
success = true;
@ -492,7 +492,7 @@ void SparseLightStorage::updateDataAndCount(int64_t newDataAndCount) {
// lastDataAndCount, and will return the value present just before the
// write took place
int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64(
(LONG64*)&dataAndCount, newDataAndCount, lastDataAndCount);
(int64_t*)&dataAndCount, newDataAndCount, lastDataAndCount);
if (lastDataAndCount2 == lastDataAndCount) {
success = true;
@ -574,7 +574,7 @@ int SparseLightStorage::compress() {
// lastDataAndCount, and will return the value present just before the
// write took place
int64_t lastDataAndCount2 = InterlockedCompareExchangeRelease64(
(LONG64*)&dataAndCount, newDataAndCount, lastDataAndCount);
(int64_t*)&dataAndCount, newDataAndCount, lastDataAndCount);
if (lastDataAndCount2 != lastDataAndCount) {
// Failed to write. Don't bother trying again... being very