mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 20:31:14 +00:00
Stratosphere: use isxdigit to check if char is hex.
This commit is contained in:
parent
c70420d996
commit
cb4089e49c
3 changed files with 13 additions and 18 deletions
|
@ -13,9 +13,7 @@ static std::atomic_bool g_has_initialized = false;
|
|||
|
||||
static bool IsHexadecimal(const char *str) {
|
||||
while (*str) {
|
||||
if (('0' <= *str && *str <= '9') ||
|
||||
('a' <= *str && *str <= 'f') ||
|
||||
('A' <= *str && *str <= 'F')) {
|
||||
if (isxdigit(*str)) {
|
||||
str++;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <dirent.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <switch.h>
|
||||
#include "ldr_patcher.hpp"
|
||||
|
@ -28,9 +29,7 @@ static inline u8 HexNybbleToU8(const char nybble) {
|
|||
static bool MatchesBuildId(const char *name, size_t name_len, const u8 *build_id) {
|
||||
/* Validate name is hex build id. */
|
||||
for (unsigned int i = 0; i < name_len - 4; i++) {
|
||||
if (!(('0' <= name[i] && name[i] <= '9') ||
|
||||
('a' <= name[i] && name[i] <= 'f') ||
|
||||
('A' <= name[i] && name[i] <= 'F'))) {
|
||||
if (isxdigit(name[i]) == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,7 @@
|
|||
|
||||
static bool IsHexadecimal(const char *str) {
|
||||
while (*str) {
|
||||
if (('0' <= *str && *str <= '9') ||
|
||||
('a' <= *str && *str <= 'f') ||
|
||||
('A' <= *str && *str <= 'F')) {
|
||||
if (isxdigit(*str)) {
|
||||
str++;
|
||||
} else {
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue