Bug #379070 --> remove nsCRT methods from import, extensions, db.

sr=bienvenu
This commit is contained in:
scott%scott-macgregor.org 2007-06-07 23:19:13 +00:00
Родитель 7345f69fc8
Коммит cbf6917dcf
35 изменённых файлов: 546 добавлений и 578 удалений

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

@ -42,7 +42,6 @@
#define FORCE_PR_LOG /* Allow logging in the release build */
#endif
#include "nsCRT.h"
#include "nsBayesianFilter.h"
#include "nsIInputStream.h"
#include "nsIStreamListener.h"
@ -319,7 +318,7 @@ void Tokenizer::addTokenForHeader(const char * aTokenPrefix, nsACString& aValue,
char* word;
nsCString str(aValue);
char *next = str.BeginWriting();
while ((word = nsCRT::strtok(next, kBayesianFilterTokenDelimiters, &next)) != NULL)
while ((word = NS_strtok(kBayesianFilterTokenDelimiters, &next)) != NULL)
{
if (word[0] == '\0') continue;
if (isDecimalNumber(word)) continue;
@ -616,7 +615,7 @@ void Tokenizer::tokenize(const char* aText)
char* word;
char* next = strippedText;
while ((word = nsCRT::strtok(next, kBayesianFilterTokenDelimiters, &next)) != NULL) {
while ((word = NS_strtok(kBayesianFilterTokenDelimiters, &next)) != NULL) {
if (!*word) continue;
if (isDecimalNumber(word)) continue;
if (isASCII(word))

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

@ -44,14 +44,13 @@
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
#include "nsICategoryManager.h"
#include "nsCRT.h"
#include "nsIExtensionManager.h"
#include "nsIFile.h"
#include "nsILocalFile.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIXULAppInfo.h"
#include "nsCRTGlue.h"
#include "PalmSyncImp.h"
#include "nsPalmSyncSupport.h"
#include "Registry.h"
@ -125,7 +124,7 @@ nsPalmSyncSupport::Observe(nsISupports *aSubject, const char *aTopic, const PRUn
}
else if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID))
rv = ShutdownPalmSyncSupport();
else if (aSubject && !strcmp(aTopic, "em-action-requested") && !nsCRT::strcmp(aData, NS_LITERAL_STRING("item-uninstalled").get()))
else if (aSubject && !strcmp(aTopic, "em-action-requested") && !NS_strcmp(aData, NS_LITERAL_STRING("item-uninstalled").get()))
{
// make sure the subject is our extension.
nsCOMPtr<nsIUpdateItem> updateItem (do_QueryInterface(aSubject, &rv));

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

@ -53,9 +53,9 @@
#include "nsIServiceManager.h"
#include "nsIMsgIdentity.h"
#include "nsIMsgCompFields.h"
#include "nsCRT.h"
#include "nsReadableUtils.h"
#include "nsIMutableArray.h"
#include "msgCore.h"
// String bundle for smime. Class static.
nsCOMPtr<nsIStringBundle> nsMsgComposeSecure::mSMIMEBundle = nsnull;

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

@ -42,7 +42,6 @@
#include "nsIModule.h"
#include "nsIGenericFactory.h"
#include "nsICategoryManager.h"
#include "nsCRT.h"
////////////////////////////////////////////////////////////////////////////////
// core import Include Files
@ -116,7 +115,7 @@ NS_METHOD TextRegister(nsIComponentManager *aCompMgr,
nsCString replace;
char *theCID = kTextImportCID.ToString();
rv = catMan->AddCategoryEntry( "mailnewsimport", theCID, kTextSupportsString, PR_TRUE, PR_TRUE, getter_Copies( replace));
nsCRT::free( theCID);
NS_Free( theCID);
}
return( rv);
@ -141,7 +140,7 @@ NS_METHOD Comm4xMailRegister(nsIComponentManager *aCompMgr,
nsCString replace;
char *theCID = kComm4xMailImportCID.ToString();
rv = catMan->AddCategoryEntry("mailnewsimport", theCID, kComm4xMailSupportsString, PR_TRUE, PR_TRUE, getter_Copies(replace));
nsCRT::free(theCID);
NS_Free(theCID);
}
return rv;
@ -165,7 +164,7 @@ NS_METHOD EudoraRegister(nsIComponentManager *aCompMgr,
nsCString replace;
char *theCID = kEudoraImportCID.ToString();
rv = catMan->AddCategoryEntry( "mailnewsimport", theCID, kEudoraSupportsString, PR_TRUE, PR_TRUE, getter_Copies( replace));
nsCRT::free( theCID);
NS_Free( theCID);
}
return( rv);
@ -195,7 +194,7 @@ NS_METHOD OERegister(nsIComponentManager *aCompMgr,
nsCString replace;
char *theCID = kOEImportCID.ToString();
rv = catMan->AddCategoryEntry( "mailnewsimport", theCID, kOESupportsString, PR_TRUE, PR_TRUE, getter_Copies( replace));
nsCRT::free( theCID);
NS_Free( theCID);
}
return( rv);
@ -213,7 +212,7 @@ NS_METHOD OutlookRegister(nsIComponentManager *aCompMgr,
nsCString replace;
char *theCID = kOutlookImportCID.ToString();
rv = catMan->AddCategoryEntry( "mailnewsimport", theCID, kOutlookSupportsString, PR_TRUE, PR_TRUE, getter_Copies( replace));
nsCRT::free( theCID);
NS_Free( theCID);
}
return( rv);

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

@ -47,7 +47,6 @@
#endif
#include "nscore.h"
#include "nsCRT.h"
#include "nsString.h"
#include "nsCOMPtr.h"
#include "nsIServiceManager.h"
@ -123,18 +122,18 @@ NS_IMETHODIMP nsComm4xMailImport::GetName(PRUnichar **name)
NS_IMETHODIMP nsComm4xMailImport::GetDescription(PRUnichar **name)
{
NS_ENSURE_ARG_POINTER (name);
nsresult rv = NS_ERROR_FAILURE;
if (m_pBundle)
rv = m_pBundle->GetStringFromID(COMM4XMAILIMPORT_DESCRIPTION, name);
return rv;
NS_ENSURE_ARG_POINTER (name);
nsresult rv = NS_ERROR_FAILURE;
if (m_pBundle)
rv = m_pBundle->GetStringFromID(COMM4XMAILIMPORT_DESCRIPTION, name);
return rv;
}
NS_IMETHODIMP nsComm4xMailImport::GetSupports(char **supports)
{
NS_ENSURE_ARG_POINTER (supports);
*supports = nsCRT::strdup(kComm4xMailSupportsString);
return NS_OK;
NS_ENSURE_ARG_POINTER (supports);
*supports = strdup(kComm4xMailSupportsString);
return NS_OK;
}
NS_IMETHODIMP nsComm4xMailImport::GetSupportsUpgrade(PRBool *pUpgrade)

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

@ -205,7 +205,7 @@ void nsEudoraAddress::ProcessLine( const char *pLine, PRInt32 len, nsString& err
PRInt32 cnt;
CAliasEntry *pEntry;
if (!nsCRT::strncmp( pLine, "alias", 5)) {
if (!strncmp( pLine, "alias", 5)) {
pLine += 5;
len -= 5;
cnt = CountWhiteSpace( pLine, len);
@ -217,7 +217,7 @@ void nsEudoraAddress::ProcessLine( const char *pLine, PRInt32 len, nsString& err
}
}
}
else if (!nsCRT::strncmp( pLine, "note", 4)) {
else if (!strncmp( pLine, "note", 4)) {
pLine += 4;
len -= 4;
cnt = CountWhiteSpace( pLine, len);

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

@ -417,7 +417,7 @@ void nsEudoraCompose::GetHeaderValue( const char *pData, PRInt32 dataLen, const
PRInt32 start = 0;
PRInt32 len = strlen( pHeader);
const char *pChar = pData;
if (!nsCRT::strncasecmp( pHeader, pData, len)) {
if (!PL_strncasecmp( pHeader, pData, len)) {
start = len;
}
else {
@ -430,7 +430,7 @@ void nsEudoraCompose::GetHeaderValue( const char *pData, PRInt32 dataLen, const
start++;
pChar++;
}
if ((start < dataLen) && !nsCRT::strncasecmp( pChar, pHeader, len))
if ((start < dataLen) && !PL_strncasecmp( pChar, pHeader, len))
break;
}
if (start < dataLen)
@ -538,11 +538,11 @@ void nsEudoraCompose::CleanUpAttach( nsMsgAttachedFile *a, PRInt32 count)
for (PRInt32 i = 0; i < count; i++) {
a[i].orig_url=nsnull;
if (a[i].type)
nsCRT::free( a[i].type);
NS_Free( a[i].type);
if (a[i].description)
nsCRT::free( a[i].description);
NS_Free( a[i].description);
if (a[i].encoding)
nsCRT::free( a[i].encoding);
NS_Free( a[i].encoding);
}
delete [] a;
}
@ -592,9 +592,9 @@ nsMsgAttachedFile * nsEudoraCompose::GetLocalAttachments( void)
return( nsnull);
}
a[i].type = nsCRT::strdup( pAttach->mimeType);
a[i].real_name = nsCRT::strdup( pAttach->description);
a[i].encoding = nsCRT::strdup( ENCODING_BINARY);
a[i].type = strdup( pAttach->mimeType);
a[i].real_name = strdup( pAttach->description);
a[i].encoding = strdup( ENCODING_BINARY);
}
return( a);
@ -793,7 +793,7 @@ nsresult nsEudoraCompose::SendTheMessage( nsIFile **pMsg)
}
if (pMimeType)
nsCRT::free( pMimeType);
NS_Free( pMimeType);
if (pListen->m_location) {
pListen->m_location->Clone(pMsg);
@ -1058,7 +1058,7 @@ static const char *gReplaceHeaders[kMaxReplaceHeaders] = {
PRBool nsEudoraCompose::IsReplaceHeader( const char *pHeader)
{
for (int i = 0; i < kMaxReplaceHeaders; i++) {
if (!nsCRT::strcasecmp( pHeader, gReplaceHeaders[i]))
if (!PL_strcasecmp( pHeader, gReplaceHeaders[i]))
return( PR_TRUE);
}
@ -1068,7 +1068,7 @@ PRBool nsEudoraCompose::IsReplaceHeader( const char *pHeader)
PRInt32 nsEudoraCompose::IsSpecialHeader( const char *pHeader)
{
for (int i = 0; i < kMaxSpecialHeaders; i++) {
if (!nsCRT::strcasecmp( pHeader, gSpecialHeaders[i]))
if (!PL_strcasecmp( pHeader, gSpecialHeaders[i]))
return( (PRInt32) i);
}
@ -1122,7 +1122,7 @@ nsresult nsEudoraCompose::WriteHeaders(nsIOutputStream *pDst, SimpleBufferTonyRC
}
if (!val.IsEmpty()) {
// See if we're writing out a Date: header.
if (!nsCRT::strcasecmp(header.get(), "Date"))
if (header.LowerCaseEqualsLiteral("date"))
hasDateHeader = PR_TRUE;
rv = pDst->Write( header.get(), header.Length(), &written);
if (NS_SUCCEEDED( rv))

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

@ -49,7 +49,6 @@
#endif
#include "nscore.h"
#include "nsCRT.h"
#include "nsString.h"
#include "nsIServiceManager.h"
#include "nsIImportService.h"
@ -103,22 +102,22 @@ public:
NS_DECL_ISUPPORTS
// nsIImportmail interface
/* void GetDefaultLocation (out nsIFile location, out boolean found, out boolean userVerify); */
NS_IMETHOD GetDefaultLocation(nsIFile **location, PRBool *found, PRBool *userVerify);
/* nsISupportsArray FindMailboxes (in nsIFile location); */
NS_IMETHOD FindMailboxes(nsIFile *location, nsISupportsArray **_retval);
/* void ImportMailbox (in nsIImportMailboxDescriptor source, in nsIFileSpec destination, out boolean fatalError); */
NS_IMETHOD ImportMailbox(nsIImportMailboxDescriptor *source, nsIFile *destination,
NS_IMETHOD ImportMailbox(nsIImportMailboxDescriptor *source, nsIFile *destination,
PRUnichar **pErrorLog, PRUnichar **pSuccessLog, PRBool *fatalError);
/* unsigned long GetImportProgress (); */
NS_IMETHOD GetImportProgress(PRUint32 *_retval);
NS_IMETHOD TranslateFolderName(const nsAString & aFolderName, nsAString & _retval);
public:
static void AddLinebreak( nsString *pStream);
static void SetLogs( nsString& success, nsString& error, PRUnichar **pError, PRUnichar **pSuccess);
@ -151,38 +150,38 @@ public:
NS_DECL_ISUPPORTS
// nsIImportAddressBooks interface
/* PRBool GetSupportsMultiple (); */
NS_IMETHOD GetSupportsMultiple(PRBool *_retval) { *_retval = PR_TRUE; return( NS_OK);}
/* PRBool GetAutoFind (out wstring description); */
NS_IMETHOD GetAutoFind(PRUnichar **description, PRBool *_retval);
/* PRBool GetNeedsFieldMap (nsIFile location); */
NS_IMETHOD GetNeedsFieldMap(nsIFile *location, PRBool *_retval) { *_retval = PR_FALSE; return( NS_OK);}
/* void GetDefaultLocation (out nsIFile location, out boolean found, out boolean userVerify); */
NS_IMETHOD GetDefaultLocation(nsIFile **location, PRBool *found, PRBool *userVerify);
/* nsISupportsArray FindAddressBooks (in nsIFile location); */
NS_IMETHOD FindAddressBooks(nsIFile *location, nsISupportsArray **_retval);
/* nsISupports GetFieldMap (in nsIImportABDescriptor source); */
NS_IMETHOD InitFieldMap(nsIImportFieldMap *fieldMap)
{ return( NS_ERROR_FAILURE); }
/* void ImportAddressBook (in nsIImportABDescriptor source, in nsIAddrDatabase destination, in nsIImportFieldMap fieldMap, in boolean isAddrLocHome, out wstring errorLog, out wstring successLog, out boolean fatalError); */
NS_IMETHOD ImportAddressBook( nsIImportABDescriptor *source,
nsIAddrDatabase * destination,
nsIImportFieldMap * fieldMap,
PRBool isAddrLocHome,
NS_IMETHOD ImportAddressBook( nsIImportABDescriptor *source,
nsIAddrDatabase * destination,
nsIImportFieldMap * fieldMap,
PRBool isAddrLocHome,
PRUnichar ** errorLog,
PRUnichar ** successLog,
PRBool * fatalError);
/* unsigned long GetImportProgress (); */
NS_IMETHOD GetImportProgress(PRUint32 *_retval);
NS_IMETHOD GetSampleData( PRInt32 index, PRBool *pFound, PRUnichar **pStr)
{ return( NS_ERROR_FAILURE);}
@ -237,7 +236,7 @@ NS_IMETHODIMP nsEudoraImport::GetName( PRUnichar **name)
// nsString title = "Outlook Express";
// *name = ToNewUnicode(title);
*name = nsEudoraStringBundle::GetStringByID( EUDORAIMPORT_NAME);
return NS_OK;
}
@ -250,28 +249,28 @@ NS_IMETHODIMP nsEudoraImport::GetDescription( PRUnichar **name)
// nsString desc = "Outlook Express mail and address books";
// *name = ToNewUnicode(desc);
*name = nsEudoraStringBundle::GetStringByID( EUDORAIMPORT_DESCRIPTION);
return NS_OK;
}
NS_IMETHODIMP nsEudoraImport::GetSupports( char **supports)
{
NS_PRECONDITION(supports != nsnull, "null ptr");
if (! supports)
return NS_ERROR_NULL_POINTER;
*supports = nsCRT::strdup( kEudoraSupportsString);
return( NS_OK);
NS_PRECONDITION(supports != nsnull, "null ptr");
if (! supports)
return NS_ERROR_NULL_POINTER;
*supports = strdup( kEudoraSupportsString);
return( NS_OK);
}
NS_IMETHODIMP nsEudoraImport::GetSupportsUpgrade( PRBool *pUpgrade)
{
NS_PRECONDITION(pUpgrade != nsnull, "null ptr");
if (! pUpgrade)
return NS_ERROR_NULL_POINTER;
*pUpgrade = PR_TRUE;
return( NS_OK);
NS_PRECONDITION(pUpgrade != nsnull, "null ptr");
if (! pUpgrade)
return NS_ERROR_NULL_POINTER;
*pUpgrade = PR_TRUE;
return( NS_OK);
}
@ -286,7 +285,7 @@ NS_IMETHODIMP nsEudoraImport::GetImportInterface( const char *pImportType, nsISu
*ppInterface = nsnull;
nsresult rv;
if (!nsCRT::strcmp( pImportType, "mail")) {
if (!strcmp( pImportType, "mail")) {
// create the nsIImportMail interface and return it!
nsIImportMail * pMail = nsnull;
nsIImportGeneric *pGeneric = nsnull;
@ -312,8 +311,8 @@ NS_IMETHODIMP nsEudoraImport::GetImportInterface( const char *pImportType, nsISu
NS_IF_RELEASE( pGeneric);
return( rv);
}
if (!nsCRT::strcmp( pImportType, "addressbook")) {
if (!strcmp( pImportType, "addressbook")) {
// create the nsIImportMail interface and return it!
nsIImportAddressBooks * pAddress = nsnull;
nsIImportGeneric * pGeneric = nsnull;
@ -332,8 +331,8 @@ NS_IMETHODIMP nsEudoraImport::GetImportInterface( const char *pImportType, nsISu
NS_IF_RELEASE( pGeneric);
return( rv);
}
if (!nsCRT::strcmp( pImportType, "settings")) {
if (!strcmp( pImportType, "settings")) {
nsIImportSettings *pSettings = nsnull;
rv = nsEudoraSettings::Create( &pSettings);
if (NS_SUCCEEDED( rv)) {
@ -342,7 +341,7 @@ NS_IMETHODIMP nsEudoraImport::GetImportInterface( const char *pImportType, nsISu
NS_IF_RELEASE( pSettings);
return( rv);
}
return( NS_ERROR_NOT_AVAILABLE);
}
@ -383,7 +382,7 @@ ImportEudoraMailImpl::ImportEudoraMailImpl()
#if defined(XP_MAC) || defined(XP_MACOSX)
// For now default to no labels on Mac
#define kNumEudoraLabels 0
// Use one dummy entry for now as a placeholder to keep the Mac code valid,
// until we enter actual reasonable defaults for Mac builds.
EudoraDefaultLabels defaultEudoraLabels[1] =
@ -437,7 +436,7 @@ NS_IMETHODIMP ImportEudoraMailImpl::GetDefaultLocation( nsIFile **ppLoc, PRBool
NS_PRECONDITION(userVerify != nsnull, "null ptr");
if (!ppLoc || !found || !userVerify)
return NS_ERROR_NULL_POINTER;
*ppLoc = nsnull;
*found = m_eudora.FindMailFolder(ppLoc);
*userVerify = PR_TRUE;
@ -452,7 +451,7 @@ NS_IMETHODIMP ImportEudoraMailImpl::FindMailboxes( nsIFile *pLoc, nsISupportsArr
NS_PRECONDITION(ppArray != nsnull, "null ptr");
if (!pLoc || !ppArray)
return NS_ERROR_NULL_POINTER;
PRBool exists = PR_FALSE;
nsresult rv = pLoc->Exists( &exists);
if (NS_FAILED( rv) || !exists)
@ -463,7 +462,7 @@ NS_IMETHODIMP ImportEudoraMailImpl::FindMailboxes( nsIFile *pLoc, nsISupportsArr
NS_RELEASE( *ppArray);
*ppArray = nsnull;
}
return( rv);
}
@ -512,8 +511,8 @@ void ImportEudoraMailImpl::SetLogs( nsString& success, nsString& error, PRUnicha
*pSuccess = ToNewUnicode(success);
}
NS_IMETHODIMP ImportEudoraMailImpl::ImportMailbox(nsIImportMailboxDescriptor *pSource,
nsIFile *pDestination,
NS_IMETHODIMP ImportEudoraMailImpl::ImportMailbox(nsIImportMailboxDescriptor *pSource,
nsIFile *pDestination,
PRUnichar **pErrorLog,
PRUnichar **pSuccessLog,
PRBool *fatalError)
@ -524,7 +523,7 @@ NS_IMETHODIMP ImportEudoraMailImpl::ImportMailbox(nsIImportMailboxDescriptor *pS
nsCOMPtr<nsIStringBundle> bundle( dont_AddRef( nsEudoraStringBundle::GetStringBundleProxy()));
nsString success;
nsString error;
if (!pSource || !pDestination || !fatalError) {
@ -535,15 +534,15 @@ NS_IMETHODIMP ImportEudoraMailImpl::ImportMailbox(nsIImportMailboxDescriptor *pS
SetLogs( success, error, pErrorLog, pSuccessLog);
return NS_ERROR_NULL_POINTER;
}
PRBool abort = PR_FALSE;
nsString name;
PRUnichar * pName;
if (NS_SUCCEEDED( pSource->GetDisplayName( &pName))) {
name = pName;
nsCRT::free( pName);
NS_Free( pName);
}
PRUint32 mailSize = 0;
pSource->GetSize( &mailSize);
if (mailSize == 0) {
@ -553,30 +552,30 @@ NS_IMETHODIMP ImportEudoraMailImpl::ImportMailbox(nsIImportMailboxDescriptor *pS
return( NS_OK);
}
nsCOMPtr <nsILocalFile> inFile;
if (NS_FAILED(pSource->GetFile( getter_AddRefs(inFile))))
{
ReportError( EUDORAIMPORT_MAILBOX_BADSOURCEFILE, name, &error);
SetLogs( success, error, pErrorLog, pSuccessLog);
SetLogs( success, error, pErrorLog, pSuccessLog);
return( NS_ERROR_FAILURE);
}
#ifdef IMPORT_DEBUG
nsCString pPath;
inFile->GetNativePath(pPath);
inFile->GetNativePath(pPath);
IMPORT_LOG1( "Import mailbox: %s\n", pPath.get());
#endif
PRInt32 msgCount = 0;
nsresult rv = NS_OK;
m_bytes = 0;
rv = m_eudora.ImportMailbox( &m_bytes, &abort, name.get(), inFile, pDestination, &msgCount);
if (NS_SUCCEEDED( rv))
ReportSuccess( name, msgCount, &success);
else
else
ReportError( EUDORAIMPORT_MAILBOX_CONVERTERROR, name, &error);
SetLogs( success, error, pErrorLog, pSuccessLog);
@ -587,12 +586,12 @@ NS_IMETHODIMP ImportEudoraMailImpl::ImportMailbox(nsIImportMailboxDescriptor *pS
}
NS_IMETHODIMP ImportEudoraMailImpl::GetImportProgress( PRUint32 *pDoneSoFar)
{
NS_IMETHODIMP ImportEudoraMailImpl::GetImportProgress( PRUint32 *pDoneSoFar)
{
NS_PRECONDITION(pDoneSoFar != nsnull, "null ptr");
if (! pDoneSoFar)
return NS_ERROR_NULL_POINTER;
*pDoneSoFar = m_bytes;
return( NS_OK);
}
@ -605,7 +604,7 @@ NS_IMETHODIMP ImportEudoraMailImpl::TranslateFolderName(const nsAString & aFolde
else if (aFolderName.Equals(NS_LITERAL_STRING("In"), nsCaseInsensitiveStringComparator()))
_retval = NS_LITERAL_STRING(kDestInboxFolderName);
else
_retval = aFolderName;
_retval = aFolderName;
return NS_OK;
}
@ -636,19 +635,19 @@ ImportEudoraAddressImpl::~ImportEudoraAddressImpl()
NS_IMPL_THREADSAFE_ISUPPORTS1(ImportEudoraAddressImpl, nsIImportAddressBooks)
NS_IMETHODIMP ImportEudoraAddressImpl::GetAutoFind(PRUnichar **description, PRBool *_retval)
{
NS_PRECONDITION(description != nsnull, "null ptr");
NS_PRECONDITION(_retval != nsnull, "null ptr");
if (! description || !_retval)
return NS_ERROR_NULL_POINTER;
nsString str;
*_retval = PR_FALSE;
nsEudoraStringBundle::GetStringByID( EUDORAIMPORT_NICKNAMES_NAME, str);
*description = ToNewUnicode(str);
return( NS_OK);
}
@ -660,23 +659,23 @@ NS_IMETHODIMP ImportEudoraAddressImpl::GetDefaultLocation(nsIFile **ppLoc, PRBoo
NS_PRECONDITION(userVerify != nsnull, "null ptr");
if (! found || !userVerify || !ppLoc)
return NS_ERROR_NULL_POINTER;
*ppLoc = nsnull;
*found = m_eudora.FindAddressFolder(ppLoc);
*userVerify = PR_TRUE;
return( NS_OK);
return( NS_OK);
}
NS_IMETHODIMP ImportEudoraAddressImpl::FindAddressBooks(nsIFile *pLoc, nsISupportsArray **ppArray)
{
NS_PRECONDITION(pLoc != nsnull, "null ptr");
NS_PRECONDITION(ppArray != nsnull, "null ptr");
if (!pLoc || !ppArray)
return NS_ERROR_NULL_POINTER;
PRBool exists = PR_FALSE;
nsresult rv = pLoc->Exists( &exists);
if (NS_FAILED( rv) || !exists)
@ -687,11 +686,11 @@ NS_IMETHODIMP ImportEudoraAddressImpl::FindAddressBooks(nsIFile *pLoc, nsISuppor
NS_RELEASE( *ppArray);
*ppArray = nsnull;
}
return( rv);
}
void ImportEudoraAddressImpl::ReportSuccess( nsString& name, nsString *pStream)
{
@ -709,10 +708,10 @@ void ImportEudoraAddressImpl::ReportSuccess( nsString& name, nsString *pStream)
}
NS_IMETHODIMP ImportEudoraAddressImpl::ImportAddressBook( nsIImportABDescriptor *pSource,
nsIAddrDatabase * pDestination,
nsIImportFieldMap * fieldMap,
PRBool isAddrLocHome,
NS_IMETHODIMP ImportEudoraAddressImpl::ImportAddressBook( nsIImportABDescriptor *pSource,
nsIAddrDatabase * pDestination,
nsIImportFieldMap * fieldMap,
PRBool isAddrLocHome,
PRUnichar ** pErrorLog,
PRUnichar ** pSuccessLog,
PRBool * fatalError)
@ -720,7 +719,7 @@ NS_IMETHODIMP ImportEudoraAddressImpl::ImportAddressBook( nsIImportABDescriptor
NS_PRECONDITION(pSource != nsnull, "null ptr");
NS_PRECONDITION(pDestination != nsnull, "null ptr");
NS_PRECONDITION(fatalError != nsnull, "null ptr");
nsCOMPtr<nsIStringBundle> bundle( dont_AddRef( nsEudoraStringBundle::GetStringBundleProxy()));
nsString success;
@ -733,11 +732,11 @@ NS_IMETHODIMP ImportEudoraAddressImpl::ImportAddressBook( nsIImportABDescriptor
ImportEudoraMailImpl::SetLogs( success, error, pErrorLog, pSuccessLog);
return NS_ERROR_NULL_POINTER;
}
PRBool abort = PR_FALSE;
nsString name;
pSource->GetPreferredName(name);
PRUint32 addressSize = 0;
pSource->GetSize( &addressSize);
if (addressSize == 0) {
@ -747,11 +746,11 @@ NS_IMETHODIMP ImportEudoraAddressImpl::ImportAddressBook( nsIImportABDescriptor
return( NS_OK);
}
nsCOMPtr<nsIFile> inFile;
if (NS_FAILED(pSource->GetAbFile(getter_AddRefs(inFile)))) {
ImportEudoraMailImpl::ReportError( EUDORAIMPORT_ADDRESS_BADSOURCEFILE, name, &error);
ImportEudoraMailImpl::SetLogs( success, error, pErrorLog, pSuccessLog);
ImportEudoraMailImpl::SetLogs( success, error, pErrorLog, pSuccessLog);
return( NS_ERROR_FAILURE);
}
@ -761,10 +760,10 @@ NS_IMETHODIMP ImportEudoraAddressImpl::ImportAddressBook( nsIImportABDescriptor
inFile->GetNativePath(path);
IMPORT_LOG1( "Import address book: %s\n", path.get());
#endif
nsresult rv = NS_OK;
m_bytes = 0;
rv = m_eudora.ImportAddresses( &m_bytes, &abort, name.get(), inFile, pDestination, error);
@ -782,13 +781,13 @@ NS_IMETHODIMP ImportEudoraAddressImpl::ImportAddressBook( nsIImportABDescriptor
return( rv);
}
NS_IMETHODIMP ImportEudoraAddressImpl::GetImportProgress(PRUint32 *_retval)
{
NS_PRECONDITION(_retval != nsnull, "null ptr");
if (!_retval)
return( NS_ERROR_NULL_POINTER);
*_retval = m_bytes;
return( NS_OK);

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

@ -1020,7 +1020,7 @@ PRBool nsEudoraMac::IsValidMailboxFile( nsIFile *pFile)
if (NS_FAILED( rv) || (read != 5))
return( PR_FALSE);
buffer[5] = 0;
if (nsCRT::strcmp( buffer, "From "))
if (strcmp( buffer, "From "))
return( PR_FALSE);
}

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

@ -939,7 +939,7 @@ PRBool nsEudoraMailbox::IsEudoraTag( const char *pChar, PRInt32 maxLen, PRBool &
{
PRInt32 idx = 0;
while ((tagLength = eudoraTagLen[idx]) != 0) {
if (maxLen >= tagLength && !nsCRT::strncmp( eudoraTag[idx], pChar, tagLength)) {
if (maxLen >= tagLength && !strncmp( eudoraTag[idx], pChar, tagLength)) {
insideEudoraTags = (pChar[1] != '/');
bodyType = TagContentType[idx];
return PR_TRUE;
@ -1063,17 +1063,17 @@ PRInt32 nsEudoraMailbox::IsEudoraFromSeparator( const char *pChar, PRInt32 maxLe
return( -1);
month = result;
}
else if ((tokLen == 6) && !nsCRT::strncasecmp( pTok, "remote", 6)) {
else if ((tokLen == 6) && !PL_strncasecmp( pTok, "remote", 6)) {
if (remote || from)
return( -1);
remote = PR_TRUE;
}
else if ((tokLen == 4) && !nsCRT::strncasecmp( pTok, "from", 4)) {
else if ((tokLen == 4) && !PL_strncasecmp( pTok, "from", 4)) {
if (!remote || from)
return( -1);
from = PR_TRUE;
}
else if ((tokLen == 4) && ((num > 1900) || !nsCRT::strncmp( pTok, "0000", 4))) {
else if ((tokLen == 4) && ((num > 1900) || !strncmp( pTok, "0000", 4))) {
if (year)
return( -1);
year = (int)num;
@ -1197,7 +1197,7 @@ PRInt32 nsEudoraMailbox::AsciiToLong( const char *pChar, PRInt32 len)
int nsEudoraMailbox::IsWeekDayStr( const char *pStr)
{
for (int i = 0; i < 7; i++) {
if (!nsCRT::strncasecmp( pStr, eudoraWeekDays[i], 3))
if (!PL_strncasecmp( pStr, eudoraWeekDays[i], 3))
return( i + 1);
}
return( 0);
@ -1206,7 +1206,7 @@ int nsEudoraMailbox::IsWeekDayStr( const char *pStr)
int nsEudoraMailbox::IsMonthStr( const char *pStr)
{
for (int i = 0; i < 12; i++) {
if (!nsCRT::strncasecmp( pStr, eudoraMonths[i], 3))
if (!PL_strncasecmp( pStr, eudoraMonths[i], 3))
return( i + 1);
}
return( 0);
@ -1230,8 +1230,8 @@ void nsEudoraMailbox::EmptyAttachments( void)
for (PRInt32 i = 0; i < max; i++) {
pAttach = (ImportAttachment *) m_attachments.ElementAt( i);
if (pAttach) {
nsCRT::free( pAttach->description);
nsCRT::free( pAttach->mimeType);
NS_Free( pAttach->description);
NS_Free( pAttach->mimeType);
delete pAttach;
}
}
@ -1269,7 +1269,7 @@ nsresult nsEudoraMailbox::ExamineAttachment( SimpleBufferTonyRCopiedOnce& data)
PRInt32 cnt;
PRInt32 idx = 0;
while ((cnt = eudoraAttachLen[idx]) != 0) {
if (!nsCRT::strncmp( eudoraAttachLines[idx], pChar, cnt)) {
if (!strncmp( eudoraAttachLines[idx], pChar, cnt)) {
pData = pChar + cnt;
while (((*pData == ' ') || (*pData == '\t')) && (cnt < len)) {
cnt++;
@ -1317,26 +1317,26 @@ nsresult nsEudoraMailbox::ExamineAttachment( SimpleBufferTonyRCopiedOnce& data)
PRBool nsEudoraMailbox::AddAttachment( nsCString& fileName)
{
IMPORT_LOG1( "Found attachment: %s\n", fileName.get());
IMPORT_LOG1( "Found attachment: %s\n", fileName.get());
nsresult rv;
nsCOMPtr <nsILocalFile> pFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
if (NS_FAILED( rv))
return( PR_FALSE);
nsresult rv;
nsCOMPtr <nsILocalFile> pFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
if (NS_FAILED( rv))
return( PR_FALSE);
nsCString mimeType;
nsCString attachmentName;
if (NS_FAILED( GetAttachmentInfo( fileName.get(), pFile, mimeType, attachmentName)))
return( PR_FALSE);
nsCString mimeType;
nsCString attachmentName;
if (NS_FAILED( GetAttachmentInfo( fileName.get(), pFile, mimeType, attachmentName)))
return( PR_FALSE);
ImportAttachment *a = new ImportAttachment;
a->mimeType = ToNewCString(mimeType);
a->description = !attachmentName.IsEmpty() ? ToNewCString(attachmentName) : nsCRT::strdup( "Attached File");
a->pAttachment = pFile;
ImportAttachment *a = new ImportAttachment;
a->mimeType = ToNewCString(mimeType);
a->description = !attachmentName.IsEmpty() ? ToNewCString(attachmentName) : strdup( "Attached File");
a->pAttachment = pFile;
m_attachments.AppendElement( a);
m_attachments.AppendElement( a);
return( PR_TRUE);
return( PR_TRUE);
}
nsresult nsEudoraMailbox::FillMailBuffer( ReadFileState *pState, SimpleBufferTonyRCopiedOnce& read)

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

@ -37,7 +37,6 @@
#ifndef nsEudoraStringBundle_H__
#define nsEudoraStringBundle_H__
#include "nsCRT.h"
#include "nsString.h"
class nsIStringBundle;
@ -48,7 +47,7 @@ public:
static void GetStringByID(PRInt32 stringID, nsString& result, nsIStringBundle *pBundle = nsnull);
static nsIStringBundle * GetStringBundle( void); // don't release
static nsIStringBundle * GetStringBundleProxy( void); // release
static void FreeString( PRUnichar *pStr) { nsCRT::free( pStr);}
static void FreeString( PRUnichar *pStr) { NS_Free( pStr);}
static void Cleanup( void);
private:

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

@ -1125,7 +1125,7 @@ void nsEudoraWin32::GetMimeTypeFromExtension( nsCString& ext, nsCString& mimeTyp
tStr.Truncate();
tStr.Append( pStart, len);
tStr.Trim( kWhitespace);
if (!nsCRT::strcasecmp( tStr.get(), pExt)) {
if (!PL_strcasecmp( tStr.get(), pExt)) {
// skip the mac creator and type
pChar++;
while (*pChar && (*pChar != ','))

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

@ -36,15 +36,12 @@
* ***** END LICENSE BLOCK ***** */
#include "nscore.h"
#include "nsCRT.h"
#include "wabobject.h"
enum {
ieidPR_DISPLAY_NAME = 0,
ieidPR_ENTRYID,
ieidPR_OBJECT_TYPE,
ieidPR_OBJECT_TYPE,
ieidMax
};

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

@ -36,7 +36,6 @@
* ***** END LICENSE BLOCK ***** */
#include "nsOE5File.h"
#include "nsCRT.h"
#include "OEDebugLog.h"
#include "nsMsgUtils.h"
#include "msgCore.h"
@ -81,7 +80,7 @@ PRBool nsOE5File::VerifyLocalMailFile( nsIFile *pFile)
storeName[12] = 0;
if (nsCRT::strcasecmp( "LocalStore", storeName))
if (PL_strcasecmp( "LocalStore", storeName))
result = PR_FALSE;
return( result);

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

@ -43,7 +43,6 @@
*/
#include "nscore.h"
#include "nsCRT.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsReadableUtils.h"

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

@ -48,7 +48,6 @@
#endif
#include "nscore.h"
#include "nsCRT.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsIServiceManager.h"
@ -249,7 +248,7 @@ NS_IMETHODIMP nsOEImport::GetImportInterface( const char *pImportType, nsISuppor
*ppInterface = nsnull;
nsresult rv;
if (!nsCRT::strcmp( pImportType, "mail")) {
if (!strcmp( pImportType, "mail")) {
// create the nsIImportMail interface and return it!
nsIImportMail * pMail = nsnull;
nsIImportGeneric *pGeneric = nsnull;
@ -276,7 +275,7 @@ NS_IMETHODIMP nsOEImport::GetImportInterface( const char *pImportType, nsISuppor
return( rv);
}
if (!nsCRT::strcmp( pImportType, "addressbook")) {
if (!strcmp( pImportType, "addressbook")) {
// create the nsIImportMail interface and return it!
nsIImportAddressBooks * pAddress = nsnull;
nsIImportGeneric * pGeneric = nsnull;
@ -296,7 +295,7 @@ NS_IMETHODIMP nsOEImport::GetImportInterface( const char *pImportType, nsISuppor
return( rv);
}
if (!nsCRT::strcmp( pImportType, "settings")) {
if (!strcmp( pImportType, "settings")) {
nsIImportSettings *pSettings = nsnull;
rv = nsOESettings::Create( &pSettings);
if (NS_SUCCEEDED( rv)) {

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

@ -37,7 +37,6 @@
#ifndef _nsOEStringBundle_H__
#define _nsOEStringBundle_H__
#include "nsCRT.h"
#include "nsString.h"
class nsIStringBundle;
@ -47,7 +46,7 @@ public:
static PRUnichar * GetStringByID(PRInt32 stringID, nsIStringBundle *pBundle = nsnull);
static void GetStringByID(PRInt32 stringID, nsString& result, nsIStringBundle *pBundle = nsnull);
static nsIStringBundle * GetStringBundle( void); // don't release
static void FreeString( PRUnichar *pStr) { nsCRT::free( pStr);}
static void FreeString( PRUnichar *pStr) { NS_Free( pStr);}
static void Cleanup( void);
static nsIStringBundle * GetStringBundleProxy( void); // release

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

@ -38,7 +38,6 @@
#include "MapiDbgLog.h"
#include "MapiApi.h"
#include "nsCRT.h"
#include "prprf.h"
#include "nsReadableUtils.h"
#include "nsUnicharUtils.h"
@ -1294,7 +1293,7 @@ void CMapiApi::ReportUIDProp( const char *pTag, LPSPropValue pVal)
char * pStr = uid.ToString();
if (pStr) {
MAPI_TRACE2( "%s %s\n", pTag, (const char *)pStr);
nsCRT::free( pStr);
NS_Free( pStr);
}
}
}
@ -1603,13 +1602,13 @@ void CMapiFolderList::DumpList( void)
#ifdef MAPI_DEBUG
char *ansiStr = ToNewCString(str);
MAPI_TRACE2( "%s%s: ", prefix, ansiStr);
nsCRT::free(ansiStr);
NS_Free(ansiStr);
#endif
pFolder->GetFilePath( str);
#ifdef MAPI_DEBUG
ansiStr = ToNewCString(str);
MAPI_TRACE2( "depth=%d, filePath=%s\n", pFolder->GetDepth(), ansiStr);
nsCRT::free(ansiStr);
NS_Free(ansiStr);
#endif
}
MAPI_TRACE0( "---------------------------------------------\n");

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

@ -36,7 +36,6 @@
* ***** END LICENSE BLOCK ***** */
#include "nscore.h"
#include "nsCRT.h"
#include "nsString.h"
#include "MapiMimeTypes.h"

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

@ -392,7 +392,7 @@ void nsOutlookCompose::GetHeaderValue( const char *pData, PRInt32 dataLen, const
PRInt32 start = 0;
PRInt32 len = strlen( pHeader);
const char *pChar = pData;
if (!nsCRT::strncasecmp( pHeader, pData, len)) {
if (!PL_strncasecmp( pHeader, pData, len)) {
start = len;
}
else {
@ -405,7 +405,7 @@ void nsOutlookCompose::GetHeaderValue( const char *pData, PRInt32 dataLen, const
start++;
pChar++;
}
if ((start < dataLen) && !nsCRT::strncasecmp( pChar, pHeader, len))
if ((start < dataLen) && !PL_strncasecmp( pChar, pHeader, len))
break;
}
if (start < dataLen)
@ -514,11 +514,11 @@ void nsOutlookCompose::CleanUpAttach( nsMsgAttachedFile *a, PRInt32 count)
{
a[i].orig_url=nsnull;
if (a[i].type)
nsCRT::free( a[i].type);
NS_Free( a[i].type);
if (a[i].description)
nsCRT::free( a[i].description);
NS_Free( a[i].description);
if (a[i].encoding)
nsCRT::free( a[i].encoding);
NS_Free( a[i].encoding);
}
delete [] a;
}
@ -567,9 +567,9 @@ nsMsgAttachedFile * nsOutlookCompose::GetLocalAttachments( void)
return( nsnull);
}
a[i].type = nsCRT::strdup( pAttach->mimeType);
a[i].real_name = nsCRT::strdup( pAttach->description);
a[i].encoding = nsCRT::strdup( ENCODING_BINARY);
a[i].type = strdup( pAttach->mimeType);
a[i].real_name = strdup( pAttach->description);
a[i].encoding = strdup( ENCODING_BINARY);
}
return( a);
@ -709,7 +709,7 @@ nsresult nsOutlookCompose::SendTheMessage( nsIFile *pMsg, nsMsgDeliverMode mode,
}
if (pMimeType)
nsCRT::free( pMimeType);
NS_Free( pMimeType);
if (pListen->m_location) {
pListen->m_location->Clone(&pMsg);
@ -972,7 +972,7 @@ static const char *gReplaceHeaders[kMaxReplaceHeaders] = {
PRBool nsOutlookCompose::IsReplaceHeader( const char *pHeader)
{
for (int i = 0; i < kMaxReplaceHeaders; i++) {
if (!nsCRT::strcasecmp( pHeader, gReplaceHeaders[i]))
if (!PL_strcasecmp( pHeader, gReplaceHeaders[i]))
return( PR_TRUE);
}
@ -982,7 +982,7 @@ PRBool nsOutlookCompose::IsReplaceHeader( const char *pHeader)
PRInt32 nsOutlookCompose::IsSpecialHeader( const char *pHeader)
{
for (int i = 0; i < kMaxSpecialHeaders; i++) {
if (!nsCRT::strcasecmp( pHeader, gSpecialHeaders[i]))
if (!PL_strcasecmp( pHeader, gSpecialHeaders[i]))
return( (PRInt32) i);
}

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

@ -48,7 +48,6 @@
#endif
#include "nscore.h"
#include "nsCRT.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsIServiceManager.h"
@ -241,7 +240,7 @@ NS_IMETHODIMP nsOutlookImport::GetSupports( char **supports)
if (! supports)
return NS_ERROR_NULL_POINTER;
*supports = nsCRT::strdup( kOutlookSupportsString);
*supports = strdup( kOutlookSupportsString);
return( NS_OK);
}
@ -266,7 +265,7 @@ NS_IMETHODIMP nsOutlookImport::GetImportInterface( const char *pImportType, nsIS
*ppInterface = nsnull;
nsresult rv;
if (!nsCRT::strcmp( pImportType, "mail")) {
if (!strcmp( pImportType, "mail")) {
// create the nsIImportMail interface and return it!
nsIImportMail * pMail = nsnull;
nsIImportGeneric *pGeneric = nsnull;
@ -293,7 +292,7 @@ NS_IMETHODIMP nsOutlookImport::GetImportInterface( const char *pImportType, nsIS
return( rv);
}
if (!nsCRT::strcmp( pImportType, "addressbook")) {
if (!strcmp( pImportType, "addressbook")) {
// create the nsIImportMail interface and return it!
nsIImportAddressBooks * pAddress = nsnull;
nsIImportGeneric * pGeneric = nsnull;
@ -313,7 +312,7 @@ NS_IMETHODIMP nsOutlookImport::GetImportInterface( const char *pImportType, nsIS
return( rv);
}
if (!nsCRT::strcmp( pImportType, "settings")) {
if (!strcmp( pImportType, "settings")) {
nsIImportSettings *pSettings = nsnull;
rv = nsOutlookSettings::Create( &pSettings);
if (NS_SUCCEEDED( rv)) {
@ -477,7 +476,7 @@ NS_IMETHODIMP ImportOutlookMailImpl::ImportMailbox( nsIImportMailboxDescriptor *
PRUnichar * pName;
if (NS_SUCCEEDED( pSource->GetDisplayName( &pName))) {
name = pName;
nsCRT::free( pName);
NS_Free( pName);
}
PRUint32 mailSize = 0;

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

@ -365,9 +365,9 @@ void nsOutlookMail::SetDefaultContentType(CMapiMessage &msg, nsCString &cType)
{
// If content type is not multipart/alternative or mixed or related, return.
// for a multipart alternative with attachments, we get multipart mixed!
if (nsCRT::strcasecmp(msg.GetMimeContent(), "multipart/alternative")
&& nsCRT::strcasecmp(msg.GetMimeContent(), "multipart/mixed")
&& nsCRT::strcasecmp(msg.GetMimeContent(), "multipart/related"))
if (PL_strcasecmp(msg.GetMimeContent(), "multipart/alternative")
&& PL_strcasecmp(msg.GetMimeContent(), "multipart/mixed")
&& PL_strcasecmp(msg.GetMimeContent(), "multipart/related"))
return;
// For multipart/alternative, if no body or boundary,
@ -782,8 +782,8 @@ void nsOutlookMail::EmptyAttachments( void)
DeleteFile( pAttach->pAttachment);
pAttach->pAttachment = nsnull;
}
nsCRT::free( pAttach->description);
nsCRT::free( pAttach->mimeType);
NS_Free( pAttach->description);
NS_Free( pAttach->mimeType);
delete pAttach;
}
}
@ -808,8 +808,8 @@ void nsOutlookMail::BuildAttachments( CMapiMessage& msg, int count)
}
else {
if (msg.GetAttachFileLoc( pFile)) {
PRBool isFile = PR_FALSE;
PRBool exists = PR_FALSE;
PRBool isFile = PR_FALSE;
PRBool exists = PR_FALSE;
pFile->Exists( &exists);
pFile->IsFile( &isFile);
@ -819,7 +819,7 @@ void nsOutlookMail::BuildAttachments( CMapiMessage& msg, int count)
else {
// We have a file spec, now get the other info
OutlookAttachment *a = new OutlookAttachment;
a->mimeType = nsCRT::strdup( msg.GetMimeType());
a->mimeType = strdup( msg.GetMimeType());
// Init description here so that we cacn tell
// if defaul tattacchment is needed later.
a->description = nsnull;

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

@ -37,21 +37,21 @@
#ifndef _nsOutlookStringBundle_H__
#define _nsOutlookStringBundle_H__
#include "nsCRT.h"
#include "nsCRTGlue.h"
#include "nsString.h"
class nsIStringBundle;
class nsOutlookStringBundle {
public:
static PRUnichar * GetStringByID(PRInt32 stringID, nsIStringBundle *pBundle = nsnull);
static void GetStringByID(PRInt32 stringID, nsString& result, nsIStringBundle *pBundle = nsnull);
static nsIStringBundle * GetStringBundle( void); // don't release
static nsIStringBundle * GetStringBundleProxy( void); // release
static void FreeString( PRUnichar *pStr) { nsCRT::free( pStr);}
static void Cleanup( void);
private:
static nsIStringBundle * m_pBundle;
static PRUnichar * GetStringByID(PRInt32 stringID, nsIStringBundle *pBundle = nsnull);
static void GetStringByID(PRInt32 stringID, nsString& result, nsIStringBundle *pBundle = nsnull);
static nsIStringBundle * GetStringBundle( void); // don't release
static nsIStringBundle * GetStringBundleProxy( void); // release
static void FreeString( PRUnichar *pStr) { NS_Free( pStr);}
static void Cleanup( void);
private:
static nsIStringBundle * m_pBundle;
};

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

@ -37,7 +37,6 @@
#include "nscore.h"
#include "nsString.h"
#include "nsCRT.h"
#include "prio.h"
#include "nsNetUtil.h"
#include "nsISeekableStream.h"

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

@ -48,7 +48,6 @@
#include "nsISupportsPrimitives.h"
#include "nsIImportABDescriptor.h"
#include "nsIImportFieldMap.h"
#include "nsCRT.h"
#include "nsString.h"
#include "nsIURL.h"
#include "nsNetCID.h"
@ -203,22 +202,22 @@ nsImportGenericAddressBooks::nsImportGenericAddressBooks()
nsImportGenericAddressBooks::~nsImportGenericAddressBooks()
{
if (m_pThreadData) {
m_pThreadData->DriverAbort();
m_pThreadData = nsnull;
}
if (m_pDestinationUri)
nsCRT::free( m_pDestinationUri);
if (m_description)
nsCRT::free( m_description);
if (m_pThreadData) {
m_pThreadData->DriverAbort();
m_pThreadData = nsnull;
}
NS_IF_RELEASE( m_pFieldMap);
NS_IF_RELEASE( m_pInterface);
NS_IF_RELEASE( m_pBooks);
NS_IF_RELEASE( m_pSuccessLog);
NS_IF_RELEASE( m_pErrorLog);
if (m_pDestinationUri)
NS_Free( m_pDestinationUri);
if (m_description)
NS_Free( m_description);
NS_IF_RELEASE( m_pFieldMap);
NS_IF_RELEASE( m_pInterface);
NS_IF_RELEASE( m_pBooks);
NS_IF_RELEASE( m_pSuccessLog);
NS_IF_RELEASE( m_pErrorLog);
}
@ -228,90 +227,90 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsImportGenericAddressBooks, nsIImportGeneric)
NS_IMETHODIMP nsImportGenericAddressBooks::GetData(const char *dataId, nsISupports **_retval)
{
NS_PRECONDITION(_retval != nsnull, "null ptr");
if (!_retval)
return NS_ERROR_NULL_POINTER;
nsresult rv;
*_retval = nsnull;
if (!nsCRT::strcasecmp( dataId, "addressInterface")) {
*_retval = m_pInterface;
NS_IF_ADDREF( m_pInterface);
}
if (!nsCRT::strcasecmp( dataId, "addressLocation")) {
if (!m_pLocation)
GetDefaultLocation();
NS_IF_ADDREF(*_retval = m_pLocation);
}
if (!nsCRT::strcasecmp( dataId, "addressBooks")) {
if (!m_pLocation)
GetDefaultLocation();
if (!m_pBooks)
GetDefaultBooks();
*_retval = m_pBooks;
NS_IF_ADDREF( m_pBooks);
}
if (!nsCRT::strcasecmp( dataId, "addressDestination")) {
if (m_pDestinationUri) {
NS_PRECONDITION(_retval != nsnull, "null ptr");
if (!_retval)
return NS_ERROR_NULL_POINTER;
nsresult rv;
*_retval = nsnull;
if (!PL_strcasecmp( dataId, "addressInterface")) {
*_retval = m_pInterface;
NS_IF_ADDREF( m_pInterface);
}
if (!PL_strcasecmp( dataId, "addressLocation")) {
if (!m_pLocation)
GetDefaultLocation();
NS_IF_ADDREF(*_retval = m_pLocation);
}
if (!PL_strcasecmp( dataId, "addressBooks")) {
if (!m_pLocation)
GetDefaultLocation();
if (!m_pBooks)
GetDefaultBooks();
*_retval = m_pBooks;
NS_IF_ADDREF( m_pBooks);
}
if (!PL_strcasecmp( dataId, "addressDestination")) {
if (m_pDestinationUri) {
nsCOMPtr<nsISupportsCString> abString = do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
abString->SetData(nsDependentCString(m_pDestinationUri));
NS_IF_ADDREF( *_retval = abString);
}
}
}
}
if (!nsCRT::strcasecmp( dataId, "fieldMap")) {
if (m_pFieldMap) {
*_retval = m_pFieldMap;
m_pFieldMap->AddRef();
}
else {
if (m_pInterface && m_pLocation) {
PRBool needsIt = PR_FALSE;
m_pInterface->GetNeedsFieldMap( m_pLocation, &needsIt);
if (needsIt) {
GetDefaultFieldMap();
if (m_pFieldMap) {
*_retval = m_pFieldMap;
m_pFieldMap->AddRef();
}
}
}
}
}
if (!PL_strcasecmp( dataId, "fieldMap")) {
if (m_pFieldMap) {
*_retval = m_pFieldMap;
m_pFieldMap->AddRef();
}
else {
if (m_pInterface && m_pLocation) {
PRBool needsIt = PR_FALSE;
m_pInterface->GetNeedsFieldMap( m_pLocation, &needsIt);
if (needsIt) {
GetDefaultFieldMap();
if (m_pFieldMap) {
*_retval = m_pFieldMap;
m_pFieldMap->AddRef();
}
}
}
}
}
if (!nsCRT::strncasecmp( dataId, "sampleData-", 11)) {
// extra the record number
const char *pNum = dataId + 11;
PRInt32 rNum = 0;
while (*pNum) {
rNum *= 10;
rNum += (*pNum - '0');
pNum++;
}
IMPORT_LOG1( "Requesting sample data #: %ld\n", (long)rNum);
if (m_pInterface) {
nsCOMPtr<nsISupportsString> data = do_CreateInstance( NS_SUPPORTS_STRING_CONTRACTID, &rv);
if (NS_FAILED( rv))
return( rv);
PRUnichar * pData = nsnull;
PRBool found = PR_FALSE;
rv = m_pInterface->GetSampleData( rNum, &found, &pData);
if (NS_FAILED( rv))
return( rv);
if (found) {
data->SetData(nsDependentString(pData));
*_retval = data;
NS_ADDREF( *_retval);
}
nsCRT::free( pData);
}
}
if (!PL_strncasecmp( dataId, "sampleData-", 11)) {
// extra the record number
const char *pNum = dataId + 11;
PRInt32 rNum = 0;
while (*pNum) {
rNum *= 10;
rNum += (*pNum - '0');
pNum++;
}
IMPORT_LOG1( "Requesting sample data #: %ld\n", (long)rNum);
if (m_pInterface) {
nsCOMPtr<nsISupportsString> data = do_CreateInstance( NS_SUPPORTS_STRING_CONTRACTID, &rv);
if (NS_FAILED( rv))
return( rv);
PRUnichar * pData = nsnull;
PRBool found = PR_FALSE;
rv = m_pInterface->GetSampleData( rNum, &found, &pData);
if (NS_FAILED( rv))
return( rv);
if (found) {
data->SetData(nsDependentString(pData));
*_retval = data;
NS_ADDREF( *_retval);
}
NS_Free( pData);
}
}
return( NS_OK);
return( NS_OK);
}
@ -321,18 +320,18 @@ NS_IMETHODIMP nsImportGenericAddressBooks::SetData( const char *dataId, nsISuppo
if (!dataId)
return NS_ERROR_NULL_POINTER;
if (!nsCRT::strcasecmp( dataId, "addressInterface")) {
if (!PL_strcasecmp( dataId, "addressInterface")) {
NS_IF_RELEASE( m_pInterface);
if (item)
item->QueryInterface( NS_GET_IID(nsIImportAddressBooks), (void **) &m_pInterface);
}
if (!nsCRT::strcasecmp( dataId, "addressBooks")) {
if (!PL_strcasecmp( dataId, "addressBooks")) {
NS_IF_RELEASE( m_pBooks);
if (item)
item->QueryInterface( NS_GET_IID(nsISupportsArray), (void **) &m_pBooks);
}
if (!nsCRT::strcasecmp( dataId, "addressLocation")) {
if (!PL_strcasecmp( dataId, "addressLocation")) {
m_pLocation = nsnull;
if (item) {
@ -345,13 +344,13 @@ NS_IMETHODIMP nsImportGenericAddressBooks::SetData( const char *dataId, nsISuppo
m_pInterface->SetSampleLocation(m_pLocation);
}
if (!nsCRT::strcasecmp( dataId, "addressDestination")) {
if (!PL_strcasecmp( dataId, "addressDestination")) {
if (item) {
nsCOMPtr<nsISupportsCString> abString;
item->QueryInterface( NS_GET_IID(nsISupportsCString), getter_AddRefs( abString));
if (abString) {
if (m_pDestinationUri)
nsCRT::free( m_pDestinationUri);
NS_Free( m_pDestinationUri);
m_pDestinationUri = nsnull;
nsCAutoString tempUri;
abString->GetData(tempUri);
@ -360,7 +359,7 @@ NS_IMETHODIMP nsImportGenericAddressBooks::SetData( const char *dataId, nsISuppo
}
}
if (!nsCRT::strcasecmp( dataId, "fieldMap")) {
if (!PL_strcasecmp( dataId, "fieldMap")) {
NS_IF_RELEASE( m_pFieldMap);
if (item)
item->QueryInterface( NS_GET_IID(nsIImportFieldMap), (void **) &m_pFieldMap);
@ -378,29 +377,29 @@ NS_IMETHODIMP nsImportGenericAddressBooks::GetStatus( const char *statusKind, PR
*_retval = 0;
if (!nsCRT::strcasecmp( statusKind, "isInstalled")) {
if (!PL_strcasecmp( statusKind, "isInstalled")) {
GetDefaultLocation();
*_retval = (PRInt32) m_found;
}
if (!nsCRT::strcasecmp( statusKind, "canUserSetLocation")) {
if (!PL_strcasecmp( statusKind, "canUserSetLocation")) {
GetDefaultLocation();
*_retval = (PRInt32) m_userVerify;
}
if (!nsCRT::strcasecmp( statusKind, "autoFind")) {
if (!PL_strcasecmp( statusKind, "autoFind")) {
GetDefaultLocation();
*_retval = (PRInt32) m_autoFind;
}
if (!nsCRT::strcasecmp( statusKind, "supportsMultiple")) {
if (!PL_strcasecmp( statusKind, "supportsMultiple")) {
PRBool multi = PR_FALSE;
if (m_pInterface)
m_pInterface->GetSupportsMultiple( &multi);
*_retval = (PRInt32) multi;
}
if (!nsCRT::strcasecmp( statusKind, "needsFieldMap")) {
if (!PL_strcasecmp( statusKind, "needsFieldMap")) {
PRBool needs = PR_FALSE;
if (m_pInterface && m_pLocation)
m_pInterface->GetNeedsFieldMap( m_pLocation, &needs);
@ -419,7 +418,7 @@ void nsImportGenericAddressBooks::GetDefaultLocation( void)
return;
if (m_description)
nsCRT::free( m_description);
NS_Free( m_description);
m_description = nsnull;
m_pInterface->GetAutoFind( &m_description, &m_autoFind);
m_gotLocation = PR_TRUE;
@ -595,7 +594,7 @@ NS_IMETHODIMP nsImportGenericAddressBooks::BeginImport(nsISupportsString *succes
m_pThreadData->successLog = m_pSuccessLog;
NS_IF_ADDREF( m_pSuccessLog);
if (m_pDestinationUri)
m_pThreadData->pDestinationUri = nsCRT::strdup( m_pDestinationUri);
m_pThreadData->pDestinationUri = strdup( m_pDestinationUri);
m_pThreadData->bAddrLocInput = isAddrLocHome ;
NS_IF_ADDREF(m_pThreadData->stringBundle = m_stringBundle);
@ -707,7 +706,7 @@ AddressThreadData::AddressThreadData()
AddressThreadData::~AddressThreadData()
{
if (pDestinationUri)
nsCRT::free(pDestinationUri);
NS_Free(pDestinationUri);
NS_IF_RELEASE(books);
NS_IF_RELEASE(addressImport);
@ -870,7 +869,7 @@ void nsImportGenericAddressBooks::ReportError(const PRUnichar *pName,
PRUnichar *pText = nsTextFormatter::smprintf( pFmt, pName);
pStream->Append( pText);
nsTextFormatter::smprintf_free( pText);
nsCRT::free(pFmt);
NS_Free(pFmt);
pStream->AppendLiteral(MSG_LINEBREAK);
}
@ -958,11 +957,11 @@ PR_STATIC_CALLBACK( void) ImportAddressThread( void *stuff)
&fatalError);
if (pSuccess) {
success.Append( pSuccess);
nsCRT::free( pSuccess);
NS_Free( pSuccess);
}
if (pError) {
error.Append( pError);
nsCRT::free( pError);
NS_Free( pError);
}
}
else {

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

@ -36,7 +36,6 @@
* ***** END LICENSE BLOCK ***** */
#include "nscore.h"
#include "nsCRT.h"
#include "nsImportEncodeScan.h"
#include "nsNetUtil.h"

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

@ -43,15 +43,11 @@
#include "nsImportStringBundle.h"
#include "nsReadableUtils.h"
#include "nsISupportsObsolete.h"
#include "nsCRTGlue.h"
#include "ImportDebug.h"
////////////////////////////////////////////////////////////////////////
NS_METHOD nsImportFieldMap::Create(nsIStringBundle *aBundle, nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
if (aOuter)
@ -243,145 +239,145 @@ NS_IMETHODIMP nsImportFieldMap::SetFieldActive(PRInt32 index, PRBool active)
NS_IMETHODIMP nsImportFieldMap::SetFieldValue(nsIAddrDatabase *database, nsIMdbRow *row, PRInt32 fieldNum, const PRUnichar *value)
{
NS_PRECONDITION(database != nsnull, "null ptr");
NS_PRECONDITION(row != nsnull, "null ptr");
NS_PRECONDITION(value != nsnull, "null ptr");
if (!database || !row || !value)
return NS_ERROR_NULL_POINTER;
// Allow the special value for a null field
if (fieldNum == -1)
return( NS_OK);
NS_PRECONDITION(database != nsnull, "null ptr");
NS_PRECONDITION(row != nsnull, "null ptr");
NS_PRECONDITION(value != nsnull, "null ptr");
if (!database || !row || !value)
return NS_ERROR_NULL_POINTER;
if ((fieldNum < 0) || (fieldNum >= m_mozFieldCount))
return( NS_ERROR_FAILURE);
// UGGG!!!!! lot's of typing here!
nsresult rv;
nsString str(value);
char *pVal = ToNewUTF8String(str);
// Allow the special value for a null field
if (fieldNum == -1)
return( NS_OK);
switch( fieldNum) {
case 0:
rv = database->AddFirstName( row, pVal);
break;
case 1:
rv = database->AddLastName( row, pVal);
break;
case 2:
rv = database->AddDisplayName( row, pVal);
break;
case 3:
rv = database->AddNickName( row, pVal);
break;
case 4:
rv = database->AddPrimaryEmail( row, pVal);
break;
case 5:
rv = database->Add2ndEmail( row, pVal);
break;
case 6:
rv = database->AddWorkPhone( row, pVal);
break;
case 7:
rv = database->AddHomePhone( row, pVal);
break;
case 8:
rv = database->AddFaxNumber( row, pVal);
break;
case 9:
rv = database->AddPagerNumber( row, pVal);
break;
case 10:
rv = database->AddCellularNumber( row, pVal);
break;
case 11:
rv = database->AddHomeAddress( row, pVal);
break;
case 12:
rv = database->AddHomeAddress2( row, pVal);
break;
case 13:
rv = database->AddHomeCity( row, pVal);
break;
case 14:
rv = database->AddHomeState( row, pVal);
break;
case 15:
rv = database->AddHomeZipCode( row, pVal);
break;
case 16:
rv = database->AddHomeCountry( row, pVal);
break;
case 17:
rv = database->AddWorkAddress( row, pVal);
break;
case 18:
rv = database->AddWorkAddress2( row, pVal);
break;
case 19:
rv = database->AddWorkCity( row, pVal);
break;
case 20:
rv = database->AddWorkState( row, pVal);
break;
case 21:
rv = database->AddWorkZipCode( row, pVal);
break;
case 22:
rv = database->AddWorkCountry( row, pVal);
break;
case 23:
rv = database->AddJobTitle(row, pVal);
break;
case 24:
rv = database->AddDepartment(row, pVal);
break;
case 25:
rv = database->AddCompany(row, pVal);
break;
case 26:
rv = database->AddWebPage1(row, pVal);
break;
case 27:
rv = database->AddWebPage2(row, pVal);
break;
case 28:
rv = database->AddBirthYear(row, pVal);
break;
case 29:
rv = database->AddBirthMonth(row, pVal);
break;
case 30:
rv = database->AddBirthDay(row, pVal);
break;
case 31:
rv = database->AddCustom1(row, pVal);
break;
case 32:
rv = database->AddCustom2(row, pVal);
break;
case 33:
rv = database->AddCustom3(row, pVal);
break;
case 34:
rv = database->AddCustom4(row, pVal);
break;
case 35:
rv = database->AddNotes(row, pVal);
break;
default:
/* Get the field description, and add it as an anonymous attr? */
/* OR WHAT???? */
{
rv = NS_ERROR_FAILURE;
}
}
nsCRT::free( pVal);
if ((fieldNum < 0) || (fieldNum >= m_mozFieldCount))
return( NS_ERROR_FAILURE);
return( rv);
// UGGG!!!!! lot's of typing here!
nsresult rv;
nsString str(value);
char *pVal = ToNewUTF8String(str);
switch( fieldNum) {
case 0:
rv = database->AddFirstName( row, pVal);
break;
case 1:
rv = database->AddLastName( row, pVal);
break;
case 2:
rv = database->AddDisplayName( row, pVal);
break;
case 3:
rv = database->AddNickName( row, pVal);
break;
case 4:
rv = database->AddPrimaryEmail( row, pVal);
break;
case 5:
rv = database->Add2ndEmail( row, pVal);
break;
case 6:
rv = database->AddWorkPhone( row, pVal);
break;
case 7:
rv = database->AddHomePhone( row, pVal);
break;
case 8:
rv = database->AddFaxNumber( row, pVal);
break;
case 9:
rv = database->AddPagerNumber( row, pVal);
break;
case 10:
rv = database->AddCellularNumber( row, pVal);
break;
case 11:
rv = database->AddHomeAddress( row, pVal);
break;
case 12:
rv = database->AddHomeAddress2( row, pVal);
break;
case 13:
rv = database->AddHomeCity( row, pVal);
break;
case 14:
rv = database->AddHomeState( row, pVal);
break;
case 15:
rv = database->AddHomeZipCode( row, pVal);
break;
case 16:
rv = database->AddHomeCountry( row, pVal);
break;
case 17:
rv = database->AddWorkAddress( row, pVal);
break;
case 18:
rv = database->AddWorkAddress2( row, pVal);
break;
case 19:
rv = database->AddWorkCity( row, pVal);
break;
case 20:
rv = database->AddWorkState( row, pVal);
break;
case 21:
rv = database->AddWorkZipCode( row, pVal);
break;
case 22:
rv = database->AddWorkCountry( row, pVal);
break;
case 23:
rv = database->AddJobTitle(row, pVal);
break;
case 24:
rv = database->AddDepartment(row, pVal);
break;
case 25:
rv = database->AddCompany(row, pVal);
break;
case 26:
rv = database->AddWebPage1(row, pVal);
break;
case 27:
rv = database->AddWebPage2(row, pVal);
break;
case 28:
rv = database->AddBirthYear(row, pVal);
break;
case 29:
rv = database->AddBirthMonth(row, pVal);
break;
case 30:
rv = database->AddBirthDay(row, pVal);
break;
case 31:
rv = database->AddCustom1(row, pVal);
break;
case 32:
rv = database->AddCustom2(row, pVal);
break;
case 33:
rv = database->AddCustom3(row, pVal);
break;
case 34:
rv = database->AddCustom4(row, pVal);
break;
case 35:
rv = database->AddNotes(row, pVal);
break;
default:
/* Get the field description, and add it as an anonymous attr? */
/* OR WHAT???? */
{
rv = NS_ERROR_FAILURE;
}
}
NS_Free( pVal);
return( rv);
}
@ -404,9 +400,9 @@ NS_IMETHODIMP nsImportFieldMap::GetFieldValue(nsIAbCard *card, PRInt32 fieldNum,
if (fieldNum == -1) {
PRUnichar c = 0;
*_retval = nsCRT::strdup(&c);
*_retval = NS_strdup(&c);
return NS_OK;
}
}
if ((fieldNum < 0) || (fieldNum >= m_mozFieldCount))
return( NS_ERROR_FAILURE);

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

@ -55,7 +55,7 @@
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsIImportMailboxDescriptor.h"
#include "nsCRT.h"
#include "nsString.h"
#include "nsUnicharUtils.h"
#include "nsIProxyObjectManager.h"
@ -235,81 +235,79 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsImportGenericMail, nsIImportGeneric)
NS_IMETHODIMP nsImportGenericMail::GetData(const char *dataId, nsISupports **_retval)
{
nsresult rv = NS_OK;
nsresult rv = NS_OK;
NS_PRECONDITION(_retval != nsnull, "null ptr");
if (!_retval)
return NS_ERROR_NULL_POINTER;
*_retval = nsnull;
if (!nsCRT::strcasecmp( dataId, "mailInterface")) {
*_retval = m_pInterface;
NS_IF_ADDREF( m_pInterface);
}
if (!nsCRT::strcasecmp( dataId, "mailBoxes")) {
if (!m_pMailboxes)
GetDefaultMailboxes();
*_retval = m_pMailboxes;
NS_IF_ADDREF( m_pMailboxes);
}
NS_PRECONDITION(_retval != nsnull, "null ptr");
if (!_retval)
return NS_ERROR_NULL_POINTER;
if (!nsCRT::strcasecmp( dataId, "mailLocation")) {
if (!m_pSrcLocation)
GetDefaultLocation();
NS_IF_ADDREF(*_retval = m_pSrcLocation);
}
if (!nsCRT::strcasecmp( dataId, "mailDestination")) {
if (!m_pDestFolder)
GetDefaultDestination();
*_retval = m_pDestFolder;
NS_IF_ADDREF( m_pDestFolder);
}
if (!nsCRT::strcasecmp( dataId, "migration")) {
*_retval = nsnull;
if (!PL_strcasecmp( dataId, "mailInterface")) {
*_retval = m_pInterface;
NS_IF_ADDREF( m_pInterface);
}
if (!PL_strcasecmp( dataId, "mailBoxes")) {
if (!m_pMailboxes)
GetDefaultMailboxes();
*_retval = m_pMailboxes;
NS_IF_ADDREF( m_pMailboxes);
}
if (!PL_strcasecmp( dataId, "mailLocation")) {
if (!m_pSrcLocation)
GetDefaultLocation();
NS_IF_ADDREF(*_retval = m_pSrcLocation);
}
if (!PL_strcasecmp( dataId, "mailDestination")) {
if (!m_pDestFolder)
GetDefaultDestination();
NS_IF_ADDREF(*_retval = m_pDestFolder);
}
if (!PL_strcasecmp( dataId, "migration")) {
nsCOMPtr<nsISupportsPRBool> migrationString = do_CreateInstance(NS_SUPPORTS_PRBOOL_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
migrationString->SetData(m_performingMigration);
NS_IF_ADDREF( *_retval = migrationString);
}
if (!nsCRT::strcasecmp( dataId, "currentMailbox")) {
// create an nsISupportsString, get the current mailbox
// name being imported and put it in the string
nsCOMPtr<nsISupportsString> data = do_CreateInstance( NS_SUPPORTS_STRING_CONTRACTID, &rv);
if (NS_FAILED( rv))
return( rv);
if (m_pThreadData) {
GetMailboxName( m_pThreadData->currentMailbox, data);
}
*_retval = data;
NS_ADDREF( *_retval);
}
}
return( rv);
if (!PL_strcasecmp( dataId, "currentMailbox")) {
// create an nsISupportsString, get the current mailbox
// name being imported and put it in the string
nsCOMPtr<nsISupportsString> data = do_CreateInstance( NS_SUPPORTS_STRING_CONTRACTID, &rv);
if (NS_FAILED( rv))
return( rv);
if (m_pThreadData) {
GetMailboxName( m_pThreadData->currentMailbox, data);
}
NS_ADDREF(*_retval = data);
}
return( rv);
}
NS_IMETHODIMP nsImportGenericMail::SetData( const char *dataId, nsISupports *item)
{
nsresult rv = NS_OK;
NS_PRECONDITION(dataId != nsnull, "null ptr");
if (!dataId)
return NS_ERROR_NULL_POINTER;
nsresult rv = NS_OK;
NS_PRECONDITION(dataId != nsnull, "null ptr");
if (!dataId)
return NS_ERROR_NULL_POINTER;
if (!nsCRT::strcasecmp( dataId, "mailInterface")) {
NS_IF_RELEASE( m_pInterface);
if (item)
item->QueryInterface( NS_GET_IID(nsIImportMail), (void **) &m_pInterface);
}
if (!nsCRT::strcasecmp( dataId, "mailBoxes")) {
NS_IF_RELEASE( m_pMailboxes);
if (item)
item->QueryInterface( NS_GET_IID(nsISupportsArray), (void **) &m_pMailboxes);
}
if (!nsCRT::strcasecmp( dataId, "mailLocation")) {
NS_IF_RELEASE( m_pMailboxes);
if (!PL_strcasecmp( dataId, "mailInterface")) {
NS_IF_RELEASE( m_pInterface);
if (item)
item->QueryInterface( NS_GET_IID(nsIImportMail), (void **) &m_pInterface);
}
if (!PL_strcasecmp( dataId, "mailBoxes")) {
NS_IF_RELEASE( m_pMailboxes);
if (item)
item->QueryInterface( NS_GET_IID(nsISupportsArray), (void **) &m_pMailboxes);
}
if (!PL_strcasecmp( dataId, "mailLocation")) {
NS_IF_RELEASE( m_pMailboxes);
m_pSrcLocation = nsnull;
if (item) {
nsresult rv;
@ -317,54 +315,53 @@ NS_IMETHODIMP nsImportGenericMail::SetData( const char *dataId, nsISupports *ite
NS_ENSURE_SUCCESS(rv,rv);
m_pSrcLocation = location;
}
}
if (!nsCRT::strcasecmp( dataId, "mailDestination")) {
NS_IF_RELEASE( m_pDestFolder);
if (item)
item->QueryInterface( NS_GET_IID(nsIMsgFolder), (void **) &m_pDestFolder);
m_deleteDestFolder = PR_FALSE;
}
if (!nsCRT::strcasecmp( dataId, "name")) {
nsCOMPtr<nsISupportsString> nameString;
if (item) {
item->QueryInterface( NS_GET_IID(nsISupportsString), getter_AddRefs(nameString));
rv = nameString->GetData(m_pName);
}
}
}
if (!nsCRT::strcasecmp( dataId, "migration")) {
nsCOMPtr<nsISupportsPRBool> migrationString;
if (item) {
item->QueryInterface( NS_GET_IID(nsISupportsPRBool), getter_AddRefs(migrationString));
rv = migrationString->GetData(&m_performingMigration);
}
}
if (!PL_strcasecmp( dataId, "mailDestination")) {
NS_IF_RELEASE( m_pDestFolder);
if (item)
item->QueryInterface( NS_GET_IID(nsIMsgFolder), (void **) &m_pDestFolder);
m_deleteDestFolder = PR_FALSE;
}
return rv;
if (!PL_strcasecmp( dataId, "name")) {
nsCOMPtr<nsISupportsString> nameString;
if (item) {
item->QueryInterface( NS_GET_IID(nsISupportsString), getter_AddRefs(nameString));
rv = nameString->GetData(m_pName);
}
}
if (!PL_strcasecmp( dataId, "migration")) {
nsCOMPtr<nsISupportsPRBool> migrationString;
if (item) {
item->QueryInterface( NS_GET_IID(nsISupportsPRBool), getter_AddRefs(migrationString));
rv = migrationString->GetData(&m_performingMigration);
}
}
return rv;
}
NS_IMETHODIMP nsImportGenericMail::GetStatus( const char *statusKind, PRInt32 *_retval)
{
NS_PRECONDITION(statusKind != nsnull, "null ptr");
NS_PRECONDITION(_retval != nsnull, "null ptr");
if (!statusKind || !_retval)
return( NS_ERROR_NULL_POINTER);
*_retval = 0;
NS_PRECONDITION(statusKind != nsnull, "null ptr");
NS_PRECONDITION(_retval != nsnull, "null ptr");
if (!statusKind || !_retval)
return( NS_ERROR_NULL_POINTER);
if (!nsCRT::strcasecmp( statusKind, "isInstalled")) {
GetDefaultLocation();
*_retval = (PRInt32) m_found;
}
*_retval = 0;
if (!nsCRT::strcasecmp( statusKind, "canUserSetLocation")) {
GetDefaultLocation();
*_retval = (PRInt32) m_userVerify;
}
if (!PL_strcasecmp( statusKind, "isInstalled")) {
GetDefaultLocation();
*_retval = (PRInt32) m_found;
}
return( NS_OK);
if (!PL_strcasecmp( statusKind, "canUserSetLocation")) {
GetDefaultLocation();
*_retval = (PRInt32) m_userVerify;
}
return( NS_OK);
}
@ -640,7 +637,7 @@ void nsImportGenericMail::ReportError(PRInt32 id, const PRUnichar *pName, nsStri
PRUnichar *pText = nsTextFormatter::smprintf( pFmt, pName);
pStream->Append( pText);
nsTextFormatter::smprintf_free( pText);
nsCRT::free(pFmt);
NS_Free(pFmt);
pStream->Append(NS_ConvertASCIItoUTF16(MSG_LINEBREAK));
}
@ -865,7 +862,7 @@ ImportMailThread( void *stuff)
box->GetDisplayName( &pName);
if (pName) {
lastName = pName;
nsCRT::free( pName);
NS_Free( pName);
}
else
lastName.AssignLiteral("Unknown!");
@ -914,11 +911,11 @@ ImportMailThread( void *stuff)
rv = pData->mailImport->ImportMailbox( box, outBox, &pError, &pSuccess, &fatalError);
if (pError) {
error.Append( pError);
nsCRT::free( pError);
NS_Free( pError);
}
if (pSuccess) {
success.Append( pSuccess);
nsCRT::free( pSuccess);
NS_Free( pSuccess);
}
pData->currentSize = 0;

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

@ -38,7 +38,6 @@
#include "nscore.h"
#include "nsString.h"
#include "nsCRT.h"
#include "nsImportMimeEncode.h"
#include "ImportCharSet.h"

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

@ -37,7 +37,6 @@
#include "nscore.h"
#include "nsILocalFile.h"
#include "nsCRT.h"
#include "nsImportScanFile.h"
#include "ImportCharSet.h"

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

@ -46,7 +46,6 @@
#include "nsIPlatformCharset.h"
#include "nsICharsetConverterManager.h"
#include "nsCRT.h"
#include "nsString.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
@ -66,6 +65,7 @@
#include "ImportDebug.h"
#include "nsImportService.h"
#include "nsImportStringBundle.h"
#include "nsCRTGlue.h"
PRLogModuleInfo *IMPORTLOGMODULE = nsnull;
@ -234,8 +234,8 @@ NS_IMETHODIMP nsImportService::GetModuleInfo( const char *filter, PRInt32 index,
pDesc = m_pModules->GetModuleDesc( i);
if (pDesc->SupportsThings( filter)) {
if (count == index) {
*name = nsCRT::strdup( pDesc->GetName());
*moduleDescription = nsCRT::strdup( pDesc->GetDescription());
*name = NS_strdup( pDesc->GetName());
*moduleDescription = NS_strdup( pDesc->GetDescription());
return( NS_OK);
}
else
@ -267,7 +267,7 @@ NS_IMETHODIMP nsImportService::GetModuleName(const char *filter, PRInt32 index,
pDesc = m_pModules->GetModuleDesc( i);
if (pDesc->SupportsThings( filter)) {
if (count == index) {
*_retval = nsCRT::strdup( pDesc->GetName());
*_retval = NS_strdup( pDesc->GetName());
return( NS_OK);
}
else
@ -300,7 +300,7 @@ NS_IMETHODIMP nsImportService::GetModuleDescription(const char *filter, PRInt32
pDesc = m_pModules->GetModuleDesc( i);
if (pDesc->SupportsThings( filter)) {
if (count == index) {
*_retval = nsCRT::strdup( pDesc->GetDescription());
*_retval = NS_strdup( pDesc->GetDescription());
return( NS_OK);
}
else

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

@ -41,7 +41,6 @@
#include "nsICharsetConverterManager.h"
#include "nsCRT.h"
#include "nsString.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"

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

@ -37,7 +37,6 @@
#ifndef _nsImportStringBundle_H__
#define _nsImportStringBundle_H__
#include "nsCRT.h"
#include "nsString.h"
class nsIStringBundle;

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

@ -40,7 +40,6 @@
#include "nscore.h"
#include "nsString.h"
#include "nsCRT.h"
class ImportOutFile;

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

@ -50,7 +50,6 @@
#endif
#include "nscore.h"
#include "nsCRT.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsIServiceManager.h"
@ -218,7 +217,7 @@ NS_IMETHODIMP nsTextImport::GetImportInterface( const char *pImportType, nsISupp
*ppInterface = nsnull;
nsresult rv;
if (!nsCRT::strcmp( pImportType, "addressbook")) {
if (!strcmp( pImportType, "addressbook")) {
// create the nsIImportMail interface and return it!
nsIImportAddressBooks * pAddress = nsnull;
nsIImportGeneric * pGeneric = nsnull;
@ -605,7 +604,7 @@ NS_IMETHODIMP ImportAddressImpl::GetSampleData( PRInt32 index, PRBool *pFound, P
if (!fileExists) {
*pFound = PR_FALSE;
*pStr = nsCRT::strdup(&term);
*pStr = NS_strdup(&term);
return NS_OK;
}
@ -635,7 +634,7 @@ NS_IMETHODIMP ImportAddressImpl::GetSampleData( PRInt32 index, PRBool *pFound, P
}
else {
*pFound = PR_FALSE;
*pStr = nsCRT::strdup( &term);
*pStr = NS_strdup( &term);
}
return NS_OK;