From bfb5b44d38846b6a54a2269173b70bd09d1d1e00 Mon Sep 17 00:00:00 2001 From: HappyDOGE <28511119+HappyDOGE@users.noreply.github.com> Date: Mon, 16 Jan 2023 11:56:05 +0300 Subject: [PATCH] win64: misc pointer truncation fixes --- engine/downloadthread.cpp | 2 +- filesystem/filesystem_stdio.cpp | 2 +- game/server/ai_navigator.cpp | 2 +- materialsystem/CColorCorrection.cpp | 2 +- studiorender/r_studiodraw.cpp | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engine/downloadthread.cpp b/engine/downloadthread.cpp index a79ebff5..882609f7 100644 --- a/engine/downloadthread.cpp +++ b/engine/downloadthread.cpp @@ -425,7 +425,7 @@ DWORD __stdcall DownloadThread( void *voidPtr ) //Thread_DPrintf( "Requesting full download\n%s", headers ); } - rc.hDataResource = InternetOpenUrl(rc.hOpenResource, fullURL, headerPtr, headerLen, flags,(DWORD)(&rc) ); + rc.hDataResource = InternetOpenUrl(rc.hOpenResource, fullURL, headerPtr, headerLen, flags, (DWORD_PTR)(&rc) ); // send the request off if ( !rc.hDataResource ) diff --git a/filesystem/filesystem_stdio.cpp b/filesystem/filesystem_stdio.cpp index f80d4e4a..29caa925 100644 --- a/filesystem/filesystem_stdio.cpp +++ b/filesystem/filesystem_stdio.cpp @@ -1413,7 +1413,7 @@ size_t CWin32ReadOnlyFile::FS_fread( void *dest, size_t destSize, size_t size ) if ( m_hFileUnbuffered != INVALID_HANDLE_VALUE ) { const int destBaseAlign = ( IsX360() ) ? 4 : m_SectorSize; - bool bDestBaseIsAligned = ( (DWORD)dest % destBaseAlign == 0 ); + bool bDestBaseIsAligned = ( (DWORD_PTR)dest % destBaseAlign == 0 ); bool bCanReadUnbufferedDirect = ( bDestBaseIsAligned && ( destSize % m_SectorSize == 0 ) && ( m_ReadPos % m_SectorSize == 0 ) ); if ( bCanReadUnbufferedDirect ) diff --git a/game/server/ai_navigator.cpp b/game/server/ai_navigator.cpp index 2825744c..c304bcdc 100644 --- a/game/server/ai_navigator.cpp +++ b/game/server/ai_navigator.cpp @@ -1222,7 +1222,7 @@ float CAI_Navigator::GetPathTimeToGoal() AI_PathNode_t CAI_Navigator::GetNearestNode() { #ifdef WIN32 - COMPILE_TIME_ASSERT( (int)AIN_NO_NODE == NO_NODE ); + COMPILE_TIME_ASSERT( (intp)AIN_NO_NODE == NO_NODE ); #endif return (AI_PathNode_t)(intp)( GetPathfinder()->NearestNodeToNPC() ); } diff --git a/materialsystem/CColorCorrection.cpp b/materialsystem/CColorCorrection.cpp index 5483d18e..46246658 100644 --- a/materialsystem/CColorCorrection.cpp +++ b/materialsystem/CColorCorrection.cpp @@ -79,7 +79,7 @@ ColorCorrectionLookup_t::~ColorCorrectionLookup_t( ) void ColorCorrectionLookup_t::AllocTexture() { char name[64]; - sprintf( name, "ColorCorrection - %d", m_Handle ); + sprintf( name, "ColorCorrection - %p", m_Handle ); m_pColorCorrectionTexture = ITextureInternal::CreateProceduralTexture( name, TEXTURE_GROUP_OTHER, COLOR_CORRECTION_TEXTURE_SIZE, COLOR_CORRECTION_TEXTURE_SIZE, COLOR_CORRECTION_TEXTURE_SIZE, IMAGE_FORMAT_BGRX8888, diff --git a/studiorender/r_studiodraw.cpp b/studiorender/r_studiodraw.cpp index da6905fd..c2aee1fb 100644 --- a/studiorender/r_studiodraw.cpp +++ b/studiorender/r_studiodraw.cpp @@ -1138,7 +1138,7 @@ public: if ( nHasSIMD ) { // Precaches the data - _mm_prefetch( (char*)((int)pGroupToMesh & (~0x1F)), _MM_HINT_NTA ); + _mm_prefetch( (char*)((intp)pGroupToMesh & (~0x1F)), _MM_HINT_NTA ); } #endif for ( int i = 0; i < PREFETCH_VERT_COUNT; ++i ) @@ -1165,7 +1165,7 @@ public: if ( nHasSIMD ) { char *pMem = (char*)&pGroupToMesh[j + PREFETCH_VERT_COUNT + 1]; - _mm_prefetch( (char*)((int)pMem & (~0x1F)), _MM_HINT_NTA ); + _mm_prefetch( (char*)((intp)pMem & (~0x1F)), _MM_HINT_NTA ); } #endif idx = j & (PREFETCH_VERT_COUNT-1);