Bug 104480. "EqualsIgnoreCase(nsAutoString(foo)) is bad and should

die." r=alecf, sr=jag
This commit is contained in:
bzbarsky%mit.edu 2002-01-16 03:31:25 +00:00
Родитель 00b5f915b1
Коммит d974e9c1e6
5 изменённых файлов: 19 добавлений и 11 удалений

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

@ -41,6 +41,7 @@
#include "pratom.h"
#include "nsIDOMDocument.h"
#include "nsIPref.h"
#include "nsUnicharUtils.h"
#include "nsIDOMText.h"
#include "nsIDOMElement.h"
@ -3452,7 +3453,7 @@ nsEditor::NodeIsType(nsIDOMNode *aNode, nsIAtom *aTag)
element->GetTagName(tag);
const PRUnichar *unicodeString;
aTag->GetUnicode(&unicodeString);
if (tag.EqualsIgnoreCase(nsAutoString(unicodeString)))
if (tag.Equals(unicodeString, nsCaseInsensitiveStringComparator()))
{
return PR_TRUE;
}

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

@ -52,6 +52,7 @@
#include "nsCRT.h"
#include "plstr.h"
#include "prmem.h"
#include "nsUnicharUtils.h"
////////////////////////////////////////////////////////////////////////////////
@ -247,7 +248,9 @@ nsresult nsDateTimeFormatMac::Initialize(nsILocale* locale)
else {
res = locale->GetCategory(aCategory.get(), &aLocaleUnichar);
if (NS_SUCCEEDED(res) && NULL != aLocaleUnichar) {
if (mLocale.Length() && mLocale.EqualsIgnoreCase(nsAutoString(aLocaleUnichar))) {
if (!mLocale.IsEmpty() &&
mLocale.Equals(aLocaleUnichar,
nsCaseInsensitiveStringComparator())) {
nsMemory::Free(aLocaleUnichar);
return NS_OK;
}

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

@ -47,6 +47,7 @@
#include "nsIPlatformCharset.h"
#include "nsIPosixLocale.h"
#include "nsCRT.h"
#include "nsUnicharUtils.h"
NS_IMPL_THREADSAFE_ISUPPORTS1(nsDateTimeFormatUnix, nsIDateTimeFormat);
@ -67,7 +68,9 @@ nsresult nsDateTimeFormatUnix::Initialize(nsILocale* locale)
else {
res = locale->GetCategory(aCategory.get(), &aLocaleUnichar);
if (NS_SUCCEEDED(res) && NULL != aLocaleUnichar) {
if (mLocale.Length() && mLocale.EqualsIgnoreCase(nsAutoString(aLocaleUnichar))) {
if (!mLocale.IsEmpty() &&
mLocale.Equals(aLocaleUnichar,
nsCaseInsensitiveStringComparator())) {
nsMemory::Free(aLocaleUnichar);
return NS_OK;
}

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

@ -355,11 +355,12 @@ NS_IMETHODIMP nsImapMailFolder::AddSubfolderWithPath(nsAutoString *name, nsIFile
if(NS_SUCCEEDED(rv))
{
if(isServer && (Compare(*name,
NS_LITERAL_STRING("Inbox"),
nsCaseInsensitiveStringComparator()) == 0))
if(isServer &&
name->Equals(NS_LITERAL_STRING("Inbox"),
nsCaseInsensitiveStringComparator()))
flags |= MSG_FOLDER_FLAG_INBOX;
else if((isServer || isParentInbox) && name->EqualsIgnoreCase(nsAutoString(kTrashName)))
else if((isServer || isParentInbox) && name->Equals(kTrashName,
nsCaseInsensitiveStringComparator()))
flags |= MSG_FOLDER_FLAG_TRASH;
#if 0
else if(name->EqualsIgnoreCase(kSentName))

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

@ -295,15 +295,15 @@ NS_IMETHODIMP nsMsgLocalMailFolder::AddSubfolder(nsAutoString *name,
//Only set these is these are top level children.
if(NS_SUCCEEDED(rv) && isServer)
{
if(name->EqualsIgnoreCase(nsAutoString(kInboxName)))
if(name->Equals(kInboxName, nsCaseInsensitiveStringComparator()))
{
flags |= MSG_FOLDER_FLAG_INBOX;
SetBiffState(nsIMsgFolder::nsMsgBiffState_Unknown);
}
else if (name->EqualsIgnoreCase(nsAutoString(kTrashName)))
else if (name->Equals(kTrashName, nsCaseInsensitiveStringComparator()))
flags |= MSG_FOLDER_FLAG_TRASH;
else if (name->EqualsIgnoreCase(nsAutoString(kUnsentName))
|| Compare(*name, NS_LITERAL_STRING("Outbox"), nsCaseInsensitiveStringComparator()) == 0)
else if (name->Equals(kUnsentName, nsCaseInsensitiveStringComparator()) ||
name->Equals(NS_LITERAL_STRING("Outbox"), nsCaseInsensitiveStringComparator()))
flags |= MSG_FOLDER_FLAG_QUEUE;
#if 0
// the logic for this has been moved into