diff --git a/Common/Data/Encoding/Utf8.cpp b/Common/Data/Encoding/Utf8.cpp index 4a984e2f45..faad2bba78 100644 --- a/Common/Data/Encoding/Utf8.cpp +++ b/Common/Data/Encoding/Utf8.cpp @@ -13,7 +13,9 @@ */ #ifdef _WIN32 +#ifndef NOMINMAX #define NOMINMAX +#endif #include #endif diff --git a/Common/File/VFS/SevenZipFileReader.cpp b/Common/File/VFS/SevenZipFileReader.cpp index a344f6c9c3..bff32f2e98 100644 --- a/Common/File/VFS/SevenZipFileReader.cpp +++ b/Common/File/VFS/SevenZipFileReader.cpp @@ -9,7 +9,9 @@ #include #endif +#ifndef NOMINMAX #define NOMINMAX // 7z includes windows.h for some reason. +#endif #include "ext/lzma-sdk/7z.h" #include "ext/lzma-sdk/7zCrc.h" #include "ext/lzma-sdk/7zFile.h" diff --git a/Common/Render/DropShadow.cpp b/Common/Render/DropShadow.cpp index 099042e40b..16fa8fbec9 100644 --- a/Common/Render/DropShadow.cpp +++ b/Common/Render/DropShadow.cpp @@ -29,7 +29,7 @@ DropShadowParams UIDropShadowParams(float pixelsPerUnit) { DropShadowParams params; params.radius = std::max(1, (int)(UI_SHADOW_RADIUS * pixelsPerUnit)); params.intensity = UI_SHADOW_INTENSITY; - params.offsetY = 1.0f * pixelsPerUnit; + params.offsetY = (int)(1.0f * pixelsPerUnit); return params; } diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index d73593ae4d..add2684dd9 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -1869,7 +1869,7 @@ static PSPThread *__KernelNextThread() { // A busy syscall keeps the CPU unless something better wants it. An idle thread stands in. PSPThread *busy = busySyscalls.empty() ? nullptr : __KernelBestBusyThread(); if (busy) { - const u32 busyPriority = busy->nt.currentPriority; + const s32 busyPriority = busy->nt.currentPriority; const SceUID bestReady = threadReadyQueue.peek_first(); PSPThread *bestReadyThread = bestReady != 0 ? kernelObjects.GetFast(bestReady) : nullptr; const bool readyOutranks = bestReadyThread && bestReadyThread->nt.currentPriority < busyPriority; @@ -3823,7 +3823,7 @@ bool __KernelCheckCallbacks() { // canceled.) PSPThread *cur = __GetCurrentThread(); u32 error; - u32 bestPriority = 0xFFFFFFFF; + s32 bestPriority = 0x7FFFFFFF; if (cur && cur->isRunning()) bestPriority = cur->nt.currentPriority; SceUID bestReady = threadReadyQueue.peek_first(); diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index 89758112e8..8045ff761f 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -2736,7 +2736,6 @@ static u32 sceNetAdhocctlAddHandler(u32 handlerPtr, u32 handlerArg) { static u32 NetAdhocctl_Disconnect(bool fromGameMode = false) { // Library initialized if (netAdhocctlInited) { - int iResult, error; if (isAdhocctlBusy && CoreTiming::IsScheduled(adhocctlNotifyEvent)) { return SCE_NET_ADHOCCTL_ERROR_BUSY; } diff --git a/Core/HLE/sceUsbMic.cpp b/Core/HLE/sceUsbMic.cpp index 499596fd26..c72eb5c66e 100644 --- a/Core/HLE/sceUsbMic.cpp +++ b/Core/HLE/sceUsbMic.cpp @@ -92,7 +92,7 @@ static void __MicBlockingResume(u64 userdata, int cyclesLate) { if (Microphone::isHaveDevice()) { const u64 retries = userdata >> 32; - if (micPolling && Microphone::getReadMicDataLength() < (u32)iter->needSize && retries < MIC_JITTER_US / MIC_POLL_INTERVAL_US) { + if (micPolling && (u32)Microphone::getReadMicDataLength() < (u32)iter->needSize && retries < (u64)(MIC_JITTER_US / MIC_POLL_INTERVAL_US)) { CoreTiming::ScheduleEvent(usToCycles(MIC_POLL_INTERVAL_US), eventMicBlockingResume, (u32)threadID | ((retries + 1) << 32)); iter++; continue; diff --git a/Core/MIPS/MIPSVFPUUtils.cpp b/Core/MIPS/MIPSVFPUUtils.cpp index 849a89fbcf..5c0d6895c4 100644 --- a/Core/MIPS/MIPSVFPUUtils.cpp +++ b/Core/MIPS/MIPSVFPUUtils.cpp @@ -1821,7 +1821,7 @@ static uint32_t vfpu_sin_bits(uint32_t bits) { bool odd; if (!vfpu_sin_reduce(bits, &angle, &odd)) return (bits & 0x80000000u) ^ 0x7F800001u; - return vfpu_sin_from_reduced(angle, (bits >> 31) != odd); + return vfpu_sin_from_reduced(angle, (bits >> 31) != (u32)odd); } static uint32_t vfpu_cos_bits(uint32_t bits) { @@ -1850,7 +1850,7 @@ void vfpu_sincos(float a, float &s, float &c) { sinBits = (bits & 0x80000000u) ^ 0x7F800001u; cosBits = 0x7F800001u; } else { - sinBits = vfpu_sin_from_reduced(angle, (bits >> 31) != odd); + sinBits = vfpu_sin_from_reduced(angle, (bits >> 31) != (u32)odd); cosBits = vfpu_cos_from_reduced(angle, odd); } s = vfpu_float_from_bits(sinBits); diff --git a/Core/Util/AtracTrack.cpp b/Core/Util/AtracTrack.cpp index e263c8d307..b0cf329163 100644 --- a/Core/Util/AtracTrack.cpp +++ b/Core/Util/AtracTrack.cpp @@ -202,7 +202,7 @@ int AnalyzeAtracTrack(const u8 *buffer, u32 size, Track *track, std::string *err return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; } u32 maxLoops = chunkSize >= 36 ? (chunkSize - 36) / 24 : 0; - if (checkNumLoops < 0 || checkNumLoops > maxLoops) { + if (checkNumLoops < 0 || (u32)checkNumLoops > maxLoops) { *error = StringFromFormat("bad checkNumLoops (%d)", checkNumLoops); return SCE_ERROR_ATRAC_UNKNOWN_FORMAT; } @@ -386,7 +386,7 @@ int ParseWaveAT3(const u8 *data, u32 dataLength, TrackInfo *track) { // Scan RIFF chunks for the RIFFWAVE header. Normally we find this immediately. while (true) { - if (offset + 0xC >= dataLength) { + if ((u32)offset + 0xC >= dataLength) { return SCE_ERROR_ATRAC_SIZE_TOO_SMALL; } const u32 blockID = Read32(data, &offset); @@ -412,14 +412,14 @@ int ParseWaveAT3(const u8 *data, u32 dataLength, TrackInfo *track) { // Now that we have the header, loop through the rest of the chunks. bool modifiedSampleOffset = false; while (true) { - if (offset + 8 >= dataLength) { + if ((u32)offset + 8 >= dataLength) { return SCE_ERROR_ATRAC_SIZE_TOO_SMALL; } const u32 chunkID = Read32(data, &offset); const int chunkSize = RoundUpToEven(Read32(data, &offset)); const int nextOffset = offset + chunkSize; // We allow the data chunk to be bigger than readSize, as we may not have read the whole file. - if (offset + chunkSize > dataLength && chunkID != DATA_CHUNK_MAGIC) { + if ((u32)(offset + chunkSize) > dataLength && chunkID != DATA_CHUNK_MAGIC) { return SCE_ERROR_ATRAC_SIZE_TOO_SMALL; } int remainingBytes = 0; @@ -620,7 +620,7 @@ static u32 ParseAA3Headers(u32 readSize, AA3Info *info, u32 fileSize, const u8 * return SCE_ERROR_ATRAC_AA3_INVALID_DATA; } offset += info->tagSize; - if (offset >= readSize) { + if ((u32)offset >= readSize) { return SCE_ERROR_ATRAC_AA3_SIZE_TOO_SMALL; } if (aa3Data[offset] == 0) { @@ -634,7 +634,7 @@ static u32 ParseAA3Headers(u32 readSize, AA3Info *info, u32 fileSize, const u8 * offset = 0; } - if (offset + 0x22 > readSize) { + if ((u32)offset + 0x22 > readSize) { return SCE_ERROR_ATRAC_AA3_SIZE_TOO_SMALL; } if (Parse3BytesBE(aa3Data, &offset) != 0x454133) { diff --git a/Core/Util/DisArm64.cpp b/Core/Util/DisArm64.cpp index 2419c7c55b..fb8f9277e5 100644 --- a/Core/Util/DisArm64.cpp +++ b/Core/Util/DisArm64.cpp @@ -747,7 +747,7 @@ static void SIMDLoadStoreStructure(uint32_t w, Instruction *instr) { bool R = (w >> 21) & 1; bool S = (w >> 12) & 1; int op = (w >> 13) & 7; - int count = (((op & 1) << 1) | R) + 1; + int count = (((op & 1) << 1) | (int)R) + 1; if (op >= 6) { // Load and replicate. if (!L || S) { @@ -787,7 +787,7 @@ static void SIMDLoadStoreStructure(uint32_t w, Instruction *instr) { default: if (size == 0) { esize = 2; - index = (Q << 1) | S; + index = (Q << 1) | (int)S; } else if (size == 1 && !S) { esize = 3; index = Q; diff --git a/Core/Util/GameManager.cpp b/Core/Util/GameManager.cpp index 3b3e475431..3e7fbbe935 100644 --- a/Core/Util/GameManager.cpp +++ b/Core/Util/GameManager.cpp @@ -670,7 +670,7 @@ bool GameManager::ExtractFile(struct zip *z, int file_index, const Path &outFile size_t readSize = std::min(blockSize, size - pos); // Stop before the total would exceed the limit (zip bomb), even // if the declared sizes in the archive were inaccurate. - if (*bytesCopied > maxTotalSize || readSize > maxTotalSize - *bytesCopied) { + if (*bytesCopied > maxTotalSize || (int64_t)readSize > maxTotalSize - *bytesCopied) { ERROR_LOG(Log::HLE, "Bailing: zip contents too large, limit %d", (int)maxTotalSize); delete[] buffer; fclose(f); diff --git a/GPU/Common/DrawEngineCommon.cpp b/GPU/Common/DrawEngineCommon.cpp index 51369b2ce1..1b9439c28b 100644 --- a/GPU/Common/DrawEngineCommon.cpp +++ b/GPU/Common/DrawEngineCommon.cpp @@ -820,7 +820,7 @@ int DrawEngineCommon::ExtendNonIndexedPrim(const uint32_t *cmd, const uint32_t * break; } // The vertices would run off the end of memory. Execute_Prim drops the draw. - if ((offset - dv.vertexCount) + vertexCount > maxVerts) { + if ((int)(offset - dv.vertexCount) + vertexCount > maxVerts) { break; } expandedVertsInDrawCalls_ += expanded; diff --git a/GPU/Common/VertexDecoderHandwritten.cpp b/GPU/Common/VertexDecoderHandwritten.cpp index fee2a6129c..7c9ff68a85 100644 --- a/GPU/Common/VertexDecoderHandwritten.cpp +++ b/GPU/Common/VertexDecoderHandwritten.cpp @@ -224,8 +224,8 @@ void VtxDec_Tu8_C5551_Ps16(const u8 *srcp, u8 *dstp, int numVerts, const UVScale _mm_storeh_pd((double *)&dst[1].u, uvf); #if PPSSPP_ARCH(AMD64) u64 colors = _mm_cvtsi128_si64(col); - dst[0].col = colors; - dst[1].col = colors >> 32; + dst[0].col = (u32)colors; + dst[1].col = (u32)(colors >> 32); #else dst[0].col = _mm_cvtsi128_si32(col); dst[1].col = _mm_cvtsi128_si32(_mm_shuffle_epi32(col, _MM_SHUFFLE(1, 1, 1, 1))); diff --git a/GPU/GLES/ShaderManagerGLES.cpp b/GPU/GLES/ShaderManagerGLES.cpp index 17cd36cb05..e64ab6d1dd 100644 --- a/GPU/GLES/ShaderManagerGLES.cpp +++ b/GPU/GLES/ShaderManagerGLES.cpp @@ -961,7 +961,7 @@ bool ShaderManagerGLES::LoadCache(File::IOFile &f) { return false; } - for (int i = 0; i < header.numLinkedPrograms; i++) { + for (uint32_t i = 0; i < header.numLinkedPrograms; i++) { VShaderID vsid; FShaderID fsid; if (!f.ReadArray(&vsid, 1)) { diff --git a/GPU/GPUCommonHW.cpp b/GPU/GPUCommonHW.cpp index cb069d0064..5692c45c95 100644 --- a/GPU/GPUCommonHW.cpp +++ b/GPU/GPUCommonHW.cpp @@ -1053,7 +1053,7 @@ void GPUCommonHW::Execute_Prim(u32 op, u32 diff) { if (passCulling && readsFramebufferPerDraw && prim == GE_PRIM_RECTANGLES && count > 2 && !inds) { // Its rectangles can overlap too. const int vertexSize = decoder->VertexSize(); - for (int i = 0; i + 1 < count; i += 2) { + for (u32 i = 0; i + 1 < count; i += 2) { int rectBytesRead = 0; drawEngineCommon_->SubmitPrim((const u8 *)verts + i * vertexSize, nullptr, prim, 2, decoder, vertTypeID, true, &rectBytesRead, flags); drawEngineCommon_->Flush(); diff --git a/UI/ImDebugger/ImMemView.cpp b/UI/ImDebugger/ImMemView.cpp index dc6040b73d..2d2f2e5f4d 100644 --- a/UI/ImDebugger/ImMemView.cpp +++ b/UI/ImDebugger/ImMemView.cpp @@ -814,7 +814,7 @@ bool ImMemView::ParseSearchString(const char* query, MemorySearchType mode) { } }break; case BYTE_SEQ:{ - char* s = strdup(query); + const char *s = query; size_t len = strlen(s); for (size_t index = 0; index < len; ) { if (isspace(s[index])) { @@ -834,7 +834,6 @@ bool ImMemView::ParseSearchString(const char* query, MemorySearchType mode) { } memSearch_.data.push_back(value); } - free(s); } break; default: diff --git a/UWP/CommonUWP/CommonUWP.vcxproj b/UWP/CommonUWP/CommonUWP.vcxproj index d0dc6cd25a..071431a7ca 100644 --- a/UWP/CommonUWP/CommonUWP.vcxproj +++ b/UWP/CommonUWP/CommonUWP.vcxproj @@ -57,7 +57,7 @@ false false ../..;../../ext/OpenXR-SDK/include;../../ext/native;../../ext/snappy;../../ext/glslang;../../ext/zlib;../../ext/libpng17;../../ext/zstd/lib;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - NOMINMAX;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions) + _CRT_NO_POSIX_ERROR_CODES;NOMINMAX;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions) pch.h NotUsing stdcpp17 @@ -74,7 +74,7 @@ false pch.h ../..;../../ext/OpenXR-SDK/include;../../ext/native;../../ext/snappy;../../ext/glslang;../../ext/zlib;../../ext/libpng17;../../ext/zstd/lib;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - NOMINMAX;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + _CRT_NO_POSIX_ERROR_CODES;NOMINMAX;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) NotUsing stdcpp17 diff --git a/UWP/CoreUWP/CoreUWP.vcxproj b/UWP/CoreUWP/CoreUWP.vcxproj index 131d100d81..1306e0b5cf 100644 --- a/UWP/CoreUWP/CoreUWP.vcxproj +++ b/UWP/CoreUWP/CoreUWP.vcxproj @@ -59,7 +59,7 @@ false pch.h ../../ext/libchdr/include;../../ext/ffmpeg;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;ARMIPS_USE_STD_FILESYSTEM;%(ClCompile.PreprocessorDefinitions) + _CRT_NO_POSIX_ERROR_CODES;USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;ARMIPS_USE_STD_FILESYSTEM;%(ClCompile.PreprocessorDefinitions) stdcpp17 @@ -75,7 +75,7 @@ false pch.h ../../ext/libchdr/include;../../ext/ffmpeg;../..;../../ext/native;../../ext/snappy;../../ext/libpng17;../../Common;../../ext/zlib;../../ext/zstd/lib;../../ext;../../ext/armips/;../../ext/armips/ext/filesystem/include/;../../ext/armips/ext/tinyformat/;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_UNICODE;UNICODE;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) + _CRT_NO_POSIX_ERROR_CODES;USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_UNICODE;UNICODE;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions) stdcpp17 diff --git a/UWP/UI_UWP/UI_UWP.vcxproj b/UWP/UI_UWP/UI_UWP.vcxproj index 785678b3c3..c1bfdc6177 100644 --- a/UWP/UI_UWP/UI_UWP.vcxproj +++ b/UWP/UI_UWP/UI_UWP.vcxproj @@ -57,7 +57,7 @@ Use false false - NOMINMAX;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions) + _CRT_NO_POSIX_ERROR_CODES;NOMINMAX;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions) ../..;../../ext/native;../../Common;../../ext;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) pch.h stdcpp17 @@ -73,7 +73,7 @@ Use false false - NOMINMAX;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) + _CRT_NO_POSIX_ERROR_CODES;NOMINMAX;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions) ../..;../../ext/native;../../Common;../../ext;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) pch.h stdcpp17 diff --git a/unittest/TestTextureReplacer.cpp b/unittest/TestTextureReplacer.cpp index 15c454c97e..e252c8629e 100644 --- a/unittest/TestTextureReplacer.cpp +++ b/unittest/TestTextureReplacer.cpp @@ -250,9 +250,9 @@ static bool CreateIndexedPNG(const Path &filename, int w, int h, bool palette, c const size_t len = std::min(raw.size() - pos, 65535); const bool last = pos + len >= raw.size(); zlib.push_back(last ? 1 : 0); - zlib.push_back(len & 0xFF); - zlib.push_back(len >> 8); - zlib.push_back(~len & 0xFF); + zlib.push_back((uint8_t)(len & 0xFF)); + zlib.push_back((uint8_t)(len >> 8)); + zlib.push_back((uint8_t)(~len & 0xFF)); zlib.push_back((~len >> 8) & 0xFF); zlib.insert(zlib.end(), raw.begin() + pos, raw.begin() + pos + len); pos += len;