Cheat Class: Replace is_valid_hex_digit

isxdigit does the same thing.
This commit is contained in:
Lioncash 2015-04-22 14:06:02 -04:00
parent 9884091aae
commit 6b7ecf0b79
1 changed files with 3 additions and 18 deletions

View File

@ -15,21 +15,6 @@
enum { WM_EDITCHEAT = WM_USER + 0x120 };
enum { UM_CHANGECODEEXTENSION = WM_USER + 0x121 };
static int is_valid_hex_digit(char symbol)
{
if (symbol < '0')
return 0; /* no valid hex figures before '0' */
if (symbol <= '9')
return 1;
symbol &= ~('X' ^ 'x'); /* in ASCII, forces lowercase to uppercase */
if (symbol < 'A')
return 0;
if (symbol <= 'F')
return 1;
return 0;
}
CCheats::CCheats (const CN64Rom * Rom ) :
m_Rom(Rom),
m_rcList(new RECT),
@ -1786,7 +1771,7 @@ stdstr CCheats::ReadCodeString (HWND hDlg, bool &validcodes, bool &validoptions,
if (len <= 0) { continue; }
for (i=0; i<128; i++) {
if (is_valid_hex_digit(str[i])) {
if (isxdigit(str[i])) {
tempformat[i] = 'X';
}
if ((str[i] == ' ') || (str[i] == '?')) {
@ -1860,7 +1845,7 @@ stdstr CCheats::ReadOptionsString(HWND hDlg, bool &/*validcodes*/, bool &validop
case 1: //option = lower byte
if (len >= 2) {
for (i=0; i<2; i++) {
if (!is_valid_hex_digit(str[i])) {
if (!isxdigit(str[i])) {
validoptions = false;
break;
}
@ -1893,7 +1878,7 @@ stdstr CCheats::ReadOptionsString(HWND hDlg, bool &/*validcodes*/, bool &validop
case 2: //option = word
if (len >= 4) {
for (i=0; i<4; i++) {
if (!is_valid_hex_digit(str[i])) {
if (!isxdigit(str[i])) {
validoptions = false;
break;
}