Fix compiler warnings and size issues

This commit is contained in:
Will Toohey 2020-08-16 16:55:38 +10:00
parent c8ab730524
commit 608f4984c2
4 changed files with 7 additions and 6 deletions

View File

@ -253,7 +253,8 @@ property_t prop_from_file_handle(AVS_FILE f) {
prop_buffer = malloc(memsize);
prop = property_create(flags, prop_buffer, memsize);
if (prop < 0) {
logf("Couldn't create prop (%s)", get_prop_error_str((int32_t)prop));
// double cast to squash truncation warning
logf("Couldn't create prop (%s)", get_prop_error_str((int32_t)(size_t)prop));
goto FAIL;
}

View File

@ -62,7 +62,7 @@ enum compress_type {
UNSUPPORTED_COMPRESS,
};
typedef struct {
typedef struct image {
string name;
string name_md5;
img_format format;
@ -640,7 +640,7 @@ int hook_avs_fs_mount(const char* mountpoint, const char* fsroot, const char* fs
return avs_fs_mount(mountpoint, fsroot, fstype, args);
}
int hook_avs_fs_read(AVS_FILE context, void* bytes, size_t nbytes) {
size_t hook_avs_fs_read(AVS_FILE context, void* bytes, size_t nbytes) {
ramfs_demangler_on_fs_read(context, bytes);
return avs_fs_read(context, bytes, nbytes);
}

View File

@ -9,7 +9,7 @@ AVS_FILE hook_avs_fs_open(const char* name, uint16_t mode, int flags);
int hook_avs_fs_lstat(const char* name, struct avs_stat *st);
int hook_avs_fs_convert_path(char dest_name[256], const char* name);
int hook_avs_fs_mount(const char* mountpoint, const char* fsroot, const char* fstype, const char* flags);
int hook_avs_fs_read(AVS_FILE context, void* bytes, size_t nbytes);
size_t hook_avs_fs_read(AVS_FILE context, void* bytes, size_t nbytes);
extern "C" {
__declspec(dllexport) int init(void);

View File

@ -56,7 +56,7 @@ tsl::htrie_map<char, string> ramfs_map;
tsl::htrie_map<char, string> mangling_map;
void ramfs_demangler_on_fs_open(const std::string& norm_path, AVS_FILE open_result) {
if (open_result < 0) {
if (open_result < 0 || !string_ends_with(norm_path.c_str(), ".ifs")) {
return;
}
@ -115,7 +115,7 @@ void ramfs_demangler_on_fs_mount(const char* mountpoint, const char* fsroot, con
return;
}
buffer = (void*)strtoul(baseptr + strlen("base="), NULL, 0);
buffer = (void*)strtoull(baseptr + strlen("base="), NULL, 0);
auto find = ram_load_map.find(buffer);
if (find != ram_load_map.end()) {