one part of fix for bug 107575 - clean up consumers of nsString::EqualsIgnoreCase and nsString::EqualsWithConversion, to be explicit about case-insensitive compares

r=timeless sr=jag
This commit is contained in:
alecf%netscape.com 2002-02-19 22:49:12 +00:00
parent 1f0a883e6c
commit 66e767c7b8
50 changed files with 247 additions and 235 deletions

View File

@ -1113,7 +1113,7 @@ nsHTMLDocument::GetImageMap(const nsString& aMapName,
nsCOMPtr<nsIDOMHTMLMapElement> map;
mImageMaps->QueryElementAt(i, NS_GET_IID(nsIDOMHTMLMapElement), getter_AddRefs(map));
if (map && NS_SUCCEEDED(map->GetName(name))) {
if (name.EqualsIgnoreCase(aMapName)) {
if (name.Equals(aMapName, nsCaseInsensitiveStringComparator())) {
*aResult = map;
NS_ADDREF(*aResult);
return NS_OK;
@ -1894,7 +1894,7 @@ nsHTMLDocument::SetDomain(const nsAReadableString& aDomain)
nsAutoString suffix;
current.Right(suffix, aDomain.Length());
PRUnichar c = current.CharAt(current.Length() - aDomain.Length() - 1);
if (suffix.EqualsIgnoreCase(nsString(aDomain)) &&
if (suffix.Equals(aDomain, nsCaseInsensitiveStringComparator()) &&
(c == '.' || c == '/'))
ok = PR_TRUE;
}
@ -2017,9 +2017,7 @@ nsHTMLDocument::SetBody(nsIDOMHTMLElement* aBody)
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
}
nsAutoString bodyStr;
bodyStr.Assign(NS_LITERAL_STRING("BODY"));
NS_NAMED_LITERAL_STRING(bodyStr, "BODY");
nsCOMPtr<nsIDOMNode> child;
root->GetFirstChild(getter_AddRefs(child));
@ -2031,7 +2029,8 @@ nsHTMLDocument::SetBody(nsIDOMHTMLElement* aBody)
domElement->GetTagName(tagName);
if (bodyStr.EqualsIgnoreCase(tagName)) {
ToUpperCase(tagName);
if (bodyStr.Equals(tagName)) {
nsCOMPtr<nsIDOMNode> ret;
nsresult rv = root->ReplaceChild(aBody, child, getter_AddRefs(ret));
@ -3757,7 +3756,7 @@ nsHTMLDocument::GetBodyContent()
return PR_FALSE;
}
nsAutoString bodyStr(NS_LITERAL_STRING("BODY"));
NS_NAMED_LITERAL_STRING(bodyStr, "BODY");
nsCOMPtr<nsIDOMNode> child;
root->GetFirstChild(getter_AddRefs(child));
@ -3768,7 +3767,8 @@ nsHTMLDocument::GetBodyContent()
nsAutoString tagName;
domElement->GetTagName(tagName);
if (bodyStr.EqualsIgnoreCase(tagName)) {
ToUpperCase(tagName);
if (bodyStr.Equals(tagName)) {
mBodyContent = child;
return PR_TRUE;

View File

@ -42,6 +42,7 @@
#include "nsICharsetConverterManager.h"
#include "nsIUnicodeDecoder.h"
#include "nsICharsetAlias.h"
#include "nsUnicharUtils.h"
#include "nsHashtable.h"
#include "nsIURL.h"
#include "nsIURL.h"
@ -1137,7 +1138,7 @@ PRBool
CSSLoaderImpl::IsAlternate(const nsString& aTitle)
{
if (!aTitle.IsEmpty()) {
return PRBool(! aTitle.EqualsIgnoreCase(mPreferredSheet));
return PRBool(! aTitle.Equals(mPreferredSheet, nsCaseInsensitiveStringComparator()));
}
return PR_FALSE;
}

View File

@ -378,7 +378,7 @@ nsXMLElement::MaybeTriggerAutoLink(nsIWebShell *aShell)
kActuateAtom,
value);
if (rv == NS_CONTENT_ATTR_HAS_VALUE &&
value.EqualsAtom(kOnLoadAtom,PR_FALSE)) {
value.EqualsAtom(kOnLoadAtom, PR_FALSE)) {
// show= ?
nsLinkVerb verb = eLinkVerb_Undefined;

View File

@ -2272,7 +2272,6 @@ nsXULDocument::SelectAll()
nsIContent * end = nsnull;
nsIContent * body = nsnull;
nsAutoString bodyStr; bodyStr.Assign(NS_LITERAL_STRING("BODY"));
PRInt32 i, n;
mRootContent->ChildCount(n);
for (i=0;i<n;i++) {
@ -2280,7 +2279,12 @@ nsXULDocument::SelectAll()
mRootContent->ChildAt(i, child);
nsCOMPtr<nsIAtom> atom;
child->GetTag(*getter_AddRefs(atom));
if (bodyStr.EqualsIgnoreCase(atom)) {
nsAutoString atomValue;
atom->ToString(atomValue);
ToUpperCase(atomValue);
if (NS_LITERAL_STRING("BODY").Equals(atomValue)) {
body = child;
break;
}

View File

@ -539,7 +539,7 @@ XULSortServiceImpl::GetSortColumnIndex(nsIContent *tree, const nsString &sortRes
}
}
if (NS_SUCCEEDED(rv = child->GetAttr(kNameSpaceID_None, kSortSeparatorsAtom, value))
&& (rv == NS_CONTENT_ATTR_HAS_VALUE) && (value.EqualsIgnoreCase(*trueStr)))
&& (rv == NS_CONTENT_ATTR_HAS_VALUE) && (value.EqualsIgnoreCase("true")))
{
inbetweenSeparatorSort = PR_TRUE;
}
@ -614,7 +614,7 @@ XULSortServiceImpl::NodeHasSortInfo(nsIContent *child, nsString &sortResource, n
if (NS_SUCCEEDED(rv = child->GetAttr(kNameSpaceID_None, nsXULAtoms::sortActive, value))
&& (rv == NS_CONTENT_ATTR_HAS_VALUE))
{
if (value.EqualsIgnoreCase(*trueStr))
if (value.EqualsIgnoreCase("true"))
{
if (NS_SUCCEEDED(rv = child->GetAttr(kNameSpaceID_None, kResourceAtom,
sortResource)) && (rv == NS_CONTENT_ATTR_HAS_VALUE))
@ -628,7 +628,7 @@ XULSortServiceImpl::NodeHasSortInfo(nsIContent *child, nsString &sortResource, n
if (NS_SUCCEEDED(rv = child->GetAttr(kNameSpaceID_None, kSortSeparatorsAtom,
value)) && (rv == NS_CONTENT_ATTR_HAS_VALUE))
{
if (value.EqualsIgnoreCase(*trueStr))
if (value.EqualsIgnoreCase("true"))
{
inbetweenSeparatorSort = PR_TRUE;
}
@ -1694,7 +1694,7 @@ XULSortServiceImpl::SortTreeChildren(nsIContent *container, sortPtr sortInfo, PR
// if its a container, find its treechildren node, and sort those
if (NS_FAILED(rv = parentNode->GetAttr(kNameSpaceID_None, nsXULAtoms::container, value)) ||
(rv != NS_CONTENT_ATTR_HAS_VALUE) || (!value.EqualsIgnoreCase(*trueStr)))
(rv != NS_CONTENT_ATTR_HAS_VALUE) || (!value.EqualsIgnoreCase("true")))
continue;
if (NS_FAILED(rv = parentNode->ChildCount(numChildren))) continue;
@ -1981,7 +1981,7 @@ XULSortServiceImpl::InsertContainerNode(nsIRDFCompositeDataSource *db, nsRDFSort
}
}
if (NS_SUCCEEDED(rv = root->GetAttr(kNameSpaceID_None, kStaticsSortLastHintAtom, valueStr))
&& (rv == NS_CONTENT_ATTR_HAS_VALUE) && (valueStr.EqualsIgnoreCase(*trueStr)))
&& (rv == NS_CONTENT_ATTR_HAS_VALUE) && (valueStr.EqualsIgnoreCase("true")))
{
// indicate that static XUL comes after RDF-generated content by making negative
staticCount = -staticCount;
@ -2132,10 +2132,10 @@ XULSortServiceImpl::DoSort(nsIDOMNode* node, const nsString& sortResource,
PRBool invertTreeFlag = PR_FALSE;
nsAutoString value;
if (NS_SUCCEEDED(rv = treeNode->GetAttr(kNameSpaceID_None, nsXULAtoms::sortActive, value))
&& (rv == NS_CONTENT_ATTR_HAS_VALUE) && (value.EqualsIgnoreCase(*trueStr)))
&& (rv == NS_CONTENT_ATTR_HAS_VALUE) && (value.EqualsIgnoreCase("true")))
{
if (NS_SUCCEEDED(rv = treeNode->GetAttr(kNameSpaceID_None, kResourceAtom,
value)) && (rv == NS_CONTENT_ATTR_HAS_VALUE) && (value.EqualsIgnoreCase(sortResource)))
value)) && (rv == NS_CONTENT_ATTR_HAS_VALUE) && (value.Equals(sortResource, nsCaseInsensitiveStringComparator())))
{
if (NS_SUCCEEDED(rv = treeNode->GetAttr(kNameSpaceID_None, nsXULAtoms::sortDirection,
value)) && (rv == NS_CONTENT_ATTR_HAS_VALUE))

View File

@ -109,7 +109,7 @@
#include "prlog.h"
// this is going away - see
// http://bugzilla.mozilla.org/show_bug.cgi?id=71482
//
#include "nsIBrowserHistory.h"
#ifdef DEBUG_DOCSHELL_FOCUS
@ -1362,10 +1362,10 @@ nsDocShell::GetDocShellEnumerator(PRInt32 aItemType, PRInt32 aDirection, nsISimp
rv = docShellEnum->First();
if (NS_FAILED(rv)) return rv;
docShellEnum->AddRef(); // ensure we don't lose the last ref inside the QueryInterface
NS_ADDREF(docShellEnum); // ensure we don't lose the last ref inside the QueryInterface
rv = docShellEnum->QueryInterface(NS_GET_IID(nsISimpleEnumerator), (void **)outEnum);
docShellEnum->Release();
NS_RELEASE(docShellEnum);
return rv;
}
@ -1633,7 +1633,7 @@ nsDocShell::FindItemWithName(const PRUnichar * aName,
reqAsTreeItem(do_QueryInterface(aRequestor));
// First we check our name.
if (mName.EqualsWithConversion(aName)) {
if (mName.Equals(aName)) {
*_retval = NS_STATIC_CAST(nsIDocShellTreeItem *, this);
NS_ADDREF(*_retval);
return NS_OK;
@ -2271,7 +2271,8 @@ nsDocShell::LoadURI(const PRUnichar * aURI,
nsresult rv = CreateFixupURI(aURI, getter_AddRefs(uri));
if (NS_ERROR_UNKNOWN_PROTOCOL == rv) {
if (NS_ERROR_UNKNOWN_PROTOCOL == rv ||
NS_ERROR_MALFORMED_URI == rv) {
// we weren't able to find a protocol handler
nsCOMPtr<nsIPrompt> prompter;
nsCOMPtr<nsIStringBundle> stringBundle;
@ -2281,44 +2282,34 @@ nsDocShell::LoadURI(const PRUnichar * aURI,
NS_ENSURE_TRUE(stringBundle, NS_ERROR_FAILURE);
nsXPIDLString messageStr;
NS_ENSURE_SUCCESS(stringBundle->
GetStringFromName(
NS_LITERAL_STRING("protocolNotFound").get(),
getter_Copies(messageStr)),
NS_ERROR_FAILURE);
nsresult strerror;
if (NS_ERROR_UNKNOWN_PROTOCOL == rv) {
const nsAutoString uriString(aURI);
PRInt32 colon = uriString.FindChar(':');
// extract the scheme
nsAutoString scheme;
uriString.Left(scheme, colon);
const PRUnichar* formatStrs[] = { scheme.get() };
strerror =
stringBundle->FormatStringFromName(NS_LITERAL_STRING("protocolNotFound").get(),
formatStrs,
1,
getter_Copies(messageStr));
}
else {
// NS_ERROR_MALFORMED_URI
strerror =
stringBundle->GetStringFromName(NS_LITERAL_STRING("malformedURI").get(),
getter_Copies(messageStr));
}
nsAutoString uriString(aURI);
PRInt32 colon = uriString.FindChar(':');
// extract the scheme
nsAutoString scheme;
uriString.Left(scheme, colon);
nsCAutoString cScheme;
cScheme.AssignWithConversion(scheme);
PRUnichar *msg = nsTextFormatter::smprintf(messageStr, cScheme.get());
if (!msg)
return NS_ERROR_OUT_OF_MEMORY;
prompter->Alert(nsnull, msg);
nsTextFormatter::smprintf_free(msg);
// now we have the string
NS_ENSURE_SUCCESS(strerror, NS_ERROR_FAILURE);
prompter->Alert(nsnull, messageStr);
} // end unknown protocol
else if (NS_ERROR_MALFORMED_URI == rv) {
// malformed URI
nsCOMPtr<nsIPrompt> prompter;
nsCOMPtr<nsIStringBundle> stringBundle;
GetPromptAndStringBundle(getter_AddRefs(prompter),
getter_AddRefs(stringBundle));
NS_ENSURE_TRUE(stringBundle, NS_ERROR_FAILURE);
nsXPIDLString messageStr;
NS_ENSURE_SUCCESS(stringBundle->
GetStringFromName(
NS_LITERAL_STRING("malformedURI").get(),
getter_Copies(messageStr)),
NS_ERROR_FAILURE);
prompter->Alert(nsnull, messageStr.get());
}
if (NS_FAILED(rv) || !uri)
return NS_ERROR_FAILURE;
@ -3673,7 +3664,6 @@ nsDocShell::OnStateChange(nsIWebProgress * aProgress, nsIRequest * aRequest,
AddToGlobalHistory(uri);
// this is a redirect, so hide the page from
// being enumerated in history
// this is temporary until bug 71482 is fixed
if (mGlobalHistory) {
nsCOMPtr<nsIBrowserHistory> browserHistory =
do_QueryInterface(mGlobalHistory);
@ -3930,18 +3920,18 @@ nsDocShell::NewContentViewerObj(const char *aContentType,
nsIContentViewer ** aViewer)
{
//XXX This should probably be some category thing....
char id[256];
PR_snprintf(id, sizeof(id),
NS_DOCUMENT_LOADER_FACTORY_CONTRACTID_PREFIX "%s;1?type=%s",
(const char *) "view", aContentType);
nsCAutoString contractId(NS_DOCUMENT_LOADER_FACTORY_CONTRACTID_PREFIX
"view"
";1?type=");
contractId += aContentType;
// Note that we're always passing in "view" for the component id above
// Note that we're always passing in "view" for the contractid above
// and to the docLoaderFactory->CreateInstance() at the end of this method.
// nsLayoutDLF makes the determination if it should be a "view-source"
// Create an instance of the document-loader-factory
nsCOMPtr<nsIDocumentLoaderFactory>
docLoaderFactory(do_CreateInstance(id));
docLoaderFactory(do_CreateInstance(contractId.get()));
if (!docLoaderFactory) {
// try again after loading plugins
nsresult err;
@ -3953,7 +3943,7 @@ nsDocShell::NewContentViewerObj(const char *aContentType,
pluginHost->LoadPlugins();
docLoaderFactory = do_CreateInstance(id);
docLoaderFactory = do_CreateInstance(contractId.get());
if (!docLoaderFactory)
return NS_ERROR_FAILURE;
@ -4101,6 +4091,9 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer)
isSubWindow = PR_TRUE;
break;
}
// don't use nsCOMPtr here to avoid extra addref
// when assigning to curwin
nsIDOMWindow* temp;
curwin->GetParent(&temp);
if (curwin == temp) {
@ -4728,7 +4721,7 @@ nsDocShell::AddHeadersToChannel(nsIInputStream * aHeadersData,
nsresult rv = NS_ERROR_FAILURE;
PRUint32 available = 0;
PRUint32 bytesRead;
char *headersBuf = nsnull;
nsXPIDLCString headersBuf;
// used during the manipulation of the String from the InputStream
nsCAutoString headersString;
@ -4743,23 +4736,25 @@ nsDocShell::AddHeadersToChannel(nsIInputStream * aHeadersData,
//
rv = aHeadersData->Available(&available);
if (NS_FAILED(rv) || available < 1) {
goto AHTC_CLEANUP;
}
if (NS_FAILED(rv) || available < 1)
return rv;
do {
aHeadersData->ReadSegments(AHTC_WriteFunc, &headersBuf, available,
aHeadersData->ReadSegments(AHTC_WriteFunc,
getter_Copies(headersBuf),
available,
&bytesRead);
rv = aHeadersData->Available(&available);
if (NS_FAILED(rv)) {
goto AHTC_CLEANUP;
}
if (NS_FAILED(rv))
return rv;
} while (0 < available);
//
// Turn the char * buffer into an nsString.
// Turn nsXPIDLCString into an nsString.
// (need to find the new string APIs so we don't do this
//
headersString = (const char *) headersBuf;
headersString = headersBuf.get();
//
// Iterate over the nsString: for each "\r\n" delimeted chunk,
@ -4769,16 +4764,14 @@ nsDocShell::AddHeadersToChannel(nsIInputStream * aHeadersData,
while (PR_TRUE) {
crlf = headersString.Find("\r\n", PR_TRUE);
if (-1 == crlf) {
rv = NS_OK;
goto AHTC_CLEANUP;
return NS_OK;
}
headersString.Mid(oneHeader, 0, crlf);
headersString.Cut(0, crlf + 2);
oneHeader.StripWhitespace();
colon = oneHeader.Find(":");
if (-1 == colon) {
rv = NS_ERROR_NULL_POINTER;
goto AHTC_CLEANUP;
return NS_ERROR_NULL_POINTER;
}
oneHeader.Left(headerName, colon);
colon++;
@ -4790,15 +4783,10 @@ nsDocShell::AddHeadersToChannel(nsIInputStream * aHeadersData,
rv = aChannel->SetRequestHeader(headerName.get(), headerValue.get());
if (NS_FAILED(rv)) {
rv = NS_ERROR_NULL_POINTER;
goto AHTC_CLEANUP;
return NS_ERROR_NULL_POINTER;
}
}
AHTC_CLEANUP:
nsMemory::Free((void *) headersBuf);
headersBuf = nsnull;
return rv;
return NS_ERROR_FAILURE;
}
nsresult nsDocShell::DoChannelLoad(nsIChannel * aChannel,
@ -4922,35 +4910,45 @@ nsDocShell::ScrollIfAnchor(nsIURI * aURI, PRBool * aWasAnchor)
const char kHash = '#';
// Split the new URI into a left and right part
nsAutoString sNew;
sNew.AssignWithConversion(newSpec);
nsAutoString sNewLeft;
nsAutoString sNewRef;
PRInt32 hashNew = sNew.FindChar(kHash);
// (assume we're parsing it out right
nsACString::const_iterator urlStart, urlEnd, refStart, refEnd;
newSpec.BeginReading(urlStart);
newSpec.EndReading(refEnd);
PRInt32 hashNew = newSpec.FindChar(kHash);
if (hashNew == 0) {
return NS_OK; // Strange URI
return NS_OK; // Strange URI
}
else if (hashNew > 0) {
sNew.Left(sNewLeft, hashNew);
sNew.Right(sNewRef, sNew.Length() - hashNew - 1);
// found it
urlEnd = urlStart;
urlEnd.advance(hashNew);
refStart = urlEnd;
++refStart; // advanced past '#'
}
else {
sNewLeft = sNew;
// no hash at all
urlEnd = refStart = refEnd;
}
const nsACString& sNewLeft = Substring(urlStart, urlEnd);
const nsACString& sNewRef = Substring(refStart, refEnd);
// Split the current URI in a left and right part
nsAutoString sCurrent;
sCurrent.AssignWithConversion(currentSpec);
nsAutoString sCurrentLeft;
PRInt32 hashCurrent = sCurrent.FindChar(kHash);
nsACString::const_iterator currentLeftStart, currentLeftEnd;
currentSpec.BeginReading(currentLeftStart);
PRInt32 hashCurrent = currentSpec.FindChar(kHash);
if (hashCurrent == 0) {
return NS_OK; // Strange URI
}
else if (hashCurrent > 0) {
sCurrent.Left(sCurrentLeft, hashCurrent);
currentLeftEnd = currentLeftStart;
currentLeftEnd.advance(hashCurrent);
}
else {
sCurrentLeft = sCurrent;
currentSpec.EndReading(currentLeftEnd);
}
// Exit when there are no anchors
@ -4967,7 +4965,7 @@ nsDocShell::ScrollIfAnchor(nsIURI * aURI, PRBool * aWasAnchor)
// This means that comparing "http://www.ABC.com/" to "http://www.abc.com/"
// will fail this test.
if (sCurrentLeft.CompareWithConversion(sNewLeft, PR_FALSE, -1) != 0) {
if (Substring(currentLeftStart, currentLeftEnd).Equals(sNewLeft)) {
return NS_OK; // URIs not the same
}
@ -4987,17 +4985,16 @@ nsDocShell::ScrollIfAnchor(nsIURI * aURI, PRBool * aWasAnchor)
// We assume that the bytes are in UTF-8, as it says in the spec:
// http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.1
nsAutoString savedNewRef(sNewRef);
sNewRef = NS_ConvertUTF8toUCS2(str);
// We try the UTF-8 string first, and then try the
// document's charset (see below).
rv = shell->GoToAnchor(NS_ConvertUTF8toUCS2(str));
nsMemory::Free(str);
// We try the UTF-8 string first, and then try the document's charset (see below).
rv = shell->GoToAnchor(sNewRef);
// Above will fail if the anchor name is not UTF-8.
// Need to convert from document charset to unicode.
if (NS_FAILED(rv)) {
// Get a document charset
NS_ENSURE_TRUE(mContentViewer, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocumentViewer>
@ -5009,36 +5006,22 @@ nsDocShell::ScrollIfAnchor(nsIURI * aURI, PRBool * aWasAnchor)
nsAutoString aCharset;
rv = doc->GetDocumentCharacterSet(aCharset);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
char *charsetStr = ToNewCString(aCharset);
NS_ENSURE_TRUE(charsetStr, NS_ERROR_OUT_OF_MEMORY);
// Use the saved string
char *uriStr = ToNewCString(savedNewRef);
if (!uriStr) {
nsMemory::Free(charsetStr);
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsITextToSubURI> textToSubURI =
do_GetService(NS_ITEXTTOSUBURI_CONTRACTID, &rv);
if (NS_FAILED(rv)) {
nsMemory::Free(uriStr);
nsMemory::Free(charsetStr);
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
}
// Unescape and convert to unicode
PRUnichar *uStr;
rv = textToSubURI->UnEscapeAndConvert(charsetStr, uriStr,
&uStr);
nsMemory::Free(uriStr);
nsMemory::Free(charsetStr);
nsXPIDLString uStr;
NS_LossyConvertUCS2toASCII charset(aCharset);
rv = textToSubURI->UnEscapeAndConvert(charset.get(),
PromiseFlatCString(sNewRef).get(),
getter_Copies(uStr));
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
sNewRef.Assign(uStr);
nsMemory::Free(uStr);
rv = shell->GoToAnchor(sNewRef);
rv = shell->GoToAnchor(uStr);
}
}
}

View File

@ -225,7 +225,7 @@ NS_IMETHODIMP ChangeCSSInlineStyleTxn::DoTransaction(void)
// do nothing.
nsAutoString itemPropertyNameString;
cssDecl->Item(0, itemPropertyNameString);
PRBool thisOne = propertyNameString.EqualsIgnoreCase(itemPropertyNameString);
PRBool thisOne = propertyNameString.Equals(itemPropertyNameString, nsCaseInsensitiveStringComparator());
if (thisOne) {
mPropertyWasSet = PR_TRUE;
if (multiple) {
@ -252,7 +252,7 @@ NS_IMETHODIMP ChangeCSSInlineStyleTxn::DoTransaction(void)
nsAutoString itemPropertyNameString;
for (index = 0 ; index < length; index++) {
cssDecl->Item(index, itemPropertyNameString);
PRBool thisOne = propertyNameString.EqualsIgnoreCase(itemPropertyNameString);
PRBool thisOne = propertyNameString.Equals(itemPropertyNameString, nsCaseInsensitiveStringComparator());
if (thisOne) {
// we have found the property we are looking for...
// if we have to remove it, do nothing or remove only the corresponding value

View File

@ -3457,7 +3457,7 @@ nsEditor::NodeIsType(nsIDOMNode *aNode, const nsAReadableString &aTagStr)
{
nsAutoString tag, tagStr(aTagStr);
element->GetTagName(tag);
if (tag.EqualsIgnoreCase(tagStr))
if (tag.Equals(tagStr, nsCaseInsensitiveStringComparator()))
return PR_TRUE;
}
return PR_FALSE;

View File

@ -2767,7 +2767,7 @@ nsHTMLEditor::GetElementOrParentByTagName(const nsAReadableString& aTagName, nsI
} else {
currentNode->GetNodeName(currentTagName);
if (currentTagName.EqualsIgnoreCase(TagName))
if (currentTagName.Equals(TagName, nsCaseInsensitiveStringComparator()))
{
NODE_FOUND:
bNodeFound = PR_TRUE;
@ -3991,7 +3991,7 @@ void nsHTMLEditor::IsTextPropertySetByContent(nsIDOMNode *aNode,
{
nsAutoString tag, value;
element->GetTagName(tag);
if (propName.EqualsIgnoreCase(tag))
if (propName.Equals(tag, nsCaseInsensitiveStringComparator()))
{
PRBool found = PR_FALSE;
if (aAttribute && 0!=aAttribute->Length())
@ -4006,7 +4006,7 @@ void nsHTMLEditor::IsTextPropertySetByContent(nsIDOMNode *aNode,
else
{
nsString tString(*aValue);
if (tString.EqualsIgnoreCase(value)) {
if (tString.Equals(value, nsCaseInsensitiveStringComparator())) {
found = PR_TRUE;
}
else { // we found the prop with the attribute, but the value doesn't match

View File

@ -219,7 +219,7 @@ NS_IMETHODIMP nsDocShellTreeOwner::FindItemWithName(const PRUnichar* aName,
if (domWindow) {
nsAutoString ourName;
domWindow->GetName(ourName);
if (name.EqualsIgnoreCase(ourName)) {
if (name.Equals(ourName, nsCaseInsensitiveStringComparator())) {
*aFoundItem = mWebBrowser->mDocShellAsItem;
NS_IF_ADDREF(*aFoundItem);
return NS_OK;

View File

@ -141,8 +141,7 @@ void txMozillaXMLOutput::endElement(const String& aName, const PRInt32 aNsID)
#ifdef DEBUG
nsAutoString nodeName;
mCurrentNode->GetNodeName(nodeName);
if (!nodeName.EqualsIgnoreCase(aName.getConstNSString()))
NS_ASSERTION(nodeName.EqualsIgnoreCase(aName.getConstNSString()),
NS_ASSERTION(nodeName.Equals(aName.getConstNSString(), nsCaseInsensitiveStringComparator()),
"Unbalanced startElement and endElement calls!");
#endif
@ -198,7 +197,11 @@ void txMozillaXMLOutput::endElement(const String& aName, const PRInt32 aNsID)
// Add this script element to the array of loading script elements.
nsCOMPtr<nsIDOMHTMLScriptElement> scriptElement = do_QueryInterface(mCurrentNode, &rv);
NS_ASSERTION(NS_SUCCEEDED(rv), "Need script element");
mScriptElements.AppendElement(scriptElement);
if (!mScriptElements)
rv = NS_NewISupportsArray(getter_AddRefs(mScriptElements));
NS_ASSERTION(NS_SUCCEEDED(rv), "Can't create array");
if (NS_SUCCEEDED(rv))
mScriptElements->AppendElement(scriptElement);
// Add the script element to the tree.
nsCOMPtr<nsIDocument> document = do_QueryInterface(mScriptParent);
@ -239,8 +242,9 @@ nsresult txMozillaXMLOutput::getRootContent(nsIContent** aReturn)
PRBool txMozillaXMLOutput::isDone()
{
PRUint32 scriptCount;
mScriptElements.Count(&scriptCount);
PRUint32 scriptCount = 0;
if (mScriptElements)
mScriptElements->Count(&scriptCount);
return (scriptCount == 0);
}
@ -267,9 +271,11 @@ void txMozillaXMLOutput::processingInstruction(const String& aTarget, const Stri
void txMozillaXMLOutput::removeScriptElement(nsIDOMHTMLScriptElement *aElement)
{
PRInt32 index = mScriptElements.IndexOf(aElement);
if (index > -1)
mScriptElements.RemoveElementAt(index);
if (mScriptElements) {
PRInt32 index = mScriptElements->IndexOf(aElement);
if (index > -1)
mScriptElements->RemoveElementAt(index);
}
}
void txMozillaXMLOutput::setOutputDocument(nsIDOMDocument* aDocument)

View File

@ -174,7 +174,7 @@ private:
nsCOMPtr<nsINameSpaceManager> mNameSpaceManager;
nsSupportsArray mScriptElements;
nsCOMPtr<nsISupportsArray> mScriptElements;
nsAutoString mText;

View File

@ -465,7 +465,7 @@ PRUint32 FontAliasKey::HashCode(void) const
PRBool FontAliasKey::Equals(const nsHashKey *aKey) const
{
return mString.EqualsIgnoreCase(((FontAliasKey*)aKey)->mString);
return mString.Equals(((FontAliasKey*)aKey)->mString, nsCaseInsensitiveStringComparator());
}
nsHashKey* FontAliasKey::Clone(void) const

View File

@ -38,6 +38,7 @@
#include "nsFont.h"
#include "nsString.h"
#include "nsUnicharUtils.h"
nsFont::nsFont(const char* aName, PRUint8 aStyle, PRUint8 aVariant,
PRUint16 aWeight, PRUint8 aDecoration, nscoord aSize,
@ -92,7 +93,7 @@ PRBool nsFont::Equals(const nsFont& aOther) const
(decorations == aOther.decorations) &&
(size == aOther.size) &&
(sizeAdjust == aOther.sizeAdjust) &&
name.EqualsIgnoreCase(aOther.name)) {
name.Equals(aOther.name, nsCaseInsensitiveStringComparator())) {
return PR_TRUE;
}
return PR_FALSE;

View File

@ -1062,7 +1062,7 @@ nsDeviceContextSpecWin::ShowNativePrintDialog(nsIWidget *aWidget, PRBool aQuiet)
if (NS_SUCCEEDED(GetLocalizedBundle(PRINTDLG_PROPERTIES, getter_AddRefs(strBundle)))) {
nsAutoString doExtendStr;
if (NS_SUCCEEDED(GetLocalizedString(strBundle, "extend", doExtendStr))) {
doExtend = doExtendStr.EqualsIgnoreCase("true");
doExtend = doExtendStr.Equals(NS_LITERAL_STRING("true"));
}
}

View File

@ -2913,9 +2913,13 @@ nsFontWin*
nsFontMetricsWin::LoadGenericFont(HDC aDC, PRUint32 aChar, nsString* aName)
{
for (int i = mLoadedFonts.Count()-1; i >= 0; --i) {
if (aName->EqualsIgnoreCase(((nsFontWin*)mLoadedFonts[i])->mName)) {
// woah, this seems bad
const nsACString& fontName =
nsDependentCString(((nsFontWin*)mLoadedFonts[i])->mName);
if (aName->Equals(NS_ConvertASCIItoUCS2(((nsFontWin*)mLoadedFonts[i])->mName),
nsCaseInsensitiveStringComparator()))
return nsnull;
}
}
nsFontWin* font = LoadFont(aDC, aName);
if (font && font->HasGlyph(aChar)) {
@ -4664,9 +4668,11 @@ nsFontWin*
nsFontMetricsWinA::LoadGenericFont(HDC aDC, PRUnichar aChar, nsString* aName)
{
for (int i = mLoadedFonts.Count()-1; i >= 0; --i) {
if (aName->EqualsIgnoreCase(((nsFontWinA*)mLoadedFonts[i])->mName)) {
if (aName->Equals(NS_ConvertASCIItoUCS2(((nsFontWin*)mLoadedFonts[i])->mName),
nsCaseInsensitiveStringComparator()))
return nsnull;
}
}
nsFontWinA* font = (nsFontWinA*)LoadFont(aDC, aName);
if (font && font->HasGlyph(aChar)) {

View File

@ -55,6 +55,7 @@
#include "nsIPresContext.h"
#include "nsILookAndFeel.h"
#include "nsIMenuFrame.h"
#include "nsUnicharUtils.h"
#include <malloc.h>
#define THEME_COLOR 204
@ -315,13 +316,6 @@ static PRInt32 GetContentState(nsIFrame* aFrame)
return flags;
}
static PRBool HasAttrValue(nsIContent* aContent, nsIAtom* aAtom, const char* aStr)
{
nsAutoString attr;
aContent->GetAttr(kNameSpaceID_None, aAtom, attr);
return attr.EqualsIgnoreCase(aStr);
}
static PRBool CheckBooleanAttr(nsIFrame* aFrame, nsIAtom* aAtom)
{
if (!aFrame)
@ -333,7 +327,8 @@ static PRBool CheckBooleanAttr(nsIFrame* aFrame, nsIAtom* aAtom)
if (res == NS_CONTENT_ATTR_NO_VALUE ||
(res != NS_CONTENT_ATTR_NOT_THERE && attr.IsEmpty()))
return PR_TRUE; // This handles the HTML case (an attr with no value is like a true val)
return attr.EqualsIgnoreCase("true"); // This handles the XUL case.
return attr.Equals(NS_LITERAL_STRING("true"), // This handles the XUL case.
nsCaseInsensitiveStringComparator());
}
PRBool nsNativeThemeWin::IsDisabled(nsIFrame* aFrame)
@ -358,7 +353,8 @@ PRBool nsNativeThemeWin::IsChecked(nsIFrame* aFrame)
return PR_TRUE; // XXXdwh Can the HTML form control's checked property differ
// from the checked attribute? If so, will need an IsContentofType
// HTML followed by a QI to nsIDOMHTMLInputElement to grab the prop.
return checked.EqualsIgnoreCase("true"); // This handles the XUL case.
return checked.Equals(NS_LITERAL_STRING("true"), // This handles the XUL case
nsCaseInsensitiveStringComparator());
}
PRBool nsNativeThemeWin::IsSelected(nsIFrame* aFrame)

View File

@ -284,11 +284,11 @@ NS_IMETHODIMP nsMetaCharsetObserver::Notify(
newCharset = charsetValue;
}
nsDependentString charsetString(charset);
if (!newCharset.IsEmpty())
{
nsAutoString charsetString(charset);
if(! newCharset.EqualsIgnoreCase(charsetString))
if(! newCharset.Equals(charsetString, nsCaseInsensitiveStringComparator()))
{
PRBool same = PR_FALSE;
nsresult res2 = mAlias->Equals( newCharset, charsetString , &same);

View File

@ -107,7 +107,7 @@ nsLanguageAtom::LanguageIs(const PRUnichar* aLanguage, PRBool* aResult)
NS_ENSURE_ARG_POINTER(aLanguage);
NS_ENSURE_ARG_POINTER(aResult);
*aResult = mLang.EqualsWithConversion(aLanguage);
*aResult = mLang.Equals(nsDependentString(aLanguage));
return NS_OK;
}

View File

@ -43,6 +43,7 @@
#include "nsLocaleCID.h"
#include "nsILocaleService.h"
#include "nsIWin32Locale.h"
#include "nsUnicharUtils.h"
#include "nsCRT.h"
#include "nsCOMPtr.h"
#include "prmem.h"
@ -62,14 +63,14 @@ nsresult nsDateTimeFormatWin::Initialize(nsILocale* locale)
// use cached info if match with stored locale
if (NULL == locale) {
if (mLocale.Length() && mLocale.EqualsIgnoreCase(mAppLocale)) {
if (mLocale.Equals(mAppLocale, nsCaseInsensitiveStringComparator())) {
return NS_OK;
}
}
else {
res = locale->GetCategory(aCategory.get(), &aLocaleUnichar);
if (NS_SUCCEEDED(res) && NULL != aLocaleUnichar) {
if (mLocale.Length() && mLocale.EqualsIgnoreCase(nsString(aLocaleUnichar))) {
if (mLocale.Equals(nsDependentString(aLocaleUnichar), nsCaseInsensitiveStringComparator())) {
nsMemory::Free(aLocaleUnichar);
return NS_OK;
}

View File

@ -141,7 +141,7 @@ NS_IMETHODIMP nsCharsetAlias2::Equals(const nsAReadableString& aCharset1, const
if(NS_SUCCEEDED(res)) {
res = this->GetPreferred(aCharset2, name2);
if(NS_SUCCEEDED(res)) {
*oResult = (name1.EqualsIgnoreCase(name2)) ? PR_TRUE : PR_FALSE;
*oResult = name1.Equals(name2, nsCaseInsensitiveStringComparator());
}
}

View File

@ -55,6 +55,7 @@ class nsIDeviceContext;
class nsIRenderingContext;
class nsIPageSequenceFrame;
class nsString;
class nsAString;
class nsStringArray;
class nsICaret;
class nsIStyleContext;
@ -363,7 +364,7 @@ public:
* Scrolls the view of the document so that the anchor with the specified
* name is displayed at the top of the window
*/
NS_IMETHOD GoToAnchor(const nsString& aAnchorName) = 0;
NS_IMETHOD GoToAnchor(const nsAString& aAnchorName) = 0;
/**
* Scrolls the view of the document so that the frame is displayed at the

View File

@ -931,7 +931,7 @@ public:
nsIRenderingContext** aContext);
NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext,
nsIFrame* aFrame);
NS_IMETHOD GoToAnchor(const nsString& aAnchorName);
NS_IMETHOD GoToAnchor(const nsAString& aAnchorName);
NS_IMETHOD ScrollFrameIntoView(nsIFrame *aFrame,
PRIntn aVPercent,
@ -3828,7 +3828,7 @@ PresShell::CantRenderReplacedElement(nsIPresContext* aPresContext,
}
NS_IMETHODIMP
PresShell::GoToAnchor(const nsString& aAnchorName)
PresShell::GoToAnchor(const nsAString& aAnchorName)
{
nsCOMPtr<nsIDOMDocument> doc = do_QueryInterface(mDocument);
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(mDocument);
@ -3898,7 +3898,7 @@ PresShell::GoToAnchor(const nsString& aAnchorName)
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(node);
nsAutoString value;
if (element && NS_SUCCEEDED(element->GetAttribute(NS_LITERAL_STRING("name"), value))) {
if (value.EqualsWithConversion(aAnchorName)) {
if (value.Equals(aAnchorName)) {
content = do_QueryInterface(element);
break;
}
@ -3961,7 +3961,7 @@ PresShell::GoToAnchor(const nsString& aAnchorName)
nsCompatibility compatMode;
mPresContext->GetCompatibilityMode(&compatMode);
if ((aAnchorName.EqualsIgnoreCase("top")) &&
if ((NS_LossyConvertUCS2toASCII(aAnchorName).EqualsIgnoreCase("top")) &&
(compatMode == eCompatibility_NavQuirks) &&
(mViewManager)) {
// Get the viewport scroller

View File

@ -55,6 +55,7 @@ class nsIDeviceContext;
class nsIRenderingContext;
class nsIPageSequenceFrame;
class nsString;
class nsAString;
class nsStringArray;
class nsICaret;
class nsIStyleContext;
@ -363,7 +364,7 @@ public:
* Scrolls the view of the document so that the anchor with the specified
* name is displayed at the top of the window
*/
NS_IMETHOD GoToAnchor(const nsString& aAnchorName) = 0;
NS_IMETHOD GoToAnchor(const nsAString& aAnchorName) = 0;
/**
* Scrolls the view of the document so that the frame is displayed at the

View File

@ -219,18 +219,14 @@ nsFormControlHelper::GetWrapPropertyEnum(nsIContent * aContent, nsHTMLTextWrap&
if (NS_CONTENT_ATTR_NOT_THERE != result) {
nsAutoString wrapHard; wrapHard.AssignWithConversion(kTextControl_Wrap_Hard);
nsAutoString wrapPhysical; wrapPhysical.AssignWithConversion(kTextControl_Wrap_Physical);
if (wrap.EqualsIgnoreCase(wrapHard)) {
if (wrap.EqualsIgnoreCase(kTextControl_Wrap_Hard)) {
aWrapProp = eHTMLTextWrap_Hard;
return result;
}
nsAutoString wrapSoft; wrapSoft.AssignWithConversion(kTextControl_Wrap_Soft);
nsAutoString wrapVirtual; wrapVirtual.AssignWithConversion(kTextControl_Wrap_Virtual);
if (wrap.EqualsIgnoreCase(wrapSoft) ||
wrap.EqualsIgnoreCase(wrapVirtual) ||
wrap.EqualsIgnoreCase(wrapPhysical)) {
if (wrap.EqualsIgnoreCase(kTextControl_Wrap_Soft) ||
wrap.EqualsIgnoreCase(kTextControl_Wrap_Virtual) ||
wrap.EqualsIgnoreCase(kTextControl_Wrap_Physical)) {
aWrapProp = eHTMLTextWrap_Soft;
return result;
}

View File

@ -931,7 +931,7 @@ public:
nsIRenderingContext** aContext);
NS_IMETHOD CantRenderReplacedElement(nsIPresContext* aPresContext,
nsIFrame* aFrame);
NS_IMETHOD GoToAnchor(const nsString& aAnchorName);
NS_IMETHOD GoToAnchor(const nsAString& aAnchorName);
NS_IMETHOD ScrollFrameIntoView(nsIFrame *aFrame,
PRIntn aVPercent,
@ -3828,7 +3828,7 @@ PresShell::CantRenderReplacedElement(nsIPresContext* aPresContext,
}
NS_IMETHODIMP
PresShell::GoToAnchor(const nsString& aAnchorName)
PresShell::GoToAnchor(const nsAString& aAnchorName)
{
nsCOMPtr<nsIDOMDocument> doc = do_QueryInterface(mDocument);
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(mDocument);
@ -3898,7 +3898,7 @@ PresShell::GoToAnchor(const nsString& aAnchorName)
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(node);
nsAutoString value;
if (element && NS_SUCCEEDED(element->GetAttribute(NS_LITERAL_STRING("name"), value))) {
if (value.EqualsWithConversion(aAnchorName)) {
if (value.Equals(aAnchorName)) {
content = do_QueryInterface(element);
break;
}
@ -3961,7 +3961,7 @@ PresShell::GoToAnchor(const nsString& aAnchorName)
nsCompatibility compatMode;
mPresContext->GetCompatibilityMode(&compatMode);
if ((aAnchorName.EqualsIgnoreCase("top")) &&
if ((NS_LossyConvertUCS2toASCII(aAnchorName).EqualsIgnoreCase("top")) &&
(compatMode == eCompatibility_NavQuirks) &&
(mViewManager)) {
// Get the viewport scroller

View File

@ -219,18 +219,14 @@ nsFormControlHelper::GetWrapPropertyEnum(nsIContent * aContent, nsHTMLTextWrap&
if (NS_CONTENT_ATTR_NOT_THERE != result) {
nsAutoString wrapHard; wrapHard.AssignWithConversion(kTextControl_Wrap_Hard);
nsAutoString wrapPhysical; wrapPhysical.AssignWithConversion(kTextControl_Wrap_Physical);
if (wrap.EqualsIgnoreCase(wrapHard)) {
if (wrap.EqualsIgnoreCase(kTextControl_Wrap_Hard)) {
aWrapProp = eHTMLTextWrap_Hard;
return result;
}
nsAutoString wrapSoft; wrapSoft.AssignWithConversion(kTextControl_Wrap_Soft);
nsAutoString wrapVirtual; wrapVirtual.AssignWithConversion(kTextControl_Wrap_Virtual);
if (wrap.EqualsIgnoreCase(wrapSoft) ||
wrap.EqualsIgnoreCase(wrapVirtual) ||
wrap.EqualsIgnoreCase(wrapPhysical)) {
if (wrap.EqualsIgnoreCase(kTextControl_Wrap_Soft) ||
wrap.EqualsIgnoreCase(kTextControl_Wrap_Virtual) ||
wrap.EqualsIgnoreCase(kTextControl_Wrap_Physical)) {
aWrapProp = eHTMLTextWrap_Soft;
return result;
}

View File

@ -37,6 +37,7 @@ REQUIRES = xpcom \
widget \
webshell \
locale \
unicharutil \
view \
necko \
docshell \

View File

@ -30,6 +30,7 @@ REQUIRES = xpcom \
string \
gfx \
locale \
unicharutil \
webshell \
necko \
dom \

View File

@ -33,6 +33,7 @@
#include "nsStyleConsts.h"
#include "nsINameSpaceManager.h"
#include "nsString.h"
#include "nsUnicharUtils.h"
#include "nsIRenderingContext.h"
#include "nsIFontMetrics.h"
#include "nsStyleUtil.h"
@ -849,7 +850,7 @@ StretchyFontEnumCallback(const nsString& aFamily, PRBool aGeneric, void *aData)
nsGlyphTable* glyphTable = gGlyphTableList->TableAt(i);
nsAutoString fontName;
glyphTable->GetPrimaryFontName(fontName);
if (fontName.EqualsIgnoreCase(aFamily) &&
if (fontName.Equals(aFamily, nsCaseInsensitiveStringComparator()) &&
glyphTable->Has(currPresContext, currChar)) {
currList->AppendElement(glyphTable); // the table is retained
return PR_TRUE; // don't stop
@ -947,7 +948,7 @@ PreferredFontEnumCallback(const nsString& aFamily, PRBool aGeneric, void *aData)
for (i = 0; i < count; i++) {
glyphTable = gGlyphTableList->TableAt(i);
glyphTable->GetPrimaryFontName(fontName);
if (fontName.EqualsIgnoreCase(aFamily)) {
if (fontName.Equals(aFamily, nsCaseInsensitiveStringComparator())) {
found = PR_TRUE;
break;
}
@ -959,7 +960,7 @@ PreferredFontEnumCallback(const nsString& aFamily, PRBool aGeneric, void *aData)
for (i = 0; i < count; i++) {
glyphTable = gGlyphTableList->AdditionalTableAt(i);
glyphTable->GetPrimaryFontName(fontName);
if (fontName.EqualsIgnoreCase(aFamily)) {
if (fontName.Equals(aFamily, nsCaseInsensitiveStringComparator())) {
found = PR_TRUE;
break;
}

View File

@ -42,6 +42,7 @@
#include "nsICharsetConverterManager.h"
#include "nsIUnicodeDecoder.h"
#include "nsICharsetAlias.h"
#include "nsUnicharUtils.h"
#include "nsHashtable.h"
#include "nsIURL.h"
#include "nsIURL.h"
@ -1137,7 +1138,7 @@ PRBool
CSSLoaderImpl::IsAlternate(const nsString& aTitle)
{
if (!aTitle.IsEmpty()) {
return PRBool(! aTitle.EqualsIgnoreCase(mPreferredSheet));
return PRBool(! aTitle.Equals(mPreferredSheet, nsCaseInsensitiveStringComparator()));
}
return PR_FALSE;
}

View File

@ -1490,9 +1490,8 @@ nsMenuPopupFrame::FindMenuWithShortcut(PRUint32 aLetter)
char tempChar[2];
tempChar[0] = aLetter;
tempChar[1] = 0;
nsAutoString tempChar2; tempChar2.AssignWithConversion(tempChar);
if (shortcutKey.EqualsIgnoreCase(tempChar2)) {
if (shortcutKey.EqualsIgnoreCase(tempChar)) {
// We match!
nsCOMPtr<nsIMenuFrame> menuFrame = do_QueryInterface(currFrame);
if (menuFrame)

View File

@ -1117,8 +1117,8 @@ nsOutlinerBodyFrame::GetCoordsForCellItem(PRInt32 aRow, const PRUnichar *aColID,
nsCOMPtr<nsIStyleContext> cellContext;
GetPseudoStyleContext(nsXULAtoms::mozoutlinercell, getter_AddRefs(cellContext));
nsAutoString cell(NS_LITERAL_STRING("cell"));
if (currCol->IsCycler() || cell.EqualsWithConversion(aCellItem)) {
NS_NAMED_LITERAL_STRING(cell, "cell");
if (currCol->IsCycler() || cell.Equals(aCellItem)) {
// If the current Column is a Cycler, then the Rect is just the cell - the margins.
// Similarly, if we're just being asked for the cell rect, provide it.

View File

@ -1117,8 +1117,8 @@ nsOutlinerBodyFrame::GetCoordsForCellItem(PRInt32 aRow, const PRUnichar *aColID,
nsCOMPtr<nsIStyleContext> cellContext;
GetPseudoStyleContext(nsXULAtoms::mozoutlinercell, getter_AddRefs(cellContext));
nsAutoString cell(NS_LITERAL_STRING("cell"));
if (currCol->IsCycler() || cell.EqualsWithConversion(aCellItem)) {
NS_NAMED_LITERAL_STRING(cell, "cell");
if (currCol->IsCycler() || cell.Equals(aCellItem)) {
// If the current Column is a Cycler, then the Rect is just the cell - the margins.
// Similarly, if we're just being asked for the cell rect, provide it.

View File

@ -2795,10 +2795,10 @@ EarlyExit:
}
PRInt32
nsAbSync::GetTypeOfPhoneNumber(nsString tagName)
{
nsString compValue = tagName;
compValue.Append(NS_LITERAL_STRING("_type"));
nsAbSync::GetTypeOfPhoneNumber(const nsAString& tagName)
{
NS_NAMED_LITERAL_STRING(typePostfix, "_type");
const nsAString& compValue = tagName + typePostfix;
for (PRInt32 i=0; i<mPhoneTypes->Count(); i++)
{
@ -2806,7 +2806,8 @@ nsAbSync::GetTypeOfPhoneNumber(nsString tagName)
if ( (!val) || val->IsEmpty() )
continue;
if (!compValue.CompareWithConversion(*val, PR_TRUE, compValue.Length()))
const nsAString& valPrefix = Substring(*val, 0, compValue.Length());
if (compValue.Equals(valPrefix, nsCaseInsensitiveStringComparator()))
{
nsString phoneType;

View File

@ -248,7 +248,7 @@ private:
nsresult ProcessDeletedRecords();
nsresult ProcessLastChange();
nsresult ProcessPhoneNumbersTheyAreSpecial(nsIAbCard *aCard);
PRInt32 GetTypeOfPhoneNumber(nsString tagName);
PRInt32 GetTypeOfPhoneNumber(const nsAString& tagName);
// For updating...
PRInt32 HuntForExistingABEntryInServerRecord(PRInt32 aPersonIndex,

View File

@ -903,7 +903,7 @@ NS_IMETHODIMP nsMsgFolder::GetName(PRUnichar **name)
NS_IMETHODIMP nsMsgFolder::SetName(const PRUnichar * name)
{
// override the URI-generated name
if (!mName.EqualsWithConversion(name))
if (!mName.Equals(name))
{
mName = name;
@ -2285,7 +2285,7 @@ NS_IMETHODIMP nsMsgFolder::MatchName(nsString *name, PRBool *matches)
{
if (!matches)
return NS_ERROR_NULL_POINTER;
*matches = mName.EqualsIgnoreCase(*name);
*matches = mName.Equals(*name, nsCaseInsensitiveStringComparator());
return NS_OK;
}

View File

@ -6307,7 +6307,11 @@ NS_IMETHODIMP nsImapMailFolder::MatchName(nsString *name, PRBool *matches)
if (!matches)
return NS_ERROR_NULL_POINTER;
PRBool isInbox = mName.EqualsIgnoreCase("inbox");
*matches = mName.EqualsWithConversion(*name, isInbox);
if (isInbox)
*matches = mName.Equals(*name, nsCaseInsensitiveStringComparator());
else
*matches = mName.Equals(*name);
return NS_OK;
}

View File

@ -41,6 +41,7 @@
#include "nsCRT.h"
#include "prprf.h"
#include "nsReadableUtils.h"
#include "nsUnicharUtils.h"
int CMapiApi::m_clients = 0;
@ -1530,11 +1531,11 @@ void CMapiFolderList::EnsureUniqueName( CMapiFolder *pFolder)
done = TRUE;
i = m_array.Count() - 1;
while (i >= 0) {
pCurrent = (CMapiFolder *)GetAt( i);
pCurrent = (CMapiFolder *)GetAt(i);
if (pCurrent->GetDepth() == pFolder->GetDepth()) {
pCurrent->GetDisplayName( cName);
if (!cName.CompareWithConversion( name, PR_TRUE)) {
ChangeName( name);
pCurrent->GetDisplayName(cName);
if (cName.Equals(name, nsCaseInsensitiveStringComparator())) {
ChangeName(name);
pFolder->SetDisplayName(name.get());
done = FALSE;
break;

View File

@ -44,6 +44,7 @@ REQUIRES = xpcom \
necko \
rdf \
msgdb \
unicharutil \
$(NULL)
ifeq ($(USE_SHORT_LIBNAME),1)
@ -77,6 +78,7 @@ EXTRA_DSO_LDOPTS += \
$(LIBS_DIR) \
$(EXTRA_DSO_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(MOZ_UNICHARUTIL_LIBS) \
$(NULL)

View File

@ -36,6 +36,7 @@ REQUIRES = xpcom \
necko \
rdf \
msgdb \
unicharutil \
$(NULL)
CPP_OBJS=\
@ -58,6 +59,7 @@ CPP_OBJS=\
LLIBS=\
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\unicharutil_s.lib \
$(LIBNSPR) \
$(NULL)

View File

@ -51,6 +51,7 @@
#include "nsIImportMailboxDescriptor.h"
#include "nsCRT.h"
#include "nsString.h"
#include "nsUnicharUtils.h"
#include "nsIProxyObjectManager.h"
#include "nsXPIDLString.h"
@ -1148,7 +1149,7 @@ void nsImportGenericMail::GetUniquePrettyName( nsIMsgAccountManager *pMgr, nsStr
nsXPIDLString prettyName;
rv = server->GetPrettyName( getter_Copies( prettyName));
if (NS_SUCCEEDED( rv)) {
if (!newName.CompareWithConversion( nsAutoString(prettyName), PR_TRUE))
if (newName.Equals( prettyName, nsCaseInsensitiveStringComparator()))
found = PR_TRUE;
}
}

View File

@ -43,6 +43,7 @@ REQUIRES = xpcom \
caps \
intl \
uconv \
unicharutil \
dom \
gfx \
layout \
@ -98,6 +99,7 @@ EXTRA_DSO_LDOPTS = \
$(EXTRA_DSO_LIBS) \
$(MOZ_NECKO_UTIL_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(MOZ_UNICHARUTIL_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -39,6 +39,7 @@ REQUIRES = xpcom \
caps \
intl \
uconv \
unicharutil \
dom \
content \
layout \
@ -82,6 +83,7 @@ CACHELIBNAME=netcache.lib
LLIBS = \
$(DIST)\lib\gkgfx.lib \
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\unicharutil_s.lib \
$(LIBNSPR)
WIN_LIBS = \

View File

@ -147,6 +147,8 @@
#include "nsInt64.h"
#include "nsPluginError.h"
#include "nsUnicharUtils.h"
#ifdef XP_UNIX
#if defined(MOZ_WIDGET_GTK)
#include <gdk/gdkx.h> // for GDK_DISPLAY()
@ -4583,7 +4585,7 @@ static int PR_CALLBACK ComparePluginFileInDirectory (const void *v1, const void
PRInt32 result = 0;
if (LL_EQ(pfd1->mModTime, pfd2->mModTime))
result = pfd1->mFilename.CompareWithConversion(pfd2->mFilename.get(), PR_TRUE);
result = Compare(pfd1->mFilename, pfd2->mFilename, nsCaseInsensitiveStringComparator());
else if (LL_CMP(pfd1->mModTime, >, pfd2->mModTime))
result = -1;
else

View File

@ -48,6 +48,7 @@ REQUIRES = xpcom \
view \
pref \
intl \
unicharutil \
editor \
cookie \
windowwatcher \
@ -126,6 +127,7 @@ XP_DIST_LIBS += \
$(EXTRA_DSO_LIBS) \
$(XPCOM_LIBS) \
$(MOZ_JS_LIBS) \
$(MOZ_UNICHARUTIL_LIBS) \
$(NULL)
XP_LIBS = \

View File

@ -39,7 +39,6 @@ REQUIRES = xpcom \
pref \
intl \
editor \
cookie \
xpconnect \
gfx \
content \

View File

@ -78,6 +78,7 @@
#include "nsIWebBrowserSetup.h"
#include "nsCWebBrowser.h"
#include "nsUnicharUtils.h"
#include "nsIParser.h"
#include "nsEditorMode.h"
@ -3310,8 +3311,8 @@ nsBrowserWindow::DispatchStyleMenu(PRInt32 aID)
titles.StringAt(index, title);
fputs(NS_LossyConvertUCS2toASCII(title).get(), stdout);
fprintf(stdout, "\" %s%s\n",
((title.EqualsIgnoreCase(current)) ? "<< current " : ""),
((title.EqualsIgnoreCase(defaultStyle)) ? "** default" : ""));
((title.Equals(current, nsCaseInsensitiveStringComparator())) ? "<< current " : ""),
((title.Equals(defaultStyle, nsCaseInsensitiveStringComparator())) ? "** default" : ""));
}
NS_RELEASE(shell);
}

View File

@ -33,7 +33,6 @@
#include "nsIPlatformCharset.h"
#include "nsFilePicker.h"
#include "nsILocalFile.h"
#include "nsIFileChannel.h"
#include "nsIURL.h"
#include "nsIStringBundle.h"
#include <windows.h>
@ -178,9 +177,11 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval)
if ( extIndex >= 0) {
nsAutoString ext;
mDefault.Right(ext, mDefault.Length() - extIndex);
// Should we test for ".cgi", ".asp", ".jsp" and other "generated" html pages?
if ( ext.EqualsIgnoreCase(".htm") ||
ext.EqualsIgnoreCase(".html") ||
// Should we test for ".cgi", ".asp", ".jsp" and other
// "generated" html pages?
if ( ext.EqualsIgnoreCase(".htm") ||
ext.EqualsIgnoreCase(".html") ||
ext.EqualsIgnoreCase(".shtml") ) {
// This is supposed to append ".htm" if user doesn't supply an extension
//XXX Actually, behavior is sort of weird:

View File

@ -38,17 +38,14 @@ REQUIRES = xpcom \
shistory \
widget \
gfx \
layout \
content \
docshell \
appshell \
dom \
uriloader \
pref \
editor \
appcomps \
webbrwsr \
uconv \
chardet \
windowwatcher \
$(NULL)
@ -58,7 +55,7 @@ CPPSRCS = nsBrowserInstance.cpp
EXTRA_DSO_LDOPTS = \
$(LIBS_DIR) \
$(MOZ_COMPONENT_LIBS) \
$(MOZ_JS_LIBS) \
$(MOZ_UNICHARUTIL_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk