Improve CD key prevalidation (#880)
* Improve CD key prevalidation * Use tolower instead of ascii math
This commit is contained in:
1 parent
5d810e50d2
commit
b75bee1064
2 files changed
+15
-18
No files matched your search
+14
-17
@@ -4719,26 +4719,23 @@ qboolean CL_CDKeyValidate( const char *key, const char *checksum ) {
|
||||
// for loop gets rid of conditional assignment warning
|
||||
for (i = 0; i < len; i++) {
|
||||
ch = *key++;
|
||||
if (ch>='a' && ch<='z') {
|
||||
ch -= 32;
|
||||
}
|
||||
switch( ch ) {
|
||||
switch(tolower(ch)) {
|
||||
case '2':
|
||||
case '3':
|
||||
case '7':
|
||||
case 'A':
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'D':
|
||||
case 'G':
|
||||
case 'H':
|
||||
case 'J':
|
||||
case 'L':
|
||||
case 'P':
|
||||
case 'R':
|
||||
case 'S':
|
||||
case 'T':
|
||||
case 'W':
|
||||
case 'a':
|
||||
case 'b':
|
||||
case 'c':
|
||||
case 'd':
|
||||
case 'g':
|
||||
case 'h':
|
||||
case 'j':
|
||||
case 'l':
|
||||
case 'p':
|
||||
case 'r':
|
||||
case 's':
|
||||
case 't':
|
||||
case 'w':
|
||||
sum += ch;
|
||||
continue;
|
||||
default:
|
||||
|
||||
@@ -96,7 +96,7 @@ static int UI_CDKeyMenu_PreValidateKey( const char *key ) {
|
||||
}
|
||||
|
||||
while( ( ch = *key++ ) ) {
|
||||
switch( ch ) {
|
||||
switch(tolower(ch)) {
|
||||
case '2':
|
||||
case '3':
|
||||
case '7':
|
||||
|
||||
Reference in new issue
Block a user