diff --git a/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp b/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp index e58c5b0a1a6..b11bcd2b4d6 100644 --- a/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp +++ b/editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp @@ -92,8 +92,9 @@ ChangeCSSInlineStyleTxn::ValueIncludes(const nsAReadableString &aValueList, cons } } else { - if (nsDependentString(value).Equals(nsDependentString(start), - nsCaseInsensitiveStringComparator())) { + if (!Compare(nsDependentString(value), + nsDependentString(start), + nsCaseInsensitiveStringComparator())) { result = PR_TRUE; break; } @@ -369,9 +370,8 @@ ChangeCSSInlineStyleTxn::AcceptsMoreThanOneValue(nsIAtom *aCSSProperty) NS_IMETHODIMP ChangeCSSInlineStyleTxn::AddValueToMultivalueProperty(nsAWritableString & aValues, const nsAReadableString & aNewValue) { - if (aValues.IsEmpty() - || aValues.Equals(NS_LITERAL_STRING("none"), - nsCaseInsensitiveStringComparator())) { + if (!aValues.Length() + || !Compare(aValues, NS_LITERAL_STRING("none"), nsCaseInsensitiveStringComparator())) { // the list of values is empty of the value is 'none' aValues.Assign(aNewValue); } diff --git a/editor/libeditor/html/nsHTMLCSSUtils.cpp b/editor/libeditor/html/nsHTMLCSSUtils.cpp index a78614f7628..3e6632db933 100644 --- a/editor/libeditor/html/nsHTMLCSSUtils.cpp +++ b/editor/libeditor/html/nsHTMLCSSUtils.cpp @@ -1179,8 +1179,7 @@ nsHTMLCSSUtils::IsCSSEquivalentToHTMLInlineStyleSet(nsIDOMNode * aNode, if (!htmlValueString.Equals(NS_LITERAL_STRING(""))) { nsAutoString leftHTMLValue; htmlValueString.Left(leftHTMLValue, 5); - aIsSet = leftHTMLValue.Equals(leftCSSValue, - nsCaseInsensitiveStringComparator()); + aIsSet = PRBool(!Compare(leftHTMLValue, leftCSSValue, nsCaseInsensitiveStringComparator())); } else { aIsSet = (leftCSSValue.Equals(NS_LITERAL_STRING("times")) || @@ -1203,8 +1202,7 @@ nsHTMLCSSUtils::IsCSSEquivalentToHTMLInlineStyleSet(nsIDOMNode * aNode, } if (!htmlValueString.Equals(NS_LITERAL_STRING(""))) { - if (htmlValueString.Equals(valueString, - nsCaseInsensitiveStringComparator())) { + if (!Compare(htmlValueString, valueString, nsCaseInsensitiveStringComparator())) { aIsSet = PR_TRUE; } } diff --git a/editor/libeditor/html/nsHTMLEditRules.cpp b/editor/libeditor/html/nsHTMLEditRules.cpp index 253c1434543..427a924b402 100644 --- a/editor/libeditor/html/nsHTMLEditRules.cpp +++ b/editor/libeditor/html/nsHTMLEditRules.cpp @@ -2492,7 +2492,7 @@ nsHTMLEditRules::WillMakeList(nsISelection *aSelection, nsAutoString itemType; if (aItemType) itemType = *aItemType; - else if (aListType->Equals(NS_LITERAL_STRING("dl"),nsCaseInsensitiveStringComparator())) + else if (!Compare(*aListType,NS_LITERAL_STRING("dl"),nsCaseInsensitiveStringComparator())) itemType.Assign(NS_LITERAL_STRING("dd")); else itemType.Assign(NS_LITERAL_STRING("li")); @@ -6148,7 +6148,7 @@ nsHTMLEditRules::ApplyBlockStyle(nsISupportsArray *arrayOfNodes, const nsAReadab else if (IsInlineNode(curNode)) { // if curNode is a non editable, drop it if we are going to
- if (tString.Equals(NS_LITERAL_STRING("pre"),nsCaseInsensitiveStringComparator()) + if (!Compare(tString,NS_LITERAL_STRING("pre"),nsCaseInsensitiveStringComparator()) && (!mHTMLEditor->IsEditable(curNode))) continue; // do nothing to this block diff --git a/editor/libeditor/html/nsHTMLEditor.cpp b/editor/libeditor/html/nsHTMLEditor.cpp index 5f04e3a9b2e..f4ab17890e3 100644 --- a/editor/libeditor/html/nsHTMLEditor.cpp +++ b/editor/libeditor/html/nsHTMLEditor.cpp @@ -2461,7 +2461,7 @@ nsHTMLEditor::RemoveList(const nsAReadableString& aListType) if (!selection) return NS_ERROR_NULL_POINTER; nsTextRulesInfo ruleInfo(nsTextEditRules::kRemoveList); - if (aListType.Equals(NS_LITERAL_STRING("ol"),nsCaseInsensitiveStringComparator())) + if (!Compare(aListType,NS_LITERAL_STRING("ol"),nsCaseInsensitiveStringComparator())) ruleInfo.bOrdered = PR_TRUE; else ruleInfo.bOrdered = PR_FALSE; res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); @@ -2584,7 +2584,7 @@ nsHTMLEditor::Indent(const nsAReadableString& aIndent) PRBool cancel, handled; PRInt32 theAction = nsTextEditRules::kIndent; PRInt32 opID = kOpIndent; - if (aIndent.Equals(NS_LITERAL_STRING("outdent"),nsCaseInsensitiveStringComparator())) + if (!Compare(aIndent,NS_LITERAL_STRING("outdent"),nsCaseInsensitiveStringComparator())) { theAction = nsTextEditRules::kOutdent; opID = kOpOutdent; @@ -3571,8 +3571,7 @@ nsHTMLEditor::GetEmbeddedObjects(nsISupportsArray** aNodeList) { nsAutoString href; if (NS_SUCCEEDED(anchor->GetHref(href))) - if (Substring(href, 0, 5).Equals(NS_LITERAL_STRING("file:"), - nsCaseInsensitiveStringComparator())) + if (Compare(Substring(href, 0, 5), NS_LITERAL_STRING("file:"), nsCaseInsensitiveStringComparator()) == 0) (*aNodeList)->AppendElement(node); } } @@ -3864,20 +3863,20 @@ PRBool nsHTMLEditor::TagCanContainTag(const nsAReadableString& aParentTag, const nsAReadableString& aChildTag) { // COtherDTD gives some unwanted results. We override them here. - if (aParentTag.Equals(NS_LITERAL_STRING("ol"),nsCaseInsensitiveStringComparator()) || - aParentTag.Equals(NS_LITERAL_STRING("ul"),nsCaseInsensitiveStringComparator())) + if (!Compare(aParentTag,NS_LITERAL_STRING("ol"),nsCaseInsensitiveStringComparator()) || + !Compare(aParentTag,NS_LITERAL_STRING("ul"),nsCaseInsensitiveStringComparator())) { // if parent is a list and tag is also a list, say "yes". // This is because the editor does sublists illegally for now. - if (aChildTag.Equals(NS_LITERAL_STRING("ol"),nsCaseInsensitiveStringComparator()) || - aChildTag.Equals(NS_LITERAL_STRING("ul"),nsCaseInsensitiveStringComparator())) + if (!Compare(aChildTag,NS_LITERAL_STRING("ol"),nsCaseInsensitiveStringComparator()) || + !Compare(aChildTag,NS_LITERAL_STRING("ul"),nsCaseInsensitiveStringComparator())) return PR_TRUE; } - if (aParentTag.Equals(NS_LITERAL_STRING("li"),nsCaseInsensitiveStringComparator())) + if (!Compare(aParentTag,NS_LITERAL_STRING("li"),nsCaseInsensitiveStringComparator())) { // list items cant contain list items - if (aChildTag.Equals(NS_LITERAL_STRING("li"),nsCaseInsensitiveStringComparator())) + if (!Compare(aChildTag,NS_LITERAL_STRING("li"),nsCaseInsensitiveStringComparator())) return PR_FALSE; } diff --git a/editor/libeditor/html/nsHTMLEditorStyle.cpp b/editor/libeditor/html/nsHTMLEditorStyle.cpp index 0ea49f6d656..82d5a4d7200 100644 --- a/editor/libeditor/html/nsHTMLEditorStyle.cpp +++ b/editor/libeditor/html/nsHTMLEditorStyle.cpp @@ -715,7 +715,7 @@ nsresult nsHTMLEditor::RemoveStyleInside(nsIDOMNode *aNode, } if ( aProperty == nsIEditProperty::font && // or node is big or small and we are setting font size (NodeIsType(aNode, nsIEditProperty::big) || NodeIsType(aNode, nsIEditProperty::small)) && - aAttribute->Equals(NS_LITERAL_STRING("size"),nsCaseInsensitiveStringComparator())) + !Compare(*aAttribute,NS_LITERAL_STRING("size"),nsCaseInsensitiveStringComparator())) { res = RemoveContainer(aNode); // if we are setting font size, remove any nested bigs and smalls } @@ -741,10 +741,10 @@ PRBool nsHTMLEditor::IsOnlyAttribute(nsIDOMNode *aNode, if (!attrName) continue; // ooops attrName->ToString(attrString); // if it's the attribute we know about, keep looking - if (attrString.Equals(*aAttribute,nsCaseInsensitiveStringComparator())) continue; + if (!Compare(attrString,*aAttribute,nsCaseInsensitiveStringComparator())) continue; // if it's a special _moz... attribute, keep looking attrString.Left(tmp,4); - if (tmp.Equals(NS_LITERAL_STRING("_moz"),nsCaseInsensitiveStringComparator())) continue; + if (!Compare(tmp,NS_LITERAL_STRING("_moz"),nsCaseInsensitiveStringComparator())) continue; // otherwise, it's another attribute, so return false return PR_FALSE; } @@ -798,7 +798,7 @@ PRBool nsHTMLEditor::HasAttrVal(nsIDOMNode *aNode, attNode->GetValue(attrVal); // do values match? - if (attrVal.Equals(*aValue,nsCaseInsensitiveStringComparator())) return PR_TRUE; + if (!Compare(attrVal,*aValue,nsCaseInsensitiveStringComparator())) return PR_TRUE; return PR_FALSE; } diff --git a/editor/libeditor/text/nsAOLCiter.cpp b/editor/libeditor/text/nsAOLCiter.cpp index 259a50dcbe0..a00a98f26c9 100644 --- a/editor/libeditor/text/nsAOLCiter.cpp +++ b/editor/libeditor/text/nsAOLCiter.cpp @@ -107,7 +107,7 @@ nsAOLCiter::StripCites(const nsAReadableString& aInString, nsAWritableString& aO nsReadingIteratoriter,enditer; aInString.BeginReading(iter); aInString.EndReading(enditer); - if (Substring(aInString,0,2).Equals(NS_LITERAL_STRING(">>"))) + if (!Compare(Substring(aInString,0,2),NS_LITERAL_STRING(">>"))) { iter.advance(2); while (nsCRT::IsAsciiSpace(*iter)) diff --git a/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp b/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp index 4d27844a596..55764eacfb4 100644 --- a/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp +++ b/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp @@ -1466,27 +1466,27 @@ ChromeContextMenuListener :: ContextMenu ( nsIDOMEvent* aMouseEvent ) element->GetTagName(tag); // Test what kind of element we're dealing with here - if (tag.Equals(NS_LITERAL_STRING("img"), nsCaseInsensitiveStringComparator())) + if (!Compare(tag, NS_LITERAL_STRING("img"), nsCaseInsensitiveStringComparator())) { flags |= nsIContextMenuListener::CONTEXT_IMAGE; targetDOMnode = node; // if we see an image, keep searching for a possible anchor } - else if (tag.Equals(NS_LITERAL_STRING("input"), nsCaseInsensitiveStringComparator())) + else if (!Compare(tag, NS_LITERAL_STRING("input"), nsCaseInsensitiveStringComparator())) { // INPUT element - button, combo, checkbox, text etc. flags |= nsIContextMenuListener::CONTEXT_INPUT; targetDOMnode = node; break; // exit do-while } - else if (tag.Equals(NS_LITERAL_STRING("textarea"), nsCaseInsensitiveStringComparator())) + else if (!Compare(tag, NS_LITERAL_STRING("textarea"), nsCaseInsensitiveStringComparator())) { // text area flags |= nsIContextMenuListener::CONTEXT_TEXT; targetDOMnode = node; break; // exit do-while } - else if (tag.Equals(NS_LITERAL_STRING("html"), nsCaseInsensitiveStringComparator())) + else if (!Compare(tag, NS_LITERAL_STRING("html"), nsCaseInsensitiveStringComparator())) { // only care about this if no other context was found. if (!flags) { @@ -1508,7 +1508,8 @@ ChromeContextMenuListener :: ContextMenu ( nsIDOMEvent* aMouseEvent ) if (attributes) { nsCOMPtr hrefNode; - attributes->GetNamedItem(NS_LITERAL_STRING("href"), getter_AddRefs(hrefNode)); + nsAutoString href(NS_LITERAL_STRING("href")); + attributes->GetNamedItem(href, getter_AddRefs(hrefNode)); if (hrefNode) { flags |= nsIContextMenuListener::CONTEXT_LINK; diff --git a/extensions/wallet/src/nsWalletService.cpp b/extensions/wallet/src/nsWalletService.cpp index 2c67ab05565..29efe6b3162 100644 --- a/extensions/wallet/src/nsWalletService.cpp +++ b/extensions/wallet/src/nsWalletService.cpp @@ -429,7 +429,7 @@ nsWalletlibService::OnStateChange(nsIWebProgress* aWebProgress, nsAutoString type; rv = inputElement->GetType(type); if (NS_SUCCEEDED(rv)) { - if (type.Equals(NS_LITERAL_STRING("password"), nsCaseInsensitiveStringComparator())) { + if (Compare(type, NS_LITERAL_STRING("password"), nsCaseInsensitiveStringComparator()) == 0) { passwordCount++; } } @@ -449,11 +449,8 @@ nsWalletlibService::OnStateChange(nsIWebProgress* aWebProgress, nsAutoString type; rv = inputElement->GetType(type); if (NS_SUCCEEDED(rv)) { - if (type.IsEmpty() || - type.Equals(NS_LITERAL_STRING("text"), - nsCaseInsensitiveStringComparator()) || - type.Equals(NS_LITERAL_STRING("password"), - nsCaseInsensitiveStringComparator())) { + if ((type.IsEmpty()) || (Compare(type, NS_LITERAL_STRING("text"), nsCaseInsensitiveStringComparator()) == 0) || + (Compare(type, NS_LITERAL_STRING("password"), nsCaseInsensitiveStringComparator()) == 0)) { nsAutoString field; rv = inputElement->GetName(field); if (NS_SUCCEEDED(rv)) { diff --git a/extensions/wallet/src/wallet.cpp b/extensions/wallet/src/wallet.cpp index 72200363696..0a9b646387d 100644 --- a/extensions/wallet/src/wallet.cpp +++ b/extensions/wallet/src/wallet.cpp @@ -1960,16 +1960,14 @@ wallet_StepForwardOrBack if (goForward) { if (NS_SUCCEEDED(result) && (type.IsEmpty() || - type.Equals(NS_LITERAL_STRING("text"), - nsCaseInsensitiveStringComparator()))) { + (Compare(type, NS_LITERAL_STRING("text"), + nsCaseInsensitiveStringComparator()) == 0))) { /* at element and it's type is either "text" or is missing ("text" by default) */ atInputOrSelect = PR_TRUE; return; } } else { - if (NS_SUCCEEDED(result) && - !type.Equals(NS_LITERAL_STRING("hidden"), - nsCaseInsensitiveStringComparator())) { + if (NS_SUCCEEDED(result) && (Compare(type, NS_LITERAL_STRING("hidden"), nsCaseInsensitiveStringComparator()) != 0)) { /* at element and it's type is not "hidden" */ atInputOrSelect = PR_TRUE; return; @@ -2404,10 +2402,7 @@ wallet_GetPrefills( if ((NS_SUCCEEDED(result)) && (nsnull != inputElement)) { nsAutoString type; result = inputElement->GetType(type); - if (NS_SUCCEEDED(result) && - (type.IsEmpty() || - type.Equals(NS_LITERAL_STRING("text"), - nsCaseInsensitiveStringComparator()))) { + if ((NS_SUCCEEDED(result)) && ((type.IsEmpty()) || (Compare(type, NS_LITERAL_STRING("text"), nsCaseInsensitiveStringComparator()) == 0))) { nsAutoString field; result = inputElement->GetName(field); if (NS_SUCCEEDED(result)) { @@ -3641,10 +3636,8 @@ wallet_CaptureInputElement(nsIDOMNode* elementNode, nsIDocument* doc) { /* it's an input element */ nsAutoString type; result = inputElement->GetType(type); - if (NS_SUCCEEDED(result) && - (type.IsEmpty() || - type.Equals(NS_LITERAL_STRING("text"), - nsCaseInsensitiveStringComparator()))) { + if ((NS_SUCCEEDED(result)) && + (type.IsEmpty() || (Compare(type, NS_LITERAL_STRING("text"), nsCaseInsensitiveStringComparator()) == 0))) { nsAutoString field; result = inputElement->GetName(field); if (NS_SUCCEEDED(result)) { @@ -3999,8 +3992,8 @@ WLLT_OnSubmit(nsIContent* currentForm, nsIDOMWindowInternal* window) { rv = inputElement->GetType(type); if (NS_SUCCEEDED(rv)) { - PRBool isText = (type.IsEmpty() || type.Equals(NS_LITERAL_STRING("text"), nsCaseInsensitiveStringComparator())); - PRBool isPassword = type.Equals(NS_LITERAL_STRING("password"), nsCaseInsensitiveStringComparator()); + PRBool isText = (type.IsEmpty() || (Compare(type, NS_LITERAL_STRING("text"), nsCaseInsensitiveStringComparator())==0)); + PRBool isPassword = (Compare(type, NS_LITERAL_STRING("password"), nsCaseInsensitiveStringComparator())==0); // don't save password if field was left blank if (isPassword) { diff --git a/htmlparser/src/CNavDTD.cpp b/htmlparser/src/CNavDTD.cpp index e424a0e72bc..3c5474218f0 100644 --- a/htmlparser/src/CNavDTD.cpp +++ b/htmlparser/src/CNavDTD.cpp @@ -1013,12 +1013,12 @@ nsresult CNavDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){ if(theCount) { PRInt32 theIndex=0; for(theIndex=0;theIndex GetStringValue()); - if(!theStr.Equals(NS_LITERAL_STRING("XI"), nsCaseInsensitiveStringComparator())) { + if(Compare(theStr, NS_LITERAL_STRING("XI"), nsCaseInsensitiveStringComparator()) != 0) { PRUnichar theChar=theStr.CharAt(0); if((nsCRT::IsAsciiDigit(theChar)) || ('X'==theChar) || ('x'==theChar)){ theStr.Assign(NS_LITERAL_STRING("#") + theStr); diff --git a/intl/chardet/src/nsMetaCharsetObserver.cpp b/intl/chardet/src/nsMetaCharsetObserver.cpp index cb2e5cbf006..74073789e6a 100644 --- a/intl/chardet/src/nsMetaCharsetObserver.cpp +++ b/intl/chardet/src/nsMetaCharsetObserver.cpp @@ -106,8 +106,7 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify( const PRUnichar* valueArray[]) { - if(!nsDependentString(aTag).Equals(NS_LITERAL_STRING("META"), - nsCaseInsensitiveStringComparator())) + if(0 != Compare(nsDependentString(aTag), NS_LITERAL_STRING("META"), nsCaseInsensitiveStringComparator())) return NS_ERROR_ILLEGAL_VALUE; else return Notify(aDocumentID, numOfAttributes, nameArray, valueArray); @@ -148,8 +147,8 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify( const PRUnichar* aTag, const nsStringArray* keys, const nsStringArray* values) { - if(!nsDependentString(aTag).Equals(NS_LITERAL_STRING("META"), - nsCaseInsensitiveStringComparator())) + if(0 != Compare(nsDependentString(aTag), NS_LITERAL_STRING("META"), + nsCaseInsensitiveStringComparator())) return NS_ERROR_ILLEGAL_VALUE; else return Notify(aWebShell, aChannel, keys, values); @@ -216,14 +215,17 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify( while(IS_SPACE_CHARS(*keyStr)) keyStr++; - if(Substring(keyStr, keyStr+10).Equals(NS_LITERAL_STRING("HTTP-EQUIV"), - nsCaseInsensitiveStringComparator())) + if(0 == Compare(Substring(keyStr, keyStr+10), + NS_LITERAL_STRING("HTTP-EQUIV"), + nsCaseInsensitiveStringComparator())) httpEquivValue = values->StringAt(i)->get(); - else if(Substring(keyStr, keyStr+7).Equals(NS_LITERAL_STRING("content"), - nsCaseInsensitiveStringComparator())) + else if(0 == Compare(Substring(keyStr, keyStr+7), + NS_LITERAL_STRING("content"), + nsCaseInsensitiveStringComparator())) contentValue = values->StringAt(i)->get(); - else if (Substring(keyStr, keyStr+7).Equals(NS_LITERAL_STRING("charset"), - nsCaseInsensitiveStringComparator())) + else if (0 == Compare(Substring(keyStr, keyStr+7), + NS_LITERAL_STRING("charset"), + nsCaseInsensitiveStringComparator())) charsetValue = values->StringAt(i)->get(); } NS_NAMED_LITERAL_STRING(contenttype, "Content-Type"); @@ -239,26 +241,26 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify( if( // first try unquoted strings - ((Substring(httpEquivValue, - httpEquivValue+contenttype.Length()).Equals(contenttype, - nsCaseInsensitiveStringComparator())) || + ((0==Compare(Substring(httpEquivValue,httpEquivValue+contenttype.Length()), + contenttype, + nsCaseInsensitiveStringComparator())) || // now try "quoted" or 'quoted' strings (( (httpEquivValue[0]=='\'') || (httpEquivValue[0]=='\"') ) && - (Substring(httpEquivValue+1, - httpEquivValue+1+contenttype.Length()).Equals(contenttype, - nsCaseInsensitiveStringComparator())) + (0==Compare(Substring(httpEquivValue+1, httpEquivValue+1+contenttype.Length()), + contenttype, + nsCaseInsensitiveStringComparator())) )) && // first try unquoted strings - ((Substring(contentValue, - contentValue+texthtml.Length()).Equals(texthtml, - nsCaseInsensitiveStringComparator())) || + ((0==Compare(Substring(contentValue,contentValue+texthtml.Length()), + texthtml, + nsCaseInsensitiveStringComparator())) || // now try "quoted" or 'quoted' strings (((contentValue[0]=='\'') || (contentValue[0]=='\"'))&& - (Substring(contentValue+1, - contentValue+1+texthtml.Length()).Equals(texthtml, - nsCaseInsensitiveStringComparator())) + (0==Compare(Substring(contentValue+1, contentValue+1+texthtml.Length()), + texthtml, + nsCaseInsensitiveStringComparator())) )) ) { @@ -350,8 +352,8 @@ NS_IMETHODIMP nsMetaCharsetObserver::GetCharsetFromCompatibilityTag( // e.g. PRInt32 numOfAttributes = keys->Count(); if ((numOfAttributes >= 3) && - (keys->StringAt(0)->Equals(NS_LITERAL_STRING("charset"), - nsCaseInsensitiveStringComparator()))) + (0 == Compare(*keys->StringAt(0), NS_LITERAL_STRING("charset"), + nsCaseInsensitiveStringComparator()))) { nsAutoString srcStr((values->StringAt(numOfAttributes-2))->get()); PRInt32 err; diff --git a/intl/chardet/src/nsXMLEncodingObserver.cpp b/intl/chardet/src/nsXMLEncodingObserver.cpp index aa437feccc1..fa12c04a90c 100644 --- a/intl/chardet/src/nsXMLEncodingObserver.cpp +++ b/intl/chardet/src/nsXMLEncodingObserver.cpp @@ -94,8 +94,8 @@ NS_IMETHODIMP nsXMLEncodingObserver::Notify( const PRUnichar* nameArray[], const PRUnichar* valueArray[]) { - if(!nsDependentString(aTag).Equals(NS_LITERAL_STRING("?XML"), - nsCaseInsensitiveStringComparator())) + if(0 != Compare(nsDependentString(aTag), NS_LITERAL_STRING("?XML"), + nsCaseInsensitiveStringComparator())) return NS_ERROR_ILLEGAL_VALUE; else return Notify(aDocumentID, numOfAttributes, nameArray, valueArray); @@ -143,8 +143,8 @@ NS_IMETHODIMP nsXMLEncodingObserver::Notify( } else if(0==nsCRT::strcmp(nameArray[i], NS_LITERAL_STRING("charsetSource").get())) { bGotCurrentCharsetSource = PR_TRUE; charsetSourceStr = valueArray[i]; - } else if(nsDependentString(nameArray[i]).Equals(NS_LITERAL_STRING("encoding"), - nsCaseInsensitiveStringComparator())) { + } else if(0==Compare(nsDependentString(nameArray[i]), NS_LITERAL_STRING("encoding"), + nsCaseInsensitiveStringComparator())) { bGotEncoding = PR_TRUE; encoding = valueArray[i]; } diff --git a/intl/locale/src/unix/nsCollationUnix.cpp b/intl/locale/src/unix/nsCollationUnix.cpp index 392e0420ca4..a73e33c6a6a 100644 --- a/intl/locale/src/unix/nsCollationUnix.cpp +++ b/intl/locale/src/unix/nsCollationUnix.cpp @@ -96,9 +96,7 @@ nsresult nsCollationUnix::Initialize(nsILocale* locale) PRUnichar *prefValue; res = prefs->GetLocalizedUnicharPref("intl.collationOption", &prefValue); if (NS_SUCCEEDED(res)) { - mUseCodePointOrder = - nsDependentString(prefValue).Equals(NS_LITERAL_STRING("useCodePointOrder"), - nsCaseInsensitiveStringComparator()); + mUseCodePointOrder = (Compare(nsDependentString(prefValue), NS_LITERAL_STRING("useCodePointOrder"), nsCaseInsensitiveStringComparator())==0); nsMemory::Free(prefValue); } } diff --git a/intl/uconv/src/nsCharsetAliasImp.cpp b/intl/uconv/src/nsCharsetAliasImp.cpp index 813c572f8ab..a2a479348b6 100644 --- a/intl/uconv/src/nsCharsetAliasImp.cpp +++ b/intl/uconv/src/nsCharsetAliasImp.cpp @@ -127,7 +127,7 @@ NS_IMETHODIMP nsCharsetAlias2::Equals(const nsAReadableString& aCharset1, const { nsresult res = NS_OK; - if(aCharset1.Equals(aCharset2, nsCaseInsensitiveStringComparator())) { + if(Compare(aCharset1, aCharset2, nsCaseInsensitiveStringComparator()) == 0) { *oResult = PR_TRUE; return res; } diff --git a/mailnews/absync/src/nsAbSync.cpp b/mailnews/absync/src/nsAbSync.cpp index 46f5a62e8a8..842d76840a2 100644 --- a/mailnews/absync/src/nsAbSync.cpp +++ b/mailnews/absync/src/nsAbSync.cpp @@ -2816,20 +2816,15 @@ nsAbSync::GetTypeOfPhoneNumber(nsString tagName) continue; phoneType.Cut(0, loc+1); - if (phoneType.Equals(NS_LITERAL_STRING(ABSYNC_HOME_PHONE_TYPE), - nsCaseInsensitiveStringComparator())) + if (!Compare(phoneType, NS_LITERAL_STRING(ABSYNC_HOME_PHONE_TYPE), nsCaseInsensitiveStringComparator())) return ABSYNC_HOME_PHONE_ID; - else if (phoneType.Equals(NS_LITERAL_STRING(ABSYNC_WORK_PHONE_TYPE), - nsCaseInsensitiveStringComparator())) + else if (!Compare(phoneType, NS_LITERAL_STRING(ABSYNC_WORK_PHONE_TYPE), nsCaseInsensitiveStringComparator())) return ABSYNC_WORK_PHONE_ID; - else if (phoneType.Equals(NS_LITERAL_STRING(ABSYNC_FAX_PHONE_TYPE), - nsCaseInsensitiveStringComparator())) + else if (!Compare(phoneType, NS_LITERAL_STRING(ABSYNC_FAX_PHONE_TYPE), nsCaseInsensitiveStringComparator())) return ABSYNC_FAX_PHONE_ID; - else if (phoneType.Equals(NS_LITERAL_STRING(ABSYNC_PAGER_PHONE_TYPE), - nsCaseInsensitiveStringComparator())) + else if (!Compare(phoneType, NS_LITERAL_STRING(ABSYNC_PAGER_PHONE_TYPE), nsCaseInsensitiveStringComparator())) return ABSYNC_PAGER_PHONE_ID; - else if (phoneType.Equals(NS_LITERAL_STRING(ABSYNC_CELL_PHONE_TYPE), - nsCaseInsensitiveStringComparator())) + else if (!Compare(phoneType, NS_LITERAL_STRING(ABSYNC_CELL_PHONE_TYPE), nsCaseInsensitiveStringComparator())) return ABSYNC_CELL_PHONE_ID; } } @@ -2919,8 +2914,7 @@ nsAbSync::AddValueToNewCard(nsIAbCard *aCard, nsString *aTagName, nsString *aTag PR_FREEIF(tValue); } - if (Substring(*aTagName, 0, 5).Equals(NS_LITERAL_STRING("phone"), - nsCaseInsensitiveStringComparator())) + if (!Compare(Substring(*aTagName, 0, 5), NS_LITERAL_STRING("phone"), nsCaseInsensitiveStringComparator())) { nsString tempVal; tempVal.Append(*aTagName + diff --git a/mailnews/addrbook/src/nsAbAutoCompleteSession.cpp b/mailnews/addrbook/src/nsAbAutoCompleteSession.cpp index 750489fbc45..6d8e721931b 100644 --- a/mailnews/addrbook/src/nsAbAutoCompleteSession.cpp +++ b/mailnews/addrbook/src/nsAbAutoCompleteSession.cpp @@ -100,8 +100,8 @@ PRBool nsAbAutoCompleteSession::ItsADuplicate(PRUnichar* fullAddrStr, nsIAutoCom rv = resultItem->GetValue(valueStr); if (NS_SUCCEEDED(rv) && !valueStr.IsEmpty()) { - if (nsDependentString(fullAddrStr).Equals(valueStr, - nsCaseInsensitiveStringComparator())) + if (Compare(nsDependentString(fullAddrStr), valueStr, + nsCaseInsensitiveStringComparator())==0) return PR_TRUE; } } @@ -266,9 +266,9 @@ static PRBool CommonPrefix(const PRUnichar *aString, const PRUnichar *aSubstr, P if (!aSubstrLen || (nsCRT::strlen(aString) < NS_STATIC_CAST(PRUint32, aSubstrLen))) return PR_FALSE; - return (Substring(aString, - aString+aSubstrLen).Equals(Substring(aSubstr, aSubstr+aSubstrLen), - nsCaseInsensitiveStringComparator())); + return (Compare(Substring(aString, aString+aSubstrLen), + Substring(aSubstr, aSubstr+aSubstrLen), + nsCaseInsensitiveStringComparator()) == 0); } @@ -295,48 +295,46 @@ nsAbAutoCompleteSession::CheckEntry(nsAbAutoCompleteSearchString* searchStr, fullStringLen = searchStr->mFullStringLen; } - nsDependentString fullStringStr(fullString, fullStringLen); - // First check for a Nickname exact match - if (nickName && - fullStringStr.Equals(nsDependentString(nickName), - nsCaseInsensitiveStringComparator())) + if (nickName && Compare(nsDependentString(fullString), + nsDependentString(nickName), + nsCaseInsensitiveStringComparator()) == 0) { *matchType = NICKNAME_EXACT_MATCH; return PR_TRUE; } // Then check for a display Name exact match - if (displayName && - fullStringStr.Equals(nsDependentString(displayName), - nsCaseInsensitiveStringComparator())) + if (displayName && Compare(nsDependentString(fullString), + nsDependentString(displayName), + nsCaseInsensitiveStringComparator()) == 0) { *matchType = NAME_EXACT_MATCH; return PR_TRUE; } // Then check for a fisrt Name exact match - if (firstName && - fullStringStr.Equals(nsDependentString(firstName), - nsCaseInsensitiveStringComparator())) + if (firstName && Compare(nsDependentString(fullString), + nsDependentString(firstName), + nsCaseInsensitiveStringComparator()) == 0) { *matchType = NAME_EXACT_MATCH; return PR_TRUE; } // Then check for a last Name exact match - if (lastName && - fullStringStr.Equals(nsDependentString(lastName), - nsCaseInsensitiveStringComparator())) + if (lastName && Compare(nsDependentString(fullString), + nsDependentString(lastName), + nsCaseInsensitiveStringComparator()) == 0) { *matchType = NAME_EXACT_MATCH; return PR_TRUE; } // Then check for a Email exact match - if (emailAddress && - fullStringStr.Equals(nsDependentString(emailAddress), - nsCaseInsensitiveStringComparator())) + if (emailAddress && Compare(nsDependentString(fullString), + nsDependentString(emailAddress), + nsCaseInsensitiveStringComparator()) == 0) { *matchType = EMAIL_EXACT_MATCH; return PR_TRUE; diff --git a/mailnews/base/src/nsMsgAccountManager.cpp b/mailnews/base/src/nsMsgAccountManager.cpp index 5186722d3c7..4766138c598 100644 --- a/mailnews/base/src/nsMsgAccountManager.cpp +++ b/mailnews/base/src/nsMsgAccountManager.cpp @@ -1037,9 +1037,7 @@ PRBool PR_CALLBACK nsMsgAccountManager::cleanupOnExit(nsHashKey *aKey, void *aDa nsCOMPtr inboxFolder = do_QueryInterface(aSupport); nsXPIDLString folderName; inboxFolder->GetName(getter_Copies(folderName)); - if (folderName && - folderName.Equals(NS_LITERAL_STRING("INBOX"), - nsCaseInsensitiveStringComparator())) + if (folderName && Compare(folderName, NS_LITERAL_STRING("INBOX"), nsCaseInsensitiveStringComparator()) ==0) { rv1 = inboxFolder->Compact(urlListener, nsnull /* msgwindow */); if (NS_SUCCEEDED(rv1)) diff --git a/mailnews/base/util/nsMsgFolder.cpp b/mailnews/base/util/nsMsgFolder.cpp index f742d949d52..cf8b7d43a73 100644 --- a/mailnews/base/util/nsMsgFolder.cpp +++ b/mailnews/base/util/nsMsgFolder.cpp @@ -938,9 +938,8 @@ NS_IMETHODIMP nsMsgFolder::GetChildNamed(const char *name, nsISupports ** aChild rv = folder->GetName(getter_Copies(folderName)); // case-insensitive compare is probably LCD across OS filesystems - if (NS_SUCCEEDED(rv) && - folderName.Equals(uniName, - nsCaseInsensitiveStringComparator())) + if (NS_SUCCEEDED(rv) && Compare(folderName, uniName, + nsCaseInsensitiveStringComparator()) == 0) { *aChild = folder; NS_ADDREF(*aChild); diff --git a/mailnews/base/util/nsMsgI18N.cpp b/mailnews/base/util/nsMsgI18N.cpp index a7ebcc3d617..838e037a601 100644 --- a/mailnews/base/util/nsMsgI18N.cpp +++ b/mailnews/base/util/nsMsgI18N.cpp @@ -438,8 +438,7 @@ PRBool nsMsgI18Nmultibyte_charset(const char *charset) if (NS_SUCCEEDED(res)) { res = ccm2->GetCharsetData2(charsetAtom, NS_LITERAL_STRING(".isMultibyte").get(), &charsetData); if (NS_SUCCEEDED(res)) { - result = charsetData.Equals(NS_LITERAL_STRING("true"), - nsCaseInsensitiveStringComparator()); + result = !Compare(charsetData, NS_LITERAL_STRING("true"), nsCaseInsensitiveStringComparator()); } } } diff --git a/mailnews/compose/src/nsMsgCompose.cpp b/mailnews/compose/src/nsMsgCompose.cpp index dd1e11ab779..8e557bc2bf4 100644 --- a/mailnews/compose/src/nsMsgCompose.cpp +++ b/mailnews/compose/src/nsMsgCompose.cpp @@ -2324,8 +2324,9 @@ nsresult nsMsgComposeSendListener::OnStopSending(const char *aMsgID, nsresult aS { if (!fieldsFCC.IsEmpty()) { - if (fieldsFCC.Equals(NS_LITERAL_STRING("nocopy://"), - nsCaseInsensitiveStringComparator())) + if (Compare(nsDependentString(fieldsFCC), + NS_LITERAL_STRING("nocopy://"), + nsCaseInsensitiveStringComparator()) == 0) { compose->NotifyStateListeners(eComposeProcessDone, NS_OK); if (progress) @@ -3800,8 +3801,7 @@ nsresult nsMsgCompose::TagConvertible(nsIDOMNode *node, PRInt32 *_retval) if (NS_SUCCEEDED(pItem->GetNodeValue(typeValue))) { typeValue.StripChars("\""); - if (typeValue.Equals(NS_LITERAL_STRING("cite"), - nsCaseInsensitiveStringComparator())) + if (!Compare(typeValue, NS_LITERAL_STRING("cite"), nsCaseInsensitiveStringComparator())) *_retval = nsIMsgCompConvertible::Plain; } } diff --git a/mailnews/compose/src/nsMsgSend.cpp b/mailnews/compose/src/nsMsgSend.cpp index e79760a1f9e..a9ff3948ac1 100644 --- a/mailnews/compose/src/nsMsgSend.cpp +++ b/mailnews/compose/src/nsMsgSend.cpp @@ -1680,8 +1680,7 @@ nsMsgComposeAndSend::ProcessMultipartRelated(PRInt32 *aMailboxCount, PRInt32 *aN nsAutoString attributeValue; if (NS_SUCCEEDED(domElement->GetAttribute(NS_LITERAL_STRING("moz-do-not-send"), attributeValue))) { - if (attributeValue.Equals(NS_LITERAL_STRING("true"), - nsCaseInsensitiveStringComparator())) + if (!Compare(attributeValue, NS_LITERAL_STRING("true"), nsCaseInsensitiveStringComparator())) continue; } } diff --git a/mailnews/imap/src/nsImapMailFolder.cpp b/mailnews/imap/src/nsImapMailFolder.cpp index 36d1661a5f3..0562e3811b7 100644 --- a/mailnews/imap/src/nsImapMailFolder.cpp +++ b/mailnews/imap/src/nsImapMailFolder.cpp @@ -710,12 +710,12 @@ NS_IMETHODIMP nsImapMailFolder::CreateSubfolder(const PRUnichar* folderName, nsI nsresult rv = NS_ERROR_NULL_POINTER; if (!folderName) return rv; - if ( nsDependentString(folderName).Equals(NS_LITERAL_STRING("Trash"),nsCaseInsensitiveStringComparator()) ) // Trash , a special folder + if ( Compare(nsDependentString(folderName),NS_LITERAL_STRING("Trash"),nsCaseInsensitiveStringComparator()) == 0 ) // Trash , a special folder { AlertSpecialFolderExists(msgWindow); return NS_MSG_FOLDER_EXISTS; } - else if ( nsDependentString(folderName).Equals(NS_LITERAL_STRING("Inbox"),nsCaseInsensitiveStringComparator()) ) // Inbox, a special folder + else if ( Compare(nsDependentString(folderName),NS_LITERAL_STRING("Inbox"),nsCaseInsensitiveStringComparator()) == 0 ) // Inbox, a special folder { AlertSpecialFolderExists(msgWindow); return NS_MSG_FOLDER_EXISTS; @@ -3923,8 +3923,9 @@ PRBool nsImapMailFolder::ShowDeletedMessages() { nsXPIDLString folderName; GetName(getter_Copies(folderName)); - if (Substring(folderName,0,convertedName.Length()).Equals(convertedName, - nsCaseInsensitiveStringComparator())) + if (!Compare(Substring(folderName,0,convertedName.Length()), + convertedName, + nsCaseInsensitiveStringComparator())) showDeleted = PR_TRUE; } } diff --git a/mailnews/import/eudora/src/nsEudoraCompose.cpp b/mailnews/import/eudora/src/nsEudoraCompose.cpp index ea68be524be..85cdc2a9288 100644 --- a/mailnews/import/eudora/src/nsEudoraCompose.cpp +++ b/mailnews/import/eudora/src/nsEudoraCompose.cpp @@ -504,7 +504,7 @@ void nsEudoraCompose::ExtractType( nsString& str) // valid multipart! if (str.Length() > 10) { str.Left( tStr, 10); - if (tStr.Equals(NS_LITERAL_STRING("multipart/"), nsCaseInsensitiveStringComparator())) + if (!Compare(tStr, NS_LITERAL_STRING("multipart/"), nsCaseInsensitiveStringComparator())) str.Truncate(); } } diff --git a/mailnews/import/eudora/src/nsEudoraMac.cpp b/mailnews/import/eudora/src/nsEudoraMac.cpp index 940be7c2060..8d2d7537586 100644 --- a/mailnews/import/eudora/src/nsEudoraMac.cpp +++ b/mailnews/import/eudora/src/nsEudoraMac.cpp @@ -1030,7 +1030,7 @@ PRBool nsEudoraMac::IsValidMailboxName( nsCString& fName) { if (m_depth > 1) return( PR_TRUE); - if (fName.Equals(NS_LITERAL_CSTRING("Eudora Nicknames"), nsCaseInsensitiveCStringComparator())) + if (!Compare(fName, NS_LITERAL_CSTRING("Eudora Nicknames"), nsCaseInsensitiveCStringComparator())) return( PR_FALSE); return( PR_TRUE); } diff --git a/mailnews/import/eudora/src/nsEudoraWin32.cpp b/mailnews/import/eudora/src/nsEudoraWin32.cpp index 3784a61a386..8910eff507e 100644 --- a/mailnews/import/eudora/src/nsEudoraWin32.cpp +++ b/mailnews/import/eudora/src/nsEudoraWin32.cpp @@ -694,7 +694,7 @@ void nsEudoraWin32::GetAccountName( const char *pSection, nsString& str) nsCString s(pSection); - if (s.Equals(NS_LITERAL_CSTRING("Settings"), nsCaseInsensitiveCStringComparator())) { + if (!Compare(s, NS_LITERAL_CSTRING("Settings"), nsCaseInsensitiveCStringComparator())) { str.Assign(NS_LITERAL_STRING("Eudora ")); str.AppendWithConversion( pSection); } @@ -703,7 +703,7 @@ void nsEudoraWin32::GetAccountName( const char *pSection, nsString& str) str.AssignWithConversion(pSection); if (s.Length() > 8) { s.Left( tStr, 8); - if (tStr.Equals(NS_LITERAL_CSTRING("Persona-"), nsCaseInsensitiveCStringComparator())) { + if (!Compare(tStr, NS_LITERAL_CSTRING("Persona-"), nsCaseInsensitiveCStringComparator())) { s.Right( tStr, s.Length() - 8); str.AssignWithConversion(tStr.get()); } @@ -1378,8 +1378,9 @@ nsresult nsEudoraWin32::FoundAddressBook( nsIFileSpec *spec, const PRUnichar *pN nsCRT::free( pLeaf); nsString tStr; name.Right( tStr, 4); - if (tStr.Equals(NS_LITERAL_STRING(".txt"), - nsCaseInsensitiveStringComparator())) { + if (! Compare(tStr, + NS_LITERAL_STRING(".txt"), + nsCaseInsensitiveStringComparator())) { name.Left( tStr, name.Length() - 4); name = tStr; } diff --git a/mailnews/import/oexpress/nsOEScanBoxes.cpp b/mailnews/import/oexpress/nsOEScanBoxes.cpp index dc6006cec27..88f178d0ed7 100644 --- a/mailnews/import/oexpress/nsOEScanBoxes.cpp +++ b/mailnews/import/oexpress/nsOEScanBoxes.cpp @@ -293,7 +293,7 @@ PRBool nsOEScanBoxes::FindMailBoxes( nsIFileSpec* descFile) #endif pEntry->fileName.Right( ext, 4); - if (!ext.Equals(mbxExt)) + if (Compare(ext, mbxExt)) pEntry->fileName.Append( ".mbx"); m_entryArray.AppendElement( pEntry); diff --git a/mailnews/import/outlook/src/MapiApi.cpp b/mailnews/import/outlook/src/MapiApi.cpp index 28e409b93d5..5e3deaeb84f 100644 --- a/mailnews/import/outlook/src/MapiApi.cpp +++ b/mailnews/import/outlook/src/MapiApi.cpp @@ -306,25 +306,24 @@ CGetStoreFoldersIter::CGetStoreFoldersIter( CMapiApi *pApi, CMapiFolderList& fol BOOL CGetStoreFoldersIter::ExcludeFolderClass( const PRUnichar *pName) { BOOL bResult; - nsDependentString pNameStr(pName); if (m_isMail) { bResult = FALSE; - if (pNameStr.Equals(NS_LITERAL_STRING("IPF.Appointment"))) + if (!Compare(nsDependentString(pName), NS_LITERAL_STRING("IPF.Appointment"))) bResult = TRUE; - else if (pNameStr.Equals(NS_LITERAL_STRING("IPF.Contact"))) + else if (!Compare(nsDependentString(pName), NS_LITERAL_STRING("IPF.Contact"))) bResult = TRUE; - else if (pNameStr.Equals(NS_LITERAL_STRING("IPF.Journal"))) + else if (!Compare(nsDependentString(pName), NS_LITERAL_STRING("IPF.Journal"))) bResult = TRUE; - else if (pNameStr.Equals(NS_LITERAL_STRING("IPF.StickyNote"))) + else if (!Compare(nsDependentString(pName), NS_LITERAL_STRING("IPF.StickyNote"))) bResult = TRUE; - else if (pNameStr.Equals(NS_LITERAL_STRING("IPF.Task"))) + else if (!Compare(nsDependentString(pName), NS_LITERAL_STRING("IPF.Task"))) bResult = TRUE; // else if (!stricmp( pName, "IPF.Note")) // bResult = TRUE; } else { bResult = TRUE; - if (pNameStr.Equals(NS_LITERAL_STRING("IPF.Contact"))) + if (!Compare( nsDependentString(pName), NS_LITERAL_STRING("IPF.Contact"))) bResult = FALSE; } diff --git a/mailnews/local/src/nsLocalMailFolder.cpp b/mailnews/local/src/nsLocalMailFolder.cpp index 0062841a3b8..c5a25783819 100644 --- a/mailnews/local/src/nsLocalMailFolder.cpp +++ b/mailnews/local/src/nsLocalMailFolder.cpp @@ -801,8 +801,8 @@ nsMsgLocalMailFolder::CheckIfFolderExists(const PRUnichar *folderName, nsFileSpe PR_FREEIF(leaf); if (!leafName.IsEmpty() && - leafName.Equals(nsDependentString(folderName), - nsCaseInsensitiveStringComparator())) + Compare(nsDependentString(folderName), leafName, + nsCaseInsensitiveStringComparator()) == 0) { if (msgWindow) AlertFolderExists(msgWindow); diff --git a/netwerk/cache/src/nsCacheEntry.cpp b/netwerk/cache/src/nsCacheEntry.cpp index c62a1907e07..3131215e25c 100644 --- a/netwerk/cache/src/nsCacheEntry.cpp +++ b/netwerk/cache/src/nsCacheEntry.cpp @@ -591,7 +591,7 @@ nsCacheEntryHashTable::MatchEntry(PLDHashTable * /* table */, NS_ASSERTION(key != nsnull, "### nsCacheEntryHashTable::MatchEntry : null key"); nsCacheEntry *cacheEntry = ((nsCacheEntryHashTableEntry *)hashEntry)->cacheEntry; - return cacheEntry->mKey->Equals(*(nsCString *)key); + return Compare(*cacheEntry->mKey, *(nsCString *)key) == 0; } diff --git a/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp b/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp index 2813b875e7f..6effaa73c82 100644 --- a/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp +++ b/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp @@ -2132,7 +2132,7 @@ nsFtpState::SendFTPCommand(nsCString& command) // we don't want to log the password: nsCAutoString logcmd(command); - if (Substring(command, 0, 5).Equals(NS_LITERAL_CSTRING("PASS "))) + if (Compare(Substring(command, 0, 5), NS_LITERAL_CSTRING("PASS ")) == 0) logcmd = "PASS xxxxx"; PR_LOG(gFTPLog, PR_LOG_DEBUG, ("(%x)(dwait=%d) Writing \"%s\"\n", this, mWaitingForDConn, logcmd.get())); diff --git a/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp b/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp index 3f1f21384a6..dee8a652e5e 100644 --- a/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp +++ b/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp @@ -542,10 +542,11 @@ mozTXTToHTMLConv::ItMatchesDelimited(const PRUnichar * aInString, nsCRT::IsAsciiDigit(textAfterPos) || textAfterPos == *rep ) || - !Substring(nsDependentString(aInString, aInLength), - (before == LT_IGNORE ? 0 : 1), - aRepLen).Equals(nsDependentString(rep, aRepLen), - nsCaseInsensitiveStringComparator()) + Compare(Substring(nsDependentString(aInString, aInLength), + (before == LT_IGNORE ? 0 : 1), + aRepLen), + nsDependentString(rep, aRepLen), + nsCaseInsensitiveStringComparator()) ) return PR_FALSE; @@ -977,9 +978,8 @@ mozTXTToHTMLConv::CiteLevelTXT(const PRUnichar *line, const PRUnichar * indexString = &line[logLineStart]; // here, |logLineStart < lineLength| is always true PRUint32 minlength = MinInt(6,nsCRT::strlen(indexString)); - if (Substring(indexString, - indexString+minlength).Equals(Substring(NS_LITERAL_STRING(">From "), 0, minlength), - nsCaseInsensitiveStringComparator())) + if (!Compare(Substring(indexString, indexString+minlength), + Substring(NS_LITERAL_STRING(">From "), 0, minlength), nsCaseInsensitiveStringComparator())) //XXX RFC2646 moreCites = PR_FALSE; else diff --git a/netwerk/streamconv/converters/nsUnknownDecoder.cpp b/netwerk/streamconv/converters/nsUnknownDecoder.cpp index ce7778f147a..276196779c3 100644 --- a/netwerk/streamconv/converters/nsUnknownDecoder.cpp +++ b/netwerk/streamconv/converters/nsUnknownDecoder.cpp @@ -304,10 +304,8 @@ void nsUnknownDecoder::DetermineContentType(nsIRequest* request) // // If the buffer begins with a mailbox delimiter then it is not HTML // - else if (Substring(str, 0, 5).Equals(NS_LITERAL_CSTRING("From "), - nsCaseInsensitiveCStringComparator()) || - Substring(str, 0, 6).Equals(NS_LITERAL_CSTRING(">From "), - nsCaseInsensitiveCStringComparator())) { + else if (!Compare(Substring(str, 0, 5), NS_LITERAL_CSTRING("From "), nsCaseInsensitiveCStringComparator()) || + !Compare(Substring(str, 0, 6), NS_LITERAL_CSTRING(">From "), nsCaseInsensitiveCStringComparator())) { mContentType = TEXT_PLAIN; } // diff --git a/parser/htmlparser/src/CNavDTD.cpp b/parser/htmlparser/src/CNavDTD.cpp index e424a0e72bc..3c5474218f0 100644 --- a/parser/htmlparser/src/CNavDTD.cpp +++ b/parser/htmlparser/src/CNavDTD.cpp @@ -1013,12 +1013,12 @@ nsresult CNavDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){ if(theCount) { PRInt32 theIndex=0; for(theIndex=0;theIndex GetStringValue()); - if(!theStr.Equals(NS_LITERAL_STRING("XI"), nsCaseInsensitiveStringComparator())) { + if(Compare(theStr, NS_LITERAL_STRING("XI"), nsCaseInsensitiveStringComparator()) != 0) { PRUnichar theChar=theStr.CharAt(0); if((nsCRT::IsAsciiDigit(theChar)) || ('X'==theChar) || ('x'==theChar)){ theStr.Assign(NS_LITERAL_STRING("#") + theStr); diff --git a/rdf/base/src/rdfutil.cpp b/rdf/base/src/rdfutil.cpp index 07183c75287..3aa9b5d85aa 100644 --- a/rdf/base/src/rdfutil.cpp +++ b/rdf/base/src/rdfutil.cpp @@ -92,8 +92,8 @@ rdf_RequiresAbsoluteURI(const nsString& uri) // cheap shot at figuring out if this requires an absolute url translation if (Substring(uri, 0, 4).Equals(NS_LITERAL_STRING("urn:")) || Substring(uri, 0, 9).Equals(NS_LITERAL_STRING("chrome:")) || - Substring(uri, 0, 3).Equals(NS_LITERAL_STRING("nc:"), - nsCaseInsensitiveStringComparator())) { + !Compare(Substring(uri, 0, 3), NS_LITERAL_STRING("nc:"), + nsCaseInsensitiveStringComparator())) { return PR_FALSE; } return PR_TRUE; diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index a7160cc8884..28f2afd1203 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -1744,8 +1744,9 @@ nsresult nsExternalHelperAppService::GetMIMEInfoForExtensionFromExtras(const cha while (start != end) { FindCharInReadable(',', iter, end); - if (Substring(start, iter).Equals(extension, - nsCaseInsensitiveCStringComparator())) + if (Compare(Substring(start, iter), + extension, + nsCaseInsensitiveCStringComparator()) == 0) { // This is the one. Create MIMEInfo object and set // attributes appropriately. diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp index 7cf6f53a51f..01ba227d643 100644 --- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp +++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp @@ -442,8 +442,9 @@ GetTypeAndDescriptionFromMimetypesFile(const nsAString& aFilename, while (start != end) { FindCharInReadable(',', iter, end); - if (Substring(start, iter).Equals(aFileExtension, - nsCaseInsensitiveStringComparator())) { + if (Compare(Substring(start, iter), + aFileExtension, + nsCaseInsensitiveStringComparator()) == 0) { // it's a match. Assign the type and description and run aMajorType.Assign(Substring(majorTypeStart, majorTypeEnd)); aMinorType.Assign(Substring(minorTypeStart, minorTypeEnd)); @@ -573,12 +574,12 @@ GetExtensionsAndDescriptionFromMimetypesFile(const nsAString& aFilename, } #endif if (NS_SUCCEEDED(rv) && - Substring(majorTypeStart, - majorTypeEnd).Equals(aMajorType, - nsCaseInsensitiveStringComparator())&& - Substring(minorTypeStart, - minorTypeEnd).Equals(aMinorType, - nsCaseInsensitiveStringComparator())) { + Compare(Substring(majorTypeStart, majorTypeEnd), + aMajorType, + nsCaseInsensitiveStringComparator()) == 0 && + Compare(Substring(minorTypeStart, minorTypeEnd), + aMinorType, + nsCaseInsensitiveStringComparator()) == 0) { // it's a match aFileExtensions.Assign(extensions); aDescription.Assign(Substring(descriptionStart, descriptionEnd)); @@ -947,14 +948,13 @@ GetHandlerAndDescriptionFromMailcapFile(const nsAString& aFilename, rv = ParseMIMEType(start_iter, majorTypeStart, majorTypeEnd, minorTypeStart, minorTypeEnd, semicolon_iter); if (NS_SUCCEEDED(rv) && - Substring(majorTypeStart, - majorTypeEnd).Equals(aMajorType, - nsCaseInsensitiveStringComparator()) && - (Substring(minorTypeStart, - minorTypeEnd).Equals(NS_LITERAL_STRING("*")) || - Substring(minorTypeStart, - minorTypeEnd).Equals(aMinorType, - nsCaseInsensitiveStringComparator()))) { // we have a match + Compare(Substring(majorTypeStart, majorTypeEnd), + aMajorType, + nsCaseInsensitiveStringComparator()) == 0 && + (Substring(minorTypeStart, minorTypeEnd).Equals(NS_LITERAL_STRING("*")) || + Compare(Substring(minorTypeStart, minorTypeEnd), + aMinorType, + nsCaseInsensitiveStringComparator()) == 0)) { // we have a match PRBool match = PR_TRUE; ++semicolon_iter; // point at the first char past the semicolon start_iter = semicolon_iter; // handler string starts here diff --git a/xpfe/components/bookmarks/src/nsBookmarksService.cpp b/xpfe/components/bookmarks/src/nsBookmarksService.cpp index ce3c067a751..5799f6f5938 100644 --- a/xpfe/components/bookmarks/src/nsBookmarksService.cpp +++ b/xpfe/components/bookmarks/src/nsBookmarksService.cpp @@ -934,22 +934,27 @@ BookmarkParser::Unescape(nsString &text) while((offset = text.FindChar((PRUnichar('&')), offset)) >= 0) { - if (Substring(text, offset, 4).Equals(NS_LITERAL_STRING("<"), nsCaseInsensitiveStringComparator())) + // XXX get max of 6 chars; change the value below if + // we ever start looking for longer HTML-escaped values + nsAutoString temp; + text.Mid(temp, offset, 6); + + if (Compare(Substring(temp, 0, 4), NS_LITERAL_STRING("<"), nsCaseInsensitiveStringComparator()) == 0) { text.Cut(offset, 4); text.Insert(PRUnichar('<'), offset); } - else if (Substring(text, offset, 4).Equals(NS_LITERAL_STRING(">"), nsCaseInsensitiveStringComparator())) + if (Compare(Substring(temp, 0, 4), NS_LITERAL_STRING(">"), nsCaseInsensitiveStringComparator()) == 0) { text.Cut(offset, 4); text.Insert(PRUnichar('>'), offset); } - else if (Substring(text, offset, 5).Equals(NS_LITERAL_STRING("&"), nsCaseInsensitiveStringComparator())) + if (Compare(Substring(temp, 0, 5), NS_LITERAL_STRING("&"), nsCaseInsensitiveStringComparator()) == 0) { text.Cut(offset, 5); text.Insert(PRUnichar('&'), offset); } - else if (Substring(text, offset, 6).Equals(NS_LITERAL_STRING("""), nsCaseInsensitiveStringComparator())) + if (Compare(Substring(temp, 0, 6), NS_LITERAL_STRING("""), nsCaseInsensitiveStringComparator()) == 0) { text.Cut(offset, 6); text.Insert(PRUnichar('\"'), offset); diff --git a/xpfe/components/related/src/nsRelatedLinksHandler.cpp b/xpfe/components/related/src/nsRelatedLinksHandler.cpp index 8ee62965506..0dfcebb42e2 100644 --- a/xpfe/components/related/src/nsRelatedLinksHandler.cpp +++ b/xpfe/components/related/src/nsRelatedLinksHandler.cpp @@ -556,22 +556,27 @@ RelatedLinksStreamListener::Unescape(nsString &text) while((offset = text.FindChar((PRUnichar('&')), offset)) >= 0) { - if (Substring(text, offset, 4).Equals(NS_LITERAL_STRING("<"), nsCaseInsensitiveStringComparator())) + // XXX get max of 6 chars; change the value below if + // we ever start looking for longer HTML-escaped values + nsAutoString temp; + text.Mid(temp, offset, 6); + + if (Compare(Substring(temp, 0, 4), NS_LITERAL_STRING("<"), nsCaseInsensitiveStringComparator()) == 0) { text.Cut(offset, 4); text.Insert(PRUnichar('<'), offset); } - else if (Substring(text, offset, 4).Equals(NS_LITERAL_STRING(">"), nsCaseInsensitiveStringComparator())) + if (Compare(Substring(temp, 0, 4), NS_LITERAL_STRING(">"), nsCaseInsensitiveStringComparator()) == 0) { text.Cut(offset, 4); text.Insert(PRUnichar('>'), offset); } - else if (Substring(text, offset, 5).Equals(NS_LITERAL_STRING("&"), nsCaseInsensitiveStringComparator())) + if (Compare(Substring(temp, 0, 5), NS_LITERAL_STRING("&"), nsCaseInsensitiveStringComparator()) == 0) { text.Cut(offset, 5); text.Insert(PRUnichar('&'), offset); } - else if (Substring(text, offset, 6).Equals(NS_LITERAL_STRING("""), nsCaseInsensitiveStringComparator())) + if (Compare(Substring(temp, 0, 6), NS_LITERAL_STRING("""), nsCaseInsensitiveStringComparator()) == 0) { text.Cut(offset, 6); text.Insert(PRUnichar('\"'), offset); diff --git a/xpfe/components/urlbarhistory/src/nsUrlbarHistory.cpp b/xpfe/components/urlbarhistory/src/nsUrlbarHistory.cpp index 27241dd143b..828061499e4 100644 --- a/xpfe/components/urlbarhistory/src/nsUrlbarHistory.cpp +++ b/xpfe/components/urlbarhistory/src/nsUrlbarHistory.cpp @@ -337,9 +337,9 @@ nsUrlbarHistory::SearchPreviousResults(const PRUnichar *searchStr, nsIAutoComple // which doesn't make any sense (since the "!= 0" was inside the // parentheses) if (searchStrLen < prevSearchStrLen || - !Substring(searchStr, - searchStr+prevSearchStrLen).Equals(nsDependentString(prevSearchString, prevSearchStrLen), - nsCaseInsensitiveStringComparator())) + Compare(Substring(searchStr, searchStr+prevSearchStrLen), + nsDependentString(prevSearchString, prevSearchStrLen), + nsCaseInsensitiveStringComparator())!= 0) return NS_ERROR_ABORT; nsCOMPtr array; @@ -368,9 +368,9 @@ nsUrlbarHistory::SearchPreviousResults(const PRUnichar *searchStr, nsIAutoComple if (itemValue.IsEmpty()) continue; - if (nsDependentString(searchStr, - searchStrLen).Equals(Substring(itemValue, 0, searchStrLen), - nsCaseInsensitiveStringComparator())) + if (Compare(nsDependentString(searchStr, searchStrLen), + Substring(itemValue, 0, searchStrLen), + nsCaseInsensitiveStringComparator()) == 0) continue; } @@ -626,8 +626,8 @@ nsUrlbarHistory::CheckItemAvailability(const PRUnichar * aItem, nsIAutoCompleteR resultItem->GetValue(itemValue); // Using nsIURI to do comparisons didn't quite work out. // So use nsCRT methods - if (itemValue.Equals(nsDependentString(aItem), - nsCaseInsensitiveStringComparator())) + if (Compare(itemValue, nsDependentString(aItem), + nsCaseInsensitiveStringComparator()) == 0) { //printf("In CheckItemAvailability. Item already found\n"); *aResult = PR_TRUE;