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

Fix -Wsign-compare a little bit

Explicitly mark loop types (per review)
This commit is contained in:
JohnHolmesII 2019-05-21 20:47:47 -07:00 committed by Nekotekina
parent 22917084d9
commit d0eae7bab1
6 changed files with 12 additions and 10 deletions

View File

@ -589,4 +589,4 @@ namespace std {
return (size_t{ k.start } << 32) | size_t{ k.end };
}
};
}
}

View File

@ -7,6 +7,8 @@
#include <vector>
#include <algorithm>
static const size_t size_dropped = std::numeric_limits<size_t>::max();
/*
C-style format parser. Appends formatted string to `out`, returns number of characters written.
`out`: mutable reference to std::string, std::vector<char> or other compatible container
@ -41,7 +43,7 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
const auto drop_sequence = [&]
{
out.insert(out.end(), fmt - ctx.size, fmt);
ctx.size = -1;
ctx.size = size_dropped;
};
const auto read_decimal = [&](uint result) -> uint
@ -112,7 +114,7 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
ctx = {0};
out.push_back(ch);
}
else if (ctx.size == -1)
else if (ctx.size == size_dropped)
{
out.push_back(ch);
}
@ -626,7 +628,7 @@ std::size_t cfmt_append(Dst& out, const Char* fmt, Src&& src)
}
// Handle unfinished sequence
if (ctx.size && ctx.size != -1)
if (ctx.size && ctx.size != size_dropped)
{
fmt--, drop_sequence();
}

View File

@ -32,7 +32,7 @@ statichle_handler::~statichle_handler()
bool statichle_handler::load_patterns()
{
for (int i = 0; i < shle_patterns_list.size(); i++)
for (u32 i = 0; i < shle_patterns_list.size(); i++)
{
auto& pattern = shle_patterns_list[i];
@ -77,7 +77,7 @@ bool statichle_handler::load_patterns()
return (hv << 4) | lv;
};
for (int j = 0; j < 32; j++)
for (u32 j = 0; j < 32; j++)
dapat.start_pattern[j] = char_to_u8(pattern[0][j * 2], pattern[0][(j * 2) + 1]);
dapat.crc16_length = char_to_u8(pattern[1][0], pattern[1][1]);

View File

@ -428,7 +428,7 @@ next:
if (adecIsAtracX(adec.type) && !adec.reader.init)
{
OMAHeader oma(1 /* atrac3p id */, adec.sample_rate, adec.ch_cfg, adec.frame_size);
if (buf_size < sizeof(oma))
if (buf_size + 0u < sizeof(oma))
{
cellAdec.error("adecRead(): OMAHeader writing failed");
Emu.Pause();

View File

@ -410,7 +410,7 @@ s32 jstrnchk(vm::cptr<u8> src, s32 src_len)
{
u8 r = 0;
for (u32 len = 0; len < src_len; len++)
for (s32 len = 0; len < src_len; len++)
{
if (src != vm::null)
{

View File

@ -769,9 +769,9 @@ s32 pngDecodeData(ppu_thread& ppu, PHandle handle, PStream stream, vm::ptr<u8> d
// todo: commandptr
try
{
for (int j = 0; j < stream->passes; j++)
for (u32 j = 0; j < stream->passes; j++)
{
for (int i = 0; i < stream->out_param.outputHeight; ++i)
for (u32 i = 0; i < stream->out_param.outputHeight; ++i)
{
const u32 line = flip ? stream->out_param.outputHeight - i - 1 : i;
png_read_row(stream->png_ptr, &data[line*bytes_per_line], nullptr);