fix a few compiler warnings (#1419)

This commit is contained in:
water111 2022-06-05 15:00:35 -04:00 committed by GitHub
parent d7b307144c
commit 0e91709063
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 30 additions and 21 deletions

View File

@ -87,7 +87,7 @@ void DMA_SendToEE(void* data, u32 size, void* dest) {
* SPU DMA interrupt handler.
*/
s32 intr(s32 channel, void* userdata) {
s32 intr(s32 /*channel*/, void* /*userdata*/) {
strobe = 1;
return 0;
}
@ -101,7 +101,7 @@ bool DMA_SendToSPUAndSync(void* src_addr, u32 size, u32 dst_addr) {
// Skip this, we end up memcpy's from OOB (which trips asan)
// u32 size_aligned = (size + 63) & 0xFFFFFFF0;
u32 size_aligned = size;
s32 transferred = sceSdVoiceTrans(channel, 0, src_addr, dst_addr, size_aligned);
u32 transferred = sceSdVoiceTrans(channel, 0, src_addr, dst_addr, size_aligned);
while (!strobe)
;
sceSdSetTransIntrHandler(channel, nullptr, nullptr);

View File

@ -273,7 +273,7 @@ u32 GetISOFileLength(FileRecord* f) {
*/
VagDirEntry* FindVAGFile(const char* name) {
VagDirEntry* entry = gVagDir.vag;
for (s32 idx = 0; idx < gVagDir.count; idx++) {
for (u32 idx = 0; idx < gVagDir.count; idx++) {
// check if matching name
if (memcmp(entry->name, name, 8) == 0) {
return entry;
@ -1104,13 +1104,13 @@ static s32 CheckVAGStreamProgress(VagCommand* vag) {
}
if (vag->end_point != -1) {
if ((gPlayPos & 0xFFFFFFF0) == vag->end_point) {
if ((s32)(gPlayPos & 0xFFFFFFF0) == vag->end_point) {
return 0;
}
if (((gPlayPos < 0x6000) && (vag->end_point < 0x6000)) ||
((0x5fff < gPlayPos && (0x5fff < vag->end_point)))) {
if ((vag->unk2 == 0) && (gPlayPos < vag->end_point)) {
if ((vag->unk2 == 0) && (gPlayPos < (u32)vag->end_point)) {
sceSdSetAddr(gVoice | SD_VA_LSAX, gStreamSRAM + vag->end_point);
vag->unk2 = 1;
}
@ -1223,7 +1223,7 @@ static void UpdatePlayPos() {
}
u32 pos = GetPlayPos();
if (pos == -1) {
if (pos == 0xffffffff) {
if (gLastVagHalf) {
pos = 0xC000;
} else {

View File

@ -98,7 +98,7 @@ void LoadMusic(const char* music_name, s32* bank) {
SendMbx(iso_mbx, &cmd);
SleepThread();
for (int i = 0; i < gMusicTweakInfo.TweakCount; i++) {
for (u32 i = 0; i < gMusicTweakInfo.TweakCount; i++) {
if (!strcmp(gMusicTweakInfo.MusicTweak[i].MusicName, music_name)) {
gMusicTweak = gMusicTweakInfo.MusicTweak[i].VolumeAdjust;
return;

View File

@ -60,7 +60,7 @@ s32 LookupSoundIndex(const char* name, SoundBank** bank_out) {
break;
}
for (int i = 0; i < bank->sound_count; i++) {
for (int i = 0; i < (int)bank->sound_count; i++) {
if (memcmp(bank->sound[i].name, name, 16) == 0) {
*bank_out = bank;
return i;

View File

@ -15,7 +15,7 @@ void ReadBankSoundInfo(SoundBank* bank, SoundBank* unk, s32 unk2) {
void PrintBankInfo(SoundBank* bank) {
printf("Bank %s\n\n", bank->name);
for (int i = 0; i < bank->sound_count; i++) {
for (u32 i = 0; i < bank->sound_count; i++) {
printf("%d : %16s : min %d max %d curve %d\n", i, bank->sound[i].name,
bank->sound[i].fallof_params & 0x3fff, (bank->sound[i].fallof_params >> 14) & 0x3fff,
bank->sound[i].fallof_params >> 28);

View File

@ -204,7 +204,7 @@ void* RPC_Player(unsigned int /*fno*/, void* data, int size) {
Sound* sound = LookupSound(cmd->sound_id.sound_id);
if (sound != nullptr) {
snd_PauseSound(sound->sound_handle);
} else if (cmd->sound_id.sound_id == gVAG_Id) {
} else if (cmd->sound_id.sound_id == (u32)gVAG_Id) {
PauseVAGStream();
}
} break;
@ -212,7 +212,7 @@ void* RPC_Player(unsigned int /*fno*/, void* data, int size) {
Sound* sound = LookupSound(cmd->sound_id.sound_id);
if (sound != nullptr) {
snd_StopSound(sound->sound_handle);
} else if (cmd->sound_id.sound_id == gVAG_Id) {
} else if (cmd->sound_id.sound_id == (u32)gVAG_Id) {
StopVAGStream(nullptr, 0);
}
} break;
@ -220,7 +220,7 @@ void* RPC_Player(unsigned int /*fno*/, void* data, int size) {
Sound* sound = LookupSound(cmd->sound_id.sound_id);
if (sound != nullptr) {
snd_ContinueSound(sound->sound_handle);
} else if (cmd->sound_id.sound_id == gVAG_Id) {
} else if (cmd->sound_id.sound_id == (u32)gVAG_Id) {
UnpauseVAGStream();
}
} break;
@ -261,7 +261,7 @@ void* RPC_Player(unsigned int /*fno*/, void* data, int size) {
}
}
} else if (cmd->sound_id.sound_id == gVAG_Id) {
} else if (cmd->sound_id.sound_id == (u32)gVAG_Id) {
SetVAGStreamVolume(cmd->param.parms.volume);
}
} break;
@ -486,7 +486,7 @@ s32 VBlank_Handler() {
sceSifDmaData dma;
dma.data = &info;
dma.addr = (void*)gInfoEE;
dma.addr = (void*)(uintptr_t)gInfoEE;
dma.size = 0x110;
dma.mode = 0;
dmaid = sceSifSetDma(&dma, 1);

View File

@ -266,11 +266,11 @@ s32 CalculateFallofVolume(Vec3w* pos, s32 volume, s32 fo_curve, s32 fo_min, s32
distance = 0;
}
if (distance <= min) {
if (distance <= (u32)min) {
return volume;
}
if (distance >= max) {
if (distance >= (u32)max) {
return 0;
}
@ -492,4 +492,4 @@ void SetMusicVol() {
static void* SndMemAlloc() {
return nullptr;
}
static void SndMemFree(void* ptr) {}
static void SndMemFree(void* /*ptr*/) {}

View File

@ -91,7 +91,7 @@ u32 loader::read_bank(std::fstream& in) {
attr.where[chunk::bank].size += 4;
}
auto pos = in.tellg();
// auto pos = in.tellg();
auto bank_buf = std::make_unique<u8[]>(attr.where[chunk::bank].size);
in.seekg(origin + attr.where[chunk::bank].offset, std::fstream::beg);
in.read((char*)bank_buf.get(), attr.where[chunk::bank].size);

View File

@ -20,6 +20,6 @@ class sound_handler {
virtual void stop() = 0;
virtual void set_vol_pan(s32 vol, s32 pan) = 0;
virtual void set_pmod(s32 mod) = 0;
virtual void set_register(u8 reg, u8 value) {}
virtual void set_register(u8 /*reg*/, u8 /*value*/) {}
};
} // namespace snd

View File

@ -27,3 +27,12 @@ else()
target_link_libraries(sndplay PRIVATE sound cubeb stdc++fs)
endif()
if (NOT WIN32)
target_compile_options(sound
PRIVATE
-Wno-unknown-warning-option
-Wno-unused-private-field
-Wno-unused-parameter
-Wno-shadow
)
endif()

View File

@ -68,8 +68,8 @@ endif()
set(CMAKE_CXX_WARNING_LEVEL 4)
if(NOT MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -fno-exceptions -fno-rtti")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -Wno-string-compare -Wno-implicit-int-float-conversion -fno-exceptions -fno-rtti")
else()
string(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable RTTI
string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable Exceptions