diff --git a/mailnews/addrbook/build/nsAbFactory.cpp b/mailnews/addrbook/build/nsAbFactory.cpp index 09e98c85cb..a774152997 100644 --- a/mailnews/addrbook/build/nsAbFactory.cpp +++ b/mailnews/addrbook/build/nsAbFactory.cpp @@ -46,7 +46,6 @@ #include "nsIComponentManager.h" #include "nsIServiceManager.h" #include "rdf.h" -#include "nsCRT.h" #include "nsCOMPtr.h" #include "nsDirectoryDataSource.h" diff --git a/mailnews/addrbook/src/nsAbBSDirectory.cpp b/mailnews/addrbook/src/nsAbBSDirectory.cpp index 4c2c395fb3..4a92e494c2 100644 --- a/mailnews/addrbook/src/nsAbBSDirectory.cpp +++ b/mailnews/addrbook/src/nsAbBSDirectory.cpp @@ -251,7 +251,7 @@ NS_IMETHODIMP nsAbBSDirectory::CreateDirectoryByURI(const nsAString &aDisplayNam nsCString fileName; if (StringBeginsWith(aURI, NS_LITERAL_CSTRING(kMDBDirectoryRoot))) - fileName = StringTail(aURI, aURI.Length() - kMDBDirectoryRootLen); + fileName = Substring(aURI, kMDBDirectoryRootLen); DIR_Server * server = nsnull; rv = DIR_AddNewAddressBook(aDisplayName, fileName, aURI, diff --git a/mailnews/addrbook/src/nsAbCardProperty.cpp b/mailnews/addrbook/src/nsAbCardProperty.cpp index 2b6cb6fc22..9b9c267104 100644 --- a/mailnews/addrbook/src/nsAbCardProperty.cpp +++ b/mailnews/addrbook/src/nsAbCardProperty.cpp @@ -62,6 +62,7 @@ #include "nsIProperty.h" #include "nsCOMArray.h" #include "nsArrayEnumerator.h" +#include "prmem.h" #define PREF_MAIL_ADDR_BOOK_LASTNAMEFIRST "mail.addr_book.lastnamefirst" @@ -706,7 +707,9 @@ nsresult nsAbCardProperty::ConvertToBase64EncodedXML(nsACString &result) xmlStr.Append(xmlSubstr); xmlStr.AppendLiteral("\n"); - result.Adopt(PL_Base64Encode(NS_ConvertUTF16toUTF8(xmlStr).get(), 0, nsnull)); + char *tmpRes = PL_Base64Encode(NS_ConvertUTF16toUTF8(xmlStr).get(), 0, nsnull); + result.Assign(tmpRes); + PR_Free(tmpRes); return NS_OK; } diff --git a/mailnews/addrbook/src/nsAbDirectoryQuery.cpp b/mailnews/addrbook/src/nsAbDirectoryQuery.cpp index a5712b0393..0218003df8 100644 --- a/mailnews/addrbook/src/nsAbDirectoryQuery.cpp +++ b/mailnews/addrbook/src/nsAbDirectoryQuery.cpp @@ -501,19 +501,10 @@ nsresult nsAbDirectoryQuery::matchCardCondition(nsIAbCard* card, *matchFound = PR_TRUE; break; case nsIAbBooleanConditionTypes::Contains: -#ifdef MOZILLA_INTERNAL_API - *matchFound = FindInReadable(matchValue, value, nsCaseInsensitiveStringComparator()); -#else - *matchFound = value.Find(matchValue, CaseInsensitiveCompare) >= 0; -#endif - + *matchFound = CaseInsensitiveFindInReadable(matchValue, value); break; case nsIAbBooleanConditionTypes::DoesNotContain: -#ifdef MOZILLA_INTERNAL_API - *matchFound = !FindInReadable(matchValue, value, nsCaseInsensitiveStringComparator()); -#else - *matchFound = value.Find(matchValue, CaseInsensitiveCompare) == -1; -#endif + *matchFound = CaseInsensitiveFindInReadable(matchValue, value); break; case nsIAbBooleanConditionTypes::Is: *matchFound = value.Equals(matchValue, nsCaseInsensitiveStringComparator()); diff --git a/mailnews/addrbook/src/nsAbDirectoryRDFResource.cpp b/mailnews/addrbook/src/nsAbDirectoryRDFResource.cpp index e2afd5e177..70fb376a68 100644 --- a/mailnews/addrbook/src/nsAbDirectoryRDFResource.cpp +++ b/mailnews/addrbook/src/nsAbDirectoryRDFResource.cpp @@ -66,7 +66,7 @@ NS_IMETHODIMP nsAbDirectoryRDFResource::Init(const char* aURI) PRInt32 searchCharLocation = mURINoQuery.FindChar('?'); if (searchCharLocation >= 0) { mQueryString = Substring(mURINoQuery, searchCharLocation + 1); - mURINoQuery.Truncate(searchCharLocation); + mURINoQuery.SetLength(searchCharLocation); mIsQueryURI = PR_TRUE; } diff --git a/mailnews/addrbook/src/nsAbLDAPDirectory.cpp b/mailnews/addrbook/src/nsAbLDAPDirectory.cpp index 8086f9dbb7..303e9205b2 100644 --- a/mailnews/addrbook/src/nsAbLDAPDirectory.cpp +++ b/mailnews/addrbook/src/nsAbLDAPDirectory.cpp @@ -110,7 +110,7 @@ NS_IMETHODIMP nsAbLDAPDirectory::Init(const char* aURI) PRInt32 searchCharLocation = uri.FindChar('?', kLDAPDirectoryRootLen); if (searchCharLocation == -1) - m_DirPrefId = StringTail(uri, uri.Length() - kLDAPDirectoryRootLen); + m_DirPrefId = Substring(uri, kLDAPDirectoryRootLen); else m_DirPrefId = Substring(uri, kLDAPDirectoryRootLen, searchCharLocation - kLDAPDirectoryRootLen); diff --git a/mailnews/addrbook/src/nsAbLDAPListenerBase.cpp b/mailnews/addrbook/src/nsAbLDAPListenerBase.cpp index c16c6e0173..53ff7b217f 100644 --- a/mailnews/addrbook/src/nsAbLDAPListenerBase.cpp +++ b/mailnews/addrbook/src/nsAbLDAPListenerBase.cpp @@ -51,6 +51,8 @@ #include "nsILoginInfo.h" #include "nsServiceManagerUtils.h" #include "nsXPCOMCIDInternal.h" +#include "nsComponentManagerUtils.h" +#include "nsMemory.h" nsAbLDAPListenerBase::nsAbLDAPListenerBase(nsILDAPURL* url, nsILDAPConnection* connection, diff --git a/mailnews/addrbook/src/nsAbLDIFService.cpp b/mailnews/addrbook/src/nsAbLDIFService.cpp index 9007af4815..1c27045bda 100644 --- a/mailnews/addrbook/src/nsAbLDIFService.cpp +++ b/mailnews/addrbook/src/nsAbLDIFService.cpp @@ -537,9 +537,9 @@ void nsAbLDIFService::AddLdifColToDatabase(nsIAddrDatabase *aDatabase, // This will remove the label and place the URI as the work URL else if (colType.EqualsLiteral("labeleduri")) { - PRInt32 index = column.Find(" ", false, 0, -1); + PRInt32 index = column.FindChar(' '); if (index != -1) - column.Truncate(index); + column.SetLength(index); aDatabase->AddWebPage1(newRow, column.get()); } diff --git a/mailnews/addrbook/src/nsAbMDBDirectory.cpp b/mailnews/addrbook/src/nsAbMDBDirectory.cpp index 6527efa587..585756ba79 100644 --- a/mailnews/addrbook/src/nsAbMDBDirectory.cpp +++ b/mailnews/addrbook/src/nsAbMDBDirectory.cpp @@ -105,7 +105,7 @@ NS_IMETHODIMP nsAbMDBDirectory::Init(const char *aUri) // extract the filename from the uri. if (searchCharLocation == -1) - filename = StringTail(uri, uri.Length() - kMDBDirectoryRootLen); + filename = Substring(uri, kMDBDirectoryRootLen); else filename = Substring(uri, kMDBDirectoryRootLen, searchCharLocation - kMDBDirectoryRootLen); diff --git a/mailnews/addrbook/src/nsAbManager.cpp b/mailnews/addrbook/src/nsAbManager.cpp index f1e033dae7..9fe6cebe4f 100644 --- a/mailnews/addrbook/src/nsAbManager.cpp +++ b/mailnews/addrbook/src/nsAbManager.cpp @@ -556,9 +556,8 @@ NS_IMETHODIMP nsAbManager::ExportAddressBook(nsIDOMWindow *aParentWin, nsIAbDire default: case LDIF_EXPORT_TYPE: // ldif // If filename does not have the correct ext, add one. - if ((fileName.Find(LDIF_FILE_EXTENSION, fileName.Length() - strlen(LDIF_FILE_EXTENSION), PR_TRUE) == -1) && - (fileName.Find(LDIF_FILE_EXTENSION2, fileName.Length() - strlen(LDIF_FILE_EXTENSION2), PR_TRUE) == -1)) { - + if ((MsgFind(fileName, LDIF_FILE_EXTENSION, PR_TRUE, fileName.Length() - strlen(LDIF_FILE_EXTENSION)) == -1) && + (MsgFind(fileName, LDIF_FILE_EXTENSION2, PR_TRUE, fileName.Length() - strlen(LDIF_FILE_EXTENSION2)) == -1)) { // Add the extension and build a new localFile. fileName.AppendLiteral(LDIF_FILE_EXTENSION2); @@ -569,7 +568,7 @@ NS_IMETHODIMP nsAbManager::ExportAddressBook(nsIDOMWindow *aParentWin, nsIAbDire case CSV_EXPORT_TYPE: // csv // If filename does not have the correct ext, add one. - if (fileName.Find(CSV_FILE_EXTENSION, fileName.Length() - strlen(CSV_FILE_EXTENSION), PR_TRUE) == -1) { + if (MsgFind(fileName, CSV_FILE_EXTENSION, PR_TRUE, fileName.Length() - strlen(CSV_FILE_EXTENSION)) == -1) { // Add the extension and build a new localFile. fileName.AppendLiteral(CSV_FILE_EXTENSION); @@ -580,8 +579,8 @@ NS_IMETHODIMP nsAbManager::ExportAddressBook(nsIDOMWindow *aParentWin, nsIAbDire case TAB_EXPORT_TYPE: // tab & text // If filename does not have the correct ext, add one. - if ((fileName.Find(TXT_FILE_EXTENSION, fileName.Length() - strlen(TXT_FILE_EXTENSION), PR_TRUE) == -1) && - (fileName.Find(TAB_FILE_EXTENSION, fileName.Length() - strlen(TAB_FILE_EXTENSION), PR_TRUE) == -1)) { + if ((MsgFind(fileName, TXT_FILE_EXTENSION, PR_TRUE, fileName.Length() - strlen(TXT_FILE_EXTENSION)) == -1) && + (MsgFind(fileName, TAB_FILE_EXTENSION, PR_TRUE, fileName.Length() - strlen(TAB_FILE_EXTENSION)) == -1)) { // Add the extension and build a new localFile. fileName.AppendLiteral(TXT_FILE_EXTENSION); diff --git a/mailnews/addrbook/src/nsAbOutlookDirectory.cpp b/mailnews/addrbook/src/nsAbOutlookDirectory.cpp index a6eb1fbe44..029801381e 100644 --- a/mailnews/addrbook/src/nsAbOutlookDirectory.cpp +++ b/mailnews/addrbook/src/nsAbOutlookDirectory.cpp @@ -60,6 +60,7 @@ #include "nsCRTGlue.h" #include "nsArrayUtils.h" #include "nsArrayEnumerator.h" +#include "nsMsgUtils.h" #ifdef PR_LOGGING static PRLogModuleInfo* gAbOutlookDirectoryLog @@ -971,11 +972,11 @@ NS_IMETHODIMP nsAbOutlookDirectory::StartSearch(void) NS_ENSURE_SUCCESS(retCode, retCode) ; nsCOMPtr proxyListener; - retCode = NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD, - NS_GET_IID(nsIAbDirSearchListener), - static_cast(this), - NS_PROXY_SYNC | NS_PROXY_ALWAYS, - getter_AddRefs(proxyListener)); + retCode = MsgGetProxyForObject(NS_PROXY_TO_MAIN_THREAD, + NS_GET_IID(nsIAbDirSearchListener), + static_cast(this), + NS_PROXY_SYNC | NS_PROXY_ALWAYS, + getter_AddRefs(proxyListener)); NS_ENSURE_SUCCESS(retCode, retCode); return DoQuery(this, arguments, proxyListener, -1, 0, &mSearchContext); diff --git a/mailnews/addrbook/src/nsAbView.cpp b/mailnews/addrbook/src/nsAbView.cpp index b64e5ee594..84b18454a0 100644 --- a/mailnews/addrbook/src/nsAbView.cpp +++ b/mailnews/addrbook/src/nsAbView.cpp @@ -59,6 +59,7 @@ #include "nsIPrefLocalizedString.h" #include "nsArrayUtils.h" #include "nsIAddrDatabase.h" // for kPriEmailColumn +#include "nsMsgUtils.h" #define CARD_NOT_FOUND -1 #define ALL_ROWS -1 @@ -77,7 +78,7 @@ nsAbView::nsAbView() : mInitialized(PR_FALSE), mSuppressCountChange(PR_FALSE), mGeneratedNameFormat(0) { - mMailListAtom = do_GetAtom("MailList"); + mMailListAtom = MsgGetAtom("MailList"); } nsAbView::~nsAbView() diff --git a/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp b/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp index ddc311472d..01a2e1fb78 100644 --- a/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp +++ b/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp @@ -229,7 +229,7 @@ nsAddbookProtocolHandler::GeneratePrintOutput(nsIAddbookUrl *addbookUrl, turn "moz-abmdbdirectory/abook.mab" into "moz-abmdbdirectory://abook.mab" */ - pos = uri.Find("/"); + pos = uri.FindChar('/'); if (pos == -1) return NS_ERROR_UNEXPECTED; diff --git a/mailnews/addrbook/src/nsDirPrefs.cpp b/mailnews/addrbook/src/nsDirPrefs.cpp index 59692aeb3c..51c0a592f7 100644 --- a/mailnews/addrbook/src/nsDirPrefs.cpp +++ b/mailnews/addrbook/src/nsDirPrefs.cpp @@ -61,6 +61,7 @@ #include "prprf.h" #include "plstr.h" #include "nsQuickSort.h" +#include "nsComponentManagerUtils.h" #include "msgCore.h" #include @@ -303,8 +304,7 @@ nsresult DIR_AddNewAddressBook(const nsAString &dirName, DIR_GetDirServers(); if (dir_ServerList) { - NS_ConvertUTF16toUTF8 utf8str(dirName); - server->description = ToNewCString(utf8str); + server->description = ToNewCString(NS_ConvertUTF16toUTF8(dirName)); server->position = kDefaultPosition; // don't set position so alphabetic sort will happen. if (!fileName.IsEmpty()) @@ -858,8 +858,7 @@ static char *DIR_GetDescription(const char *prefRoot) char *value = nsnull; if (!wvalue.IsEmpty()) { - NS_ConvertUTF16toUTF8 utf8str(wvalue.get()); - value = ToNewCString(utf8str); + value = ToNewCString(NS_ConvertUTF16toUTF8(wvalue)); } else {