Fix logic in ldr_ro_manager

Fix argument type for isdigit/isxdigit
This commit is contained in:
hexkyz
2019-06-30 18:48:16 +01:00
parent b0a66a63ba
commit e561919a52
9 changed files with 34 additions and 33 deletions

View File

@@ -116,7 +116,7 @@ Result SettingsItemManager::ValidateKey(const char *key) {
static bool IsHexadecimal(const char *str) {
while (*str) {
if (isxdigit(*str)) {
if (isxdigit((unsigned char)*str)) {
str++;
} else {
return false;

View File

@@ -70,7 +70,7 @@ static FsFile g_emummc_file = {0};
static bool IsHexadecimal(const char *str) {
while (*str) {
if (isxdigit(*str)) {
if (isxdigit((unsigned char)*str)) {
str++;
} else {
return false;

View File

@@ -349,7 +349,7 @@ bool DmntCheatManager::ParseCheats(const char *s, size_t len) {
/* Skip onwards. */
i = j + 1;
} else if (isxdigit(s[i])) {
} else if (isxdigit((unsigned char)s[i])) {
/* Make sure that we have a cheat open. */
if (cur_entry == NULL) {
return false;
@@ -363,7 +363,7 @@ bool DmntCheatManager::ParseCheats(const char *s, size_t len) {
/* We're parsing an instruction, so validate it's 8 hex digits. */
for (size_t j = 1; j < 8; j++) {
/* Validate 8 hex chars. */
if (i + j >= len || !isxdigit(s[i+j])) {
if (i + j >= len || !isxdigit((unsigned char)s[i+j])) {
return false;
}
}

View File

@@ -136,13 +136,14 @@ namespace sts::ldr::ro {
/* Nintendo doesn't actually care about successful allocation. */
for (size_t i = 0; i < ModuleCountMax; i++) {
ModuleInfo *module = &info->modules[i];
if (!module->in_use) {
if (module->in_use) {
continue;
}
std::memcpy(module->info.build_id, build_id, sizeof(module->info.build_id));
module->info.base_address = address;
module->info.size = size;
module->in_use = true;
break;
}

View File

@@ -32,7 +32,7 @@
static bool IsHexadecimal(const char *str) {
while (*str) {
if (isxdigit(*str)) {
if (isxdigit((unsigned char)*str)) {
str++;
} else {
return false;