Convert Compare() to Equals() where possible now that we can do

case-insensitive Equals().  Bug 115289, r=alecf, sr=jag
This commit is contained in:
bzbarsky%mit.edu 2002-02-05 02:03:07 +00:00
Родитель 8d7e1b0c62
Коммит 580e33204e
69 изменённых файлов: 321 добавлений и 305 удалений

Просмотреть файл

@ -1050,8 +1050,8 @@ nsDocument::SetHeaderData(nsIAtom* aHeaderField, const nsAReadableString& aData)
sheet->GetTitle(title);
if (!title.IsEmpty()) { // if sheet has title
PRBool disabled = (aData.IsEmpty() ||
Compare(title, aData,
nsCaseInsensitiveStringComparator()) != 0);
!title.Equals(aData,
nsCaseInsensitiveStringComparator()));
SetStyleSheetDisabledState(sheet, disabled);
}
}

Просмотреть файл

@ -839,23 +839,23 @@ nsGenericElement::InternalIsSupported(const nsAReadableString& aFeature,
*aReturn = PR_FALSE;
nsAutoString feature(aFeature);
if (!Compare(feature, NS_LITERAL_STRING("XML"), nsCaseInsensitiveStringComparator()) ||
!Compare(feature, NS_LITERAL_STRING("HTML"), nsCaseInsensitiveStringComparator())) {
if (feature.Equals(NS_LITERAL_STRING("XML"), nsCaseInsensitiveStringComparator()) ||
feature.Equals(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 (!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())) {
} 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())) {
if (aVersion.IsEmpty() || aVersion.Equals(NS_LITERAL_STRING("2.0"))) {
*aReturn = PR_TRUE;
}

Просмотреть файл

@ -172,9 +172,8 @@ PRBool nsHTMLValue::operator==(const nsHTMLValue& aOther) const
}
}
else if (nsnull != aOther.mValue.mString) {
return 0 == Compare(nsDependentString(mValue.mString),
nsDependentString(aOther.mValue.mString),
nsCaseInsensitiveStringComparator());
return nsDependentString(mValue.mString).Equals(nsDependentString(aOther.mValue.mString),
nsCaseInsensitiveStringComparator());
}
}
else if (eHTMLUnit_ISupports == mUnit) {

Просмотреть файл

@ -398,8 +398,8 @@ nsHTMLAnchorElement::StringToAttribute(nsIAtom* aAttribute,
}
}
else if (aAttribute == nsHTMLAtoms::suppress) {
if (Compare(aValue,NS_LITERAL_STRING("true"),
nsCaseInsensitiveStringComparator())) {
if (!aValue.Equals(NS_LITERAL_STRING("true"),
nsCaseInsensitiveStringComparator())) {
aResult.SetEmptyValue(); // XXX? shouldn't just leave "true"
return NS_CONTENT_ATTR_HAS_VALUE;
}

Просмотреть файл

@ -212,7 +212,7 @@ nsHTMLButtonElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
nsAutoString value(aValue);
if (aName == nsHTMLAtoms::disabled &&
!Compare(value, NS_LITERAL_STRING("false"), nsCaseInsensitiveStringComparator())) {
value.Equals(NS_LITERAL_STRING("false"), nsCaseInsensitiveStringComparator())) {
return UnsetAttr(aNameSpaceID, aName, aNotify);
}

Просмотреть файл

@ -5521,7 +5521,7 @@ nsCSSDeclaration::TryBackgroundPosition(nsAWritableString & aString,
AppendValueToString(eCSSProperty_background_x_position, backgroundXValue);
AppendValueToString(eCSSProperty_background_y_position, backgroundYValue);
aString.Append(backgroundYValue);
if (Compare(backgroundXValue, backgroundYValue, nsCaseInsensitiveStringComparator())) {
if (!backgroundXValue.Equals(backgroundYValue, nsCaseInsensitiveStringComparator())) {
// the two values are different
aString.Append(PRUnichar(' '));
aString.Append(backgroundXValue);

Просмотреть файл

@ -638,9 +638,8 @@ SheetLoadData::OnStreamComplete(nsIStreamLoader* aLoader,
}
}
if (mLoader->mNavQuirkMode ||
Compare(contentType,
NS_LITERAL_CSTRING("text/css"),
nsCaseInsensitiveCStringComparator()) == 0 ||
contentType.Equals(NS_LITERAL_CSTRING("text/css"),
nsCaseInsensitiveCStringComparator()) ||
contentType.IsEmpty()) {
/*
* First determine the charset (if one is indicated)

Просмотреть файл

@ -5521,7 +5521,7 @@ nsCSSDeclaration::TryBackgroundPosition(nsAWritableString & aString,
AppendValueToString(eCSSProperty_background_x_position, backgroundXValue);
AppendValueToString(eCSSProperty_background_y_position, backgroundYValue);
aString.Append(backgroundYValue);
if (Compare(backgroundXValue, backgroundYValue, nsCaseInsensitiveStringComparator())) {
if (!backgroundXValue.Equals(backgroundYValue, nsCaseInsensitiveStringComparator())) {
// the two values are different
aString.Append(PRUnichar(' '));
aString.Append(backgroundXValue);

Просмотреть файл

@ -201,9 +201,8 @@ PRBool AtomKey_base::Equals(const nsHashKey* aKey) const
const PRUnichar *theirStr = nsnull;
theirAtom->GetUnicode(&theirStr);
return Compare(nsDependentString(myStr),
nsDependentString(theirStr),
nsCaseInsensitiveStringComparator()) == 0;
return nsDependentString(myStr).Equals(nsDependentString(theirStr),
nsCaseInsensitiveStringComparator());
}
@ -3352,9 +3351,8 @@ static PRBool ValueIncludes(const nsString& aValueList, const nsString& aValue,
}
}
else {
if (!Compare(nsDependentString(value),
nsDependentString(start),
nsCaseInsensitiveStringComparator())) {
if (nsDependentString(value).Equals(nsDependentString(start),
nsCaseInsensitiveStringComparator())) {
return PR_TRUE;
}
}
@ -3648,9 +3646,9 @@ static PRBool SelectorMatches(RuleProcessorData &data,
break;
}
if (isCaseSensitive)
result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsDefaultStringComparator()));
result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsDefaultStringComparator()));
else
result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsCaseInsensitiveStringComparator()));
result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator()));
}
}
break;
@ -3662,9 +3660,9 @@ static PRBool SelectorMatches(RuleProcessorData &data,
result = localFalse;
} else {
if (isCaseSensitive)
result = PRBool(localTrue == !Compare(Substring(value, valLen - selLen, selLen), attr->mValue, nsDefaultStringComparator()));
result = PRBool(localTrue == Substring(value, valLen - selLen, selLen).Equals(attr->mValue, nsDefaultStringComparator()));
else
result = PRBool(localTrue == !Compare(Substring(value, valLen - selLen, selLen), attr->mValue, nsCaseInsensitiveStringComparator()));
result = PRBool(localTrue == Substring(value, valLen - selLen, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator()));
}
}
break;
@ -3676,9 +3674,9 @@ static PRBool SelectorMatches(RuleProcessorData &data,
result = localFalse;
} else {
if (isCaseSensitive)
result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsDefaultStringComparator()));
result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsDefaultStringComparator()));
else
result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsCaseInsensitiveStringComparator()));
result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator()));
}
}
break;
@ -3718,8 +3716,8 @@ static PRBool SelectorMatches(RuleProcessorData &data,
const PRUnichar* id2Str;
IDList->mAtom->GetUnicode(&id2Str);
nsDependentString id2(id2Str);
if (localTrue ==
(Compare(id1, id2, nsCaseInsensitiveStringComparator()) != 0)) {
if (localTrue !=
id1.Equals(id2, nsCaseInsensitiveStringComparator())) {
result = PR_FALSE;
break;
}

Просмотреть файл

@ -1447,7 +1447,7 @@ HTMLAttributesImpl::HasClass(nsIAtom* aClass, PRBool aCaseSensitive) const
const PRUnichar* class2Buf;
classList->mAtom->GetUnicode(&class2Buf);
nsDependentString class2(class2Buf);
if (Compare(class1, class2, nsCaseInsensitiveStringComparator()) == 0)
if (class1.Equals(class2, nsCaseInsensitiveStringComparator()))
return NS_OK;
classList = classList->mNext;
} while (classList);

Просмотреть файл

@ -172,9 +172,8 @@ PRBool nsHTMLValue::operator==(const nsHTMLValue& aOther) const
}
}
else if (nsnull != aOther.mValue.mString) {
return 0 == Compare(nsDependentString(mValue.mString),
nsDependentString(aOther.mValue.mString),
nsCaseInsensitiveStringComparator());
return nsDependentString(mValue.mString).Equals(nsDependentString(aOther.mValue.mString),
nsCaseInsensitiveStringComparator());
}
}
else if (eHTMLUnit_ISupports == mUnit) {

Просмотреть файл

@ -852,16 +852,17 @@ nsXBLPrototypeHandler::ConstructPrototype(nsIContent* aKeyElement,
mEventName = getter_AddRefs(NS_NewAtom(event));
if (aPhase) {
if (Compare(nsDependentString(aPhase), NS_LITERAL_STRING("capturing")) == 0)
const nsDependentString phase(aPhase);
if (phase.Equals(NS_LITERAL_STRING("capturing")))
mPhase = NS_PHASE_CAPTURING;
else if (Compare(nsDependentString(aPhase), NS_LITERAL_STRING("target")) == 0)
else if (phase.Equals(NS_LITERAL_STRING("target")))
mPhase = NS_PHASE_TARGET;
}
// Button and clickcount apply only to XBL handlers and don't apply to XUL key
// handlers.
nsAutoString button(aButton);
nsAutoString clickcount(aClickCount);
const nsDependentString button(aButton);
const nsDependentString clickcount(aClickCount);
if (!button.IsEmpty())
mDetail = button.First() - '0';
if (!clickcount.IsEmpty())

Просмотреть файл

@ -1444,10 +1444,12 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes,
nsAutoString src;
while (*aAttributes) {
const nsDependentString key(aAttributes[0]);
if (Compare(key, NS_LITERAL_STRING("src"),nsCaseInsensitiveStringComparator()) == 0) {
if (key.Equals(NS_LITERAL_STRING("src"),
nsCaseInsensitiveStringComparator())) {
src.Assign(aAttributes[1]);
}
else if (Compare(key, NS_LITERAL_STRING("type"),nsCaseInsensitiveStringComparator()) == 0) {
else if (key.Equals(NS_LITERAL_STRING("type"),
nsCaseInsensitiveStringComparator())) {
nsAutoString type(aAttributes[1]);
nsAutoString mimeType;
nsAutoString params;
@ -1473,7 +1475,8 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes,
jsVersionString = JS_VersionToString(jsVersion);
}
}
else if (Compare(key, NS_LITERAL_STRING("language"),nsCaseInsensitiveStringComparator()) == 0) {
else if (key.Equals(NS_LITERAL_STRING("language"),
nsCaseInsensitiveStringComparator())) {
nsAutoString lang(aAttributes[1]);
isJavaScript = nsParserUtils::IsJavaScriptLanguage(lang, &jsVersionString);
}

Просмотреть файл

@ -92,9 +92,8 @@ ChangeCSSInlineStyleTxn::ValueIncludes(const nsAReadableString &aValueList, cons
}
}
else {
if (!Compare(nsDependentString(value),
nsDependentString(start),
nsCaseInsensitiveStringComparator())) {
if (nsDependentString(value).Equals(nsDependentString(start),
nsCaseInsensitiveStringComparator())) {
result = PR_TRUE;
break;
}
@ -370,8 +369,9 @@ ChangeCSSInlineStyleTxn::AcceptsMoreThanOneValue(nsIAtom *aCSSProperty)
NS_IMETHODIMP
ChangeCSSInlineStyleTxn::AddValueToMultivalueProperty(nsAWritableString & aValues, const nsAReadableString & aNewValue)
{
if (!aValues.Length()
|| !Compare(aValues, NS_LITERAL_STRING("none"), nsCaseInsensitiveStringComparator())) {
if (aValues.IsEmpty()
|| aValues.Equals(NS_LITERAL_STRING("none"),
nsCaseInsensitiveStringComparator())) {
// the list of values is empty of the value is 'none'
aValues.Assign(aNewValue);
}

Просмотреть файл

@ -1179,7 +1179,8 @@ nsHTMLCSSUtils::IsCSSEquivalentToHTMLInlineStyleSet(nsIDOMNode * aNode,
if (!htmlValueString.Equals(NS_LITERAL_STRING(""))) {
nsAutoString leftHTMLValue;
htmlValueString.Left(leftHTMLValue, 5);
aIsSet = PRBool(!Compare(leftHTMLValue, leftCSSValue, nsCaseInsensitiveStringComparator()));
aIsSet = leftHTMLValue.Equals(leftCSSValue,
nsCaseInsensitiveStringComparator());
}
else {
aIsSet = (leftCSSValue.Equals(NS_LITERAL_STRING("times")) ||
@ -1202,7 +1203,8 @@ nsHTMLCSSUtils::IsCSSEquivalentToHTMLInlineStyleSet(nsIDOMNode * aNode,
}
if (!htmlValueString.Equals(NS_LITERAL_STRING(""))) {
if (!Compare(htmlValueString, valueString, nsCaseInsensitiveStringComparator())) {
if (htmlValueString.Equals(valueString,
nsCaseInsensitiveStringComparator())) {
aIsSet = PR_TRUE;
}
}

Просмотреть файл

@ -2436,7 +2436,7 @@ nsHTMLEditRules::WillMakeList(nsISelection *aSelection,
nsAutoString itemType;
if (aItemType)
itemType = *aItemType;
else if (!Compare(*aListType,NS_LITERAL_STRING("dl"),nsCaseInsensitiveStringComparator()))
else if (aListType->Equals(NS_LITERAL_STRING("dl"),nsCaseInsensitiveStringComparator()))
itemType.Assign(NS_LITERAL_STRING("dd"));
else
itemType.Assign(NS_LITERAL_STRING("li"));
@ -6079,7 +6079,7 @@ nsHTMLEditRules::ApplyBlockStyle(nsISupportsArray *arrayOfNodes, const nsAReadab
else if (IsInlineNode(curNode))
{
// if curNode is a non editable, drop it if we are going to <pre>
if (!Compare(tString,NS_LITERAL_STRING("pre"),nsCaseInsensitiveStringComparator())
if (tString.Equals(NS_LITERAL_STRING("pre"),nsCaseInsensitiveStringComparator())
&& (!mHTMLEditor->IsEditable(curNode)))
continue; // do nothing to this block

Просмотреть файл

@ -2459,7 +2459,7 @@ nsHTMLEditor::RemoveList(const nsAReadableString& aListType)
if (!selection) return NS_ERROR_NULL_POINTER;
nsTextRulesInfo ruleInfo(nsTextEditRules::kRemoveList);
if (!Compare(aListType,NS_LITERAL_STRING("ol"),nsCaseInsensitiveStringComparator()))
if (aListType.Equals(NS_LITERAL_STRING("ol"),nsCaseInsensitiveStringComparator()))
ruleInfo.bOrdered = PR_TRUE;
else ruleInfo.bOrdered = PR_FALSE;
res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
@ -2582,7 +2582,7 @@ nsHTMLEditor::Indent(const nsAReadableString& aIndent)
PRBool cancel, handled;
PRInt32 theAction = nsTextEditRules::kIndent;
PRInt32 opID = kOpIndent;
if (!Compare(aIndent,NS_LITERAL_STRING("outdent"),nsCaseInsensitiveStringComparator()))
if (aIndent.Equals(NS_LITERAL_STRING("outdent"),nsCaseInsensitiveStringComparator()))
{
theAction = nsTextEditRules::kOutdent;
opID = kOpOutdent;
@ -3569,7 +3569,8 @@ nsHTMLEditor::GetEmbeddedObjects(nsISupportsArray** aNodeList)
{
nsAutoString href;
if (NS_SUCCEEDED(anchor->GetHref(href)))
if (Compare(Substring(href, 0, 5), NS_LITERAL_STRING("file:"), nsCaseInsensitiveStringComparator()) == 0)
if (Substring(href, 0, 5).Equals(NS_LITERAL_STRING("file:"),
nsCaseInsensitiveStringComparator()))
(*aNodeList)->AppendElement(node);
}
}
@ -3861,20 +3862,20 @@ PRBool
nsHTMLEditor::TagCanContainTag(const nsAReadableString& aParentTag, const nsAReadableString& aChildTag)
{
// COtherDTD gives some unwanted results. We override them here.
if (!Compare(aParentTag,NS_LITERAL_STRING("ol"),nsCaseInsensitiveStringComparator()) ||
!Compare(aParentTag,NS_LITERAL_STRING("ul"),nsCaseInsensitiveStringComparator()))
if (aParentTag.Equals(NS_LITERAL_STRING("ol"),nsCaseInsensitiveStringComparator()) ||
aParentTag.Equals(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 (!Compare(aChildTag,NS_LITERAL_STRING("ol"),nsCaseInsensitiveStringComparator()) ||
!Compare(aChildTag,NS_LITERAL_STRING("ul"),nsCaseInsensitiveStringComparator()))
if (aChildTag.Equals(NS_LITERAL_STRING("ol"),nsCaseInsensitiveStringComparator()) ||
aChildTag.Equals(NS_LITERAL_STRING("ul"),nsCaseInsensitiveStringComparator()))
return PR_TRUE;
}
if (!Compare(aParentTag,NS_LITERAL_STRING("li"),nsCaseInsensitiveStringComparator()))
if (aParentTag.Equals(NS_LITERAL_STRING("li"),nsCaseInsensitiveStringComparator()))
{
// list items cant contain list items
if (!Compare(aChildTag,NS_LITERAL_STRING("li"),nsCaseInsensitiveStringComparator()))
if (aChildTag.Equals(NS_LITERAL_STRING("li"),nsCaseInsensitiveStringComparator()))
return PR_FALSE;
}

Просмотреть файл

@ -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)) &&
!Compare(*aAttribute,NS_LITERAL_STRING("size"),nsCaseInsensitiveStringComparator()))
aAttribute->Equals(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 (!Compare(attrString,*aAttribute,nsCaseInsensitiveStringComparator())) continue;
if (attrString.Equals(*aAttribute,nsCaseInsensitiveStringComparator())) continue;
// if it's a special _moz... attribute, keep looking
attrString.Left(tmp,4);
if (!Compare(tmp,NS_LITERAL_STRING("_moz"),nsCaseInsensitiveStringComparator())) continue;
if (tmp.Equals(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 (!Compare(attrVal,*aValue,nsCaseInsensitiveStringComparator())) return PR_TRUE;
if (attrVal.Equals(*aValue,nsCaseInsensitiveStringComparator())) return PR_TRUE;
return PR_FALSE;
}

Просмотреть файл

@ -107,7 +107,7 @@ nsAOLCiter::StripCites(const nsAReadableString& aInString, nsAWritableString& aO
nsReadingIterator <PRUnichar> iter,enditer;
aInString.BeginReading(iter);
aInString.EndReading(enditer);
if (!Compare(Substring(aInString,0,2),NS_LITERAL_STRING(">>")))
if (Substring(aInString,0,2).Equals(NS_LITERAL_STRING(">>")))
{
iter.advance(2);
while (nsCRT::IsAsciiSpace(*iter))

Просмотреть файл

@ -1467,27 +1467,27 @@ ChromeContextMenuListener :: ContextMenu ( nsIDOMEvent* aMouseEvent )
element->GetTagName(tag);
// Test what kind of element we're dealing with here
if (!Compare(tag, NS_LITERAL_STRING("img"), nsCaseInsensitiveStringComparator()))
if (tag.Equals(NS_LITERAL_STRING("img"), nsCaseInsensitiveStringComparator()))
{
flags |= nsIContextMenuListener::CONTEXT_IMAGE;
targetDOMnode = node;
// if we see an image, keep searching for a possible anchor
}
else if (!Compare(tag, NS_LITERAL_STRING("input"), nsCaseInsensitiveStringComparator()))
else if (tag.Equals(NS_LITERAL_STRING("input"), nsCaseInsensitiveStringComparator()))
{
// INPUT element - button, combo, checkbox, text etc.
flags |= nsIContextMenuListener::CONTEXT_INPUT;
targetDOMnode = node;
break; // exit do-while
}
else if (!Compare(tag, NS_LITERAL_STRING("textarea"), nsCaseInsensitiveStringComparator()))
else if (tag.Equals(NS_LITERAL_STRING("textarea"), nsCaseInsensitiveStringComparator()))
{
// text area
flags |= nsIContextMenuListener::CONTEXT_TEXT;
targetDOMnode = node;
break; // exit do-while
}
else if (!Compare(tag, NS_LITERAL_STRING("html"), nsCaseInsensitiveStringComparator()))
else if (tag.Equals(NS_LITERAL_STRING("html"), nsCaseInsensitiveStringComparator()))
{
// only care about this if no other context was found.
if (!flags) {
@ -1509,8 +1509,7 @@ ChromeContextMenuListener :: ContextMenu ( nsIDOMEvent* aMouseEvent )
if (attributes)
{
nsCOMPtr<nsIDOMNode> hrefNode;
nsAutoString href(NS_LITERAL_STRING("href"));
attributes->GetNamedItem(href, getter_AddRefs(hrefNode));
attributes->GetNamedItem(NS_LITERAL_STRING("href"), getter_AddRefs(hrefNode));
if (hrefNode)
{
flags |= nsIContextMenuListener::CONTEXT_LINK;

Просмотреть файл

@ -183,7 +183,7 @@ int CPrintSetupDialog::GetPaperSizeIndexFromData(short aUnit, double aW, double
int CPrintSetupDialog::GetPaperSizeIndex(const CString& aStr)
{
for (int i=0;i<gNumPaperSizes;i++) {
if (!aStr.Compare(gPaperSize[i].mDesc)) {
if (aStr.Equals(gPaperSize[i].mDesc)) {
return i;
}
}

Просмотреть файл

@ -429,7 +429,7 @@ nsWalletlibService::OnStateChange(nsIWebProgress* aWebProgress,
nsAutoString type;
rv = inputElement->GetType(type);
if (NS_SUCCEEDED(rv)) {
if (Compare(type, NS_LITERAL_STRING("password"), nsCaseInsensitiveStringComparator()) == 0) {
if (type.Equals(NS_LITERAL_STRING("password"), nsCaseInsensitiveStringComparator())) {
passwordCount++;
}
}
@ -449,8 +449,11 @@ nsWalletlibService::OnStateChange(nsIWebProgress* aWebProgress,
nsAutoString type;
rv = inputElement->GetType(type);
if (NS_SUCCEEDED(rv)) {
if ((type.IsEmpty()) || (Compare(type, NS_LITERAL_STRING("text"), nsCaseInsensitiveStringComparator()) == 0) ||
(Compare(type, NS_LITERAL_STRING("password"), nsCaseInsensitiveStringComparator()) == 0)) {
if (type.IsEmpty() ||
type.Equals(NS_LITERAL_STRING("text"),
nsCaseInsensitiveStringComparator()) ||
type.Equals(NS_LITERAL_STRING("password"),
nsCaseInsensitiveStringComparator())) {
nsAutoString field;
rv = inputElement->GetName(field);
if (NS_SUCCEEDED(rv)) {

Просмотреть файл

@ -1960,14 +1960,16 @@ wallet_StepForwardOrBack
if (goForward) {
if (NS_SUCCEEDED(result) &&
(type.IsEmpty() ||
(Compare(type, NS_LITERAL_STRING("text"),
nsCaseInsensitiveStringComparator()) == 0))) {
type.Equals(NS_LITERAL_STRING("text"),
nsCaseInsensitiveStringComparator()))) {
/* at <input> element and it's type is either "text" or is missing ("text" by default) */
atInputOrSelect = PR_TRUE;
return;
}
} else {
if (NS_SUCCEEDED(result) && (Compare(type, NS_LITERAL_STRING("hidden"), nsCaseInsensitiveStringComparator()) != 0)) {
if (NS_SUCCEEDED(result) &&
!type.Equals(NS_LITERAL_STRING("hidden"),
nsCaseInsensitiveStringComparator())) {
/* at <input> element and it's type is not "hidden" */
atInputOrSelect = PR_TRUE;
return;
@ -2402,7 +2404,10 @@ wallet_GetPrefills(
if ((NS_SUCCEEDED(result)) && (nsnull != inputElement)) {
nsAutoString type;
result = inputElement->GetType(type);
if ((NS_SUCCEEDED(result)) && ((type.IsEmpty()) || (Compare(type, NS_LITERAL_STRING("text"), nsCaseInsensitiveStringComparator()) == 0))) {
if (NS_SUCCEEDED(result) &&
(type.IsEmpty() ||
type.Equals(NS_LITERAL_STRING("text"),
nsCaseInsensitiveStringComparator()))) {
nsAutoString field;
result = inputElement->GetName(field);
if (NS_SUCCEEDED(result)) {
@ -3636,8 +3641,10 @@ wallet_CaptureInputElement(nsIDOMNode* elementNode, nsIDocument* doc) {
/* it's an input element */
nsAutoString type;
result = inputElement->GetType(type);
if ((NS_SUCCEEDED(result)) &&
(type.IsEmpty() || (Compare(type, NS_LITERAL_STRING("text"), nsCaseInsensitiveStringComparator()) == 0))) {
if (NS_SUCCEEDED(result) &&
(type.IsEmpty() ||
type.Equals(NS_LITERAL_STRING("text"),
nsCaseInsensitiveStringComparator()))) {
nsAutoString field;
result = inputElement->GetName(field);
if (NS_SUCCEEDED(result)) {
@ -3992,8 +3999,8 @@ WLLT_OnSubmit(nsIContent* currentForm, nsIDOMWindowInternal* window) {
rv = inputElement->GetType(type);
if (NS_SUCCEEDED(rv)) {
PRBool isText = (type.IsEmpty() || (Compare(type, NS_LITERAL_STRING("text"), nsCaseInsensitiveStringComparator())==0));
PRBool isPassword = (Compare(type, NS_LITERAL_STRING("password"), nsCaseInsensitiveStringComparator())==0);
PRBool isText = (type.IsEmpty() || type.Equals(NS_LITERAL_STRING("text"), nsCaseInsensitiveStringComparator()));
PRBool isPassword = type.Equals(NS_LITERAL_STRING("password"), nsCaseInsensitiveStringComparator());
// don't save password if field was left blank
if (isPassword) {

Просмотреть файл

@ -1013,12 +1013,12 @@ nsresult CNavDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){
if(theCount) {
PRInt32 theIndex=0;
for(theIndex=0;theIndex<theCount;theIndex++){
nsAutoString theKey(aNode.GetKeyAt(theIndex));
if(!Compare(theKey, NS_LITERAL_STRING("ENTITY"), nsCaseInsensitiveStringComparator())) {
const nsAString& theKey = aNode.GetKeyAt(theIndex);
if(theKey.Equals(NS_LITERAL_STRING("ENTITY"), nsCaseInsensitiveStringComparator())) {
const nsString& theName=aNode.GetValueAt(theIndex);
theNamePtr=&theName;
}
else if(!Compare(theKey, NS_LITERAL_STRING("VALUE"), nsCaseInsensitiveStringComparator())) {
else if(theKey.Equals(NS_LITERAL_STRING("VALUE"), nsCaseInsensitiveStringComparator())) {
//store the named enity with the context...
const nsString& theValue=aNode.GetValueAt(theIndex);
theValuePtr=&theValue;

Просмотреть файл

@ -588,12 +588,12 @@ nsresult COtherDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){
if(theCount) {
PRInt32 theIndex=0;
for(theIndex=0;theIndex<theCount;theIndex++){
nsAutoString theKey(aNode.GetKeyAt(theIndex));
if(!Compare(theKey, NS_LITERAL_STRING("ENTITY"), nsCaseInsensitiveStringComparator())) {
const nsAString& theKey = aNode.GetKeyAt(theIndex);
if(theKey.Equals(NS_LITERAL_STRING("ENTITY"), nsCaseInsensitiveStringComparator())) {
const nsString& theName=aNode.GetValueAt(theIndex);
theNamePtr=&theName;
}
else if(!Compare(theKey, NS_LITERAL_STRING("VALUE"), nsCaseInsensitiveStringComparator())) {
else if(theKey.Equals(NS_LITERAL_STRING("VALUE"), nsCaseInsensitiveStringComparator())) {
//store the named enity with the context...
const nsString& theValue=aNode.GetValueAt(theIndex);
theValuePtr=&theValue;

Просмотреть файл

@ -842,10 +842,10 @@ PRInt32 nsDTDContext::IncrementCounter(eHTMLTags aTag,nsIParserNode& aNode,nsStr
CAbacus::eNumFormat theNumFormat=CAbacus::eDecimal;
for(theIndex=0;theIndex<theCount;theIndex++){
nsAutoString theKey(aNode.GetKeyAt(theIndex));
const nsAString& theKey=aNode.GetKeyAt(theIndex);
const nsString& theValue=aNode.GetValueAt(theIndex);
if(!Compare(theKey, NS_LITERAL_STRING("name"), nsCaseInsensitiveStringComparator())){
if(theKey.Equals(NS_LITERAL_STRING("name"), nsCaseInsensitiveStringComparator())){
theEntity=GetEntity(theValue);
if(!theEntity) {
theEntity=RegisterEntity(theValue,theValue);
@ -853,10 +853,10 @@ PRInt32 nsDTDContext::IncrementCounter(eHTMLTags aTag,nsIParserNode& aNode,nsStr
}
aTag=eHTMLTag_userdefined;
}
else if(!Compare(theKey, NS_LITERAL_STRING("noincr"), nsCaseInsensitiveStringComparator())){
else if(theKey.Equals(NS_LITERAL_STRING("noincr"), nsCaseInsensitiveStringComparator())){
theIncrValue=0;
}
else if(!Compare(theKey, NS_LITERAL_STRING("format"), nsCaseInsensitiveStringComparator())){
else if(theKey.Equals(NS_LITERAL_STRING("format"), nsCaseInsensitiveStringComparator())){
PRUnichar theChar=theValue.CharAt(0);
if('"'==theChar)
theChar=theValue.CharAt(1);
@ -873,7 +873,7 @@ PRInt32 nsDTDContext::IncrementCounter(eHTMLTags aTag,nsIParserNode& aNode,nsStr
}
//determine numbering style
}
else if(!Compare(theKey, NS_LITERAL_STRING("value"), nsCaseInsensitiveStringComparator())){
else if(theKey.Equals(NS_LITERAL_STRING("value"), nsCaseInsensitiveStringComparator())){
PRInt32 err=0;
theNewValue=theValue.ToInteger(&err);
if(!err) {

Просмотреть файл

@ -413,7 +413,7 @@ void nsHTMLContentSinkStream::WriteAttributes(const nsIParserNode& aNode)
if(theCount) {
int i=0;
for(i=0;i<theCount;i++){
nsAutoString key(aNode.GetKeyAt(i));
const nsAString& key = aNode.GetKeyAt(i);
// See if there's an attribute:
// note that we copy here, because we're going to have to trim quotes.
@ -423,7 +423,7 @@ void nsHTMLContentSinkStream::WriteAttributes(const nsIParserNode& aNode)
value.Trim("\"", PR_TRUE, PR_TRUE);
// Filter out any attribute starting with _moz
if (!Compare(key, NS_LITERAL_STRING("_moz"), nsCaseInsensitiveStringComparator())
if (key.Equals(NS_LITERAL_STRING("_moz"), nsCaseInsensitiveStringComparator()))
continue;
//
@ -437,8 +437,8 @@ void nsHTMLContentSinkStream::WriteAttributes(const nsIParserNode& aNode)
// used by the editor. Bug 16988. Yuck.
//
if ((eHTMLTags)aNode.GetNodeType() == eHTMLTag_br
&& (!Compare((key, NS_LITERAL_STRING("type"), nsCaseInsensitiveStringComparator())
&& value.Equals(NS_LITERAL_STRING("_moz")))))
&& key.Equals(NS_LITERAL_STRING("type"), nsCaseInsensitiveStringComparator())
&& value.Equals(NS_LITERAL_STRING("_moz")))
continue;
if (mLowerCaseTags == PR_TRUE)
@ -456,8 +456,8 @@ void nsHTMLContentSinkStream::WriteAttributes(const nsIParserNode& aNode)
// Make all links absolute when converting only the selection:
if ((mFlags & nsIDocumentEncoder::OutputAbsoluteLinks)
&& (!Compare(key, NS_LITERAL_STRING("href"), nsCaseInsensitiveStringComparator())
|| !Compare(key, NS_LITERAL_STRING("src"), nsCaseInsensitiveStringComparator())
&& (key.Equals(NS_LITERAL_STRING("href"), nsCaseInsensitiveStringComparator())
|| key.Equals(NS_LITERAL_STRING("src"), nsCaseInsensitiveStringComparator())
// Would be nice to handle OBJECT and APPLET tags,
// but that gets more complicated since we have to
// search the tag list for CODEBASE as well.

Просмотреть файл

@ -1203,7 +1203,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
{
nsAutoString theStr;
theStr.Assign(aToken->GetStringValue());
if(Compare(theStr, NS_LITERAL_STRING("XI"), nsCaseInsensitiveStringComparator()) != 0) {
if(!theStr.Equals(NS_LITERAL_STRING("XI"), nsCaseInsensitiveStringComparator())) {
PRUnichar theChar=theStr.CharAt(0);
if((nsCRT::IsAsciiDigit(theChar)) || ('X'==theChar) || ('x'==theChar)){
theStr.Assign(NS_LITERAL_STRING("#") + theStr);

Просмотреть файл

@ -106,7 +106,8 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify(
const PRUnichar* valueArray[])
{
if(0 != Compare(nsDependentString(aTag), NS_LITERAL_STRING("META"), nsCaseInsensitiveStringComparator()))
if(!nsDependentString(aTag).Equals(NS_LITERAL_STRING("META"),
nsCaseInsensitiveStringComparator()))
return NS_ERROR_ILLEGAL_VALUE;
else
return Notify(aDocumentID, numOfAttributes, nameArray, valueArray);
@ -147,8 +148,8 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify(
const PRUnichar* aTag,
const nsStringArray* keys, const nsStringArray* values)
{
if(0 != Compare(nsDependentString(aTag), NS_LITERAL_STRING("META"),
nsCaseInsensitiveStringComparator()))
if(!nsDependentString(aTag).Equals(NS_LITERAL_STRING("META"),
nsCaseInsensitiveStringComparator()))
return NS_ERROR_ILLEGAL_VALUE;
else
return Notify(aWebShell, aChannel, keys, values);
@ -215,17 +216,14 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify(
while(IS_SPACE_CHARS(*keyStr))
keyStr++;
if(0 == Compare(Substring(keyStr, keyStr+10),
NS_LITERAL_STRING("HTTP-EQUIV"),
nsCaseInsensitiveStringComparator()))
if(Substring(keyStr, keyStr+10).Equals(NS_LITERAL_STRING("HTTP-EQUIV"),
nsCaseInsensitiveStringComparator()))
httpEquivValue = values->StringAt(i)->get();
else if(0 == Compare(Substring(keyStr, keyStr+7),
NS_LITERAL_STRING("content"),
nsCaseInsensitiveStringComparator()))
else if(Substring(keyStr, keyStr+7).Equals(NS_LITERAL_STRING("content"),
nsCaseInsensitiveStringComparator()))
contentValue = values->StringAt(i)->get();
else if (0 == Compare(Substring(keyStr, keyStr+7),
NS_LITERAL_STRING("charset"),
nsCaseInsensitiveStringComparator()))
else if (Substring(keyStr, keyStr+7).Equals(NS_LITERAL_STRING("charset"),
nsCaseInsensitiveStringComparator()))
charsetValue = values->StringAt(i)->get();
}
NS_NAMED_LITERAL_STRING(contenttype, "Content-Type");
@ -241,26 +239,26 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify(
if(
// first try unquoted strings
((0==Compare(Substring(httpEquivValue,httpEquivValue+contenttype.Length()),
contenttype,
nsCaseInsensitiveStringComparator())) ||
((Substring(httpEquivValue,
httpEquivValue+contenttype.Length()).Equals(contenttype,
nsCaseInsensitiveStringComparator())) ||
// now try "quoted" or 'quoted' strings
(( (httpEquivValue[0]=='\'') ||
(httpEquivValue[0]=='\"') ) &&
(0==Compare(Substring(httpEquivValue+1, httpEquivValue+1+contenttype.Length()),
contenttype,
nsCaseInsensitiveStringComparator()))
(Substring(httpEquivValue+1,
httpEquivValue+1+contenttype.Length()).Equals(contenttype,
nsCaseInsensitiveStringComparator()))
)) &&
// first try unquoted strings
((0==Compare(Substring(contentValue,contentValue+texthtml.Length()),
texthtml,
nsCaseInsensitiveStringComparator())) ||
((Substring(contentValue,
contentValue+texthtml.Length()).Equals(texthtml,
nsCaseInsensitiveStringComparator())) ||
// now try "quoted" or 'quoted' strings
(((contentValue[0]=='\'') ||
(contentValue[0]=='\"'))&&
(0==Compare(Substring(contentValue+1, contentValue+1+texthtml.Length()),
texthtml,
nsCaseInsensitiveStringComparator()))
(Substring(contentValue+1,
contentValue+1+texthtml.Length()).Equals(texthtml,
nsCaseInsensitiveStringComparator()))
))
)
{
@ -352,8 +350,8 @@ NS_IMETHODIMP nsMetaCharsetObserver::GetCharsetFromCompatibilityTag(
// e.g. <META charset="ISO-8859-1">
PRInt32 numOfAttributes = keys->Count();
if ((numOfAttributes >= 3) &&
(0 == Compare(*keys->StringAt(0), NS_LITERAL_STRING("charset"),
nsCaseInsensitiveStringComparator())))
(keys->StringAt(0)->Equals(NS_LITERAL_STRING("charset"),
nsCaseInsensitiveStringComparator())))
{
nsAutoString srcStr((values->StringAt(numOfAttributes-2))->get());
PRInt32 err;

Просмотреть файл

@ -94,8 +94,8 @@ NS_IMETHODIMP nsXMLEncodingObserver::Notify(
const PRUnichar* nameArray[],
const PRUnichar* valueArray[])
{
if(0 != Compare(nsDependentString(aTag), NS_LITERAL_STRING("?XML"),
nsCaseInsensitiveStringComparator()))
if(!nsDependentString(aTag).Equals(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(0==Compare(nsDependentString(nameArray[i]), NS_LITERAL_STRING("encoding"),
nsCaseInsensitiveStringComparator())) {
} else if(nsDependentString(nameArray[i]).Equals(NS_LITERAL_STRING("encoding"),
nsCaseInsensitiveStringComparator())) {
bGotEncoding = PR_TRUE;
encoding = valueArray[i];
}

Просмотреть файл

@ -96,7 +96,9 @@ nsresult nsCollationUnix::Initialize(nsILocale* locale)
PRUnichar *prefValue;
res = prefs->GetLocalizedUnicharPref("intl.collationOption", &prefValue);
if (NS_SUCCEEDED(res)) {
mUseCodePointOrder = (Compare(nsDependentString(prefValue), NS_LITERAL_STRING("useCodePointOrder"), nsCaseInsensitiveStringComparator())==0);
mUseCodePointOrder =
nsDependentString(prefValue).Equals(NS_LITERAL_STRING("useCodePointOrder"),
nsCaseInsensitiveStringComparator());
nsMemory::Free(prefValue);
}
}

Просмотреть файл

@ -127,7 +127,7 @@ NS_IMETHODIMP nsCharsetAlias2::Equals(const nsAReadableString& aCharset1, const
{
nsresult res = NS_OK;
if(Compare(aCharset1, aCharset2, nsCaseInsensitiveStringComparator()) == 0) {
if(aCharset1.Equals(aCharset2, nsCaseInsensitiveStringComparator())) {
*oResult = PR_TRUE;
return res;
}

Просмотреть файл

@ -1462,10 +1462,10 @@ nsObjectFrame::IsHidden() const
// not to hide the <embed> once you'd put the 'hidden' attribute
// on the tag...
// these |NS_ConvertASCIItoUCS2|s can't be |NS_LITERAL_STRING|s until |EqualsIgnoreCase| get's fixed
if (hidden.Length() &&
(Compare(hidden, NS_LITERAL_STRING("false"), nsCaseInsensitiveStringComparator()) != 0) &&
(Compare(hidden, NS_LITERAL_STRING("no"), nsCaseInsensitiveStringComparator()) != 0) &&
(Compare(hidden, NS_LITERAL_STRING("off"), nsCaseInsensitiveStringComparator()) != 0)) {
if (!hidden.IsEmpty() &&
!hidden.Equals(NS_LITERAL_STRING("false"), nsCaseInsensitiveStringComparator()) &&
!hidden.Equals(NS_LITERAL_STRING("no"), nsCaseInsensitiveStringComparator()) &&
!hidden.Equals(NS_LITERAL_STRING("off"), nsCaseInsensitiveStringComparator())) {
// The <embed> or <applet> is hidden.
return PR_TRUE;
}

Просмотреть файл

@ -1462,10 +1462,10 @@ nsObjectFrame::IsHidden() const
// not to hide the <embed> once you'd put the 'hidden' attribute
// on the tag...
// these |NS_ConvertASCIItoUCS2|s can't be |NS_LITERAL_STRING|s until |EqualsIgnoreCase| get's fixed
if (hidden.Length() &&
(Compare(hidden, NS_LITERAL_STRING("false"), nsCaseInsensitiveStringComparator()) != 0) &&
(Compare(hidden, NS_LITERAL_STRING("no"), nsCaseInsensitiveStringComparator()) != 0) &&
(Compare(hidden, NS_LITERAL_STRING("off"), nsCaseInsensitiveStringComparator()) != 0)) {
if (!hidden.IsEmpty() &&
!hidden.Equals(NS_LITERAL_STRING("false"), nsCaseInsensitiveStringComparator()) &&
!hidden.Equals(NS_LITERAL_STRING("no"), nsCaseInsensitiveStringComparator()) &&
!hidden.Equals(NS_LITERAL_STRING("off"), nsCaseInsensitiveStringComparator())) {
// The <embed> or <applet> is hidden.
return PR_TRUE;
}

Просмотреть файл

@ -5521,7 +5521,7 @@ nsCSSDeclaration::TryBackgroundPosition(nsAWritableString & aString,
AppendValueToString(eCSSProperty_background_x_position, backgroundXValue);
AppendValueToString(eCSSProperty_background_y_position, backgroundYValue);
aString.Append(backgroundYValue);
if (Compare(backgroundXValue, backgroundYValue, nsCaseInsensitiveStringComparator())) {
if (!backgroundXValue.Equals(backgroundYValue, nsCaseInsensitiveStringComparator())) {
// the two values are different
aString.Append(PRUnichar(' '));
aString.Append(backgroundXValue);

Просмотреть файл

@ -638,9 +638,8 @@ SheetLoadData::OnStreamComplete(nsIStreamLoader* aLoader,
}
}
if (mLoader->mNavQuirkMode ||
Compare(contentType,
NS_LITERAL_CSTRING("text/css"),
nsCaseInsensitiveCStringComparator()) == 0 ||
contentType.Equals(NS_LITERAL_CSTRING("text/css"),
nsCaseInsensitiveCStringComparator()) ||
contentType.IsEmpty()) {
/*
* First determine the charset (if one is indicated)

Просмотреть файл

@ -5521,7 +5521,7 @@ nsCSSDeclaration::TryBackgroundPosition(nsAWritableString & aString,
AppendValueToString(eCSSProperty_background_x_position, backgroundXValue);
AppendValueToString(eCSSProperty_background_y_position, backgroundYValue);
aString.Append(backgroundYValue);
if (Compare(backgroundXValue, backgroundYValue, nsCaseInsensitiveStringComparator())) {
if (!backgroundXValue.Equals(backgroundYValue, nsCaseInsensitiveStringComparator())) {
// the two values are different
aString.Append(PRUnichar(' '));
aString.Append(backgroundXValue);

Просмотреть файл

@ -201,9 +201,8 @@ PRBool AtomKey_base::Equals(const nsHashKey* aKey) const
const PRUnichar *theirStr = nsnull;
theirAtom->GetUnicode(&theirStr);
return Compare(nsDependentString(myStr),
nsDependentString(theirStr),
nsCaseInsensitiveStringComparator()) == 0;
return nsDependentString(myStr).Equals(nsDependentString(theirStr),
nsCaseInsensitiveStringComparator());
}
@ -3352,9 +3351,8 @@ static PRBool ValueIncludes(const nsString& aValueList, const nsString& aValue,
}
}
else {
if (!Compare(nsDependentString(value),
nsDependentString(start),
nsCaseInsensitiveStringComparator())) {
if (nsDependentString(value).Equals(nsDependentString(start),
nsCaseInsensitiveStringComparator())) {
return PR_TRUE;
}
}
@ -3648,9 +3646,9 @@ static PRBool SelectorMatches(RuleProcessorData &data,
break;
}
if (isCaseSensitive)
result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsDefaultStringComparator()));
result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsDefaultStringComparator()));
else
result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsCaseInsensitiveStringComparator()));
result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator()));
}
}
break;
@ -3662,9 +3660,9 @@ static PRBool SelectorMatches(RuleProcessorData &data,
result = localFalse;
} else {
if (isCaseSensitive)
result = PRBool(localTrue == !Compare(Substring(value, valLen - selLen, selLen), attr->mValue, nsDefaultStringComparator()));
result = PRBool(localTrue == Substring(value, valLen - selLen, selLen).Equals(attr->mValue, nsDefaultStringComparator()));
else
result = PRBool(localTrue == !Compare(Substring(value, valLen - selLen, selLen), attr->mValue, nsCaseInsensitiveStringComparator()));
result = PRBool(localTrue == Substring(value, valLen - selLen, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator()));
}
}
break;
@ -3676,9 +3674,9 @@ static PRBool SelectorMatches(RuleProcessorData &data,
result = localFalse;
} else {
if (isCaseSensitive)
result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsDefaultStringComparator()));
result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsDefaultStringComparator()));
else
result = PRBool(localTrue == !Compare(Substring(value, 0, selLen), attr->mValue, nsCaseInsensitiveStringComparator()));
result = PRBool(localTrue == Substring(value, 0, selLen).Equals(attr->mValue, nsCaseInsensitiveStringComparator()));
}
}
break;
@ -3718,8 +3716,8 @@ static PRBool SelectorMatches(RuleProcessorData &data,
const PRUnichar* id2Str;
IDList->mAtom->GetUnicode(&id2Str);
nsDependentString id2(id2Str);
if (localTrue ==
(Compare(id1, id2, nsCaseInsensitiveStringComparator()) != 0)) {
if (localTrue !=
id1.Equals(id2, nsCaseInsensitiveStringComparator())) {
result = PR_FALSE;
break;
}

Просмотреть файл

@ -266,7 +266,8 @@ nsMenuBarFrame::FindMenuWithShortcut(PRUint32 aLetter)
if (!shortcutKey.IsEmpty()) {
// We've got something.
PRUnichar letter = PRUnichar(aLetter); // throw away the high-zero-fill
if ( Compare(shortcutKey, Substring(&letter, &letter+1), nsCaseInsensitiveStringComparator())==0 ) {
if ( shortcutKey.Equals(Substring(&letter, &letter+1),
nsCaseInsensitiveStringComparator()) ) {
// We match!
nsCOMPtr<nsIMenuFrame> menuFrame = do_QueryInterface(currFrame);
if (menuFrame)

Просмотреть файл

@ -2816,15 +2816,20 @@ nsAbSync::GetTypeOfPhoneNumber(nsString tagName)
continue;
phoneType.Cut(0, loc+1);
if (!Compare(phoneType, NS_LITERAL_STRING(ABSYNC_HOME_PHONE_TYPE), nsCaseInsensitiveStringComparator()))
if (phoneType.Equals(NS_LITERAL_STRING(ABSYNC_HOME_PHONE_TYPE),
nsCaseInsensitiveStringComparator()))
return ABSYNC_HOME_PHONE_ID;
else if (!Compare(phoneType, NS_LITERAL_STRING(ABSYNC_WORK_PHONE_TYPE), nsCaseInsensitiveStringComparator()))
else if (phoneType.Equals(NS_LITERAL_STRING(ABSYNC_WORK_PHONE_TYPE),
nsCaseInsensitiveStringComparator()))
return ABSYNC_WORK_PHONE_ID;
else if (!Compare(phoneType, NS_LITERAL_STRING(ABSYNC_FAX_PHONE_TYPE), nsCaseInsensitiveStringComparator()))
else if (phoneType.Equals(NS_LITERAL_STRING(ABSYNC_FAX_PHONE_TYPE),
nsCaseInsensitiveStringComparator()))
return ABSYNC_FAX_PHONE_ID;
else if (!Compare(phoneType, NS_LITERAL_STRING(ABSYNC_PAGER_PHONE_TYPE), nsCaseInsensitiveStringComparator()))
else if (phoneType.Equals(NS_LITERAL_STRING(ABSYNC_PAGER_PHONE_TYPE),
nsCaseInsensitiveStringComparator()))
return ABSYNC_PAGER_PHONE_ID;
else if (!Compare(phoneType, NS_LITERAL_STRING(ABSYNC_CELL_PHONE_TYPE), nsCaseInsensitiveStringComparator()))
else if (phoneType.Equals(NS_LITERAL_STRING(ABSYNC_CELL_PHONE_TYPE),
nsCaseInsensitiveStringComparator()))
return ABSYNC_CELL_PHONE_ID;
}
}
@ -2914,7 +2919,8 @@ nsAbSync::AddValueToNewCard(nsIAbCard *aCard, nsString *aTagName, nsString *aTag
PR_FREEIF(tValue);
}
if (!Compare(Substring(*aTagName, 0, 5), NS_LITERAL_STRING("phone"), nsCaseInsensitiveStringComparator()))
if (Substring(*aTagName, 0, 5).Equals(NS_LITERAL_STRING("phone"),
nsCaseInsensitiveStringComparator()))
{
nsString tempVal;
tempVal.Append(*aTagName +

Просмотреть файл

@ -100,8 +100,8 @@ PRBool nsAbAutoCompleteSession::ItsADuplicate(PRUnichar* fullAddrStr, nsIAutoCom
rv = resultItem->GetValue(valueStr);
if (NS_SUCCEEDED(rv) && !valueStr.IsEmpty())
{
if (Compare(nsDependentString(fullAddrStr), valueStr,
nsCaseInsensitiveStringComparator())==0)
if (nsDependentString(fullAddrStr).Equals(valueStr,
nsCaseInsensitiveStringComparator()))
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 (Compare(Substring(aString, aString+aSubstrLen),
Substring(aSubstr, aSubstr+aSubstrLen),
nsCaseInsensitiveStringComparator()) == 0);
return (Substring(aString,
aString+aSubstrLen).Equals(Substring(aSubstr, aSubstr+aSubstrLen),
nsCaseInsensitiveStringComparator()));
}
@ -295,46 +295,48 @@ nsAbAutoCompleteSession::CheckEntry(nsAbAutoCompleteSearchString* searchStr,
fullStringLen = searchStr->mFullStringLen;
}
nsDependentString fullStringStr(fullString, fullStringLen);
// First check for a Nickname exact match
if (nickName && Compare(nsDependentString(fullString),
nsDependentString(nickName),
nsCaseInsensitiveStringComparator()) == 0)
if (nickName &&
fullStringStr.Equals(nsDependentString(nickName),
nsCaseInsensitiveStringComparator()))
{
*matchType = NICKNAME_EXACT_MATCH;
return PR_TRUE;
}
// Then check for a display Name exact match
if (displayName && Compare(nsDependentString(fullString),
nsDependentString(displayName),
nsCaseInsensitiveStringComparator()) == 0)
if (displayName &&
fullStringStr.Equals(nsDependentString(displayName),
nsCaseInsensitiveStringComparator()))
{
*matchType = NAME_EXACT_MATCH;
return PR_TRUE;
}
// Then check for a fisrt Name exact match
if (firstName && Compare(nsDependentString(fullString),
nsDependentString(firstName),
nsCaseInsensitiveStringComparator()) == 0)
if (firstName &&
fullStringStr.Equals(nsDependentString(firstName),
nsCaseInsensitiveStringComparator()))
{
*matchType = NAME_EXACT_MATCH;
return PR_TRUE;
}
// Then check for a last Name exact match
if (lastName && Compare(nsDependentString(fullString),
nsDependentString(lastName),
nsCaseInsensitiveStringComparator()) == 0)
if (lastName &&
fullStringStr.Equals(nsDependentString(lastName),
nsCaseInsensitiveStringComparator()))
{
*matchType = NAME_EXACT_MATCH;
return PR_TRUE;
}
// Then check for a Email exact match
if (emailAddress && Compare(nsDependentString(fullString),
nsDependentString(emailAddress),
nsCaseInsensitiveStringComparator()) == 0)
if (emailAddress &&
fullStringStr.Equals(nsDependentString(emailAddress),
nsCaseInsensitiveStringComparator()))
{
*matchType = EMAIL_EXACT_MATCH;
return PR_TRUE;

Просмотреть файл

@ -1037,7 +1037,9 @@ PRBool PR_CALLBACK nsMsgAccountManager::cleanupOnExit(nsHashKey *aKey, void *aDa
nsCOMPtr<nsIMsgFolder>inboxFolder = do_QueryInterface(aSupport);
nsXPIDLString folderName;
inboxFolder->GetName(getter_Copies(folderName));
if (folderName && Compare(folderName, NS_LITERAL_STRING("INBOX"), nsCaseInsensitiveStringComparator()) ==0)
if (folderName &&
folderName.Equals(NS_LITERAL_STRING("INBOX"),
nsCaseInsensitiveStringComparator()))
{
rv1 = inboxFolder->Compact(urlListener, nsnull /* msgwindow */);
if (NS_SUCCEEDED(rv1))

Просмотреть файл

@ -937,8 +937,9 @@ 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) && Compare(folderName, uniName,
nsCaseInsensitiveStringComparator()) == 0)
if (NS_SUCCEEDED(rv) &&
folderName.Equals(uniName,
nsCaseInsensitiveStringComparator()))
{
*aChild = folder;
NS_ADDREF(*aChild);

Просмотреть файл

@ -438,7 +438,8 @@ 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 = !Compare(charsetData, NS_LITERAL_STRING("true"), nsCaseInsensitiveStringComparator());
result = charsetData.Equals(NS_LITERAL_STRING("true"),
nsCaseInsensitiveStringComparator());
}
}
}

Просмотреть файл

@ -2328,9 +2328,8 @@ nsresult nsMsgComposeSendListener::OnStopSending(const char *aMsgID, nsresult aS
{
if (!fieldsFCC.IsEmpty())
{
if (Compare(nsDependentString(fieldsFCC),
NS_LITERAL_STRING("nocopy://"),
nsCaseInsensitiveStringComparator()) == 0)
if (fieldsFCC.Equals(NS_LITERAL_STRING("nocopy://"),
nsCaseInsensitiveStringComparator()))
{
compose->NotifyStateListeners(eComposeProcessDone, NS_OK);
if (progress)
@ -3805,7 +3804,8 @@ nsresult nsMsgCompose::TagConvertible(nsIDOMNode *node, PRInt32 *_retval)
if (NS_SUCCEEDED(pItem->GetNodeValue(typeValue)))
{
typeValue.StripChars("\"");
if (!Compare(typeValue, NS_LITERAL_STRING("cite"), nsCaseInsensitiveStringComparator()))
if (typeValue.Equals(NS_LITERAL_STRING("cite"),
nsCaseInsensitiveStringComparator()))
*_retval = nsIMsgCompConvertible::Plain;
}
}

Просмотреть файл

@ -1680,7 +1680,8 @@ nsMsgComposeAndSend::ProcessMultipartRelated(PRInt32 *aMailboxCount, PRInt32 *aN
nsAutoString attributeValue;
if (NS_SUCCEEDED(domElement->GetAttribute(NS_LITERAL_STRING("moz-do-not-send"), attributeValue)))
{
if (!Compare(attributeValue, NS_LITERAL_STRING("true"), nsCaseInsensitiveStringComparator()))
if (attributeValue.Equals(NS_LITERAL_STRING("true"),
nsCaseInsensitiveStringComparator()))
continue;
}
}

Просмотреть файл

@ -710,12 +710,12 @@ NS_IMETHODIMP nsImapMailFolder::CreateSubfolder(const PRUnichar* folderName, nsI
nsresult rv = NS_ERROR_NULL_POINTER;
if (!folderName) return rv;
if ( Compare(nsDependentString(folderName),NS_LITERAL_STRING("Trash"),nsCaseInsensitiveStringComparator()) == 0 ) // Trash , a special folder
if ( nsDependentString(folderName).Equals(NS_LITERAL_STRING("Trash"),nsCaseInsensitiveStringComparator()) ) // Trash , a special folder
{
AlertSpecialFolderExists(msgWindow);
return NS_MSG_FOLDER_EXISTS;
}
else if ( Compare(nsDependentString(folderName),NS_LITERAL_STRING("Inbox"),nsCaseInsensitiveStringComparator()) == 0 ) // Inbox, a special folder
else if ( nsDependentString(folderName).Equals(NS_LITERAL_STRING("Inbox"),nsCaseInsensitiveStringComparator()) ) // Inbox, a special folder
{
AlertSpecialFolderExists(msgWindow);
return NS_MSG_FOLDER_EXISTS;
@ -3882,9 +3882,8 @@ PRBool nsImapMailFolder::ShowDeletedMessages()
{
nsXPIDLString folderName;
GetName(getter_Copies(folderName));
if (!Compare(Substring(folderName,0,convertedName.Length()),
convertedName,
nsCaseInsensitiveStringComparator()))
if (Substring(folderName,0,convertedName.Length()).Equals(convertedName,
nsCaseInsensitiveStringComparator()))
showDeleted = PR_TRUE;
}
}

Просмотреть файл

@ -504,7 +504,7 @@ void nsEudoraCompose::ExtractType( nsString& str)
// valid multipart!
if (str.Length() > 10) {
str.Left( tStr, 10);
if (!Compare(tStr, NS_LITERAL_STRING("multipart/"), nsCaseInsensitiveStringComparator()))
if (tStr.Equals(NS_LITERAL_STRING("multipart/"), nsCaseInsensitiveStringComparator()))
str.Truncate();
}
}

Просмотреть файл

@ -1030,7 +1030,7 @@ PRBool nsEudoraMac::IsValidMailboxName( nsCString& fName)
{
if (m_depth > 1)
return( PR_TRUE);
if (!Compare(fName, NS_LITERAL_CSTRING("Eudora Nicknames"), nsCaseInsensitiveCStringComparator()))
if (fName.Equals(NS_LITERAL_CSTRING("Eudora Nicknames"), nsCaseInsensitiveCStringComparator()))
return( PR_FALSE);
return( PR_TRUE);
}

Просмотреть файл

@ -694,7 +694,7 @@ void nsEudoraWin32::GetAccountName( const char *pSection, nsString& str)
nsCString s(pSection);
if (!Compare(s, NS_LITERAL_CSTRING("Settings"), nsCaseInsensitiveCStringComparator())) {
if (s.Equals(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 (!Compare(tStr, NS_LITERAL_CSTRING("Persona-"), nsCaseInsensitiveCStringComparator())) {
if (tStr.Equals(NS_LITERAL_CSTRING("Persona-"), nsCaseInsensitiveCStringComparator())) {
s.Right( tStr, s.Length() - 8);
str.AssignWithConversion(tStr.get());
}
@ -1378,9 +1378,8 @@ nsresult nsEudoraWin32::FoundAddressBook( nsIFileSpec *spec, const PRUnichar *pN
nsCRT::free( pLeaf);
nsString tStr;
name.Right( tStr, 4);
if (! Compare(tStr,
NS_LITERAL_STRING(".txt"),
nsCaseInsensitiveStringComparator())) {
if (tStr.Equals(NS_LITERAL_STRING(".txt"),
nsCaseInsensitiveStringComparator())) {
name.Left( tStr, name.Length() - 4);
name = tStr;
}

Просмотреть файл

@ -293,7 +293,7 @@ PRBool nsOEScanBoxes::FindMailBoxes( nsIFileSpec* descFile)
#endif
pEntry->fileName.Right( ext, 4);
if (Compare(ext, mbxExt))
if (!ext.Equals(mbxExt))
pEntry->fileName.Append( ".mbx");
m_entryArray.AppendElement( pEntry);

Просмотреть файл

@ -306,24 +306,25 @@ CGetStoreFoldersIter::CGetStoreFoldersIter( CMapiApi *pApi, CMapiFolderList& fol
BOOL CGetStoreFoldersIter::ExcludeFolderClass( const PRUnichar *pName)
{
BOOL bResult;
nsDependentString pNameStr(pName);
if (m_isMail) {
bResult = FALSE;
if (!Compare(nsDependentString(pName), NS_LITERAL_STRING("IPF.Appointment")))
if (pNameStr.Equals(NS_LITERAL_STRING("IPF.Appointment")))
bResult = TRUE;
else if (!Compare(nsDependentString(pName), NS_LITERAL_STRING("IPF.Contact")))
else if (pNameStr.Equals(NS_LITERAL_STRING("IPF.Contact")))
bResult = TRUE;
else if (!Compare(nsDependentString(pName), NS_LITERAL_STRING("IPF.Journal")))
else if (pNameStr.Equals(NS_LITERAL_STRING("IPF.Journal")))
bResult = TRUE;
else if (!Compare(nsDependentString(pName), NS_LITERAL_STRING("IPF.StickyNote")))
else if (pNameStr.Equals(NS_LITERAL_STRING("IPF.StickyNote")))
bResult = TRUE;
else if (!Compare(nsDependentString(pName), NS_LITERAL_STRING("IPF.Task")))
else if (pNameStr.Equals(NS_LITERAL_STRING("IPF.Task")))
bResult = TRUE;
// else if (!stricmp( pName, "IPF.Note"))
// bResult = TRUE;
}
else {
bResult = TRUE;
if (!Compare( nsDependentString(pName), NS_LITERAL_STRING("IPF.Contact")))
if (pNameStr.Equals(NS_LITERAL_STRING("IPF.Contact")))
bResult = FALSE;
}

Просмотреть файл

@ -799,8 +799,8 @@ nsMsgLocalMailFolder::CheckIfFolderExists(const PRUnichar *folderName, nsFileSpe
PR_FREEIF(leaf);
if (!leafName.IsEmpty() &&
Compare(nsDependentString(folderName), leafName,
nsCaseInsensitiveStringComparator()) == 0)
leafName.Equals(nsDependentString(folderName),
nsCaseInsensitiveStringComparator()))
{
if (msgWindow)
AlertFolderExists(msgWindow);

Просмотреть файл

@ -723,7 +723,8 @@ nsJAR::ParseOneFile(nsISignatureVerifier* verifier,
//-- Lines to look for:
// (1) Digest:
if (Compare(lineName, NS_LITERAL_CSTRING("SHA1-Digest"), nsCaseInsensitiveCStringComparator()) == 0)
if (lineName.Equals(NS_LITERAL_CSTRING("SHA1-Digest"),
nsCaseInsensitiveCStringComparator()))
//-- This is a digest line, save the data in the appropriate place
{
if(aFileType == JAR_MF)
@ -739,7 +740,8 @@ nsJAR::ParseOneFile(nsISignatureVerifier* verifier,
}
// (2) Name: associates this manifest section with a file in the jar.
if (!foundName && Compare(lineName, NS_LITERAL_CSTRING("Name"), nsCaseInsensitiveCStringComparator()) == 0)
if (!foundName && lineName.Equals(NS_LITERAL_CSTRING("Name"),
nsCaseInsensitiveCStringComparator()))
{
curItemName = lineData;
foundName = PR_TRUE;
@ -749,9 +751,11 @@ nsJAR::ParseOneFile(nsISignatureVerifier* verifier,
// (3) Magic: this may be an inline Javascript.
// We can't do any other kind of magic.
if ( aFileType == JAR_MF &&
Compare(lineName, NS_LITERAL_CSTRING("Magic"), nsCaseInsensitiveCStringComparator()) == 0)
lineName.Equals(NS_LITERAL_CSTRING("Magic"),
nsCaseInsensitiveCStringComparator()))
{
if(Compare(lineData, NS_LITERAL_CSTRING("javascript"), nsCaseInsensitiveCStringComparator()) == 0)
if(lineData.Equals(NS_LITERAL_CSTRING("javascript"),
nsCaseInsensitiveCStringComparator()))
curItemMF->mType = JAR_EXTERNAL;
else
curItemMF->mType = JAR_INVALID;

2
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 Compare(*cacheEntry->mKey, *(nsCString *)key) == 0;
return cacheEntry->mKey->Equals(*(nsCString *)key);
}

Просмотреть файл

@ -2125,7 +2125,7 @@ nsFtpState::SendFTPCommand(nsCString& command)
// we don't want to log the password:
nsCAutoString logcmd(command);
if (Compare(Substring(command, 0, 5), NS_LITERAL_CSTRING("PASS ")) == 0)
if (Substring(command, 0, 5).Equals(NS_LITERAL_CSTRING("PASS ")))
logcmd = "PASS xxxxx";
PR_LOG(gFTPLog, PR_LOG_DEBUG, ("(%x)(dwait=%d) Writing \"%s\"\n", this, mWaitingForDConn, logcmd.get()));

Просмотреть файл

@ -542,11 +542,10 @@ mozTXTToHTMLConv::ItMatchesDelimited(const PRUnichar * aInString,
nsCRT::IsAsciiDigit(textAfterPos) ||
textAfterPos == *rep
) ||
Compare(Substring(nsDependentString(aInString, aInLength),
(before == LT_IGNORE ? 0 : 1),
aRepLen),
nsDependentString(rep, aRepLen),
nsCaseInsensitiveStringComparator())
!Substring(nsDependentString(aInString, aInLength),
(before == LT_IGNORE ? 0 : 1),
aRepLen).Equals(nsDependentString(rep, aRepLen),
nsCaseInsensitiveStringComparator())
)
return PR_FALSE;
@ -978,8 +977,9 @@ mozTXTToHTMLConv::CiteLevelTXT(const PRUnichar *line,
const PRUnichar * indexString = &line[logLineStart];
// here, |logLineStart < lineLength| is always true
PRUint32 minlength = MinInt(6,nsCRT::strlen(indexString));
if (!Compare(Substring(indexString, indexString+minlength),
Substring(NS_LITERAL_STRING(">From "), 0, minlength), nsCaseInsensitiveStringComparator()))
if (Substring(indexString,
indexString+minlength).Equals(Substring(NS_LITERAL_STRING(">From "), 0, minlength),
nsCaseInsensitiveStringComparator()))
//XXX RFC2646
moreCites = PR_FALSE;
else

Просмотреть файл

@ -304,8 +304,10 @@ void nsUnknownDecoder::DetermineContentType(nsIRequest* request)
//
// If the buffer begins with a mailbox delimiter then it is not HTML
//
else if (!Compare(Substring(str, 0, 5), NS_LITERAL_CSTRING("From "), nsCaseInsensitiveCStringComparator()) ||
!Compare(Substring(str, 0, 6), NS_LITERAL_CSTRING(">From "), nsCaseInsensitiveCStringComparator())) {
else if (Substring(str, 0, 5).Equals(NS_LITERAL_CSTRING("From "),
nsCaseInsensitiveCStringComparator()) ||
Substring(str, 0, 6).Equals(NS_LITERAL_CSTRING(">From "),
nsCaseInsensitiveCStringComparator())) {
mContentType = TEXT_PLAIN;
}
//

Просмотреть файл

@ -1013,12 +1013,12 @@ nsresult CNavDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){
if(theCount) {
PRInt32 theIndex=0;
for(theIndex=0;theIndex<theCount;theIndex++){
nsAutoString theKey(aNode.GetKeyAt(theIndex));
if(!Compare(theKey, NS_LITERAL_STRING("ENTITY"), nsCaseInsensitiveStringComparator())) {
const nsAString& theKey = aNode.GetKeyAt(theIndex);
if(theKey.Equals(NS_LITERAL_STRING("ENTITY"), nsCaseInsensitiveStringComparator())) {
const nsString& theName=aNode.GetValueAt(theIndex);
theNamePtr=&theName;
}
else if(!Compare(theKey, NS_LITERAL_STRING("VALUE"), nsCaseInsensitiveStringComparator())) {
else if(theKey.Equals(NS_LITERAL_STRING("VALUE"), nsCaseInsensitiveStringComparator())) {
//store the named enity with the context...
const nsString& theValue=aNode.GetValueAt(theIndex);
theValuePtr=&theValue;

Просмотреть файл

@ -588,12 +588,12 @@ nsresult COtherDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){
if(theCount) {
PRInt32 theIndex=0;
for(theIndex=0;theIndex<theCount;theIndex++){
nsAutoString theKey(aNode.GetKeyAt(theIndex));
if(!Compare(theKey, NS_LITERAL_STRING("ENTITY"), nsCaseInsensitiveStringComparator())) {
const nsAString& theKey = aNode.GetKeyAt(theIndex);
if(theKey.Equals(NS_LITERAL_STRING("ENTITY"), nsCaseInsensitiveStringComparator())) {
const nsString& theName=aNode.GetValueAt(theIndex);
theNamePtr=&theName;
}
else if(!Compare(theKey, NS_LITERAL_STRING("VALUE"), nsCaseInsensitiveStringComparator())) {
else if(theKey.Equals(NS_LITERAL_STRING("VALUE"), nsCaseInsensitiveStringComparator())) {
//store the named enity with the context...
const nsString& theValue=aNode.GetValueAt(theIndex);
theValuePtr=&theValue;

Просмотреть файл

@ -842,10 +842,10 @@ PRInt32 nsDTDContext::IncrementCounter(eHTMLTags aTag,nsIParserNode& aNode,nsStr
CAbacus::eNumFormat theNumFormat=CAbacus::eDecimal;
for(theIndex=0;theIndex<theCount;theIndex++){
nsAutoString theKey(aNode.GetKeyAt(theIndex));
const nsAString& theKey=aNode.GetKeyAt(theIndex);
const nsString& theValue=aNode.GetValueAt(theIndex);
if(!Compare(theKey, NS_LITERAL_STRING("name"), nsCaseInsensitiveStringComparator())){
if(theKey.Equals(NS_LITERAL_STRING("name"), nsCaseInsensitiveStringComparator())){
theEntity=GetEntity(theValue);
if(!theEntity) {
theEntity=RegisterEntity(theValue,theValue);
@ -853,10 +853,10 @@ PRInt32 nsDTDContext::IncrementCounter(eHTMLTags aTag,nsIParserNode& aNode,nsStr
}
aTag=eHTMLTag_userdefined;
}
else if(!Compare(theKey, NS_LITERAL_STRING("noincr"), nsCaseInsensitiveStringComparator())){
else if(theKey.Equals(NS_LITERAL_STRING("noincr"), nsCaseInsensitiveStringComparator())){
theIncrValue=0;
}
else if(!Compare(theKey, NS_LITERAL_STRING("format"), nsCaseInsensitiveStringComparator())){
else if(theKey.Equals(NS_LITERAL_STRING("format"), nsCaseInsensitiveStringComparator())){
PRUnichar theChar=theValue.CharAt(0);
if('"'==theChar)
theChar=theValue.CharAt(1);
@ -873,7 +873,7 @@ PRInt32 nsDTDContext::IncrementCounter(eHTMLTags aTag,nsIParserNode& aNode,nsStr
}
//determine numbering style
}
else if(!Compare(theKey, NS_LITERAL_STRING("value"), nsCaseInsensitiveStringComparator())){
else if(theKey.Equals(NS_LITERAL_STRING("value"), nsCaseInsensitiveStringComparator())){
PRInt32 err=0;
theNewValue=theValue.ToInteger(&err);
if(!err) {

Просмотреть файл

@ -413,7 +413,7 @@ void nsHTMLContentSinkStream::WriteAttributes(const nsIParserNode& aNode)
if(theCount) {
int i=0;
for(i=0;i<theCount;i++){
nsAutoString key(aNode.GetKeyAt(i));
const nsAString& key = aNode.GetKeyAt(i);
// See if there's an attribute:
// note that we copy here, because we're going to have to trim quotes.
@ -423,7 +423,7 @@ void nsHTMLContentSinkStream::WriteAttributes(const nsIParserNode& aNode)
value.Trim("\"", PR_TRUE, PR_TRUE);
// Filter out any attribute starting with _moz
if (!Compare(key, NS_LITERAL_STRING("_moz"), nsCaseInsensitiveStringComparator())
if (key.Equals(NS_LITERAL_STRING("_moz"), nsCaseInsensitiveStringComparator()))
continue;
//
@ -437,8 +437,8 @@ void nsHTMLContentSinkStream::WriteAttributes(const nsIParserNode& aNode)
// used by the editor. Bug 16988. Yuck.
//
if ((eHTMLTags)aNode.GetNodeType() == eHTMLTag_br
&& (!Compare((key, NS_LITERAL_STRING("type"), nsCaseInsensitiveStringComparator())
&& value.Equals(NS_LITERAL_STRING("_moz")))))
&& key.Equals(NS_LITERAL_STRING("type"), nsCaseInsensitiveStringComparator())
&& value.Equals(NS_LITERAL_STRING("_moz")))
continue;
if (mLowerCaseTags == PR_TRUE)
@ -456,8 +456,8 @@ void nsHTMLContentSinkStream::WriteAttributes(const nsIParserNode& aNode)
// Make all links absolute when converting only the selection:
if ((mFlags & nsIDocumentEncoder::OutputAbsoluteLinks)
&& (!Compare(key, NS_LITERAL_STRING("href"), nsCaseInsensitiveStringComparator())
|| !Compare(key, NS_LITERAL_STRING("src"), nsCaseInsensitiveStringComparator())
&& (key.Equals(NS_LITERAL_STRING("href"), nsCaseInsensitiveStringComparator())
|| key.Equals(NS_LITERAL_STRING("src"), nsCaseInsensitiveStringComparator())
// Would be nice to handle OBJECT and APPLET tags,
// but that gets more complicated since we have to
// search the tag list for CODEBASE as well.

Просмотреть файл

@ -1203,7 +1203,7 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) {
{
nsAutoString theStr;
theStr.Assign(aToken->GetStringValue());
if(Compare(theStr, NS_LITERAL_STRING("XI"), nsCaseInsensitiveStringComparator()) != 0) {
if(!theStr.Equals(NS_LITERAL_STRING("XI"), nsCaseInsensitiveStringComparator())) {
PRUnichar theChar=theStr.CharAt(0);
if((nsCRT::IsAsciiDigit(theChar)) || ('X'==theChar) || ('x'==theChar)){
theStr.Assign(NS_LITERAL_STRING("#") + theStr);

Просмотреть файл

@ -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:")) ||
!Compare(Substring(uri, 0, 3), NS_LITERAL_STRING("nc:"),
nsCaseInsensitiveStringComparator())) {
Substring(uri, 0, 3).Equals(NS_LITERAL_STRING("nc:"),
nsCaseInsensitiveStringComparator())) {
return PR_FALSE;
}
return PR_TRUE;

Просмотреть файл

@ -1705,9 +1705,8 @@ nsresult nsExternalHelperAppService::GetMIMEInfoForExtensionFromExtras(const cha
while (start != end)
{
FindCharInReadable(',', iter, end);
if (Compare(Substring(start, iter),
extension,
nsCaseInsensitiveCStringComparator()) == 0)
if (Substring(start, iter).Equals(extension,
nsCaseInsensitiveCStringComparator()))
{
// This is the one. Create MIMEInfo object and set
// attributes appropriately.

Просмотреть файл

@ -442,9 +442,8 @@ GetTypeAndDescriptionFromMimetypesFile(const nsAString& aFilename,
while (start != end) {
FindCharInReadable(',', iter, end);
if (Compare(Substring(start, iter),
aFileExtension,
nsCaseInsensitiveStringComparator()) == 0) {
if (Substring(start, iter).Equals(aFileExtension,
nsCaseInsensitiveStringComparator())) {
// it's a match. Assign the type and description and run
aMajorType.Assign(Substring(majorTypeStart, majorTypeEnd));
aMinorType.Assign(Substring(minorTypeStart, minorTypeEnd));
@ -574,12 +573,12 @@ GetExtensionsAndDescriptionFromMimetypesFile(const nsAString& aFilename,
}
#endif
if (NS_SUCCEEDED(rv) &&
Compare(Substring(majorTypeStart, majorTypeEnd),
aMajorType,
nsCaseInsensitiveStringComparator()) == 0 &&
Compare(Substring(minorTypeStart, minorTypeEnd),
aMinorType,
nsCaseInsensitiveStringComparator()) == 0) {
Substring(majorTypeStart,
majorTypeEnd).Equals(aMajorType,
nsCaseInsensitiveStringComparator())&&
Substring(minorTypeStart,
minorTypeEnd).Equals(aMinorType,
nsCaseInsensitiveStringComparator())) {
// it's a match
aFileExtensions.Assign(extensions);
aDescription.Assign(Substring(descriptionStart, descriptionEnd));
@ -948,13 +947,14 @@ GetHandlerAndDescriptionFromMailcapFile(const nsAString& aFilename,
rv = ParseMIMEType(start_iter, majorTypeStart, majorTypeEnd,
minorTypeStart, minorTypeEnd, semicolon_iter);
if (NS_SUCCEEDED(rv) &&
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
Substring(majorTypeStart,
majorTypeEnd).Equals(aMajorType,
nsCaseInsensitiveStringComparator()) &&
(Substring(minorTypeStart,
minorTypeEnd).Equals(NS_LITERAL_STRING("*")) ||
Substring(minorTypeStart,
minorTypeEnd).Equals(aMinorType,
nsCaseInsensitiveStringComparator()))) { // 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

Просмотреть файл

@ -931,27 +931,22 @@ BookmarkParser::Unescape(nsString &text)
while((offset = text.FindChar((PRUnichar('&')), offset)) >= 0)
{
// 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("&lt;"), nsCaseInsensitiveStringComparator()) == 0)
if (Substring(text, offset, 4).Equals(NS_LITERAL_STRING("&lt;"), nsCaseInsensitiveStringComparator()))
{
text.Cut(offset, 4);
text.Insert(PRUnichar('<'), offset);
}
if (Compare(Substring(temp, 0, 4), NS_LITERAL_STRING("&gt;"), nsCaseInsensitiveStringComparator()) == 0)
else if (Substring(text, offset, 4).Equals(NS_LITERAL_STRING("&gt;"), nsCaseInsensitiveStringComparator()))
{
text.Cut(offset, 4);
text.Insert(PRUnichar('>'), offset);
}
if (Compare(Substring(temp, 0, 5), NS_LITERAL_STRING("&amp;"), nsCaseInsensitiveStringComparator()) == 0)
else if (Substring(text, offset, 5).Equals(NS_LITERAL_STRING("&amp;"), nsCaseInsensitiveStringComparator()))
{
text.Cut(offset, 5);
text.Insert(PRUnichar('&'), offset);
}
if (Compare(Substring(temp, 0, 6), NS_LITERAL_STRING("&quot;"), nsCaseInsensitiveStringComparator()) == 0)
else if (Substring(text, offset, 6).Equals(NS_LITERAL_STRING("&quot;"), nsCaseInsensitiveStringComparator()))
{
text.Cut(offset, 6);
text.Insert(PRUnichar('\"'), offset);

Просмотреть файл

@ -556,27 +556,22 @@ RelatedLinksStreamListener::Unescape(nsString &text)
while((offset = text.FindChar((PRUnichar('&')), offset)) >= 0)
{
// 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("&lt;"), nsCaseInsensitiveStringComparator()) == 0)
if (Substring(text, offset, 4).Equals(NS_LITERAL_STRING("&lt;"), nsCaseInsensitiveStringComparator()))
{
text.Cut(offset, 4);
text.Insert(PRUnichar('<'), offset);
}
if (Compare(Substring(temp, 0, 4), NS_LITERAL_STRING("&gt;"), nsCaseInsensitiveStringComparator()) == 0)
else if (Substring(text, offset, 4).Equals(NS_LITERAL_STRING("&gt;"), nsCaseInsensitiveStringComparator()))
{
text.Cut(offset, 4);
text.Insert(PRUnichar('>'), offset);
}
if (Compare(Substring(temp, 0, 5), NS_LITERAL_STRING("&amp;"), nsCaseInsensitiveStringComparator()) == 0)
else if (Substring(text, offset, 5).Equals(NS_LITERAL_STRING("&amp;"), nsCaseInsensitiveStringComparator()))
{
text.Cut(offset, 5);
text.Insert(PRUnichar('&'), offset);
}
if (Compare(Substring(temp, 0, 6), NS_LITERAL_STRING("&quot;"), nsCaseInsensitiveStringComparator()) == 0)
else if (Substring(text, offset, 6).Equals(NS_LITERAL_STRING("&quot;"), nsCaseInsensitiveStringComparator()))
{
text.Cut(offset, 6);
text.Insert(PRUnichar('\"'), offset);

Просмотреть файл

@ -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 ||
Compare(Substring(searchStr, searchStr+prevSearchStrLen),
nsDependentString(prevSearchString, prevSearchStrLen),
nsCaseInsensitiveStringComparator())!= 0)
!Substring(searchStr,
searchStr+prevSearchStrLen).Equals(nsDependentString(prevSearchString, prevSearchStrLen),
nsCaseInsensitiveStringComparator()))
return NS_ERROR_ABORT;
nsCOMPtr<nsISupportsArray> array;
@ -368,9 +368,9 @@ nsUrlbarHistory::SearchPreviousResults(const PRUnichar *searchStr, nsIAutoComple
if (itemValue.IsEmpty())
continue;
if (Compare(nsDependentString(searchStr, searchStrLen),
Substring(itemValue, 0, searchStrLen),
nsCaseInsensitiveStringComparator()) == 0)
if (nsDependentString(searchStr,
searchStrLen).Equals(Substring(itemValue, 0, searchStrLen),
nsCaseInsensitiveStringComparator()))
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 (Compare(itemValue, nsDependentString(aItem),
nsCaseInsensitiveStringComparator()) == 0)
if (itemValue.Equals(nsDependentString(aItem),
nsCaseInsensitiveStringComparator()))
{
//printf("In CheckItemAvailability. Item already found\n");
*aResult = PR_TRUE;