diff --git a/Libs/j3dcore/j3dhook.h b/Libs/j3dcore/j3dhook.h index cf97368..af2dc73 100644 --- a/Libs/j3dcore/j3dhook.h +++ b/Libs/j3dcore/j3dhook.h @@ -85,6 +85,9 @@ static inline bool J3DHookFunction(intptr_t pFuncAddr, void* pHookFunc) */ static inline bool J3DHookIsSkipped(const char* pName) { +#ifdef _MSC_VER +#pragma warning(suppress : 4996) // getenv: only read +#endif const char* pList = getenv("INDY_NOHOOK"); if ( !pList ) { diff --git a/Libs/sith/World/sithThing.c b/Libs/sith/World/sithThing.c index 22b901d..b88107e 100644 --- a/Libs/sith/World/sithThing.c +++ b/Libs/sith/World/sithThing.c @@ -340,8 +340,7 @@ static_assert(sizeof(CndThingSectionCounts) == 44, "sizeof(CndThingSectionCounts // Copies a resource name into a CND name field (at most 63 characters, always terminated) static void sithThing_CopyCndName(char* pDest, const char* pName) { - strncpy(pDest, pName, 63); - pDest[63] = '\0'; + stdUtil_StringCopy(pDest, 64, pName); } // INDY: reimplemented from v1.2 (Stage 3); verified by the differential suite "sithThing" (Scripts/indy/test_diff.sh). @@ -808,8 +807,7 @@ int J3DAPI sithThing_ReadThingsListBinary(tFileHandle fh, SithWorld* pWorld, siz sithThing_EnterSector(pThing, pSector, /*bNoWaterSplash=*/1, /*bNoNotify=*/1); } - strncpy(pThing->aName, pInfo->aName, STD_ARRAYLEN(pThing->aName) - 1); - pThing->aName[STD_ARRAYLEN(pThing->aName) - 1] = '\0'; + STD_STRCPY(pThing->aName, pInfo->aName); pThing->flags = pInfo->flags & ~SITH_TF_SEEN; pThing->type = pInfo->type; @@ -1013,8 +1011,7 @@ int J3DAPI sithThing_ReadThingsListBinary(tFileHandle fh, SithWorld* pWorld, siz pExplInfo->spriteEnd = pExplosion->spriteEndPos; if ( pExplosion->aSpriteTemplateName[0] ) { - strncpy(pExplInfo->aSpriteTemplateName, pExplosion->aSpriteTemplateName, STD_ARRAYLEN(pExplInfo->aSpriteTemplateName) - 1); - pExplInfo->aSpriteTemplateName[STD_ARRAYLEN(pExplInfo->aSpriteTemplateName) - 1] = '\0'; + STD_STRCPY(pExplInfo->aSpriteTemplateName, pExplosion->aSpriteTemplateName); } for ( size_t j = 0; j < STD_ARRAYLEN(pExplInfo->apDebries); j++ ) { diff --git a/Libs/smush/smushPlayWin32.c b/Libs/smush/smushPlayWin32.c index 09fbc3f..67b8ece 100644 --- a/Libs/smush/smushPlayWin32.c +++ b/Libs/smush/smushPlayWin32.c @@ -324,7 +324,9 @@ void SmushPlatform_Wait(uint32_t usec) void* SmushPlatform_OpenFile(const char* pFilename) { - return fopen(pFilename, "rb"); + FILE* pFile = NULL; + fopen_s(&pFile, pFilename, "rb"); + return pFile; } size_t SmushPlatform_ReadFile(void* pFile, void* pBuffer, size_t size)