It seems that, despite their trivial functionality, the runtime
implementation insists on converting to Unicode! This means those functions
are actually only safe at PASSIVE_LEVEL.
This patch implements __toupper() and __tolower() as replacements with
no such hidden nastiness and modifies callers to use those.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
return Token;
}
+static FORCEINLINE CHAR
+__toupper(
+ IN CHAR Character
+ )
+{
+ if (Character < 'a' || Character > 'z')
+ return Character;
+
+ return 'A' + Character - 'a';
+}
+
+static FORCEINLINE CHAR
+__tolower(
+ IN CHAR Character
+ )
+{
+ if (Character < 'A' || Character > 'Z')
+ return Character;
+
+ return 'a' + Character - 'A';
+}
+
#endif // _COMMON_UTIL_H
if (Name[Index] == '\0')
break;
- New->Name[Index] = (CHAR)tolower(Name[Index]);
+ New->Name[Index] = __tolower(Name[Index]);
}
New->Start = Start;
if (Buffer[Index] == '\0')
break;
} else {
- Buffer[Index] = (CHAR)toupper(Buffer[Index]);
+ Buffer[Index] = __toupper(Buffer[Index]);
Index++;
}
}