mirror of
https://github.com/libretro/RetroArch
synced 2025-01-29 18:32:44 +00:00
Silence a lot of warnings
This commit is contained in:
parent
00f2a8d7ba
commit
e5d4e2ac0a
@ -1891,6 +1891,8 @@ static config_file_t *open_default_config_file(void)
|
||||
|
||||
application_data[0] = conf_path[0] = app_path[0] = '\0';
|
||||
|
||||
(void)path_size;
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
fill_pathname_application_path(app_path, path_size);
|
||||
fill_pathname_resolve_relative(conf_path, app_path,
|
||||
|
@ -164,13 +164,13 @@ size_t utf8cpy(char *d, size_t d_len, const char *s, size_t chars)
|
||||
while (*sb && chars-- > 0)
|
||||
{
|
||||
sb++;
|
||||
while ((*sb&0xC0) == 0x80) sb++;
|
||||
while ((*sb & 0xC0) == 0x80) sb++;
|
||||
}
|
||||
|
||||
if ((size_t)(sb - sb_org) > d_len-1 /* NUL */)
|
||||
{
|
||||
sb = sb_org + d_len-1;
|
||||
while ((*sb&0xC0) == 0x80) sb--;
|
||||
while ((*sb & 0xC0) == 0x80) sb--;
|
||||
}
|
||||
|
||||
memcpy(d, sb_org, sb-sb_org);
|
||||
@ -187,7 +187,7 @@ const char *utf8skip(const char *str, size_t chars)
|
||||
do
|
||||
{
|
||||
strb++;
|
||||
while ((*strb&0xC0)==0x80) strb++;
|
||||
while ((*strb & 0xC0)==0x80) strb++;
|
||||
chars--;
|
||||
} while(chars);
|
||||
return (const char*)strb;
|
||||
@ -218,23 +218,22 @@ static INLINE uint8_t utf8_walkbyte(const char **string)
|
||||
uint32_t utf8_walk(const char **string)
|
||||
{
|
||||
uint8_t first = utf8_walkbyte(string);
|
||||
uint32_t ret;
|
||||
uint32_t ret = 0;
|
||||
|
||||
if (first<128)
|
||||
if (first < 128)
|
||||
return first;
|
||||
|
||||
ret = 0;
|
||||
ret = (ret<<6) | (utf8_walkbyte(string) & 0x3F);
|
||||
ret = (ret << 6) | (utf8_walkbyte(string) & 0x3F);
|
||||
if (first >= 0xE0)
|
||||
ret = (ret<<6) | (utf8_walkbyte(string) & 0x3F);
|
||||
ret = (ret << 6) | (utf8_walkbyte(string) & 0x3F);
|
||||
if (first >= 0xF0)
|
||||
ret = (ret<<6) | (utf8_walkbyte(string) & 0x3F);
|
||||
ret = (ret << 6) | (utf8_walkbyte(string) & 0x3F);
|
||||
|
||||
if (first >= 0xF0)
|
||||
return ret | (first&7)<<18;
|
||||
return ret | (first & 7) << 18;
|
||||
if (first >= 0xE0)
|
||||
return ret | (first&15)<<12;
|
||||
return ret | (first&31)<<6;
|
||||
return ret | (first & 15) << 12;
|
||||
return ret | (first & 31) << 6;
|
||||
}
|
||||
|
||||
static bool utf16_to_char(uint8_t **utf_data,
|
||||
@ -273,17 +272,19 @@ bool utf16_to_char_string(const uint16_t *in, char *s, size_t len)
|
||||
}
|
||||
|
||||
/* Returned pointer MUST be freed by the caller if non-NULL. */
|
||||
static char* mb_to_mb_string_alloc(const char *str, enum CodePage cp_in, enum CodePage cp_out)
|
||||
static char* mb_to_mb_string_alloc(const char *str,
|
||||
enum CodePage cp_in, enum CodePage cp_out)
|
||||
{
|
||||
char *path_buf = NULL;
|
||||
char *path_buf = NULL;
|
||||
wchar_t *path_buf_wide = NULL;
|
||||
int path_buf_len = 0;
|
||||
int path_buf_wide_len = 0;
|
||||
int path_buf_len = 0;
|
||||
int path_buf_wide_len = 0;
|
||||
|
||||
if (!str || !*str)
|
||||
return NULL;
|
||||
|
||||
(void)path_buf;
|
||||
(void)path_buf_wide;
|
||||
(void)path_buf_len;
|
||||
(void)path_buf_wide_len;
|
||||
|
||||
@ -300,45 +301,49 @@ static char* mb_to_mb_string_alloc(const char *str, enum CodePage cp_in, enum Co
|
||||
|
||||
if (path_buf_wide_len)
|
||||
{
|
||||
path_buf_wide = (wchar_t*)calloc(path_buf_wide_len + sizeof(wchar_t), sizeof(wchar_t));
|
||||
path_buf_wide = (wchar_t*)
|
||||
calloc(path_buf_wide_len + sizeof(wchar_t), sizeof(wchar_t));
|
||||
|
||||
if (path_buf_wide)
|
||||
{
|
||||
MultiByteToWideChar(cp_in, 0, str, -1, path_buf_wide, path_buf_wide_len);
|
||||
MultiByteToWideChar(cp_in, 0,
|
||||
str, -1, path_buf_wide, path_buf_wide_len);
|
||||
|
||||
if (*path_buf_wide)
|
||||
{
|
||||
path_buf_len = WideCharToMultiByte(cp_out, 0, path_buf_wide, -1, NULL, 0, NULL, NULL);
|
||||
path_buf_len = WideCharToMultiByte(cp_out, 0,
|
||||
path_buf_wide, -1, NULL, 0, NULL, NULL);
|
||||
|
||||
if (path_buf_len)
|
||||
{
|
||||
path_buf = (char*)calloc(path_buf_len + sizeof(char), sizeof(char));
|
||||
path_buf = (char*)
|
||||
calloc(path_buf_len + sizeof(char), sizeof(char));
|
||||
|
||||
if (path_buf)
|
||||
{
|
||||
WideCharToMultiByte(cp_out, 0, path_buf_wide, -1, path_buf, path_buf_len, NULL, NULL);
|
||||
WideCharToMultiByte(cp_out, 0,
|
||||
path_buf_wide, -1, path_buf,
|
||||
path_buf_len, NULL, NULL);
|
||||
|
||||
free(path_buf_wide);
|
||||
|
||||
if (*path_buf)
|
||||
return path_buf;
|
||||
else
|
||||
{
|
||||
free(path_buf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
free(path_buf);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (path_buf_wide)
|
||||
free(path_buf_wide);
|
||||
|
||||
return NULL;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Returned pointer MUST be freed by the caller if non-NULL. */
|
||||
|
@ -921,7 +921,7 @@ void fill_short_pathname_representation_noext(char* out_rep,
|
||||
path_remove_extension(out_rep);
|
||||
}
|
||||
|
||||
int path_file_remove(const char *path)
|
||||
bool path_file_remove(const char *path)
|
||||
{
|
||||
char *path_local = NULL;
|
||||
wchar_t *path_wide = NULL;
|
||||
@ -938,27 +938,29 @@ int path_file_remove(const char *path)
|
||||
|
||||
if (path_local)
|
||||
{
|
||||
bool ret = remove(path_local);
|
||||
int ret = remove(path_local);
|
||||
free(path_local);
|
||||
|
||||
return ret;
|
||||
if (ret == 0)
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
path_wide = utf8_to_utf16_string_alloc(path);
|
||||
|
||||
if (path_wide)
|
||||
{
|
||||
bool ret = _wremove(path_wide);
|
||||
int ret = _wremove(path_wide);
|
||||
free(path_wide);
|
||||
|
||||
return ret;
|
||||
if (ret == 0)
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
return remove(path);
|
||||
if (remove(path) == 0)
|
||||
return true;
|
||||
#endif
|
||||
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
int path_file_rename(const char *old_path, const char *new_path)
|
||||
@ -983,11 +985,9 @@ int path_file_rename(const char *old_path, const char *new_path)
|
||||
|
||||
if (old_path_local)
|
||||
{
|
||||
bool ret;
|
||||
|
||||
if (new_path_local)
|
||||
{
|
||||
ret = rename(old_path_local, new_path_local);
|
||||
int ret = rename(old_path_local, new_path_local);
|
||||
free(old_path_local);
|
||||
free(new_path_local);
|
||||
return ret;
|
||||
@ -1004,11 +1004,9 @@ int path_file_rename(const char *old_path, const char *new_path)
|
||||
|
||||
if (old_path_wide)
|
||||
{
|
||||
bool ret;
|
||||
|
||||
if (new_path_wide)
|
||||
{
|
||||
ret = _wrename(old_path_wide, new_path_wide);
|
||||
int ret = _wrename(old_path_wide, new_path_wide);
|
||||
free(old_path_wide);
|
||||
free(new_path_wide);
|
||||
return ret;
|
||||
@ -1019,10 +1017,10 @@ int path_file_rename(const char *old_path, const char *new_path)
|
||||
|
||||
if (new_path_wide)
|
||||
free(new_path_wide);
|
||||
|
||||
return -1;
|
||||
#endif
|
||||
#else
|
||||
return rename(old_path, new_path);
|
||||
#endif
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ bool path_is_valid(const char *path);
|
||||
|
||||
int32_t path_get_size(const char *path);
|
||||
|
||||
int path_file_remove(const char *path);
|
||||
bool path_file_remove(const char *path);
|
||||
|
||||
int path_file_rename(const char *old_path, const char *new_path);
|
||||
|
||||
|
@ -105,10 +105,10 @@ bool intfstream_open(intfstream_internal_t *intf, const char *path,
|
||||
intf->chd.fp = chdstream_open(path, intf->chd.track);
|
||||
if (!intf->chd.fp)
|
||||
return false;
|
||||
break;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -1718,7 +1718,7 @@ void content_deinit(void)
|
||||
|
||||
RARCH_LOG("%s: %s.\n",
|
||||
msg_hash_to_str(MSG_REMOVING_TEMPORARY_CONTENT_FILE), path);
|
||||
if (path_file_remove(path) < 0)
|
||||
if (!path_file_remove(path))
|
||||
RARCH_ERR("%s: %s.\n",
|
||||
msg_hash_to_str(MSG_FAILED_TO_REMOVE_TEMPORARY_FILE),
|
||||
path);
|
||||
|
Loading…
x
Reference in New Issue
Block a user