mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
bug #28952: r=jst, sr=scc, checking in patch by drepper@cygnus.com which fixes |nsCRT::strtok| to handle 8-bit delimiter characters correctly when the high bit is set.
This commit is contained in:
parent
6ec0527163
commit
adeac621ea
@ -233,20 +233,20 @@ char* nsCRT::strtok(char* string, const char* delims, char* *newStr)
|
||||
for (i = 0; i < DELIM_TABLE_SIZE; i++)
|
||||
delimTable[i] = '\0';
|
||||
|
||||
for (i = 0; i < DELIM_TABLE_SIZE && delims[i]; i++) {
|
||||
SET_DELIM(delimTable, delims[i]);
|
||||
for (i = 0; delims[i]; i++) {
|
||||
SET_DELIM(delimTable, PRUint8(delims[i]));
|
||||
}
|
||||
NS_ASSERTION(delims[i] == '\0', "too many delimiters");
|
||||
|
||||
// skip to beginning
|
||||
while (*str && IS_DELIM(delimTable, *str)) {
|
||||
while (*str && IS_DELIM(delimTable, PRUint8(*str))) {
|
||||
str++;
|
||||
}
|
||||
result = str;
|
||||
|
||||
// fix up the end of the token
|
||||
while (*str) {
|
||||
if (IS_DELIM(delimTable, *str)) {
|
||||
if (IS_DELIM(delimTable, PRUint8(*str))) {
|
||||
*str++ = '\0';
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user