Silence some warnings

This commit is contained in:
Megamouse 2021-09-02 19:00:30 +02:00
parent 06f733a7f2
commit 0debcfed0a
12 changed files with 31 additions and 31 deletions

View file

@ -3205,7 +3205,7 @@ bool spu_thread::process_mfc_cmd()
{ {
state += cpu_flag::wait + cpu_flag::temp; state += cpu_flag::wait + cpu_flag::temp;
std::this_thread::yield(); std::this_thread::yield();
!check_state(); static_cast<void>(check_state());
} }
}()) }())
{ {

View file

@ -1672,7 +1672,7 @@ error_code sys_net_bnet_connect(ppu_thread& ppu, s32 s, vm::ptr<sys_net_sockaddr
sock.p2ps.op_vport = dst_vport; sock.p2ps.op_vport = dst_vport;
sock.p2ps.cur_seq = send_hdr.seq + 1; sock.p2ps.cur_seq = send_hdr.seq + 1;
sock.p2ps.data_beg_seq = 0; sock.p2ps.data_beg_seq = 0;
sock.p2ps.data_available = 0; sock.p2ps.data_available = 0u;
sock.p2ps.received_data.clear(); sock.p2ps.received_data.clear();
sock.p2ps.status = lv2_socket::p2ps_i::stream_status::stream_handshaking; sock.p2ps.status = lv2_socket::p2ps_i::stream_status::stream_handshaking;
@ -2320,8 +2320,8 @@ error_code sys_net_bnet_recvfrom(ppu_thread& ppu, s32 s, vm::ptr<void> buf, u32
{ {
const auto get_data = [&](unsigned char *dest_buf) const auto get_data = [&](unsigned char *dest_buf)
{ {
const u32 to_give = std::min(sock.p2ps.data_available, len); const u32 to_give = std::min<u32>(sock.p2ps.data_available, len);
sys_net.trace("STREAM-P2P socket had %d available, given %d", sock.p2ps.data_available, to_give); sys_net.trace("STREAM-P2P socket had %u available, given %u", sock.p2ps.data_available, to_give);
u32 left_to_give = to_give; u32 left_to_give = to_give;
while (left_to_give) while (left_to_give)
@ -2652,7 +2652,7 @@ error_code sys_net_bnet_sendto(ppu_thread& ppu, s32 s, vm::cptr<void> buf, u32 l
} }
else if (type == SYS_NET_SOCK_STREAM_P2P) else if (type == SYS_NET_SOCK_STREAM_P2P)
{ {
constexpr s64 max_data_len = (65535 - (sizeof(u16) + sizeof(lv2_socket::p2ps_i::encapsulated_tcp))); constexpr u32 max_data_len = (65535 - (sizeof(u16) + sizeof(lv2_socket::p2ps_i::encapsulated_tcp)));
// Prepare address // Prepare address
name.sin_family = AF_INET; name.sin_family = AF_INET;
@ -2664,10 +2664,10 @@ error_code sys_net_bnet_sendto(ppu_thread& ppu, s32 s, vm::cptr<void> buf, u32 l
tcp_header.dst_port = sock.p2ps.op_vport; tcp_header.dst_port = sock.p2ps.op_vport;
// chop it up // chop it up
std::vector<std::vector<u8>> stream_packets; std::vector<std::vector<u8>> stream_packets;
s64 cur_total_len = len; u32 cur_total_len = len;
while(cur_total_len > 0) while(cur_total_len > 0)
{ {
s64 cur_data_len; u32 cur_data_len;
if (cur_total_len >= max_data_len) if (cur_total_len >= max_data_len)
cur_data_len = max_data_len; cur_data_len = max_data_len;
else else
@ -3273,7 +3273,7 @@ error_code sys_net_bnet_poll(ppu_thread& ppu, vm::ptr<sys_net_pollfd> fds, s32 n
{ {
if ((fds[i].events & SYS_NET_POLLIN) && sock->p2ps.data_available) if ((fds[i].events & SYS_NET_POLLIN) && sock->p2ps.data_available)
{ {
sys_net.trace("[P2PS] p2ps has %d bytes available", sock->p2ps.data_available); sys_net.trace("[P2PS] p2ps has %u bytes available", sock->p2ps.data_available);
fds_buf[i].revents |= SYS_NET_POLLIN; fds_buf[i].revents |= SYS_NET_POLLIN;
} }

View file

@ -414,10 +414,10 @@ struct lv2_socket final
u32 op_addr = 0; u32 op_addr = 0;
u64 data_beg_seq = 0; // Seq of first byte of received_data u64 data_beg_seq = 0; // Seq of first byte of received_data
u32 data_available = 0; // Amount of continuous data available(calculated on ACK send) u64 data_available = 0; // Amount of continuous data available(calculated on ACK send)
std::map<u64, std::vector<u8>> received_data; // holds seq/data of data received std::map<u64, std::vector<u8>> received_data; // holds seq/data of data received
u32 cur_seq = 0; // SEQ of next packet to be sent u64 cur_seq = 0; // SEQ of next packet to be sent
} p2ps; } p2ps;
// Value keepers // Value keepers

View file

@ -141,7 +141,7 @@ namespace rsx
value.insert(caret_position, str); value.insert(caret_position, str);
} }
caret_position += ::narrow<u16>(str.length()); caret_position += str.length();
m_reset_caret_pulse = true; m_reset_caret_pulse = true;
set_unicode_text(value); set_unicode_text(value);
refresh(); refresh();

View file

@ -14,7 +14,7 @@ namespace rsx
right right
}; };
u16 caret_position = 0; usz caret_position = 0;
u16 vertical_scroll_offset = 0; u16 vertical_scroll_offset = 0;
bool m_reset_caret_pulse = false; bool m_reset_caret_pulse = false;

View file

@ -283,7 +283,7 @@ namespace rsx
} }
} }
void font::render_text_ex(std::vector<vertex>& result, f32& x_advance, f32& y_advance, const char32_t* text, u32 char_limit, u16 max_width, bool wrap) void font::render_text_ex(std::vector<vertex>& result, f32& x_advance, f32& y_advance, const char32_t* text, usz char_limit, u16 max_width, bool wrap)
{ {
x_advance = 0.f; x_advance = 0.f;
y_advance = 0.f; y_advance = 0.f;
@ -294,7 +294,7 @@ namespace rsx
return; return;
} }
u32 i = 0u; usz i = 0u;
bool skip_whitespace = false; bool skip_whitespace = false;
while (true) while (true)
@ -335,7 +335,7 @@ namespace rsx
if (wrap) if (wrap)
{ {
// scan previous chars // scan previous chars
for (int j = i - 1, nb_chars = 0; j > 0; j--, nb_chars++) for (usz j = i - 1, nb_chars = 0; j > 0; j--, nb_chars++)
{ {
if (text[j] == '\n') if (text[j] == '\n')
break; break;
@ -428,7 +428,7 @@ namespace rsx
return result; return result;
} }
std::pair<f32, f32> font::get_char_offset(const char32_t* text, u16 max_length, u16 max_width, bool wrap) std::pair<f32, f32> font::get_char_offset(const char32_t* text, usz max_length, u16 max_width, bool wrap)
{ {
std::vector<vertex> unused; std::vector<vertex> unused;
f32 loc_x, loc_y; f32 loc_x, loc_y;

View file

@ -73,11 +73,11 @@ namespace rsx
stbtt_aligned_quad get_char(char32_t c, f32& x_advance, f32& y_advance); stbtt_aligned_quad get_char(char32_t c, f32& x_advance, f32& y_advance);
void render_text_ex(std::vector<vertex>& result, f32& x_advance, f32& y_advance, const char32_t* text, u32 char_limit, u16 max_width, bool wrap); void render_text_ex(std::vector<vertex>& result, f32& x_advance, f32& y_advance, const char32_t* text, usz char_limit, u16 max_width, bool wrap);
std::vector<vertex> render_text(const char32_t* text, u16 max_width = -1, bool wrap = false); std::vector<vertex> render_text(const char32_t* text, u16 max_width = -1, bool wrap = false);
std::pair<f32, f32> get_char_offset(const char32_t* text, u16 max_length, u16 max_width = -1, bool wrap = false); std::pair<f32, f32> get_char_offset(const char32_t* text, usz max_length, u16 max_width = -1, bool wrap = false);
bool matches(const char* name, int size) const { return font_name == name && static_cast<int>(size_pt) == size; } bool matches(const char* name, int size) const { return font_name == name && static_cast<int>(size_pt) == size; }
std::string_view get_name() const { return font_name; } std::string_view get_name() const { return font_name; }

View file

@ -280,7 +280,7 @@ namespace rsx
} }
else else
{ {
m_preview.caret_position = ::narrow<u16>(m_preview.value.length()); m_preview.caret_position = m_preview.value.length();
m_preview.fore_color.a = 1.f; m_preview.fore_color.a = 1.f;
} }
@ -593,7 +593,7 @@ namespace rsx
// Append to output text // Append to output text
if (m_preview.value.empty()) if (m_preview.value.empty())
{ {
m_preview.caret_position = ::narrow<u16>(str.length()); m_preview.caret_position = str.length();
m_preview.set_unicode_text(str); m_preview.set_unicode_text(str);
} }
else else

View file

@ -50,7 +50,7 @@ bool serialize<rsx::frame_capture_data>(utils::serial& ar, rsx::frame_capture_da
{ {
ar(o.magic, o.version, o.LE_format); ar(o.magic, o.version, o.LE_format);
if (o.magic != rsx::c_fc_magic || o.version != rsx::c_fc_version || o.LE_format != (std::endian::little == std::endian::native)) if (o.magic != rsx::c_fc_magic || o.version != rsx::c_fc_version || o.LE_format != u32{std::endian::little == std::endian::native})
{ {
return false; return false;
} }

View file

@ -398,7 +398,7 @@ bool Emulator::BootRsxCapture(const std::string& path)
return false; return false;
} }
if (frame->LE_format != (std::endian::little == std::endian::native)) if (frame->LE_format != u32{std::endian::little == std::endian::native})
{ {
static constexpr std::string_view machines[2]{"Big-Endian", "Little-Endian"}; static constexpr std::string_view machines[2]{"Big-Endian", "Little-Endian"};
@ -669,8 +669,8 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
{ {
// Update supplementary settings // Update supplementary settings
const f64 _1ns = utils::get_tsc_freq() / 1000'000'000.; const f64 _1ns = utils::get_tsc_freq() / 1000'000'000.;
g_rtm_tx_limit1 = g_cfg.core.tx_limit1_ns * _1ns; g_rtm_tx_limit1 = static_cast<u64>(g_cfg.core.tx_limit1_ns * _1ns);
g_rtm_tx_limit2 = g_cfg.core.tx_limit2_ns * _1ns; g_rtm_tx_limit2 = static_cast<u64>(g_cfg.core.tx_limit2_ns * _1ns);
} }
// Load patches from different locations // Load patches from different locations

View file

@ -138,7 +138,7 @@ void progress_dialog_server::operator()()
// Assume not all programs were found if files were not compiled (as it may contain more) // Assume not all programs were found if files were not compiled (as it may contain more)
const u64 total = std::max<u64>(ptotal, 1) * std::max<u64>(ftotal, 1); const u64 total = std::max<u64>(ptotal, 1) * std::max<u64>(ftotal, 1);
const u64 done = pdone * std::max<u64>(fdone, 1); const u64 done = pdone * std::max<u64>(fdone, 1);
const double value = std::fmin(done * 100. / total, 100.); const f32 value = static_cast<f32>(std::fmin(done * 100. / total, 100.f));
std::string progr = "Progress:"; std::string progr = "Progress:";
@ -160,7 +160,7 @@ void progress_dialog_server::operator()()
{ {
dlg->SetMsg(text_new); dlg->SetMsg(text_new);
dlg->ProgressBarSetMsg(0, progr); dlg->ProgressBarSetMsg(0, progr);
dlg->ProgressBarSetValue(0, std::floor(value)); dlg->ProgressBarSetValue(0, static_cast<u32>(std::floor(value)));
}); });
} }
} }

View file

@ -130,7 +130,7 @@ namespace utils
{ {
const AVStream* stream = av_format_ctx->streams[video_stream_index]; const AVStream* stream = av_format_ctx->streams[video_stream_index];
info.video_av_codec_id = stream->codecpar->codec_id; info.video_av_codec_id = stream->codecpar->codec_id;
info.video_bitrate_bps = stream->codecpar->bit_rate; info.video_bitrate_bps = static_cast<s32>(stream->codecpar->bit_rate);
} }
// Get audio info if available // Get audio info if available
@ -138,7 +138,7 @@ namespace utils
{ {
const AVStream* stream = av_format_ctx->streams[audio_stream_index]; const AVStream* stream = av_format_ctx->streams[audio_stream_index];
info.audio_av_codec_id = stream->codecpar->codec_id; info.audio_av_codec_id = stream->codecpar->codec_id;
info.audio_bitrate_bps = stream->codecpar->bit_rate; info.audio_bitrate_bps = static_cast<s32>(stream->codecpar->bit_rate);
info.sample_rate = stream->codecpar->sample_rate; info.sample_rate = stream->codecpar->sample_rate;
} }