mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 03:25:16 +00:00
Small warnings cleanup (#6671)
* Ignore more warnings These are intentional * Signed/unsigned mismatch when comparing * Explictly cast values * Intentionally discard a nodiscard value * Change ppu_tid to u32 * Do not use POSIX function name on Windows * Qt: Use horizontalAdvance instead of width * Change progress variables to u32
This commit is contained in:
parent
89a2d04f96
commit
f3ed26e9db
17 changed files with 45 additions and 39 deletions
|
@ -527,7 +527,7 @@ bool logs::file_writer::flush(u64 bufv)
|
|||
// Write compressed
|
||||
if (m_fout2 && st < m_max_size)
|
||||
{
|
||||
m_zs.avail_in = size;
|
||||
m_zs.avail_in = static_cast<uInt>(size);
|
||||
m_zs.next_in = m_fptr + st % s_log_size;
|
||||
|
||||
do
|
||||
|
|
|
@ -1276,7 +1276,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (vm::check_addr(addr, std::max<std::size_t>(1, d_size), is_writing ? vm::page_writable : vm::page_readable))
|
||||
if (vm::check_addr(addr, std::max(1u, ::narrow<u32>(d_size)), is_writing ? vm::page_writable : vm::page_readable))
|
||||
{
|
||||
if (cpu && cpu->test_stopped())
|
||||
{
|
||||
|
@ -1331,12 +1331,12 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
|
|||
u64 data3;
|
||||
{
|
||||
vm::reader_lock rlock;
|
||||
if (vm::check_addr(addr, std::max<std::size_t>(1, d_size), is_writing ? vm::page_writable : vm::page_readable))
|
||||
if (vm::check_addr(addr, std::max(1u, ::narrow<u32>(d_size)), is_writing ? vm::page_writable : vm::page_readable))
|
||||
{
|
||||
// Memory was allocated inbetween, retry
|
||||
return true;
|
||||
}
|
||||
else if (vm::check_addr(addr, std::max<std::size_t>(1, d_size)))
|
||||
else if (vm::check_addr(addr, std::max(1u, ::narrow<u32>(d_size))))
|
||||
{
|
||||
data3 = SYS_MEMORY_PAGE_FAULT_CAUSE_READ_ONLY; // TODO
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ int decompress(unsigned char *out, unsigned char *in, unsigned int size)
|
|||
if (code <= size)
|
||||
{
|
||||
memcpy(out, (const void *)(in + 5), code);
|
||||
result = (start - out);
|
||||
result = static_cast<int>(start - out);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -162,7 +162,7 @@ int decompress(unsigned char *out, unsigned char *in, unsigned int size)
|
|||
{
|
||||
// Adjust offset and check for stream end.
|
||||
if (offset > 0) offset--;
|
||||
if (start == end) return (start - out);
|
||||
if (start == end) return static_cast<int>(start - out);
|
||||
|
||||
// Locate first section.
|
||||
int sect = (((((((int)(start - out)) & 7) << 8) + prev) >> head) & 7) * 0xFF - 1;
|
||||
|
@ -203,7 +203,7 @@ int decompress(unsigned char *out, unsigned char *in, unsigned int size)
|
|||
|
||||
// Decode the data length (8 bit fields).
|
||||
data_length = decode_number(tmp_sect1, index, &bit_flag, &range, &code, &in);
|
||||
if (data_length == 0xFF) return (start - out); // End of stream.
|
||||
if (data_length == 0xFF) return static_cast<int>(start - out); // End of stream.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -276,7 +276,7 @@ int decompress(unsigned char *out, unsigned char *in, unsigned int size)
|
|||
}
|
||||
prev = *(start - 1);
|
||||
}
|
||||
result = (start - out);
|
||||
result = static_cast<int>(start - out);
|
||||
}
|
||||
delete[] tmp;
|
||||
return result;
|
||||
|
|
|
@ -423,7 +423,7 @@ s32 _cellGcmInitBody(ppu_thread& ppu, vm::pptr<CellGcmContextData> context, u32
|
|||
vm::var<u64> _tid;
|
||||
vm::var<char[]> _name = vm::make_str("_gcm_intr_thread");
|
||||
ppu_execute<&sys_ppu_thread_create>(ppu, +_tid, 0x10000, 0, 1, 0x4000, SYS_PPU_THREAD_CREATE_INTERRUPT, +_name);
|
||||
render->intr_thread = idm::get<named_thread<ppu_thread>>(*_tid);
|
||||
render->intr_thread = idm::get<named_thread<ppu_thread>>(static_cast<u32>(*_tid));
|
||||
render->intr_thread->state -= cpu_flag::stop;
|
||||
render->isHLE = true;
|
||||
render->label_addr = gcm_cfg->gcm_info.label_addr;
|
||||
|
|
|
@ -1260,7 +1260,7 @@ s32 UTF16stoUTF8s(vm::cptr<u16> utf16, vm::ref<s32> utf16_len, vm::ptr<u8> utf8,
|
|||
|
||||
const u32 max_len = utf8_len; utf8_len = 0;
|
||||
|
||||
for (u32 i = 0, len = 0; i < utf16_len; i++, utf8_len = len)
|
||||
for (u32 i = 0, len = 0; i < static_cast<u32>(utf16_len); i++, utf8_len = len)
|
||||
{
|
||||
const u16 ch = utf16[i];
|
||||
|
||||
|
|
|
@ -680,7 +680,7 @@ s32 pngDecodeData(ppu_thread& ppu, PHandle handle, PStream stream, vm::ptr<u8> d
|
|||
// Indicate, that the PNG decoding is stopped/failed. This is incase, we return an error code in the middle of decoding
|
||||
data_out_info->status = CELL_PNGDEC_DEC_STATUS_STOP;
|
||||
|
||||
const u32 bytes_per_line = data_control_param->outputBytesPerLine;
|
||||
const u32 bytes_per_line = ::narrow<u32>(data_control_param->outputBytesPerLine);
|
||||
|
||||
// Log this for now
|
||||
if (bytes_per_line < stream->out_param.outputWidthByte)
|
||||
|
|
|
@ -909,7 +909,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
|||
{
|
||||
statGet->fileNum++;
|
||||
|
||||
size_kbytes += (entry.size + 1023) / 1024; // firmware rounds this value up
|
||||
size_kbytes += ::narrow<u32>((entry.size + 1023) / 1024); // firmware rounds this value up
|
||||
|
||||
if (statGet->fileListNum >= setBuf->fileListMax)
|
||||
continue;
|
||||
|
@ -1423,7 +1423,7 @@ static NEVER_INLINE error_code savedata_get_list_item(vm::cptr<char> dirName, vm
|
|||
|
||||
for (const auto& entry : fs::dir(save_path))
|
||||
{
|
||||
size_kbytes += (entry.size + 1023) / 1024; // firmware rounds this value up
|
||||
size_kbytes += ::narrow<u32>((entry.size + 1023) / 1024); // firmware rounds this value up
|
||||
}
|
||||
|
||||
*sizeKB = size_kbytes;
|
||||
|
|
|
@ -133,7 +133,7 @@ bool spursDma(spu_thread& spu, u32 cmd, u64 ea, u32 lsa, u32 size, u32 tag)
|
|||
|
||||
if (cmd == MFC_GETLLAR_CMD || cmd == MFC_PUTLLC_CMD || cmd == MFC_PUTLLUC_CMD)
|
||||
{
|
||||
const u32 rv = spu.get_ch_value(MFC_RdAtomicStat);
|
||||
const u32 rv = static_cast<u32>(spu.get_ch_value(MFC_RdAtomicStat));
|
||||
return cmd == MFC_PUTLLC_CMD ? !rv : true;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ u32 spursDmaGetCompletionStatus(spu_thread& spu, u32 tagMask)
|
|||
{
|
||||
spu.set_ch_value(MFC_WrTagMask, tagMask);
|
||||
spu.set_ch_value(MFC_WrTagUpdate, MFC_TAG_UPDATE_IMMEDIATE);
|
||||
return spu.get_ch_value(MFC_RdTagStat);
|
||||
return static_cast<u32>(spu.get_ch_value(MFC_RdTagStat));
|
||||
}
|
||||
|
||||
// Wait for DMA operations to complete
|
||||
|
@ -153,7 +153,7 @@ u32 spursDmaWaitForCompletion(spu_thread& spu, u32 tagMask, bool waitForAll)
|
|||
{
|
||||
spu.set_ch_value(MFC_WrTagMask, tagMask);
|
||||
spu.set_ch_value(MFC_WrTagUpdate, waitForAll ? MFC_TAG_UPDATE_ALL : MFC_TAG_UPDATE_ANY);
|
||||
return spu.get_ch_value(MFC_RdTagStat);
|
||||
return static_cast<u32>(spu.get_ch_value(MFC_RdTagStat));
|
||||
}
|
||||
|
||||
// Halt the SPU
|
||||
|
@ -234,7 +234,7 @@ s32 sys_spu_thread_switch_system_module(spu_thread& spu, u32 status)
|
|||
{
|
||||
spu.set_ch_value(SPU_WrOutMbox, status);
|
||||
spu.stop_and_signal(0x120);
|
||||
result = spu.get_ch_value(SPU_RdInMbox);
|
||||
result = static_cast<u32>(spu.get_ch_value(SPU_RdInMbox));
|
||||
}
|
||||
while (result == CELL_EBUSY);
|
||||
|
||||
|
@ -1709,8 +1709,8 @@ s32 spursTasketSaveTaskContext(spu_thread& spu)
|
|||
v128 r;
|
||||
spu.fpscr.Read(r);
|
||||
ctxt->savedContextFpscr = r;
|
||||
ctxt->savedSpuWriteEventMask = spu.get_ch_value(SPU_RdEventMask);
|
||||
ctxt->savedWriteTagGroupQueryMask = spu.get_ch_value(MFC_RdTagMask);
|
||||
ctxt->savedSpuWriteEventMask = static_cast<u32>(spu.get_ch_value(SPU_RdEventMask));
|
||||
ctxt->savedWriteTagGroupQueryMask = static_cast<u32>(spu.get_ch_value(MFC_RdTagMask));
|
||||
|
||||
// Store the processor context
|
||||
const u32 contextSaveStorage = vm::cast(taskInfo->context_save_storage_and_alloc_ls_blocks & -0x80, HERE);
|
||||
|
|
|
@ -103,7 +103,7 @@ struct vdec_context final
|
|||
u32 frc_set{}; // Frame Rate Override
|
||||
u64 next_pts{};
|
||||
u64 next_dts{};
|
||||
u64 ppu_tid{};
|
||||
u32 ppu_tid{};
|
||||
|
||||
std::deque<vdec_frame> out;
|
||||
atomic_t<u32> out_max = 60;
|
||||
|
@ -472,7 +472,7 @@ static error_code vdecOpen(ppu_thread& ppu, T type, U res, vm::cptr<CellVdecCb>
|
|||
ppu_execute<&sys_ppu_thread_create>(ppu, +_tid, 0x10000, vid, +res->ppuThreadPriority, +res->ppuThreadStackSize, SYS_PPU_THREAD_CREATE_INTERRUPT, +_name);
|
||||
*handle = vid;
|
||||
|
||||
const auto thrd = idm::get<named_thread<ppu_thread>>(*_tid);
|
||||
const auto thrd = idm::get<named_thread<ppu_thread>>(static_cast<u32>(*_tid));
|
||||
|
||||
thrd->cmd_list
|
||||
({
|
||||
|
@ -515,7 +515,7 @@ error_code cellVdecClose(ppu_thread& ppu, u32 handle)
|
|||
vdec->out_max = 0;
|
||||
vdec->in_cmd.push(vdec_close);
|
||||
|
||||
while (!atomic_storage<u64>::load(vdec->ppu_tid))
|
||||
while (!atomic_storage<u32>::load(vdec->ppu_tid))
|
||||
{
|
||||
thread_ctrl::wait_for(1000);
|
||||
}
|
||||
|
|
|
@ -67,8 +67,8 @@ const bool s_use_ssse3 =
|
|||
extern u64 get_guest_system_time();
|
||||
|
||||
extern atomic_t<const char*> g_progr;
|
||||
extern atomic_t<u64> g_progr_ptotal;
|
||||
extern atomic_t<u64> g_progr_pdone;
|
||||
extern atomic_t<u32> g_progr_ptotal;
|
||||
extern atomic_t<u32> g_progr_pdone;
|
||||
|
||||
enum class join_status : u32
|
||||
{
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
#include <thread>
|
||||
|
||||
extern atomic_t<const char*> g_progr;
|
||||
extern atomic_t<u64> g_progr_ptotal;
|
||||
extern atomic_t<u64> g_progr_pdone;
|
||||
extern atomic_t<u32> g_progr_ptotal;
|
||||
extern atomic_t<u32> g_progr_pdone;
|
||||
|
||||
const spu_decoder<spu_itype> s_spu_itype;
|
||||
const spu_decoder<spu_iname> s_spu_iname;
|
||||
|
|
|
@ -1680,7 +1680,7 @@ void spu_thread::do_mfc(bool wait)
|
|||
u32 fence = 0;
|
||||
|
||||
// Process enqueued commands
|
||||
std::remove_if(mfc_queue + 0, mfc_queue + mfc_size, [&](spu_mfc_cmd& args)
|
||||
static_cast<void>(std::remove_if(mfc_queue + 0, mfc_queue + mfc_size, [&](spu_mfc_cmd& args)
|
||||
{
|
||||
// Select tag bit in the tag mask or the stall mask
|
||||
const u32 mask = utils::rol32(1, args.tag);
|
||||
|
@ -1753,7 +1753,7 @@ void spu_thread::do_mfc(bool wait)
|
|||
|
||||
removed++;
|
||||
return true;
|
||||
});
|
||||
}));
|
||||
|
||||
mfc_size -= removed;
|
||||
mfc_barrier = barrier;
|
||||
|
|
|
@ -189,7 +189,7 @@ void usb_device_emulated::control_transfer(u8 bmRequestType, u8 bRequest, u16 wV
|
|||
case 0:
|
||||
switch (bRequest)
|
||||
{
|
||||
case 0x09: usb_device::set_configuration(wValue); break;
|
||||
case 0x09: usb_device::set_configuration(::narrow<u8>(wValue)); break;
|
||||
default: sys_usbd.fatal("Unhandled control transfer(0): 0x%x", bRequest); break;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -67,10 +67,10 @@ std::mutex g_tty_mutex;
|
|||
|
||||
// Progress display server synchronization variables
|
||||
atomic_t<const char*> g_progr{nullptr};
|
||||
atomic_t<u64> g_progr_ftotal{0};
|
||||
atomic_t<u64> g_progr_fdone{0};
|
||||
atomic_t<u64> g_progr_ptotal{0};
|
||||
atomic_t<u64> g_progr_pdone{0};
|
||||
atomic_t<u32> g_progr_ftotal{0};
|
||||
atomic_t<u32> g_progr_fdone{0};
|
||||
atomic_t<u32> g_progr_ptotal{0};
|
||||
atomic_t<u32> g_progr_pdone{0};
|
||||
|
||||
template <>
|
||||
void fmt_class_string<mouse_handler>::format(std::string& out, u64 arg)
|
||||
|
@ -457,10 +457,10 @@ void Emulator::Init()
|
|||
});
|
||||
}
|
||||
|
||||
u64 ftotal = 0;
|
||||
u64 fdone = 0;
|
||||
u64 ptotal = 0;
|
||||
u64 pdone = 0;
|
||||
u32 ftotal = 0;
|
||||
u32 fdone = 0;
|
||||
u32 ptotal = 0;
|
||||
u32 pdone = 0;
|
||||
u32 value = 0;
|
||||
|
||||
// Update progress
|
||||
|
@ -476,7 +476,7 @@ void Emulator::Init()
|
|||
// Compute new progress in percents
|
||||
const u32 total = ftotal + ptotal;
|
||||
const u32 done = fdone + pdone;
|
||||
const u32 new_value = double(done) * 100. / double(total ? total : 1);
|
||||
const u32 new_value = static_cast<u32>(double(done) * 100. / double(total ? total : 1));
|
||||
|
||||
// Compute the difference
|
||||
const u32 delta = new_value > value ? new_value - value : 0;
|
||||
|
|
|
@ -9,6 +9,8 @@ if(MSVC)
|
|||
#TODO: Some of these could be cleaned up
|
||||
add_compile_options(/wd4805) # Comparing boolean and int
|
||||
add_compile_options(/wd4804) # Using integer operators with booleans
|
||||
add_compile_options(/wd4200) # Zero-sized array in struct/union
|
||||
add_link_options(/ignore:4281) # Undesirable base address 0x10000
|
||||
|
||||
# MSVC 2017 uses iterator as base class internally, causing a lot of warning spam
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING=1")
|
||||
|
|
|
@ -171,7 +171,7 @@ namespace gui
|
|||
|
||||
for (int i = 0; i < combo->count(); ++i)
|
||||
{
|
||||
max_width = std::max(max_width, font_metrics.width(combo->itemText(i)));
|
||||
max_width = std::max(max_width, font_metrics.horizontalAdvance(combo->itemText(i)));
|
||||
}
|
||||
|
||||
if (combo->view()->minimumWidth() < max_width)
|
||||
|
|
|
@ -552,7 +552,11 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool automatic)
|
|||
m_progress_dialog->close();
|
||||
QMessageBox::information(m_parent, tr("Auto-updater"), tr("Update successful!"));
|
||||
|
||||
#ifdef _WIN32
|
||||
int ret = _execl(replace_path.c_str(), replace_path.c_str(), nullptr);
|
||||
#else
|
||||
int ret = execl(replace_path.c_str(), replace_path.c_str(), nullptr);
|
||||
#endif
|
||||
if (ret == -1)
|
||||
{
|
||||
LOG_ERROR(GENERAL, "[Auto-updater] Relaunching failed with result: %d(%s)", ret, strerror(errno));
|
||||
|
|
Loading…
Add table
Reference in a new issue