1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

fix some warnings

This commit is contained in:
Megamouse 2023-02-22 21:09:11 +01:00
parent 01ed8a07af
commit ccb7528a59
11 changed files with 33 additions and 33 deletions

View File

@ -777,9 +777,9 @@ struct color4_base
}; };
constexpr color4_base() constexpr color4_base()
: x{} : x{ T{0} }
, y{} , y{ T{0} }
, z{} , z{ T{0} }
, w{ T(1) } , w{ T(1) }
{ {
} }

View File

@ -1372,7 +1372,7 @@ error_code cellCameraReadEx(s32 dev_num, vm::ptr<CellCameraReadEx> read)
return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND; return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND;
} }
g_camera.bytes_read = bytes_read; g_camera.bytes_read = ::narrow<u32>(bytes_read);
cellCamera.trace("cellCameraRead: frame_number=%d, width=%d, height=%d. bytes_read=%d (passed to game: frame=%d, bytesread=%d)", cellCamera.trace("cellCameraRead: frame_number=%d, width=%d, height=%d. bytes_read=%d (passed to game: frame=%d, bytesread=%d)",
frame_number, width, height, bytes_read, read ? read->frame.get() : 0, read ? read->bytesread.get() : 0); frame_number, width, height, bytes_read, read ? read->frame.get() : 0, read ? read->bytesread.get() : 0);
@ -1385,7 +1385,7 @@ error_code cellCameraReadEx(s32 dev_num, vm::ptr<CellCameraReadEx> read)
if (has_new_frame) if (has_new_frame)
{ {
g_camera.frame_timestamp = (get_guest_system_time() - g_camera.start_timestamp); g_camera.frame_timestamp = ::narrow<u32>(get_guest_system_time() - g_camera.start_timestamp);
} }
if (read) // NULL returns CELL_OK if (read) // NULL returns CELL_OK

View File

@ -248,7 +248,7 @@ error_code cellHttpUtilBuildRequestLine(vm::cptr<CellHttpRequestLine> req, vm::p
if (required) if (required)
{ {
*required = result.size(); *required = ::narrow<u32>(result.size());
} }
return CELL_OK; return CELL_OK;
@ -277,7 +277,7 @@ error_code cellHttpUtilBuildHeader(vm::cptr<CellHttpHeader> header, vm::ptr<char
if (required) if (required)
{ {
*required = result.size(); *required = ::narrow<u32>(result.size());
} }
return CELL_OK; return CELL_OK;
@ -336,7 +336,7 @@ error_code cellHttpUtilBuildUri(vm::cptr<CellHttpUri> uri, vm::ptr<char> buf, u3
fmt::append(result, "%s", uri->path); fmt::append(result, "%s", uri->path);
} }
const u32 size_needed = result.size() + 1; // Including '\0' const u32 size_needed = ::narrow<u32>(result.size() + 1); // Including '\0'
if (buf) if (buf)
{ {

View File

@ -846,7 +846,7 @@ error_code cellRtcSetTick(vm::ptr<CellRtcDateTime> pTime, vm::cptr<CellRtcTick>
pTime->second = seconds; pTime->second = seconds;
pTime->minute = minutes; pTime->minute = minutes;
pTime->hour = hours; pTime->hour = hours;
pTime->day = days_tmp + 1; pTime->day = ::narrow<u16>(days_tmp + 1);
pTime->month = months; pTime->month = months;
pTime->year = years; pTime->year = years;
@ -1006,10 +1006,10 @@ error_code cellRtcTickAddMonths(vm::ptr<CellRtcTick> pTick0, vm::cptr<CellRtcTic
// Not pretty, but works // Not pretty, but works
s64 total_months = (date_time->year * 12ULL) + date_time->month + iAdd + -1; s64 total_months = (date_time->year * 12ULL) + date_time->month + iAdd + -1;
s32 total_months_s32 = total_months; s32 total_months_s32 = ::narrow<s32>(total_months);
u32 unk_1 = total_months_s32 >> 0x1f; u32 unk_1 = total_months_s32 >> 0x1f;
u64 unk_2 = ((total_months_s32 / 6 + unk_1) >> 1) - unk_1; u64 unk_2 = ((total_months_s32 / 6 + unk_1) >> 1) - unk_1;
u32 unk_3 = unk_2; u32 unk_3 = ::narrow<u32>(unk_2);
unk_1 = unk_3 & 0xffff; unk_1 = unk_3 & 0xffff;
u64 unk_4 = (total_months - ((u64{unk_3} << 4) - (unk_3 << 2))) + 1; u64 unk_4 = (total_months - ((u64{unk_3} << 4) - (unk_3 << 2))) + 1;
if (((unk_2 & 0xffff) == 0) || ((unk_3 = unk_4 & 0xffff, (unk_4 & 0xffff) == 0 || (0xc < unk_3)))) if (((unk_2 & 0xffff) == 0) || ((unk_3 = unk_4 & 0xffff, (unk_4 & 0xffff) == 0 || (0xc < unk_3))))
@ -1036,8 +1036,8 @@ error_code cellRtcTickAddMonths(vm::ptr<CellRtcTick> pTick0, vm::cptr<CellRtcTic
date_time->day = month_days; date_time->day = month_days;
} }
date_time->month = unk_4; date_time->month = ::narrow<u16>(unk_4);
date_time->year = unk_2; date_time->year = ::narrow<u16>(unk_2);
cellRtcGetTick(date_time, pTick0); cellRtcGetTick(date_time, pTick0);
return CELL_OK; return CELL_OK;
@ -1086,7 +1086,7 @@ error_code cellRtcTickAddYears(vm::ptr<CellRtcTick> pTick0, vm::cptr<CellRtcTick
date_time->day = month_days; date_time->day = month_days;
} }
date_time->year = total_years; date_time->year = ::narrow<u16>(total_years);
cellRtcGetTick(date_time, pTick0); cellRtcGetTick(date_time, pTick0);
return CELL_OK; return CELL_OK;

View File

@ -3953,7 +3953,7 @@ bool spu_thread::process_mfc_cmd()
if (getllar_busy_waiting_switch == umax) if (getllar_busy_waiting_switch == umax)
{ {
// Evalute its value (shift-right to ensure its randomness with different CPUs) // Evalute its value (shift-right to ensure its randomness with different CPUs)
getllar_busy_waiting_switch = ((perf0.get() >> 8) % 100 < g_cfg.core.spu_getllar_busy_waiting_percentage); getllar_busy_waiting_switch = ((perf0.get() >> 8) % 100 < g_cfg.core.spu_getllar_busy_waiting_percentage) ? 1 : 0;
} }
return !!getllar_busy_waiting_switch || getllar_spin_count < 3; return !!getllar_busy_waiting_switch || getllar_spin_count < 3;
@ -3971,7 +3971,7 @@ bool spu_thread::process_mfc_cmd()
last_getllar_id = mfc_cmd_id; last_getllar_id = mfc_cmd_id;
last_gtsc = perf0.get(); last_gtsc = perf0.get();
if (getllar_busy_waiting_switch == true) if (getllar_busy_waiting_switch == 1)
{ {
busy_wait(300); busy_wait(300);
} }
@ -4535,7 +4535,7 @@ u32 spu_thread::get_ch_count(u32 ch)
case SPU_RdSigNotify1: return ch_snr1.get_count(); case SPU_RdSigNotify1: return ch_snr1.get_count();
case SPU_RdSigNotify2: return ch_snr2.get_count(); case SPU_RdSigNotify2: return ch_snr2.get_count();
case MFC_RdAtomicStat: return ch_atomic_stat.get_count(); case MFC_RdAtomicStat: return ch_atomic_stat.get_count();
case SPU_RdEventStat: return get_events().count; case SPU_RdEventStat: return static_cast<u32>(get_events().count);
case MFC_Cmd: return 16 - mfc_size; case MFC_Cmd: return 16 - mfc_size;
// Channels with a constant count of 1: // Channels with a constant count of 1:

View File

@ -47,9 +47,9 @@ void fmt_class_string<libusb_transfer>::format(std::string& out, u64 arg)
struct UsbLdd struct UsbLdd
{ {
std::string name; std::string name;
u16 id_vendor; u16 id_vendor{};
u16 id_product_min; u16 id_product_min{};
u16 id_product_max; u16 id_product_max{};
}; };
struct UsbPipe struct UsbPipe
@ -177,7 +177,7 @@ usb_handler_thread::usb_handler_thread()
if (ndev < 0) if (ndev < 0)
{ {
sys_usbd.error("Failed to get device list: %s", libusb_error_name(ndev)); sys_usbd.error("Failed to get device list: %s", libusb_error_name(static_cast<s32>(ndev)));
return; return;
} }

View File

@ -245,7 +245,7 @@ u32 usb_device_emulated::get_descriptor(u8 type, u8 index, u8* buf, u32 buf_size
else else
{ {
const std::u16string u16str = utf8_to_utf16(strings[index - 1]); const std::u16string u16str = utf8_to_utf16(strings[index - 1]);
const u8 len = std::min(u16str.size() * sizeof(u16) + 2, static_cast<size_t>(0xFF)); const u8 len = static_cast<u8>(std::min(u16str.size() * sizeof(u16) + 2, static_cast<usz>(0xFF)));
buf[0] = len; buf[0] = len;
expected_count = std::min(len, ::narrow<u8>(buf_size)); expected_count = std::min(len, ::narrow<u8>(buf_size));
memcpy(buf + 2, u16str.data(), expected_count - 2); memcpy(buf + 2, u16str.data(), expected_count - 2);
@ -269,7 +269,7 @@ u32 usb_device_emulated::get_status(bool self_powered, bool remote_wakeup, u8* b
return 0; return 0;
} }
const u16 device_status = self_powered | remote_wakeup << 1; const u16 device_status = static_cast<int>(self_powered) | static_cast<int>(remote_wakeup) << 1;
memcpy(buf, &device_status, expected_count); memcpy(buf, &device_status, expected_count);
return expected_count; return expected_count;
} }

View File

@ -92,7 +92,7 @@ struct UsbTransfer
s32 result = 0; s32 result = 0;
u32 count = 0; u32 count = 0;
UsbDeviceIsoRequest iso_request; UsbDeviceIsoRequest iso_request{};
std::vector<u8> setup_buf; std::vector<u8> setup_buf;
libusb_transfer* transfer = nullptr; libusb_transfer* transfer = nullptr;
@ -111,8 +111,8 @@ struct UsbTransfer
// Usb descriptor helper // Usb descriptor helper
struct UsbDescriptorNode struct UsbDescriptorNode
{ {
u8 bLength; u8 bLength{};
u8 bDescriptorType; u8 bDescriptorType{};
union union
{ {
@ -121,7 +121,7 @@ struct UsbDescriptorNode
UsbDeviceInterface _interface; UsbDeviceInterface _interface;
UsbDeviceEndpoint _endpoint; UsbDeviceEndpoint _endpoint;
UsbDeviceHID _hid; UsbDeviceHID _hid;
u8 data[0xFF]; u8 data[0xFF]{};
}; };
std::vector<UsbDescriptorNode> subnodes; std::vector<UsbDescriptorNode> subnodes;

View File

@ -243,7 +243,7 @@ struct cfg_root : cfg::node
cfg::_bool dump_to_file{ this, "Dump to file", false, true }; cfg::_bool dump_to_file{ this, "Dump to file", false, true };
cfg::_bool convert_to_s16{ this, "Convert to 16 bit", false, true }; cfg::_bool convert_to_s16{ this, "Convert to 16 bit", false, true };
cfg::_enum<audio_format> format{ this, "Audio Format", audio_format::stereo, false }; cfg::_enum<audio_format> format{ this, "Audio Format", audio_format::stereo, false };
cfg::uint<0, umax> formats{ this, "Audio Formats", static_cast<u32>(audio_format_flag::lpcm_2_48khz), false }; cfg::uint<0, 0xFF> formats{ this, "Audio Formats", static_cast<u32>(audio_format_flag::lpcm_2_48khz), false };
cfg::string audio_device{ this, "Audio Device", "@@@default@@@", true }; cfg::string audio_device{ this, "Audio Device", "@@@default@@@", true };
cfg::_int<0, 200> volume{ this, "Master Volume", 100, true }; cfg::_int<0, 200> volume{ this, "Master Volume", 100, true };
cfg::_bool enable_buffering{ this, "Enable Buffering", true, true }; cfg::_bool enable_buffering{ this, "Enable Buffering", true, true };

View File

@ -743,7 +743,7 @@ void rsx_debugger::GetBuffers() const
} }
// Touch RSX memory to potentially flush GPU memory (must occur in named_thread) // Touch RSX memory to potentially flush GPU memory (must occur in named_thread)
named_thread("RSX Buffer Touch", [&]() [[maybe_unused]] auto buffer_touch_1 = named_thread("RSX Buffer Touch"sv, [&]()
{ {
for (u32 page_start = rsx_buffer_addr & -4096; page_start < rsx_buffer_addr + src_mem_size; page_start += 4096) for (u32 page_start = rsx_buffer_addr & -4096; page_start < rsx_buffer_addr + src_mem_size; page_start += 4096)
{ {
@ -781,7 +781,7 @@ void rsx_debugger::GetBuffers() const
{ {
for (u32 y = 0; y < height; y++) for (u32 y = 0; y < height; y++)
{ {
for (u32 x = pitch - 2; x != -2u; x -= 2) for (u32 x = 0; x < std::max(pitch, 1u) - 1; x += 2)
{ {
const usz line_start = y * pitch; const usz line_start = y * pitch;
@ -904,7 +904,7 @@ void rsx_debugger::GetBuffers() const
} }
// Touch RSX memory to potentially flush GPU memory (must occur in named_thread) // Touch RSX memory to potentially flush GPU memory (must occur in named_thread)
named_thread("RSX Buffer Touch", [&]() [[maybe_unused]] auto buffer_touch_2 = named_thread("RSX Buffer Touch"sv, [&]()
{ {
for (u32 page_start = rsx_buffer_addr & -4096; page_start < rsx_buffer_addr + src_mem_size; page_start += 4096) for (u32 page_start = rsx_buffer_addr & -4096; page_start < rsx_buffer_addr + src_mem_size; page_start += 4096)
{ {
@ -1059,7 +1059,7 @@ void rsx_debugger::GetBuffers() const
return; return;
} }
named_thread("RSX Buffer Touch", [&]() [[maybe_unused]] auto buffer_touch_3 = named_thread("RSX Buffer Touch"sv, [&]()
{ {
// Must touch every page // Must touch every page
for (u32 i = texture_addr & -4096; i < texture_addr + src_mem_size; i += 4096) for (u32 i = texture_addr & -4096; i < texture_addr + src_mem_size; i += 4096)

View File

@ -26,7 +26,7 @@ namespace stx
u32 size = 1; u32 size = 1;
u32 align = 1; u32 align = 1;
u32 begin = 0; u32 begin = 0;
double order; double order{};
// Next typeinfo in linked list // Next typeinfo in linked list
type_info* next = nullptr; type_info* next = nullptr;