fix IsAscii function. The origional one report Latin1 characters as ASCII

git-svn-id: svn://10.0.0.236/trunk@68059 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ftang%netscape.com
2000-05-03 07:05:19 +00:00
parent e64f254a72
commit 44b7555922
3 changed files with 36 additions and 9 deletions

View File

@@ -2068,13 +2068,22 @@ PRBool nsString::IsSpace(PRUnichar aChar) {
PRBool nsString::IsASCII(const PRUnichar* aBuffer) {
if(!aBuffer) {
aBuffer=mUStr;
if(eOneByte==mCharSize)
if(eOneByte==mCharSize) {
char* aByte = mStr;
while(*aByte) {
if(*aByte & 0x80) { // don't use (*aByte > 0x7F) since char is signed
return PR_FALSE;
}
aByte++;
}
return PR_TRUE;
} else {
aBuffer=mUStr; // let the following code handle it
}
}
if(aBuffer) {
while(*aBuffer) {
if(*aBuffer>255){
if(*aBuffer>0x007F){
return PR_FALSE;
}
aBuffer++;