Get rid of superfluous macros around memcmp and strcpy
This commit is contained in:
parent
563b687db8
commit
03dbcc53e7
|
@ -161,7 +161,7 @@ static void rcheevos_filter_url_param(char* url, char* param)
|
|||
if (start[param_len] == '=' && memcmp(start, param, param_len) == 0)
|
||||
{
|
||||
if (next)
|
||||
strcpy_literal(start, next + 1);
|
||||
strcpy(start, next + 1);
|
||||
else if (start > url)
|
||||
start[-1] = '\0';
|
||||
else
|
||||
|
|
|
@ -604,7 +604,7 @@ static bool d3d9_cg_renderchain_init_shader_fvf(
|
|||
|
||||
for (count = 0; count < MAXD3DDECLLENGTH; count++)
|
||||
{
|
||||
if (string_is_equal_fast(&decl_end, &decl[count], sizeof(decl_end)))
|
||||
if (memcmp(&decl_end, &decl[count], sizeof(decl_end)) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -4316,8 +4316,8 @@ static void vulkan_draw_quad(vk_t *vk, const struct vk_draw_quad *quad)
|
|||
return;
|
||||
|
||||
if (
|
||||
string_is_equal_fast(quad->mvp,
|
||||
&vk->tracker.mvp, sizeof(*quad->mvp))
|
||||
(memcmp(quad->mvp,
|
||||
&vk->tracker.mvp, sizeof(*quad->mvp) == 0))
|
||||
|| quad->texture->view != vk->tracker.view
|
||||
|| quad->sampler != vk->tracker.sampler)
|
||||
{
|
||||
|
|
|
@ -248,14 +248,14 @@ static void video_shader_replace_wildcards(char *s, size_t len, char *in_preset_
|
|||
fill_pathname_parent_dir_name(content_dir_name,
|
||||
rarch_path_basename,
|
||||
sizeof(content_dir_name));
|
||||
if (string_is_not_equal_fast(content_dir_name, "", sizeof("")))
|
||||
if (memcmp(content_dir_name, "", sizeof("")) != 0)
|
||||
strlcpy(content_dir_name,
|
||||
path_basename_nocompression(content_dir_name),
|
||||
sizeof(content_dir_name));
|
||||
if (string_is_not_equal_fast(content_dir_name, "", sizeof("")))
|
||||
if (memcmp(content_dir_name, "", sizeof("")) != 0)
|
||||
path_remove_extension(content_dir_name);
|
||||
|
||||
if (string_is_not_equal_fast(content_dir_name, "", sizeof("")))
|
||||
if (memcmp(content_dir_name, "", sizeof("")) != 0)
|
||||
_len = strlcpy(replace_text, content_dir_name, sizeof(replace_text));
|
||||
else
|
||||
replace_text[0] = '\0';
|
||||
|
@ -344,13 +344,13 @@ static void video_shader_replace_wildcards(char *s, size_t len, char *in_preset_
|
|||
char preset_dir_name[DIR_MAX_LENGTH];
|
||||
fill_pathname_parent_dir_name(preset_dir_name,
|
||||
in_preset_path, sizeof(preset_dir_name));
|
||||
if (string_is_not_equal_fast(preset_dir_name, "", sizeof("")))
|
||||
if (memcmp(preset_dir_name, "", sizeof("")) != 0)
|
||||
strlcpy(preset_dir_name,
|
||||
path_basename_nocompression(preset_dir_name),
|
||||
sizeof(preset_dir_name));
|
||||
if (string_is_not_equal_fast(preset_dir_name, "", sizeof("")))
|
||||
if (memcmp(preset_dir_name, "", sizeof("")) != 0)
|
||||
path_remove_extension(preset_dir_name);
|
||||
if (string_is_not_equal_fast(preset_dir_name, "", sizeof("")))
|
||||
if (memcmp(preset_dir_name, "", sizeof("")) != 0)
|
||||
_len = strlcpy(replace_text,
|
||||
preset_dir_name, sizeof(replace_text));
|
||||
else
|
||||
|
@ -363,9 +363,9 @@ static void video_shader_replace_wildcards(char *s, size_t len, char *in_preset_
|
|||
strlcpy(preset_name,
|
||||
path_basename_nocompression(in_preset_path),
|
||||
sizeof(preset_name));
|
||||
if (string_is_not_equal_fast(preset_name, "", sizeof("")))
|
||||
if (memcmp(preset_name, "", sizeof("")) != 0)
|
||||
path_remove_extension(preset_name);
|
||||
if (string_is_not_equal_fast(preset_name, "", sizeof("")))
|
||||
if (memcmp(preset_name, "", sizeof("")) != 0)
|
||||
_len = strlcpy(replace_text,
|
||||
preset_name, sizeof(replace_text));
|
||||
else
|
||||
|
|
|
@ -144,8 +144,8 @@ static bool guid_is_xinput_device(const GUID* product_guid)
|
|||
|
||||
for (i = 0; i < ARRAY_SIZE(common_xinput_guids); ++i)
|
||||
{
|
||||
if (string_is_equal_fast(product_guid,
|
||||
&common_xinput_guids[i], sizeof(GUID)))
|
||||
if (memcmp(product_guid,
|
||||
&common_xinput_guids[i], sizeof(GUID)) == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -355,7 +355,7 @@ static int sevenzip_parse_file_init(file_archive_transfer_t *state,
|
|||
if (filestream_read(state->archive_file, magic_buf, SEVENZIP_MAGIC_LEN) != SEVENZIP_MAGIC_LEN)
|
||||
goto error;
|
||||
|
||||
if (string_is_not_equal_fast(magic_buf, SEVENZIP_MAGIC, SEVENZIP_MAGIC_LEN))
|
||||
if (memcmp(magic_buf, SEVENZIP_MAGIC, SEVENZIP_MAGIC_LEN) != 0)
|
||||
goto error;
|
||||
|
||||
sevenzip_context = (struct sevenzip_context_t*)sevenzip_stream_new();
|
||||
|
|
|
@ -1142,7 +1142,7 @@ size_t fill_pathname_abbreviate_special(char *s,
|
|||
|
||||
if (!PATH_CHAR_IS_SLASH(*in_path))
|
||||
{
|
||||
strcpy_literal(s, PATH_DEFAULT_SLASH());
|
||||
strcpy(s, PATH_DEFAULT_SLASH());
|
||||
s++;
|
||||
len--;
|
||||
}
|
||||
|
|
|
@ -1205,8 +1205,7 @@ bool rpng_start(rpng_t *rpng)
|
|||
if (rpng->buff_end - rpng->buff_data < 8)
|
||||
return false;
|
||||
|
||||
if (string_is_not_equal_fast(
|
||||
rpng->buff_data, png_magic, sizeof(png_magic)))
|
||||
if (memcmp(rpng->buff_data, png_magic, sizeof(png_magic)) != 0)
|
||||
return false;
|
||||
|
||||
rpng->buff_data += 8;
|
||||
|
|
|
@ -37,13 +37,8 @@ RETRO_BEGIN_DECLS
|
|||
|
||||
#define STRLEN_CONST(x) ((sizeof((x))-1))
|
||||
|
||||
#define strcpy_literal(a, b) strcpy(a, b)
|
||||
|
||||
#define string_is_not_equal(a, b) !string_is_equal((a), (b))
|
||||
|
||||
#define string_is_not_equal_fast(a, b, size) (memcmp(a, b, size) != 0)
|
||||
#define string_is_equal_fast(a, b, size) (memcmp(a, b, size) == 0)
|
||||
|
||||
#define TOLOWER(c) ((c) | (lr_char_props[(unsigned char)(c)] & 0x20))
|
||||
#define TOUPPER(c) ((c) & ~(lr_char_props[(unsigned char)(c)] & 0x20))
|
||||
|
||||
|
@ -83,16 +78,16 @@ static INLINE bool string_starts_with(const char *str, const char *prefix)
|
|||
return (str && prefix) ? !strncmp(prefix, str, strlen(prefix)) : false;
|
||||
}
|
||||
|
||||
static INLINE bool string_ends_with_size(const char *str, const char *suffix,
|
||||
size_t str_len, size_t suffix_len)
|
||||
static INLINE bool string_ends_with_size(const char *s, const char *suffix,
|
||||
size_t len, size_t suffix_len)
|
||||
{
|
||||
return (str_len < suffix_len) ? false :
|
||||
!memcmp(suffix, str + (str_len - suffix_len), suffix_len);
|
||||
return (len < suffix_len) ? false :
|
||||
!memcmp(suffix, s + (len - suffix_len), suffix_len);
|
||||
}
|
||||
|
||||
static INLINE bool string_ends_with(const char *str, const char *suffix)
|
||||
static INLINE bool string_ends_with(const char *s, const char *suffix)
|
||||
{
|
||||
return str && suffix && string_ends_with_size(str, suffix, strlen(str), strlen(suffix));
|
||||
return s && suffix && string_ends_with_size(s, suffix, strlen(s), strlen(suffix));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -161,10 +161,10 @@ END_TEST
|
|||
|
||||
START_TEST (test_string_comparison)
|
||||
{
|
||||
ck_assert(string_is_not_equal_fast("foo", "bar", 3));
|
||||
ck_assert(string_is_equal_fast("foo2", "foo2", 4));
|
||||
ck_assert(!string_is_equal_fast("foo1", "foo2", 4));
|
||||
ck_assert(string_is_equal_fast("foo1", "foo2", 3));
|
||||
ck_assert(memcmp("foo", "bar", 3) != 0);
|
||||
ck_assert(memcmp("foo2", "foo2", 4) == 0);
|
||||
ck_assert(memcmp("foo1", "foo2", 4) != 0);
|
||||
ck_assert(memcmp("foo1", "foo2", 3) == 0);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
|
|
@ -274,7 +274,7 @@ static void query_raise_unknown_function(
|
|||
);
|
||||
if (len < ((ssize_t)_len - __len - 3))
|
||||
strncpy(s + __len, name, len);
|
||||
strcpy_literal(s + __len + len, "'");
|
||||
strcpy(s + __len + len, "'");
|
||||
*error = s;
|
||||
}
|
||||
|
||||
|
|
16
runahead.c
16
runahead.c
|
@ -149,7 +149,7 @@ void runahead_set_load_content_info(void *data,
|
|||
static void strcat_alloc(char **dst, const char *s)
|
||||
{
|
||||
size_t _len;
|
||||
char *src = *dst;
|
||||
char *src = *dst;
|
||||
|
||||
if (!src)
|
||||
{
|
||||
|
@ -157,27 +157,27 @@ static void strcat_alloc(char **dst, const char *s)
|
|||
{
|
||||
size_t __len = strlen(s);
|
||||
if (__len != 0)
|
||||
src = strldup(s, __len + 1);
|
||||
src = strldup(s, __len + 1);
|
||||
else
|
||||
src = NULL;
|
||||
src = NULL;
|
||||
}
|
||||
else
|
||||
src = (char*)calloc(1,1);
|
||||
src = (char*)calloc(1,1);
|
||||
|
||||
*dst = src;
|
||||
*dst = src;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
_len = strlen(src);
|
||||
_len = strlen(src);
|
||||
|
||||
if (!(src = (char*)realloc(src, _len + strlen(s) + 1)))
|
||||
return;
|
||||
|
||||
*dst = src;
|
||||
strcpy_literal(src + _len, s);
|
||||
*dst = src;
|
||||
strcpy(src + _len, s);
|
||||
}
|
||||
|
||||
void runahead_secondary_core_destroy(void *data)
|
||||
|
|
|
@ -209,20 +209,20 @@ static int intfstream_get_serial(intfstream_t *fd, char *s, size_t len, const ch
|
|||
size_t system_len = strlen(system_name);
|
||||
if (string_starts_with_size(system_name, "Sony", STRLEN_CONST("Sony")))
|
||||
{
|
||||
if (STRLEN_CONST("Sony - PlayStation Portable") == system_len &&
|
||||
string_is_equal_fast(system_name, "Sony - PlayStation Portable", system_len))
|
||||
if ( STRLEN_CONST("Sony - PlayStation Portable") == system_len
|
||||
&& memcmp(system_name, "Sony - PlayStation Portable", system_len) == 0)
|
||||
{
|
||||
if (detect_psp_game(fd, s, len, filename) != 0)
|
||||
return 1;
|
||||
}
|
||||
else if (STRLEN_CONST("Sony - PlayStation") == system_len &&
|
||||
string_is_equal_fast(system_name, "Sony - PlayStation", system_len))
|
||||
else if ( STRLEN_CONST("Sony - PlayStation") == system_len
|
||||
&& memcmp(system_name, "Sony - PlayStation", system_len) == 0)
|
||||
{
|
||||
if (detect_ps1_game(fd, s, len, filename) != 0)
|
||||
return 1;
|
||||
}
|
||||
else if (STRLEN_CONST("Sony - PlayStation 2") == system_len &&
|
||||
string_is_equal_fast(system_name, "Sony - PlayStation 2", system_len))
|
||||
else if ( STRLEN_CONST("Sony - PlayStation 2") == system_len
|
||||
&& memcmp(system_name, "Sony - PlayStation 2", system_len) == 0)
|
||||
{
|
||||
if (detect_ps2_game(fd, s, len, filename) != 0)
|
||||
return 1;
|
||||
|
@ -230,14 +230,14 @@ static int intfstream_get_serial(intfstream_t *fd, char *s, size_t len, const ch
|
|||
}
|
||||
else if (string_starts_with_size(system_name, "Nintendo", STRLEN_CONST("Nintendo")))
|
||||
{
|
||||
if (STRLEN_CONST("Nintendo - GameCube") == system_len &&
|
||||
string_is_equal_fast(system_name, "Nintendo - GameCube", system_len))
|
||||
if ( STRLEN_CONST("Nintendo - GameCube") == system_len
|
||||
&& memcmp(system_name, "Nintendo - GameCube", system_len) == 0)
|
||||
{
|
||||
if (detect_gc_game(fd, s, len, filename) != 0)
|
||||
return 1;
|
||||
}
|
||||
else if (STRLEN_CONST("Nintendo - Wii") == system_len &&
|
||||
string_is_equal_fast(system_name, "Nintendo - Wii", system_len))
|
||||
else if ( STRLEN_CONST("Nintendo - Wii") == system_len
|
||||
&& memcmp(system_name, "Nintendo - Wii", system_len) == 0)
|
||||
{
|
||||
if (detect_wii_game(fd, s, len, filename) != 0)
|
||||
return 1;
|
||||
|
@ -245,20 +245,20 @@ static int intfstream_get_serial(intfstream_t *fd, char *s, size_t len, const ch
|
|||
}
|
||||
else if (string_starts_with_size(system_name, "Sega", STRLEN_CONST("Sega")))
|
||||
{
|
||||
if (STRLEN_CONST("Sega - Mega-CD - Sega CD") == system_len &&
|
||||
string_is_equal_fast(system_name, "Sega - Mega-CD - Sega CD", system_len))
|
||||
if ( STRLEN_CONST("Sega - Mega-CD - Sega CD") == system_len
|
||||
&& memcmp(system_name, "Sega - Mega-CD - Sega CD", system_len) == 0)
|
||||
{
|
||||
if (detect_scd_game(fd, s, len, filename) != 0)
|
||||
return 1;
|
||||
}
|
||||
else if (STRLEN_CONST("Sega - Saturn") == system_len &&
|
||||
string_is_equal_fast(system_name, "Sega - Saturn", system_len))
|
||||
else if ( STRLEN_CONST("Sega - Saturn") == system_len
|
||||
&& memcmp(system_name, "Sega - Saturn", system_len) == 0)
|
||||
{
|
||||
if (detect_sat_game(fd, s, len, filename) != 0)
|
||||
return 1;
|
||||
}
|
||||
else if (STRLEN_CONST("Sega - Dreamcast") == system_len &&
|
||||
string_is_equal_fast(system_name, "Sega - Dreamcast", system_len))
|
||||
else if ( STRLEN_CONST("Sega - Dreamcast") == system_len
|
||||
&& memcmp(system_name, "Sega - Dreamcast", system_len) == 0)
|
||||
{
|
||||
if (detect_dc_game(fd, s, len, filename) != 0)
|
||||
return 1;
|
||||
|
|
|
@ -207,33 +207,33 @@ int detect_ps1_game(intfstream_t *fd, char *s, size_t len, const char *filename)
|
|||
{
|
||||
strncpy(raw_game_id, &disc_data[pos], 12);
|
||||
raw_game_id[12] = '\0';
|
||||
if ( string_is_equal_fast(raw_game_id, "S", STRLEN_CONST("S"))
|
||||
|| string_is_equal_fast(raw_game_id, "E", STRLEN_CONST("E")))
|
||||
if ( memcmp(raw_game_id, "S", STRLEN_CONST("S") == 0)
|
||||
|| memcmp(raw_game_id, "E", STRLEN_CONST("E")) == 0)
|
||||
{
|
||||
if ( string_is_equal_fast(raw_game_id, "SCUS_", STRLEN_CONST("SCUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SLUS_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SLES_", STRLEN_CONST("SLES_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SCED_", STRLEN_CONST("SCED_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SLPS_", STRLEN_CONST("SLPS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SLPM_", STRLEN_CONST("SLPM_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SCPS_", STRLEN_CONST("SCPS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SLED_", STRLEN_CONST("SLED_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SIPS_", STRLEN_CONST("SIPS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "ESPM_", STRLEN_CONST("ESPM_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SCES_", STRLEN_CONST("SCES_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SLKA_", STRLEN_CONST("SLKA_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SCAJ_", STRLEN_CONST("SCAJ_"))
|
||||
if ( memcmp(raw_game_id, "SCUS_", STRLEN_CONST("SCUS_") == 0)
|
||||
|| memcmp(raw_game_id, "SLUS_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "SLES_", STRLEN_CONST("SLES_") == 0)
|
||||
|| memcmp(raw_game_id, "SCED_", STRLEN_CONST("SCED_") == 0)
|
||||
|| memcmp(raw_game_id, "SLPS_", STRLEN_CONST("SLPS_") == 0)
|
||||
|| memcmp(raw_game_id, "SLPM_", STRLEN_CONST("SLPM_") == 0)
|
||||
|| memcmp(raw_game_id, "SCPS_", STRLEN_CONST("SCPS_") == 0)
|
||||
|| memcmp(raw_game_id, "SLED_", STRLEN_CONST("SLED_") == 0)
|
||||
|| memcmp(raw_game_id, "SIPS_", STRLEN_CONST("SIPS_") == 0)
|
||||
|| memcmp(raw_game_id, "ESPM_", STRLEN_CONST("ESPM_") == 0)
|
||||
|| memcmp(raw_game_id, "SCES_", STRLEN_CONST("SCES_") == 0)
|
||||
|| memcmp(raw_game_id, "SLKA_", STRLEN_CONST("SLKA_") == 0)
|
||||
|| memcmp(raw_game_id, "SCAJ_", STRLEN_CONST("SCAJ_") == 0)
|
||||
)
|
||||
{
|
||||
raw_game_id[4] = '-';
|
||||
if (string_is_equal_fast(&raw_game_id[8], ".", STRLEN_CONST(".")))
|
||||
if (memcmp(&raw_game_id[8], ".", STRLEN_CONST(".")) == 0)
|
||||
{
|
||||
raw_game_id[8] = raw_game_id[9];
|
||||
raw_game_id[9] = raw_game_id[10];
|
||||
}
|
||||
/* A few games have their serial in the form of xx.xxx */
|
||||
/* Tanaka Torahiko no Ultra-ryuu Shougi - Ibisha Anaguma-hen (Japan) -> SLPS_02.261 */
|
||||
else if (string_is_equal_fast(&raw_game_id[7], ".", STRLEN_CONST(".")))
|
||||
else if (memcmp(&raw_game_id[7], ".", STRLEN_CONST(".")) == 0)
|
||||
{
|
||||
raw_game_id[7] = raw_game_id[8];
|
||||
raw_game_id[8] = raw_game_id[9];
|
||||
|
@ -247,7 +247,7 @@ int detect_ps1_game(intfstream_t *fd, char *s, size_t len, const char *filename)
|
|||
return true;
|
||||
}
|
||||
}
|
||||
else if (string_is_equal_fast(raw_game_id, "LSP-", STRLEN_CONST("LSP-")))
|
||||
else if (memcmp(raw_game_id, "LSP-", STRLEN_CONST("LSP-")) == 0)
|
||||
{
|
||||
raw_game_id[10] = '\0';
|
||||
|
||||
|
@ -256,7 +256,7 @@ int detect_ps1_game(intfstream_t *fd, char *s, size_t len, const char *filename)
|
|||
free(disc_data);
|
||||
return true;
|
||||
}
|
||||
else if (string_is_equal_fast(raw_game_id, "PSX.EXE", STRLEN_CONST("PSX.EXE")))
|
||||
else if (memcmp(raw_game_id, "PSX.EXE", STRLEN_CONST("PSX.EXE")) == 0)
|
||||
{
|
||||
raw_game_id[7] = '\0';
|
||||
|
||||
|
@ -308,76 +308,76 @@ int detect_ps2_game(intfstream_t *fd, char *s, size_t len, const char *filename)
|
|||
{
|
||||
strncpy(raw_game_id, &disc_data[pos], 12);
|
||||
raw_game_id[12] = '\0';
|
||||
if ( string_is_equal_fast(raw_game_id, "S", STRLEN_CONST("S"))
|
||||
|| string_is_equal_fast(raw_game_id, "P", STRLEN_CONST("P"))
|
||||
|| string_is_equal_fast(raw_game_id, "T", STRLEN_CONST("T"))
|
||||
|| string_is_equal_fast(raw_game_id, "C", STRLEN_CONST("C"))
|
||||
|| string_is_equal_fast(raw_game_id, "H", STRLEN_CONST("H"))
|
||||
|| string_is_equal_fast(raw_game_id, "A", STRLEN_CONST("A"))
|
||||
|| string_is_equal_fast(raw_game_id, "V", STRLEN_CONST("A"))
|
||||
|| string_is_equal_fast(raw_game_id, "L", STRLEN_CONST("A"))
|
||||
|| string_is_equal_fast(raw_game_id, "M", STRLEN_CONST("A"))
|
||||
|| string_is_equal_fast(raw_game_id, "N", STRLEN_CONST("A"))
|
||||
|| string_is_equal_fast(raw_game_id, "U", STRLEN_CONST("A"))
|
||||
|| string_is_equal_fast(raw_game_id, "W", STRLEN_CONST("A"))
|
||||
|| string_is_equal_fast(raw_game_id, "G", STRLEN_CONST("A"))
|
||||
|| string_is_equal_fast(raw_game_id, "K", STRLEN_CONST("A"))
|
||||
|| string_is_equal_fast(raw_game_id, "R", STRLEN_CONST("A"))
|
||||
if ( memcmp(raw_game_id, "S", STRLEN_CONST("S") == 0)
|
||||
|| memcmp(raw_game_id, "P", STRLEN_CONST("P") == 0)
|
||||
|| memcmp(raw_game_id, "T", STRLEN_CONST("T") == 0)
|
||||
|| memcmp(raw_game_id, "C", STRLEN_CONST("C") == 0)
|
||||
|| memcmp(raw_game_id, "H", STRLEN_CONST("H") == 0)
|
||||
|| memcmp(raw_game_id, "A", STRLEN_CONST("A") == 0)
|
||||
|| memcmp(raw_game_id, "V", STRLEN_CONST("A") == 0)
|
||||
|| memcmp(raw_game_id, "L", STRLEN_CONST("A") == 0)
|
||||
|| memcmp(raw_game_id, "M", STRLEN_CONST("A") == 0)
|
||||
|| memcmp(raw_game_id, "N", STRLEN_CONST("A") == 0)
|
||||
|| memcmp(raw_game_id, "U", STRLEN_CONST("A") == 0)
|
||||
|| memcmp(raw_game_id, "W", STRLEN_CONST("A") == 0)
|
||||
|| memcmp(raw_game_id, "G", STRLEN_CONST("A") == 0)
|
||||
|| memcmp(raw_game_id, "K", STRLEN_CONST("A") == 0)
|
||||
|| memcmp(raw_game_id, "R", STRLEN_CONST("A") == 0)
|
||||
)
|
||||
{
|
||||
if ( string_is_equal_fast(raw_game_id, "SLPM_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SLES_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SCES_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SLUS_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SLPS_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SCED_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SCUS_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SCPS_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SCAJ_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SLKA_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SCKA_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SLAJ_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "TCPS_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "KOEI_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "PBPX_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "PCPX_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "PAPX_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SCCS_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "ALCH_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "TCES_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "CPCS_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SLED_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "TLES_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "GUST_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "CF00_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SCPN_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SCPM_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "PSXC_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SLPN_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "ULKS_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "LDTL_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "PKP2_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "WLFD_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "CZP2_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "HAKU_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "SRPM_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "MTP2_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "NMP2_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "ARZE_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "VUGJ_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "ARP2_", STRLEN_CONST("SLUS_"))
|
||||
|| string_is_equal_fast(raw_game_id, "ROSE_", STRLEN_CONST("SLUS_"))
|
||||
if ( memcmp(raw_game_id, "SLPM_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "SLES_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "SCES_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "SLUS_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "SLPS_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "SCED_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "SCUS_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "SCPS_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "SCAJ_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "SLKA_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "SCKA_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "SLAJ_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "TCPS_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "KOEI_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "PBPX_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "PCPX_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "PAPX_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "SCCS_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "ALCH_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "TCES_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "CPCS_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "SLED_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "TLES_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "GUST_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "CF00_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "SCPN_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "SCPM_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "PSXC_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "SLPN_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "ULKS_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "LDTL_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "PKP2_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "WLFD_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "CZP2_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "HAKU_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "SRPM_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "MTP2_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "NMP2_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "ARZE_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "VUGJ_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "ARP2_", STRLEN_CONST("SLUS_") == 0)
|
||||
|| memcmp(raw_game_id, "ROSE_", STRLEN_CONST("SLUS_") == 0)
|
||||
)
|
||||
{
|
||||
raw_game_id[4] = '-';
|
||||
if (string_is_equal_fast(&raw_game_id[8], ".", STRLEN_CONST(".")))
|
||||
if (memcmp(&raw_game_id[8], ".", STRLEN_CONST(".")) == 0)
|
||||
{
|
||||
raw_game_id[8] = raw_game_id[9];
|
||||
raw_game_id[9] = raw_game_id[10];
|
||||
}
|
||||
/* A few games have their serial in the form of xx.xxx */
|
||||
/* Tanaka Torahiko no Ultra-ryuu Shougi - Ibisha Anaguma-hen (Japan) -> SLPS_02.261 */
|
||||
else if (string_is_equal_fast(&raw_game_id[7], ".", STRLEN_CONST(".")))
|
||||
else if (memcmp(&raw_game_id[7], ".", STRLEN_CONST(".")) == 0)
|
||||
{
|
||||
raw_game_id[7] = raw_game_id[8];
|
||||
raw_game_id[8] = raw_game_id[9];
|
||||
|
@ -437,39 +437,39 @@ int detect_psp_game(intfstream_t *fd, char *s, size_t len, const char *filename)
|
|||
{
|
||||
strncpy(s, &disc_data[pos], 10);
|
||||
s[10] = '\0';
|
||||
if ( string_is_equal_fast(s, "U", STRLEN_CONST("U"))
|
||||
|| string_is_equal_fast(s, "N", STRLEN_CONST("N")))
|
||||
if ( memcmp(s, "U", STRLEN_CONST("U") == 0)
|
||||
|| memcmp(s, "N", STRLEN_CONST("N")) == 0)
|
||||
{
|
||||
if (
|
||||
( string_is_equal_fast(s, "ULES-", STRLEN_CONST("ULES-")))
|
||||
|| (string_is_equal_fast(s, "ULUS-", STRLEN_CONST("ULUS-")))
|
||||
|| (string_is_equal_fast(s, "ULJS-", STRLEN_CONST("ULJS-")))
|
||||
( memcmp(s, "ULES-", STRLEN_CONST("ULES-")) == 0)
|
||||
|| (memcmp(s, "ULUS-", STRLEN_CONST("ULUS-")) == 0)
|
||||
|| (memcmp(s, "ULJS-", STRLEN_CONST("ULJS-")) == 0)
|
||||
|
||||
|| (string_is_equal_fast(s, "ULEM-", STRLEN_CONST("ULEM-")))
|
||||
|| (string_is_equal_fast(s, "ULUM-", STRLEN_CONST("ULUM-")))
|
||||
|| (string_is_equal_fast(s, "ULJM-", STRLEN_CONST("ULJM-")))
|
||||
|| (memcmp(s, "ULEM-", STRLEN_CONST("ULEM-")) == 0)
|
||||
|| (memcmp(s, "ULUM-", STRLEN_CONST("ULUM-")) == 0)
|
||||
|| (memcmp(s, "ULJM-", STRLEN_CONST("ULJM-")) == 0)
|
||||
|
||||
|| (string_is_equal_fast(s, "UCES-", STRLEN_CONST("UCES-")))
|
||||
|| (string_is_equal_fast(s, "UCUS-", STRLEN_CONST("UCUS-")))
|
||||
|| (string_is_equal_fast(s, "UCJS-", STRLEN_CONST("UCJS-")))
|
||||
|| (string_is_equal_fast(s, "UCAS-", STRLEN_CONST("UCAS-")))
|
||||
|| (string_is_equal_fast(s, "UCKS-", STRLEN_CONST("UCKS-")))
|
||||
|| (memcmp(s, "UCES-", STRLEN_CONST("UCES-")) == 0)
|
||||
|| (memcmp(s, "UCUS-", STRLEN_CONST("UCUS-")) == 0)
|
||||
|| (memcmp(s, "UCJS-", STRLEN_CONST("UCJS-")) == 0)
|
||||
|| (memcmp(s, "UCAS-", STRLEN_CONST("UCAS-")) == 0)
|
||||
|| (memcmp(s, "UCKS-", STRLEN_CONST("UCKS-")) == 0)
|
||||
|
||||
|| (string_is_equal_fast(s, "ULKS-", STRLEN_CONST("ULKS-")))
|
||||
|| (string_is_equal_fast(s, "ULAS-", STRLEN_CONST("ULAS-")))
|
||||
|| (string_is_equal_fast(s, "NPEH-", STRLEN_CONST("NPEH-")))
|
||||
|| (string_is_equal_fast(s, "NPUH-", STRLEN_CONST("NPUH-")))
|
||||
|| (string_is_equal_fast(s, "NPJH-", STRLEN_CONST("NPJH-")))
|
||||
|| (string_is_equal_fast(s, "NPHH-", STRLEN_CONST("NPHH-")))
|
||||
|| (memcmp(s, "ULKS-", STRLEN_CONST("ULKS-")) == 0)
|
||||
|| (memcmp(s, "ULAS-", STRLEN_CONST("ULAS-")) == 0)
|
||||
|| (memcmp(s, "NPEH-", STRLEN_CONST("NPEH-")) == 0)
|
||||
|| (memcmp(s, "NPUH-", STRLEN_CONST("NPUH-")) == 0)
|
||||
|| (memcmp(s, "NPJH-", STRLEN_CONST("NPJH-")) == 0)
|
||||
|| (memcmp(s, "NPHH-", STRLEN_CONST("NPHH-")) == 0)
|
||||
|
||||
|| (string_is_equal_fast(s, "NPEG-", STRLEN_CONST("NPEG-")))
|
||||
|| (string_is_equal_fast(s, "NPUG-", STRLEN_CONST("NPUG-")))
|
||||
|| (string_is_equal_fast(s, "NPJG-", STRLEN_CONST("NPJG-")))
|
||||
|| (string_is_equal_fast(s, "NPHG-", STRLEN_CONST("NPHG-")))
|
||||
|| (memcmp(s, "NPEG-", STRLEN_CONST("NPEG-")) == 0)
|
||||
|| (memcmp(s, "NPUG-", STRLEN_CONST("NPUG-")) == 0)
|
||||
|| (memcmp(s, "NPJG-", STRLEN_CONST("NPJG-")) == 0)
|
||||
|| (memcmp(s, "NPHG-", STRLEN_CONST("NPHG-")) == 0)
|
||||
|
||||
|| (string_is_equal_fast(s, "NPEZ-", STRLEN_CONST("NPEZ-")))
|
||||
|| (string_is_equal_fast(s, "NPUZ-", STRLEN_CONST("NPUZ-")))
|
||||
|| (string_is_equal_fast(s, "NPJZ-", STRLEN_CONST("NPJZ-")))
|
||||
|| (memcmp(s, "NPEZ-", STRLEN_CONST("NPEZ-")) == 0)
|
||||
|| (memcmp(s, "NPUZ-", STRLEN_CONST("NPUZ-")) == 0)
|
||||
|| (memcmp(s, "NPJZ-", STRLEN_CONST("NPJZ-")) == 0)
|
||||
)
|
||||
{
|
||||
cue_append_multi_disc_suffix(s, filename);
|
||||
|
@ -497,8 +497,8 @@ size_t detect_gc_game(intfstream_t *fd, char *s, size_t len, const char *filenam
|
|||
if (intfstream_read(fd, raw_game_id, 4) <= 0)
|
||||
return 0;
|
||||
|
||||
if ( string_is_equal_fast(raw_game_id, "RVZ", STRLEN_CONST("RVZ"))
|
||||
|| string_is_equal_fast(raw_game_id, "WIA", STRLEN_CONST("WIA")))
|
||||
if ( memcmp(raw_game_id, "RVZ", STRLEN_CONST("RVZ") == 0)
|
||||
|| memcmp(raw_game_id, "WIA", STRLEN_CONST("WIA")) == 0)
|
||||
{
|
||||
if (intfstream_seek(fd, 0x0058, SEEK_SET) < 0)
|
||||
return 0;
|
||||
|
@ -930,7 +930,7 @@ int detect_dc_game(intfstream_t *fd, char *s, size_t len, const char *filename)
|
|||
{
|
||||
/* For 8 chars serials in 'MK-xxxxx' format, we need to remove 'MK-' to match Redump database
|
||||
* Sega GT being the only exception (MK-51053), we have to check if it's not that game first */
|
||||
if (string_is_not_equal_fast(raw_game_id, "MK-51053", STRLEN_CONST("MK-51053")))
|
||||
if (memcmp(raw_game_id, "MK-51053", STRLEN_CONST("MK-51053")) != 0)
|
||||
{
|
||||
strncpy(s, raw_game_id + 3, 5);
|
||||
s[5] = '\0';
|
||||
|
@ -975,7 +975,7 @@ size_t detect_wii_game(intfstream_t *fd, char *s, size_t len, const char *filena
|
|||
if (intfstream_read(fd, raw_game_id, 6) <= 0)
|
||||
return 0;
|
||||
|
||||
if (string_is_equal_fast(raw_game_id, "WBFS", STRLEN_CONST("WBFS")))
|
||||
if (memcmp(raw_game_id, "WBFS", STRLEN_CONST("WBFS")) == 0)
|
||||
{
|
||||
if (intfstream_seek(fd, 0x0200, SEEK_SET) < 0)
|
||||
return 0;
|
||||
|
@ -983,8 +983,8 @@ size_t detect_wii_game(intfstream_t *fd, char *s, size_t len, const char *filena
|
|||
return 0;
|
||||
}
|
||||
|
||||
if ( string_is_equal_fast(raw_game_id, "RVZ", STRLEN_CONST("RVZ"))
|
||||
|| string_is_equal_fast(raw_game_id, "WIA", STRLEN_CONST("WIA")))
|
||||
if ( memcmp(raw_game_id, "RVZ", STRLEN_CONST("RVZ") == 0)
|
||||
|| memcmp(raw_game_id, "WIA", STRLEN_CONST("WIA")) == 0)
|
||||
{
|
||||
if (intfstream_seek(fd, 0x0058, SEEK_SET) < 0)
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue