mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 02:31:59 +00:00
Changed to make string as array so sizeof returns number of characters instead of a size of a pointer,
this fixes a wrong offset problem for parsing charset, bug 80114, r=attinasi, sr=blizzard.
This commit is contained in:
parent
1d120d9e17
commit
f023e39b47
@ -1619,17 +1619,17 @@ nsresult CSSLoaderImpl::SetCharset(/*in*/ const nsString &aHTTPHeader,
|
||||
if (aHTTPHeader.Length() > 0) {
|
||||
// check if it has the charset= parameter
|
||||
PRInt32 charsetOffset;
|
||||
static const char* charsetStr = "charset=";
|
||||
static const char charsetStr[] = "charset=";
|
||||
if ((charsetOffset = aHTTPHeader.Find(charsetStr,PR_TRUE)) > 0) {
|
||||
aHTTPHeader.Mid(str, charsetOffset + sizeof(charsetStr), -1);
|
||||
aHTTPHeader.Mid(str, charsetOffset + sizeof(charsetStr)-1, -1);
|
||||
setCharset = PR_TRUE;
|
||||
}
|
||||
} else if (aStyleSheetData.Length() > 0) {
|
||||
static const char* atCharsetStr = "@charset";
|
||||
static const char atCharsetStr[] = "@charset";
|
||||
if (aStyleSheetData.Find(atCharsetStr) > -1) {
|
||||
nsString strValue;
|
||||
// skip past the ident
|
||||
aStyleSheetData.Mid(str,sizeof(atCharsetStr),-1);
|
||||
aStyleSheetData.Mid(str,sizeof(atCharsetStr)-1,-1);
|
||||
// strip any whitespace
|
||||
str.StripWhitespace();
|
||||
// truncate everything past the delimiter (semicolon)
|
||||
|
@ -1619,17 +1619,17 @@ nsresult CSSLoaderImpl::SetCharset(/*in*/ const nsString &aHTTPHeader,
|
||||
if (aHTTPHeader.Length() > 0) {
|
||||
// check if it has the charset= parameter
|
||||
PRInt32 charsetOffset;
|
||||
static const char* charsetStr = "charset=";
|
||||
static const char charsetStr[] = "charset=";
|
||||
if ((charsetOffset = aHTTPHeader.Find(charsetStr,PR_TRUE)) > 0) {
|
||||
aHTTPHeader.Mid(str, charsetOffset + sizeof(charsetStr), -1);
|
||||
aHTTPHeader.Mid(str, charsetOffset + sizeof(charsetStr)-1, -1);
|
||||
setCharset = PR_TRUE;
|
||||
}
|
||||
} else if (aStyleSheetData.Length() > 0) {
|
||||
static const char* atCharsetStr = "@charset";
|
||||
static const char atCharsetStr[] = "@charset";
|
||||
if (aStyleSheetData.Find(atCharsetStr) > -1) {
|
||||
nsString strValue;
|
||||
// skip past the ident
|
||||
aStyleSheetData.Mid(str,sizeof(atCharsetStr),-1);
|
||||
aStyleSheetData.Mid(str,sizeof(atCharsetStr)-1,-1);
|
||||
// strip any whitespace
|
||||
str.StripWhitespace();
|
||||
// truncate everything past the delimiter (semicolon)
|
||||
|
Loading…
Reference in New Issue
Block a user