mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-31 20:41:45 +01:00
Explicitly cast size_t to integer types
This commit is contained in:
parent
146e43b6ec
commit
d57124d075
@ -1460,8 +1460,9 @@ const std::string& fs::get_config_dir()
|
||||
|
||||
#ifdef _WIN32
|
||||
wchar_t buf[32768];
|
||||
if (GetEnvironmentVariable(L"RPCS3_CONFIG_DIR", buf, std::size(buf)) - 1 >= std::size(buf) - 1 &&
|
||||
GetModuleFileName(NULL, buf, std::size(buf)) - 1 >= std::size(buf) - 1)
|
||||
constexpr DWORD size = static_cast<DWORD>(std::size(buf));
|
||||
if (GetEnvironmentVariable(L"RPCS3_CONFIG_DIR", buf, size) - 1 >= size - 1 &&
|
||||
GetModuleFileName(NULL, buf, size) - 1 >= size - 1)
|
||||
{
|
||||
MessageBoxA(0, fmt::format("GetModuleFileName() failed: error %u.", GetLastError()).c_str(), "fs::get_config_dir()", MB_ICONERROR);
|
||||
return dir; // empty
|
||||
|
@ -442,7 +442,7 @@ s32 cellGemGetAllTrackableHues(vm::ptr<u8> hues)
|
||||
return CELL_GEM_ERROR_UNINITIALIZED;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < 360; i++)
|
||||
for (u32 i = 0; i < 360; i++)
|
||||
{
|
||||
hues[i] = true;
|
||||
}
|
||||
@ -960,7 +960,7 @@ s32 cellGemTrackHues(vm::cptr<u32> req_hues, vm::ptr<u32> res_hues)
|
||||
return CELL_GEM_ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < CELL_GEM_MAX_NUM; i++)
|
||||
for (u32 i = 0; i < CELL_GEM_MAX_NUM; i++)
|
||||
{
|
||||
if (req_hues[i] == CELL_GEM_DONT_CARE_HUE)
|
||||
{
|
||||
|
@ -26,11 +26,11 @@ s32 cellHttpUtilParseUri(vm::ptr<CellHttpUri> uri, vm::cptr<char> str, vm::ptr<v
|
||||
std::string password = URL.m_Password;
|
||||
|
||||
u32 schemeOffset = 0;
|
||||
u32 hostOffset = scheme.length() + 1;
|
||||
u32 pathOffset = hostOffset + host.length() + 1;
|
||||
u32 usernameOffset = pathOffset + path.length() + 1;
|
||||
u32 passwordOffset = usernameOffset + username.length() + 1;
|
||||
u32 totalSize = passwordOffset + password.length() + 1;
|
||||
u32 hostOffset = ::size32(scheme) + 1;
|
||||
u32 pathOffset = hostOffset + ::size32(host) + 1;
|
||||
u32 usernameOffset = pathOffset + ::size32(path) + 1;
|
||||
u32 passwordOffset = usernameOffset + ::size32(username) + 1;
|
||||
u32 totalSize = passwordOffset + ::size32(password) + 1;
|
||||
|
||||
//called twice, first to setup pool, then to populate.
|
||||
if (!uri)
|
||||
|
@ -224,7 +224,7 @@ s32 _ConvertStr(s32 src_code, const void *src, s32 src_len, s32 dst_code, void *
|
||||
if (target.length() > *dst_len) return DSTExhausted;
|
||||
memcpy(dst, target.c_str(), target.length());
|
||||
}
|
||||
*dst_len = target.length();
|
||||
*dst_len = ::narrow<s32>(target.size());
|
||||
|
||||
return ConversionOK;
|
||||
#else
|
||||
|
@ -465,7 +465,7 @@ s32 pngDecOpen(ppu_thread& ppu, PHandle handle, PPStream png_stream, PSrc source
|
||||
}
|
||||
|
||||
// We must indicate, that we allocated more memory
|
||||
open_info->initSpaceAllocated += sizeof(PngBuffer);
|
||||
open_info->initSpaceAllocated += u32{sizeof(PngBuffer)};
|
||||
|
||||
if (source->srcSelect == CELL_PNGDEC_BUFFER)
|
||||
{
|
||||
@ -724,7 +724,7 @@ s32 pngDecodeData(ppu_thread& ppu, PHandle handle, PStream stream, vm::ptr<u8> d
|
||||
|
||||
stream->cbDispParam->nextOutputImage = disp_param->nextOutputImage;
|
||||
|
||||
streamInfo->decodedStrmSize = stream->buffer->cursor;
|
||||
streamInfo->decodedStrmSize = ::narrow<u32>(stream->buffer->cursor);
|
||||
// push the rest of the buffer we have
|
||||
if (stream->buffer->length > stream->buffer->cursor)
|
||||
{
|
||||
@ -738,7 +738,7 @@ s32 pngDecodeData(ppu_thread& ppu, PHandle handle, PStream stream, vm::ptr<u8> d
|
||||
freeMem();
|
||||
return CELL_PNGDEC_ERROR_FATAL;
|
||||
}
|
||||
streamInfo->decodedStrmSize = stream->buffer->length;
|
||||
streamInfo->decodedStrmSize = ::narrow<u32>(stream->buffer->length);
|
||||
}
|
||||
|
||||
// todo: commandPtr
|
||||
|
@ -451,7 +451,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||
}
|
||||
case CELL_SAVEDATA_FOCUSPOS_LISTTAIL:
|
||||
{
|
||||
focused = save_entries.size() - 1;
|
||||
focused = ::size32(save_entries) - 1;
|
||||
break;
|
||||
}
|
||||
case CELL_SAVEDATA_FOCUSPOS_LATEST:
|
||||
@ -512,7 +512,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
|
||||
{
|
||||
if (!file.is_directory)
|
||||
{
|
||||
doneGet->sizeKB += ::align(file.size, 4096);
|
||||
doneGet->sizeKB += static_cast<s32>(::align(file.size, 4096));
|
||||
|
||||
if (!fs::remove_file(del_path + file.name))
|
||||
{
|
||||
|
@ -349,7 +349,7 @@ error_code _sys_prx_get_module_info(u32 id, u64 flags, vm::ptr<sys_prx_module_in
|
||||
pOpt->info->modattribute = prx->module_info_attributes;
|
||||
pOpt->info->start_entry = prx->start.addr();
|
||||
pOpt->info->stop_entry = prx->stop.addr();
|
||||
pOpt->info->all_segments_num = prx->segs.size();
|
||||
pOpt->info->all_segments_num = ::size32(prx->segs);
|
||||
if (pOpt->info->filename)
|
||||
{
|
||||
std::strncpy(pOpt->info->filename.get_ptr(), prx->name.c_str(), pOpt->info->filename_size);
|
||||
|
@ -257,7 +257,7 @@ error_code sys_spu_thread_initialize(vm::ptr<u32> thread, u32 group_id, u32 spu_
|
||||
|
||||
if (++group->init == group->max_num)
|
||||
{
|
||||
if (g_cfg.core.max_spurs_threads < 6 && group->max_num > g_cfg.core.max_spurs_threads)
|
||||
if (g_cfg.core.max_spurs_threads < 6 && group->max_num > 0u + g_cfg.core.max_spurs_threads)
|
||||
{
|
||||
if (group->name.size() >= 20 && group->name.compare(group->name.size() - 20, 20, "CellSpursKernelGroup", 20) == 0)
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ s32 sys_usbd_get_device_list(u32 handle, vm::ptr<DeviceListUnknownDataType> devi
|
||||
{
|
||||
device_list[i] = devices[i].basicDevice;
|
||||
}
|
||||
return devices.size();
|
||||
return ::size32(devices);
|
||||
}
|
||||
|
||||
s32 sys_usbd_register_extra_ldd(u32 handle, vm::ptr<void> lddOps, u16 strLen, u16 vendorID, u16 productID, u16 unk1)
|
||||
|
@ -308,7 +308,7 @@ public:
|
||||
|
||||
m_arb_shader += fmt::format("#%d ", i) + param_type + param_name + param_semantic + param_const + "\n";
|
||||
|
||||
offset += sizeof(CgBinaryParameter);
|
||||
offset += u32{sizeof(CgBinaryParameter)};
|
||||
}
|
||||
|
||||
m_arb_shader += "\n";
|
||||
@ -324,7 +324,7 @@ public:
|
||||
|
||||
size_t size = f.size();
|
||||
vm::init();
|
||||
ptr = vm::alloc(size, vm::main);
|
||||
ptr = vm::alloc(static_cast<u32>(size), vm::main);
|
||||
f.read(vm::base(ptr), size);
|
||||
}
|
||||
|
||||
@ -365,7 +365,7 @@ public:
|
||||
|
||||
m_arb_shader += fmt::format("#%d ", i) + param_type + param_name + param_semantic + param_const + "\n";
|
||||
|
||||
offset += sizeof(CgBinaryParameter);
|
||||
offset += u32{sizeof(CgBinaryParameter)};
|
||||
}
|
||||
|
||||
m_arb_shader += "\n";
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
tar_object::tar_object(const fs::file& file, size_t offset)
|
||||
: m_file(file)
|
||||
, initial_offset(offset)
|
||||
, initial_offset(static_cast<int>(offset))
|
||||
{
|
||||
m_file.seek(initial_offset);
|
||||
largest_offset = initial_offset;
|
||||
|
@ -22,7 +22,7 @@ void basic_keyboard_handler::Init(const u32 max_connect)
|
||||
LoadSettings();
|
||||
memset(&m_info, 0, sizeof(KbInfo));
|
||||
m_info.max_connect = max_connect;
|
||||
m_info.now_connect = std::min<size_t>(m_keyboards.size(), max_connect);
|
||||
m_info.now_connect = std::min(::size32(m_keyboards), max_connect);
|
||||
m_info.info = 0; // Ownership of keyboard data: 0=Application, 1=System
|
||||
m_info.status[0] = CELL_KB_STATUS_CONNECTED; // (TODO: Support for more keyboards)
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ void basic_mouse_handler::Init(const u32 max_connect)
|
||||
m_mice.emplace_back(Mouse());
|
||||
memset(&m_info, 0, sizeof(MouseInfo));
|
||||
m_info.max_connect = max_connect;
|
||||
m_info.now_connect = std::min(m_mice.size(), (size_t)max_connect);
|
||||
m_info.now_connect = std::min(::size32(m_mice), max_connect);
|
||||
m_info.info = 0; // Ownership of mouse data: 0=Application, 1=System
|
||||
for (u32 i = 1; i < max_connect; i++)
|
||||
{
|
||||
|
@ -1265,7 +1265,7 @@ void game_list_frame::BatchRemovePPUCaches()
|
||||
{
|
||||
serials.emplace(game->info.serial);
|
||||
}
|
||||
const u32 total = serials.size();
|
||||
const u32 total = ::size32(serials);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
@ -1307,7 +1307,7 @@ void game_list_frame::BatchRemoveSPUCaches()
|
||||
{
|
||||
serials.emplace(game->info.serial);
|
||||
}
|
||||
const u32 total = serials.size();
|
||||
const u32 total = ::size32(serials);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
@ -1352,7 +1352,7 @@ void game_list_frame::BatchRemoveCustomConfigurations()
|
||||
serials.emplace(game->info.serial);
|
||||
}
|
||||
}
|
||||
const u32 total = serials.size();
|
||||
const u32 total = ::size32(serials);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
@ -1398,7 +1398,7 @@ void game_list_frame::BatchRemoveCustomPadConfigurations()
|
||||
serials.emplace(game->info.serial);
|
||||
}
|
||||
}
|
||||
const u32 total = serials.size();
|
||||
const u32 total = ::size32(serials);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
@ -1441,7 +1441,7 @@ void game_list_frame::BatchRemoveShaderCaches()
|
||||
{
|
||||
serials.emplace(game->info.serial);
|
||||
}
|
||||
const u32 total = serials.size();
|
||||
const u32 total = ::size32(serials);
|
||||
|
||||
if (total == 0)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user