mirror of
https://github.com/ARMSX2/ARMSX3.git
synced 2026-08-24 16:58:52 -07:00
fix some warnings
This commit is contained in:
Vendored
+1
@@ -198,6 +198,7 @@
|
||||
<PreprocessorDefinitions>ASMJIT_STATIC;ASMJIT_NO_DEPRECATED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
|
||||
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">TurnOffAllWarnings</WarningLevel>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
||||
Vendored
+1
-1
@@ -47,7 +47,7 @@
|
||||
<PreprocessorDefinitions>HAVE_SNI;NDEBUG;BUILDING_LIBCURL;CURL_STATICLIB;USE_WOLFSSL;NO_MD4;WOLFSSL_USER_SETTINGS;USE_IPV6;SIZEOF_LONG=4;SIZEOF_LONG_LONG=8;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
||||
@@ -25,9 +25,13 @@
|
||||
#define HAVE_ONE_TIME_AUTH
|
||||
#define HAVE_CHACHA
|
||||
#define HAVE_HASHDRBG
|
||||
#ifndef HAVE_SNI
|
||||
#define HAVE_SNI
|
||||
#endif
|
||||
#define HAVE_ENCRYPT_THEN_MAC
|
||||
#ifndef NO_MD4
|
||||
#define NO_MD4
|
||||
#endif
|
||||
#define WC_NO_ASYNC_THREADING
|
||||
#define WC_NO_HARDEN
|
||||
#define HAVE_WRITE_DUP
|
||||
|
||||
Vendored
+1
-1
@@ -66,7 +66,7 @@
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
@@ -50,6 +50,17 @@ namespace cfg
|
||||
return false;
|
||||
}
|
||||
|
||||
bool _base::save(std::string_view cfg_name) const
|
||||
{
|
||||
if (fs::pending_file cfg_file(cfg_name); !!cfg_file.file)
|
||||
{
|
||||
cfg_file.file.write(to_string());
|
||||
return cfg_file.commit();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Emit YAML
|
||||
static void encode(YAML::Emitter& out, const class _base& rhs);
|
||||
|
||||
|
||||
@@ -101,6 +101,8 @@ namespace cfg
|
||||
|
||||
// Set multiple values. Implementation-specific, optional.
|
||||
virtual bool from_list(std::vector<std::string>&&);
|
||||
|
||||
bool save(std::string_view cfg_name) const;
|
||||
};
|
||||
|
||||
// Config tree node which contains another nodes
|
||||
|
||||
@@ -227,10 +227,17 @@ namespace fs
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4646)
|
||||
#endif
|
||||
[[noreturn]] stat_t file_base::get_stat()
|
||||
{
|
||||
fmt::throw_exception("fs::file::get_stat() not supported.");
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
void file_base::sync()
|
||||
{
|
||||
|
||||
+4
-2
@@ -495,7 +495,8 @@ namespace fs
|
||||
{
|
||||
std::basic_string<T> result;
|
||||
result.resize(size() / sizeof(T));
|
||||
if (seek(0), !read(result, result.size(), file, func, line, col)) xfail({line, col, file, func});
|
||||
seek(0);
|
||||
if (!read(result, result.size(), file, func, line, col)) xfail({line, col, file, func});
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -509,7 +510,8 @@ namespace fs
|
||||
{
|
||||
std::vector<T> result;
|
||||
result.resize(size() / sizeof(T));
|
||||
if (seek(0), !read(result, result.size(), file, func, line, col)) xfail({line, col, file, func});
|
||||
seek(0);
|
||||
if (!read(result, result.size(), file, func, line, col)) xfail({line, col, file, func});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
+13
-6
@@ -21,9 +21,10 @@ std::string wchar_to_utf8(std::wstring_view src)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
std::string utf8_string;
|
||||
const auto tmp_size = WideCharToMultiByte(CP_UTF8, 0, src.data(), src.size(), nullptr, 0, nullptr, nullptr);
|
||||
const int size = ::narrow<int>(src.size());
|
||||
const auto tmp_size = WideCharToMultiByte(CP_UTF8, 0, src.data(), size, nullptr, 0, nullptr, nullptr);
|
||||
utf8_string.resize(tmp_size);
|
||||
WideCharToMultiByte(CP_UTF8, 0, src.data(), src.size(), utf8_string.data(), tmp_size, nullptr, nullptr);
|
||||
WideCharToMultiByte(CP_UTF8, 0, src.data(), size, utf8_string.data(), tmp_size, nullptr, nullptr);
|
||||
return utf8_string;
|
||||
#else
|
||||
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converter{};
|
||||
@@ -31,7 +32,10 @@ std::string wchar_to_utf8(std::wstring_view src)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4996)
|
||||
#else
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
@@ -46,7 +50,9 @@ std::u16string utf8_to_utf16(std::string_view src)
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> converter{};
|
||||
return converter.from_bytes(src.data());
|
||||
}
|
||||
#ifndef _MSC_VER
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#else
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
@@ -54,9 +60,10 @@ std::wstring utf8_to_wchar(std::string_view src)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
std::wstring wchar_string;
|
||||
const auto tmp_size = MultiByteToWideChar(CP_UTF8, 0, src.data(), src.size(), nullptr, 0);
|
||||
const int size = ::narrow<int>(src.size());
|
||||
const auto tmp_size = MultiByteToWideChar(CP_UTF8, 0, src.data(), size, nullptr, 0);
|
||||
wchar_string.resize(tmp_size);
|
||||
MultiByteToWideChar(CP_UTF8, 0, src.data(), src.size(), wchar_string.data(), tmp_size);
|
||||
MultiByteToWideChar(CP_UTF8, 0, src.data(), size, wchar_string.data(), tmp_size);
|
||||
return wchar_string;
|
||||
#else
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t> converter{};
|
||||
|
||||
@@ -1031,12 +1031,12 @@ static usz apply_modification(std::basic_string<u32>& applied, patch_engine::pat
|
||||
}
|
||||
case patch_type::utf8:
|
||||
{
|
||||
memory_size = p.original_value.size();
|
||||
memory_size = ::size32(p.original_value);
|
||||
break;
|
||||
}
|
||||
case patch_type::c_utf8:
|
||||
{
|
||||
memory_size = utils::add_saturate<u32>(p.original_value.size(), 1);
|
||||
memory_size = utils::add_saturate<u32>(::size32(p.original_value), 1);
|
||||
break;
|
||||
}
|
||||
case patch_type::move_file:
|
||||
|
||||
@@ -942,10 +942,9 @@ void generate_subkey(aes_context *ctx, unsigned char *K1, unsigned char *K2)
|
||||
}
|
||||
}
|
||||
|
||||
void padding (unsigned char *lastb, unsigned char *pad, int length)
|
||||
void padding(unsigned char *lastb, unsigned char *pad, size_t length)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 16; i++)
|
||||
for (unsigned int i = 0; i < 16; i++)
|
||||
{
|
||||
if (i < length)
|
||||
pad[i] = lastb[i];
|
||||
@@ -956,14 +955,14 @@ void padding (unsigned char *lastb, unsigned char *pad, int length)
|
||||
}
|
||||
}
|
||||
|
||||
void aes_cmac(aes_context *ctx, int length, unsigned char *input, unsigned char *output)
|
||||
void aes_cmac(aes_context *ctx, size_t length, unsigned char *input, unsigned char *output)
|
||||
{
|
||||
unsigned char X[16], Y[16], M_last[16], padded[16];
|
||||
unsigned char K1[16], K2[16];
|
||||
int n, i, flag;
|
||||
int i, flag;
|
||||
generate_subkey(ctx, K1, K2);
|
||||
|
||||
n = (length + 15) / 16;
|
||||
size_t n = (length + 15) / 16;
|
||||
if (n == 0)
|
||||
{
|
||||
n = 1;
|
||||
@@ -984,7 +983,7 @@ void aes_cmac(aes_context *ctx, int length, unsigned char *input, unsigned char
|
||||
}
|
||||
|
||||
for (i = 0; i < 16; i++) X[i] = 0;
|
||||
for (i = 0; i < n - 1; i++)
|
||||
for (size_t i = 0; i < n - 1; i++)
|
||||
{
|
||||
xor_128(X, &input[16*i], Y);
|
||||
aes_crypt_ecb(ctx, AES_ENCRYPT, Y, X);
|
||||
|
||||
+1
-1
@@ -172,7 +172,7 @@ int aes_crypt_ctr( aes_context *ctx,
|
||||
const unsigned char *input,
|
||||
unsigned char *output );
|
||||
|
||||
void aes_cmac(aes_context *ctx, int length, unsigned char *input, unsigned char *output);
|
||||
void aes_cmac(aes_context *ctx, size_t length, unsigned char *input, unsigned char *output);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ void generate_hash(int hash_mode, int version, unsigned char *hash_final, unsign
|
||||
};
|
||||
}
|
||||
|
||||
bool decrypt(int hash_mode, int crypto_mode, int version, unsigned char *in, unsigned char *out, int length, unsigned char *key, unsigned char *iv, unsigned char *hash, unsigned char *test_hash)
|
||||
bool decrypt(int hash_mode, int crypto_mode, int version, unsigned char *in, unsigned char *out, usz length, unsigned char *key, unsigned char *iv, unsigned char *hash, unsigned char *test_hash)
|
||||
{
|
||||
// Setup buffers for key, iv and hash.
|
||||
unsigned char key_final[0x10] = {};
|
||||
|
||||
@@ -176,7 +176,7 @@ inline struct ppu_frsqrte_lut_t
|
||||
|
||||
if (expv == 0) // ±INF on zero/denormal, not accurate
|
||||
{
|
||||
data[i] = 0x7ff0'0000 | (sign << 31);
|
||||
data[i] = static_cast<u32>(0x7ff0'0000 | (sign << 31));
|
||||
}
|
||||
else if (expv == 0x7ff)
|
||||
{
|
||||
@@ -194,7 +194,7 @@ inline struct ppu_frsqrte_lut_t
|
||||
// ((MAN_BITS(b) >> 49) & 7ull) + (!(EXP_BITS(b) & 1) << 3)
|
||||
const u64 idx = 8 ^ (i & 0xf);
|
||||
|
||||
data[i] = ppu_frsqrte_mantissas[idx] | exp;
|
||||
data[i] = static_cast<u32>(ppu_frsqrte_mantissas[idx] | exp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#include "Emu/Cell/lv2/sys_event.h"
|
||||
#include "Emu/IdManager.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
LOG_CHANNEL(cellCamera);
|
||||
|
||||
template <>
|
||||
@@ -326,7 +328,7 @@ u32 get_buffer_size_by_format(s32 format, s32 width, s32 height)
|
||||
break;
|
||||
}
|
||||
|
||||
return width * height * bytes_per_pixel;
|
||||
return ::narrow<u32>(static_cast<u64>(std::ceil(width * height * bytes_per_pixel)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -385,7 +385,7 @@ error_code cellFsGetFreeSize(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<u32>
|
||||
}
|
||||
|
||||
*block_count = *avail / *_block_size;
|
||||
*block_size = *_block_size;
|
||||
*block_size = ::narrow<u32>(*_block_size);
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
|
||||
@@ -141,7 +141,7 @@ static u32 ppu_test(const be_t<u32>* ptr, const void* fend, ppu_pattern_array pa
|
||||
cur++;
|
||||
}
|
||||
|
||||
return (cur - ptr) * sizeof(*ptr);
|
||||
return ::narrow<u32>((cur - ptr) * sizeof(*ptr));
|
||||
}
|
||||
|
||||
static u32 ppu_test(const be_t<u32>* ptr, const void* fend, ppu_pattern_matrix pats)
|
||||
@@ -2041,7 +2041,7 @@ bool ppu_module::analyse(u32 lib_toc, u32 entry, const u32 sec_end, const std::b
|
||||
|
||||
if (per_instruction_bytes)
|
||||
{
|
||||
const bool error = per_instruction_bytes >= 200 && per_instruction_bytes / 4 >= utils::aligned_div<u32>(funcs.size(), 128);
|
||||
const bool error = per_instruction_bytes >= 200 && per_instruction_bytes / 4 >= utils::aligned_div<u32>(::size32(funcs), 128);
|
||||
(error ? ppu_log.error : ppu_log.notice)("%d instructions will be compiled on per-instruction basis in total", per_instruction_bytes / 4);
|
||||
}
|
||||
|
||||
|
||||
@@ -1148,7 +1148,7 @@ static void ppu_check_patch_spu_images(const ppu_module& mod, const ppu_segment&
|
||||
|
||||
for (usz addr_last = 0, valid_count = 0, invalid_count = 0;;)
|
||||
{
|
||||
usz instruction = ls_segment.find("\x24\0\x40\x80"sv, addr_last);
|
||||
const usz instruction = ls_segment.find("\x24\0\x40\x80"sv, addr_last);
|
||||
|
||||
if (instruction != umax)
|
||||
{
|
||||
@@ -1161,7 +1161,7 @@ static void ppu_check_patch_spu_images(const ppu_module& mod, const ppu_segment&
|
||||
|
||||
// FIXME: This seems to terminate SPU code prematurely in some cases
|
||||
// Likely due to absolute branches
|
||||
if (spu_thread::is_exec_code(instruction, {reinterpret_cast<const u8*>(ls_segment.data()), ls_segment.size()}, 0))
|
||||
if (spu_thread::is_exec_code(::narrow<u32>(instruction), {reinterpret_cast<const u8*>(ls_segment.data()), ls_segment.size()}, 0))
|
||||
{
|
||||
addr_last = instruction + 4;
|
||||
valid_count++;
|
||||
@@ -1183,7 +1183,7 @@ static void ppu_check_patch_spu_images(const ppu_module& mod, const ppu_segment&
|
||||
if (addr_last >= 0x80 && valid_count >= 2)
|
||||
{
|
||||
const u32 begin = i & -128;
|
||||
u32 end = std::min<u32>(seg.size, utils::align<u32>(i + addr_last + 256, 128));
|
||||
u32 end = std::min<u32>(seg.size, utils::align<u32>(::narrow<u32>(i + addr_last + 256), 128));
|
||||
|
||||
u32 guessed_ls_addr = 0;
|
||||
|
||||
@@ -1738,7 +1738,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, bool virtual_lo
|
||||
};
|
||||
|
||||
// Access library information (TODO)
|
||||
const auto lib_info = ensure(prx->get_ptr<const ppu_prx_library_info>(prx->segs[0].addr + elf.progs[0].p_paddr - elf.progs[0].p_offset));
|
||||
const auto lib_info = ensure(prx->get_ptr<const ppu_prx_library_info>(::narrow<u32>(prx->segs[0].addr + elf.progs[0].p_paddr - elf.progs[0].p_offset)));
|
||||
const std::string lib_name = lib_info->name;
|
||||
|
||||
strcpy_trunc(prx->module_info_name, lib_name);
|
||||
@@ -1749,7 +1749,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, bool virtual_lo
|
||||
prx->exports_start = lib_info->exports_start;
|
||||
prx->exports_end = lib_info->exports_end;
|
||||
|
||||
for (usz start = prx->exports_start, size = 0;; size++)
|
||||
for (u32 start = prx->exports_start, size = 0;; size++)
|
||||
{
|
||||
if (start >= prx->exports_end)
|
||||
{
|
||||
@@ -2612,7 +2612,7 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str
|
||||
|
||||
ensure(ppu->stack_size > stack_alloc_size);
|
||||
|
||||
vm::ptr<u64> args = vm::cast(static_cast<u32>(ppu->stack_addr + ppu->stack_size - stack_alloc_size - utils::align<u32>(Emu.data.size(), 0x10)));
|
||||
vm::ptr<u64> args = vm::cast(static_cast<u32>(ppu->stack_addr + ppu->stack_size - stack_alloc_size - utils::align<u32>(::size32(Emu.data), 0x10)));
|
||||
vm::ptr<u8> args_data = vm::cast(args.addr() + pointers_storage_size);
|
||||
|
||||
const vm::ptr<u64> argv = args;
|
||||
|
||||
@@ -1342,12 +1342,12 @@ void ppu_thread::dump_regs(std::string& ret, std::any& custom_data) const
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (is_exec_code(reg))
|
||||
else if (is_exec_code(static_cast<u32>(reg)))
|
||||
{
|
||||
is_function = true;
|
||||
}
|
||||
|
||||
const auto gpr_buf = vm::get_super_ptr<u8>(reg);
|
||||
const auto gpr_buf = vm::get_super_ptr<u8>(static_cast<u32>(reg));
|
||||
|
||||
std::string buf_tmp(gpr_buf, gpr_buf + max_str_len);
|
||||
|
||||
@@ -1361,7 +1361,7 @@ void ppu_thread::dump_regs(std::string& ret, std::any& custom_data) const
|
||||
}
|
||||
else
|
||||
{
|
||||
dis_asm.disasm(reg);
|
||||
dis_asm.disasm(static_cast<u32>(reg));
|
||||
fmt::append(ret, " -> %s", dis_asm.last_opcode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ void spu_load_rel_exec(const spu_rel_object& elf)
|
||||
ensure(vm::get(vm::spu)->falloc(spu->vm_offset(), SPU_LS_SIZE, &spu->shm, vm::page_size_64k));
|
||||
spu->map_ls(*spu->shm, spu->ls);
|
||||
|
||||
u64 total_memsize = 0;
|
||||
u32 total_memsize = 0;
|
||||
|
||||
// Compute executable data size
|
||||
for (const auto& shdr : elf.shdrs)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user