diff --git a/mozilla/base/src/nsCRT.h b/mozilla/base/src/nsCRT.h index a14ed2bbcb5..0161c67e129 100644 --- a/mozilla/base/src/nsCRT.h +++ b/mozilla/base/src/nsCRT.h @@ -66,6 +66,11 @@ public: return PRInt32(PL_strcasecmp(s1, s2)); } + /// Case-insensitive string comparison with length + static PRInt32 strncasecmp(const char* s1, const char* s2, PRInt32 aMaxLen) { + return PRInt32(PL_strncasecmp(s1, s2, aMaxLen)); + } + /// Like strlen except for ucs2 strings static PRInt32 strlen(const PRUnichar* s); diff --git a/mozilla/htmlparser/src/nsHTMLParser.cpp b/mozilla/htmlparser/src/nsHTMLParser.cpp index c221c423224..e39e6d31af1 100644 --- a/mozilla/htmlparser/src/nsHTMLParser.cpp +++ b/mozilla/htmlparser/src/nsHTMLParser.cpp @@ -462,7 +462,7 @@ PRBool nsHTMLParser::Parse(nsIURL* aURL){ char* theModeStr= PR_GetEnv("PARSE_MODE"); if(theModeStr) - if(0==strnicmp("other",theModeStr,5)) + if(0==nsCRT::strncasecmp("other",theModeStr,5)) theMode=eParseMode_other; return Parse(aURL,theMode); diff --git a/mozilla/parser/htmlparser/src/nsHTMLParser.cpp b/mozilla/parser/htmlparser/src/nsHTMLParser.cpp index c221c423224..e39e6d31af1 100644 --- a/mozilla/parser/htmlparser/src/nsHTMLParser.cpp +++ b/mozilla/parser/htmlparser/src/nsHTMLParser.cpp @@ -462,7 +462,7 @@ PRBool nsHTMLParser::Parse(nsIURL* aURL){ char* theModeStr= PR_GetEnv("PARSE_MODE"); if(theModeStr) - if(0==strnicmp("other",theModeStr,5)) + if(0==nsCRT::strncasecmp("other",theModeStr,5)) theMode=eParseMode_other; return Parse(aURL,theMode); diff --git a/mozilla/xpcom/ds/nsCRT.h b/mozilla/xpcom/ds/nsCRT.h index a14ed2bbcb5..0161c67e129 100644 --- a/mozilla/xpcom/ds/nsCRT.h +++ b/mozilla/xpcom/ds/nsCRT.h @@ -66,6 +66,11 @@ public: return PRInt32(PL_strcasecmp(s1, s2)); } + /// Case-insensitive string comparison with length + static PRInt32 strncasecmp(const char* s1, const char* s2, PRInt32 aMaxLen) { + return PRInt32(PL_strncasecmp(s1, s2, aMaxLen)); + } + /// Like strlen except for ucs2 strings static PRInt32 strlen(const PRUnichar* s);