Merge pull request #22865 from hrydgard/fix-windows-warnings

Windows: Fix a batch of MSVC warnings from CI
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2026-10-31 12:41:17 +01:00
commit 92e0c07a6f
19 files changed
+34 -32

No files matched your search

+2
View File
@@ -13,7 +13,9 @@
*/
#ifdef _WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h>
#endif
+2
View File
@@ -9,7 +9,9 @@
#include <unistd.h>
#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"
+1 -1
View File
@@ -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;
}
+2 -2
View File
@@ -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<PSPThread>(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();
-1
View File
@@ -2890,7 +2890,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;
}
+1 -1
View File
@@ -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;
+2 -2
View File
@@ -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);
+6 -6
View File
@@ -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) {
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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;
+2 -2
View File
@@ -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)));
+1 -1
View File
@@ -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)) {
+1 -1
View File
@@ -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();
+1 -2
View File
@@ -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:
+2 -2
View File
@@ -57,7 +57,7 @@
<CompileAsWinRT>false</CompileAsWinRT>
<SDLCheck>false</SDLCheck>
<AdditionalIncludeDirectories>../..;../../ext/OpenXR-SDK/include;../../ext/native;../../ext/snappy;../../ext/glslang;../../ext/zlib;../../ext/libpng17;../../ext/zstd/lib;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NOMINMAX;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_NO_POSIX_ERROR_CODES;NOMINMAX;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<LanguageStandard>stdcpp17</LanguageStandard>
@@ -74,7 +74,7 @@
<SDLCheck>false</SDLCheck>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>../..;../../ext/OpenXR-SDK/include;../../ext/native;../../ext/snappy;../../ext/glslang;../../ext/zlib;../../ext/libpng17;../../ext/zstd/lib;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NOMINMAX;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_NO_POSIX_ERROR_CODES;NOMINMAX;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
+2 -2
View File
@@ -59,7 +59,7 @@
<SDLCheck>false</SDLCheck>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>../../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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>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)</PreprocessorDefinitions>
<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)</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
@@ -75,7 +75,7 @@
<SDLCheck>false</SDLCheck>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<AdditionalIncludeDirectories>../../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)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>USE_FFMPEG;WITH_UPNP;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;NOMINMAX;_UNICODE;UNICODE;ARMIPS_USE_STD_FILESYSTEM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<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)</PreprocessorDefinitions>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
+2 -2
View File
@@ -57,7 +57,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>false</CompileAsWinRT>
<SDLCheck>false</SDLCheck>
<PreprocessorDefinitions>NOMINMAX;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_NO_POSIX_ERROR_CODES;NOMINMAX;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../..;../../ext/native;../../Common;../../ext;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<LanguageStandard>stdcpp17</LanguageStandard>
@@ -73,7 +73,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<CompileAsWinRT>false</CompileAsWinRT>
<SDLCheck>false</SDLCheck>
<PreprocessorDefinitions>NOMINMAX;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CRT_NO_POSIX_ERROR_CODES;NOMINMAX;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../..;../../ext/native;../../Common;../../ext;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<LanguageStandard>stdcpp17</LanguageStandard>
+3 -3
View File
@@ -250,9 +250,9 @@ static bool CreateIndexedPNG(const Path &filename, int w, int h, bool palette, c
const size_t len = std::min<size_t>(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;