diff --git a/Utilities/BitField.h b/Utilities/BitField.h index 0be25610f5..754982c350 100644 --- a/Utilities/BitField.h +++ b/Utilities/BitField.h @@ -11,7 +11,7 @@ struct bf_base // Datatype bitsize static constexpr uint bitmax = sizeof(T) * 8; static_assert(N - 1 < bitmax, "bf_base<> error: N out of bounds"); - + // Field bitsize static constexpr uint bitsize = N; @@ -96,7 +96,7 @@ struct bf_t : bf_base // Optimized bool conversion (must be removed if inappropriate) explicit constexpr operator bool() const { - return unshifted() != 0; + return unshifted() != 0u; } // Store bitfield value diff --git a/rpcs3/Crypto/unpkg.cpp b/rpcs3/Crypto/unpkg.cpp index 3dfdf570f0..00c04d7ec1 100644 --- a/rpcs3/Crypto/unpkg.cpp +++ b/rpcs3/Crypto/unpkg.cpp @@ -293,7 +293,7 @@ bool pkg_install(const std::string& path, atomic_t& sync) const uchar psp2t3[] = {0xAF, 0x07, 0xFD, 0x59, 0x65, 0x25, 0x27, 0xBA, 0xF1, 0x33, 0x89, 0x66, 0x8B, 0x17, 0xD9, 0xEA}; aes_context ctx; - aes_setkey_enc(&ctx, content_type == 0x15 ? psp2t1 : content_type == 0x16 ? psp2t2 : psp2t3, 128); + aes_setkey_enc(&ctx, content_type == 0x15u ? psp2t1 : content_type == 0x16u ? psp2t2 : psp2t3, 128); aes_crypt_ecb(&ctx, AES_ENCRYPT, reinterpret_cast(&header.klicensee), dec_key.data()); decrypt(0, header.file_count * sizeof(PKGEntry), dec_key.data()); } @@ -311,7 +311,7 @@ bool pkg_install(const std::string& path, atomic_t& sync) for (const auto& entry : entries) { - const bool is_psp = (entry.type & PKG_FILE_ENTRY_PSP) != 0; + const bool is_psp = (entry.type & PKG_FILE_ENTRY_PSP) != 0u; if (entry.name_size > 256) { @@ -345,7 +345,7 @@ bool pkg_install(const std::string& path, atomic_t& sync) const bool did_overwrite = fs::is_file(path); - if (did_overwrite && (entry.type & PKG_FILE_ENTRY_OVERWRITE) == 0) + if (did_overwrite && !(entry.type & PKG_FILE_ENTRY_OVERWRITE)) { pkg_log.notice("Didn't overwrite %s", name); break; diff --git a/rpcs3/Emu/Cell/Modules/cellFont.cpp b/rpcs3/Emu/Cell/Modules/cellFont.cpp index ab5887ccac..e758ca894e 100644 --- a/rpcs3/Emu/Cell/Modules/cellFont.cpp +++ b/rpcs3/Emu/Cell/Modules/cellFont.cpp @@ -18,7 +18,7 @@ s32 cellFontInitializeWithRevision(u64 revisionFlags, vm::ptr co return CELL_FONT_ERROR_INVALID_PARAMETER; } - if (config->flags != 0) + if (config->flags != 0u) { cellFont.error("cellFontInitializeWithRevision: Unknown flags (0x%x)", config->flags); } @@ -545,7 +545,7 @@ s32 cellFontExtend(u32 a1, u32 a2, u32 a3) { //Something happens } - if (vm::read32(a3) == 0) + if (vm::read32(a3) == 0u) { //Something happens } diff --git a/rpcs3/Emu/Cell/Modules/cellGame.cpp b/rpcs3/Emu/Cell/Modules/cellGame.cpp index 8b3fbdd495..29576b03ca 100644 --- a/rpcs3/Emu/Cell/Modules/cellGame.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGame.cpp @@ -220,7 +220,7 @@ error_code cellHddGameCheck(ppu_thread& ppu, u32 version, vm::cptr dirName funcStat(ppu, result, get, set); - if (result->result != CELL_HDDGAME_CBRESULT_OK && result->result != CELL_HDDGAME_CBRESULT_OK_CANCEL) + if (result->result != u32{CELL_HDDGAME_CBRESULT_OK} && result->result != u32{CELL_HDDGAME_CBRESULT_OK_CANCEL}) { return CELL_HDDGAME_ERROR_CBRESULT; } @@ -364,7 +364,7 @@ error_code cellGameBootCheck(vm::ptr type, vm::ptr attributes, vm::ptr size->sysSizeKB = 4; } - if (*type == CELL_GAME_GAMETYPE_HDD && dirName) + if (*type == u32{CELL_GAME_GAMETYPE_HDD} && dirName) { strcpy_trunc(*dirName, Emu.GetTitleID()); } diff --git a/rpcs3/Emu/Cell/Modules/cellGem.cpp b/rpcs3/Emu/Cell/Modules/cellGem.cpp index 3f49cdfc2f..148a6d54c0 100644 --- a/rpcs3/Emu/Cell/Modules/cellGem.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGem.cpp @@ -1221,11 +1221,11 @@ error_code cellGemTrackHues(vm::cptr req_hues, vm::ptr res_hues) for (u32 i = 0; i < CELL_GEM_MAX_NUM; i++) { - if (req_hues[i] == CELL_GEM_DONT_CARE_HUE) + if (req_hues[i] == u32{CELL_GEM_DONT_CARE_HUE}) { } - else if (req_hues[i] == CELL_GEM_DONT_TRACK_HUE) + else if (req_hues[i] == u32{CELL_GEM_DONT_TRACK_HUE}) { gem->controllers[i].enabled_tracking = false; gem->controllers[i].enabled_LED = false; diff --git a/rpcs3/Emu/Cell/Modules/cellGifDec.cpp b/rpcs3/Emu/Cell/Modules/cellGifDec.cpp index 0d896d7097..cddc536236 100644 --- a/rpcs3/Emu/Cell/Modules/cellGifDec.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGifDec.cpp @@ -105,8 +105,8 @@ s32 cellGifDecReadHeader(PMainHandle mainHandle, PSubHandle subHandle, PInfo inf } } - if (*reinterpret_cast*>(buffer) != 0x47494638 || - (*reinterpret_cast*>(buffer + 4) != 0x6139 && *reinterpret_cast*>(buffer + 4) != 0x6137)) // Error: The first 6 bytes are not a valid GIF signature + if (*reinterpret_cast*>(buffer) != 0x47494638u || + (*reinterpret_cast*>(buffer + 4) != 0x6139u && *reinterpret_cast*>(buffer + 4) != 0x6137u)) // Error: The first 6 bytes are not a valid GIF signature { return CELL_GIFDEC_ERROR_STREAM_FORMAT; // Surprisingly there is no error code related with headerss } diff --git a/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp b/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp index 60ef2428e8..e1442d8745 100644 --- a/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp +++ b/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp @@ -239,7 +239,7 @@ error_code cellNetCtlNetStartDialogLoadAsync(vm::cptrsize != 12) + if (param->size != 12u) { return CELL_NET_CTL_ERROR_INVALID_SIZE; } @@ -278,7 +278,7 @@ error_code cellNetCtlNetStartDialogUnloadAsync(vm::ptrsize != 8) + if (result->size != 8u) { return CELL_NET_CTL_ERROR_INVALID_SIZE; } @@ -312,7 +312,7 @@ error_code cellNetCtlGetNatInfo(vm::ptr natInfo) return CELL_NET_CTL_ERROR_INVALID_ADDR; } - if (natInfo->size != 16 && natInfo->size != 20) + if (natInfo->size != 16u && natInfo->size != 20u) { return CELL_NET_CTL_ERROR_INVALID_SIZE; } diff --git a/rpcs3/Emu/Cell/Modules/cellPngDec.cpp b/rpcs3/Emu/Cell/Modules/cellPngDec.cpp index 9af0855e76..d3b899e4eb 100644 --- a/rpcs3/Emu/Cell/Modules/cellPngDec.cpp +++ b/rpcs3/Emu/Cell/Modules/cellPngDec.cpp @@ -477,7 +477,7 @@ s32 pngDecOpen(ppu_thread& ppu, PHandle handle, PPStream png_stream, PSrc source // Set the custom read function for decoding if (control_stream) { - if (open_param && open_param->selectChunk != 0) + if (open_param && open_param->selectChunk != 0u) fmt::throw_exception("Partial Decoding with selectChunk not supported yet."); stream->cbCtrlStream.cbCtrlStrmArg = control_stream->cbCtrlStrmArg; @@ -559,14 +559,14 @@ s32 pngDecSetParameter(PStream stream, PInParam in_param, POutParam out_param, P png_set_keep_unknown_chunks(stream->png_ptr, PNG_HANDLE_CHUNK_IF_SAFE, 0, 0); // Scale 16 bit depth down to 8 bit depth. - if (stream->info.bitDepth == 16 && in_param->outputBitDepth == 8) + if (stream->info.bitDepth == 16u && in_param->outputBitDepth == 8u) { // PS3 uses png_set_strip_16, since png_set_scale_16 wasn't available back then. png_set_strip_16(stream->png_ptr); } // This shouldnt ever happen, but not sure what to do if it does, just want it logged for now - if (stream->info.bitDepth != 16 && in_param->outputBitDepth == 16) + if (stream->info.bitDepth != 16u && in_param->outputBitDepth == 16u) cellPngDec.error("Output depth of 16 with non input depth of 16 specified!"); if (in_param->commandPtr) cellPngDec.warning("Ignoring CommandPtr."); @@ -876,7 +876,7 @@ s32 cellPngDecExtReadHeader(PHandle handle, PStream stream, PInfo info, PExtInfo // png doesnt allow empty image, so quick check for 0 verifys if we got the header // not sure exactly what should happen if we dont have header, ask for more data with callback? - if (stream->info.imageWidth == 0) + if (stream->info.imageWidth == 0u) { fmt::throw_exception("Invalid or not enough data sent to get header"); return CELL_PNGDEC_ERROR_HEADER; diff --git a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp index 666a4184a6..4ac31df20f 100644 --- a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp @@ -467,7 +467,7 @@ static s32 savedata_check_args(u32 operation, u32 version, vm::cptr dirNam if (operation == SAVEDATA_OP_FIXED_DELETE) { - if (setBuf->fileListMax != 0) + if (setBuf->fileListMax != 0u) { // ****** sysutil savedata parameter error : 9 ****** return 9; diff --git a/rpcs3/Emu/Cell/Modules/cellSpurs.cpp b/rpcs3/Emu/Cell/Modules/cellSpurs.cpp index ea3ea98362..6eae188178 100644 --- a/rpcs3/Emu/Cell/Modules/cellSpurs.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSpurs.cpp @@ -472,7 +472,7 @@ s32 _spurs::detach_lv2_eq(vm::ptr spurs, u8 spuPort, bool spursCreate if (_spurs::get_sdk_version() >= 0x180000) { - if ((spurs->spuPortBits.load() & mask) == 0) + if ((spurs->spuPortBits.load() & mask) == 0u) { return CELL_SPURS_CORE_ERROR_SRCH; } @@ -499,7 +499,7 @@ void _spurs::handler_wait_ready(ppu_thread& ppu, vm::ptr spurs) // Find a runnable workload spurs->handlerDirty = 0; - if (spurs->exception == 0) + if (spurs->exception == 0u) { bool foundRunnableWorkload = false; for (u32 i = 0; i < 16; i++) @@ -510,7 +510,7 @@ void _spurs::handler_wait_ready(ppu_thread& ppu, vm::ptr spurs) { if (spurs->wklReadyCount1[i] || spurs->wklSignal1.load() & (0x8000u >> i) || - (spurs->wklFlag.flag.load() == 0 && + (spurs->wklFlag.flag.load() == 0u && spurs->wklFlagReceiver == static_cast(i))) { foundRunnableWorkload = true; @@ -529,7 +529,7 @@ void _spurs::handler_wait_ready(ppu_thread& ppu, vm::ptr spurs) { if (spurs->wklIdleSpuCountOrReadyCount2[i] || spurs->wklSignal2.load() & (0x8000u >> i) || - (spurs->wklFlag.flag.load() == 0 && + (spurs->wklFlag.flag.load() == 0u && spurs->wklFlagReceiver == static_cast(i) + 0x10)) { foundRunnableWorkload = true; @@ -646,7 +646,7 @@ s32 _spurs::wakeup_shutdown_completion_waiter(ppu_thread& ppu, vm::ptrwklEnabled.load() & (0x80000000u >> wid)) == 0) + if ((spurs->wklEnabled.load() & (0x80000000u >> wid)) == 0u) { return CELL_SPURS_POLICY_MODULE_ERROR_SRCH; } @@ -674,7 +674,7 @@ s32 _spurs::wakeup_shutdown_completion_waiter(ppu_thread& ppu, vm::ptrhook || wklEvent->load() & 0x10) { - verify(HERE), (wklF->x28 == 2); + verify(HERE), (wklF->x28 == 2u); rc = sys_semaphore_post(ppu, static_cast(wklF->sem), 1); } @@ -1607,7 +1607,7 @@ s32 cellSpursSetMaxContention(vm::ptr spurs, u32 wid, u32 maxContenti return CELL_SPURS_CORE_ERROR_INVAL; } - if ((spurs->wklEnabled.load() & (0x80000000u >> wid)) == 0) + if ((spurs->wklEnabled.load() & (0x80000000u >> wid)) == 0u) { return CELL_SPURS_CORE_ERROR_SRCH; } @@ -1651,7 +1651,7 @@ s32 cellSpursSetPriorities(vm::ptr spurs, u32 wid, vm::cptr pr return CELL_SPURS_CORE_ERROR_INVAL; } - if ((spurs->wklEnabled.load() & (0x80000000u >> wid)) == 0) + if ((spurs->wklEnabled.load() & (0x80000000u >> wid)) == 0u) { return CELL_SPURS_CORE_ERROR_SRCH; } @@ -1730,14 +1730,14 @@ s32 cellSpursEnableExceptionEventHandler(ppu_thread& ppu, vm::ptr spu auto oldEnableEH = spurs->enableEH.exchange(flag ? 1u : 0u); if (flag) { - if (oldEnableEH == 0) + if (oldEnableEH == 0u) { rc = sys_spu_thread_group_connect_event(ppu, spurs->spuTG, spurs->eventQueue, SYS_SPU_THREAD_GROUP_EVENT_EXCEPTION); } } else { - if (oldEnableEH == 1) + if (oldEnableEH == 1u) { rc = sys_spu_thread_group_disconnect_event(ppu, spurs->eventQueue, SYS_SPU_THREAD_GROUP_EVENT_EXCEPTION); } @@ -2290,7 +2290,7 @@ s32 cellSpursAddWorkloadWithAttribute(vm::ptr spurs, vm::ptr wid return CELL_SPURS_POLICY_MODULE_ERROR_ALIGN; } - if (attr->revision != 1) + if (attr->revision != 1u) { return CELL_SPURS_POLICY_MODULE_ERROR_INVAL; } @@ -2440,7 +2440,7 @@ s32 cellSpursReadyCountStore(vm::ptr spurs, u32 wid, u32 value) return CELL_SPURS_POLICY_MODULE_ERROR_INVAL; } - if ((spurs->wklEnabled.load() & (0x80000000u >> wid)) == 0) + if ((spurs->wklEnabled.load() & (0x80000000u >> wid)) == 0u) { return CELL_SPURS_POLICY_MODULE_ERROR_SRCH; } @@ -2503,7 +2503,7 @@ s32 cellSpursGetWorkloadData(vm::ptr spurs, vm::ptr data, u32 wi return CELL_SPURS_POLICY_MODULE_ERROR_INVAL; } - if ((spurs->wklEnabled.load() & (0x80000000u >> wid)) == 0) + if ((spurs->wklEnabled.load() & (0x80000000u >> wid)) == 0u) { return CELL_SPURS_POLICY_MODULE_ERROR_SRCH; } @@ -2566,7 +2566,7 @@ s32 _cellSpursWorkloadFlagReceiver(vm::ptr spurs, u32 wid, u32 is_set return CELL_SPURS_POLICY_MODULE_ERROR_INVAL; } - if ((spurs->wklEnabled.load() & (0x80000000u >> wid)) == 0) + if ((spurs->wklEnabled.load() & (0x80000000u >> wid)) == 0u) { return CELL_SPURS_POLICY_MODULE_ERROR_SRCH; } diff --git a/rpcs3/Emu/Cell/Modules/cellSpursSpu.cpp b/rpcs3/Emu/Cell/Modules/cellSpursSpu.cpp index aeaad1c570..717b1f5c70 100644 --- a/rpcs3/Emu/Cell/Modules/cellSpursSpu.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSpursSpu.cpp @@ -300,7 +300,7 @@ bool spursKernel1SelectWorkload(spu_thread& spu) { u16 runnable = ctxt->wklRunnable1 & (0x8000 >> i); u16 wklSignal = spurs->wklSignal1.load() & (0x8000 >> i); - u8 wklFlag = spurs->wklFlag.flag.load() == 0 ? spurs->wklFlagReceiver == i ? 1 : 0 : 0; + u8 wklFlag = spurs->wklFlag.flag.load() == 0u ? spurs->wklFlagReceiver == i ? 1 : 0 : 0; u8 readyCount = spurs->wklReadyCount1[i] > CELL_SPURS_MAX_SPU ? CELL_SPURS_MAX_SPU : spurs->wklReadyCount1[i].load(); u8 idleSpuCount = spurs->wklIdleSpuCountOrReadyCount2[i] > CELL_SPURS_MAX_SPU ? CELL_SPURS_MAX_SPU : spurs->wklIdleSpuCountOrReadyCount2[i].load(); u8 requestCount = readyCount + idleSpuCount; @@ -490,7 +490,7 @@ bool spursKernel2SelectWorkload(spu_thread& spu) u8 priority = i < CELL_SPURS_MAX_WORKLOAD ? ctxt->priority[j] & 0x0F : ctxt->priority[j] >> 4; u8 maxContention = i < CELL_SPURS_MAX_WORKLOAD ? spurs->wklMaxContention[j] & 0x0F : spurs->wklMaxContention[j] >> 4; u16 wklSignal = i < CELL_SPURS_MAX_WORKLOAD ? spurs->wklSignal1.load() & (0x8000 >> j) : spurs->wklSignal2.load() & (0x8000 >> j); - u8 wklFlag = spurs->wklFlag.flag.load() == 0 ? spurs->wklFlagReceiver == i ? 1 : 0 : 0; + u8 wklFlag = spurs->wklFlag.flag.load() == 0u ? spurs->wklFlagReceiver == i ? 1 : 0 : 0; u8 readyCount = i < CELL_SPURS_MAX_WORKLOAD ? spurs->wklReadyCount1[j] : spurs->wklIdleSpuCountOrReadyCount2[j]; // For a workload to be considered for scheduling: @@ -792,7 +792,7 @@ void spursSysServiceIdleHandler(spu_thread& spu, SpursKernelContext* ctxt) u8 maxContention = i < CELL_SPURS_MAX_WORKLOAD ? spurs->wklMaxContention[j] & 0x0F : spurs->wklMaxContention[j] >> 4; u8 contention = i < CELL_SPURS_MAX_WORKLOAD ? spurs->wklCurrentContention[j] & 0x0F : spurs->wklCurrentContention[j] >> 4; u16 wklSignal = i < CELL_SPURS_MAX_WORKLOAD ? spurs->wklSignal1.load() & (0x8000 >> j) : spurs->wklSignal2.load() & (0x8000 >> j); - u8 wklFlag = spurs->wklFlag.flag.load() == 0 ? spurs->wklFlagReceiver == i ? 1 : 0 : 0; + u8 wklFlag = spurs->wklFlag.flag.load() == 0u ? spurs->wklFlagReceiver == i ? 1 : 0 : 0; u8 readyCount = i < CELL_SPURS_MAX_WORKLOAD ? spurs->wklReadyCount1[j] : spurs->wklIdleSpuCountOrReadyCount2[j]; if (runnable && priority > 0 && maxContention > contention) @@ -811,7 +811,7 @@ void spursSysServiceIdleHandler(spu_thread& spu, SpursKernelContext* ctxt) { u16 runnable = ctxt->wklRunnable1 & (0x8000 >> i); u16 wklSignal = spurs->wklSignal1.load() & (0x8000 >> i); - u8 wklFlag = spurs->wklFlag.flag.load() == 0 ? spurs->wklFlagReceiver == i ? 1 : 0 : 0; + u8 wklFlag = spurs->wklFlag.flag.load() == 0u ? spurs->wklFlagReceiver == i ? 1 : 0 : 0; u8 readyCount = spurs->wklReadyCount1[i] > CELL_SPURS_MAX_SPU ? CELL_SPURS_MAX_SPU : spurs->wklReadyCount1[i].load(); u8 idleSpuCount = spurs->wklIdleSpuCountOrReadyCount2[i] > CELL_SPURS_MAX_SPU ? CELL_SPURS_MAX_SPU : spurs->wklIdleSpuCountOrReadyCount2[i].load(); u8 requestCount = readyCount + idleSpuCount; @@ -1201,7 +1201,7 @@ void spursSysServiceTraceUpdate(spu_thread& spu, SpursKernelContext* ctxt, u32 a //vm::reservation_acquire(vm::base(spu.offset + 0x80), ctxt->spurs.ptr(&CellSpurs::traceBuffer).addr(), 128); auto spurs = vm::_ptr(spu.offset + 0x80 - offset32(&CellSpurs::traceBuffer)); - if (ctxt->traceMsgCount != 0xFF || spurs->traceBuffer.addr() == 0) + if (ctxt->traceMsgCount != 0xffu || spurs->traceBuffer.addr() == 0u) { spursSysServiceTraceSaveCount(spu, ctxt); } @@ -1214,9 +1214,9 @@ void spursSysServiceTraceUpdate(spu_thread& spu, SpursKernelContext* ctxt, u32 a ctxt->traceBuffer = spurs->traceBuffer.addr() + (spurs->traceStartIndex[ctxt->spuNum] << 4); ctxt->traceMaxCount = spurs->traceStartIndex[1] - spurs->traceStartIndex[0]; - if (ctxt->traceBuffer == 0) + if (ctxt->traceBuffer == 0u) { - ctxt->traceMsgCount = 0; + ctxt->traceMsgCount = 0u; } } @@ -1665,7 +1665,7 @@ s32 spursTasketSaveTaskContext(spu_thread& spu) //spursDmaWaitForCompletion(spu, 0xFFFFFFFF); - if (taskInfo->context_save_storage_and_alloc_ls_blocks == 0) + if (taskInfo->context_save_storage_and_alloc_ls_blocks == 0u) { return CELL_SPURS_TASK_ERROR_STAT; } @@ -1867,15 +1867,15 @@ s32 spursTasksetProcessSyscall(spu_thread& spu, u32 syscallNum, u32 args) switch (syscallNum & 0x0F) { case CELL_SPURS_TASK_SYSCALL_EXIT: - if (ctxt->x2FD4 == 4 || (ctxt->x2FC0 & 0xFFFFFFFF) != 0) + if (ctxt->x2FD4 == 4u || (ctxt->x2FC0 & 0xffffffffu) != 0u) { // TODO: Figure this out - if (ctxt->x2FD4 != 4) + if (ctxt->x2FD4 != 4u) { spursTasksetProcessRequest(spu, SPURS_TASKSET_REQUEST_DESTROY_TASK, nullptr, nullptr); } - const u64 addr = ctxt->x2FD4 == 4 ? taskset->x78 : ctxt->x2FC0; - const u64 args = ctxt->x2FD4 == 4 ? 0 : ctxt->x2FC8.value(); + const u64 addr = ctxt->x2FD4 == 4u ? +taskset->x78 : +ctxt->x2FC0; + const u64 args = ctxt->x2FD4 == 4u ? 0 : +ctxt->x2FC8; spursTasksetOnTaskExit(spu, addr, ctxt->taskId, ctxt->taskExitCode, args); } @@ -2000,9 +2000,9 @@ s32 spursTasksetLoadElf(spu_thread& spu, u32* entryPoint, u32* lowestLoadAddr, u break; } - if (prog.p_type == 1 /* PT_LOAD */) + if (prog.p_type == 1u /* PT_LOAD */) { - if (skipWriteableSegments == false || (prog.p_flags & 2 /*PF_W*/ ) == 0) + if (skipWriteableSegments == false || (prog.p_flags & 2u /*PF_W*/ ) == 0u) { if (prog.p_vaddr < CELL_SPURS_TASK_TOP || prog.p_vaddr + prog.p_memsz > CELL_SPURS_TASK_BOTTOM) { @@ -2021,9 +2021,9 @@ s32 spursTasksetLoadElf(spu_thread& spu, u32* entryPoint, u32* lowestLoadAddr, u break; } - if (prog.p_type == 1) + if (prog.p_type == 1u) { - if (skipWriteableSegments == false || (prog.p_flags & 2) == 0) + if (skipWriteableSegments == false || (prog.p_flags & 2u) == 0u) { std::memcpy(vm::base(spu.offset + prog.p_vaddr), prog.bin.data(), prog.p_filesz); } diff --git a/rpcs3/Emu/Cell/Modules/cellSync2.cpp b/rpcs3/Emu/Cell/Modules/cellSync2.cpp index 2ec11535d2..27a7cf6268 100644 --- a/rpcs3/Emu/Cell/Modules/cellSync2.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSync2.cpp @@ -335,8 +335,8 @@ error_code cellSync2QueueEstimateBufferSize(vm::cptr at if (!attr || !bufferSize) return CELL_SYNC2_ERROR_NULL_POINTER; - if (attr->elementSize == 0 || attr->elementSize > 0x4000 || attr->elementSize % 16 || attr->depth == 0 || attr->depth > 0xFFFFFFFC || - attr->maxPushWaiters > 0x8000 || attr->maxPopWaiters > 0x8000) + if (attr->elementSize == 0u || attr->elementSize > 0x4000u || attr->elementSize % 16u || attr->depth == 0u || attr->depth > 0xFFFFFFFCu || + attr->maxPushWaiters > 0x8000u || attr->maxPopWaiters > 0x8000u) return CELL_SYNC2_ERROR_INVAL; return CELL_OK; @@ -349,8 +349,8 @@ error_code cellSync2QueueInitialize(vm::ptr queue, vm::ptr if (!queue || !buffer || !attr) return CELL_SYNC2_ERROR_NULL_POINTER; - if (attr->elementSize == 0 || attr->elementSize > 0x4000 || attr->elementSize % 16 || attr->depth == 0 || attr->depth > 0xFFFFFFFC || - attr->maxPushWaiters > 0x8000 || attr->maxPopWaiters > 0x8000) + if (attr->elementSize == 0u || attr->elementSize > 0x4000u || attr->elementSize % 16u || attr->depth == 0u || attr->depth > 0xFFFFFFFCu || + attr->maxPushWaiters > 0x8000u || attr->maxPopWaiters > 0x8000u) return CELL_SYNC2_ERROR_INVAL; return CELL_OK; diff --git a/rpcs3/Emu/Cell/Modules/cellVpost.cpp b/rpcs3/Emu/Cell/Modules/cellVpost.cpp index 89e5aa7a29..2ae5bdd5f6 100644 --- a/rpcs3/Emu/Cell/Modules/cellVpost.cpp +++ b/rpcs3/Emu/Cell/Modules/cellVpost.cpp @@ -82,7 +82,7 @@ s32 cellVpostExec(u32 handle, vm::cptr inPicBuff, vm::cptrinWidth; + u32 w = ctrlParam->inWidth; u32 h = ctrlParam->inHeight; u32 ow = ctrlParam->outWidth; u32 oh = ctrlParam->outHeight; @@ -137,9 +137,10 @@ s32 cellVpostExec(u32 handle, vm::cptr inPicBuff, vm::cptr(ow*4), 0, 0, 0 }; + int out_line[4] = { static_cast(ow * 4), 0, 0, 0 }; sws_scale(vpost->sws, in_data, in_line, 0, h, out_data, out_line); diff --git a/rpcs3/Emu/Cell/Modules/libmixer.cpp b/rpcs3/Emu/Cell/Modules/libmixer.cpp index 2735351ce1..7a34d0ddda 100644 --- a/rpcs3/Emu/Cell/Modules/libmixer.cpp +++ b/rpcs3/Emu/Cell/Modules/libmixer.cpp @@ -177,7 +177,7 @@ s32 cellSSPlayerCreate(vm::ptr handle, vm::ptr config) { libmixer.warning("cellSSPlayerCreate(handle=*0x%x, config=*0x%x)", handle, config); - if (config->outputMode != 0 || config->channels - 1 >= 2) + if (config->outputMode != 0u || config->channels - 1u >= 2u) { libmixer.error("cellSSPlayerCreate(config.outputMode=%d, config.channels=%d): invalid parameters", config->outputMode, config->channels); return CELL_LIBMIXER_ERROR_INVALID_PARAMATER; diff --git a/rpcs3/Emu/Cell/Modules/sys_lwmutex_.cpp b/rpcs3/Emu/Cell/Modules/sys_lwmutex_.cpp index 8999616c5f..914b421862 100644 --- a/rpcs3/Emu/Cell/Modules/sys_lwmutex_.cpp +++ b/rpcs3/Emu/Cell/Modules/sys_lwmutex_.cpp @@ -113,13 +113,13 @@ error_code sys_lwmutex_lock(ppu_thread& ppu, vm::ptr lwmutex, u64 { // recursive locking - if ((lwmutex->attribute & SYS_SYNC_RECURSIVE) == 0) + if ((lwmutex->attribute & SYS_SYNC_RECURSIVE) == 0u) { // if not recursive return CELL_EDEADLK; } - if (lwmutex->recursive_count == -1) + if (lwmutex->recursive_count == umax) { // if recursion limit reached return CELL_EKRESOURCE; @@ -273,13 +273,13 @@ error_code sys_lwmutex_trylock(ppu_thread& ppu, vm::ptr lwmutex) { // recursive locking - if ((lwmutex->attribute & SYS_SYNC_RECURSIVE) == 0) + if ((lwmutex->attribute & SYS_SYNC_RECURSIVE) == 0u) { // if not recursive return CELL_EDEADLK; } - if (lwmutex->recursive_count == -1) + if (lwmutex->recursive_count == umax) { // if recursion limit reached return CELL_EKRESOURCE; diff --git a/rpcs3/Emu/Cell/Modules/sys_prx_.cpp b/rpcs3/Emu/Cell/Modules/sys_prx_.cpp index 924cea1332..af19e952f1 100644 --- a/rpcs3/Emu/Cell/Modules/sys_prx_.cpp +++ b/rpcs3/Emu/Cell/Modules/sys_prx_.cpp @@ -18,13 +18,13 @@ static auto convert_path_list(vm::cpptr path_list, s32 count) // Execute start or stop module function static void entryx(ppu_thread& ppu, vm::ptr opt, u32 args, vm::ptr argp, vm::ptr res) { - if (opt->entry2.addr() != -1) + if (opt->entry2.addr() != umax) { *res = opt->entry2(ppu, opt->entry, args, argp); return; } - if (opt->entry.addr() != -1) + if (opt->entry.addr() != umax) { *res = opt->entry(ppu, args, argp); return; diff --git a/rpcs3/Emu/Cell/Modules/sys_spu_.cpp b/rpcs3/Emu/Cell/Modules/sys_spu_.cpp index 3595c8ad10..18e6c317af 100644 --- a/rpcs3/Emu/Cell/Modules/sys_spu_.cpp +++ b/rpcs3/Emu/Cell/Modules/sys_spu_.cpp @@ -139,9 +139,9 @@ struct spu_elf_info // Check SCE header if found std::memcpy(&sce0, src.get_ptr(), sizeof(sce0)); - if (sce0.se_magic == 0x53434500 /* SCE\0 */) + if (sce0.se_magic == 0x53434500u /* SCE\0 */) { - if (sce0.se_hver != 2 || sce0.se_type != 1 || sce0.se_meta == 0) + if (sce0.se_hver != 2u || sce0.se_type != 1u || sce0.se_meta == 0u) { return CELL_ENOEXEC; } @@ -150,7 +150,7 @@ struct spu_elf_info ehdr_off = static_cast(+self.se_elfoff); phdr_off = static_cast(+self.se_phdroff); - if (self.se_htype != 3 || !ehdr_off || !phdr_off) + if (self.se_htype != 3u || !ehdr_off || !phdr_off) { return CELL_ENOEXEC; } @@ -159,12 +159,12 @@ struct spu_elf_info // Check ELF header vm::ptr> ehdr = vm::cast(src.addr() + ehdr_off); - if (ehdr->e_magic != "\177ELF"_u32 || ehdr->e_data != 2 /* BE */) + if (ehdr->e_magic != "\177ELF"_u32 || ehdr->e_data != 2u /* BE */) { return CELL_ENOEXEC; } - if (ehdr->e_class != 1 && ehdr->e_class != 2) + if (ehdr->e_class != 1u && ehdr->e_class != 2u) { return CELL_ENOEXEC; } @@ -194,7 +194,7 @@ error_code sys_spu_elf_get_information(u32 elf_img, vm::ptr entry, vm::ptr< } // Reject SCE header - if (info->sce0.se_magic == 0x53434500) + if (info->sce0.se_magic == 0x53434500u) { return CELL_ENOEXEC; } @@ -287,7 +287,7 @@ error_code sys_spu_image_import(ppu_thread& ppu, vm::ptr img, u32 } // Reject SCE header - if (info->sce0.se_magic == 0x53434500) + if (info->sce0.se_magic == 0x53434500u) { return CELL_ENOEXEC; } @@ -314,7 +314,7 @@ error_code sys_spu_image_import(ppu_thread& ppu, vm::ptr img, u32 for (const auto& p : phdr) { - if (p.p_type != 1 && p.p_type != 4) + if (p.p_type != 1u && p.p_type != 4u) { return CELL_ENOEXEC; } diff --git a/rpcs3/Emu/Cell/PPUAnalyser.cpp b/rpcs3/Emu/Cell/PPUAnalyser.cpp index f12245e67a..8737d43603 100644 --- a/rpcs3/Emu/Cell/PPUAnalyser.cpp +++ b/rpcs3/Emu/Cell/PPUAnalyser.cpp @@ -772,13 +772,13 @@ void ppu_module::analyse(u32 lib_toc, u32 entry) // Mine for (vm::cptr ptr = vm::cast(sec.addr); ptr < sec_end; ptr = vm::cast(ptr.addr() + ptr[0] + 4)) { - if (ptr[0] == 0) + if (ptr[0] == 0u) { // Null terminator break; } - if (ptr[1] == 0) + if (ptr[1] == 0u) { // CIE ppu_log.trace(".eh_frame: [0x%x] CIE 0x%x", ptr, ptr[0]); @@ -792,16 +792,16 @@ void ppu_module::analyse(u32 lib_toc, u32 entry) u32 size = 0; // TODO: 64 bit or 32 bit values (approximation) - if (ptr[2] == 0 && ptr[3] == 0) + if (ptr[2] == 0u && ptr[3] == 0u) { size = ptr[5]; } - else if ((ptr[2] == -1 || ptr[2] == 0) && ptr[4] == 0 && ptr[5]) + else if ((ptr[2] + 1 == 0u || ptr[2] == 0u) && ptr[4] == 0u && ptr[5]) { addr = ptr[3]; size = ptr[5]; } - else if (ptr[2] != -1 && ptr[3]) + else if (ptr[2] + 1 && ptr[3]) { addr = ptr[2]; size = ptr[3]; @@ -1113,8 +1113,8 @@ void ppu_module::analyse(u32 lib_toc, u32 entry) } if (ptr + 3 <= fend && - ptr[0] == 0x7c0004ac && - ptr[1] == 0x00000000 && + ptr[0] == 0x7c0004acu && + ptr[1] == 0x00000000u && ptr[2] == BLR()) { // Weird function (illegal instruction) diff --git a/rpcs3/Emu/Cell/PPUModule.cpp b/rpcs3/Emu/Cell/PPUModule.cpp index 6b831ed4e2..325f366085 100644 --- a/rpcs3/Emu/Cell/PPUModule.cpp +++ b/rpcs3/Emu/Cell/PPUModule.cpp @@ -798,7 +798,7 @@ std::shared_ptr ppu_load_prx(const ppu_prx_object& elf, const std::stri const u32 addr = vm::cast(s.sh_addr); const u32 size = vm::cast(s.sh_size); - if (s.sh_type == 1 && addr && size) // TODO: some sections with addr=0 are valid + if (s.sh_type == 1u && addr && size) // TODO: some sections with addr=0 are valid { for (auto i = 0; i < prx->segs.size(); i++) { @@ -1116,7 +1116,7 @@ void ppu_load_exec(const ppu_exec_object& elf) const u32 flag = _sec.flags = s.sh_flags & 7; _sec.filesz = 0; - if (s.sh_type == 1 && addr && size) + if (s.sh_type == 1u && addr && size) { _main->secs.emplace_back(_sec); } @@ -1178,12 +1178,12 @@ void ppu_load_exec(const ppu_exec_object& elf) fmt::append(dump, "\n\tSegment: p_type=0x%x, p_vaddr=0x%llx, p_filesz=0x%llx, p_memsz=0x%llx, p_offset=0x%llx", prog.p_type, prog.p_vaddr, prog.p_filesz, prog.p_memsz, prog.p_offset); - if (prog.p_type == 0x1 /* LOAD */ && prog.p_filesz > 0) + if (prog.p_type == 0x1u /* LOAD */ && prog.p_filesz > 0u) { sha1_update(&sha2, (elf_header + prog.p_offset), prog.p_filesz); } - else if (prog.p_type == 0x4 /* NOTE */ && prog.p_filesz > 0) + else if (prog.p_type == 0x4u /* NOTE */ && prog.p_filesz > 0u) { sha1_update(&sha2, (elf_header + prog.p_offset), prog.p_filesz); @@ -1296,7 +1296,7 @@ void ppu_load_exec(const ppu_exec_object& elf) ppu_loader.warning("Bad process_param size! [0x%x : 0x%x]", info.size, sizeof(process_param_t)); } - if (info.magic != 0x13bcc5f6) + if (info.magic != 0x13bcc5f6u) { ppu_loader.error("Bad process_param magic! [0x%x]", info.magic); } @@ -1351,7 +1351,7 @@ void ppu_load_exec(const ppu_exec_object& elf) ppu_loader.notice("* unk0 = 0x%x", proc_prx_param.unk0); ppu_loader.notice("* unk2 = 0x%x", proc_prx_param.unk2); - if (proc_prx_param.magic != 0x1b434cec) + if (proc_prx_param.magic != 0x1b434cecu) { fmt::throw_exception("Bad magic! (0x%x)", proc_prx_param.magic); } @@ -1614,7 +1614,7 @@ void ppu_load_exec(const ppu_exec_object& elf) const u32 addr = static_cast(prog.p_vaddr); const u32 size = static_cast(prog.p_memsz); - if (prog.p_type == 0x1 /* LOAD */ && prog.p_memsz && (prog.p_flags & 0x2) == 0 /* W */) + if (prog.p_type == 0x1u /* LOAD */ && prog.p_memsz && (prog.p_flags & 0x2) == 0u /* W */) { // Set memory protection to read-only when necessary verify(HERE), vm::page_protect(addr, ::align(size, 0x1000), 0, 0, vm::page_writable); @@ -1686,7 +1686,7 @@ std::shared_ptr ppu_load_overlay(const ppu_exec_object& elf, const const u32 flag = _sec.flags = s.sh_flags & 7; _sec.filesz = 0; - if (s.sh_type == 1 && addr && size) + if (s.sh_type == 1u && addr && size) { ovlm->secs.emplace_back(_sec); } @@ -1742,7 +1742,7 @@ std::shared_ptr ppu_load_overlay(const ppu_exec_object& elf, const ppu_loader.warning("Bad process_param size! [0x%x : 0x%x]", info.size, u32{sizeof(process_param_t)}); } - if (info.magic != 0x4f564c4d) //string "OVLM" + if (info.magic != "OVLM"_u32) //string "OVLM" { ppu_loader.error("Bad process_param magic! [0x%x]", info.magic); } @@ -1780,7 +1780,7 @@ std::shared_ptr ppu_load_overlay(const ppu_exec_object& elf, const ppu_loader.notice("* unk0 = 0x%x", proc_prx_param.unk0); ppu_loader.notice("* unk2 = 0x%x", proc_prx_param.unk2); - if (proc_prx_param.magic != 0x1b434cec) + if (proc_prx_param.magic != 0x1b434cecu) { fmt::throw_exception("Bad magic! (0x%x)", proc_prx_param.magic); } diff --git a/rpcs3/Emu/Cell/RawSPUThread.cpp b/rpcs3/Emu/Cell/RawSPUThread.cpp index 2bb2056217..cfd3833c95 100644 --- a/rpcs3/Emu/Cell/RawSPUThread.cpp +++ b/rpcs3/Emu/Cell/RawSPUThread.cpp @@ -300,7 +300,7 @@ void spu_load_exec(const spu_exec_object& elf) for (const auto& prog : elf.progs) { - if (prog.p_type == 0x1 /* LOAD */ && prog.p_memsz) + if (prog.p_type == 0x1u /* LOAD */ && prog.p_memsz) { std::memcpy(vm::base(spu->offset + prog.p_vaddr), prog.bin.data(), prog.p_filesz); } diff --git a/rpcs3/Emu/Cell/SPURecompiler.cpp b/rpcs3/Emu/Cell/SPURecompiler.cpp index 2cf01c4325..b5756b22ff 100644 --- a/rpcs3/Emu/Cell/SPURecompiler.cpp +++ b/rpcs3/Emu/Cell/SPURecompiler.cpp @@ -1077,7 +1077,7 @@ void spu_recompiler_base::dispatch(spu_thread& spu, void*, u8* rip) spu.jit->init(); // Compile - if (spu._ref(spu.pc) == 0) + if (spu._ref(spu.pc) == 0u) { spu_runtime::g_escape(&spu); return; @@ -1540,16 +1540,16 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point) } } else if (start + 12 * 4 < limit && - ls[start / 4 + 0] == 0x1ce00408 && - ls[start / 4 + 1] == 0x24000389 && - ls[start / 4 + 2] == 0x24004809 && - ls[start / 4 + 3] == 0x24008809 && - ls[start / 4 + 4] == 0x2400c809 && - ls[start / 4 + 5] == 0x24010809 && - ls[start / 4 + 6] == 0x24014809 && - ls[start / 4 + 7] == 0x24018809 && - ls[start / 4 + 8] == 0x1c200807 && - ls[start / 4 + 9] == 0x2401c809) + ls[start / 4 + 0] == 0x1ce00408u && + ls[start / 4 + 1] == 0x24000389u && + ls[start / 4 + 2] == 0x24004809u && + ls[start / 4 + 3] == 0x24008809u && + ls[start / 4 + 4] == 0x2400c809u && + ls[start / 4 + 5] == 0x24010809u && + ls[start / 4 + 6] == 0x24014809u && + ls[start / 4 + 7] == 0x24018809u && + ls[start / 4 + 8] == 0x1c200807u && + ls[start / 4 + 9] == 0x2401c809u) { spu_log.warning("[0x%x] Pattern 1 detected (hbr=0x%x:0x%x)", pos, hbr_loc, hbr_tg); diff --git a/rpcs3/Emu/Cell/SPUThread.cpp b/rpcs3/Emu/Cell/SPUThread.cpp index dabab4dad4..8464671f6e 100644 --- a/rpcs3/Emu/Cell/SPUThread.cpp +++ b/rpcs3/Emu/Cell/SPUThread.cpp @@ -1176,7 +1176,7 @@ void spu_thread::cpu_task() break; } - if (_ref(pc) == 0x0) + if (_ref(pc) == 0x0u) { if (spu_thread::stop_and_signal(0x0)) pc += 4; diff --git a/rpcs3/Emu/Cell/lv2/sys_fs.cpp b/rpcs3/Emu/Cell/lv2/sys_fs.cpp index 2e5e993bf6..ee7ef59830 100644 --- a/rpcs3/Emu/Cell/lv2/sys_fs.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_fs.cpp @@ -36,13 +36,13 @@ bool verify_mself(u32 fd, fs::file const& mself_file) return false; } - if (mself_header.m_magic != 0x4D534600) + if (mself_header.m_magic != 0x4D534600u) { sys_fs.error("verify_mself: Header magic is incorrect."); return false; } - if (mself_header.m_format_version != 1) + if (mself_header.m_format_version != 1u) { sys_fs.error("verify_mself: Unexpected header format version."); return false; @@ -424,7 +424,7 @@ error_code sys_fs_open(ppu_thread& ppu, vm::cptr path, s32 flags, vm::ptr< if (size == 8) { // check for sdata - if (*casted_arg == 0x18000000010) + if (*casted_arg == 0x18000000010ull) { // check if the file has the NPD header, or else assume its not encrypted u32 magic; @@ -442,7 +442,7 @@ error_code sys_fs_open(ppu_thread& ppu, vm::cptr path, s32 flags, vm::ptr< } } // edata - else if (*casted_arg == 0x2) + else if (*casted_arg == 0x2u) { // check if the file has the NPD header, or else assume its not encrypted u32 magic; @@ -1248,13 +1248,13 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr _arg, u32 { const auto arg = vm::static_ptr_cast(_arg); - if (arg->size != 0x20) + if (arg->size != 0x20u) { sys_fs.error("sys_fs_fcntl(0xc0000006): invalid size (0x%x)", arg->size); break; } - if (arg->_x4 != 0x10 || arg->_x8 != 0x18) + if (arg->_x4 != 0x10u || arg->_x8 != 0x18u) { sys_fs.error("sys_fs_fcntl(0xc0000006): invalid args (0x%x, 0x%x)", arg->_x4, arg->_x8); break; @@ -1464,7 +1464,7 @@ error_code sys_fs_fcntl(ppu_thread& ppu, u32 fd, u32 op, vm::ptr _arg, u32 { const auto arg = vm::static_ptr_cast(_arg); - if (_size < arg->size || arg->_x4 != 0x10 || arg->_x8 != 0x20) + if (_size < arg->size || arg->_x4 != 0x10u || arg->_x8 != 0x20u) { return CELL_EINVAL; } diff --git a/rpcs3/Emu/Cell/lv2/sys_spu.cpp b/rpcs3/Emu/Cell/lv2/sys_spu.cpp index fc70b5e55b..0e258c4185 100644 --- a/rpcs3/Emu/Cell/lv2/sys_spu.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_spu.cpp @@ -39,7 +39,7 @@ void sys_spu_image::load(const fs::file& stream) { spu_log.notice("** Segment: p_type=0x%x, p_vaddr=0x%llx, p_filesz=0x%llx, p_memsz=0x%llx, flags=0x%x", prog.p_type, prog.p_vaddr, prog.p_filesz, prog.p_memsz, prog.p_flags); - if (prog.p_type != SYS_SPU_SEGMENT_TYPE_COPY && prog.p_type != SYS_SPU_SEGMENT_TYPE_INFO) + if (prog.p_type != u32{SYS_SPU_SEGMENT_TYPE_COPY} && prog.p_type != u32{SYS_SPU_SEGMENT_TYPE_INFO}) { spu_log.error("Unknown program type (0x%x)", prog.p_type); } diff --git a/rpcs3/Emu/Cell/lv2/sys_spu.h b/rpcs3/Emu/Cell/lv2/sys_spu.h index 80e6f53ebe..281b1460b5 100644 --- a/rpcs3/Emu/Cell/lv2/sys_spu.h +++ b/rpcs3/Emu/Cell/lv2/sys_spu.h @@ -133,16 +133,16 @@ struct sys_spu_image for (const auto& phdr : phdrs) { - if (phdr.p_type != 1 && phdr.p_type != 4) + if (phdr.p_type != 1u && phdr.p_type != 4u) { return -1; } - if (phdr.p_type == 1 && phdr.p_filesz != phdr.p_memsz && phdr.p_filesz) + if (phdr.p_type == 1u && phdr.p_filesz != phdr.p_memsz && phdr.p_filesz) { num_segs += 2; } - else if (phdr.p_type == 1 || CountInfo) + else if (phdr.p_type == 1u || CountInfo) { num_segs += 1; } @@ -158,7 +158,7 @@ struct sys_spu_image for (const auto& phdr : phdrs) { - if (phdr.p_type == 1) + if (phdr.p_type == 1u) { if (phdr.p_filesz) { @@ -188,7 +188,7 @@ struct sys_spu_image seg->addr = 0; } } - else if (WriteInfo && phdr.p_type == 4) + else if (WriteInfo && phdr.p_type == 4u) { if (num_segs >= nsegs) { @@ -200,7 +200,7 @@ struct sys_spu_image seg->size = 0x20; seg->addr = static_cast(phdr.p_offset + 0x14 + src); } - else if (phdr.p_type != 4) + else if (phdr.p_type != 4u) { return -1; } diff --git a/rpcs3/Emu/Memory/vm_ptr.h b/rpcs3/Emu/Memory/vm_ptr.h index 6f6a6532f8..dcb1568e4a 100644 --- a/rpcs3/Emu/Memory/vm_ptr.h +++ b/rpcs3/Emu/Memory/vm_ptr.h @@ -60,7 +60,7 @@ namespace vm explicit operator bool() const { - return m_addr != 0; + return m_addr != 0u; } // Get vm pointer to a struct member @@ -120,7 +120,7 @@ namespace vm // Test address for arbitrary alignment: (addr & (align - 1)) == 0 bool aligned(u32 align = alignof(T)) const { - return (m_addr & (align - 1)) == 0; + return (m_addr & (align - 1)) == 0u; } // Get type size @@ -252,7 +252,7 @@ namespace vm explicit operator bool() const { - return m_addr != 0; + return m_addr != 0u; } _ptr_base operator +() const diff --git a/rpcs3/Emu/RSX/CgBinaryProgram.h b/rpcs3/Emu/RSX/CgBinaryProgram.h index d9bdf40585..6f7d08d616 100644 --- a/rpcs3/Emu/RSX/CgBinaryProgram.h +++ b/rpcs3/Emu/RSX/CgBinaryProgram.h @@ -284,7 +284,7 @@ public: auto& prog = GetCgRef(0); - if (prog.profile == 7004) + if (prog.profile == 7004u) { auto& fprog = GetCgRef(prog.program); m_arb_shader += "\n"; diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 9704b469de..68ced1074c 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -3453,7 +3453,7 @@ namespace rsx void conditional_render_eval::eval_result(::rsx::thread* pthr) { vm::ptr result = vm::cast(eval_address); - const bool failed = (result->value == 0); + const bool failed = (result->value == 0u); set_eval_result(pthr, failed); } } diff --git a/rpcs3/Loader/ELF.h b/rpcs3/Loader/ELF.h index 746727d9ef..a3b4130b35 100644 --- a/rpcs3/Loader/ELF.h +++ b/rpcs3/Loader/ELF.h @@ -232,13 +232,13 @@ public: return set_error(elf_error::header_type); // Check version and other params - if (header.e_curver != 1 || header.e_version != 1 || header.e_ehsize != sizeof(ehdr_t)) + if (header.e_curver != 1 || header.e_version != 1u || header.e_ehsize != u16{sizeof(ehdr_t)}) return set_error(elf_error::header_version); - if (header.e_phnum && header.e_phentsize != sizeof(phdr_t)) + if (header.e_phnum && header.e_phentsize != u16{sizeof(phdr_t)}) return set_error(elf_error::header_version); - if (header.e_shnum && header.e_shentsize != sizeof(shdr_t)) + if (header.e_shnum && header.e_shentsize != u16{sizeof(shdr_t)}) return set_error(elf_error::header_version); // Load program headers diff --git a/rpcs3/Loader/PSF.cpp b/rpcs3/Loader/PSF.cpp index 859c5d6eb6..49a2ddc465 100644 --- a/rpcs3/Loader/PSF.cpp +++ b/rpcs3/Loader/PSF.cpp @@ -117,7 +117,7 @@ namespace psf // Check magic and version verify(HERE), header.magic == "\0PSF"_u32, - header.version == 0x101, + header.version == 0x101u, sizeof(header_t) + header.entries_num * sizeof(def_table_t) <= header.off_key_table, header.off_key_table <= header.off_data_table, header.off_data_table <= stream.size(); diff --git a/rpcs3/Loader/TROPUSR.cpp b/rpcs3/Loader/TROPUSR.cpp index fe1b58e162..6c721744bd 100644 --- a/rpcs3/Loader/TROPUSR.cpp +++ b/rpcs3/Loader/TROPUSR.cpp @@ -76,7 +76,7 @@ bool TROPUSRLoader::LoadTables() { m_file.seek(tableHeader.offset); - if (tableHeader.type == 4) + if (tableHeader.type == 4u) { m_table4.clear(); m_table4.resize(tableHeader.entries_count); @@ -88,7 +88,7 @@ bool TROPUSRLoader::LoadTables() } } - if (tableHeader.type == 6) + if (tableHeader.type == 6u) { m_table6.clear(); m_table6.resize(tableHeader.entries_count);