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
Родитель 1f0a883e6c
Коммит 66e767c7b8
50 изменённых файлов: 247 добавлений и 235 удалений

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

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

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

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

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

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

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

@ -539,7 +539,7 @@ XULSortServiceImpl::GetSortColumnIndex(nsIContent *tree, const nsString &sortRes
} }
} }
if (NS_SUCCEEDED(rv = child->GetAttr(kNameSpaceID_None, kSortSeparatorsAtom, value)) 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; 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)) if (NS_SUCCEEDED(rv = child->GetAttr(kNameSpaceID_None, nsXULAtoms::sortActive, value))
&& (rv == NS_CONTENT_ATTR_HAS_VALUE)) && (rv == NS_CONTENT_ATTR_HAS_VALUE))
{ {
if (value.EqualsIgnoreCase(*trueStr)) if (value.EqualsIgnoreCase("true"))
{ {
if (NS_SUCCEEDED(rv = child->GetAttr(kNameSpaceID_None, kResourceAtom, if (NS_SUCCEEDED(rv = child->GetAttr(kNameSpaceID_None, kResourceAtom,
sortResource)) && (rv == NS_CONTENT_ATTR_HAS_VALUE)) 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, if (NS_SUCCEEDED(rv = child->GetAttr(kNameSpaceID_None, kSortSeparatorsAtom,
value)) && (rv == NS_CONTENT_ATTR_HAS_VALUE)) value)) && (rv == NS_CONTENT_ATTR_HAS_VALUE))
{ {
if (value.EqualsIgnoreCase(*trueStr)) if (value.EqualsIgnoreCase("true"))
{ {
inbetweenSeparatorSort = PR_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 its a container, find its treechildren node, and sort those
if (NS_FAILED(rv = parentNode->GetAttr(kNameSpaceID_None, nsXULAtoms::container, value)) || 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; continue;
if (NS_FAILED(rv = parentNode->ChildCount(numChildren))) 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)) 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 // indicate that static XUL comes after RDF-generated content by making negative
staticCount = -staticCount; staticCount = -staticCount;
@ -2132,10 +2132,10 @@ XULSortServiceImpl::DoSort(nsIDOMNode* node, const nsString& sortResource,
PRBool invertTreeFlag = PR_FALSE; PRBool invertTreeFlag = PR_FALSE;
nsAutoString value; nsAutoString value;
if (NS_SUCCEEDED(rv = treeNode->GetAttr(kNameSpaceID_None, nsXULAtoms::sortActive, 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, 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, if (NS_SUCCEEDED(rv = treeNode->GetAttr(kNameSpaceID_None, nsXULAtoms::sortDirection,
value)) && (rv == NS_CONTENT_ATTR_HAS_VALUE)) value)) && (rv == NS_CONTENT_ATTR_HAS_VALUE))

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -465,7 +465,7 @@ PRUint32 FontAliasKey::HashCode(void) const
PRBool FontAliasKey::Equals(const nsHashKey *aKey) 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 nsHashKey* FontAliasKey::Clone(void) const

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

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

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

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

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

@ -2913,9 +2913,13 @@ nsFontWin*
nsFontMetricsWin::LoadGenericFont(HDC aDC, PRUint32 aChar, nsString* aName) nsFontMetricsWin::LoadGenericFont(HDC aDC, PRUint32 aChar, nsString* aName)
{ {
for (int i = mLoadedFonts.Count()-1; i >= 0; --i) { 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; return nsnull;
}
} }
nsFontWin* font = LoadFont(aDC, aName); nsFontWin* font = LoadFont(aDC, aName);
if (font && font->HasGlyph(aChar)) { if (font && font->HasGlyph(aChar)) {
@ -4664,9 +4668,11 @@ nsFontWin*
nsFontMetricsWinA::LoadGenericFont(HDC aDC, PRUnichar aChar, nsString* aName) nsFontMetricsWinA::LoadGenericFont(HDC aDC, PRUnichar aChar, nsString* aName)
{ {
for (int i = mLoadedFonts.Count()-1; i >= 0; --i) { 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; return nsnull;
}
} }
nsFontWinA* font = (nsFontWinA*)LoadFont(aDC, aName); nsFontWinA* font = (nsFontWinA*)LoadFont(aDC, aName);
if (font && font->HasGlyph(aChar)) { if (font && font->HasGlyph(aChar)) {

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

@ -55,6 +55,7 @@
#include "nsIPresContext.h" #include "nsIPresContext.h"
#include "nsILookAndFeel.h" #include "nsILookAndFeel.h"
#include "nsIMenuFrame.h" #include "nsIMenuFrame.h"
#include "nsUnicharUtils.h"
#include <malloc.h> #include <malloc.h>
#define THEME_COLOR 204 #define THEME_COLOR 204
@ -315,13 +316,6 @@ static PRInt32 GetContentState(nsIFrame* aFrame)
return flags; 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) static PRBool CheckBooleanAttr(nsIFrame* aFrame, nsIAtom* aAtom)
{ {
if (!aFrame) if (!aFrame)
@ -333,7 +327,8 @@ static PRBool CheckBooleanAttr(nsIFrame* aFrame, nsIAtom* aAtom)
if (res == NS_CONTENT_ATTR_NO_VALUE || if (res == NS_CONTENT_ATTR_NO_VALUE ||
(res != NS_CONTENT_ATTR_NOT_THERE && attr.IsEmpty())) (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 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) 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 return PR_TRUE; // XXXdwh Can the HTML form control's checked property differ
// from the checked attribute? If so, will need an IsContentofType // from the checked attribute? If so, will need an IsContentofType
// HTML followed by a QI to nsIDOMHTMLInputElement to grab the prop. // 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) PRBool nsNativeThemeWin::IsSelected(nsIFrame* aFrame)

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

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

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

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

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

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

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

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

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

@ -55,6 +55,7 @@ class nsIDeviceContext;
class nsIRenderingContext; class nsIRenderingContext;
class nsIPageSequenceFrame; class nsIPageSequenceFrame;
class nsString; class nsString;
class nsAString;
class nsStringArray; class nsStringArray;
class nsICaret; class nsICaret;
class nsIStyleContext; class nsIStyleContext;
@ -363,7 +364,7 @@ public:
* Scrolls the view of the document so that the anchor with the specified * Scrolls the view of the document so that the anchor with the specified
* name is displayed at the top of the window * 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 * Scrolls the view of the document so that the frame is displayed at the

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

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

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

@ -55,6 +55,7 @@ class nsIDeviceContext;
class nsIRenderingContext; class nsIRenderingContext;
class nsIPageSequenceFrame; class nsIPageSequenceFrame;
class nsString; class nsString;
class nsAString;
class nsStringArray; class nsStringArray;
class nsICaret; class nsICaret;
class nsIStyleContext; class nsIStyleContext;
@ -363,7 +364,7 @@ public:
* Scrolls the view of the document so that the anchor with the specified * Scrolls the view of the document so that the anchor with the specified
* name is displayed at the top of the window * 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 * Scrolls the view of the document so that the frame is displayed at the

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -6307,7 +6307,11 @@ NS_IMETHODIMP nsImapMailFolder::MatchName(nsString *name, PRBool *matches)
if (!matches) if (!matches)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
PRBool isInbox = mName.EqualsIgnoreCase("inbox"); 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; return NS_OK;
} }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -33,7 +33,6 @@
#include "nsIPlatformCharset.h" #include "nsIPlatformCharset.h"
#include "nsFilePicker.h" #include "nsFilePicker.h"
#include "nsILocalFile.h" #include "nsILocalFile.h"
#include "nsIFileChannel.h"
#include "nsIURL.h" #include "nsIURL.h"
#include "nsIStringBundle.h" #include "nsIStringBundle.h"
#include <windows.h> #include <windows.h>
@ -178,7 +177,9 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval)
if ( extIndex >= 0) { if ( extIndex >= 0) {
nsAutoString ext; nsAutoString ext;
mDefault.Right(ext, mDefault.Length() - extIndex); mDefault.Right(ext, mDefault.Length() - extIndex);
// Should we test for ".cgi", ".asp", ".jsp" and other "generated" html pages? // Should we test for ".cgi", ".asp", ".jsp" and other
// "generated" html pages?
if ( ext.EqualsIgnoreCase(".htm") || if ( ext.EqualsIgnoreCase(".htm") ||
ext.EqualsIgnoreCase(".html") || ext.EqualsIgnoreCase(".html") ||
ext.EqualsIgnoreCase(".shtml") ) { ext.EqualsIgnoreCase(".shtml") ) {

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

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