diff --git a/Core/HW/MediaEngine.cpp b/Core/HW/MediaEngine.cpp index 0fe8a7062f..2e598f0ac3 100644 --- a/Core/HW/MediaEngine.cpp +++ b/Core/HW/MediaEngine.cpp @@ -23,7 +23,7 @@ static const int modeBpp[4] = { 2, 2, 2, 4 }; void MediaEngine::writeVideoImage(u32 bufferPtr, int frameWidth, int videoPixelMode) { - if (videoPixelMode > (int)(sizeof(modeBpp) / sizeof(modeBpp[0])) || videoPixelMode < 0) + if (videoPixelMode >= (int)(sizeof(modeBpp) / sizeof(modeBpp[0])) || videoPixelMode < 0) { ERROR_LOG(ME, "Unexpected videoPixelMode %d, using 0 instead.", videoPixelMode); videoPixelMode = 0; diff --git a/Core/HW/SasAudio.cpp b/Core/HW/SasAudio.cpp index 5cf90ba173..84806d52db 100644 --- a/Core/HW/SasAudio.cpp +++ b/Core/HW/SasAudio.cpp @@ -47,7 +47,7 @@ void VagDecoder::DecodeBlock(u8 *&readp) { int predict_nr = *readp++; int shift_factor = predict_nr & 0xf; predict_nr >>= 4; - if (predict_nr >= sizeof(f) / sizeof(s8)) { + if (predict_nr >= sizeof(f) / sizeof(f[0])) { predict_nr = 0; } int flags = *readp++; @@ -311,7 +311,7 @@ void SasInstance::Mix(u32 outAddr, u32 inAddr, int leftVol, int rightVol) { break; case VOICETYPE_PCM: { - int size = std::min(voice.pcmSize, (int)(numSamples * sizeof(s16))); + u32 size = std::min(voice.pcmSize, (int)(numSamples * sizeof(s16))); Memory::Memcpy(resampleBuffer + 2, voice.pcmAddr, size); if (numSamples * sizeof(s16) > size) memset(resampleBuffer + 2 + voice.pcmSize, 0, numSamples * sizeof(s16) - size);