diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index bb95d366c88c..77f31ec279ca 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -1071,8 +1071,8 @@ nsDocument::SetHeaderData(nsIAtom* aHeaderField, const nsAReadableString& aData) sheet->GetTitle(title); if (!title.IsEmpty()) { // if sheet has title PRBool disabled = (aData.IsEmpty() || - !title.Equals(aData, - nsCaseInsensitiveStringComparator())); + Compare(title, aData, + nsCaseInsensitiveStringComparator()) != 0); SetStyleSheetDisabledState(sheet, disabled); } } diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index ea527ab844bd..b69cb9294779 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -839,23 +839,23 @@ nsGenericElement::InternalIsSupported(const nsAReadableString& aFeature, *aReturn = PR_FALSE; nsAutoString feature(aFeature); - if (feature.Equals(NS_LITERAL_STRING("XML"), nsCaseInsensitiveStringComparator()) || - feature.Equals(NS_LITERAL_STRING("HTML"), nsCaseInsensitiveStringComparator())) { + if (!Compare(feature, NS_LITERAL_STRING("XML"), nsCaseInsensitiveStringComparator()) || + !Compare(feature, NS_LITERAL_STRING("HTML"), nsCaseInsensitiveStringComparator())) { if (aVersion.IsEmpty() || aVersion.Equals(NS_LITERAL_STRING("1.0")) || aVersion.Equals(NS_LITERAL_STRING("2.0"))) { *aReturn = PR_TRUE; } - } else if (feature.Equals(NS_LITERAL_STRING("Views"), nsCaseInsensitiveStringComparator()) || - feature.Equals(NS_LITERAL_STRING("StyleSheets"), nsCaseInsensitiveStringComparator()) || - feature.Equals(NS_LITERAL_STRING("CSS"), nsCaseInsensitiveStringComparator()) || -// feature.Equals(NS_LITERAL_STRING("CSS2"), nsCaseInsensitiveStringComparator()) || - feature.Equals(NS_LITERAL_STRING("Events"), nsCaseInsensitiveStringComparator()) || -// feature.Equals(NS_LITERAL_STRING("UIEvents"), nsCaseInsensitiveStringComparator()) || - feature.Equals(NS_LITERAL_STRING("MouseEvents"), nsCaseInsensitiveStringComparator()) || - feature.Equals(NS_LITERAL_STRING("MouseScrollEvents"), nsCaseInsensitiveStringComparator()) || - feature.Equals(NS_LITERAL_STRING("HTMLEvents"), nsCaseInsensitiveStringComparator()) || - feature.Equals(NS_LITERAL_STRING("Range"), nsCaseInsensitiveStringComparator())) { + } else if (!Compare(feature, NS_LITERAL_STRING("Views"), nsCaseInsensitiveStringComparator()) || + !Compare(feature, NS_LITERAL_STRING("StyleSheets"), nsCaseInsensitiveStringComparator()) || + !Compare(feature, NS_LITERAL_STRING("CSS"), nsCaseInsensitiveStringComparator()) || +// !Compare(feature, NS_LITERAL_STRING("CSS2"), nsCaseInsensitiveStringComparator()) || + !Compare(feature, NS_LITERAL_STRING("Events"), nsCaseInsensitiveStringComparator()) || +// !Compare(feature, NS_LITERAL_STRING("UIEvents"), nsCaseInsensitiveStringComparator()) || + !Compare(feature, NS_LITERAL_STRING("MouseEvents"), nsCaseInsensitiveStringComparator()) || + !Compare(feature, NS_LITERAL_STRING("MouseScrollEvents"), nsCaseInsensitiveStringComparator()) || + !Compare(feature, NS_LITERAL_STRING("HTMLEvents"), nsCaseInsensitiveStringComparator()) || + !Compare(feature, NS_LITERAL_STRING("Range"), nsCaseInsensitiveStringComparator())) { if (aVersion.IsEmpty() || aVersion.Equals(NS_LITERAL_STRING("2.0"))) { *aReturn = PR_TRUE; } diff --git a/content/base/src/nsHTMLValue.cpp b/content/base/src/nsHTMLValue.cpp index 3ed6e80a11f1..48e1b765f2fe 100644 --- a/content/base/src/nsHTMLValue.cpp +++ b/content/base/src/nsHTMLValue.cpp @@ -172,8 +172,9 @@ PRBool nsHTMLValue::operator==(const nsHTMLValue& aOther) const } } else if (nsnull != aOther.mValue.mString) { - return nsDependentString(mValue.mString).Equals(nsDependentString(aOther.mValue.mString), - nsCaseInsensitiveStringComparator()); + return 0 == Compare(nsDependentString(mValue.mString), + nsDependentString(aOther.mValue.mString), + nsCaseInsensitiveStringComparator()); } } else if (eHTMLUnit_ISupports == mUnit) { diff --git a/content/html/content/src/nsHTMLAnchorElement.cpp b/content/html/content/src/nsHTMLAnchorElement.cpp index ab2f9c370ba8..5f3ce60390f9 100644 --- a/content/html/content/src/nsHTMLAnchorElement.cpp +++ b/content/html/content/src/nsHTMLAnchorElement.cpp @@ -398,8 +398,8 @@ nsHTMLAnchorElement::StringToAttribute(nsIAtom* aAttribute, } } else if (aAttribute == nsHTMLAtoms::suppress) { - if (!aValue.Equals(NS_LITERAL_STRING("true"), - nsCaseInsensitiveStringComparator())) { + if (Compare(aValue,NS_LITERAL_STRING("true"), + nsCaseInsensitiveStringComparator())) { aResult.SetEmptyValue(); // XXX? shouldn't just leave "true" return NS_CONTENT_ATTR_HAS_VALUE; } diff --git a/content/html/content/src/nsHTMLButtonElement.cpp b/content/html/content/src/nsHTMLButtonElement.cpp index 0e3269ef2796..637231f9907e 100644 --- a/content/html/content/src/nsHTMLButtonElement.cpp +++ b/content/html/content/src/nsHTMLButtonElement.cpp @@ -212,7 +212,7 @@ nsHTMLButtonElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, nsAutoString value(aValue); if (aName == nsHTMLAtoms::disabled && - value.Equals(NS_LITERAL_STRING("false"), nsCaseInsensitiveStringComparator())) { + !Compare(value, NS_LITERAL_STRING("false"), nsCaseInsensitiveStringComparator())) { return UnsetAttr(aNameSpaceID, aName, aNotify); } diff --git a/content/html/style/src/nsCSSDeclaration.cpp b/content/html/style/src/nsCSSDeclaration.cpp index 20675c406d17..a04f0fd9a594 100644 --- a/content/html/style/src/nsCSSDeclaration.cpp +++ b/content/html/style/src/nsCSSDeclaration.cpp @@ -5521,7 +5521,7 @@ nsCSSDeclaration::TryBackgroundPosition(nsAWritableString & aString, AppendValueToString(eCSSProperty_background_x_position, backgroundXValue); AppendValueToString(eCSSProperty_background_y_position, backgroundYValue); aString.Append(backgroundYValue); - if (!backgroundXValue.Equals(backgroundYValue, nsCaseInsensitiveStringComparator())) { + if (Compare(backgroundXValue, backgroundYValue, nsCaseInsensitiveStringComparator())) { // the two values are different aString.Append(PRUnichar(' ')); aString.Append(backgroundXValue); diff --git a/content/html/style/src/nsCSSLoader.cpp b/content/html/style/src/nsCSSLoader.cpp index d3d482f1aca2..6a6b7dc2d6d9 100644 --- a/content/html/style/src/nsCSSLoader.cpp +++ b/content/html/style/src/nsCSSLoader.cpp @@ -638,8 +638,9 @@ SheetLoadData::OnStreamComplete(nsIStreamLoader* aLoader, } } if (mLoader->mNavQuirkMode || - contentType.Equals(NS_LITERAL_CSTRING("text/css"), - nsCaseInsensitiveCStringComparator()) || + Compare(contentType, + NS_LITERAL_CSTRING("text/css"), + nsCaseInsensitiveCStringComparator()) == 0 || contentType.IsEmpty()) { /* * First determine the charset (if one is indicated) diff --git a/content/html/style/src/nsCSSStruct.cpp b/content/html/style/src/nsCSSStruct.cpp index 20675c406d17..a04f0fd9a594 100644 --- a/content/html/style/src/nsCSSStruct.cpp +++ b/content/html/style/src/nsCSSStruct.cpp @@ -5521,7 +5521,7 @@ nsCSSDeclaration::TryBackgroundPosition(nsAWritableString & aString, AppendValueToString(eCSSProperty_background_x_position, backgroundXValue); AppendValueToString(eCSSProperty_background_y_position, backgroundYValue); aString.Append(backgroundYValue); - if (!backgroundXValue.Equals(backgroundYValue, nsCaseInsensitiveStringComparator())) { + if (Compare(backgroundXValue, backgroundYValue, nsCaseInsensitiveStringComparator())) { // the two values are different aString.Append(PRUnichar(' ')); aString.Append(backgroundXValue); diff --git a/content/html/style/src/nsCSSStyleSheet.cpp b/content/html/style/src/nsCSSStyleSheet.cpp index 952aad603dec..3cce72167e6d 100644 --- a/content/html/style/src/nsCSSStyleSheet.cpp +++ b/content/html/style/src/nsCSSStyleSheet.cpp @@ -201,8 +201,9 @@ PRBool AtomKey_base::Equals(const nsHashKey* aKey) const const PRUnichar *theirStr = nsnull; theirAtom->GetUnicode(&theirStr); - return nsDependentString(myStr).Equals(nsDependentString(theirStr), - nsCaseInsensitiveStringComparator()); + return Compare(nsDependentString(myStr), + nsDependentString(theirStr), + nsCaseInsensitiveStringComparator()) == 0; } @@ -3351,8 +3352,9 @@ static PRBool ValueIncludes(const nsString& aValueList, const nsString& aValue, } } else { - if (nsDependentString(value).Equals(nsDependentString(start), - nsCaseInsensitiveStringComparator())) { + if (!Compare(nsDependentString(value), + nsDependentString(start), + nsCaseInsensitiveStringComparator())) { return PR_TRUE; } } @@ -3646,9 +3648,9 @@ static PRBool SelectorMatches(RuleProcessorData &data, break; } if (isCaseSensitive) - result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsDefaultStringComparator())); + result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsDefaultStringComparator())); else - result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator())); + result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsCaseInsensitiveStringComparator())); } } break; @@ -3660,9 +3662,9 @@ static PRBool SelectorMatches(RuleProcessorData &data, result = localFalse; } else { if (isCaseSensitive) - result = PRBool(localTrue == Substring(value, valLen - selLen, selLen).Equals(attr->mValue, nsDefaultStringComparator())); + result = PRBool(localTrue == !Compare(Substring(value, valLen - selLen, selLen), attr->mValue, nsDefaultStringComparator())); else - result = PRBool(localTrue == Substring(value, valLen - selLen, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator())); + result = PRBool(localTrue == !Compare(Substring(value, valLen - selLen, selLen), attr->mValue, nsCaseInsensitiveStringComparator())); } } break; @@ -3674,9 +3676,9 @@ static PRBool SelectorMatches(RuleProcessorData &data, result = localFalse; } else { if (isCaseSensitive) - result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsDefaultStringComparator())); + result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsDefaultStringComparator())); else - result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator())); + result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsCaseInsensitiveStringComparator())); } } break; @@ -3716,8 +3718,8 @@ static PRBool SelectorMatches(RuleProcessorData &data, const PRUnichar* id2Str; IDList->mAtom->GetUnicode(&id2Str); nsDependentString id2(id2Str); - if (localTrue != - id1.Equals(id2, nsCaseInsensitiveStringComparator())) { + if (localTrue == + (Compare(id1, id2, nsCaseInsensitiveStringComparator()) != 0)) { result = PR_FALSE; break; } diff --git a/content/html/style/src/nsHTMLAttributes.cpp b/content/html/style/src/nsHTMLAttributes.cpp index 5824b0c40e35..c11c1c7f364d 100644 --- a/content/html/style/src/nsHTMLAttributes.cpp +++ b/content/html/style/src/nsHTMLAttributes.cpp @@ -1447,7 +1447,7 @@ HTMLAttributesImpl::HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const const PRUnichar* class2Buf; classList->mAtom->GetUnicode(&class2Buf); nsDependentString class2(class2Buf); - if (class1.Equals(class2, nsCaseInsensitiveStringComparator())) + if (Compare(class1, class2, nsCaseInsensitiveStringComparator()) == 0) return NS_OK; classList = classList->mNext; } while (classList); diff --git a/content/shared/src/nsHTMLValue.cpp b/content/shared/src/nsHTMLValue.cpp index 3ed6e80a11f1..48e1b765f2fe 100644 --- a/content/shared/src/nsHTMLValue.cpp +++ b/content/shared/src/nsHTMLValue.cpp @@ -172,8 +172,9 @@ PRBool nsHTMLValue::operator==(const nsHTMLValue& aOther) const } } else if (nsnull != aOther.mValue.mString) { - return nsDependentString(mValue.mString).Equals(nsDependentString(aOther.mValue.mString), - nsCaseInsensitiveStringComparator()); + return 0 == Compare(nsDependentString(mValue.mString), + nsDependentString(aOther.mValue.mString), + nsCaseInsensitiveStringComparator()); } } else if (eHTMLUnit_ISupports == mUnit) { diff --git a/content/xbl/src/nsXBLPrototypeHandler.cpp b/content/xbl/src/nsXBLPrototypeHandler.cpp index 4d57b21f51a6..8756b7ccda1c 100644 --- a/content/xbl/src/nsXBLPrototypeHandler.cpp +++ b/content/xbl/src/nsXBLPrototypeHandler.cpp @@ -852,20 +852,20 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement, mEventName = getter_AddRefs(NS_NewAtom(event)); if (aPhase) { - const nsDependentString phase(aPhase); - if (phase.Equals(NS_LITERAL_STRING("capturing"))) + if (Compare(nsDependentString(aPhase), NS_LITERAL_STRING("capturing")) == 0) mPhase = NS_PHASE_CAPTURING; - else if (phase.Equals(NS_LITERAL_STRING("target"))) + else if (Compare(nsDependentString(aPhase), NS_LITERAL_STRING("target")) == 0) mPhase = NS_PHASE_TARGET; } // Button and clickcount apply only to XBL handlers and don't apply to XUL key // handlers. - if (aButton && *aButton) - mDetail = *aButton - '0'; - - if (aClickCount && *aClickCount) - mMisc = *aClickCount - '0'; + nsAutoString button(aButton); + nsAutoString clickcount(aClickCount); + if (!button.IsEmpty()) + mDetail = button.First() - '0'; + if (!clickcount.IsEmpty()) + mMisc = clickcount.First() - '0'; // Modifiers are supported by both types of handlers (XUL and XBL). nsAutoString modifiers(aModifiers); diff --git a/content/xul/document/src/nsXULContentSink.cpp b/content/xul/document/src/nsXULContentSink.cpp index abe16b6b227d..aec6bc8438f7 100644 --- a/content/xul/document/src/nsXULContentSink.cpp +++ b/content/xul/document/src/nsXULContentSink.cpp @@ -1444,12 +1444,10 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes, nsAutoString src; while (*aAttributes) { const nsDependentString key(aAttributes[0]); - if (key.Equals(NS_LITERAL_STRING("src"), - nsCaseInsensitiveStringComparator())) { + if (Compare(key, NS_LITERAL_STRING("src"),nsCaseInsensitiveStringComparator()) == 0) { src.Assign(aAttributes[1]); } - else if (key.Equals(NS_LITERAL_STRING("type"), - nsCaseInsensitiveStringComparator())) { + else if (Compare(key, NS_LITERAL_STRING("type"),nsCaseInsensitiveStringComparator()) == 0) { nsAutoString type(aAttributes[1]); nsAutoString mimeType; nsAutoString params; @@ -1475,8 +1473,7 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes, jsVersionString = JS_VersionToString(jsVersion); } } - else if (key.Equals(NS_LITERAL_STRING("language"), - nsCaseInsensitiveStringComparator())) { + else if (Compare(key, NS_LITERAL_STRING("language"),nsCaseInsensitiveStringComparator()) == 0) { nsAutoString lang(aAttributes[1]); isJavaScript = nsParserUtils::IsJavaScriptLanguage(lang, &jsVersionString); } diff --git a/layout/style/nsCSSDeclaration.cpp b/layout/style/nsCSSDeclaration.cpp index 20675c406d17..a04f0fd9a594 100644 --- a/layout/style/nsCSSDeclaration.cpp +++ b/layout/style/nsCSSDeclaration.cpp @@ -5521,7 +5521,7 @@ nsCSSDeclaration::TryBackgroundPosition(nsAWritableString & aString, AppendValueToString(eCSSProperty_background_x_position, backgroundXValue); AppendValueToString(eCSSProperty_background_y_position, backgroundYValue); aString.Append(backgroundYValue); - if (!backgroundXValue.Equals(backgroundYValue, nsCaseInsensitiveStringComparator())) { + if (Compare(backgroundXValue, backgroundYValue, nsCaseInsensitiveStringComparator())) { // the two values are different aString.Append(PRUnichar(' ')); aString.Append(backgroundXValue); diff --git a/layout/style/nsCSSLoader.cpp b/layout/style/nsCSSLoader.cpp index d3d482f1aca2..6a6b7dc2d6d9 100644 --- a/layout/style/nsCSSLoader.cpp +++ b/layout/style/nsCSSLoader.cpp @@ -638,8 +638,9 @@ SheetLoadData::OnStreamComplete(nsIStreamLoader* aLoader, } } if (mLoader->mNavQuirkMode || - contentType.Equals(NS_LITERAL_CSTRING("text/css"), - nsCaseInsensitiveCStringComparator()) || + Compare(contentType, + NS_LITERAL_CSTRING("text/css"), + nsCaseInsensitiveCStringComparator()) == 0 || contentType.IsEmpty()) { /* * First determine the charset (if one is indicated) diff --git a/layout/style/nsCSSStruct.cpp b/layout/style/nsCSSStruct.cpp index 20675c406d17..a04f0fd9a594 100644 --- a/layout/style/nsCSSStruct.cpp +++ b/layout/style/nsCSSStruct.cpp @@ -5521,7 +5521,7 @@ nsCSSDeclaration::TryBackgroundPosition(nsAWritableString & aString, AppendValueToString(eCSSProperty_background_x_position, backgroundXValue); AppendValueToString(eCSSProperty_background_y_position, backgroundYValue); aString.Append(backgroundYValue); - if (!backgroundXValue.Equals(backgroundYValue, nsCaseInsensitiveStringComparator())) { + if (Compare(backgroundXValue, backgroundYValue, nsCaseInsensitiveStringComparator())) { // the two values are different aString.Append(PRUnichar(' ')); aString.Append(backgroundXValue); diff --git a/layout/style/nsCSSStyleSheet.cpp b/layout/style/nsCSSStyleSheet.cpp index 952aad603dec..3cce72167e6d 100644 --- a/layout/style/nsCSSStyleSheet.cpp +++ b/layout/style/nsCSSStyleSheet.cpp @@ -201,8 +201,9 @@ PRBool AtomKey_base::Equals(const nsHashKey* aKey) const const PRUnichar *theirStr = nsnull; theirAtom->GetUnicode(&theirStr); - return nsDependentString(myStr).Equals(nsDependentString(theirStr), - nsCaseInsensitiveStringComparator()); + return Compare(nsDependentString(myStr), + nsDependentString(theirStr), + nsCaseInsensitiveStringComparator()) == 0; } @@ -3351,8 +3352,9 @@ static PRBool ValueIncludes(const nsString& aValueList, const nsString& aValue, } } else { - if (nsDependentString(value).Equals(nsDependentString(start), - nsCaseInsensitiveStringComparator())) { + if (!Compare(nsDependentString(value), + nsDependentString(start), + nsCaseInsensitiveStringComparator())) { return PR_TRUE; } } @@ -3646,9 +3648,9 @@ static PRBool SelectorMatches(RuleProcessorData &data, break; } if (isCaseSensitive) - result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsDefaultStringComparator())); + result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsDefaultStringComparator())); else - result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator())); + result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsCaseInsensitiveStringComparator())); } } break; @@ -3660,9 +3662,9 @@ static PRBool SelectorMatches(RuleProcessorData &data, result = localFalse; } else { if (isCaseSensitive) - result = PRBool(localTrue == Substring(value, valLen - selLen, selLen).Equals(attr->mValue, nsDefaultStringComparator())); + result = PRBool(localTrue == !Compare(Substring(value, valLen - selLen, selLen), attr->mValue, nsDefaultStringComparator())); else - result = PRBool(localTrue == Substring(value, valLen - selLen, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator())); + result = PRBool(localTrue == !Compare(Substring(value, valLen - selLen, selLen), attr->mValue, nsCaseInsensitiveStringComparator())); } } break; @@ -3674,9 +3676,9 @@ static PRBool SelectorMatches(RuleProcessorData &data, result = localFalse; } else { if (isCaseSensitive) - result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsDefaultStringComparator())); + result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsDefaultStringComparator())); else - result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator())); + result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsCaseInsensitiveStringComparator())); } } break; @@ -3716,8 +3718,8 @@ static PRBool SelectorMatches(RuleProcessorData &data, const PRUnichar* id2Str; IDList->mAtom->GetUnicode(&id2Str); nsDependentString id2(id2Str); - if (localTrue != - id1.Equals(id2, nsCaseInsensitiveStringComparator())) { + if (localTrue == + (Compare(id1, id2, nsCaseInsensitiveStringComparator()) != 0)) { result = PR_FALSE; break; }