Bug 776630 - Switch comm-central from using nsnull to nullptr. rs=Standard8.
authorMike Conley <mconley@mozilla.com>
Thu, 02 Aug 2012 10:26:36 -0400
changeset 13187 0a10c274a1fe037f599647f38fe166060801934b
parent 13186 8ba28b3daf3cbaebd36da7c0fef4faf8e9fa1f77
child 13188 2af3a435cadea74906c3004a78a8bbd8df617311
push idunknown
push userunknown
push dateunknown
reviewersStandard8
bugs776630
Bug 776630 - Switch comm-central from using nsnull to nullptr. rs=Standard8.
calendar/base/src/calDateTime.cpp
calendar/base/src/calICSService.cpp
calendar/base/src/calICSService.h
calendar/base/src/calPeriod.cpp
calendar/base/src/calRecurrenceDate.cpp
calendar/base/src/calRecurrenceDateSet.cpp
calendar/base/src/calRecurrenceRule.cpp
calendar/base/src/calTimezone.cpp
calendar/base/src/calUtils.cpp
db/mork/src/morkEnv.cpp
db/mork/src/morkFactory.cpp
db/mork/src/morkObject.cpp
db/mork/src/morkObject.h
db/mork/src/morkRowCellCursor.cpp
editor/ui/composer/content/ComposerCommands.js
ldap/xpcom/src/nsLDAPConnection.cpp
ldap/xpcom/src/nsLDAPOperation.cpp
ldap/xpcom/src/nsLDAPSecurityGlue.cpp
ldap/xpcom/src/nsLDAPService.cpp
ldap/xpcom/src/nsLDAPSyncQuery.cpp
mail/app/macbuild/Contents/CodeResources
mail/app/nsMailApp.cpp
mail/components/migration/src/nsEudoraProfileMigrator.cpp
mail/components/migration/src/nsMailProfileMigratorUtils.cpp
mail/components/migration/src/nsMailProfileMigratorUtils.h
mail/components/migration/src/nsNetscapeProfileMigratorBase.cpp
mail/components/migration/src/nsOEProfileMigrator.cpp
mail/components/migration/src/nsOutlookProfileMigrator.cpp
mail/components/migration/src/nsProfileMigrator.cpp
mail/components/migration/src/nsProfileMigratorBase.cpp
mail/components/migration/src/nsSeamonkeyProfileMigrator.cpp
mail/components/search/nsMailWinSearchHelper.cpp
mail/components/shell/DirectoryProvider.cpp
mail/components/shell/nsMailGNOMEIntegration.cpp
mail/components/shell/nsMailWinIntegration.cpp
mail/test/resources/mozmill/patches/eventUtils.patch
mailnews/addrbook/src/nsAbAddressCollector.cpp
mailnews/addrbook/src/nsAbBSDirectory.cpp
mailnews/addrbook/src/nsAbCardProperty.cpp
mailnews/addrbook/src/nsAbDirProperty.cpp
mailnews/addrbook/src/nsAbLDAPChangeLogData.cpp
mailnews/addrbook/src/nsAbLDAPChangeLogQuery.cpp
mailnews/addrbook/src/nsAbLDAPDirectory.cpp
mailnews/addrbook/src/nsAbLDAPDirectoryModify.cpp
mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp
mailnews/addrbook/src/nsAbLDAPListenerBase.cpp
mailnews/addrbook/src/nsAbLDAPListenerBase.h
mailnews/addrbook/src/nsAbLDAPReplicationData.cpp
mailnews/addrbook/src/nsAbLDAPReplicationQuery.cpp
mailnews/addrbook/src/nsAbLDAPReplicationService.cpp
mailnews/addrbook/src/nsAbLDIFService.cpp
mailnews/addrbook/src/nsAbMDBDirectory.cpp
mailnews/addrbook/src/nsAbManager.cpp
mailnews/addrbook/src/nsAbOSXDirFactory.cpp
mailnews/addrbook/src/nsAbOSXDirectory.mm
mailnews/addrbook/src/nsAbOutlookDirFactory.cpp
mailnews/addrbook/src/nsAbOutlookDirectory.cpp
mailnews/addrbook/src/nsAbView.cpp
mailnews/addrbook/src/nsAbWinHelper.cpp
mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
mailnews/addrbook/src/nsAddrDatabase.cpp
mailnews/addrbook/src/nsDirPrefs.cpp
mailnews/addrbook/src/nsLDAPAutoCompleteSession.cpp
mailnews/addrbook/src/nsVCard.cpp
mailnews/base/public/nsIMsgMessageService.idl
mailnews/base/search/src/nsMsgBodyHandler.cpp
mailnews/base/search/src/nsMsgFilter.cpp
mailnews/base/search/src/nsMsgFilterList.cpp
mailnews/base/search/src/nsMsgFilterService.cpp
mailnews/base/search/src/nsMsgLocalSearch.cpp
mailnews/base/search/src/nsMsgSearchAdapter.cpp
mailnews/base/search/src/nsMsgSearchNews.cpp
mailnews/base/search/src/nsMsgSearchSession.cpp
mailnews/base/search/src/nsMsgSearchTerm.cpp
mailnews/base/src/nsMailDirProvider.cpp
mailnews/base/src/nsMessenger.cpp
mailnews/base/src/nsMessengerOSXIntegration.mm
mailnews/base/src/nsMessengerUnixIntegration.cpp
mailnews/base/src/nsMessengerWinIntegration.cpp
mailnews/base/src/nsMsgAccount.cpp
mailnews/base/src/nsMsgAccountManager.cpp
mailnews/base/src/nsMsgAccountManagerDS.cpp
mailnews/base/src/nsMsgBiffManager.cpp
mailnews/base/src/nsMsgContentPolicy.cpp
mailnews/base/src/nsMsgCopyService.cpp
mailnews/base/src/nsMsgDBView.cpp
mailnews/base/src/nsMsgDBView.h
mailnews/base/src/nsMsgFolderCache.cpp
mailnews/base/src/nsMsgFolderCacheElement.cpp
mailnews/base/src/nsMsgFolderCompactor.cpp
mailnews/base/src/nsMsgFolderDataSource.cpp
mailnews/base/src/nsMsgFolderDataSource.h
mailnews/base/src/nsMsgGroupThread.cpp
mailnews/base/src/nsMsgGroupView.cpp
mailnews/base/src/nsMsgMailSession.cpp
mailnews/base/src/nsMsgOfflineManager.cpp
mailnews/base/src/nsMsgPrintEngine.cpp
mailnews/base/src/nsMsgProgress.cpp
mailnews/base/src/nsMsgPurgeService.cpp
mailnews/base/src/nsMsgQuickSearchDBView.cpp
mailnews/base/src/nsMsgQuickSearchDBView.h
mailnews/base/src/nsMsgRDFDataSource.cpp
mailnews/base/src/nsMsgRDFDataSource.h
mailnews/base/src/nsMsgRDFUtils.cpp
mailnews/base/src/nsMsgSearchDBView.cpp
mailnews/base/src/nsMsgSearchDBView.h
mailnews/base/src/nsMsgStatusFeedback.cpp
mailnews/base/src/nsMsgTagService.cpp
mailnews/base/src/nsMsgThreadedDBView.cpp
mailnews/base/src/nsMsgWindow.cpp
mailnews/base/src/nsMsgXFViewThread.cpp
mailnews/base/src/nsMsgXFVirtualFolderDBView.cpp
mailnews/base/src/nsSpamSettings.cpp
mailnews/base/src/nsStatusBarBiffManager.cpp
mailnews/base/src/nsSubscribableServer.cpp
mailnews/base/src/nsSubscribeDataSource.cpp
mailnews/base/test/TestMailCookie.cpp
mailnews/base/util/nsImapMoveCoalescer.cpp
mailnews/base/util/nsMsgCompressIStream.cpp
mailnews/base/util/nsMsgCompressOStream.cpp
mailnews/base/util/nsMsgDBFolder.cpp
mailnews/base/util/nsMsgFileStream.cpp
mailnews/base/util/nsMsgI18N.cpp
mailnews/base/util/nsMsgI18N.h
mailnews/base/util/nsMsgIdentity.cpp
mailnews/base/util/nsMsgIncomingServer.cpp
mailnews/base/util/nsMsgKeySet.cpp
mailnews/base/util/nsMsgLineBuffer.cpp
mailnews/base/util/nsMsgLineBuffer.h
mailnews/base/util/nsMsgMailNewsUrl.cpp
mailnews/base/util/nsMsgProtocol.cpp
mailnews/base/util/nsMsgProtocol.h
mailnews/base/util/nsMsgTxn.cpp
mailnews/base/util/nsMsgUtils.cpp
mailnews/base/util/nsMsgUtils.h
mailnews/build/nsMailModule.cpp
mailnews/compose/src/nsMsgAppleDoubleEncode.cpp
mailnews/compose/src/nsMsgAppleEncode.cpp
mailnews/compose/src/nsMsgAttachmentHandler.cpp
mailnews/compose/src/nsMsgCompFields.cpp
mailnews/compose/src/nsMsgCompUtils.cpp
mailnews/compose/src/nsMsgCompose.cpp
mailnews/compose/src/nsMsgComposeContentHandler.cpp
mailnews/compose/src/nsMsgComposeParams.cpp
mailnews/compose/src/nsMsgComposeService.cpp
mailnews/compose/src/nsMsgComposeService.h
mailnews/compose/src/nsMsgCopy.cpp
mailnews/compose/src/nsMsgEncoders.cpp
mailnews/compose/src/nsMsgPrompts.h
mailnews/compose/src/nsMsgQuote.cpp
mailnews/compose/src/nsMsgSend.cpp
mailnews/compose/src/nsMsgSendLater.cpp
mailnews/compose/src/nsMsgSendPart.cpp
mailnews/compose/src/nsMsgSendReport.cpp
mailnews/compose/src/nsSmtpProtocol.cpp
mailnews/compose/src/nsSmtpProtocol.h
mailnews/compose/src/nsSmtpServer.cpp
mailnews/compose/src/nsSmtpService.cpp
mailnews/compose/src/nsSmtpService.h
mailnews/compose/src/nsURLFetcher.cpp
mailnews/db/msgdb/public/nsMsgDatabase.h
mailnews/db/msgdb/src/nsDBFolderInfo.cpp
mailnews/db/msgdb/src/nsImapMailDatabase.cpp
mailnews/db/msgdb/src/nsMailDatabase.cpp
mailnews/db/msgdb/src/nsMsgDatabase.cpp
mailnews/db/msgdb/src/nsMsgHdr.cpp
mailnews/db/msgdb/src/nsMsgOfflineImapOperation.cpp
mailnews/db/msgdb/src/nsMsgThread.cpp
mailnews/db/msgdb/src/nsNewsDatabase.cpp
mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp
mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.h
mailnews/extensions/fts3/src/nsFts3Tokenizer.cpp
mailnews/extensions/mdn/src/nsMsgMdnGenerator.cpp
mailnews/extensions/smime/src/nsMsgComposeSecure.cpp
mailnews/extensions/smime/src/nsSMimeJSHelper.cpp
mailnews/imap/src/nsAutoSyncManager.cpp
mailnews/imap/src/nsAutoSyncManager.h
mailnews/imap/src/nsAutoSyncState.cpp
mailnews/imap/src/nsIMAPBodyShell.cpp
mailnews/imap/src/nsIMAPGenericParser.cpp
mailnews/imap/src/nsIMAPHostSessionList.cpp
mailnews/imap/src/nsIMAPNamespace.cpp
mailnews/imap/src/nsImapFlagAndUidState.cpp
mailnews/imap/src/nsImapIncomingServer.cpp
mailnews/imap/src/nsImapMailFolder.cpp
mailnews/imap/src/nsImapOfflineSync.cpp
mailnews/imap/src/nsImapOfflineSync.h
mailnews/imap/src/nsImapProtocol.cpp
mailnews/imap/src/nsImapProtocol.h
mailnews/imap/src/nsImapServerResponseParser.cpp
mailnews/imap/src/nsImapServerResponseParser.h
mailnews/imap/src/nsImapService.cpp
mailnews/imap/src/nsImapUndoTxn.cpp
mailnews/imap/src/nsImapUrl.cpp
mailnews/imap/src/nsImapUtils.cpp
mailnews/imap/test/TestImapFlagAndUidState.cpp
mailnews/imap/test/TestImapHdrXferInfo.cpp
mailnews/import/applemail/src/nsAppleMailImport.cpp
mailnews/import/eudora/src/nsEudoraAddress.cpp
mailnews/import/eudora/src/nsEudoraCompose.cpp
mailnews/import/eudora/src/nsEudoraCompose.h
mailnews/import/eudora/src/nsEudoraEditor.cpp
mailnews/import/eudora/src/nsEudoraFilters.cpp
mailnews/import/eudora/src/nsEudoraFilters.h
mailnews/import/eudora/src/nsEudoraImport.cpp
mailnews/import/eudora/src/nsEudoraMac.cpp
mailnews/import/eudora/src/nsEudoraMac.h
mailnews/import/eudora/src/nsEudoraSettings.cpp
mailnews/import/eudora/src/nsEudoraStringBundle.cpp
mailnews/import/eudora/src/nsEudoraWin32.cpp
mailnews/import/oexpress/WabObject.cpp
mailnews/import/oexpress/nsOE5File.cpp
mailnews/import/oexpress/nsOEAddressIterator.cpp
mailnews/import/oexpress/nsOEImport.cpp
mailnews/import/oexpress/nsOEMailbox.cpp
mailnews/import/oexpress/nsOEScanBoxes.cpp
mailnews/import/oexpress/nsOESettings.cpp
mailnews/import/oexpress/nsOEStringBundle.cpp
mailnews/import/outlook/src/MapiApi.cpp
mailnews/import/outlook/src/MapiMessage.cpp
mailnews/import/outlook/src/nsOutlookCompose.cpp
mailnews/import/outlook/src/nsOutlookImport.cpp
mailnews/import/outlook/src/nsOutlookMail.cpp
mailnews/import/outlook/src/nsOutlookSettings.cpp
mailnews/import/outlook/src/nsOutlookStringBundle.cpp
mailnews/import/public/nsIImportAddressBooks.idl
mailnews/import/src/ImportOutFile.cpp
mailnews/import/src/ImportTranslate.cpp
mailnews/import/src/nsImportABDescriptor.cpp
mailnews/import/src/nsImportABDescriptor.h
mailnews/import/src/nsImportAddressBooks.cpp
mailnews/import/src/nsImportEncodeScan.cpp
mailnews/import/src/nsImportFieldMap.cpp
mailnews/import/src/nsImportMail.cpp
mailnews/import/src/nsImportMailboxDescriptor.cpp
mailnews/import/src/nsImportMimeEncode.cpp
mailnews/import/src/nsImportScanFile.cpp
mailnews/import/src/nsImportService.cpp
mailnews/import/src/nsImportService.h
mailnews/import/src/nsImportStringBundle.cpp
mailnews/import/src/nsImportStringBundle.h
mailnews/import/src/nsImportTranslator.h
mailnews/import/text/src/nsTextAddress.cpp
mailnews/import/text/src/nsTextImport.cpp
mailnews/import/vcard/src/nsVCardAddress.cpp
mailnews/import/vcard/src/nsVCardImport.cpp
mailnews/import/winlivemail/nsWMImport.cpp
mailnews/import/winlivemail/nsWMSettings.cpp
mailnews/import/winlivemail/nsWMStringBundle.cpp
mailnews/import/winlivemail/nsWMUtils.cpp
mailnews/local/public/nsIMailboxService.idl
mailnews/local/public/nsIPop3Service.idl
mailnews/local/src/nsLocalMailFolder.cpp
mailnews/local/src/nsLocalUndoTxn.cpp
mailnews/local/src/nsMailboxProtocol.cpp
mailnews/local/src/nsMailboxService.cpp
mailnews/local/src/nsMailboxService.h
mailnews/local/src/nsMailboxUrl.cpp
mailnews/local/src/nsMovemailIncomingServer.cpp
mailnews/local/src/nsMovemailService.cpp
mailnews/local/src/nsMsgBrkMBoxStore.cpp
mailnews/local/src/nsMsgMaildirStore.cpp
mailnews/local/src/nsNoIncomingServer.cpp
mailnews/local/src/nsNoneService.cpp
mailnews/local/src/nsParseMailbox.cpp
mailnews/local/src/nsPop3IncomingServer.cpp
mailnews/local/src/nsPop3Protocol.cpp
mailnews/local/src/nsPop3Protocol.h
mailnews/local/src/nsPop3Service.cpp
mailnews/local/src/nsPop3Sink.cpp
mailnews/local/src/nsRssIncomingServer.cpp
mailnews/local/src/nsRssService.cpp
mailnews/mapi/mapihook/src/msgMapiFactory.cpp
mailnews/mapi/mapihook/src/msgMapiHook.cpp
mailnews/mapi/mapihook/src/msgMapiImp.cpp
mailnews/mapi/mapihook/src/msgMapiMain.cpp
mailnews/mapi/mapihook/src/msgMapiSupport.cpp
mailnews/mime/cthandlers/pgpmime/nsPgpMimeProxy.cpp
mailnews/mime/cthandlers/smimestub/nsSMIMEStubFactory.cpp
mailnews/mime/emitters/src/nsMimeBaseEmitter.cpp
mailnews/mime/public/nsIMimeConverter.idl
mailnews/mime/src/comi18n.cpp
mailnews/mime/src/mimecms.cpp
mailnews/mime/src/mimecryp.cpp
mailnews/mime/src/mimedrft.cpp
mailnews/mime/src/mimeenc.cpp
mailnews/mime/src/mimeeobj.cpp
mailnews/mime/src/mimehdrs.cpp
mailnews/mime/src/mimei.cpp
mailnews/mime/src/mimeiimg.cpp
mailnews/mime/src/mimemalt.cpp
mailnews/mime/src/mimemcms.cpp
mailnews/mime/src/mimemoz2.cpp
mailnews/mime/src/mimemrel.cpp
mailnews/mime/src/mimemsg.cpp
mailnews/mime/src/mimemsig.cpp
mailnews/mime/src/mimemult.cpp
mailnews/mime/src/mimeobj.cpp
mailnews/mime/src/mimepbuf.cpp
mailnews/mime/src/mimetext.cpp
mailnews/mime/src/mimethtm.cpp
mailnews/mime/src/mimetpfl.cpp
mailnews/mime/src/mimetpla.cpp
mailnews/mime/src/modmimee.h
mailnews/mime/src/nsMimeHeaders.cpp
mailnews/mime/src/nsMsgHeaderParser.cpp
mailnews/mime/src/nsSimpleMimeConverterStub.cpp
mailnews/mime/src/nsStreamConverter.cpp
mailnews/mime/test/TestMimeCrash.cpp
mailnews/news/src/nsNNTPArticleList.cpp
mailnews/news/src/nsNNTPNewsgroupList.cpp
mailnews/news/src/nsNNTPNewsgroupPost.cpp
mailnews/news/src/nsNNTPProtocol.cpp
mailnews/news/src/nsNewsDownloader.cpp
mailnews/news/src/nsNewsFolder.cpp
mailnews/news/src/nsNntpIncomingServer.cpp
mailnews/news/src/nsNntpMockChannel.cpp
mailnews/news/src/nsNntpService.cpp
mailnews/news/src/nsNntpUrl.cpp
suite/app/nsSuiteApp.cpp
suite/feeds/src/nsFeedSniffer.cpp
suite/profile/migration/src/nsNetscapeProfileMigratorBase.cpp
suite/profile/migration/src/nsProfileMigrator.cpp
suite/profile/migration/src/nsSuiteProfileMigratorUtils.cpp
suite/profile/migration/src/nsSuiteProfileMigratorUtils.h
suite/profile/migration/src/nsThunderbirdProfileMigrator.cpp
suite/profile/nsSuiteDirectoryProvider.cpp
suite/shell/src/nsGNOMEShellService.cpp
suite/shell/src/nsMacShellService.cpp
suite/shell/src/nsWindowsShellService.cpp
--- a/calendar/base/src/calDateTime.cpp
+++ b/calendar/base/src/calDateTime.cpp
@@ -96,17 +96,17 @@ calDateTime::Reset()
     mMonth = 0;
     mDay = 1;
     mHour = 0;
     mMinute = 0;
     mSecond = 0;
     mWeekday = 4;
     mYearday = 1;
     mIsDate = false;
-    mTimezone = nsnull;
+    mTimezone = nullptr;
     mNativeTime = 0;
     mIsValid = true;
     return NS_OK;
 }
 
 CAL_VALUETYPE_ATTR(calDateTime, PRInt16, Year)
 CAL_VALUETYPE_ATTR(calDateTime, PRInt16, Month)
 CAL_VALUETYPE_ATTR(calDateTime, PRInt16, Day)
@@ -391,17 +391,17 @@ NS_IMETHODIMP
 calDateTime::SetIcalString(nsACString const& aIcalString)
 {
     NS_ENSURE_FALSE(mImmutable, NS_ERROR_OBJECT_IS_IMMUTABLE);
     icaltimetype icalt;
     icalt = icaltime_from_string(PromiseFlatCString(aIcalString).get());
     if (icaltime_is_null_time(icalt)) {
         return calIErrors::ICS_ERROR_BASE + icalerrno;
     }
-    FromIcalTime(&icalt, nsnull);
+    FromIcalTime(&icalt, nullptr);
     return NS_OK;
 }
 
 /**
  ** utility/protected methods
  **/
 
 // internal Normalize():
@@ -412,17 +412,17 @@ void calDateTime::Normalize()
     ensureTimezone();
     ToIcalTime(&icalt);
     FromIcalTime(&icalt, mTimezone);
 }
 
 void
 calDateTime::ensureTimezone()
 {
-    if (mTimezone == nsnull) {
+    if (mTimezone == nullptr) {
         mTimezone = cal::UTC();
     }
 }
 
 NS_IMETHODIMP_(void)
 calDateTime::ToIcalTime(struct icaltimetype * icalt)
 {
     ensureTimezone();
@@ -469,17 +469,17 @@ void calDateTime::FromIcalTime(icaltimet
     mDay = static_cast<PRInt16>(t.day);
     mHour = static_cast<PRInt16>(t.hour);
     mMinute = static_cast<PRInt16>(t.minute);
     mSecond = static_cast<PRInt16>(t.second);
 
     if (tz) {
         mTimezone = tz;
     } else {
-        mTimezone = cal::detectTimezone(t, nsnull);
+        mTimezone = cal::detectTimezone(t, nullptr);
     }
 #if defined(DEBUG)
     if (mTimezone) {
         if (t.is_utc) {
             NS_ASSERTION(SameCOMIdentity(mTimezone, cal::UTC()), "UTC mismatch!");
         } else if (!t.zone) {
             nsCAutoString tzid;
             mTimezone->GetTzid(tzid);
--- a/calendar/base/src/calICSService.cpp
+++ b/calendar/base/src/calICSService.cpp
@@ -177,30 +177,30 @@ FindParameter(icalproperty *prop, const 
 {
     for (icalparameter *icalparam =
              icalproperty_get_first_parameter(prop, kind);
          icalparam;
          icalparam = icalproperty_get_next_parameter(prop, kind)) {
         if (param.Equals(icalparameter_get_xname(icalparam)))
             return icalparam;
     }
-    return nsnull;
+    return nullptr;
 }
 
 NS_IMETHODIMP
 calIcalProperty::GetParameter(const nsACString &param, nsACString &value)
 {
     // More ridiculous parameter/X-PARAMETER handling.
     icalparameter_kind paramkind =
         icalparameter_string_to_kind(PromiseFlatCString(param).get());
 
     if (paramkind == ICAL_NO_PARAMETER)
         return NS_ERROR_INVALID_ARG;
 
-    const char *icalstr = nsnull;
+    const char *icalstr = nullptr;
     if (paramkind == ICAL_X_PARAMETER) {
         icalparameter *icalparam = FindParameter(mProperty, param, ICAL_X_PARAMETER);
         if (icalparam)
             icalstr = icalparameter_get_xvalue(icalparam);
     } else if (paramkind == ICAL_IANA_PARAMETER) {
         icalparameter *icalparam = FindParameter(mProperty, param, ICAL_IANA_PARAMETER);
         if (icalparam)
             icalstr = icalparameter_get_iana_value(icalparam);
@@ -273,17 +273,17 @@ calIcalProperty::SetParameter(const nsAC
     icalproperty_add_parameter(mProperty, icalparam);
     // XXX check ical errno
     return NS_OK;
 }
 
 static nsresult
 FillParameterName(icalparameter *icalparam, nsACString &name)
 {
-    const char *propname = nsnull;
+    const char *propname = nullptr;
     if (icalparam) {
         icalparameter_kind paramkind = icalparameter_isa(icalparam);
         if (paramkind == ICAL_X_PARAMETER)
             propname = icalparameter_get_xname(icalparam);
         else if (paramkind == ICAL_IANA_PARAMETER)
             propname = icalparameter_get_iana_name(icalparam);
         else if (paramkind != ICAL_NO_PARAMETER)
             propname = icalparameter_kind_to_string(paramkind);
@@ -357,17 +357,17 @@ nsresult calIcalProperty::getDatetime_(c
 {
     icalvalue * const val = icalproperty_get_value(prop);
     icalvalue_kind const valkind = icalvalue_isa(val);
     if (valkind != ICAL_DATETIME_VALUE && valkind != ICAL_DATE_VALUE) {
         return NS_ERROR_UNEXPECTED;
     }
     icaltimetype itt = icalvalue_get_datetime(val);
 
-    char const* tzid_ = nsnull;
+    char const* tzid_ = nullptr;
     if (!itt.is_utc) {
         if (itt.zone) {
             tzid_ = icaltimezone_get_tzid(const_cast<icaltimezone *>(itt.zone));
         } else {
             // Need to get the tzid param. Unfortunatly, libical tends to return raw
             // ics strings, with quotes and everything. That's not what we want. Need
             // to work around.
             icalparameter * const tzparam = icalproperty_get_first_parameter(prop, ICAL_TZID_PARAMETER);
@@ -375,17 +375,17 @@ nsresult calIcalProperty::getDatetime_(c
                 tzid_ = icalparameter_get_xvalue(tzparam);
             }
         }
     }
 
     nsCOMPtr<calITimezone> tz;
     if (tzid_) {
         nsDependentCString const tzid(tzid_);
-        calIcalComponent * comp = nsnull;
+        calIcalComponent * comp = nullptr;
         if (parent) {
             comp = parent->getParentVCalendarOrThis();
         }
         // look up parent if timezone is already referenced:
         if (comp) {
             comp->mReferencedTimezones.Get(tzid, getter_AddRefs(tz));
         }
         if (!tz) {
@@ -426,17 +426,17 @@ nsresult calIcalProperty::getDatetime_(c
                             icaltimezone_free(clonedZone, 1 /* free struct */);
                             return NS_ERROR_INVALID_ARG;
                         }
                         nsCOMPtr<calIIcalComponent> const tzComp(new calIcalComponent(clonedZone, clonedZoneComp));
                         CAL_ENSURE_MEMORY(tzComp);
                         tz = new calTimezone(tzid, tzComp);
                         CAL_ENSURE_MEMORY(tz);
                     } else { // install phantom timezone, so the data could be repaired:
-                        tz = new calTimezone(tzid, nsnull);
+                        tz = new calTimezone(tzid, nullptr);
                         CAL_ENSURE_MEMORY(tz);
                     }
                 }
             }
             if (comp && tz) {
                 // assure timezone is known:
                 comp->AddTimezoneReference(tz);
             }
@@ -494,17 +494,17 @@ NS_IMETHODIMP
 calIcalComponent::GetReferencedTimezones(PRUint32 * aCount, calITimezone *** aTimezones)
 {
     NS_ENSURE_ARG_POINTER(aCount);
     NS_ENSURE_ARG_POINTER(aTimezones);
 
     PRUint32 const count = mReferencedTimezones.Count();
     if (count == 0) {
         *aCount = 0;
-        *aTimezones = nsnull;
+        *aTimezones = nullptr;
         return NS_OK;
     }
 
     calITimezone ** const timezones = static_cast<calITimezone **>(
         nsMemory::Alloc(sizeof(calITimezone *) * count));
     CAL_ENSURE_MEMORY(timezones);
     // tzptr will get used as an iterator by the enumerator function
     calITimezone ** tzptr = timezones;
@@ -558,17 +558,17 @@ calIcalComponent::Get##Attrname(nsACStri
         str.Assign(icalproperty_##lcname##_to_string((icalproperty_##lcname)val)); \
     }                                                                   \
     return NS_OK;                                                       \
 }                                                                       \
                                                                         \
 NS_IMETHODIMP                                                           \
 calIcalComponent::Set##Attrname(const nsACString &str)                  \
 {                                                                       \
-    icalproperty *prop = nsnull;                                        \
+    icalproperty *prop = nullptr;                                        \
     if (!str.IsVoid()) {                                                \
         icalproperty_##lcname val =                                     \
             icalproperty_string_to_##lcname(PromiseFlatCString(str).get()); \
         prop = icalproperty_new_##lcname(val);                          \
         if (!prop)                                                      \
             return NS_ERROR_OUT_OF_MEMORY; /* XXX map errno */          \
     }                                                                   \
     return SetProperty(ICAL_##ICALNAME##_PROPERTY, prop);               \
@@ -654,17 +654,17 @@ nsresult calIcalComponent::GetStringProp
         str.Assign(icalvalue_get_string(icalproperty_get_value(prop)));
     }
     return NS_OK;
 }
 
 nsresult calIcalComponent::SetStringProperty(icalproperty_kind kind,
                                              const nsACString &str)
 {
-    icalvalue *val = nsnull;
+    icalvalue *val = nullptr;
     if (!str.IsVoid()) {
         val = icalvalue_new_string(PromiseFlatCString(str).get());
         if (!val)
             return NS_ERROR_OUT_OF_MEMORY;
     }
     return SetPropertyValue(kind, val);
 }
 
@@ -687,17 +687,17 @@ nsresult calIcalComponent::SetIntPropert
 }
 
 nsresult calIcalComponent::GetDateTimeAttribute(icalproperty_kind kind,
                                                 calIDateTime ** dtp)
 {
     NS_ENSURE_ARG_POINTER(dtp);
     icalproperty *prop = icalcomponent_get_first_property(mComponent, kind);
     if (!prop) {
-        *dtp = nsnull;  /* invalid date */
+        *dtp = nullptr;  /* invalid date */
         return NS_OK;
     }
     return calIcalProperty::getDatetime_(this, prop, dtp);
 }
 
 nsresult calIcalComponent::SetDateTimeAttribute(icalproperty_kind kind,
                                                 calIDateTime * dt)
 {
@@ -791,17 +791,17 @@ calIcalComponent::Set##Attrname(calIDate
 #define RO_COMP_DURATION_ATTRIBUTE(Attrname, ICALNAME)                  \
 NS_IMETHODIMP                                                           \
 calIcalComponent::Get##Attrname(calIDuration **dtp)                     \
 {                                                                       \
     icalproperty *prop =                                                \
         icalcomponent_get_first_property(mComponent,                    \
                                          ICAL_##ICALNAME##_PROPERTY);   \
     if (!prop) {                                                        \
-        *dtp = nsnull;  /* invalid duration */                          \
+        *dtp = nullptr;  /* invalid duration */                          \
         return NS_OK;                                                   \
     }                                                                   \
     struct icaldurationtype idt =                                       \
         icalvalue_get_duration(icalproperty_get_value(prop));           \
     *dtp = new calDuration(&idt);                                       \
     CAL_ENSURE_MEMORY(*dtp);                                            \
     NS_ADDREF(*dtp);                                                    \
     return NS_OK;                                                       \
@@ -849,17 +849,17 @@ calIcalComponent::GetFirstSubcomponent(c
 
     // Maybe someday I'll support X-COMPONENTs
     if (compkind == ICAL_NO_COMPONENT || compkind == ICAL_X_COMPONENT)
         return NS_ERROR_INVALID_ARG;
 
     icalcomponent *ical =
         icalcomponent_get_first_component(mComponent, compkind);
     if (!ical) {
-        *subcomp = nsnull;
+        *subcomp = nullptr;
         return NS_OK;
     }
 
     *subcomp = new calIcalComponent(ical, this);
     CAL_ENSURE_MEMORY(*subcomp);
     NS_ADDREF(*subcomp);
     return NS_OK;
 }
@@ -875,17 +875,17 @@ calIcalComponent::GetNextSubcomponent(co
 
     // Maybe someday I'll support X-COMPONENTs
     if (compkind == ICAL_NO_COMPONENT || compkind == ICAL_X_COMPONENT)
         return NS_ERROR_INVALID_ARG;
 
     icalcomponent *ical =
         icalcomponent_get_next_component(mComponent, compkind);
     if (!ical) {
-        *subcomp = nsnull;
+        *subcomp = nullptr;
         return NS_OK;
     }
 
     *subcomp = new calIcalComponent(ical, this);
     CAL_ENSURE_MEMORY(*subcomp);
     NS_ADDREF(*subcomp);
     return NS_OK;
 }
@@ -1008,20 +1008,20 @@ calIcalComponent::Serialize(char **icals
     return NS_OK;
 }
 
 NS_IMETHODIMP
 calIcalComponent::Clone(calIIcalComponent **_retval)
 {
     NS_ENSURE_ARG_POINTER(_retval);
     icalcomponent * cloned = icalcomponent_new_clone(mComponent);
-    if (cloned == nsnull)
+    if (cloned == nullptr)
         return NS_ERROR_OUT_OF_MEMORY;
-    calIcalComponent * const comp = new calIcalComponent(cloned, nsnull, getTzProvider());
-    if (comp == nsnull) {
+    calIcalComponent * const comp = new calIcalComponent(cloned, nullptr, getTzProvider());
+    if (comp == nullptr) {
         icalcomponent_free(cloned);
         return NS_ERROR_OUT_OF_MEMORY;
     }
     NS_ADDREF(*_retval = comp);
     return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -1036,17 +1036,17 @@ calIcalComponent::AddSubcomponent(calIIc
      * - use comp->serializeToICS and reparse to create a copy.
      *
      * I should probably also return the new/reused component so that the
      * caller has something it can poke at all live-like.
      */
     calIcalComponent * const ical = toIcalComponent(comp);
 
     PRUint32 tzCount = 0;
-    calITimezone ** timezones = nsnull;
+    calITimezone ** timezones = nullptr;
     nsresult rv = ical->GetReferencedTimezones(&tzCount, &timezones);
     NS_ENSURE_SUCCESS(rv, rv);
 
     calIcalComponent * const vcal = getParentVCalendarOrThis();
     bool failed = false;
     for (PRUint32 i = 0; i < tzCount; i++) {
         if (!failed) {
             rv = vcal->AddTimezoneReference(timezones[i]);
@@ -1071,49 +1071,49 @@ calIcalComponent::AddSubcomponent(calIIc
 }
 
 // NS_IMETHODIMP
 // IcalComponent::RemoveSubcomponent(calIIcalComponent *comp)
 // {
 //     NS_ENSURE_ARG_POINTER(comp);
 //     calIcalComponent *ical = static_cast<calIcalComponent *>(comp);
 //     icalcomponent_remove_component(mComponent, ical->mComponent);
-//     ical->mParent = nsnull;
+//     ical->mParent = nullptr;
 //     return NS_OK;
 // }
 
 NS_IMETHODIMP
 calIcalComponent::GetFirstProperty(const nsACString &kind,
                                    calIIcalProperty **prop)
 {
     NS_ENSURE_ARG_POINTER(prop);
 
     icalproperty_kind propkind =
         icalproperty_string_to_kind(PromiseFlatCString(kind).get());
 
     if (propkind == ICAL_NO_PROPERTY)
         return NS_ERROR_INVALID_ARG;
 
-    icalproperty *icalprop = nsnull;
+    icalproperty *icalprop = nullptr;
     if (propkind == ICAL_X_PROPERTY) {
         for (icalprop =
                  icalcomponent_get_first_property(mComponent, ICAL_X_PROPERTY);
              icalprop;
              icalprop = icalcomponent_get_next_property(mComponent,
                                                         ICAL_X_PROPERTY)) {
 
             if (kind.Equals(icalproperty_get_x_name(icalprop)))
                 break;
         }
     } else {
         icalprop = icalcomponent_get_first_property(mComponent, propkind);
     }
 
     if (!icalprop) {
-        *prop = nsnull;
+        *prop = nullptr;
         return NS_OK;
     }
 
     *prop = new calIcalProperty(icalprop, this);
     CAL_ENSURE_MEMORY(*prop);
     NS_ADDREF(*prop);
     return NS_OK;
 }
@@ -1123,33 +1123,33 @@ calIcalComponent::GetNextProperty(const 
 {
     NS_ENSURE_ARG_POINTER(prop);
 
     icalproperty_kind propkind =
         icalproperty_string_to_kind(PromiseFlatCString(kind).get());
 
     if (propkind == ICAL_NO_PROPERTY)
         return NS_ERROR_INVALID_ARG;
-    icalproperty *icalprop = nsnull;
+    icalproperty *icalprop = nullptr;
     if (propkind == ICAL_X_PROPERTY) {
         for (icalprop =
                  icalcomponent_get_next_property(mComponent, ICAL_X_PROPERTY);
              icalprop;
              icalprop = icalcomponent_get_next_property(mComponent,
                                                         ICAL_X_PROPERTY)) {
 
             if (kind.Equals(icalproperty_get_x_name(icalprop)))
                 break;
         }
     } else {
         icalprop = icalcomponent_get_next_property(mComponent, propkind);
     }
 
     if (!icalprop) {
-        *prop = nsnull;
+        *prop = nullptr;
         return NS_OK;
     }
 
     *prop = new calIcalProperty(icalprop, this);
     CAL_ENSURE_MEMORY(*prop);
     NS_ADDREF(*prop);
     return NS_OK;
 }
@@ -1184,17 +1184,17 @@ calIcalComponent::AddProperty(calIIcalPr
 
 // NS_IMETHODIMP
 // calIcalComponent::RemoveProperty(calIIcalProperty *prop)
 // {
 //     NS_ENSURE_ARG_POINTER(prop);
 //     // XXX like AddSubcomponent, this is questionable
 //     calIcalProperty *ical = static_cast<calIcalProperty *>(prop);
 //     icalcomponent_remove_property(mComponent, ical->mProperty);
-//     ical->mParent = nsnull;
+//     ical->mParent = nullptr;
 //     return NS_OK;
 // }
 
 NS_IMPL_CLASSINFO(calICSService, NULL, nsIClassInfo::THREADSAFE, CAL_ICSSERVICE_CID)
 NS_IMPL_THREADSAFE_ISUPPORTS2(calICSService, calIICSService, nsIClassInfo)
 NS_IMPL_CI_INTERFACE_GETTER1(calICSService, calIICSService)
 NS_IMPL_THREADSAFE_CI(calICSService)
 
@@ -1215,35 +1215,35 @@ calICSService::ParseICS(const nsACString
         fprintf(stderr, "Error parsing: '%20s': %d (%s)\n",
                 PromiseFlatCString(serialized).get(), icalerrno,
                 icalerror_strerror(icalerrno));
 #endif
         // The return values is calIError match with ical errors,
         // so no need for a conversion table or anything.
         return calIErrors::ICS_ERROR_BASE + icalerrno;
     }
-    calIcalComponent *comp = new calIcalComponent(ical, nsnull, tzProvider);
+    calIcalComponent *comp = new calIcalComponent(ical, nullptr, tzProvider);
     if (!comp) {
         icalcomponent_free(ical);
         return NS_ERROR_OUT_OF_MEMORY;
     }
     NS_ADDREF(*component = comp);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 calICSService::ParserWorker::Run()
 {
     icalcomponent *ical =
         icalparser_parse_string(PromiseFlatCString(mString).get());
     nsresult status = NS_OK;
-    calIIcalComponent *comp = nsnull;
+    calIIcalComponent *comp = nullptr;
 
     if (ical) {
-        comp = new calIcalComponent(ical, nsnull, mProvider);
+        comp = new calIcalComponent(ical, nullptr, mProvider);
         if (!comp) {
             icalcomponent_free(ical);
             status = NS_ERROR_OUT_OF_MEMORY;
         }
     } else {
         status = calIErrors::ICS_ERROR_BASE + icalerrno;
     }
 
@@ -1290,17 +1290,17 @@ calICSService::CreateIcalComponent(const
     // Maybe someday I'll support X-COMPONENTs
     if (compkind == ICAL_NO_COMPONENT || compkind == ICAL_X_COMPONENT)
         return NS_ERROR_INVALID_ARG;
 
     icalcomponent *ical = icalcomponent_new(compkind);
     if (!ical)
         return NS_ERROR_OUT_OF_MEMORY; // XXX translate
 
-    *comp = new calIcalComponent(ical, nsnull);
+    *comp = new calIcalComponent(ical, nullptr);
     if (!*comp) {
         icalcomponent_free(ical);
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
     NS_ADDREF(*comp);
     return NS_OK;
 }
@@ -1317,13 +1317,13 @@ calICSService::CreateIcalProperty(const 
 
     icalproperty *icalprop = icalproperty_new(propkind);
     if (!icalprop)
         return NS_ERROR_OUT_OF_MEMORY; // XXX translate
 
     if (propkind == ICAL_X_PROPERTY)
         icalproperty_set_x_name(icalprop, PromiseFlatCString(kind).get());
 
-    *prop = new calIcalProperty(icalprop, nsnull);
+    *prop = new calIcalProperty(icalprop, nullptr);
     CAL_ENSURE_MEMORY(*prop);
     NS_ADDREF(*prop);
     return NS_OK;
 }
--- a/calendar/base/src/calICSService.h
+++ b/calendar/base/src/calICSService.h
@@ -92,18 +92,18 @@ protected:
 
 class calIcalComponent : public calIIcalComponent,
                          public nsIClassInfo,
                          public cal::XpcomBase
 {
     friend class calIcalProperty;
 public:
     calIcalComponent(icalcomponent *ical, calIIcalComponent *parent,
-                     calITimezoneProvider *tzProvider = nsnull)
-        : mComponent(ical), mTimezone(nsnull), mTzProvider(tzProvider), mParent(parent)
+                     calITimezoneProvider *tzProvider = nullptr)
+        : mComponent(ical), mTimezone(nullptr), mTzProvider(tzProvider), mParent(parent)
     {
         mReferencedTimezones.Init();
     }
 
     // VTIMEZONE ctor
     calIcalComponent(icaltimezone * icaltz, icalcomponent * ical) : mComponent(ical), mTimezone(icaltz) {
         mReferencedTimezones.Init();
     }
@@ -121,17 +121,17 @@ protected:
         while (that) {
             calITimezoneProvider * const ret = that->mTzProvider;
             if (ret) {
                 return ret;
             }
             calIIcalComponent * const p = that->mParent;
             that = static_cast<calIcalComponent const *>(p);
         }
-        return nsnull;
+        return nullptr;
     }
 
     calIcalComponent * getParentVCalendarOrThis() {
         // walk up the parents to find a VCALENDAR:
         calIcalComponent * that = this;
         while (that && icalcomponent_isa(that->mComponent) != ICAL_VCALENDAR_COMPONENT) {
             calIIcalComponent * const p = that->mParent;
             that = static_cast<calIcalComponent *>(p);
--- a/calendar/base/src/calPeriod.cpp
+++ b/calendar/base/src/calPeriod.cpp
@@ -123,19 +123,19 @@ calPeriod::ToIcalPeriod(struct icalperio
     
     mStart->ToIcalTime(&icalp->start);
     mEnd->ToIcalTime(&icalp->end);
 }
 
 void
 calPeriod::FromIcalPeriod(struct icalperiodtype const* icalp)
 {
-    mStart = new calDateTime(&(icalp->start), nsnull);
+    mStart = new calDateTime(&(icalp->start), nullptr);
     mStart->MakeImmutable();
-    mEnd = new calDateTime(&(icalp->end), nsnull);
+    mEnd = new calDateTime(&(icalp->end), nullptr);
     mEnd->MakeImmutable();
     return;
 }
 
 NS_IMETHODIMP
 calPeriod::GetIcalString(nsACString& aResult)
 {
     struct icalperiodtype ip;
@@ -155,12 +155,12 @@ calPeriod::GetIcalString(nsACString& aRe
 NS_IMETHODIMP
 calPeriod::SetIcalString(const nsACString& aIcalString)
 {
     if (mImmutable)
         return NS_ERROR_OBJECT_IS_IMMUTABLE;
     struct icalperiodtype ip;
     ip = icalperiodtype_from_string(PromiseFlatCString(aIcalString).get());
     //XXX Shortcut. Assumes nobody tried to overrule our impl. of calIDateTime
-    mStart = new calDateTime(&ip.start, nsnull);
-    mEnd = new calDateTime(&ip.end, nsnull);
+    mStart = new calDateTime(&ip.start, nullptr);
+    mEnd = new calDateTime(&ip.end, nullptr);
     return NS_OK;
 }
--- a/calendar/base/src/calRecurrenceDate.cpp
+++ b/calendar/base/src/calRecurrenceDate.cpp
@@ -55,17 +55,17 @@ calRecurrenceDate::Clone(calIRecurrenceI
     calRecurrenceDate *crd = new calRecurrenceDate;
     if (!crd)
         return NS_ERROR_OUT_OF_MEMORY;
 
     crd->mIsNegative = mIsNegative;
     if (mDate)
         mDate->Clone(getter_AddRefs(crd->mDate));
     else
-        crd->mDate = nsnull;
+        crd->mDate = nullptr;
 
     NS_ADDREF(*_retval = crd);
     return NS_OK;
 }
 
 /* attribute boolean isNegative; */
 NS_IMETHODIMP
 calRecurrenceDate::GetIsNegative(bool *_retval)
@@ -125,17 +125,17 @@ calRecurrenceDate::GetNextOccurrence(cal
     if (mDate) {
         PRInt32 result;
         if (NS_SUCCEEDED(mDate->Compare(aStartTime, &result)) && result > 0) {
             NS_ADDREF (*_retval = mDate);
             return NS_OK;
         }
     }
 
-    *_retval = nsnull;
+    *_retval = nullptr;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 calRecurrenceDate::GetOccurrences(calIDateTime *aStartTime,
                                   calIDateTime *aRangeStart,
                                   calIDateTime *aRangeEnd,
                                   PRUint32 aMaxCount,
@@ -153,17 +153,17 @@ calRecurrenceDate::GetOccurrences(calIDa
             calIDateTime **dates = (calIDateTime **) nsMemory::Alloc(sizeof(calIDateTime*));
             NS_ADDREF (dates[0] = mDate);
             *aDates = dates;
             *aCount = 1;
             return NS_OK;
         }
     }
 
-    *aDates = nsnull;
+    *aDates = nullptr;
     *aCount = 0;
     return NS_OK;
 }
 
 /**
  ** ical property getting/setting
  **/
 NS_IMETHODIMP
@@ -192,17 +192,17 @@ calRecurrenceDate::SetIcalProperty(calII
         return rc;
     if (name.EqualsLiteral("RDATE")) {
         mIsNegative = false;
         icalvalue * const value = icalproperty_get_value(aProp->GetIcalProperty());
         if (icalvalue_isa(value) == ICAL_PERIOD_VALUE) {
             icalperiodtype const period = icalvalue_get_period(value);
             // take only period's start date and skip end date, but continue parsing;
             // open bug 489747:
-            mDate = new calDateTime(&period.start, nsnull /* detect timezone */);
+            mDate = new calDateTime(&period.start, nullptr /* detect timezone */);
             return NS_OK;
         }
     } else if (name.EqualsLiteral("EXDATE"))
         mIsNegative = true;
     else
         return NS_ERROR_INVALID_ARG;
 
     return aProp->GetValueAsDatetime(getter_AddRefs(mDate));
--- a/calendar/base/src/calRecurrenceDateSet.cpp
+++ b/calendar/base/src/calRecurrenceDateSet.cpp
@@ -99,17 +99,17 @@ calRecurrenceDateSet::GetIsFinite(bool *
     *_retval = true;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 calRecurrenceDateSet::GetDates(PRUint32 *aCount, calIDateTime ***aDates)
 {
     if (mDates.Count() == 0) {
-        *aDates = nsnull;
+        *aDates = nullptr;
         *aCount = 0;
         return NS_OK;
     }
 
     EnsureSorted();
         
     calIDateTime **dates = (calIDateTime **) nsMemory::Alloc(sizeof(calIDateTime*) * mDates.Count());
     if (!dates)
@@ -161,17 +161,17 @@ calDateTimeComparator (calIDateTime *aEl
     aElement1->Compare(aElement2, &result);
     return result;
 }
 
 void
 calRecurrenceDateSet::EnsureSorted()
 {
     if (!mSorted) {
-        mDates.Sort(calDateTimeComparator, nsnull);
+        mDates.Sort(calDateTimeComparator, nullptr);
         mSorted = true;
     }
 }
 
 NS_IMETHODIMP
 calRecurrenceDateSet::GetNextOccurrence(calIDateTime *aStartTime,
                                         calIDateTime *aOccurrenceTime,
                                         calIDateTime **_retval)
@@ -188,17 +188,17 @@ calRecurrenceDateSet::GetNextOccurrence(
     // we ignore aStartTime
     for (i = 0; i < mDates.Count(); i++) {
         if (NS_SUCCEEDED(mDates[i]->Compare(aOccurrenceTime, &result)) && result > 0) {
             NS_ADDREF (*_retval = mDates[i]);
             return NS_OK;
         }
     }
 
-    *_retval = nsnull;
+    *_retval = nullptr;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 calRecurrenceDateSet::GetOccurrences(calIDateTime *aStartTime,
                                      calIDateTime *aRangeStart,
                                      calIDateTime *aRangeEnd,
                                      PRUint32 aMaxCount,
@@ -240,30 +240,30 @@ calRecurrenceDateSet::GetOccurrences(cal
     PRInt32 count = dates.Count();
     if (count) {
         calIDateTime **dateArray = (calIDateTime **) nsMemory::Alloc(sizeof(calIDateTime*) * count);
         for (int i = 0; i < count; i++) {
             NS_ADDREF(dateArray[i] = dates[i]);
         }
         *aDates = dateArray;
     } else {
-        *aDates = nsnull;
+        *aDates = nullptr;
     }
     *aCount = count;
 
     return NS_OK;
 }
 
 /**
  ** ical property getting/setting
  **/
 NS_IMETHODIMP
 calRecurrenceDateSet::GetIcalProperty(calIIcalProperty **aProp)
 {
-    icalproperty *dateset = nsnull;
+    icalproperty *dateset = nullptr;
 
     for (int i = 0; i < mDates.Count(); i++) {
         if (mIsNegative)
             dateset = icalproperty_new(ICAL_EXDATE_PROPERTY);
         else
             dateset = icalproperty_new(ICAL_RDATE_PROPERTY);
 
         struct icaltimetype icalt;
--- a/calendar/base/src/calRecurrenceRule.cpp
+++ b/calendar/base/src/calRecurrenceRule.cpp
@@ -177,22 +177,22 @@ NS_IMETHODIMP
 calRecurrenceRule::GetUntilDate(calIDateTime * *aRecurEnd)
 {
     NS_ENSURE_ARG_POINTER(aRecurEnd);
 
     if (mIsByCount)
         return NS_ERROR_FAILURE;
 
     if (!icaltime_is_null_time(mIcalRecur.until)) {
-        *aRecurEnd = new calDateTime(&mIcalRecur.until, nsnull);
+        *aRecurEnd = new calDateTime(&mIcalRecur.until, nullptr);
         CAL_ENSURE_MEMORY(*aRecurEnd);
         NS_ADDREF(*aRecurEnd);
     } else {
         // infinite recurrence
-        *aRecurEnd = nsnull; 
+        *aRecurEnd = nullptr; 
     }
     return NS_OK;
 }
 
 NS_IMETHODIMP
 calRecurrenceRule::SetUntilDate(calIDateTime * aRecurEnd)
 {
     if (aRecurEnd) {
@@ -262,17 +262,17 @@ calRecurrenceRule::GetComponent(const ns
             if (mIcalRecur._icalvar[count] == ICAL_RECURRENCE_ARRAY_MAX) \
                 break;                                                  \
         }                                                               \
         if (count) {                                                    \
             *aValues = (PRInt16*) nsMemory::Clone(mIcalRecur._icalvar,  \
                                                   count * sizeof(PRInt16)); \
             if (!*aValues) return NS_ERROR_OUT_OF_MEMORY;               \
         } else {                                                        \
-            *aValues = nsnull;                                          \
+            *aValues = nullptr;                                          \
         }                                                               \
         *aCount = count;                                                \
     }
 
     HANDLE_COMPONENT(BYSECOND, by_second, ICAL_BY_SECOND_SIZE)
     else HANDLE_COMPONENT(BYMINUTE, by_minute, ICAL_BY_MINUTE_SIZE)
     else HANDLE_COMPONENT(BYHOUR, by_hour, ICAL_BY_HOUR_SIZE)
     else HANDLE_COMPONENT(BYDAY, by_day, ICAL_BY_DAY_SIZE) // special
@@ -351,17 +351,17 @@ calRecurrenceRule::GetNextOccurrence(cal
             break;
 
         next = icalrecur_iterator_next(recur_iter);
     }
 
     icalrecur_iterator_free(recur_iter);
 
     if (icaltime_is_null_time(next)) {
-        *_retval = nsnull;
+        *_retval = nullptr;
         return NS_OK;
     }
 
     nsCOMPtr<calITimezone> tz;
     aStartTime->GetTimezone(getter_AddRefs(tz));
     *_retval = new calDateTime(&next, tz);
     CAL_ENSURE_MEMORY(*_retval);
     NS_ADDREF(*_retval);
@@ -419,17 +419,17 @@ calRecurrenceRule::GetOccurrences(calIDa
 
     if (aRangeEnd) {
         aRangeEnd->ToIcalTime(&dtend);
         dtend = ensureDateTime(dtend);
 
         // if the start of the recurrence is past the end,
         // we have no dates
         if (icaltime_compare (dtstart, dtend) >= 0) {
-            *aDates = nsnull;
+            *aDates = nullptr;
             *aCount = 0;
             return NS_OK;
         }
     }
 
     icalrecur_iterator* recur_iter;
     recur_iter = icalrecur_iterator_new(mIcalRecur, dtstart);
     if (!recur_iter)
@@ -476,33 +476,33 @@ calRecurrenceRule::GetOccurrences(calIDa
         calIDateTime ** const dateArray =
             static_cast<calIDateTime **>(nsMemory::Alloc(sizeof(calIDateTime*) * count));
         CAL_ENSURE_MEMORY(dateArray);
         for (PRUint32 i = 0; i < count; ++i) {
             NS_ADDREF(dateArray[i] = dates[i]);
         }
         *aDates = dateArray;
     } else {
-        *aDates = nsnull;
+        *aDates = nullptr;
     }
 
     *aCount = count;
 
     return NS_OK;
 }
 
 /**
  ** ical property getting/setting
  **/
 NS_IMETHODIMP
 calRecurrenceRule::GetIcalProperty(calIIcalProperty **prop)
 {
     icalproperty * const rrule = icalproperty_new_rrule(mIcalRecur);
     CAL_ENSURE_MEMORY(rrule);
-    *prop = new calIcalProperty(rrule, nsnull);
+    *prop = new calIcalProperty(rrule, nullptr);
     if (!*prop) {
         icalproperty_free(rrule);
         return NS_ERROR_FAILURE;
     }
 
     NS_ADDREF(*prop);
     return NS_OK;
 }
--- a/calendar/base/src/calTimezone.cpp
+++ b/calendar/base/src/calTimezone.cpp
@@ -40,17 +40,17 @@ NS_IMETHODIMP
 calTimezone::GetLongitude(nsACString & _retval) {
     _retval.SetIsVoid(true);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 calTimezone::GetProvider(calITimezoneProvider ** _retval) {
     NS_ENSURE_ARG_POINTER(_retval);
-    *_retval = nsnull;
+    *_retval = nullptr;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 calTimezone::ToString(nsACString & aResult) {
     if (mIcalComponent) {
         return mIcalComponent->ToString(aResult);
     } else {
--- a/calendar/base/src/calUtils.cpp
+++ b/calendar/base/src/calUtils.cpp
@@ -11,25 +11,25 @@ extern "C" {
 }
 
 namespace cal {
 
 nsresult logError(PRUnichar const* msg) {
     nsresult rc;
     nsCOMPtr<nsIScriptError> const scriptError(do_CreateInstance("@mozilla.org/scripterror;1", &rc));
     NS_ENSURE_SUCCESS(rc, rc);
-    rc = scriptError->Init(msg, nsnull, nsnull, 0, 0, nsIScriptError::errorFlag, "calendar");
+    rc = scriptError->Init(msg, nullptr, nullptr, 0, 0, nsIScriptError::errorFlag, "calendar");
     return getConsoleService()->LogMessage(scriptError);
 }
 
 nsresult logWarning(PRUnichar const* msg) {
     nsresult rc;
     nsCOMPtr<nsIScriptError> const scriptError(do_CreateInstance("@mozilla.org/scripterror;1", &rc));
     NS_ENSURE_SUCCESS(rc, rc);
-    rc = scriptError->Init(msg, nsnull, nsnull, 0, 0, nsIScriptError::warningFlag, "calendar");
+    rc = scriptError->Init(msg, nullptr, nullptr, 0, 0, nsIScriptError::warningFlag, "calendar");
     return getConsoleService()->LogMessage(scriptError);
 }
 
 nsresult log(PRUnichar const* msg) {
     return getConsoleService()->LogStringMessage(msg);
 }
 
 nsCOMPtr<calITimezone> detectTimezone(icaltimetype const& icalt,
@@ -61,20 +61,20 @@ void logMissingTimezone(char const* tzid
     // xxx todo: needs l10n
     nsString msg(NS_LITERAL_STRING("Timezone \""));
     msg += NS_ConvertUTF8toUTF16(tzid);
     msg += NS_LITERAL_STRING("\" not found, falling back to floating!");
     logError(msg.get());
 }
 
 icaltimezone * getIcalTimezone(calITimezone * tz) {
-    icaltimezone * icaltz = nsnull;
+    icaltimezone * icaltz = nullptr;
     if (!tz) {
         NS_ASSERTION(false, "No Timezone passed to getIcalTimezone");
-        return nsnull;
+        return nullptr;
     }
 
     bool b;
     tz->GetIsUTC(&b);
     if (b) {
         icaltz = icaltimezone_get_utc_timezone();
     } else {
         nsCOMPtr<calIIcalComponent> tzComp;
--- a/db/mork/src/morkEnv.cpp
+++ b/db/mork/src/morkEnv.cpp
@@ -55,17 +55,17 @@ morkEnv::~morkEnv() /*i*/ // assert Clos
     if (ownsHeap)
     {
 #ifdef MORK_DEBUG_HEAP_STATS
       printf("%d blocks remaining \n", ((orkinHeap *) saveHeap)->HeapBlockCount());
       mork_u4* array = (mork_u4*) this;
       array -= 3;
       // null out heap ptr in mem block so we won't crash trying to use it to
       // delete the env.
-      *array = nsnull;
+      *array = nullptr;
 #endif // MORK_DEBUG_HEAP_STATS
       // whoops, this is our heap - hmm. Can't delete it, or not allocate env's from
       // an orkinHeap.
       delete saveHeap;
     }
 
   }
 //  MORK_ASSERT(mEnv_SelfAsMdbEnv==0);
--- a/db/mork/src/morkFactory.cpp
+++ b/db/mork/src/morkFactory.cpp
@@ -176,17 +176,17 @@ morkFactory::OpenOldFile(nsIMdbEnv* mev,
   // (and write if not frozen) the file known by inFilePath.  The file
   // returned should be open and ready for use, and presumably positioned
   // at the first byte position of the file.  The exact manner in which
   // files must be opened is considered a subclass specific detail, and
   // other portions or Mork source code don't want to know how it's done.
 {
   mdb_err outErr = 0;
   morkEnv* ev = morkEnv::FromMdbEnv(mev);
-  morkFile* file = nsnull;
+  morkFile* file = nullptr;
   if ( ev )
   {
     if ( !ioHeap )
       ioHeap = &mFactory_Heap;
       
     file = morkFile::OpenOldFile(ev, ioHeap, inFilePath, inFrozen);
     NS_IF_ADDREF( file );
       
@@ -205,17 +205,17 @@ morkFactory::CreateNewFile(nsIMdbEnv* me
   // (and write if not frozen) the file known by inFilePath.  The file
   // returned should be created and ready for use, and presumably positioned
   // at the first byte position of the file.  The exact manner in which
   // files must be opened is considered a subclass specific detail, and
   // other portions or Mork source code don't want to know how it's done.
 {
   mdb_err outErr = 0;
   morkEnv* ev = morkEnv::FromMdbEnv(mev);
-  morkFile* file = nsnull;
+  morkFile* file = nullptr;
   if ( ev )
   {
     if ( !ioHeap )
       ioHeap = &mFactory_Heap;
       
     file = morkFile::CreateNewFile(ev, ioHeap, inFilePath);
     if ( file )
       NS_ADDREF(file);
--- a/db/mork/src/morkObject.cpp
+++ b/db/mork/src/morkObject.cpp
@@ -57,17 +57,17 @@ morkObject::~morkObject() // assert Clos
 }
 
 /*public non-poly*/
 morkObject::morkObject(const morkUsage& inUsage, nsIMdbHeap* ioHeap,
   mork_color inBeadColor)
 : morkBead(inUsage, ioHeap, inBeadColor)
 , mObject_Handle( 0 )
 {
-  mMorkEnv = nsnull;
+  mMorkEnv = nullptr;
 }
 
 /*public non-poly*/
 morkObject::morkObject(morkEnv* ev,
   const morkUsage& inUsage, nsIMdbHeap* ioHeap, 
   mork_color inBeadColor, morkHandle* ioHandle)
 : morkBead(ev, inUsage, ioHeap, inBeadColor)
 , mObject_Handle( 0 )
--- a/db/mork/src/morkObject.h
+++ b/db/mork/src/morkObject.h
@@ -63,17 +63,17 @@ public: // morkNode virtual methods
   virtual ~morkObject(); // assert that CloseObject() executed earlier
 #ifdef MORK_DEBUG_HEAP_STATS
   void operator delete(void* ioAddress, size_t size)
   { 
     mork_u4* array = (mork_u4*) ioAddress;
     array -= 3;
     orkinHeap *heap = (orkinHeap *) *array;
     if (heap)
-      heap->Free(nsnull, ioAddress);
+      heap->Free(nullptr, ioAddress);
   }
 #endif
 
   NS_DECL_ISUPPORTS
 
     // { ----- begin attribute methods -----
   NS_IMETHOD IsFrozenMdbObject(nsIMdbEnv* ev, mdb_bool* outIsReadonly);
   // same as nsIMdbPort::GetIsPortReadonly() when this object is inside a port.
--- a/db/mork/src/morkRowCellCursor.cpp
+++ b/db/mork/src/morkRowCellCursor.cpp
@@ -256,17 +256,17 @@ morkRowCellCursor::NextCell( // get next
   morkCell* cell = mRowCellCursor_RowObject->mRowObject_Row->CellAt(ev, pos);
   if ( cell )
   {
     col = cell->GetColumn();
     *acqCell = mRowCellCursor_RowObject->mRowObject_Row->AcquireCellHandle(ev, cell, col, pos);
   }
   else
   {
-    *acqCell = nsnull;
+    *acqCell = nullptr;
     pos = -1;
   }
  if ( outPos )
    *outPos = pos;
  if ( outColumn )
    *outColumn = col;
      
   mRowCellCursor_Col = pos;
--- a/editor/ui/composer/content/ComposerCommands.js
+++ b/editor/ui/composer/content/ComposerCommands.js
@@ -3650,17 +3650,17 @@ var nsNormalizeTableCommand =
     return IsInTable();
   },
 
   getCommandStateParams: function(aCommand, aParams, aRefCon) {},
   doCommandParams: function(aCommand, aParams, aRefCon) {},
 
   doCommand: function(aCommand)
   {
-    // Use nsnull to let editor find table enclosing current selection
+    // Use nullptr to let editor find table enclosing current selection
     try {
       GetCurrentTableEditor().normalizeTable(null);   
     } catch (e) {}
     window.content.focus();
   }
 };
 
 //-----------------------------------------------------------------------------------
--- a/ldap/xpcom/src/nsLDAPConnection.cpp
+++ b/ldap/xpcom/src/nsLDAPConnection.cpp
@@ -184,17 +184,17 @@ nsLDAPConnection::Close()
       rc = ldap_unbind(mConnectionHandle);
 #ifdef PR_LOGGING
       if (rc != LDAP_SUCCESS) {
           PR_LOG(gLDAPLogModule, PR_LOG_WARNING,
                  ("nsLDAPConnection::Close(): %s\n",
                   ldap_err2string(rc)));
       }
 #endif
-      mConnectionHandle = nsnull;
+      mConnectionHandle = nullptr;
   }
 
   PR_LOG(gLDAPLogModule, PR_LOG_DEBUG, ("unbound\n"));
 
   NS_ASSERTION(!mThread || NS_SUCCEEDED(mThread->Shutdown()),
                "Failed to shutdown thread cleanly");
 
   // Cancel the DNS lookup if needed, and also drop the reference to the
--- a/ldap/xpcom/src/nsLDAPOperation.cpp
+++ b/ldap/xpcom/src/nsLDAPOperation.cpp
@@ -140,19 +140,19 @@ nsLDAPOperation::GetConnection(nsILDAPCo
     NS_IF_ADDREF(*aConnection);
 
     return NS_OK;
 }
 
 void
 nsLDAPOperation::Clear()
 {
-  mMessageListener = nsnull;
-  mClosure = nsnull;
-  mConnection = nsnull;
+  mMessageListener = nullptr;
+  mClosure = nullptr;
+  mConnection = nullptr;
 }
 
 NS_IMETHODIMP
 nsLDAPOperation::GetMessageListener(nsILDAPMessageListener **aMessageListener)
 {
     if (!aMessageListener) {
         return NS_ERROR_ILLEGAL_VALUE;
     }
@@ -176,20 +176,20 @@ nsLDAPOperation::SaslBind(const nsACStri
   mAuthModule = authModule;
   mMechanism.Assign(mechanism);
 
   rv = mConnection->GetBindName(bindName);
   NS_ENSURE_SUCCESS(rv, rv);
 
   creds.bv_val = NULL;
   mAuthModule->Init(PromiseFlatCString(service).get(),
-                    nsIAuthModule::REQ_DEFAULT, nsnull,
-                    NS_ConvertUTF8toUTF16(bindName).get(), nsnull);
+                    nsIAuthModule::REQ_DEFAULT, nullptr,
+                    NS_ConvertUTF8toUTF16(bindName).get(), nullptr);
 
-  rv = mAuthModule->GetNextToken(nsnull, 0, (void **)&creds.bv_val,
+  rv = mAuthModule->GetNextToken(nullptr, 0, (void **)&creds.bv_val,
                                  &credlen);
   if (NS_FAILED(rv) || !creds.bv_val)
     return rv;
 
   creds.bv_len = credlen;
   const int lderrno = ldap_sasl_bind(mConnectionHandle, bindName.get(),
                                      mMechanism.get(), &creds, NULL, NULL,
                                      &mMsgID);
@@ -438,17 +438,17 @@ nsLDAPOperation::SearchExt(const nsACStr
             return rv;
         }
     }
 
     // Convert our comma separated string to one that the C-SDK will like, i.e.
     // convert to a char array and add a last NULL element.
     nsTArray<nsCString> attrArray;
     ParseString(aAttributes, ',', attrArray);
-    char **attrs = nsnull;
+    char **attrs = nullptr;
     PRUint32 origLength = attrArray.Length();
     if (origLength)
     {
       attrs = static_cast<char **> (NS_Alloc((origLength + 1) * sizeof(char *)));
       if (!attrs)
         return NS_ERROR_OUT_OF_MEMORY;
 
       for (PRUint32 i = 0; i < origLength; ++i)
--- a/ldap/xpcom/src/nsLDAPSecurityGlue.cpp
+++ b/ldap/xpcom/src/nsLDAPSecurityGlue.cpp
@@ -37,17 +37,17 @@ typedef struct {
 
 // free the per-socket data structure as necessary
 //
 static void
 nsLDAPSSLFreeSocketClosure(nsLDAPSSLSocketClosure **aClosure)
 {
     if (aClosure && *aClosure) {
 	nsMemory::Free(*aClosure);
-	*aClosure = nsnull;
+	*aClosure = nullptr;
     }
 }
 
 // Replacement close() function, which cleans up local stuff associated
 // with this socket, and then calls the real close function.
 //
 extern "C" int LDAP_CALLBACK
 nsLDAPSSLClose(int s, struct lextiof_socket_private *socketarg)
@@ -88,17 +88,17 @@ nsLDAPSSLClose(int s, struct lextiof_soc
 extern "C" int LDAP_CALLBACK
 nsLDAPSSLConnect(const char *hostlist, int defport, int timeout,
 		 unsigned long options, 
 		 struct lextiof_session_private *sessionarg,
 		 struct lextiof_socket_private **socketargp )
 {
     PRLDAPSocketInfo socketInfo;
     PRLDAPSessionInfo sessionInfo;
-    nsLDAPSSLSocketClosure *socketClosure = nsnull;
+    nsLDAPSSLSocketClosure *socketClosure = nullptr;
     nsLDAPSSLSessionClosure *sessionClosure;
     int	intfd = -1;
     nsCOMPtr <nsISupports> securityInfo;
     nsCOMPtr <nsISocketProvider> tlsSocketProvider;
     nsCOMPtr <nsISSLSocketControl> sslSocketControl;
     nsresult rv;
 
     // Ensure secure option is set.  Also, clear secure bit in options
@@ -109,17 +109,17 @@ nsLDAPSSLConnect(const char *hostlist, i
 		 "nsLDAPSSLConnect(): called for non-secure connection");
     options &= ~LDAP_X_EXTIOF_OPT_SECURE;
 
     // Retrieve session info. so we can store a pointer to our session info.
     // in our socket info. later.
     //
     memset(&sessionInfo, 0, sizeof(sessionInfo));
     sessionInfo.seinfo_size = PRLDAP_SESSIONINFO_SIZE;
-    if (prldap_get_session_info(nsnull, sessionarg, &sessionInfo) 
+    if (prldap_get_session_info(nullptr, sessionarg, &sessionInfo) 
 	!= LDAP_SUCCESS) {
 	NS_ERROR("nsLDAPSSLConnect(): unable to get session info");
         return -1;
     }
     sessionClosure = reinterpret_cast<nsLDAPSSLSessionClosure *>
                                      (sessionInfo.seinfo_appdata);
     
     // Call the real connect() callback to make the TCP connection.  If it
@@ -171,17 +171,17 @@ nsLDAPSSLConnect(const char *hostlist, i
     // AddToSocket what to match the name in the certificate against.
     // What exactly happen will happen when this is used with some IP
     // address in the list other than the first one is not entirely
     // clear, and I suspect it may depend on the format of the name in
     // the certificate.  Need to investigate.
     //
     rv = tlsSocketProvider->AddToSocket(PR_AF_INET,
                                         sessionClosure->hostname, defport,
-                                        nsnull, 0, 0, socketInfo.soinfo_prfd,
+                                        nullptr, 0, 0, socketInfo.soinfo_prfd,
                                         getter_AddRefs(securityInfo));
     if (NS_FAILED(rv)) {
 	NS_ERROR("nsLDAPSSLConnect(): unable to add SSL layer to socket");
         goto close_socket_and_exit_with_error;
     }
 
     // If possible we want to avoid using SSLv2, as this can confuse
     // some directory servers (notably the netscape 4.1 ds).  The only
@@ -230,39 +230,39 @@ static void
 nsLDAPSSLFreeSessionClosure(nsLDAPSSLSessionClosure **aSessionClosure)
 {
     if (aSessionClosure && *aSessionClosure) {
 
 	// free the hostname
 	//
 	if ( (*aSessionClosure)->hostname ) {
 	    PL_strfree((*aSessionClosure)->hostname);
-	    (*aSessionClosure)->hostname = nsnull;
+	    (*aSessionClosure)->hostname = nullptr;
 	}
 
 	// free the structure itself
 	//
 	nsMemory::Free(*aSessionClosure);
-	*aSessionClosure = nsnull;
+	*aSessionClosure = nullptr;
     }
 }
 
 // Replacement session handle disposal code.  First cleans up our local
 // stuff, then calls the original session handle disposal function.
 //
 extern "C" void LDAP_CALLBACK
 nsLDAPSSLDisposeHandle(LDAP *ld, struct lextiof_session_private *sessionarg)
 {
     PRLDAPSessionInfo sessionInfo;
     nsLDAPSSLSessionClosure *sessionClosure;
     LDAP_X_EXTIOF_DISPOSEHANDLE_CALLBACK *disposehdl_fn;
 
     memset(&sessionInfo, 0, sizeof(sessionInfo));
     sessionInfo.seinfo_size = PRLDAP_SESSIONINFO_SIZE;
-    if (prldap_get_session_info(ld, nsnull, &sessionInfo) == LDAP_SUCCESS) {
+    if (prldap_get_session_info(ld, nullptr, &sessionInfo) == LDAP_SUCCESS) {
 	sessionClosure = reinterpret_cast<nsLDAPSSLSessionClosure *>
                                   (sessionInfo.seinfo_appdata);
 	disposehdl_fn = sessionClosure->realDisposeHandle;
 	nsLDAPSSLFreeSessionClosure(&sessionClosure);
 	(*disposehdl_fn)(ld, sessionarg);
     } 
 }
 
@@ -324,17 +324,17 @@ nsLDAPInstallSSL( LDAP *ld, const char *
         return NS_ERROR_FAILURE;
     }
 
     // Store session info. for later retrieval.
     //
     sessionInfo.seinfo_size = PRLDAP_SESSIONINFO_SIZE;
     sessionInfo.seinfo_appdata = reinterpret_cast<prldap_session_private *>
                                                  (sessionClosure);
-    if (prldap_set_session_info(ld, nsnull, &sessionInfo) != LDAP_SUCCESS) {
+    if (prldap_set_session_info(ld, nullptr, &sessionInfo) != LDAP_SUCCESS) {
 	NS_ERROR("nsLDAPInstallSSL(): error setting prldap session info");
 	nsMemory::Free(sessionClosure);
 	return NS_ERROR_UNEXPECTED;
     }
 
     return NS_OK;
 }
 
--- a/ldap/xpcom/src/nsLDAPService.cpp
+++ b/ldap/xpcom/src/nsLDAPService.cpp
@@ -651,17 +651,17 @@ nsLDAPService::EstablishConnection(nsLDA
     //
     conn = do_CreateInstance(kLDAPConnectionCID, &rv);
     if (NS_FAILED(rv)) {
         NS_ERROR("nsLDAPService::EstablishConnection(): could not create "
                  "@mozilla.org/network/ldap-connection;1");
         return NS_ERROR_FAILURE;
     }
 
-    rv = conn->Init(url, binddn, this, nsnull, protocolVersion);
+    rv = conn->Init(url, binddn, this, nullptr, protocolVersion);
     if (NS_FAILED(rv)) {
         switch (rv) {
         // Only pass along errors we are aware of
         //
         case NS_ERROR_OUT_OF_MEMORY:
         case NS_ERROR_NOT_AVAILABLE:
         case NS_ERROR_FAILURE:
             return rv;
@@ -719,17 +719,17 @@ nsLDAPService::EstablishConnection(nsLDA
 
     // Setup the bind() operation.
     //
     operation = do_CreateInstance(kLDAPOperationCID, &rv);
     if (NS_FAILED(rv)) {
         return NS_ERROR_FAILURE;
     }
 
-    rv = operation->Init(conn, this, nsnull);
+    rv = operation->Init(conn, this, nullptr);
     if (NS_FAILED(rv)) {
         return NS_ERROR_UNEXPECTED; // this should never happen
     }
 
     // Start a bind operation 
     //
     // Here we need to support the password, see bug #75990
     // 
--- a/ldap/xpcom/src/nsLDAPSyncQuery.cpp
+++ b/ldap/xpcom/src/nsLDAPSyncQuery.cpp
@@ -101,17 +101,17 @@ nsLDAPSyncQuery::OnLDAPInit(nsILDAPConne
                                    &rv);
     if (NS_FAILED(rv)) {
         FinishLDAPQuery();
         return NS_ERROR_FAILURE;
     }
 
     // our OnLDAPMessage accepts all result callbacks
     //
-    rv = mOperation->Init(mConnection, this, nsnull);
+    rv = mOperation->Init(mConnection, this, nullptr);
     if (NS_FAILED(rv)) {
         FinishLDAPQuery();
         return NS_ERROR_UNEXPECTED; // this should never happen
     }
 
     // kick off a bind operation 
     // 
     rv = mOperation->SimpleBind(EmptyCString()); 
@@ -225,17 +225,17 @@ nsLDAPSyncQuery::StartLDAPSearch()
         NS_ERROR("nsLDAPSyncQuery::StartLDAPSearch(): couldn't "
                  "create @mozilla.org/network/ldap-operation;1");
         FinishLDAPQuery();
         return NS_ERROR_FAILURE;
     }
 
     // initialize the LDAP operation object
     //
-    rv = mOperation->Init(mConnection, this, nsnull);
+    rv = mOperation->Init(mConnection, this, nullptr);
     if (NS_FAILED(rv)) {
         NS_ERROR("nsLDAPSyncQuery::StartLDAPSearch(): couldn't "
                  "initialize LDAP operation");
         FinishLDAPQuery();
         return NS_ERROR_UNEXPECTED;
     }
 
     // get the search filter associated with the directory server url; 
@@ -306,17 +306,17 @@ nsresult nsLDAPSyncQuery::InitConnection
     //
     if (!mServerURL) {
         NS_ERROR("nsLDAPSyncQuery::InitConnection(): mServerURL "
                  "is NULL");
         FinishLDAPQuery();
         return NS_ERROR_NOT_INITIALIZED;
     }
     rv = mConnection->Init(mServerURL, EmptyCString(), this,
-                           nsnull, mProtocolVersion);
+                           nullptr, mProtocolVersion);
     if (NS_FAILED(rv)) {
         FinishLDAPQuery();
         return NS_ERROR_UNEXPECTED; // this should never happen
     }
 
     return NS_OK;
 }
 
old mode 120000
new mode 100644
--- a/mail/app/macbuild/Contents/CodeResources
+++ b/mail/app/macbuild/Contents/CodeResources
@@ -1,1 +1,65 @@
-_CodeSignature/CodeResources
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+    <dict>
+        <key>rules</key>
+        <dict>
+            <key>^Info.plist$</key>
+            <true/>
+            <key>^PkgInfo$</key>
+            <true/>
+            <key>^MacOS/</key>
+            <true/>
+            <key>^Resources/</key>
+            <true/>
+            <key>^MacOS/extensions/.*</key><dict>
+                <key>omit</key>
+                <true/>
+                <key>weight</key>
+                <real>10</real>
+            </dict>
+            <key>^MacOS/distribution/.*</key><dict>
+                <key>omit</key>
+                <true/>
+                <key>weight</key>
+                <real>10</real>
+            </dict>
+            <key>^MacOS/updates/.*</key><dict>
+                <key>omit</key>
+                <true/>
+                <key>weight</key>
+                <real>10</real>
+            </dict>
+            <key>^MacOS/active-update.xml$</key><dict>
+                <key>omit</key>
+                <true/>
+                <key>weight</key>
+                <real>10</real>
+            </dict>
+            <key>^MacOS/defaults/.*</key><dict>
+                <key>omit</key>
+                <true/>
+                <key>weight</key>
+                <real>10</real>
+            </dict>
+            <key>^MacOS/mozilla.cfg$</key><dict>
+                <key>omit</key>
+                <true/>
+                <key>weight</key>
+                <real>10</real>
+            </dict>
+            <key>^MacOS/removed-files$</key><dict>
+                <key>omit</key>
+                <true/>
+                <key>weight</key>
+                <real>10</real>
+            </dict>
+            <key>^MacOS/updates.xml$</key><dict>
+                <key>omit</key>
+                <true/>
+                <key>weight</key>
+                <real>10</real>
+            </dict>
+        </dict>
+    </dict>
+</plist>
--- a/mail/app/nsMailApp.cpp
+++ b/mail/app/nsMailApp.cpp
@@ -75,17 +75,17 @@ static const nsDynamicFunctionLoad kXULF
     { "XRE_GetFileFromPath", (NSFuncPtr*) &XRE_GetFileFromPath },
     { "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData },
     { "XRE_FreeAppData", (NSFuncPtr*) &XRE_FreeAppData },
 #ifdef XRE_HAS_DLL_BLOCKLIST
     { "XRE_SetupDllBlocklist", (NSFuncPtr*) &XRE_SetupDllBlocklist },
 #endif
     { "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate },
     { "XRE_main", (NSFuncPtr*) &XRE_main },
-    { nsnull, nsnull }
+    { nullptr, nullptr }
 };
 
 static int do_main(const char *exePath, int argc, char* argv[])
 {
   nsCOMPtr<nsIFile> appini;
 #ifdef XP_WIN
   // exePath comes from mozilla::BinaryPath::Get, which returns a UTF-8
   // encoded path, so it is safe to convert it
--- a/mail/components/migration/src/nsEudoraProfileMigrator.cpp
+++ b/mail/components/migration/src/nsEudoraProfileMigrator.cpp
@@ -29,17 +29,17 @@ nsEudoraProfileMigrator::nsEudoraProfile
 }
 
 nsEudoraProfileMigrator::~nsEudoraProfileMigrator()
 {
 }
 
 nsresult nsEudoraProfileMigrator::ContinueImport()
 {
-  return Notify(nsnull);
+  return Notify(nullptr);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 // nsITimerCallback
 
 NS_IMETHODIMP
 nsEudoraProfileMigrator::Notify(nsITimer *timer)
 {
@@ -76,17 +76,17 @@ nsEudoraProfileMigrator::Migrate(PRUint1
   nsresult rv = NS_OK;
 
   if (aStartup)
   {
     rv = aStartup->DoStartup();
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
-  NOTIFY_OBSERVERS(MIGRATION_STARTED, nsnull);
+  NOTIFY_OBSERVERS(MIGRATION_STARTED, nullptr);
   rv = ImportSettings(mImportModule);
 
   // now import address books
   // this routine will asynchronously import address book data and it will then kick off
   // the final migration step, copying the mail folders over.
   rv = ImportAddressBook(mImportModule);
 
   // don't broadcast an on end migration here. We aren't done until our asynch import process says we are done.
@@ -127,12 +127,12 @@ nsEudoraProfileMigrator::GetSourceHasMul
 {
   *aResult = false;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsEudoraProfileMigrator::GetSourceProfiles(nsIArray** aResult)
 {
-  *aResult = nsnull;
+  *aResult = nullptr;
   return NS_OK;
 }
 
--- a/mail/components/migration/src/nsMailProfileMigratorUtils.cpp
+++ b/mail/components/migration/src/nsMailProfileMigratorUtils.cpp
@@ -68,17 +68,17 @@ void GetMigrateDataFromArray(MigrationDa
     if (aReplace || !cursor->replaceOnly) {
       aSourceProfile->Clone(getter_AddRefs(sourceFile));
       sourceFile->Append(nsDependentString(cursor->fileName));
       sourceFile->Exists(&exists);
       if (exists)
         *aResult |= cursor->sourceFlag;
     }
     NS_Free(cursor->fileName);
-    cursor->fileName = nsnull;
+    cursor->fileName = nullptr;
   }
 }
 
 void
 GetProfilePath(nsIProfileStartup* aStartup, nsCOMPtr<nsIFile>& aProfileDir)
 {
   if (aStartup) {
     aStartup->GetDirectory(getter_AddRefs(aProfileDir));
--- a/mail/components/migration/src/nsMailProfileMigratorUtils.h
+++ b/mail/components/migration/src/nsMailProfileMigratorUtils.h
@@ -8,17 +8,17 @@
 
 #define MIGRATION_ITEMBEFOREMIGRATE "Migration:ItemBeforeMigrate"
 #define MIGRATION_ITEMAFTERMIGRATE  "Migration:ItemAfterMigrate"
 #define MIGRATION_STARTED           "Migration:Started"
 #define MIGRATION_ENDED             "Migration:Ended"
 #define MIGRATION_PROGRESS          "Migration:Progress"
 
 #define NOTIFY_OBSERVERS(message, item) \
-  mObserverService->NotifyObservers(nsnull, message, item)
+  mObserverService->NotifyObservers(nullptr, message, item)
 
 #define COPY_DATA(func, replace, itemIndex) \
   if (NS_SUCCEEDED(rv) && (aItems & itemIndex || !aItems)) { \
     nsAutoString index; \
     index.AppendInt(itemIndex); \
     NOTIFY_OBSERVERS(MIGRATION_ITEMBEFOREMIGRATE, index.get()); \
     rv = func(replace); \
     NOTIFY_OBSERVERS(MIGRATION_ITEMAFTERMIGRATE, index.get()); \
--- a/mail/components/migration/src/nsNetscapeProfileMigratorBase.cpp
+++ b/mail/components/migration/src/nsNetscapeProfileMigratorBase.cpp
@@ -384,17 +384,17 @@ void nsNetscapeProfileMigratorBase::EndC
   mFileCopyTransactions.Clear();
   mFileCopyTransactionIndex = 0;
 
   // notify the UI that we are done with the migration process
   nsAutoString index;
   index.AppendInt(nsIMailProfileMigrator::MAILDATA);
   NOTIFY_OBSERVERS(MIGRATION_ITEMAFTERMIGRATE, index.get());
 
-  NOTIFY_OBSERVERS(MIGRATION_ENDED, nsnull);
+  NOTIFY_OBSERVERS(MIGRATION_ENDED, nullptr);
 }
 
 NS_IMETHODIMP
 nsNetscapeProfileMigratorBase::GetSourceHasMultipleProfiles(bool* aResult)
 {
   nsCOMPtr<nsIArray> profiles;
   GetSourceProfiles(getter_AddRefs(profiles));
 
--- a/mail/components/migration/src/nsOEProfileMigrator.cpp
+++ b/mail/components/migration/src/nsOEProfileMigrator.cpp
@@ -26,17 +26,17 @@ nsOEProfileMigrator::nsOEProfileMigrator
 
 nsOEProfileMigrator::~nsOEProfileMigrator()
 {
 
 }
 
 nsresult nsOEProfileMigrator::ContinueImport()
 {
-  return Notify(nsnull);
+  return Notify(nullptr);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 // nsITimerCallback
 
 NS_IMETHODIMP
 nsOEProfileMigrator::Notify(nsITimer *timer)
 {
@@ -73,17 +73,17 @@ nsOEProfileMigrator::Migrate(PRUint16 aI
   nsresult rv = NS_OK;
 
   if (aStartup)
   {
     rv = aStartup->DoStartup();
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
-  NOTIFY_OBSERVERS(MIGRATION_STARTED, nsnull);
+  NOTIFY_OBSERVERS(MIGRATION_STARTED, nullptr);
   rv = ImportSettings(mImportModule);
 
   // now import address books
   // this routine will asynchronously import address book data and it will then kick off
   // the final migration step, copying the mail folders over.
   rv = ImportAddressBook(mImportModule);
 
   // don't broadcast an on end migration here. We aren't done until our asynch import process says we are done.
@@ -124,12 +124,12 @@ nsOEProfileMigrator::GetSourceHasMultipl
 {
   *aResult = false;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsOEProfileMigrator::GetSourceProfiles(nsIArray** aResult)
 {
-  *aResult = nsnull;
+  *aResult = nullptr;
   return NS_OK;
 }
 
--- a/mail/components/migration/src/nsOutlookProfileMigrator.cpp
+++ b/mail/components/migration/src/nsOutlookProfileMigrator.cpp
@@ -21,17 +21,17 @@ nsOutlookProfileMigrator::nsOutlookProfi
 }
 
 nsOutlookProfileMigrator::~nsOutlookProfileMigrator()
 {
 }
 
 nsresult nsOutlookProfileMigrator::ContinueImport()
 {
-  return Notify(nsnull);
+  return Notify(nullptr);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 // nsITimerCallback
 
 NS_IMETHODIMP
 nsOutlookProfileMigrator::Notify(nsITimer *timer)
 {
@@ -68,17 +68,17 @@ nsOutlookProfileMigrator::Migrate(PRUint
   nsresult rv = NS_OK;
 
   if (aStartup)
   {
     rv = aStartup->DoStartup();
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
-  NOTIFY_OBSERVERS(MIGRATION_STARTED, nsnull);
+  NOTIFY_OBSERVERS(MIGRATION_STARTED, nullptr);
 
   rv = ImportSettings(mImportModule);
 
   // now import address books
   // this routine will asynchronously import address book data and it will then kick off
   // the final migration step, copying the mail folders over.
   rv = ImportAddressBook(mImportModule);
 
@@ -118,11 +118,11 @@ nsOutlookProfileMigrator::GetSourceHasMu
 {
   *aResult = false;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsOutlookProfileMigrator::GetSourceProfiles(nsIArray** aResult)
 {
-  *aResult = nsnull;
+  *aResult = nullptr;
   return NS_OK;
 }
--- a/mail/components/migration/src/nsProfileMigrator.cpp
+++ b/mail/components/migration/src/nsProfileMigrator.cpp
@@ -49,17 +49,17 @@ nsProfileMigrator::Migrate(nsIProfileSta
   nsCOMPtr<nsIMutableArray> params (do_CreateInstance(NS_ARRAY_CONTRACTID));
   if (!ww || !params) return NS_ERROR_FAILURE;
 
   params->AppendElement(cstr, false);
   params->AppendElement(mailMigrator, false);
   params->AppendElement(aStartup, false);
 
   nsCOMPtr<nsIDOMWindow> migrateWizard;
-  return ww->OpenWindow(nsnull,
+  return ww->OpenWindow(nullptr,
                         MIGRATION_WIZARD_FE_URL,
                         "_blank",
                         MIGRATION_WIZARD_FE_FEATURES,
                         params,
                         getter_AddRefs(migrateWizard));
 }
 
 #ifdef XP_WIN
@@ -123,15 +123,15 @@ nsProfileMigrator::GetDefaultMailMigrato
     mailMigrator = do_CreateInstance(migratorID.get());
     if (!mailMigrator)
       continue;
 
     bool exists = false;
     mailMigrator->GetSourceExists(&exists);
     if (exists)
     {
-      mailMigrator = nsnull;
+      mailMigrator = nullptr;
       return NS_OK;
     }
   }
 
   return NS_ERROR_NOT_AVAILABLE;
 }
--- a/mail/components/migration/src/nsProfileMigratorBase.cpp
+++ b/mail/components/migration/src/nsProfileMigratorBase.cpp
@@ -62,17 +62,17 @@ nsresult nsProfileMigratorBase::ImportAd
 
   // we want to migrate the outlook express addressbook into our personal address book
   pabString->SetData(nsDependentCString(kPersonalAddressbookUri));
   mGenericImporter->SetData("addressDestination", pabString);
 
   bool importResult;
   bool wantsProgress;
   mGenericImporter->WantsProgress(&wantsProgress);
-  rv = mGenericImporter->BeginImport(nsnull, nsnull, &importResult);
+  rv = mGenericImporter->BeginImport(nullptr, nullptr, &importResult);
 
   if (wantsProgress)
     ContinueImport();
   else
     FinishCopyingAddressBookData();
 
   return rv;
 }
@@ -106,17 +106,17 @@ nsresult nsProfileMigratorBase::ImportMa
   // by setting the migration flag, we force the import utility to install local folders from OE
   // directly into Local Folders and not as a subfolder
   migrating->SetData(true);
   mGenericImporter->SetData("migration", migrating);
 
   bool importResult;
   bool wantsProgress;
   mGenericImporter->WantsProgress(&wantsProgress);
-  rv = mGenericImporter->BeginImport(nsnull, nsnull, &importResult);
+  rv = mGenericImporter->BeginImport(nullptr, nullptr, &importResult);
 
   mProcessingMailFolders = true;
 
   if (wantsProgress)
     ContinueImport();
   else
     FinishCopyingMailFolders();
 
@@ -150,13 +150,13 @@ nsresult nsProfileMigratorBase::ImportFi
     PRUnichar* error;
 
     rv = importFilters->Import(&error, &importedFilters);
 
     NOTIFY_OBSERVERS(MIGRATION_ITEMAFTERMIGRATE, index.get());
   }
 
   // migration is now done...notify the UI.
-  NOTIFY_OBSERVERS(MIGRATION_ENDED, nsnull);
+  NOTIFY_OBSERVERS(MIGRATION_ENDED, nullptr);
 
   return rv;
 }
 
--- a/mail/components/migration/src/nsSeamonkeyProfileMigrator.cpp
+++ b/mail/components/migration/src/nsSeamonkeyProfileMigrator.cpp
@@ -69,17 +69,17 @@ nsSeamonkeyProfileMigrator::Migrate(PRUi
     if (!mTargetProfile) return NS_ERROR_FAILURE;
   }
   if (!mSourceProfile) {
     GetSourceProfile(aProfile);
     if (!mSourceProfile)
       return NS_ERROR_FAILURE;
   }
 
-  NOTIFY_OBSERVERS(MIGRATION_STARTED, nsnull);
+  NOTIFY_OBSERVERS(MIGRATION_STARTED, nullptr);
 
   COPY_DATA(CopyPreferences,  aReplace, nsIMailProfileMigrator::SETTINGS);
 
   // fake notifications for things we've already imported as part of CopyPreferences
   COPY_DATA(DummyCopyRoutine, aReplace, nsIMailProfileMigrator::ACCOUNT_SETTINGS);
   COPY_DATA(DummyCopyRoutine, aReplace, nsIMailProfileMigrator::NEWSDATA);
 
   // copy junk mail training file
@@ -614,17 +614,17 @@ nsSeamonkeyProfileMigrator::ReadBranch(c
                                        nsIPrefService* aPrefService,
                                        PBStructArray &aPrefs)
 {
   // Enumerate the branch
   nsCOMPtr<nsIPrefBranch> branch;
   aPrefService->GetBranch(branchName, getter_AddRefs(branch));
 
   PRUint32 count;
-  char** prefs = nsnull;
+  char** prefs = nullptr;
   nsresult rv = branch->GetChildList("", &count, &prefs);
   if (NS_FAILED(rv))
     return;
 
   for (PRUint32 i = 0; i < count; ++i) {
     // Save each pref's value into an array
     char* currPref = prefs[i];
     PRInt32 type;
@@ -666,33 +666,33 @@ nsSeamonkeyProfileMigrator::WriteBranch(
 
   PRUint32 count = aPrefs.Length();
   for (PRUint32 i = 0; i < count; ++i) {
     PrefBranchStruct* pref = aPrefs.ElementAt(i);
     switch (pref->type) {
     case nsIPrefBranch::PREF_STRING:
       rv = branch->SetCharPref(pref->prefName, pref->stringValue);
       NS_Free(pref->stringValue);
-      pref->stringValue = nsnull;
+      pref->stringValue = nullptr;
       break;
     case nsIPrefBranch::PREF_BOOL:
       rv = branch->SetBoolPref(pref->prefName, pref->boolValue);
       break;
     case nsIPrefBranch::PREF_INT:
       rv = branch->SetIntPref(pref->prefName, pref->intValue);
       break;
     default:
       NS_WARNING("Invalid Pref Type in "
                  "nsNetscapeProfileMigratorBase::WriteBranch\n");
       break;
     }
     NS_Free(pref->prefName);
-    pref->prefName = nsnull;
+    pref->prefName = nullptr;
     delete pref;
-    pref = nsnull;
+    pref = nullptr;
   }
   aPrefs.Clear();
 }
 
 nsresult nsSeamonkeyProfileMigrator::DummyCopyRoutine(bool aReplace)
 {
   // place holder function only to fake the UI out into showing some migration process.
   return NS_OK;
--- a/mail/components/search/nsMailWinSearchHelper.cpp
+++ b/mail/components/search/nsMailWinSearchHelper.cpp
@@ -103,17 +103,17 @@ NS_IMETHODIMP nsMailWinSearchHelper::Get
   }
   *aResult = true;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMailWinSearchHelper::GetServiceRunning(bool* aResult)
 {
   *aResult = false;
-  SC_HANDLE hSCManager = OpenSCManager(nsnull, SERVICES_ACTIVE_DATABASE, SERVICE_QUERY_STATUS);
+  SC_HANDLE hSCManager = OpenSCManager(nullptr, SERVICES_ACTIVE_DATABASE, SERVICE_QUERY_STATUS);
   if (!hSCManager)
     return NS_ERROR_FAILURE;
 
   SC_HANDLE hService = OpenService(hSCManager, "wsearch", SERVICE_QUERY_STATUS);
   CloseServiceHandle(hSCManager);
   if (!hService)
     // The service isn't present. Never mind.
     return NS_ERROR_NOT_AVAILABLE;
--- a/mail/components/shell/DirectoryProvider.cpp
+++ b/mail/components/shell/DirectoryProvider.cpp
@@ -189,17 +189,17 @@ DirectoryProvider::GetFiles(const char *
       return rv;
 
     nsCOMPtr<nsISimpleEnumerator> list;
     rv = dirSvc->Get(XRE_EXTENSIONS_DIR_LIST,
                      NS_GET_IID(nsISimpleEnumerator), getter_AddRefs(list));
     if (NS_FAILED(rv))
       return rv;
 
-    static char const *const kAppendSPlugins[] = {"searchplugins", nsnull};
+    static char const *const kAppendSPlugins[] = {"searchplugins", nullptr};
 
     nsCOMPtr<nsISimpleEnumerator> extEnum =
       new AppendingEnumerator(list, kAppendSPlugins);
     if (!extEnum)
       return NS_ERROR_OUT_OF_MEMORY;
 
     return NS_NewUnionEnumerator(aResult, extEnum, baseEnum);
   }
@@ -217,17 +217,17 @@ DirectoryProvider::AppendingEnumerator::
 }
 
 NS_IMETHODIMP
 DirectoryProvider::AppendingEnumerator::GetNext(nsISupports* *aResult)
 {
   if (aResult)
     NS_ADDREF(*aResult = mNext);
 
-  mNext = nsnull;
+  mNext = nullptr;
 
   nsresult rv;
   bool more;
   while (NS_SUCCEEDED(mBase->HasMoreElements(&more)) && more) {
     nsCOMPtr<nsISupports> nextbasesupp;
     mBase->GetNext(getter_AddRefs(nextbasesupp));
 
     nsCOMPtr<nsIFile> nextbase(do_QueryInterface(nextbasesupp));
@@ -245,26 +245,26 @@ DirectoryProvider::AppendingEnumerator::
       ++i;
     }
 
     bool exists;
     rv = mNext->Exists(&exists);
     if (NS_SUCCEEDED(rv) && exists)
       break;
 
-    mNext = nsnull;
+    mNext = nullptr;
   }
 
   return NS_OK;
 }
 
 DirectoryProvider::AppendingEnumerator::AppendingEnumerator
     (nsISimpleEnumerator* aBase,
      char const *const *aAppendList) :
   mBase(aBase),
   mAppendList(aAppendList)
 {
   // Initialize mNext to begin.
-  GetNext(nsnull);
+  GetNext(nullptr);
 }
 
 } // namespace mail
 } // namespace mozilla
--- a/mail/components/shell/nsMailGNOMEIntegration.cpp
+++ b/mail/components/shell/nsMailGNOMEIntegration.cpp
@@ -67,17 +67,17 @@ nsMailGNOMEIntegration::Init()
   nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
   nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
 
   if (!gconf && !giovfs)
     return NS_ERROR_NOT_AVAILABLE;
 
   // Check G_BROKEN_FILENAMES.  If it's set, then filenames in glib use
   // the locale encoding.  If it's not set, they use UTF-8.
-  mUseLocaleFilenames = PR_GetEnv("G_BROKEN_FILENAMES") != nsnull;
+  mUseLocaleFilenames = PR_GetEnv("G_BROKEN_FILENAMES") != nullptr;
 
   if (GetAppPathFromLauncher())
       return NS_OK;
 
   nsCOMPtr<nsIFile> appPath;
   rv = NS_GetSpecialDirectory(NS_XPCOM_CURRENT_PROCESS_DIR,
                               getter_AddRefs(appPath));
   NS_ENSURE_SUCCESS(rv, rv);
--- a/mail/components/shell/nsMailWinIntegration.cpp
+++ b/mail/components/shell/nsMailWinIntegration.cpp
@@ -185,17 +185,17 @@ nsWindowsShellService::ShortcutMaintenan
 
   NS_NAMED_LITERAL_CSTRING(prefName, "mail.taskbar.lastgroupid");
   nsCOMPtr<nsIPrefService> prefs =
     do_GetService(NS_PREFSERVICE_CONTRACTID);
   if (!prefs)
     return NS_ERROR_UNEXPECTED;
 
   nsCOMPtr<nsIPrefBranch> prefBranch;
-  prefs->GetBranch(nsnull, getter_AddRefs(prefBranch));
+  prefs->GetBranch(nullptr, getter_AddRefs(prefBranch));
   if (!prefBranch)
     return NS_ERROR_UNEXPECTED;
 
   nsCOMPtr<nsISupportsString> prefString;
   rv = prefBranch->GetComplexValue(prefName.get(),
                                    NS_GET_IID(nsISupportsString),
                                    getter_AddRefs(prefString));
   if (NS_SUCCEEDED(rv)) {
--- a/mail/test/resources/mozmill/patches/eventUtils.patch
+++ b/mail/test/resources/mozmill/patches/eventUtils.patch
@@ -156,62 +156,62 @@ index 27fbbc7..0329d47 100644
 @@ -685,8 +695,6 @@ function synthesizeText(aEvent, aWindow)
   */
  function synthesizeQuerySelectedText(aWindow)
  {
 -  netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
 -
    var utils = _getDOMWindowUtils(aWindow);
    if (!utils) {
-     return nsnull;
+     return nullptr;
 @@ -707,8 +715,6 @@ function synthesizeQuerySelectedText(aWindow)
   */
  function synthesizeQueryTextContent(aOffset, aLength, aWindow)
  {
 -  netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
 -
    var utils = _getDOMWindowUtils(aWindow);
    if (!utils) {
-     return nsnull;
+     return nullptr;
 @@ -728,8 +734,6 @@ function synthesizeQueryTextContent(aOffset, aLength, aWindow)
   */
  function synthesizeQueryCaretRect(aOffset, aWindow)
  {
 -  netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
 -
    var utils = _getDOMWindowUtils(aWindow);
    if (!utils) {
-     return nsnull;
+     return nullptr;
 @@ -751,8 +755,6 @@ function synthesizeQueryCaretRect(aOffset, aWindow)
   */
  function synthesizeQueryTextRect(aOffset, aLength, aWindow)
  {
 -  netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
 -
    var utils = _getDOMWindowUtils(aWindow);
    if (!utils) {
-     return nsnull;
+     return nullptr;
 @@ -770,8 +772,6 @@ function synthesizeQueryTextRect(aOffset, aLength, aWindow)
   */
  function synthesizeQueryEditorRect(aWindow)
  {
 -  netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
 -
    var utils = _getDOMWindowUtils(aWindow);
    if (!utils) {
-     return nsnull;
+     return nullptr;
 @@ -789,8 +789,6 @@ function synthesizeQueryEditorRect(aWindow)
   */
  function synthesizeCharAtPoint(aX, aY, aWindow)
  {
 -  netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
 -
    var utils = _getDOMWindowUtils(aWindow);
    if (!utils) {
-     return nsnull;
+     return nullptr;
 @@ -813,8 +811,6 @@ function synthesizeCharAtPoint(aX, aY, aWindow)
   */
  function synthesizeSelectionSet(aOffset, aLength, aReverse, aWindow)
  {
 -  netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
 -
    var utils = _getDOMWindowUtils(aWindow);
    if (!utils) {
--- a/mailnews/addrbook/src/nsAbAddressCollector.cpp
+++ b/mailnews/addrbook/src/nsAbAddressCollector.cpp
@@ -40,30 +40,30 @@ nsAbAddressCollector::~nsAbAddressCollec
  */
 already_AddRefed<nsIAbCard>
 nsAbAddressCollector::GetCardFromProperty(const char *aName,
                                           const nsACString &aValue,
                                           nsIAbDirectory **aDirectory)
 {
   nsresult rv;
   nsCOMPtr<nsIAbManager> abManager(do_GetService(NS_ABMANAGER_CONTRACTID, &rv));
-  NS_ENSURE_SUCCESS(rv, nsnull);
+  NS_ENSURE_SUCCESS(rv, nullptr);
 
   nsCOMPtr<nsISimpleEnumerator> enumerator;
   rv = abManager->GetDirectories(getter_AddRefs(enumerator));
-  NS_ENSURE_SUCCESS(rv, nsnull);
+  NS_ENSURE_SUCCESS(rv, nullptr);
 
   bool hasMore;
   nsCOMPtr<nsISupports> supports;
   nsCOMPtr<nsIAbDirectory> directory;
-  nsIAbCard *result = nsnull;
+  nsIAbCard *result = nullptr;
   while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) && hasMore)
   {
     rv = enumerator->GetNext(getter_AddRefs(supports));
-    NS_ENSURE_SUCCESS(rv, nsnull);
+    NS_ENSURE_SUCCESS(rv, nullptr);
 
     directory = do_QueryInterface(supports, &rv);
     if (NS_FAILED(rv))
       continue;
 
     // Some implementations may return NS_ERROR_NOT_IMPLEMENTED here,
     // so just catch the value and continue.
     if (NS_FAILED(directory->GetCardFromProperty(aName, aValue, true,
@@ -72,17 +72,17 @@ nsAbAddressCollector::GetCardFromPropert
 
     if (result)
     {
       if (aDirectory)
         directory.swap(*aDirectory);
       return result;
     }
   }
-  return nsnull;
+  return nullptr;
 }
 
 NS_IMETHODIMP
 nsAbAddressCollector::CollectAddress(const nsACString &aAddresses,
                                      bool aCreateCard,
                                      PRUint32 aSendFormat)
 {
   // If we've not got a valid directory, no point in going any further
@@ -338,17 +338,17 @@ nsAbAddressCollector::SetUpAbFromPrefs(n
                            getter_Copies(abURI));
 
   if (abURI.IsEmpty())
     abURI.AssignLiteral(kPersonalAddressbookUri);
 
   if (abURI == mABURI)
     return;
 
-  mDirectory = nsnull;
+  mDirectory = nullptr;
   mABURI = abURI;
 
   nsresult rv;
   nsCOMPtr<nsIAbManager> abManager(do_GetService(NS_ABMANAGER_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, );
 
   rv = abManager->GetDirectory(mABURI, getter_AddRefs(mDirectory));
   NS_ENSURE_SUCCESS(rv, );
@@ -358,11 +358,11 @@ nsAbAddressCollector::SetUpAbFromPrefs(n
   NS_ENSURE_SUCCESS(rv, );
 
   // If the directory is read-only, we can't write to it, so just blank it out
   // here, and warn because we shouldn't hit this (UI is wrong).
   if (readOnly)
   {
     NS_ERROR("Address Collection book preferences is set to a read-only book. "
              "Address collection will not take place.");
-    mDirectory = nsnull;
+    mDirectory = nullptr;
   }
 }
--- a/mailnews/addrbook/src/nsAbBSDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbBSDirectory.cpp
@@ -184,17 +184,17 @@ NS_IMETHODIMP nsAbBSDirectory::CreateNew
    * The creation of the address book in the preferences
    * is very MDB implementation specific.
    * If the fileName attribute is null then it will
    * create an appropriate file name.
    * Somehow have to resolve this issue so that it
    * is more general.
    *
    */
-  DIR_Server* server = nsnull;
+  DIR_Server* server = nullptr;
   rv = DIR_AddNewAddressBook(aDirName, EmptyCString(), URI,
                              (DirectoryType)aType, aPrefName, &server);
   NS_ENSURE_SUCCESS (rv, rv);
   
   if (aType == PABDirectory) {
     // Add the URI property
     URI.AssignLiteral(kMDBDirectoryRoot);
     URI.Append(nsDependentCString(server->fileName));
@@ -212,17 +212,17 @@ NS_IMETHODIMP nsAbBSDirectory::CreateDir
 {
   nsresult rv = EnsureInitialized();
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCString fileName;
   if (StringBeginsWith(aURI, NS_LITERAL_CSTRING(kMDBDirectoryRoot)))
     fileName = Substring(aURI, kMDBDirectoryRootLen);
 
-  DIR_Server * server = nsnull;
+  DIR_Server * server = nullptr;
   rv = DIR_AddNewAddressBook(aDisplayName, fileName, aURI,
                              PABDirectory, EmptyCString(), &server);
   NS_ENSURE_SUCCESS(rv,rv);
 
   rv = CreateDirectoriesFromFactory(aURI, server, true /* notify */);
   NS_ENSURE_SUCCESS(rv,rv);
 	return rv;
 }
@@ -250,17 +250,17 @@ GetDirectories_getDirectory(nsISupports 
 
 NS_IMETHODIMP nsAbBSDirectory::DeleteDirectory(nsIAbDirectory *directory)
 {
   NS_ENSURE_ARG_POINTER(directory);
 
   nsresult rv = EnsureInitialized();
   NS_ENSURE_SUCCESS(rv, rv);
 
-  DIR_Server *server = nsnull;
+  DIR_Server *server = nullptr;
   mServers.Get(directory, &server);
 
   if (!server)
     return NS_ERROR_FAILURE;
 
   GetDirectories getDirectories(server);
   mServers.EnumerateRead(GetDirectories_getDirectory,
                          (void*)&getDirectories);
@@ -302,17 +302,17 @@ NS_IMETHODIMP nsAbBSDirectory::DeleteDir
 NS_IMETHODIMP nsAbBSDirectory::HasDirectory(nsIAbDirectory *dir, bool *hasDir)
 {
   if (!hasDir)
     return NS_ERROR_NULL_POINTER;
 
   nsresult rv = EnsureInitialized();
   NS_ENSURE_SUCCESS(rv, rv);
 
-  DIR_Server *dirServer = nsnull;
+  DIR_Server *dirServer = nullptr;
   mServers.Get(dir, &dirServer);
   return DIR_ContainsServer(dirServer, hasDir);
 }
 
 NS_IMETHODIMP nsAbBSDirectory::UseForAutocomplete(const nsACString &aIdentityKey,
                                                   bool *aResult)
 {
   // For the "root" directory (kAllDirectoryRoot) always return true so that
--- a/mailnews/addrbook/src/nsAbCardProperty.cpp
+++ b/mailnews/addrbook/src/nsAbCardProperty.cpp
@@ -677,17 +677,17 @@ nsresult nsAbCardProperty::ConvertToEsca
     }
 
     rv = GetPropertyAsAString(kWorkWebPageProperty, str);
     if (NS_SUCCEEDED(rv) && !str.IsEmpty())
     {
         myAddPropValue(vObj, VCURLProp, str.get(), &vCardHasData);
     }
 
-    myAddPropValue(vObj, VCVersionProp, NS_LITERAL_STRING("2.1").get(), nsnull);
+    myAddPropValue(vObj, VCVersionProp, NS_LITERAL_STRING("2.1").get(), nullptr);
 
     if (!vCardHasData) {
         aResult.Truncate();
         return NS_OK;
     }
 
     int len = 0;
     char *vCard = writeMemVObject(0, &len, vObj);
@@ -728,17 +728,17 @@ nsresult nsAbCardProperty::ConvertToBase
 
   nsString xmlSubstr;
   rv = ConvertToXMLPrintData(xmlSubstr);
   NS_ENSURE_SUCCESS(rv,rv);
 
   xmlStr.Append(xmlSubstr);
   xmlStr.AppendLiteral("</directory>\n");
 
-  char *tmpRes = PL_Base64Encode(NS_ConvertUTF16toUTF8(xmlStr).get(), 0, nsnull);
+  char *tmpRes = PL_Base64Encode(NS_ConvertUTF16toUTF8(xmlStr).get(), 0, nullptr);
   result.Assign(tmpRes);
   PR_Free(tmpRes);
   return NS_OK;
 }
 
 nsresult nsAbCardProperty::ConvertToXMLPrintData(nsAString &aXMLSubstr)
 {
   nsresult rv;
@@ -813,17 +813,17 @@ nsresult nsAbCardProperty::ConvertToXMLP
     NS_ENSURE_SUCCESS(rv, rv);
 
     xmlStr.Append(headingAddresses);
     xmlStr.AppendLiteral("</sectiontitle>");
 
     nsCOMPtr<nsIAbManager> abManager = do_GetService(NS_ABMANAGER_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    nsCOMPtr <nsIAbDirectory> mailList = nsnull;
+    nsCOMPtr <nsIAbDirectory> mailList = nullptr;
     rv = abManager->GetDirectory(m_MailListURI, getter_AddRefs(mailList));
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsIMutableArray> addresses;
     rv = mailList->GetAddressLists(getter_AddRefs(addresses));
     if (addresses) {
       PRUint32 total = 0;
       addresses->GetLength(&total);
--- a/mailnews/addrbook/src/nsAbDirProperty.cpp
+++ b/mailnews/addrbook/src/nsAbDirProperty.cpp
@@ -397,17 +397,17 @@ NS_IMETHODIMP nsAbDirProperty::GetDirPre
 
 NS_IMETHODIMP nsAbDirProperty::SetDirPrefId(const nsACString &aDirPrefId)
 {
   if (!m_DirPrefId.Equals(aDirPrefId))
   {
     m_DirPrefId.Assign(aDirPrefId);
     // Clear the directory pref branch so that it is re-initialized next
     // time its required.
-    m_DirectoryPrefs = nsnull;
+    m_DirectoryPrefs = nullptr;
   }
   return NS_OK;
 }
 
 nsresult nsAbDirProperty::InitDirectoryPrefs()
 {
   if (m_DirPrefId.IsEmpty())
     return NS_ERROR_NOT_INITIALIZED;
--- a/mailnews/addrbook/src/nsAbLDAPChangeLogData.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPChangeLogData.cpp
@@ -360,25 +360,25 @@ nsresult nsAbLDAPProcessChangeLogData::O
     nsresult rv = NS_OK;
 
     if(mUseChangeLog) {
         rv = mChangeLogQuery->QueryChangeLog(mRootDSEEntry.changeLogDN, mRootDSEEntry.lastChangeNumber);
         if (NS_FAILED(rv))
            return rv;
         mState = kFindingChanges;
         if(mListener)
-            mListener->OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_START, false);
+            mListener->OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_START, false);
     }
     else {
         rv = mQuery->QueryAllEntries();
         if (NS_FAILED(rv))
            return rv;
         mState = kReplicatingAll;
         if(mListener)
-            mListener->OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_START, true);
+            mListener->OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_START, true);
     }
 
     rv = mDirectory->SetLastChangeNumber(mRootDSEEntry.lastChangeNumber);
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = mDirectory->SetDataVersion(mRootDSEEntry.dataVersion);
 
     return rv;
@@ -415,17 +415,17 @@ nsresult nsAbLDAPProcessChangeLogData::P
                 if (!Compare(nsDependentString(vals[0]), NS_LITERAL_STRING("delete"), nsCaseInsensitiveStringComparator()))
                     operation = ENTRY_DELETE;
             }
         }
     }
 
     mChangeLogEntriesCount++;
     if(!(mChangeLogEntriesCount % 10)) { // Inform the listener every 10 entries
-        mListener->OnProgressChange(nsnull,nsnull,mChangeLogEntriesCount, -1, mChangeLogEntriesCount, -1);
+        mListener->OnProgressChange(nullptr,nullptr,mChangeLogEntriesCount, -1, mChangeLogEntriesCount, -1);
         // In case if the LDAP Connection thread is starved and causes problem
         // uncomment this one and try.
         // PR_Sleep(PR_INTERVAL_NO_WAIT); // give others a chance
     }
 
 #ifdef DEBUG_rdayal
     printf ("ChangeLog Replication : Updated Entry : %s for OpType : %u\n", 
                                     NS_ConvertUTF16toUTF8(targetDN).get(), operation);
@@ -497,17 +497,17 @@ nsresult nsAbLDAPProcessChangeLogData::O
 
     // Decrement the count first to get the correct array element
     mEntriesAddedQueryCount--;
     rv = mChangeLogQuery->QueryChangedEntries(NS_ConvertUTF16toUTF8(*(mEntriesToAdd[mEntriesAddedQueryCount])));
     if (NS_FAILED(rv))
         return rv;
 
     if(mListener && NS_SUCCEEDED(rv))
-        mListener->OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_START, true);
+        mListener->OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_START, true);
 
     mState = kReplicatingChanges;
     return rv;
 }
 
 nsresult nsAbLDAPProcessChangeLogData::OnReplicatingChangeDone()
 {
     if(!mInitialized) 
--- a/mailnews/addrbook/src/nsAbLDAPChangeLogQuery.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPChangeLogQuery.cpp
@@ -102,17 +102,17 @@ NS_IMETHODIMP nsAbLDAPChangeLogQuery::Qu
         return rv;
 
     rv = CreateNewLDAPOperation();
     NS_ENSURE_SUCCESS(rv, rv);
 
     // XXX We really should be using LDAP_NO_ATTRS here once its exposed via
     // the XPCOM layer of the directory code.
     return mOperation->SearchExt(dn, nsILDAPURL::SCOPE_SUBTREE, filter, 
-                               0, nsnull,
+                               0, nullptr,
                                0, 0);
 }
 
 NS_IMETHODIMP nsAbLDAPChangeLogQuery::QueryRootDSE()
 {
     if(!mInitialized) 
         return NS_ERROR_NOT_INITIALIZED;
 
--- a/mailnews/addrbook/src/nsAbLDAPDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPDirectory.cpp
@@ -167,17 +167,17 @@ NS_IMETHODIMP nsAbLDAPDirectory::GetIsQu
 NS_IMETHODIMP nsAbLDAPDirectory::HasCard(nsIAbCard* card, bool* hasCard)
 {
   nsresult rv = Initiate ();
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Enter lock
   MutexAutoLock lock (mLock);
 
-  *hasCard = mCache.Get(card, nsnull);
+  *hasCard = mCache.Get(card, nullptr);
   if (!*hasCard && mPerformingQuery)
     return NS_ERROR_NOT_AVAILABLE;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAbLDAPDirectory::GetLDAPURL(nsILDAPURL** aResult)
 {
@@ -213,17 +213,17 @@ NS_IMETHODIMP nsAbLDAPDirectory::GetLDAP
       URI.Replace(0, kLDAPDirectoryRootLen, NS_LITERAL_CSTRING("ldap://"));
   }
 
   nsCOMPtr<nsIIOService> ioService =
     mozilla::services::GetIOService();
   NS_ENSURE_TRUE(ioService, NS_ERROR_UNEXPECTED);
 
   nsCOMPtr<nsIURI> result;
-  rv = ioService->NewURI(URI, nsnull, nsnull, getter_AddRefs(result));
+  rv = ioService->NewURI(URI, nullptr, nullptr, getter_AddRefs(result));
   NS_ENSURE_SUCCESS(rv, rv);
 
   return CallQueryInterface(result, aResult);
 }
 
 NS_IMETHODIMP nsAbLDAPDirectory::SetLDAPURL(nsILDAPURL *aUrl)
 {
   NS_ENSURE_ARG_POINTER(aUrl);
@@ -804,17 +804,17 @@ NS_IMETHODIMP nsAbLDAPDirectory::DeleteC
     
     rv = card->GetDn(cardDN);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsIAbCard> realCard(do_QueryInterface(card));
     realCard->SetDirectoryId(EmptyCString());
    
     // Launch query
-    rv = DoModify(this, nsILDAPModification::MOD_DELETE, cardDN, nsnull,
+    rv = DoModify(this, nsILDAPModification::MOD_DELETE, cardDN, nullptr,
                   EmptyCString(), EmptyCString());
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAbLDAPDirectory::ModifyCard(nsIAbCard *aUpdatedCard)
@@ -923,17 +923,17 @@ nsresult nsAbLDAPDirectory::SplitStringL
   char ***aValues)
 {
   NS_ENSURE_ARG_POINTER(aCount);
   NS_ENSURE_ARG_POINTER(aValues);
 
   nsTArray<nsCString> strarr;
   ParseString(aString, ',', strarr);
 
-  char **cArray = nsnull;
+  char **cArray = nullptr;
   if (!(cArray = static_cast<char **>(nsMemory::Alloc(
       strarr.Length() * sizeof(char *)))))
     return NS_ERROR_OUT_OF_MEMORY;
 
   for (PRUint32 i = 0; i < strarr.Length(); ++i)
   {
     if (!(cArray[i] = ToNewCString(strarr[i])))
     {
--- a/mailnews/addrbook/src/nsAbLDAPDirectoryModify.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPDirectoryModify.cpp
@@ -197,17 +197,17 @@ void nsAbModifyLDAPMessageListener::Init
 nsresult nsAbModifyLDAPMessageListener::DoTask()
 {
   nsresult rv;
   mCanceled = mFinished = false;
 
   mModifyOperation = do_CreateInstance(NS_LDAPOPERATION_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = mModifyOperation->Init (mConnection, this, nsnull);
+  rv = mModifyOperation->Init (mConnection, this, nullptr);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // XXX do we need the search controls?
   rv = mModifyOperation->SetServerControls(mServerSearchControls);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = mModifyOperation->SetClientControls(mClientSearchControls);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -362,11 +362,11 @@ nsresult nsAbLDAPDirectoryModify::DoModi
                                       login,
                                       0);
   if (_messageListener == NULL)
     return NS_ERROR_OUT_OF_MEMORY;
   
   // Now lets initialize the LDAP connection properly. We'll kick
   // off the bind operation in the callback function, |OnLDAPInit()|.
   return ldapConnection->Init(currentUrl, login,
-                              _messageListener, nsnull, protocolVersion);
+                              _messageListener, nullptr, protocolVersion);
 }
 
--- a/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp
@@ -199,17 +199,17 @@ NS_IMETHODIMP nsAbQueryLDAPMessageListen
 nsresult nsAbQueryLDAPMessageListener::DoTask()
 {
   nsresult rv;
   mCanceled = mFinished = false;
 
   mOperation = do_CreateInstance(NS_LDAPOPERATION_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = mOperation->Init(mConnection, this, nsnull);
+  rv = mOperation->Init(mConnection, this, nullptr);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCAutoString dn;
   rv = mSearchUrl->GetDn(dn);
   NS_ENSURE_SUCCESS(rv, rv);
 
   PRInt32 scope;
   rv = mSearchUrl->GetScope(&scope);
@@ -547,17 +547,17 @@ NS_IMETHODIMP nsAbLDAPDirectoryQuery::Do
     return NS_ERROR_OUT_OF_MEMORY;
   
   mListener = _messageListener;
   *_retval = 1;
 
   // Now lets initialize the LDAP connection properly. We'll kick
   // off the bind operation in the callback function, |OnLDAPInit()|.
   rv = mConnection->Init(mDirectoryUrl, mCurrentLogin,
-                         mListener, nsnull, mCurrentProtocolVersion);
+                         mListener, nullptr, mCurrentProtocolVersion);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return rv;
 }
 
 /* void stopQuery (in long contextID); */
 NS_IMETHODIMP nsAbLDAPDirectoryQuery::StopQuery(PRInt32 contextID)
 {
--- a/mailnews/addrbook/src/nsAbLDAPListenerBase.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPListenerBase.cpp
@@ -157,17 +157,17 @@ NS_IMETHODIMP nsAbLDAPListenerBase::OnLD
       return rv;
     }
 
     // get the addressbook window, as it will be used to parent the auth
     // prompter dialog
     //
     nsCOMPtr<nsIDOMWindow> abDOMWindow;
     rv = windowWatcherSvc->GetWindowByName(NS_LITERAL_STRING("addressbookWindow").get(),
-                                           nsnull,
+                                           nullptr,
                                            getter_AddRefs(abDOMWindow));
     if (NS_FAILED(rv))
     {
       NS_ERROR("nsAbLDAPListenerBase::OnLDAPInit():"
                " error getting addressbook Window");
       InitFailed();
       return rv;
     }
@@ -226,17 +226,17 @@ NS_IMETHODIMP nsAbLDAPListenerBase::OnLD
   mOperation = do_CreateInstance(NS_LDAPOPERATION_CONTRACTID, &rv);
   if (NS_FAILED(rv))
   {
     NS_ERROR("nsAbLDAPMessageBase::OnLDAPInit(): failed to create ldap operation");
     InitFailed();
     return rv;
   }
 
-  rv = mOperation->Init(mConnection, this, nsnull);
+  rv = mOperation->Init(mConnection, this, nullptr);
   if (NS_FAILED(rv))
   {
     NS_ERROR("nsAbLDAPMessageBase::OnLDAPInit(): failed to Initialise operation");
     InitFailed();
     return rv;
   }
 
   // Try non-password mechanisms first
@@ -328,17 +328,17 @@ nsresult nsAbLDAPListenerBase::OnLDAPMes
         }
       }
       NS_FREE_XPCOM_ISUPPORTS_POINTER_ARRAY(count, logins);
 
       // XXX We should probably pop up an error dialog telling
       // the user that the login failed here, rather than just bringing 
       // up the password dialog again, which is what calling OnLDAPInit()
       // does.
-      return OnLDAPInit(nsnull, NS_OK);
+      return OnLDAPInit(nullptr, NS_OK);
     }
 
     // Don't know how to handle this, so use the message error code in
     // the failure return value so we hopefully get it back to the UI.
     return NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, errCode);
   }
 
   mBound = true;
--- a/mailnews/addrbook/src/nsAbLDAPListenerBase.h
+++ b/mailnews/addrbook/src/nsAbLDAPListenerBase.h
@@ -14,18 +14,18 @@
 #include "nsStringGlue.h"
 #include "mozilla/Mutex.h"
 
 class nsAbLDAPListenerBase : public nsILDAPMessageListener
 {
 public:
   // Note that the directoryUrl is the details of the ldap directory
   // without any search params or attributes specified.
-  nsAbLDAPListenerBase(nsILDAPURL* directoryUrl = nsnull,
-                       nsILDAPConnection* connection = nsnull,
+  nsAbLDAPListenerBase(nsILDAPURL* directoryUrl = nullptr,
+                       nsILDAPConnection* connection = nullptr,
                        const nsACString &login = EmptyCString(),
                        const PRInt32 timeOut = 0);
   virtual ~nsAbLDAPListenerBase();
 
   NS_IMETHOD OnLDAPInit(nsILDAPConnection *aConn, nsresult aStatus);
 
 protected:
   nsresult OnLDAPMessageBind(nsILDAPMessage *aMessage);
--- a/mailnews/addrbook/src/nsAbLDAPReplicationData.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPReplicationData.cpp
@@ -51,29 +51,29 @@ NS_IMETHODIMP nsAbLDAPProcessReplication
   mConnection = aConnection;
   mDirectoryUrl = aURL;
   mQuery = aQuery;
 
   mListener = aProgressListener;
 
   nsresult rv = mDirectory->GetAttributeMap(getter_AddRefs(mAttrMap));
   if (NS_FAILED(rv)) {
-    mQuery = nsnull;
+    mQuery = nullptr;
     return rv;
   }
 
   rv = mDirectory->GetAuthDn(mLogin);
   if (NS_FAILED(rv)) {
-    mQuery = nsnull;
+    mQuery = nullptr;
     return rv;
   }
   
   rv = mDirectory->GetSaslMechanism(mSaslMechanism);
   if (NS_FAILED(rv)) {
-    mQuery = nsnull;
+    mQuery = nullptr;
     return rv;
   }
 
   mInitialized = true;
 
   return rv;
 }
 
@@ -148,17 +148,17 @@ NS_IMETHODIMP nsAbLDAPProcessReplication
     // delete the unsaved replication file
     if (mReplicationFile) {
       rv = mReplicationFile->Remove(false);
       if (NS_SUCCEEDED(rv) && mDirectory) {
         nsCAutoString fileName;
         rv = mDirectory->GetReplicationFileName(fileName);
         // now put back the backed up replicated file if aborted
         if (NS_SUCCEEDED(rv) && mBackupReplicationFile)
-          rv = mBackupReplicationFile->MoveToNative(nsnull, fileName);
+          rv = mBackupReplicationFile->MoveToNative(nullptr, fileName);
       }
     }
   }
 
   Done(false);
 
   return rv;
 }
@@ -171,17 +171,17 @@ nsresult nsAbLDAPProcessReplicationData:
   nsresult rv = OpenABForReplicatedDir(true);
   if (NS_FAILED(rv))
     // do not call done here since it is called by OpenABForReplicationDir
     return rv;
 
   mOperation = do_CreateInstance(NS_LDAPOPERATION_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = mOperation->Init(mConnection, this, nsnull);
+  rv = mOperation->Init(mConnection, this, nullptr);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // get the relevant attributes associated with the directory server url
   nsCAutoString urlFilter;
   rv = mDirectoryUrl->GetFilter(urlFilter);
   if (NS_FAILED(rv))
     return rv;
 
@@ -201,17 +201,17 @@ nsresult nsAbLDAPProcessReplicationData:
   nsCAutoString attributes;
   rv = mDirectoryUrl->GetAttributes(attributes);
   if (NS_FAILED(rv))
     return rv;
 
   mState = kReplicatingAll;
 
   if (mListener && NS_SUCCEEDED(rv))
-    mListener->OnStateChange(nsnull, nsnull,
+    mListener->OnStateChange(nullptr, nullptr,
                              nsIWebProgressListener::STATE_START, true);
 
   return mOperation->SearchExt(dn, scope, urlFilter, attributes, 0, 0);
 }
 
 void nsAbLDAPProcessReplicationData::InitFailed(bool aCancelled)
 {
   // Just call Done() which will ensure everything is tidied up nicely.
@@ -244,42 +244,42 @@ nsresult nsAbLDAPProcessReplicationData:
     if (NS_FAILED(rv))
     {
         NS_WARNING("nsAbLDAPProcessReplicationData::OnLDAPSearchEntry"
            "No card properties could be set");
         // if some entries are bogus for us, continue with next one
         return NS_OK;
     }
 
-    rv = mReplicationDB->CreateNewCardAndAddToDB(newCard, false, nsnull);
+    rv = mReplicationDB->CreateNewCardAndAddToDB(newCard, false, nullptr);
     if(NS_FAILED(rv)) {
         Abort();
         return rv;
     }
 
     // now set the attribute for the DN of the entry in the card in the DB
     nsCAutoString authDN;
     rv = aMessage->GetDn(authDN);
     if(NS_SUCCEEDED(rv) && !authDN.IsEmpty())
     {
         newCard->SetPropertyAsAUTF8String("_DN", authDN);
     }
 
-    rv = mReplicationDB->EditCard(newCard, false, nsnull);
+    rv = mReplicationDB->EditCard(newCard, false, nullptr);
     if(NS_FAILED(rv)) {
         Abort();
         return rv;
     }
     
 
     mCount ++;
 
     if (mListener && !(mCount % 10)) // inform the listener every 10 entries
     {
-        mListener->OnProgressChange(nsnull,nsnull,mCount, -1, mCount, -1);
+        mListener->OnProgressChange(nullptr,nullptr,mCount, -1, mCount, -1);
         // in case if the LDAP Connection thread is starved and causes problem
         // uncomment this one and try.
         // PR_Sleep(PR_INTERVAL_NO_WAIT); // give others a chance
     }
 
     return rv;
 }
 
@@ -330,17 +330,17 @@ nsresult nsAbLDAPProcessReplicationData:
             if(NS_SUCCEEDED(rv)) {
                 // now put back the backed up replicated file
                 if(mBackupReplicationFile && mDirectory) 
                 {
                   nsCAutoString fileName;
                   rv = mDirectory->GetReplicationFileName(fileName);
                   if (NS_SUCCEEDED(rv) && !fileName.IsEmpty())
                   {
-                    rv = mBackupReplicationFile->MoveToNative(nsnull, fileName);
+                    rv = mBackupReplicationFile->MoveToNative(nullptr, fileName);
                     NS_ASSERTION(NS_SUCCEEDED(rv), "Replication Backup File Move back on Failure failed");
                   }
                 }
             }
         }
         Done(false);
     }
 
@@ -405,27 +405,27 @@ nsresult nsAbLDAPProcessReplicationData:
             Done(false);
             return rv;
         }
 
         if(aCreate) {
             // set backup file to existing replication file for move
             mBackupReplicationFile->SetNativeLeafName(fileName);
 
-            rv = mBackupReplicationFile->MoveTo(nsnull, backupFileLeafName);
+            rv = mBackupReplicationFile->MoveTo(nullptr, backupFileLeafName);
             // set the backup file leaf name now
             if (NS_SUCCEEDED(rv))
                 mBackupReplicationFile->SetLeafName(backupFileLeafName);
         }
         else {
             // set backup file to existing replication file for copy
             mBackupReplicationFile->SetNativeLeafName(fileName);
 
             // specify the parent here specifically, 
-            // passing nsnull to copy to the same dir actually renames existing file
+            // passing nullptr to copy to the same dir actually renames existing file
             // instead of making another copy of the existing file.
             nsCOMPtr<nsIFile> parent;
             rv = mBackupReplicationFile->GetParent(getter_AddRefs(parent));
             if (NS_SUCCEEDED(rv))
                 rv = mBackupReplicationFile->CopyTo(parent, backupFileLeafName);
             // set the backup file leaf name now
             if (NS_SUCCEEDED(rv))
                 mBackupReplicationFile->SetLeafName(backupFileLeafName);
@@ -463,22 +463,22 @@ void nsAbLDAPProcessReplicationData::Don
        return;
 
    mState = kReplicationDone;
 
    if (mQuery)
      mQuery->Done(aSuccess);
 
    if (mListener)
-       mListener->OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_STOP, aSuccess);
+       mListener->OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, aSuccess);
 
    // since this is called when all is done here, either on success,
    // failure or abort release the query now.
-   mQuery = nsnull;
+   mQuery = nullptr;
 }
 
 nsresult nsAbLDAPProcessReplicationData::DeleteCard(nsString & aDn)
 {
     nsCOMPtr<nsIAbCard> cardToDelete;
-    mReplicationDB->GetCardFromAttribute(nsnull, "_DN", NS_ConvertUTF16toUTF8(aDn),
+    mReplicationDB->GetCardFromAttribute(nullptr, "_DN", NS_ConvertUTF16toUTF8(aDn),
                                          false, getter_AddRefs(cardToDelete));
-    return mReplicationDB->DeleteCard(cardToDelete, false, nsnull);
+    return mReplicationDB->DeleteCard(cardToDelete, false, nullptr);
 }
--- a/mailnews/addrbook/src/nsAbLDAPReplicationQuery.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPReplicationQuery.cpp
@@ -94,17 +94,17 @@ nsresult nsAbLDAPReplicationQuery::Conne
         replicationState != nsIAbLDAPProcessReplicationData::kIdle)
         return rv;
 
     PRUint32 protocolVersion;
     rv = mDirectory->GetProtocolVersion(&protocolVersion);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // initialize the LDAP connection
-    return mConnection->Init(mURL, mLogin, mDp, nsnull, protocolVersion);
+    return mConnection->Init(mURL, mLogin, mDp, nullptr, protocolVersion);
 }
 
 NS_IMETHODIMP nsAbLDAPReplicationQuery::Init(nsIAbLDAPDirectory *aDirectory,
                                              nsIWebProgressListener *aProgressListener)
 {
   NS_ENSURE_ARG_POINTER(aDirectory);
 
   mDirectory = aDirectory;
--- a/mailnews/addrbook/src/nsAbLDAPReplicationService.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPReplicationService.cpp
@@ -69,24 +69,24 @@ NS_IMETHODIMP nsAbLDAPReplicationService
 	{
 	  mReplicating = true;
 	  return rv;
 	}
     }
   }
 
   if (progressListener && NS_FAILED(rv))
-    progressListener->OnStateChange(nsnull, nsnull,
+    progressListener->OnStateChange(nullptr, nullptr,
 				    nsIWebProgressListener::STATE_STOP,
 				    false);
 
   if (NS_FAILED(rv))
   {
-    mDirectory = nsnull;
-    mQuery = nsnull;
+    mDirectory = nullptr;
+    mQuery = nullptr;
   }
 
   return rv;
 }
 
 /* void cancelReplication(in string aURI); */
 NS_IMETHODIMP nsAbLDAPReplicationService::CancelReplication(nsIAbLDAPDirectory *aDirectory)
 {
@@ -107,18 +107,18 @@ NS_IMETHODIMP nsAbLDAPReplicationService
   return rv;
 }
 
 NS_IMETHODIMP nsAbLDAPReplicationService::Done(bool aSuccess)
 {
   mReplicating = false;
   if (mQuery)
   {
-    mQuery = nsnull;  // Release query obj
-    mDirectory = nsnull; // Release directory
+    mQuery = nullptr;  // Release query obj
+    mDirectory = nullptr; // Release directory
   }
 
   return NS_OK;
 }
 
 
 // XXX: This method should query the RootDSE for the changeLog attribute,
 // if it exists ChangeLog protocol is supported.
--- a/mailnews/addrbook/src/nsAbLDIFService.cpp
+++ b/mailnews/addrbook/src/nsAbLDIFService.cpp
@@ -273,18 +273,18 @@ nsresult nsAbLDIFService::str_parse_line
  * which it updates and must be supplied on subsequent calls.
  */
 
 char* nsAbLDIFService::str_getline(char **next) const
 {
   char    *lineStr;
   char    c;
 
-  if ( *next == nsnull || **next == '\n' || **next == '\0' ) {
-    return( nsnull);
+  if ( *next == nullptr || **next == '\n' || **next == '\0' ) {
+    return( nullptr);
   }
 
   lineStr = *next;
   while ( (*next = PL_strchr( *next, '\n' )) != NULL ) {
     c = *(*next + 1);
     if ( isspace( c ) && c != '\n' ) {
       **next = CONTINUED_LINE_MARKER;
       *(*next+1) = CONTINUED_LINE_MARKER;
@@ -363,17 +363,17 @@ void nsAbLDIFService::AddLdifRowToDataba
     return;
 
   char* cursor = ToNewCString(mLdifLine); 
   char* saveCursor = cursor;  /* keep for deleting */ 
   char* line = 0; 
   char* typeSlot = 0; 
   char* valueSlot = 0; 
   int length = 0;  // the length  of an ldif attribute
-  while ( (line = str_getline(&cursor)) != nsnull)
+  while ( (line = str_getline(&cursor)) != nullptr)
   {
     if ( str_parse_line(line, &typeSlot, &valueSlot, &length) == 0) {
       AddLdifColToDatabase(aDatabase, newRow, typeSlot, valueSlot, bIsList);
     }
     else
       continue; // parse error: continue with next loop iteration
   }
   nsMemory::Free(saveCursor);
@@ -751,17 +751,17 @@ void nsAbLDIFService::ClearLdifRecordBuf
 // then it is most likely NOT an ldif file!
 static const char *const sLDIFFields[] = {
     "objectclass",
     "sn",
     "dn",
     "cn",
     "givenName",
     "mail",
-    nsnull
+    nullptr
 };
 #define kMaxLDIFLen        14
 
 // Count total number of legal ldif fields and records in the first 100 lines of the 
 // file and if the average legal ldif field is 3 or higher than it's a valid ldif file.
 NS_IMETHODIMP nsAbLDIFService::IsLDIFFile(nsIFile *pSrc, bool *_retval)
 {
   NS_ENSURE_ARG_POINTER(pSrc);
--- a/mailnews/addrbook/src/nsAbMDBDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbMDBDirectory.cpp
@@ -205,17 +205,17 @@ NS_IMETHODIMP nsAbMDBDirectory::DeleteDi
 }
 
 nsresult nsAbMDBDirectory::NotifyItemChanged(nsISupports *item)
 {
   nsresult rv;
   nsCOMPtr<nsIAbManager> abManager = do_GetService(NS_ABMANAGER_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv,rv);
 
-  rv = abManager->NotifyItemPropertyChanged(item, nsnull, nsnull, nsnull);
+  rv = abManager->NotifyItemPropertyChanged(item, nullptr, nullptr, nullptr);
   NS_ENSURE_SUCCESS(rv,rv);
   return rv;
 }
 
 nsresult nsAbMDBDirectory::NotifyPropertyChanged(nsIAbDirectory *list, const char *property, const PRUnichar* oldValue, const PRUnichar* newValue)
 {
   nsresult rv;
   nsCOMPtr<nsISupports> supports = do_QueryInterface(list, &rv);
@@ -253,17 +253,17 @@ nsresult nsAbMDBDirectory::NotifyItemDel
 NS_IMETHODIMP nsAbMDBDirectory::ClearDatabase()
 {       
   if (mIsQueryURI)
     return NS_ERROR_NOT_IMPLEMENTED;
 
   if (mDatabase)
   {
     mDatabase->RemoveListener(this);
-    mDatabase = nsnull; 
+    mDatabase = nullptr; 
   }
   return NS_OK; 
 }
 
 NS_IMETHODIMP nsAbMDBDirectory::RemoveElementsFromAddressList()
 {
   if (mIsQueryURI)
     return NS_ERROR_NOT_IMPLEMENTED;
@@ -273,17 +273,17 @@ NS_IMETHODIMP nsAbMDBDirectory::RemoveEl
     PRUint32 count;
     nsresult rv;
     rv = m_AddressList->GetLength(&count);
     NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed");
     PRInt32 i;
     for (i = count - 1; i >= 0; i--)
       m_AddressList->RemoveElementAt(i);
   }
-  m_AddressList = nsnull;
+  m_AddressList = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAbMDBDirectory::RemoveEmailAddressAt(PRUint32 aIndex)
 {
   if (mIsQueryURI)
     return NS_ERROR_NOT_IMPLEMENTED;
 
@@ -544,17 +544,17 @@ NS_IMETHODIMP nsAbMDBDirectory::DeleteCa
 
 NS_IMETHODIMP nsAbMDBDirectory::HasCard(nsIAbCard *cards, bool *hasCard)
 {
   if(!hasCard)
     return NS_ERROR_NULL_POINTER;
 
   if (mIsQueryURI)
   {
-    *hasCard = mSearchCache.Get(cards, nsnull);
+    *hasCard = mSearchCache.Get(cards, nullptr);
     return NS_OK;
   }
 
   nsresult rv = NS_OK;
   if (!mDatabase)
     rv = GetAbDatabase();
 
   if(NS_SUCCEEDED(rv) && mDatabase)
@@ -851,17 +851,17 @@ NS_IMETHODIMP nsAbMDBDirectory::OnListEn
     nsCOMPtr<nsIAbMDBDirectory> dblist(do_QueryInterface(list, &rv));
     NS_ENSURE_SUCCESS(rv,rv);
 
     if (bIsMailList) {
       nsString listName;
       rv = list->GetDirName(listName);
       NS_ENSURE_SUCCESS(rv,rv);
 
-      rv = NotifyPropertyChanged(list, "DirName", nsnull, listName.get());
+      rv = NotifyPropertyChanged(list, "DirName", nullptr, listName.get());
       NS_ENSURE_SUCCESS(rv,rv);
     }
   }
   return rv;
 }
 
 NS_IMETHODIMP nsAbMDBDirectory::OnAnnouncerGoingAway()
 {
@@ -1058,17 +1058,17 @@ NS_IMETHODIMP nsAbMDBDirectory::CardForE
 NS_IMETHODIMP nsAbMDBDirectory::GetCardFromProperty(const char *aProperty,
                                                     const nsACString &aValue,
                                                     bool caseSensitive,
                                                     nsIAbCard **result)
 {
   NS_ENSURE_ARG(aProperty);
   NS_ENSURE_ARG_POINTER(result);
 
-  *result = nsnull;
+  *result = nullptr;
 
   // If the value is empty, don't match.
   if (aValue.IsEmpty())
     return NS_OK;
 
   nsresult rv;
   if (!mDatabase)
   {
@@ -1087,17 +1087,17 @@ NS_IMETHODIMP nsAbMDBDirectory::GetCardF
 NS_IMETHODIMP nsAbMDBDirectory::GetCardsFromProperty(const char *aProperty,
                                                      const nsACString &aValue,
                                                      bool caseSensitive,
                                                      nsISimpleEnumerator **result)
 {
   NS_ENSURE_ARG(aProperty);
   NS_ENSURE_ARG_POINTER(result);
 
-  *result = nsnull;
+  *result = nullptr;
 
   if (aValue.IsEmpty())
     return NS_OK;
 
   if (!mDatabase)
   {
     nsresult rv = GetAbDatabase();
     if (rv == NS_ERROR_FILE_NOT_FOUND)
--- a/mailnews/addrbook/src/nsAbManager.cpp
+++ b/mailnews/addrbook/src/nsAbManager.cpp
@@ -421,17 +421,17 @@ NS_IMETHODIMP nsAbManager::NotifyDirecto
   NOTIFY_AB_LISTENERS(directoryRemoved, OnItemRemoved,
                       (aParentDirectory, aDirectory));
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAbManager::GetUserProfileDirectory(nsIFile **userDir)
 {
   NS_ENSURE_ARG_POINTER(userDir);
-  *userDir = nsnull;
+  *userDir = nullptr;
 
   nsresult rv;
   nsCOMPtr<nsIFile> profileDir;
   nsCAutoString pathBuf;
 
   rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(profileDir));
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -1091,17 +1091,17 @@ nsresult nsAbManager::AppendProperty(con
   aResult += aProperty;
 
   // if the string is not safe "as is", base64 encode it
   if (IsSafeLDIFString(aValue)) {
     aResult.AppendLiteral(": ");
     aResult.Append(NS_LossyConvertUTF16toASCII(aValue));
   }
   else {
-    char *base64Str = PL_Base64Encode(NS_ConvertUTF16toUTF8(aValue).get(), 0, nsnull);
+    char *base64Str = PL_Base64Encode(NS_ConvertUTF16toUTF8(aValue).get(), 0, nullptr);
     if (!base64Str)
       return NS_ERROR_OUT_OF_MEMORY;
 
     aResult.AppendLiteral(":: ");
     aResult.Append(nsDependentCString(base64Str));
     PR_Free(base64Str);
   }
 
@@ -1241,18 +1241,18 @@ nsAbManager::Handle(nsICommandLine* aCmd
 
   if (!found)
     return NS_OK;
 
   nsCOMPtr<nsIWindowWatcher> wwatch (do_GetService(NS_WINDOWWATCHER_CONTRACTID));
   NS_ENSURE_TRUE(wwatch, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsIDOMWindow> opened;
-  wwatch->OpenWindow(nsnull, "chrome://messenger/content/addressbook/addressbook.xul",
-                     "_blank", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar", nsnull, getter_AddRefs(opened));
+  wwatch->OpenWindow(nullptr, "chrome://messenger/content/addressbook/addressbook.xul",
+                     "_blank", "chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar", nullptr, getter_AddRefs(opened));
   aCmdLine->SetPreventDefault(true);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAbManager::GetHelpInfo(nsACString& aResult)
 {
   aResult.Assign(NS_LITERAL_CSTRING("  -addressbook       Open the address book at startup.\n"));
--- a/mailnews/addrbook/src/nsAbOSXDirFactory.cpp
+++ b/mailnews/addrbook/src/nsAbOSXDirFactory.cpp
@@ -17,17 +17,17 @@ NS_IMPL_ISUPPORTS1(nsAbOSXDirFactory, ns
 NS_IMETHODIMP
 nsAbOSXDirFactory::GetDirectories(const nsAString &aDirName,
                                   const nsACString &aURI,
                                   const nsACString &aPrefName,
                                   nsISimpleEnumerator **aDirectories)
 {
   NS_ENSURE_ARG_POINTER(aDirectories);
   
-  *aDirectories = nsnull;
+  *aDirectories = nullptr;
 
   nsresult rv;
   nsCOMPtr<nsIAbManager> abManager(do_GetService(NS_ABMANAGER_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIAbDirectory> directory;
   rv = abManager->GetDirectory(NS_LITERAL_CSTRING(NS_ABOSXDIRECTORY_URI_PREFIX "/"),
                                getter_AddRefs(directory));
--- a/mailnews/addrbook/src/nsAbOSXDirectory.mm
+++ b/mailnews/addrbook/src/nsAbOSXDirectory.mm
@@ -375,25 +375,25 @@ BuildSearchElements(nsIAbBooleanExpressi
   
   PRUint32 count;
   rv = expressions->GetLength(&count);
   NS_ENSURE_SUCCESS(rv, rv);
   
   NS_ASSERTION(count > 1 && operation != nsIAbBooleanOperationTypes::NOT,
                "This doesn't make sense!");
   
-  NSMutableArray *array = nsnull;
+  NSMutableArray *array = nullptr;
   if (count > 1)
     array = [[NSMutableArray alloc] init];
   
   PRUint32 i;
   nsCOMPtr<nsIAbBooleanConditionString> condition;
   nsCOMPtr<nsIAbBooleanExpression> subExpression;
   for (i = 0; i < count; ++i) {
-    ABSearchElement *element = nsnull;
+    ABSearchElement *element = nullptr;
     
     condition = do_QueryElementAt(expressions, i);
     if (condition) {
       rv = MapConditionString(condition, operation == nsIAbBooleanOperationTypes::NOT, aCanHandle, &element);
       if (NS_FAILED(rv))
         break;
     }
     else {
@@ -440,17 +440,17 @@ Search(nsIAbBooleanExpression *aExpressi
   
   if (canHandle)
     *aResult = [[ABAddressBook sharedAddressBook] recordsMatchingSearchElement:searchElement];
 
   return canHandle;
 }
 
 static PRUint32 sObserverCount = 0;
-static ABChangedMonitor *sObserver = nsnull;
+static ABChangedMonitor *sObserver = nullptr;
 
 nsAbOSXDirectory::nsAbOSXDirectory()
 {
   mCardStore.Init(OSX_CARD_STORE_INIT);
 }
 
 nsAbOSXDirectory::~nsAbOSXDirectory()
 {
@@ -1010,17 +1010,17 @@ nsAbOSXDirectory::GetCardByUri(const nsA
 NS_IMETHODIMP
 nsAbOSXDirectory::GetCardFromProperty(const char *aProperty,
                                       const nsACString &aValue,
                                       bool aCaseSensitive,
                                       nsIAbCard **aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
-  *aResult = nsnull;
+  *aResult = nullptr;
 
   if (aValue.IsEmpty())
     return NS_OK;
 
   nsIMutableArray *list = m_IsMailList ? m_AddressList : mCardList;
 
   if (!list)
     return NS_OK;
@@ -1058,17 +1058,17 @@ nsAbOSXDirectory::GetCardFromProperty(co
 NS_IMETHODIMP
 nsAbOSXDirectory::GetCardsFromProperty(const char *aProperty,
                                        const nsACString &aValue,
                                        bool aCaseSensitive,
                                        nsISimpleEnumerator **aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
-  *aResult = nsnull;
+  *aResult = nullptr;
 
   if (aValue.IsEmpty())
     return NS_NewEmptyEnumerator(aResult);
 
   nsIMutableArray *list = m_IsMailList ? m_AddressList : mCardList;
 
   if (!list)
     return NS_NewEmptyEnumerator(aResult);
@@ -1106,17 +1106,17 @@ nsAbOSXDirectory::GetCardsFromProperty(c
 }
 
 NS_IMETHODIMP
 nsAbOSXDirectory::CardForEmailAddress(const nsACString &aEmailAddress,
                                       nsIAbCard **aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
-  *aResult = nsnull;
+  *aResult = nullptr;
 
   if (aEmailAddress.IsEmpty())
     return NS_OK;
 
   nsIMutableArray *list = m_IsMailList ? m_AddressList : mCardList;
 
   if (!list)
     return NS_OK;
--- a/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp
+++ b/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp
@@ -38,17 +38,17 @@ extern const char *kOutlookDirectorySche
 NS_IMETHODIMP
 nsAbOutlookDirFactory::GetDirectories(const nsAString &aDirName,
                                       const nsACString &aURI,
                                       const nsACString &aPrefName,
                                       nsISimpleEnumerator **aDirectories)
 {
   NS_ENSURE_ARG_POINTER(aDirectories);
 
-  *aDirectories = nsnull;
+  *aDirectories = nullptr;
   nsresult rv = NS_OK;
   nsCString stub;
   nsCString entry;
   nsAbWinType abType = getAbWinType(kOutlookDirectoryScheme,
                                     nsCString(aURI).get(), stub, entry);
 
   if (abType == nsAbWinType_Unknown) {
     return NS_ERROR_FAILURE;
--- a/mailnews/addrbook/src/nsAbOutlookDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbOutlookDirectory.cpp
@@ -31,17 +31,17 @@ static PRLogModuleInfo* gAbOutlookDirect
     = PR_NewLogModule("nsAbOutlookDirectoryLog");
 #endif
 
 #define PRINTF(args) PR_LOG(gAbOutlookDirectoryLog, PR_LOG_DEBUG, args)
 
 nsAbOutlookDirectory::nsAbOutlookDirectory(void)
   : nsAbDirProperty(),
   mCurrentQueryId(0), mSearchContext(-1),
-  mAbWinType(nsAbWinType_Unknown), mMapiData(nsnull)
+  mAbWinType(nsAbWinType_Unknown), mMapiData(nullptr)
 {
     mMapiData = new nsMapiEntry ;
     mProtector = PR_NewLock() ;
 }
 
 nsAbOutlookDirectory::~nsAbOutlookDirectory(void)
 {
     if (mMapiData) { delete mMapiData ; }
@@ -121,17 +121,17 @@ NS_IMETHODIMP nsAbOutlookDirectory::GetU
   aURI = mURI;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAbOutlookDirectory::GetChildNodes(nsISimpleEnumerator **aNodes)
 {
   NS_ENSURE_ARG_POINTER(aNodes);
 
-  *aNodes = nsnull;
+  *aNodes = nullptr;
     
   if (mIsQueryURI) {
     return NS_NewEmptyEnumerator(aNodes);
   }
 
   nsresult rv;
   nsCOMPtr<nsIMutableArray> nodeList(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
@@ -140,25 +140,25 @@ NS_IMETHODIMP nsAbOutlookDirectory::GetC
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_NewArrayEnumerator(aNodes, nodeList);
 }
 
 NS_IMETHODIMP nsAbOutlookDirectory::GetChildCards(nsISimpleEnumerator **aCards)
 {
   NS_ENSURE_ARG_POINTER(aCards);
-  *aCards = nsnull;
+  *aCards = nullptr;
 
   nsresult rv;
   nsCOMPtr<nsIMutableArray> cardList(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   mCardList.Clear();
 
-  rv = mIsQueryURI ? StartSearch() : GetChildCards(cardList, nsnull);
+  rv = mIsQueryURI ? StartSearch() : GetChildCards(cardList, nullptr);
 
   NS_ENSURE_SUCCESS(rv, rv);
   if (!m_AddressList)
   {
     m_AddressList = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
@@ -176,17 +176,17 @@ NS_IMETHODIMP nsAbOutlookDirectory::GetC
 
 
   for (PRUint32 i = 0; i < nbCards; ++i)
   {
     card = do_QueryElementAt(cardList, i, &rv);
     if (NS_FAILED(rv))
       continue;
 
-    if (!mCardList.Get(card, nsnull))
+    if (!mCardList.Get(card, nullptr))
     {
       // We are dealing with a new element (probably directly
       // added from Outlook), we may need to sync m_AddressList
       mCardList.Put(card, card);
 
       bool isMailList = false;
 
       rv = card->GetIsMailList(&isMailList);
@@ -222,17 +222,17 @@ NS_IMETHODIMP nsAbOutlookDirectory::GetI
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAbOutlookDirectory::HasCard(nsIAbCard *aCard, bool *aHasCard)
 {
   if (!aCard || !aHasCard)
     return NS_ERROR_NULL_POINTER;
 
-  *aHasCard = mCardList.Get(aCard, nsnull);
+  *aHasCard = mCardList.Get(aCard, nullptr);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAbOutlookDirectory::HasDirectory(nsIAbDirectory *aDirectory, bool *aHasDirectory)
 {
   NS_ENSURE_ARG_POINTER(aDirectory);
   NS_ENSURE_ARG_POINTER(aHasDirectory);
 
@@ -437,17 +437,17 @@ NS_IMETHODIMP nsAbOutlookDirectory::AddM
   nsCOMPtr<nsIAbDirectory> newList;
   rv = abManager->GetDirectory(uri, getter_AddRefs(newList));
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!didCopy)
   {
     rv = newList->CopyMailList(aMailList);
     NS_ENSURE_SUCCESS(rv, rv);
-    rv = newList->EditMailListToDatabase(nsnull);
+    rv = newList->EditMailListToDatabase(nullptr);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   if (!m_AddressList)
   {
     m_AddressList = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
   }
@@ -864,17 +864,17 @@ NS_IMETHODIMP nsAbOutlookDirectory::DoQu
                                             PRInt32 *aReturnValue)
 {
   if (!aArguments || !aListener || !aReturnValue)  { 
     return NS_ERROR_NULL_POINTER;
   }
   *aReturnValue = -1;
     
   QueryThreadArgs *threadArgs = new QueryThreadArgs;
-  PRThread *newThread = nsnull;
+  PRThread *newThread = nullptr;
 
   if (!threadArgs)
     return NS_ERROR_OUT_OF_MEMORY;
 
   nsresult rv = BuildRestriction(aArguments, threadArgs->mRestriction);
   NS_ENSURE_SUCCESS(rv, rv);
 
   threadArgs->mThis = this;
@@ -976,17 +976,17 @@ nsresult nsAbOutlookDirectory::ExecuteQu
 
   nsresult retCode = NS_OK;
 
   nsCOMPtr<nsIMutableArray> resultsArray(do_CreateInstance(NS_ARRAY_CONTRACTID,
                                                            &retCode));
   NS_ENSURE_SUCCESS(retCode, retCode);
 
   retCode = GetChildCards(resultsArray,
-                          aRestriction.rt == RES_COMMENT ? nsnull : &aRestriction);
+                          aRestriction.rt == RES_COMMENT ? nullptr : &aRestriction);
   NS_ENSURE_SUCCESS(retCode, retCode);
 
   PRUint32 nbResults = 0;
   retCode = resultsArray->GetLength(&nbResults);
   NS_ENSURE_SUCCESS(retCode, retCode);
 
   if (aResultLimit > 0 && nbResults > static_cast<PRUint32>(aResultLimit)) { 
     nbResults = static_cast<PRUint32>(aResultLimit) ; 
@@ -1119,17 +1119,17 @@ nsresult nsAbOutlookDirectory::CommitAdd
     return NS_ERROR_UNEXPECTED;
   }
 
   nsresult rv;
   PRUint32 i = 0;
   nsCOMPtr<nsIMutableArray> oldList(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = GetChildCards(oldList, nsnull);
+  rv = GetChildCards(oldList, nullptr);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!m_AddressList)
     return NS_ERROR_NULL_POINTER;
 
   PRUint32 nbCards = 0;
   rv = m_AddressList->GetLength(&nbCards);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -1162,24 +1162,24 @@ nsresult nsAbOutlookDirectory::UpdateAdd
 {
     if (!m_AddressList)
     {
 	nsresult rv;
         m_AddressList = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
         NS_ENSURE_SUCCESS(rv, rv);
     }
 
-    return m_IsMailList ? GetChildCards(m_AddressList, nsnull) :
+    return m_IsMailList ? GetChildCards(m_AddressList, nullptr) :
                           GetChildNodes(m_AddressList);
 }
 
 nsresult nsAbOutlookDirectory::CreateCard(nsIAbCard *aData, nsIAbCard **aNewCard) 
 {
     if (!aData || !aNewCard) { return NS_ERROR_NULL_POINTER ; }
-    *aNewCard = nsnull ;
+    *aNewCard = nullptr ;
     nsresult retCode = NS_OK ;
     nsAbWinHelperGuard mapiAddBook (mAbWinType) ;
     nsMapiEntry newEntry ;
     nsCAutoString entryString ;
     bool didCopy = false ;
 
     if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
     // If we get an nsIAbCard that maps onto an Outlook card uri
@@ -1254,34 +1254,34 @@ nsresult nsAbOutlookDirectory::CreateCar
     *aNewCard = newCard ;
     NS_ADDREF(*aNewCard) ;
     return retCode ;
 }
 
 static void UnicodeToWord(const PRUnichar *aUnicode, WORD& aWord)
 {
     aWord = 0 ;
-    if (aUnicode == nsnull || *aUnicode == 0) { return ; }
+    if (aUnicode == nullptr || *aUnicode == 0) { return ; }
     nsresult errorCode = NS_OK;
     nsAutoString unichar (aUnicode) ;
 
     aWord = static_cast<WORD>(unichar.ToInteger(&errorCode));
     if (NS_FAILED(errorCode)) {
         PRINTF(("Error conversion string %S: %08x.\n", unichar.get(), errorCode)) ;
     }
 }
 
 #define PREF_MAIL_ADDR_BOOK_LASTNAMEFIRST "mail.addr_book.lastnamefirst"
 
 
 NS_IMETHODIMP nsAbOutlookDirectory::ModifyCard(nsIAbCard *aModifiedCard)
 {
   NS_ENSURE_ARG_POINTER(aModifiedCard);
 
-  nsString *properties = nsnull;
+  nsString *properties = nullptr;
   nsAutoString utility;
   nsAbWinHelperGuard mapiAddBook(mAbWinType);
 
   if (!mapiAddBook->IsOK())
     return NS_ERROR_FAILURE;
 
   nsCString entry;
   nsresult retCode = ExtractCardEntry(aModifiedCard, entry);
@@ -1311,17 +1311,17 @@ NS_IMETHODIMP nsAbOutlookDirectory::Modi
     nsCOMPtr<nsIPrefBranch> prefBranch =
       do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv,rv);
 
     PRInt32 format;
     rv = prefBranch->GetIntPref(PREF_MAIL_ADDR_BOOK_LASTNAMEFIRST, &format);
     NS_ENSURE_SUCCESS(rv,rv);
 
-    rv = aModifiedCard->GenerateName(format, nsnull,
+    rv = aModifiedCard->GenerateName(format, nullptr,
                                      properties[index_DisplayName]);
     NS_ENSURE_SUCCESS(rv,rv);
 
     if (*properties[index_DisplayName].get() == 0) {
       aModifiedCard->GetPrimaryEmail(properties[index_DisplayName]);
     }
   }
   aModifiedCard->SetDisplayName(properties[index_DisplayName]);
--- a/mailnews/addrbook/src/nsAbView.cpp
+++ b/mailnews/addrbook/src/nsAbView.cpp
@@ -52,22 +52,22 @@ nsAbView::~nsAbView()
 {
   if (mInitialized) {
     NS_ASSERTION(NS_SUCCEEDED(ClearView()), "failed to close view");
   }
 }
 
 NS_IMETHODIMP nsAbView::ClearView()
 {
-  mDirectory = nsnull;
-  mAbViewListener = nsnull;
+  mDirectory = nullptr;
+  mAbViewListener = nullptr;
   if (mTree)
-    mTree->SetView(nsnull);
-  mTree = nsnull;
-  mTreeSelection = nsnull;
+    mTree->SetView(nullptr);
+  mTree = nullptr;
+  mTreeSelection = nullptr;
 
   if (mInitialized)
   {
     nsresult rv;
     mInitialized = false;
     nsCOMPtr<nsIPrefBranch> pbi(do_GetService(NS_PREFSERVICE_CONTRACTID,
                                               &rv));
     NS_ENSURE_SUCCESS(rv,rv);
@@ -161,22 +161,22 @@ NS_IMETHODIMP nsAbView::SetView(nsIAbDir
                                 nsIAbViewListener *aAbViewListener,
                                 const nsAString &aSortColumn,
                                 const nsAString &aSortDirection,
                                 nsAString &aResult)
 {
   // Ensure we are initialized
   nsresult rv = Initialize();
 
-  mAbViewListener = nsnull;
+  mAbViewListener = nullptr;
   if (mTree)
   {
     // Try and speed deletion of old cards by disconnecting the tree from us.
     mTreeSelection->ClearSelection();
-    mTree->SetView(nsnull);
+    mTree->SetView(nullptr);
   }
 
   // Clear out old cards
   PRInt32 i = mCards.Count();
   while(i-- > 0)
   {
     rv = RemoveCardAt(i);
     NS_ASSERTION(NS_SUCCEEDED(rv), "remove card failed\n");
@@ -544,17 +544,17 @@ NS_IMETHODIMP nsAbView::PerformActionOnR
 
 NS_IMETHODIMP nsAbView::PerformActionOnCell(const PRUnichar *action, PRInt32 row, nsITreeColumn* col)
 {
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP nsAbView::GetCardFromRow(PRInt32 row, nsIAbCard **aCard)
 {
-  *aCard = nsnull;  
+  *aCard = nullptr;  
   if (mCards.Count() <= row) {
     return NS_OK;
   }
 
   NS_ENSURE_TRUE(row >= 0, NS_ERROR_UNEXPECTED);
 
   AbCard *a = ((AbCard *)(mCards.ElementAt(row)));
   if (!a)
--- a/mailnews/addrbook/src/nsAbWinHelper.cpp
+++ b/mailnews/addrbook/src/nsAbWinHelper.cpp
@@ -249,17 +249,17 @@ nsAbWinHelper::nsAbWinHelper(void)
     mMutex = new mozilla::Mutex("nsAbWinHelper.mMutex");
 
   MOZ_COUNT_CTOR(nsAbWinHelper);
 }
 
 nsAbWinHelper::~nsAbWinHelper(void)
 {
   if (!--mUseCount)
-    mMutex = nsnull;
+    mMutex = nullptr;
   MOZ_COUNT_DTOR(nsAbWinHelper) ;
 }
 
 BOOL nsAbWinHelper::GetFolders(nsMapiEntryArray& aFolders)
 {
     aFolders.CleanUp() ;
     nsMapiInterfaceWrapper<LPABCONT> rootFolder ;
     nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
--- a/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
+++ b/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
@@ -126,17 +126,17 @@ nsAddbookProtocolHandler::NewChannel(nsI
   }
  
   if (mAddbookOperation == nsIAddbookUrlOperation::AddVCard) {
       // create an empty pipe for use with the input stream channel.
       nsCOMPtr<nsIAsyncInputStream> pipeIn;
       nsCOMPtr<nsIAsyncOutputStream> pipeOut;
       nsCOMPtr<nsIPipe> pipe = do_CreateInstance("@mozilla.org/pipe;1");
       
-      rv = pipe->Init(false, false, 0, 0, nsnull);
+      rv = pipe->Init(false, false, 0, 0, nullptr);
       NS_ENSURE_SUCCESS(rv, rv);
 
       pipe->GetInputStream(getter_AddRefs(pipeIn));
       pipe->GetOutputStream(getter_AddRefs(pipeOut));
       
       pipeOut->Close();
       
       return NS_NewInputStreamChannel(_retval, aURI, pipeIn,
@@ -247,17 +247,17 @@ nsAddbookProtocolHandler::BuildDirectory
     }
   }
 
  // create a view and init it with the generated name sort order. Then, iterate
   // over the view, getting the card for each row, and printing them.
   nsString sortColumn;
   nsCOMPtr <nsIAbView> view = do_CreateInstance("@mozilla.org/addressbook/abview;1", &rv);
   
-  view->SetView(aDirectory, nsnull, NS_LITERAL_STRING("GeneratedName"),
+  view->SetView(aDirectory, nullptr, NS_LITERAL_STRING("GeneratedName"),
                 NS_LITERAL_STRING("ascending"), sortColumn);
 
   PRInt32 numRows;
   nsCOMPtr <nsITreeView> treeView = do_QueryInterface(view, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
   treeView->GetRowCount(&numRows);
   
   for (PRInt32 row = 0; row < numRows; row++)
--- a/mailnews/addrbook/src/nsAddrDatabase.cpp
+++ b/mailnews/addrbook/src/nsAddrDatabase.cpp
@@ -62,19 +62,19 @@ static const char kRowIDProperty[] = "Db
 static const char kMailListTotalLists[] = "ListTotalLists";    // total number of mail list in a mailing list
 static const char kLowerListNameColumn[] = "LowercaseListName";
 
 struct mdbOid gAddressBookTableOID;
 
 static const char kMailListAddressFormat[] = "Address%d";
 
 nsAddrDatabase::nsAddrDatabase()
-    : m_mdbEnv(nsnull), m_mdbStore(nsnull),
-      m_mdbPabTable(nsnull),
-      m_mdbDeletedCardsTable(nsnull),
+    : m_mdbEnv(nullptr), m_mdbStore(nullptr),
+      m_mdbPabTable(nullptr),
+      m_mdbDeletedCardsTable(nullptr),
       m_mdbTokensInitialized(false),
       m_PabTableKind(0),
       m_MailListTableKind(0),
       m_DeletedCardsTableKind(0),
       m_CardRowScopeToken(0),
       m_FirstNameColumnToken(0),
       m_LastNameColumnToken(0),
       m_PhoneticFirstNameColumnToken(0),
@@ -125,17 +125,17 @@ nsAddrDatabase::nsAddrDatabase()
       m_Custom4ColumnToken(0),
       m_NotesColumnToken(0),
       m_LastModDateColumnToken(0),
       m_MailFormatColumnToken(0),
       m_PopularityIndexColumnToken(0),
       m_AllowRemoteContentColumnToken(0),
       m_AddressCharSetColumnToken(0),
       m_LastRecordKey(0),
-      m_dbDirectory(nsnull)
+      m_dbDirectory(nullptr)
 {
 }
 
 nsAddrDatabase::~nsAddrDatabase()
 {
     Close(false);    // better have already been closed.
 
     // better not be any listeners, because we're going away.
@@ -233,17 +233,17 @@ NS_IMETHODIMP nsAddrDatabase::NotifyAnno
                                      OnAnnouncerGoingAway, ());
   return NS_OK;
 }
 
 
 // Apparently its not good for nsTArray to be allocated as static. Don't know
 // why it isn't but its not, so don't think about making it a static variable.
 // Maybe bz knows.
-nsTArray<nsAddrDatabase*>* nsAddrDatabase::m_dbCache = nsnull;
+nsTArray<nsAddrDatabase*>* nsAddrDatabase::m_dbCache = nullptr;
 
 nsTArray<nsAddrDatabase*>*
 nsAddrDatabase::GetDBCache()
 {
   if (!m_dbCache)
     m_dbCache = new nsAutoTArray<nsAddrDatabase*, kInitialAddrDBCacheSize>;
 
   return m_dbCache;
@@ -257,17 +257,17 @@ nsAddrDatabase::CleanupCache()
     for (PRInt32 i = m_dbCache->Length() - 1; i >= 0; --i)
     {
       nsAddrDatabase* pAddrDB = m_dbCache->ElementAt(i);
       if (pAddrDB)
         pAddrDB->ForceClosed();
     }
     //        NS_ASSERTION(m_dbCache.Length() == 0, "some msg dbs left open");    // better not be any open db's.
     delete m_dbCache;
-    m_dbCache = nsnull;
+    m_dbCache = nullptr;
   }
 }
 
 //----------------------------------------------------------------------
 // FindInCache - this addrefs the db it finds.
 //----------------------------------------------------------------------
 nsAddrDatabase* nsAddrDatabase::FindInCache(nsIFile *dbName)
 {
@@ -277,17 +277,17 @@ nsAddrDatabase* nsAddrDatabase::FindInCa
   {
     nsAddrDatabase* pAddrDB = dbCache->ElementAt(i);
     if (pAddrDB->MatchDbName(dbName))
     {
       NS_ADDREF(pAddrDB);
       return pAddrDB;
     }
   }
-  return nsnull;
+  return nullptr;
 }
 
 bool nsAddrDatabase::MatchDbName(nsIFile* dbName)    // returns true if they match
 {
     bool dbMatches = false;
 
     nsresult rv = m_dbName->Equals(dbName, &dbMatches);
     if (NS_FAILED(rv))
@@ -329,17 +329,17 @@ NS_IMETHODIMP nsAddrDatabase::GetDbPath(
 NS_IMETHODIMP nsAddrDatabase::SetDbPath(nsIFile* aDbPath)
 {
     return aDbPath->Clone(getter_AddRefs(m_dbName));
 }
 
 NS_IMETHODIMP nsAddrDatabase::Open
 (nsIFile *aMabFile, bool aCreate, bool upgrading /* unused */, nsIAddrDatabase** pAddrDB)
 {
-  *pAddrDB = nsnull;
+  *pAddrDB = nullptr;
 
   nsAddrDatabase *pAddressBookDB = FindInCache(aMabFile);
 
   if (pAddressBookDB) {
     *pAddrDB = pAddressBookDB;
     return NS_OK;
   }
 
@@ -452,17 +452,17 @@ nsresult nsAddrDatabase::DisplayAlert(co
   nsString alertTitle;
   rv = bundle->GetStringFromName(titleName, getter_Copies(alertTitle));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIPromptService> prompter =
       do_GetService(NS_PROMPTSERVICE_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  return prompter->Alert(nsnull /* we don't know the parent window */, alertTitle.get(), alertMessage.get());
+  return prompter->Alert(nullptr /* we don't know the parent window */, alertTitle.get(), alertMessage.get());
 }
 
 nsresult nsAddrDatabase::AlertAboutCorruptMabFile(const PRUnichar *aOldFileName, const PRUnichar *aNewFileName)
 {
   const PRUnichar *formatStrings[] = { aOldFileName, aOldFileName, aNewFileName };
   return DisplayAlert(NS_LITERAL_STRING("corruptMabFileTitle").get(),
     NS_LITERAL_STRING("corruptMabFileAlert").get(), formatStrings, 3);
 }
@@ -488,20 +488,20 @@ nsAddrDatabase::OpenInternal(nsIFile *aM
   if (NS_SUCCEEDED(rv))
   {
     pAddressBookDB->SetDbPath(aMabFile);
     GetDBCache()->AppendElement(pAddressBookDB);
     *pAddrDB = pAddressBookDB;
   }
   else
   {
-    *pAddrDB = nsnull;
+    *pAddrDB = nullptr;
     pAddressBookDB->ForceClosed();
     NS_IF_RELEASE(pAddressBookDB);
-    pAddressBookDB = nsnull;
+    pAddressBookDB = nullptr;
   }
   return rv;
 }
 
 // Open the MDB database synchronously. If successful, this routine
 // will set up the m_mdbStore and m_mdbEnv of the database object
 // so other database calls can work.
 NS_IMETHODIMP nsAddrDatabase::OpenMDB(nsIFile *dbName, bool create)
@@ -509,17 +509,17 @@ NS_IMETHODIMP nsAddrDatabase::OpenMDB(ns
   nsresult ret = NS_OK;
   nsCOMPtr<nsIMdbFactory> mdbFactory;
   GetMDBFactory(getter_AddRefs(mdbFactory));
   if (mdbFactory)
   {
     ret = mdbFactory->MakeEnv(NULL, &m_mdbEnv);
     if (NS_SUCCEEDED(ret))
     {
-      nsIMdbThumb *thumb = nsnull;
+      nsIMdbThumb *thumb = nullptr;
       nsCAutoString filePath;
 
       ret = dbName->GetNativePath(filePath);
       NS_ENSURE_SUCCESS(ret, ret);
 
       nsIMdbHeap* dbHeap = 0;
       mdb_bool dbFrozen = mdbBool_kFalse; // not readonly, we want modifiable
 
@@ -652,17 +652,17 @@ NS_IMETHODIMP nsAddrDatabase::ForceClose
     NS_IF_RELEASE(m_mdbStore);
     Release();
     return err;
 }
 
 NS_IMETHODIMP nsAddrDatabase::Commit(PRUint32 commitType)
 {
   nsresult err = NS_OK;
-  nsIMdbThumb *commitThumb = nsnull;
+  nsIMdbThumb *commitThumb = nullptr;
 
   if (commitType == nsAddrDBCommitType::kLargeCommit ||
       commitType == nsAddrDBCommitType::kSessionCommit)
   {
     mdb_percent outActualWaste = 0;
     mdb_bool outShould;
     if (m_mdbStore && m_mdbEnv)
     {
@@ -806,42 +806,42 @@ nsresult nsAddrDatabase::InitDeletedCard
     if (m_mdbStore && m_mdbEnv)
     {
       m_mdbStore->GetTable(m_mdbEnv, &deletedCardsTableOID, &m_mdbDeletedCardsTable);
       // if deletedCardsTable does not exist and bCreate is set, create a new one
       if (!m_mdbDeletedCardsTable && aCreate)
       {
         mdberr = (nsresult) m_mdbStore->NewTableWithOid(m_mdbEnv, &deletedCardsTableOID,
                                                         m_DeletedCardsTableKind,
-                                                        true, (const mdbOid*)nsnull,
+                                                        true, (const mdbOid*)nullptr,
                                                         &m_mdbDeletedCardsTable);
       }
     }
   }
   return mdberr;
 }
 
 nsresult nsAddrDatabase::InitPabTable()
 {
   return m_mdbStore && m_mdbEnv ? m_mdbStore->NewTableWithOid(m_mdbEnv,
                                                   &gAddressBookTableOID,
                                                   m_PabTableKind,
                                                   false,
-                                                  (const mdbOid*)nsnull,
+                                                  (const mdbOid*)nullptr,
                                                   &m_mdbPabTable)
       : NS_ERROR_NULL_POINTER;
 }
 
 //save the last record number, store in m_DataRowScopeToken, row 1
 nsresult nsAddrDatabase::InitLastRecorKey()
 {
   if (!m_mdbPabTable || !m_mdbStore || !m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
-  nsIMdbRow *pDataRow = nsnull;
+  nsIMdbRow *pDataRow = nullptr;
   mdbOid dataRowOid;
   dataRowOid.mOid_Scope = m_DataRowScopeToken;
   dataRowOid.mOid_Id = DATAROW_ROWID;
   nsresult err = m_mdbStore->NewRowWithOid(m_mdbEnv, &dataRowOid, &pDataRow);
 
   if (NS_SUCCEEDED(err) && pDataRow)
   {
     m_LastRecordKey = 0;
@@ -852,17 +852,17 @@ nsresult nsAddrDatabase::InitLastRecorKe
   return err;
 }
 
 nsresult nsAddrDatabase::GetDataRow(nsIMdbRow **pDataRow)
 {
   if (!m_mdbStore || !m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
-  nsIMdbRow *pRow = nsnull;
+  nsIMdbRow *pRow = nullptr;
   mdbOid dataRowOid;
   dataRowOid.mOid_Scope = m_DataRowScopeToken;
   dataRowOid.mOid_Id = DATAROW_ROWID;
   m_mdbStore->GetRow(m_mdbEnv, &dataRowOid, &pRow);
   *pDataRow = pRow;
 
   return pRow ? NS_OK : NS_ERROR_FAILURE;
 }
@@ -929,18 +929,18 @@ nsresult nsAddrDatabase::InitExistingDB(
 }
 
 nsresult nsAddrDatabase::CheckAndUpdateRecordKey()
 {
   if (!m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
   nsresult err = NS_OK;
-  nsIMdbTableRowCursor* rowCursor = nsnull;
-  nsIMdbRow* findRow = nsnull;
+  nsIMdbTableRowCursor* rowCursor = nullptr;
+  nsIMdbRow* findRow = nullptr;
   mdb_pos    rowPos = 0;
 
   mdb_err merror = m_mdbPabTable->GetTableRowCursor(m_mdbEnv, -1, &rowCursor);
 
   if (!(merror == NS_OK && rowCursor))
     return NS_ERROR_FAILURE;
 
   nsCOMPtr <nsIMdbRow> pDataRow;
@@ -972,18 +972,18 @@ nsresult nsAddrDatabase::CheckAndUpdateR
 }
 
 nsresult nsAddrDatabase::UpdateLowercaseEmailListName()
 {
   if (!m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
   nsresult err = NS_OK;
-  nsIMdbTableRowCursor* rowCursor = nsnull;
-  nsIMdbRow* findRow = nsnull;
+  nsIMdbTableRowCursor* rowCursor = nullptr;
+  nsIMdbRow* findRow = nullptr;
   mdb_pos    rowPos = 0;
   bool commitRequired = false;
 
   mdb_err merror = m_mdbPabTable->GetTableRowCursor(m_mdbEnv, -1, &rowCursor);
 
   if (!(merror == NS_OK && rowCursor))
     return NS_ERROR_FAILURE;
 
@@ -1297,17 +1297,17 @@ NS_IMETHODIMP nsAddrDatabase::CreateNewC
   return rv;
 }
 
 NS_IMETHODIMP nsAddrDatabase::CreateNewListCardAndAddToDB(nsIAbDirectory *aList, PRUint32 listRowID, nsIAbCard *newCard, bool notify /* = FALSE */)
 {
   if (!newCard || !m_mdbPabTable || !m_mdbStore || !m_mdbEnv)
         return NS_ERROR_NULL_POINTER;
 
-  nsIMdbRow* pListRow = nsnull;
+  nsIMdbRow* pListRow = nullptr;
   mdbOid listRowOid;
   listRowOid.mOid_Scope = m_ListRowScopeToken;
   listRowOid.mOid_Id = listRowID;
   nsresult rv = m_mdbStore->GetRow(m_mdbEnv, &listRowOid, &pListRow);
   NS_ENSURE_SUCCESS(rv,rv);
 
   if (!pListRow)
     return NS_OK;
@@ -1349,17 +1349,17 @@ NS_IMETHODIMP nsAddrDatabase::CreateNewL
       return NS_OK;
     }
   }
 
   // start from 1
   PRUint32 totalAddress = GetListAddressTotal(pListRow) + 1;
   SetListAddressTotal(pListRow, totalAddress);
   nsCOMPtr<nsIAbCard> pNewCard;
-  rv = AddListCardColumnsToRow(newCard, pListRow, totalAddress, getter_AddRefs(pNewCard), true /* aInMailingList */, aList, nsnull);
+  rv = AddListCardColumnsToRow(newCard, pListRow, totalAddress, getter_AddRefs(pNewCard), true /* aInMailingList */, aList, nullptr);
   NS_ENSURE_SUCCESS(rv,rv);
 
   addressList->AppendElement(newCard, false);
 
   if (notify)
     NotifyCardEntryChange(AB_NotifyInserted, newCard, aList);
 
     return rv;
@@ -1371,21 +1371,21 @@ NS_IMETHODIMP nsAddrDatabase::AddListCar
   if (!aPCard || !aPListRow || !m_mdbStore || !m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
   nsresult    err = NS_OK;
   nsString email;
   aPCard->GetPrimaryEmail(email);
   if (!email.IsEmpty())
   {
-    nsIMdbRow    *pCardRow = nsnull;
+    nsIMdbRow    *pCardRow = nullptr;
     // Please DO NOT change the 3rd param of GetRowFromAttribute() call to
     // true (ie, case insensitive) without reading bugs #128535 and #121478.
     err = GetRowFromAttribute(kPriEmailProperty, NS_ConvertUTF16toUTF8(email),
-                              false /* retain case */, &pCardRow, nsnull);
+                              false /* retain case */, &pCardRow, nullptr);
     bool cardWasAdded = false;
     if (NS_FAILED(err) || !pCardRow)
     {
       //New Email, then add a new row with this email
       err  = GetNewRow(&pCardRow);
 
       if (NS_SUCCEEDED(err) && pCardRow)
       {
@@ -1541,17 +1541,17 @@ NS_IMETHODIMP nsAddrDatabase::SetListAdd
     return AddIntColumn(aListRow, m_ListTotalColumnToken, aTotal);
 }
 
 NS_IMETHODIMP nsAddrDatabase::FindRowByCard(nsIAbCard * aCard,nsIMdbRow **aRow)
 {
     nsString primaryEmail;
     aCard->GetPrimaryEmail(primaryEmail);
     return GetRowForCharColumn(primaryEmail.get(), m_PriEmailColumnToken,
-                               true, true, aRow, nsnull);
+                               true, true, aRow, nullptr);
 }
 
 nsresult nsAddrDatabase::GetAddressRowByPos(nsIMdbRow* listRow, PRUint16 pos, nsIMdbRow** cardRow)
 {
   if (!m_mdbStore || !listRow || !cardRow || !m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
   mdb_token listAddressColumnToken;
@@ -1630,17 +1630,17 @@ NS_IMETHODIMP nsAddrDatabase::DeleteCard
   if (!aCard || !m_mdbPabTable || !m_mdbStore || !m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
   nsresult err = NS_OK;
   bool bIsMailList = false;
   aCard->GetIsMailList(&bIsMailList);
 
   // get the right row
-  nsIMdbRow* pCardRow = nsnull;
+  nsIMdbRow* pCardRow = nullptr;
   mdbOid rowOid;
 
   rowOid.mOid_Scope = bIsMailList ? m_ListRowScopeToken : m_CardRowScopeToken;
 
   err = aCard->GetPropertyAsUint32(kRowIDProperty, &rowOid.mOid_Id);
   NS_ENSURE_SUCCESS(err, err);
 
   err = m_mdbStore->GetRow(m_mdbEnv, &rowOid, &pCardRow);
@@ -1727,17 +1727,17 @@ nsresult nsAddrDatabase::DeleteCardFromL
 NS_IMETHODIMP nsAddrDatabase::DeleteCardFromMailList(nsIAbDirectory *mailList, nsIAbCard *card, bool aNotify)
 {
   if (!card || !m_mdbPabTable || !m_mdbStore || !m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
   nsresult err = NS_OK;
 
   // get the right row
-  nsIMdbRow* pListRow = nsnull;
+  nsIMdbRow* pListRow = nullptr;
   mdbOid listRowOid;
   listRowOid.mOid_Scope = m_ListRowScopeToken;
 
   nsCOMPtr<nsIAbMDBDirectory> dbmailList(do_QueryInterface(mailList,&err));
   NS_ENSURE_SUCCESS(err, err);
 
   dbmailList->GetDbRowID((PRUint32*)&listRowOid.mOid_Id);
 
@@ -1805,46 +1805,46 @@ NS_IMETHODIMP nsAddrDatabase::GetCardVal
   // it might be that the caller always has a nsAbMDBCard
   rv = card->GetPropertyAsUint32(kRowIDProperty, &rowOid.mOid_Id);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = m_mdbStore->GetRow(m_mdbEnv, &rowOid, getter_AddRefs(cardRow));
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!cardRow) {
-    *value = nsnull;
+    *value = nullptr;
     // this can happen when adding cards when editing a mailing list
     return NS_OK;
   }
 
   mdb_token token;
   m_mdbStore->StringToToken(m_mdbEnv, name, &token);
 
   // XXX fix me
   // avoid extra copying and allocations (did dmb already do this on the trunk?)
   nsAutoString tempString;
   rv = GetStringColumn(cardRow, token, tempString);
   if (NS_FAILED(rv)) {
     // not all cards are going this column
-    *value = nsnull;
+    *value = nullptr;
     return NS_OK;
   }
 
   *value = NS_strdup(tempString.get());
   if (!*value)
     return NS_ERROR_OUT_OF_MEMORY;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAddrDatabase::GetDeletedCardList(nsIArray **aResult)
 {
   if (!m_mdbEnv || !aResult)
     return NS_ERROR_NULL_POINTER;
 
-  *aResult = nsnull;
+  *aResult = nullptr;
 
   nsresult rv;
   nsCOMPtr<nsIMutableArray> resultCardArray =
     do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // make sure the member is set properly
   InitDeletedCardsTable(false);
@@ -2034,17 +2034,17 @@ NS_IMETHODIMP nsAddrDatabase::DeleteMail
 
 NS_IMETHODIMP nsAddrDatabase::EditMailList(nsIAbDirectory *mailList, nsIAbCard *listCard, bool notify)
 {
   if (!mailList || !m_mdbPabTable || !m_mdbStore || !m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
   nsresult err = NS_OK;
 
-  nsIMdbRow* pListRow = nsnull;
+  nsIMdbRow* pListRow = nullptr;
   mdbOid rowOid;
   rowOid.mOid_Scope = m_ListRowScopeToken;
 
   nsCOMPtr<nsIAbMDBDirectory> dbmailList(do_QueryInterface(mailList, &err));
   NS_ENSURE_SUCCESS(err, err);
   dbmailList->GetDbRowID((PRUint32*)&rowOid.mOid_Id);
 
   err = m_mdbStore->GetRow(m_mdbEnv, &rowOid, &pListRow);
@@ -2133,17 +2133,17 @@ NS_IMETHODIMP nsAddrDatabase::AddLdifLis
   nsCAutoString email;
   PRInt32 emailPos = valueString.Find("mail=");
   emailPos += strlen("mail=");
   email = Substring(valueString, emailPos);
   nsCOMPtr <nsIMdbRow> cardRow;
   // Please DO NOT change the 3rd param of GetRowFromAttribute() call to
   // true (ie, case insensitive) without reading bugs #128535 and #121478.
   nsresult rv = GetRowFromAttribute(kPriEmailProperty, email, false /* retain case */,
-                                    getter_AddRefs(cardRow), nsnull);
+                                    getter_AddRefs(cardRow), nullptr);
   if (NS_SUCCEEDED(rv) && cardRow)
   {
     mdbOid outOid;
     mdb_id rowID = 0;
     if (cardRow->GetOid(m_mdbEnv, &outOid) == NS_OK)
       rowID = outOid.mOid_Id;
 
     // start from 1
@@ -2159,17 +2159,17 @@ NS_IMETHODIMP nsAddrDatabase::AddLdifLis
     SetListAddressTotal(listRow, total);
   }
   return NS_OK;
 }
 
 
 void nsAddrDatabase::GetCharStringYarn(char* str, struct mdbYarn* strYarn)
 {
-    strYarn->mYarn_Grow = nsnull;
+    strYarn->mYarn_Grow = nullptr;
     strYarn->mYarn_Buf = str;
     strYarn->mYarn_Size = PL_strlen((const char *) strYarn->mYarn_Buf) + 1;
     strYarn->mYarn_Fill = strYarn->mYarn_Size - 1;
     strYarn->mYarn_Form = 0;
 }
 
 void nsAddrDatabase::GetStringYarn(const nsAString & aStr, struct mdbYarn* strYarn)
 {
@@ -2178,17 +2178,17 @@ void nsAddrDatabase::GetStringYarn(const
     strYarn->mYarn_Fill = strYarn->mYarn_Size - 1;
     strYarn->mYarn_Form = 0;
 }
 
 void nsAddrDatabase::GetIntYarn(PRUint32 nValue, struct mdbYarn* intYarn)
 {
     intYarn->mYarn_Fill = intYarn->mYarn_Size;
     intYarn->mYarn_Form = 0;
-    intYarn->mYarn_Grow = nsnull;
+    intYarn->mYarn_Grow = nullptr;
 
     PR_snprintf((char*)intYarn->mYarn_Buf, intYarn->mYarn_Size, "%lx", nValue);
     intYarn->mYarn_Fill = PL_strlen((const char *) intYarn->mYarn_Buf);
 }
 
 nsresult nsAddrDatabase::AddCharStringColumn(nsIMdbRow* cardRow, mdb_column inColumn, const char* str)
 {
   if (!m_mdbEnv)
@@ -2399,22 +2399,22 @@ NS_IMETHODIMP nsAddrDatabase::InitCardFr
   nsCOMPtr<nsIMdbRowCellCursor> cursor;
   nsCOMPtr<nsIMdbCell> cell;
 
   rv = cardRow->GetRowCellCursor(m_mdbEnv, -1, getter_AddRefs(cursor));
   NS_ENSURE_SUCCESS(rv, rv);
 
   mdb_column columnNumber;
   char columnName[100];
-  struct mdbYarn colYarn = {columnName, 0, sizeof(columnName), 0, 0, nsnull};
+  struct mdbYarn colYarn = {columnName, 0, sizeof(columnName), 0, 0, nullptr};
   struct mdbYarn cellYarn;
 
   do
   {
-    rv = cursor->NextCell(m_mdbEnv, getter_AddRefs(cell), &columnNumber, nsnull);
+    rv = cursor->NextCell(m_mdbEnv, getter_AddRefs(cell), &columnNumber, nullptr);
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (!cell)
       break;
 
     // Get the value of the cell
     cell->AliasYarn(m_mdbEnv, &cellYarn);
     NS_ConvertUTF8toUTF16 value(static_cast<const char*>(cellYarn.mYarn_Buf),
@@ -2563,19 +2563,19 @@ nsAddrDBEnumerator::nsAddrDBEnumerator(n
 
 nsAddrDBEnumerator::~nsAddrDBEnumerator()
 {
   Clear();
 }
 
 void nsAddrDBEnumerator::Clear()
 {
-  mRowCursor = nsnull;
-  mCurrentRow = nsnull;
-  mDbTable = nsnull;
+  mRowCursor = nullptr;
+  mCurrentRow = nullptr;
+  mDbTable = nullptr;
   if (mDb)
     mDb->RemoveListener(this);
 }
 
 NS_IMPL_ISUPPORTS2(nsAddrDBEnumerator, nsISimpleEnumerator, nsIAddrDBListener)
 
 NS_IMETHODIMP
 nsAddrDBEnumerator::HasMoreElements(bool *aResult)
@@ -2589,44 +2589,44 @@ nsAddrDBEnumerator::HasMoreElements(bool
     }
 
     nsCOMPtr<nsIMdbTableRowCursor> rowCursor;
     mDbTable->GetTableRowCursor(mDb->GetEnv(), mRowPos,
                                 getter_AddRefs(rowCursor));
     NS_ENSURE_TRUE(rowCursor, NS_ERROR_FAILURE);
 
     mdbOid rowOid;
-    rowCursor->NextRowOid(mDb->GetEnv(), &rowOid, nsnull);
+    rowCursor->NextRowOid(mDb->GetEnv(), &rowOid, nullptr);
     while (rowOid.mOid_Id != (mdb_id)-1)
     {
         if (mDb->IsListRowScopeToken(rowOid.mOid_Scope) ||
             mDb->IsCardRowScopeToken(rowOid.mOid_Scope))
         {
             *aResult = true;
 
             return NS_OK;
         }
 
         if (!mDb->IsDataRowScopeToken(rowOid.mOid_Scope))
         {
             return NS_ERROR_FAILURE;
         }
 
-        rowCursor->NextRowOid(mDb->GetEnv(), &rowOid, nsnull);
+        rowCursor->NextRowOid(mDb->GetEnv(), &rowOid, nullptr);
     }
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAddrDBEnumerator::GetNext(nsISupports **aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
-    *aResult = nsnull;
+    *aResult = nullptr;
 
     if (!mDbTable || !mDb->GetEnv())
     {
         return NS_ERROR_NULL_POINTER;
     }
 
     if (!mRowCursor)
     {
@@ -2769,17 +2769,17 @@ nsListAddressEnumerator::HasMoreElements
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsListAddressEnumerator::GetNext(nsISupports **aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
-    *aResult = nsnull;
+    *aResult = nullptr;
 
     if (!mDbTable || !mDb->GetEnv())
     {
         return NS_ERROR_NULL_POINTER;
     }
 
     if (++mAddressPos <= mAddressTotal)
     {
@@ -2810,17 +2810,17 @@ NS_IMETHODIMP nsAddrDatabase::EnumerateC
     NS_ADDREF(e);
     *result = e;
     return NS_OK;
 }
 
 NS_IMETHODIMP nsAddrDatabase::GetMailingListsFromDB(nsIAbDirectory *parentDir)
 {
     nsCOMPtr<nsIAbDirectory>    resultList;
-    nsIMdbTableRowCursor*       rowCursor = nsnull;
+    nsIMdbTableRowCursor*       rowCursor = nullptr;
     nsCOMPtr<nsIMdbRow> currentRow;
      mdb_pos                        rowPos;
     bool                        done = false;
 
   if (!m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
   m_dbDirectory = do_GetWeakReference(parentDir);
@@ -2955,17 +2955,17 @@ nsresult nsAddrDatabase::CreateABListCar
     nsresult rv = NS_OK;
 
     mdbOid outOid;
     mdb_id rowID=0;
 
     if (listRow->GetOid(m_mdbEnv, &outOid) == NS_OK)
         rowID = outOid.mOid_Id;
 
-    char* listURI = nsnull;
+    char* listURI = nullptr;
 
     nsAutoString fileName;
     rv = m_dbName->GetLeafName(fileName);
     NS_ENSURE_SUCCESS(rv, rv);
     listURI = PR_smprintf("%s%s/MailList%ld", kMDBDirectoryRoot, NS_ConvertUTF16toUTF8(fileName).get(), rowID);
 
     nsCOMPtr<nsIAbCard> personCard;
     nsCOMPtr<nsIAbMDBDirectory> dbm_dbDirectory(do_QueryReferent(m_dbDirectory,
@@ -3010,17 +3010,17 @@ nsresult nsAddrDatabase::CreateABList(ns
         return NS_ERROR_NULL_POINTER;
 
     mdbOid outOid;
     mdb_id rowID=0;
 
     if (listRow->GetOid(m_mdbEnv, &outOid) == NS_OK)
         rowID = outOid.mOid_Id;
 
-    char* listURI = nsnull;
+    char* listURI = nullptr;
 
     nsAutoString fileName;
     m_dbName->GetLeafName(fileName);
     NS_ENSURE_SUCCESS(rv, rv);
 
     listURI = PR_smprintf("%s%s/MailList%ld", kMDBDirectoryRoot, NS_ConvertUTF16toUTF8(fileName).get(), rowID);
 
     nsCOMPtr<nsIAbDirectory> mailList;
@@ -3111,20 +3111,20 @@ NS_IMETHODIMP nsAddrDatabase::GetCardFro
                                                    bool aCaseInsensitive,
                                                    nsIAbCard **aCardResult)
 {
   NS_ENSURE_ARG_POINTER(aCardResult);
 
   m_dbDirectory = do_GetWeakReference(aDirectory);
   nsCOMPtr<nsIMdbRow> cardRow;
   if (NS_SUCCEEDED(GetRowFromAttribute(aName, aUTF8Value, aCaseInsensitive,
-                                       getter_AddRefs(cardRow), nsnull)) && cardRow)
+                                       getter_AddRefs(cardRow), nullptr)) && cardRow)
     return CreateABCard(cardRow, 0, aCardResult);
 
-  *aCardResult = nsnull;
+  *aCardResult = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAddrDatabase::GetCardsFromAttribute(nsIAbDirectory *aDirectory,
                                                     const char *aName,
                                                     const nsACString & aUTF8Value,
                                                     bool aCaseInsensitive,
                                                     nsISimpleEnumerator **cards)
@@ -3192,17 +3192,17 @@ NS_IMETHODIMP nsAddrDatabase::AddListDir
 NS_IMETHODIMP nsAddrDatabase::FindMailListbyUnicodeName(const PRUnichar *listName, bool *exist)
 {
   nsAutoString unicodeString(listName);
   ToLowerCase(unicodeString);
 
   nsCOMPtr <nsIMdbRow> listRow;
   nsresult rv = GetRowForCharColumn(unicodeString.get(),
                                     m_LowerListNameColumnToken, false,
-                                    false, getter_AddRefs(listRow), nsnull);
+                                    false, getter_AddRefs(listRow), nullptr);
   *exist = (NS_SUCCEEDED(rv) && listRow);
   return rv;
 }
 
 NS_IMETHODIMP nsAddrDatabase::GetCardCount(PRUint32 *count)
 {
     mdb_err rv;
     mdb_count c;
@@ -3270,17 +3270,17 @@ nsAddrDatabase::GetRowForCharColumn(cons
                                     nsIMdbRow **aFindRow,
                                     mdb_pos *aRowPos)
 {
   NS_ENSURE_ARG_POINTER(unicodeStr);
   NS_ENSURE_ARG_POINTER(aFindRow);
   if (!m_mdbEnv)
     return NS_ERROR_NULL_POINTER;
 
-  *aFindRow = nsnull;
+  *aFindRow = nullptr;
 
   // see bug #198303
   // the addition of the m_mdbDeletedCardsTable table has complicated life in the addressbook
   // (it was added for palm sync).  until we fix the underlying problem, we have to jump through hoops
   // in order to know if we have a row (think card) for a given column value (think email=foo@bar.com)
   // there are 4 scenarios:
   //   1) no cards with a match
   //   2) at least one deleted card with a match, but no non-deleted cards
--- a/mailnews/addrbook/src/nsDirPrefs.cpp
+++ b/mailnews/addrbook/src/nsDirPrefs.cpp
@@ -63,17 +63,17 @@ static bool DIR_SetServerPosition(nsVoid
 
 /* These two routines should be called to initialize and save 
  * directory preferences from the XP Java Script preferences
  */
 static nsresult DIR_GetServerPreferences(nsVoidArray** list);
 static void DIR_SaveServerPreferences(nsVoidArray *wholeList);
 
 static PRInt32 dir_UserId = 0;
-nsVoidArray *dir_ServerList = nsnull;
+nsVoidArray *dir_ServerList = nullptr;
 
 /*****************************************************************************
  * Functions for creating the new back end managed DIR_Server list.
  */
 class DirPrefObserver : public nsSupportsWeakReference,
                         public nsIObserver
 {
 public:
@@ -124,31 +124,31 @@ NS_IMETHODIMP DirPrefObserver::Observe(n
         server->position = position;
         if (dir_IsServerDeleted(server))
           DIR_SetServerPosition(dir_ServerList, server, DIR_POS_DELETE);
       }
     }
 
     if (id == idDescription)
       // Ensure the local copy of the description is kept up to date.
-      server->description = DIR_GetStringPref(prefname, "description", nsnull);
+      server->description = DIR_GetStringPref(prefname, "description", nullptr);
   }
   /* If the server is not in the unified list, we may need to add it.  Servers
    * are only added when the position, serverName and description are valid.
    */
   else if (id == idPosition || id == idType || id == idDescription)
   {
     dir_ValidateAndAddNewServer(dir_ServerList, prefname);
   }
 
   return NS_OK;
 }
 
 // A pointer to the pref observer
-static DirPrefObserver *prefObserver = nsnull;
+static DirPrefObserver *prefObserver = nullptr;
 
 static nsresult DIR_GetDirServers()
 {
   nsresult rv = NS_OK;
 
   if (!dir_ServerList)
   {
     /* we need to build the DIR_Server list */ 
@@ -177,17 +177,17 @@ nsVoidArray* DIR_GetDirectories()
 {
     if (!dir_ServerList)
         DIR_GetDirServers();
   return dir_ServerList;
 }
 
 DIR_Server* DIR_GetServerFromList(const char* prefName)
 {
-  DIR_Server* result = nsnull;
+  DIR_Server* result = nullptr;
 
   if (!dir_ServerList)
     DIR_GetDirServers();
 
   if (dir_ServerList)
   {
     PRInt32 count = dir_ServerList->Count();
     PRInt32 i;
@@ -206,26 +206,26 @@ DIR_Server* DIR_GetServerFromList(const 
 }
 
 static nsresult SavePrefsFile()
 {
   nsresult rv;
   nsCOMPtr<nsIPrefService> pPref(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
   if (NS_FAILED(rv))
     return rv;
-  return pPref->SavePrefFile(nsnull);
+  return pPref->SavePrefFile(nullptr);
 }
 
 nsresult DIR_ShutDown()  /* FEs should call this when the app is shutting down. It frees all DIR_Servers regardless of ref count values! */
 {
   nsresult rv = SavePrefsFile();
   NS_ENSURE_SUCCESS(rv, rv);
 
   DIR_DeleteServerList(dir_ServerList);
-  dir_ServerList = nsnull;
+  dir_ServerList = nullptr;
 
   /* unregister the preference call back, if necessary.
   * we need to do this as DIR_Shutdown() is called when switching profiles
   * when using turbo.  (see nsAbDirectoryDataSource::Observe())
   * When switching profiles, prefs get unloaded and then re-loaded
   * we don't want our callback to get called for all that.
   * We'll reset our callback the first time DIR_GetDirServers() is called
   * after we've switched profiles.
@@ -308,17 +308,17 @@ static void DIR_InitServer(DIR_Server *s
 {
   if (!server) {
     NS_WARNING("DIR_InitServer: server parameter not initialized");
     return;
   }
 
   memset(server, 0, sizeof(DIR_Server));
   server->position = kDefaultPosition;
-  server->uri = nsnull;
+  server->uri = nullptr;
   server->savingServer = false;
   server->dirType = dirType;
 }
 
 /* Function for setting the position of a server.  Can be used to append,
  * delete, or move a server in a server list.
  *
  * The third parameter specifies the new position the server is to occupy.
@@ -333,27 +333,27 @@ static void DIR_InitServer(DIR_Server *s
  * Returns true if the server list was re-sorted.
  */
 static bool DIR_SetServerPosition(nsVoidArray *wholeList, DIR_Server *server, PRInt32 position)
  {
    NS_ENSURE_TRUE(wholeList, false);
 
    PRInt32    i, count, num;
    bool       resort = false;
-   DIR_Server *s=nsnull;
+   DIR_Server *s=nullptr;
    
    switch (position) {
    case DIR_POS_APPEND:
    /* Do nothing if the request is to append a server that is already
      * in the list.
      */
      count = wholeList->Count();
      for (i= 0; i < count; i++)
      {
-       if  ((s = (DIR_Server *)wholeList->ElementAt(i)) != nsnull)
+       if  ((s = (DIR_Server *)wholeList->ElementAt(i)) != nullptr)
          if (s == server)
            return false;
      }
      /* In general, if there are any servers already in the list, set the
      * position to the position of the last server plus one.  If there
      * are none, set it to position 1.
      */
      if (count > 0)
@@ -364,17 +364,17 @@ static bool DIR_SetServerPosition(nsVoid
      else
        server->position = 1;
      
      wholeList->AppendElement(server);
      break;
      
    case DIR_POS_DELETE:
        /* Remove the prefs corresponding to the given server.  If the prefName
-       * value is nsnull, the server has never been saved and there are no
+       * value is nullptr, the server has never been saved and there are no
        * prefs to remove.
      */
      if (server->prefName)
      {
        nsresult rv;
        nsCOMPtr<nsIPrefBranch> pPref(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
        if (NS_FAILED(rv))
          return false;
@@ -407,24 +407,24 @@ static bool DIR_SetServerPosition(nsVoid
      break;
      
    default:
    /* See if the server is already in the list.
      */
      count = wholeList->Count();
      for (i= 0; i < count; i++)
      {
-       if  ((s = (DIR_Server *)wholeList->ElementAt(i)) != nsnull)
+       if  ((s = (DIR_Server *)wholeList->ElementAt(i)) != nullptr)
          if (s == server)
            break;
      }
      
      /* If the server is not in the list, add it to the beginning and re-sort.
      */
-     if (s == nsnull)
+     if (s == nullptr)
      {
        server->position = position;
        wholeList->AppendElement(server);
        resort = true;
      }
      
        /* Don't re-sort if the server is already in the requested position.
      */
@@ -457,27 +457,27 @@ static bool DIR_SetServerPosition(nsVoid
 static DIR_Server *dir_MatchServerPrefToServer(nsVoidArray *wholeList, const char *pref)
 {
   DIR_Server *server;
 
   PRInt32 count = wholeList->Count();
   PRInt32 i;
   for (i = 0; i < count; i++)
   {
-    if ((server = (DIR_Server *)wholeList->ElementAt(i)) != nsnull)
+    if ((server = (DIR_Server *)wholeList->ElementAt(i)) != nullptr)
     {
       if (server->prefName && PL_strstr(pref, server->prefName) == pref)
       {
         char c = pref[PL_strlen(server->prefName)];
         if (c == 0 || c == '.')
           return server;
       }
     }
   }
-  return nsnull;
+  return nullptr;
 }
 
 /* dir_ValidateAndAddNewServer
  *
  * This function verifies that the position, serverName and description values
  * are set for the given prefName.  If they are then it adds the server to the
  * unified server list.
  */
@@ -487,27 +487,27 @@ static bool dir_ValidateAndAddNewServer(
 
   const char *endname = PL_strchr(&fullprefname[PL_strlen(PREF_LDAP_SERVER_TREE_NAME) + 1], '.');
   if (endname)
   {
     char *prefname = (char *)PR_Malloc(endname - fullprefname + 1);
     if (prefname)
     {
       PRInt32 dirType;
-      char *t1 = nsnull, *t2 = nsnull;
+      char *t1 = nullptr, *t2 = nullptr;
 
       PL_strncpyz(prefname, fullprefname, endname - fullprefname + 1);
 
       dirType = DIR_GetIntPref(prefname, "dirType", -1);
       if (dirType != -1 &&
           DIR_GetIntPref(prefname, "position", 0) != 0 &&
-          (t1 = DIR_GetStringPref(prefname, "description", nsnull)) != nsnull)
+          (t1 = DIR_GetStringPref(prefname, "description", nullptr)) != nullptr)
       {
         if (dirType == PABDirectory ||
-           (t2 = DIR_GetStringPref(prefname, "serverName",  nsnull)) != nsnull)
+           (t2 = DIR_GetStringPref(prefname, "serverName",  nullptr)) != nullptr)
         {
           DIR_Server *server = (DIR_Server *)PR_Malloc(sizeof(DIR_Server));
           if (server)
           {
             DIR_InitServer(server, (DirectoryType)dirType);
             server->prefName = prefname;
             DIR_GetPrefsForOneServer(server);
             DIR_SetServerPosition(wholeList, server, server->position);
@@ -663,25 +663,25 @@ nsresult DIR_DeleteServerFromList(DIR_Se
 
   return NS_ERROR_NULL_POINTER;
 }
 
 static void DIR_DeleteServerList(nsVoidArray *wholeList)
 {
   if (wholeList)
   {
-    DIR_Server *server = nsnull;
+    DIR_Server *server = nullptr;
   
     /* TBD: Send notifications? */
     PRInt32 count = wholeList->Count();
     PRInt32 i;
     for (i = count - 1; i >=0; i--)
     {
       server = (DIR_Server *)wholeList->ElementAt(i);
-      if (server != nsnull)
+      if (server != nullptr)
         DIR_DeleteServer(server);
     }
     delete wholeList;
   }
 }
 
 /*****************************************************************************
  * Functions for managing JavaScript prefs for the DIR_Servers 
@@ -761,17 +761,17 @@ static nsresult dir_GetChildList(const n
     return NS_OK;
 }
 
 static char *DIR_GetStringPref(const char *prefRoot, const char *prefLeaf, const char *defaultValue)
 {
     nsresult rv;
     nsCOMPtr<nsIPrefBranch> pPref(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
     if (NS_FAILED(rv))
-        return nsnull;
+        return nullptr;
 
     nsCString value;
     nsCAutoString prefLocation(prefRoot);
 
     prefLocation.Append('.');
     prefLocation.Append(prefLeaf);
 
     if (NS_SUCCEEDED(pPref->GetCharPref(prefLocation.get(), getter_Copies(value))))
@@ -805,29 +805,29 @@ static char *DIR_GetStringPref(const cha
 */
 
 static char *DIR_GetDescription(const char *prefRoot)
 {
   nsresult rv;
   nsCOMPtr<nsIPrefBranch> pPref(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
 
   if (NS_FAILED(rv))
-    return nsnull;
+    return nullptr;
 
   nsCAutoString prefLocation(prefRoot);
   prefLocation.AppendLiteral(".description");
 
   nsString wvalue;
   nsCOMPtr<nsIPrefLocalizedString> locStr;
 
   rv = pPref->GetComplexValue(prefLocation.get(), NS_GET_IID(nsIPrefLocalizedString), getter_AddRefs(locStr));
   if (NS_SUCCEEDED(rv))
     rv = locStr->ToString(getter_Copies(wvalue));
 
-  char *value = nsnull;
+  char *value = nullptr;
   if (!wvalue.IsEmpty())
   {
     value = ToNewCString(NS_ConvertUTF16toUTF8(wvalue));
   }
   else
   {
     // In TB 2 only some prefs had chrome:// URIs. We had code in place that would
     // only get the localized string pref for the particular address books that
@@ -838,17 +838,17 @@ static char *DIR_GetDescription(const ch
     // set default pref values and allow users to change directory names.
     //
     // Now we have to support this, and so if for whatever reason we fail to get
     // the localized version, then we try and get the non-localized version
     // instead. If the string value is empty, then we'll just get the empty value
     // back here.
     rv = pPref->GetCharPref(prefLocation.get(), &value);
     if (NS_FAILED(rv))
-      value = nsnull;
+      value = nullptr;
   }
 
   return value;
 }
 
 static PRInt32 DIR_GetIntPref(const char *prefRoot, const char *prefLeaf, PRInt32 defaultValue)
 {
   nsresult rv;
@@ -869,17 +869,17 @@ static PRInt32 DIR_GetIntPref(const char
   return value;
 }
 
 /* This will convert from the old preference that was a path and filename */
 /* to a just a filename */
 static void DIR_ConvertServerFileName(DIR_Server* pServer)
 {
   char* leafName = pServer->fileName;
-  char* newLeafName = nsnull;
+  char* newLeafName = nullptr;
 #if defined(XP_WIN) || defined(XP_OS2)
   /* jefft -- bug 73349 This is to allow users share same address book.
    * It only works if the user specify a full path filename.
    */
 #ifdef XP_FileIsFullPath
   if (! XP_FileIsFullPath(leafName))
     newLeafName = XP_STRRCHR (leafName, '\\');
 #endif /* XP_FileIsFullPath */
@@ -898,17 +898,17 @@ static void DIR_ConvertServerFileName(DI
 void DIR_SetFileName(char** fileName, const char* defaultName)
 {
   if (!fileName)
     return;
 
   nsresult rv = NS_OK;
   nsCOMPtr<nsIFile> dbPath;
 
-  *fileName = nsnull;
+  *fileName = nullptr;
 
   nsCOMPtr<nsIAbManager> abManager = do_GetService(NS_ABMANAGER_CONTRACTID, &rv); 
   if (NS_SUCCEEDED(rv))
     rv = abManager->GetUserProfileDirectory(getter_AddRefs(dbPath));
   if (NS_SUCCEEDED(rv))
   {
     rv = dbPath->AppendNative(nsDependentCString(defaultName));
     if (NS_SUCCEEDED(rv))
@@ -928,22 +928,22 @@ void DIR_SetFileName(char** fileName, co
 Helper function used to generate a file name from the description
 of a directory. Caller must free returned string. 
 An extension is not applied 
 *****************************************************************/
 
 static char * dir_ConvertDescriptionToPrefName(DIR_Server * server)
 {
 #define MAX_PREF_NAME_SIZE 25
-  char * fileName = nsnull;
+  char * fileName = nullptr;
   char fileNameBuf[MAX_PREF_NAME_SIZE];
   PRInt32 srcIndex = 0;
   PRInt32 destIndex = 0;
   PRInt32 numSrcBytes = 0;
-  const char * descr = nsnull;
+  const char * descr = nullptr;
   if (server && server->description)
   {
     descr = server->description;
     numSrcBytes = PL_strlen(descr);
     while (srcIndex < numSrcBytes && destIndex < MAX_PREF_NAME_SIZE-1)
     {
       if (IS_DIGIT(descr[srcIndex]) || IS_ALPHA(descr[srcIndex]))
       {
@@ -961,18 +961,18 @@ static char * dir_ConvertDescriptionToPr
   fileName = strdup(fileNameBuf);
 
   return fileName;
 }
 
 
 void DIR_SetServerFileName(DIR_Server *server)
 {
-  char * tempName = nsnull; 
-  const char * prefName = nsnull;
+  char * tempName = nullptr; 
+  const char * prefName = nullptr;
   PRUint32 numHeaderBytes = 0; 
 
   if (server && (!server->fileName || !(*server->fileName)) )
   {
           PR_FREEIF(server->fileName); // might be one byte empty string.
     /* make sure we have a pref name...*/
     if (!server->prefName || !*server->prefName)
       server->prefName = dir_CreateServerPrefName(server);
@@ -1011,30 +1011,30 @@ void DIR_SetServerFileName(DIR_Server *s
 }
 
 static char *dir_CreateServerPrefName (DIR_Server *server)
 {
   /* we are going to try to be smart in how we generate our server
      pref name. We'll try to convert the description into a pref name
      and then verify that it is unique. If it is unique then use it... */
   char * leafName = dir_ConvertDescriptionToPrefName(server);
-  char * prefName = nsnull;
+  char * prefName = nullptr;
   bool isUnique = false;
 
   if (!leafName || !*leafName)
   {
     // we need to handle this in case the description has no alphanumeric chars
     // it's very common for cjk users
     leafName = strdup("_nonascii");
   }
 
   if (leafName)
   {
     PRInt32 uniqueIDCnt = 0;
-        char **children = nsnull;
+        char **children = nullptr;
     /* we need to verify that this pref string name is unique */
     prefName = PR_smprintf(PREF_LDAP_SERVER_TREE_NAME".%s", leafName);
     isUnique = false;
     PRUint32 prefCount;
     nsresult rv = dir_GetChildList(NS_LITERAL_CSTRING(PREF_LDAP_SERVER_TREE_NAME "."),
                                    &prefCount, &children);
     if (NS_SUCCEEDED(rv))
     {
@@ -1055,17 +1055,17 @@ static char *dir_CreateServerPrefName (D
 
       NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(prefCount, children);
     } /* while we don't have a unique name */
 
     // fallback to "user_directory_N" form if we failed to verify
     if (!isUnique && prefName)
     {
       PR_smprintf_free(prefName);
-      prefName = nsnull;
+      prefName = nullptr;
     }
 
     PR_Free(leafName);
 
   } /* if leafName */
 
   if (!prefName) /* last resort if we still don't have a pref name is to use user_directory string */
     return PR_smprintf(PREF_LDAP_SERVER_TREE_NAME".user_directory_%d", ++dir_UserId);
@@ -1196,17 +1196,17 @@ void DIR_SortServersByPosition(nsVoidArr
 static nsresult DIR_GetServerPreferences(nsVoidArray** list)
 {
   nsresult err;
   nsCOMPtr<nsIPrefBranch> pPref(do_GetService(NS_PREFSERVICE_CONTRACTID, &err));
   if (NS_FAILED(err))
     return err;
 
   PRInt32 version = -1;
-  nsVoidArray *newList = nsnull;
+  nsVoidArray *newList = nullptr;
   
   /* Update the ldap list version and see if there are old prefs to migrate. */
   err = pPref->GetIntPref(PREF_LDAP_VERSION_NAME, &version);
   NS_ENSURE_SUCCESS(err, err);
 
   /* Find the new-style "ldap_2.servers" tree in prefs */
   err = dir_GetPrefs(&newList);
 
@@ -1393,17 +1393,17 @@ static void DIR_SetIntPref(const char *p
 
 void DIR_SavePrefsForOneServer(DIR_Server *server)
 {
   if (!server)
     return;
 
   char *prefstring;
 
-  if (server->prefName == nsnull)
+  if (server->prefName == nullptr)
     server->prefName = dir_CreateServerPrefName(server);
   prefstring = server->prefName;
 
   server->savingServer = true;
 
   DIR_SetIntPref (prefstring, "position", server->position, kDefaultPosition);
 
   // Only save the non-default address book name
--- a/mailnews/addrbook/src/nsLDAPAutoCompleteSession.cpp
+++ b/mailnews/addrbook/src/nsLDAPAutoCompleteSession.cpp
@@ -556,17 +556,17 @@ nsLDAPAutoCompleteSession::DoTask()
                  "create @mozilla.org/network/ldap-operation;1");
 
         FinishAutoCompleteLookup(nsIAutoCompleteStatus::failureItems, rv, 
                                  BOUND);
         return NS_ERROR_FAILURE;
     }
 
     // Initialize the LDAP operation object.
-    rv = mOperation->Init(mConnection, this, nsnull);
+    rv = mOperation->Init(mConnection, this, nullptr);
     if (NS_FAILED(rv)) {
         NS_ERROR("nsLDAPAutoCompleteSession::DoTask(): couldn't "
                  "initialize LDAP operation");
         FinishAutoCompleteLookup(nsIAutoCompleteStatus::failureItems, rv, 
                                  BOUND);
         return NS_ERROR_UNEXPECTED;
     }
 
@@ -806,17 +806,17 @@ nsLDAPAutoCompleteSession::InitConnectio
         FinishAutoCompleteLookup(nsIAutoCompleteStatus::failureItems, rv, 
                                  UNBOUND);
         return NS_ERROR_NOT_INITIALIZED;
     }
 
     // Initialize the connection. This will cause an asynchronous DNS
     // lookup to occur, and we'll finish the binding of the connection
     // in the OnLDAPInit() listener function.
-    rv = mConnection->Init(mDirectoryUrl, mLogin, this, nsnull, mVersion);
+    rv = mConnection->Init(mDirectoryUrl, mLogin, this, nullptr, mVersion);
     if (NS_FAILED(rv)) {
         switch (rv) {
 
         case NS_ERROR_OUT_OF_MEMORY:
         case NS_ERROR_NOT_AVAILABLE:
         case NS_ERROR_FAILURE:
             PR_LOG(sLDAPAutoCompleteLogModule, PR_LOG_DEBUG, 
                    ("nsLDAPAutoCompleteSession::InitConnection(): mSimpleBind "
--- a/mailnews/addrbook/src/nsVCard.cpp
+++ b/mailnews/addrbook/src/nsVCard.cpp
@@ -471,17 +471,17 @@ static void enterValues(const char *valu
 static void enterProps(const char *s)
     {
     curProp = addGroup(curObj,s);
     deleteString((char *)s);
     }
 
 static void enterAttr(const char *s1, const char *s2)
 {
-  const char *p1, *p2 = nsnull;
+  const char *p1, *p2 = nullptr;
   p1 = lookupProp_(s1);
   if (s2) {
 	  VObject *a;
 	  p2 = lookupProp_(s2);
 	  a = addProp(curProp,p1);
 	  setVObjectStringZValue(a,p2);
 	}
   else
--- a/mailnews/base/public/nsIMsgMessageService.idl
+++ b/mailnews/base/public/nsIMsgMessageService.idl
@@ -22,17 +22,17 @@ interface nsICacheEntryDescriptor;
 
 [scriptable, uuid(3aa7080a-73ac-4394-9636-fc00e182319b)]
 interface nsIMsgMessageService : nsISupports {
      
   /**
    * If you want a handle on the running task, pass in a valid nsIURI 
    * ptr. You can later interrupt this action by asking the netlib 
    * service manager to interrupt the url you are given back. 
-   * Remember to release aURL when you are done with it. Pass nsnull
+   * Remember to release aURL when you are done with it. Pass nullptr
    * in for aURL if you don't care about the returned URL.
    */
 
 
   /**
    * Pass in the URI for the message you want to have copied.
    *
    * @param aSrcURI
--- a/mailnews/base/search/src/nsMsgBodyHandler.cpp
+++ b/mailnews/base/search/src/nsMsgBodyHandler.cpp
@@ -406,17 +406,17 @@ void nsMsgBodyHandler::SniffPossibleMIME
  * Decodes the given base64 string.
  *
  * It returns its decoded string in its input.
  *
  * @param pBufInOut   (inout) a buffer of the string
  */
 void nsMsgBodyHandler::Base64Decode (nsCString &pBufInOut)
 {
-  char *decodedBody = PL_Base64Decode(pBufInOut.get(), pBufInOut.Length(), nsnull);
+  char *decodedBody = PL_Base64Decode(pBufInOut.get(), pBufInOut.Length(), nullptr);
   if (decodedBody)
     pBufInOut.Adopt(decodedBody);
 
   PRInt32 offset = pBufInOut.FindChar('\n');
   while (offset != -1) {
     pBufInOut.Replace(offset, 1, ' ');
     offset = pBufInOut.FindChar('\n', offset);
   }
--- a/mailnews/base/search/src/nsMsgFilter.cpp
+++ b/mailnews/base/search/src/nsMsgFilter.cpp
@@ -164,18 +164,18 @@ NS_IMETHODIMP nsMsgRuleAction::GetCustom
   // found the correct custom action
   NS_ADDREF(*aCustomAction = m_customAction);
   return NS_OK;
 }
 
 nsMsgFilter::nsMsgFilter():
     m_temporary(false),
     m_unparseable(false),
-    m_filterList(nsnull),
-    m_expressionTree(nsnull)
+    m_filterList(nullptr),
+    m_expressionTree(nullptr)
 {
   NS_NewISupportsArray(getter_AddRefs(m_termList));
   NS_NewISupportsArray(getter_AddRefs(m_actionList));
 
   m_type = nsMsgFilterType::InboxRule | nsMsgFilterType::Manual;
 }
 
 nsMsgFilter::~nsMsgFilter()
@@ -238,17 +238,17 @@ NS_IMETHODIMP nsMsgFilter::AddTerm(
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgFilter::AppendTerm(nsIMsgSearchTerm * aTerm)
 {
     NS_ENSURE_TRUE(aTerm, NS_ERROR_NULL_POINTER);
     // invalidate expression tree if we're changing the terms
     delete m_expressionTree;
-    m_expressionTree = nsnull;
+    m_expressionTree = nullptr;
     return m_termList->AppendElement(static_cast<nsISupports*>(aTerm));
 }
 
 NS_IMETHODIMP
 nsMsgFilter::CreateTerm(nsIMsgSearchTerm **aResult)
 {
     NS_ENSURE_ARG_POINTER(aResult);
     nsMsgSearchTerm *term = new nsMsgSearchTerm;
@@ -421,25 +421,25 @@ NS_IMETHODIMP nsMsgFilter::GetTerm(PRInt
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgFilter::GetSearchTerms(nsISupportsArray **aResult)
 {
     NS_ENSURE_ARG_POINTER(aResult);
     // caller can change m_termList, which can invalidate m_expressionTree.
     delete m_expressionTree;
-    m_expressionTree = nsnull;
+    m_expressionTree = nullptr;
     NS_IF_ADDREF(*aResult = m_termList);
     return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgFilter::SetSearchTerms(nsISupportsArray *aSearchList)
 {
     delete m_expressionTree;
-    m_expressionTree = nsnull;
+    m_expressionTree = nullptr;
     m_termList = aSearchList;
     return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgFilter::SetScope(nsIMsgSearchScopeTerm *aResult)
 {
     m_scope = aResult;
     return NS_OK;
@@ -485,17 +485,17 @@ NS_IMETHODIMP nsMsgFilter::LogRuleHit(ns
     {
       mDateFormatter = do_CreateInstance(NS_DATETIMEFORMAT_CONTRACTID, &rv);
       NS_ENSURE_SUCCESS(rv, rv);
       if (!mDateFormatter)
       {
         return NS_ERROR_FAILURE;
       }
     }
-    mDateFormatter->FormatPRExplodedTime(nsnull, kDateFormatShort,
+    mDateFormatter->FormatPRExplodedTime(nullptr, kDateFormatShort,
                                          kTimeFormatSeconds, &exploded,
                                          dateValue);
 
     (void)aMsgHdr->GetMime2DecodedAuthor(authorValue);
     (void)aMsgHdr->GetMime2DecodedSubject(subjectValue);
 
     nsCString buffer;
 #ifdef MOZILLA_INTERNAL_API
--- a/mailnews/base/search/src/nsMsgFilterList.cpp
+++ b/mailnews/base/search/src/nsMsgFilterList.cpp
@@ -33,17 +33,17 @@ static const PRUnichar unicodeFormatter[
 
 
 nsMsgFilterList::nsMsgFilterList() :
     m_fileVersion(0)
 {
   m_loggingEnabled = false;
   m_startWritingToBuffer = false;
   m_temporaryList = false;
-  m_curFilter = nsnull;
+  m_curFilter = nullptr;
 }
 
 NS_IMPL_ADDREF(nsMsgFilterList)
 NS_IMPL_RELEASE(nsMsgFilterList)
 NS_IMPL_QUERY_INTERFACE1(nsMsgFilterList, nsIMsgFilterList)
 
 NS_IMETHODIMP nsMsgFilterList::CreateFilter(const nsAString &name,class nsIMsgFilter **aFilter)
 {
@@ -97,17 +97,17 @@ NS_IMETHODIMP nsMsgFilterList::EnsureLog
     NS_ENSURE_SUCCESS(rv,rv);
   }
   return NS_OK;
 }
 
 nsresult nsMsgFilterList::TruncateLog()
 {
   // this will flush and close the steam
-  nsresult rv = SetLogStream(nsnull);
+  nsresult rv = SetLogStream(nullptr);
   NS_ENSURE_SUCCESS(rv,rv);
 
   nsCOMPtr <nsIFile> file;
   rv = GetLogFile(getter_AddRefs(file));
   NS_ENSURE_SUCCESS(rv,rv);
 
   file->Remove(false);
   rv = file->Create(nsIFile::NORMAL_FILE_TYPE, 0644);
@@ -279,17 +279,17 @@ nsMsgFilterList::ApplyFiltersToHdr(nsMsg
                                    nsIMsgFilterHitNotify *listener,
                                    nsIMsgWindow *msgWindow)
 {
   nsCOMPtr<nsIMsgFilter> filter;
   PRUint32 filterCount = 0;
   nsresult rv = GetFilterCount(&filterCount);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  nsMsgSearchScopeTerm* scope = new nsMsgSearchScopeTerm(nsnull, nsMsgSearchScope::offlineMail, folder);
+  nsMsgSearchScopeTerm* scope = new nsMsgSearchScopeTerm(nullptr, nsMsgSearchScope::offlineMail, folder);
   scope->AddRef();
   if (!scope) return NS_ERROR_OUT_OF_MEMORY;
 
   for (PRUint32 filterIndex = 0; filterIndex < filterCount; filterIndex++)
   {
     if (NS_SUCCEEDED(GetFilterAt(filterIndex, getter_AddRefs(filter))))
     {
       bool isEnabled;
@@ -302,17 +302,17 @@ nsMsgFilterList::ApplyFiltersToHdr(nsMsg
       filter->GetFilterType(&curFilterType);
       if (curFilterType & filterType)
       {
         nsresult matchTermStatus = NS_OK;
         bool result;
 
         filter->SetScope(scope);
         matchTermStatus = filter->MatchHdr(msgHdr, folder, db, headers, headersSize, &result);
-        filter->SetScope(nsnull);
+        filter->SetScope(nullptr);
         if (NS_SUCCEEDED(matchTermStatus) && result && listener)
         {
           bool applyMore = true;
 
           rv = listener->ApplyFilterHit(filter, msgWindow, &applyMore);
           if (NS_FAILED(rv) || !applyMore)
             break;
         }
@@ -440,17 +440,17 @@ char nsMsgFilterList::LoadAttrib(nsMsgFi
 
 const char *nsMsgFilterList::GetStringForAttrib(nsMsgFilterFileAttribValue attrib)
 {
   for (unsigned int tableIndex = 0; tableIndex < sNumFilterFileAttribTable; tableIndex++)
   {
     if (attrib == FilterFileAttribTable[tableIndex].attrib)
       return FilterFileAttribTable[tableIndex].attribName;
   }
-  return nsnull;
+  return nullptr;
 }
 
 nsresult nsMsgFilterList::LoadValue(nsCString &value, nsIInputStream *aStream)
 {
   nsCAutoString  valueStr;
   char  curChar;
   value = "";
   curChar = SkipWhitespace(aStream);
@@ -551,17 +551,17 @@ nsresult nsMsgFilterList::LoadTextFilter
           if (unparseableFilter)
           {
             m_curFilter->SetUnparsedBuffer(m_unparsedFilterBuffer);
             m_curFilter->SetEnabled(false); //disable the filter because we don't know how to apply it
           }
           m_unparsedFilterBuffer = nextFilterPart;
         }
         nsMsgFilter *filter = new nsMsgFilter;
-        if (filter == nsnull)
+        if (filter == nullptr)
         {
           err = NS_ERROR_OUT_OF_MEMORY;
           break;
         }
         filter->SetFilterList(static_cast<nsIMsgFilterList*>(this));
         if (m_fileVersion == k45Version)
         {
           nsAutoString unicodeStr;
@@ -743,17 +743,17 @@ NS_IMETHODIMP nsMsgFilterList::ParseCond
   {
     // insert code to save the boolean operator if there is one for this search term....
     const char *openParen = PL_strchr(curPtr, '(');
     const char *orTermPos = PL_strchr(curPtr, 'O');    // determine if an "OR" appears b4 the openParen...
     bool ANDTerm = true;
     if (orTermPos && orTermPos < openParen) // make sure OR term falls before the '('
       ANDTerm = false;
 
-    char *termDup = nsnull;
+    char *termDup = nullptr;
     if (openParen)
     {
       bool foundEndTerm = false;
       bool inQuote = false;
       for (curPtr = openParen +1; *curPtr; curPtr++)
       {
         if (*curPtr == '\\' && *(curPtr + 1) == '"')
           curPtr++;
@@ -828,17 +828,17 @@ nsresult nsMsgFilterList::WriteIntAttr(n
 
 NS_IMETHODIMP
 nsMsgFilterList::WriteStrAttr(nsMsgFilterFileAttribValue attrib,
                               const char *aStr, nsIOutputStream *aStream)
 {
   nsresult rv = NS_OK;
   if (aStr && *aStr && aStream) // only proceed if we actually have a string to write out.
   {
-    char *escapedStr = nsnull;
+    char *escapedStr = nullptr;
     if (PL_strchr(aStr, '"'))
       escapedStr = nsMsgSearchTerm::EscapeQuotesInStr(aStr);
 
     const char *attribStr = GetStringForAttrib(attrib);
     if (attribStr)
     {
       PRUint32 bytesWritten;
       nsCAutoString writeStr(attribStr);
@@ -932,17 +932,17 @@ nsresult
 nsMsgFilterList::GetFilterNamed(const nsAString &aName, nsIMsgFilter **aResult)
 {
     NS_ENSURE_ARG_POINTER(aResult);
 
     PRUint32 count = 0;
     nsresult rv = GetFilterCount(&count);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    *aResult = nsnull;
+    *aResult = nullptr;
     for (PRUint32 i = 0; i < count; i++) {
         nsCOMPtr<nsIMsgFilter> filter;
         rv = GetFilterAt(i, getter_AddRefs(filter));
         if (NS_FAILED(rv)) continue;
 
         nsString filterName;
         filter->GetFilterName(filterName);
         if (filterName.Equals(aName))
@@ -1146,17 +1146,17 @@ nsresult nsMsgFilterList::ComputeArbitra
 
     nsCOMPtr <nsISupportsArray> searchTerms;
     PRUint32 numSearchTerms=0;
     filter->GetSearchTerms(getter_AddRefs(searchTerms));
     if (searchTerms)
       searchTerms->Count(&numSearchTerms);
     for (PRUint32 i = 0; i < numSearchTerms; i++)
     {
-      filter->GetTerm(i, &attrib, nsnull, nsnull, nsnull, arbitraryHeader);
+      filter->GetTerm(i, &attrib, nullptr, nullptr, nullptr, arbitraryHeader);
       if (!arbitraryHeader.IsEmpty())
       {
         if (m_arbitraryHeaders.IsEmpty())
           m_arbitraryHeaders.Assign(arbitraryHeader);
         else if (m_arbitraryHeaders.Find(arbitraryHeader, CaseInsensitiveCompare) == -1)
         {
           m_arbitraryHeaders.Append(" ");
           m_arbitraryHeaders.Append(arbitraryHeader);
--- a/mailnews/base/search/src/nsMsgFilterService.cpp
+++ b/mailnews/base/search/src/nsMsgFilterService.cpp
@@ -78,17 +78,17 @@ NS_IMETHODIMP nsMsgFilterService::OpenFi
   // temporarily tell the filter where its file path is
   filterList->SetDefaultFile(aFilterFile);
 
   PRInt64 size;
   rv = aFilterFile->GetFileSize(&size);
   if (NS_SUCCEEDED(rv) && size > 0)
     rv = filterList->LoadTextFilters(fileStream);
   fileStream->Close();
-  fileStream =nsnull;
+  fileStream =nullptr;
   if (NS_SUCCEEDED(rv))
   {
     *resultFilterList = filterList;
     PRInt16 version;
     filterList->GetVersion(&version);
     if (version != kFileVersion)
       SaveFilterList(filterList, aFilterFile);
   }
@@ -211,17 +211,17 @@ nsMsgFilterService::ThrowAlertMsg(const 
   if (NS_SUCCEEDED(rv) && !alertString.IsEmpty() && aMsgWindow)
   {
     nsCOMPtr <nsIDocShell> docShell;
     aMsgWindow->GetRootDocShell(getter_AddRefs(docShell));
     if (docShell)
     {
       nsCOMPtr<nsIPrompt> dialog(do_GetInterface(docShell));
       if (dialog && !alertString.IsEmpty())
-        dialog->Alert(nsnull, alertString.get());
+        dialog->Alert(nullptr, alertString.get());
     }
   }
   return rv;
 }
 
 // this class is used to run filters after the fact, i.e., after new mail has been downloaded from the server.
 // It can do the following:
 // 1. Apply a single imap or pop3 filter on a single folder.
@@ -248,17 +248,17 @@ public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIURLLISTENER
   NS_DECL_NSIMSGSEARCHNOTIFY
   NS_DECL_NSIMSGCOPYSERVICELISTENER
 
   nsresult  AdvanceToNextFolder();  // kicks off the process
 protected:
   virtual   nsresult  RunNextFilter();
-  nsresult  ApplyFilter(bool *aApplyMore = nsnull);
+  nsresult  ApplyFilter(bool *aApplyMore = nullptr);
   nsresult  OnEndExecution(nsresult executionStatus); // do what we have to do to cleanup.
   bool      ContinueExecutionPrompt();
   nsresult  DisplayConfirmationPrompt(nsIMsgWindow *msgWindow, const PRUnichar *confirmString, bool *confirmed);
   nsCOMPtr <nsIMsgWindow>     m_msgWindow;
   nsCOMPtr <nsIMsgFilterList> m_filters;
   nsCOMPtr <nsISupportsArray> m_folders;
   nsCOMPtr <nsIMsgFolder>     m_curFolder;
   nsCOMPtr <nsIMsgDatabase>   m_curFolderDB;
@@ -473,17 +473,17 @@ nsresult nsMsgFilterAfterTheFact::ApplyF
       switch (actionType)
       {
       case nsMsgFilterAction::Delete:
         // we can't pass ourselves in as a copy service listener because the copy service
         // listener won't get called in several situations (e.g., the delete model is imap delete)
         // and we rely on the listener getting called to continue the filter application.
         // This means we're going to end up firing off the delete, and then subsequently
         // issuing a search for the next filter, which will block until the delete finishes.
-        m_curFolder->DeleteMessages(m_searchHitHdrs, m_msgWindow, false, false, nsnull, false /*allow Undo*/ );
+        m_curFolder->DeleteMessages(m_searchHitHdrs, m_msgWindow, false, false, nullptr, false /*allow Undo*/ );
         for (PRUint32 i = 0; i < m_searchHits.Length(); i++)
           m_curFolder->OrProcessingFlags(m_searchHits[i], nsMsgProcessingFlags::FilterToMove);
         //if we are deleting then we couldn't care less about applying remaining filter actions
         *aApplyMore = false;
         break;
       case nsMsgFilterAction::MoveToFolder:
       case nsMsgFilterAction::CopyToFolder:
       {
@@ -569,32 +569,32 @@ nsresult nsMsgFilterAfterTheFact::ApplyF
             {
               nsCOMPtr <nsIMsgThread> msgThread;
               nsMsgKey threadKey;
               m_curFolderDB->GetThreadContainingMsgHdr(msgHdr, getter_AddRefs(msgThread));
               if (msgThread)
               {
                 msgThread->GetThreadKey(&threadKey);
                 if (actionType == nsMsgFilterAction::KillThread)
-                  m_curFolderDB->MarkThreadIgnored(msgThread, threadKey, true, nsnull);
+                  m_curFolderDB->MarkThreadIgnored(msgThread, threadKey, true, nullptr);
                 else
-                  m_curFolderDB->MarkThreadWatched(msgThread, threadKey, true, nsnull);
+                  m_curFolderDB->MarkThreadWatched(msgThread, threadKey, true, nullptr);
               }
             }
           }
         }
         break;
       case nsMsgFilterAction::KillSubthread:
         {
           for (PRUint32 msgIndex = 0; msgIndex < m_searchHits.Length(); msgIndex++)
           {
             nsCOMPtr <nsIMsgDBHdr> msgHdr;
             m_searchHitHdrs->QueryElementAt(msgIndex, NS_GET_IID(nsIMsgDBHdr), getter_AddRefs(msgHdr));
             if (msgHdr)
-              m_curFolderDB->MarkHeaderKilled(msgHdr, true, nsnull);
+              m_curFolderDB->MarkHeaderKilled(msgHdr, true, nullptr);
           }
         }
         break;
       case nsMsgFilterAction::ChangePriority:
           {
               nsMsgPriorityValue filterPriority;
               filterAction->GetPriority(&filterPriority);
               for (PRUint32 msgIndex = 0; msgIndex < m_searchHits.Length(); msgIndex++)
@@ -700,17 +700,17 @@ nsresult nsMsgFilterAfterTheFact::ApplyF
                   if (!partialMsgs)
                     partialMsgs = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
                   NS_ENSURE_SUCCESS(rv, rv);
                   partialMsgs->AppendElement(msgHdr, false);
                 }
               }
             }
             if (partialMsgs)
-              m_curFolder->DeleteMessages(partialMsgs, m_msgWindow, true, false, nsnull, false);
+              m_curFolder->DeleteMessages(partialMsgs, m_msgWindow, true, false, nullptr, false);
           }
         }
         break;
       case nsMsgFilterAction::FetchBodyFromPop3Server:
         {
           nsCOMPtr <nsIMsgLocalMailFolder> localFolder = do_QueryInterface(m_curFolder);
           if (localFolder)
           {
@@ -823,17 +823,17 @@ nsMsgFilterService::GetCustomAction(cons
     nsCAutoString id;
     nsresult rv = mCustomActions[i]->GetId(id);
     if (NS_SUCCEEDED(rv) && aId.Equals(id))
     {
       NS_ADDREF(*aResult = mCustomActions[i]);
       return NS_OK;
     }
   }
-  aResult = nsnull;
+  aResult = nullptr;
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP nsMsgFilterService::AddCustomTerm(nsIMsgSearchCustomTerm *aTerm)
 {
   mCustomTerms.AppendObject(aTerm);
   return NS_OK;
 }
@@ -856,17 +856,17 @@ nsMsgFilterService::GetCustomTerm(const 
     nsCAutoString id;
     nsresult rv = mCustomTerms[i]->GetId(id);
     if (NS_SUCCEEDED(rv) && aId.Equals(id))
     {
       NS_ADDREF(*aResult = mCustomTerms[i]);
       return NS_OK;
     }
   }
-  aResult = nsnull;
+  aResult = nullptr;
   // we use a null result to indicate failure to find a term
   return NS_OK;
 }
 
 // nsMsgApplyFiltersToMessages overrides nsMsgFilterAfterTheFact in order to
 // apply filters to a list of messages, rather than an entire folder
 class nsMsgApplyFiltersToMessages : public nsMsgFilterAfterTheFact
 {
@@ -913,38 +913,38 @@ nsresult nsMsgApplyFiltersToMessages::Ru
     NS_ENSURE_SUCCESS(rv, rv);
     if (!(filterType & m_filterType))
       continue;
     rv = m_curFilter->GetEnabled(&isEnabled);
     NS_ENSURE_SUCCESS(rv, rv);
     if (!isEnabled)
       continue;
 
-    nsCOMPtr<nsIMsgSearchScopeTerm> scope(new nsMsgSearchScopeTerm(nsnull, nsMsgSearchScope::offlineMail, m_curFolder));
+    nsCOMPtr<nsIMsgSearchScopeTerm> scope(new nsMsgSearchScopeTerm(nullptr, nsMsgSearchScope::offlineMail, m_curFolder));
     if (!scope)
       return NS_ERROR_OUT_OF_MEMORY;
     m_curFilter->SetScope(scope);
     OnNewSearch();
 
     for (PRInt32 i = 0; i < m_msgHdrList.Count(); i++)
     {
       nsIMsgDBHdr* msgHdr = m_msgHdrList[i];
       bool matched;
 
-      rv = m_curFilter->MatchHdr(msgHdr, m_curFolder, m_curFolderDB, nsnull, 0, &matched);
+      rv = m_curFilter->MatchHdr(msgHdr, m_curFolder, m_curFolderDB, nullptr, 0, &matched);
 
       if (NS_SUCCEEDED(rv) && matched)
       {
         // In order to work with nsMsgFilterAfterTheFact::ApplyFilter we initialize
         // nsMsgFilterAfterTheFact's information with a search hit now for the message
         // that we're filtering.
         OnSearchHit(msgHdr, m_curFolder);
       }
     }
-    m_curFilter->SetScope(nsnull);
+    m_curFilter->SetScope(nullptr);
 
     if (m_searchHits.Length() > 0)
     {
       bool applyMore = true;
 
       m_nextAction = 0;
       rv = ApplyFilter(&applyMore);
       NS_ENSURE_SUCCESS(rv, rv);
@@ -1071,13 +1071,13 @@ nsMsgFilterAfterTheFact::DisplayConfirma
   if (msgWindow)
   {
     nsCOMPtr <nsIDocShell> docShell;
     msgWindow->GetRootDocShell(getter_AddRefs(docShell));
     if (docShell)
     {
       nsCOMPtr<nsIPrompt> dialog(do_GetInterface(docShell));
       if (dialog && confirmString)
-        dialog->Confirm(nsnull, confirmString, confirmed);
+        dialog->Confirm(nullptr, confirmString, confirmed);
     }
   }
   return NS_OK;
 }
--- a/mailnews/base/search/src/nsMsgLocalSearch.cpp
+++ b/mailnews/base/search/src/nsMsgLocalSearch.cpp
@@ -55,46 +55,46 @@ nsMsgSearchBoolExpression * nsMsgSearchB
   }
 
   nsMsgSearchBoolExpression * newExpr = new nsMsgSearchBoolExpression (aOrigExpr, aExpression, aBoolOp);
   return (newExpr) ? newExpr : aOrigExpr;
 }
 
 nsMsgSearchBoolExpression::nsMsgSearchBoolExpression()
 {
-    m_term = nsnull;
+    m_term = nullptr;
     m_boolOp = nsMsgSearchBooleanOp::BooleanAND;
-    m_leftChild = nsnull;
-    m_rightChild = nsnull;
+    m_leftChild = nullptr;
+    m_rightChild = nullptr;
 }
 
 nsMsgSearchBoolExpression::nsMsgSearchBoolExpression (nsIMsgSearchTerm * newTerm, char * encodingStr)
 // we are creating an expression which contains a single search term (newTerm)
 // and the search term's IMAP or NNTP encoding value for online search expressions AND
 // a boolean evaluation value which is used for offline search expressions.
 {
     m_term = newTerm;
     m_encodingStr = encodingStr;
     m_boolOp = nsMsgSearchBooleanOp::BooleanAND;
 
     // this expression does not contain sub expressions
-    m_leftChild = nsnull;
-    m_rightChild = nsnull;
+    m_leftChild = nullptr;
+    m_rightChild = nullptr;
 }
 
 
 nsMsgSearchBoolExpression::nsMsgSearchBoolExpression (nsMsgSearchBoolExpression * expr1, nsMsgSearchBoolExpression * expr2, nsMsgSearchBooleanOperator boolOp)
 // we are creating an expression which contains two sub expressions and a boolean operator used to combine
 // them.
 {
     m_leftChild = expr1;
     m_rightChild = expr2;
     m_boolOp = boolOp;
 
-    m_term = nsnull;
+    m_term = nullptr;
 }
 
 nsMsgSearchBoolExpression::~nsMsgSearchBoolExpression()
 {
   // we must recursively destroy all sub expressions before we destroy ourself.....We leave search terms alone!
   delete m_leftChild;
   delete m_rightChild;
 }
@@ -323,17 +323,17 @@ nsMsgSearchOfflineMail::MatchTermsForSea
                                             nsISupportsArray* termList,
                                             const char *defaultCharset,
                                             nsIMsgSearchScopeTerm *scope,
                                             nsIMsgDatabase *db,
                                             nsMsgSearchBoolExpression ** aExpressionTree,
                                             bool *pResult)
 {
 
-    return MatchTerms(msgToMatch, termList, defaultCharset, scope, db, nsnull, 0, false, aExpressionTree, pResult);
+    return MatchTerms(msgToMatch, termList, defaultCharset, scope, db, nullptr, 0, false, aExpressionTree, pResult);
 }
 
 nsresult nsMsgSearchOfflineMail::ConstructExpressionTree(nsISupportsArray * termList,
                                             PRUint32 termCount,
                                             PRUint32 &aStartPosInList,
                                             nsMsgSearchBoolExpression ** aExpressionTree)
 {
   nsMsgSearchBoolExpression * finalExpression = *aExpressionTree;
@@ -371,17 +371,17 @@ nsresult nsMsgSearchOfflineMail::Constru
             &finalExpression->m_rightChild);
 
           // undo our damage
           pTerm->SetBeginsGrouping(true);
 
       }
       else
       {
-        finalExpression = nsMsgSearchBoolExpression::AddSearchTerm(finalExpression, pTerm, nsnull);    // add the term to the expression tree
+        finalExpression = nsMsgSearchBoolExpression::AddSearchTerm(finalExpression, pTerm, nullptr);    // add the term to the expression tree
 
         if (endsGrouping)
           break;
       }
 
       aStartPosInList++;
   } // while we still have terms to process in this group
 
@@ -692,17 +692,17 @@ nsresult nsMsgSearchOfflineMail::MatchTe
 
 nsresult nsMsgSearchOfflineMail::Search (bool *aDone)
 {
   nsresult err = NS_OK;
 
   NS_ENSURE_ARG(aDone);
   nsresult dbErr = NS_OK;
   nsCOMPtr<nsIMsgDBHdr> msgDBHdr;
-  nsMsgSearchBoolExpression *expressionTree = nsnull;
+  nsMsgSearchBoolExpression *expressionTree = nullptr;
 
   const PRUint32 kTimeSliceInMS = 200;
 
   *aDone = false;
   // Try to open the DB lazily. This will set up a parser if one is required
   if (!m_db)
     err = OpenSummaryFile ();
   if (!m_db)  // must be reparsing.
@@ -761,20 +761,20 @@ nsresult nsMsgSearchOfflineMail::Search 
   return err;
 }
 
 void nsMsgSearchOfflineMail::CleanUpScope()
 {
   // Let go of the DB when we're done with it so we don't kill the db cache
   if (m_db)
   {
-    m_listContext = nsnull;
+    m_listContext = nullptr;
     m_db->Close(false);
   }
-  m_db = nsnull;
+  m_db = nullptr;
 
   if (m_scope)
     m_scope->CloseInputStream();
 }
 
 NS_IMETHODIMP nsMsgSearchOfflineMail::AddResultElement (nsIMsgDBHdr *pHeaders)
 {
     nsresult err = NS_OK;
@@ -791,17 +791,17 @@ NS_IMETHODIMP nsMsgSearchOfflineMail::Ad
 }
 
 NS_IMETHODIMP
 nsMsgSearchOfflineMail::Abort ()
 {
     // Let go of the DB when we're done with it so we don't kill the db cache
     if (m_db)
         m_db->Close(true /* commit in case we downloaded new headers */);
-    m_db = nsnull;
+    m_db = nullptr;
     return nsMsgSearchAdapter::Abort ();
 }
 
 /* void OnStartRunningUrl (in nsIURI url); */
 NS_IMETHODIMP nsMsgSearchOfflineMail::OnStartRunningUrl(nsIURI *url)
 {
     return NS_OK;
 }
@@ -972,45 +972,45 @@ nsresult SetLocalNews(nsIMsgSearchValidi
   aTable->SetAvailable (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::EndsWith, 1);
   aTable->SetEnabled   (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::EndsWith, 1);
   return NS_OK;
 
 }
 
 nsresult nsMsgSearchValidityManager::InitLocalNewsTable()
 {
-  NS_ASSERTION (nsnull == m_localNewsTable, "already have local news validity table");
+  NS_ASSERTION (nullptr == m_localNewsTable, "already have local news validity table");
   nsresult rv = NewTable(getter_AddRefs(m_localNewsTable));
   NS_ENSURE_SUCCESS(rv, rv);
   return SetLocalNews(m_localNewsTable);
 }
 
 nsresult nsMsgSearchValidityManager::InitLocalNewsBodyTable()
 {
-  NS_ASSERTION (nsnull == m_localNewsBodyTable, "already have local news+body validity table");
+  NS_ASSERTION (nullptr == m_localNewsBodyTable, "already have local news+body validity table");
   nsresult rv = NewTable(getter_AddRefs(m_localNewsBodyTable));
   NS_ENSURE_SUCCESS(rv, rv);
   rv = SetLocalNews(m_localNewsBodyTable);
   NS_ENSURE_SUCCESS(rv, rv);
   return SetBody(m_localNewsBodyTable);
 }
 
 nsresult nsMsgSearchValidityManager::InitLocalNewsJunkTable()
 {
-  NS_ASSERTION (nsnull == m_localNewsJunkTable, "already have local news+junk validity table");
+  NS_ASSERTION (nullptr == m_localNewsJunkTable, "already have local news+junk validity table");
   nsresult rv = NewTable(getter_AddRefs(m_localNewsJunkTable));
   NS_ENSURE_SUCCESS(rv, rv);
   rv = SetLocalNews(m_localNewsJunkTable);
   NS_ENSURE_SUCCESS(rv, rv);
   return SetJunk(m_localNewsJunkTable);
 }
 
 nsresult nsMsgSearchValidityManager::InitLocalNewsJunkBodyTable()
 {
-  NS_ASSERTION (nsnull == m_localNewsJunkBodyTable, "already have local news+junk+body validity table");
+  NS_ASSERTION (nullptr == m_localNewsJunkBodyTable, "already have local news+junk+body validity table");
   nsresult rv = NewTable(getter_AddRefs(m_localNewsJunkBodyTable));
   NS_ENSURE_SUCCESS(rv, rv);
   rv = SetLocalNews(m_localNewsJunkBodyTable);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = SetJunk(m_localNewsJunkBodyTable);
   NS_ENSURE_SUCCESS(rv, rv);
   return SetBody(m_localNewsJunkBodyTable);
 }
--- a/mailnews/base/search/src/nsMsgSearchAdapter.cpp
+++ b/mailnews/base/search/src/nsMsgSearchAdapter.cpp
@@ -90,17 +90,17 @@ nsMsgSearchAdapter::~nsMsgSearchAdapter(
 {
 }
 
 NS_IMETHODIMP nsMsgSearchAdapter::ClearScope()
 {
   if (m_scope)
   {
     m_scope->CloseInputStream();
-    m_scope = nsnull;
+    m_scope = nullptr;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgSearchAdapter::ValidateTerms ()
 {
   // all this used to do is check if the object had been deleted - we can skip that.
   return NS_OK;
@@ -145,58 +145,58 @@ NS_IMETHODIMP nsMsgSearchAdapter::AddHit
   NS_ASSERTION(false, "shouldn't call this base class impl");
   return NS_ERROR_FAILURE;
 }
 
 
 char *
 nsMsgSearchAdapter::GetImapCharsetParam(const PRUnichar *destCharset)
 {
-  char *result = nsnull;
+  char *result = nullptr;
 
   // Specify a character set unless we happen to be US-ASCII.
   if (NS_strcmp(destCharset, NS_LITERAL_STRING("us-ascii").get()))
       result = PR_smprintf("%s%s", nsMsgSearchAdapter::m_kImapCharset, NS_ConvertUTF16toUTF8(destCharset).get());
 
   return result;
 }
 
 /*
    09/21/2000 - taka@netscape.com
    This method is bogus. Escape must be done against char * not PRUnichar *
    should be rewritten later.
    for now, just duplicate the string.
 */
 PRUnichar *nsMsgSearchAdapter::EscapeSearchUrl (const PRUnichar *nntpCommand)
 {
-  return nntpCommand ? NS_strdup(nntpCommand) : nsnull;
+  return nntpCommand ? NS_strdup(nntpCommand) : nullptr;
 }
 
 /*
    09/21/2000 - taka@netscape.com
    This method is bogus. Escape must be done against char * not PRUnichar *
    should be rewritten later.
    for now, just duplicate the string.
 */
 PRUnichar *
 nsMsgSearchAdapter::EscapeImapSearchProtocol(const PRUnichar *imapCommand)
 {
-  return imapCommand ? NS_strdup(imapCommand) : nsnull;
+  return imapCommand ? NS_strdup(imapCommand) : nullptr;
 }
 
 /*
    09/21/2000 - taka@netscape.com
    This method is bogus. Escape must be done against char * not PRUnichar *
    should be rewritten later.
    for now, just duplicate the string.
 */
 PRUnichar *
 nsMsgSearchAdapter::EscapeQuoteImapSearchProtocol(const PRUnichar *imapCommand)
 {
-  return imapCommand ? NS_strdup(imapCommand) : nsnull;
+  return imapCommand ? NS_strdup(imapCommand) : nullptr;
 }
 
 char *nsMsgSearchAdapter::UnEscapeSearchUrl (const char *commandSpecificData)
 {
   char *result = (char*) PR_Malloc (strlen(commandSpecificData) + 1);
   if (result)
   {
     char *resultPtr = result;
@@ -295,20 +295,20 @@ nsresult nsMsgSearchAdapter::EncodeImapT
   NS_ENSURE_ARG_POINTER(term);
   NS_ENSURE_ARG_POINTER(ppOutTerm);
 
   nsresult err = NS_OK;
   bool useNot = false;
   bool useQuotes = false;
   bool ignoreValue = false;
   nsCAutoString arbitraryHeader;
-  const char *whichMnemonic = nsnull;
-  const char *orHeaderMnemonic = nsnull;
+  const char *whichMnemonic = nullptr;
+  const char *orHeaderMnemonic = nullptr;
 
-  *ppOutTerm = nsnull;
+  *ppOutTerm = nullptr;
 
   nsCOMPtr <nsIMsgSearchValue> searchValue;
   nsresult rv = term->GetValue(getter_AddRefs(searchValue));
 
   NS_ENSURE_SUCCESS(rv,rv);
 
   nsMsgSearchOpValue op;
   term->GetOp(&op);
@@ -446,17 +446,17 @@ nsresult nsMsgSearchAdapter::EncodeImapT
       }
       else
       {
         NS_ASSERTION(false, "invalid search operator");
         return NS_ERROR_INVALID_ARG;
       }
     }
 
-    char *value = nsnull;
+    char *value = nullptr;
     char dateBuf[100];
     dateBuf[0] = '\0';
 
     bool valueWasAllocated = false;
     if (attrib == nsMsgSearchAttrib::Date)
     {
       // note that there used to be code here that encoded an RFC822 date for imap searches.
       // The IMAP RFC 2060 is misleading to the point that it looks like it requires an RFC822
@@ -657,17 +657,17 @@ nsresult nsMsgSearchAdapter::EncodeImapV
 
 
 nsresult nsMsgSearchAdapter::EncodeImap (char **ppOutEncoding, nsISupportsArray *searchTerms, const PRUnichar *srcCharset, const PRUnichar *destCharset, bool reallyDredd)
 {
   // i've left the old code (before using CBoolExpression for debugging purposes to make sure that
   // the new code generates the same encoding string as the old code.....
 
   nsresult err = NS_OK;
-  *ppOutEncoding = nsnull;
+  *ppOutEncoding = nullptr;
 
   PRUint32 termCount;
   searchTerms->Count(&termCount);
   PRUint32 i = 0;
 
   // create our expression
   nsMsgSearchBoolExpression * expression = new nsMsgSearchBoolExpression();
   if (!expression)
@@ -679,17 +679,17 @@ nsresult nsMsgSearchAdapter::EncodeImap 
     bool matchAll;
     nsCOMPtr<nsIMsgSearchTerm> pTerm;
     searchTerms->QueryElementAt(i, NS_GET_IID(nsIMsgSearchTerm),
       (void **)getter_AddRefs(pTerm));
     pTerm->GetMatchAll(&matchAll);
     if (matchAll)
       continue;
     err = EncodeImapTerm (pTerm, reallyDredd, srcCharset, destCharset, &termEncoding);
-    if (NS_SUCCEEDED(err) && nsnull != termEncoding)
+    if (NS_SUCCEEDED(err) && nullptr != termEncoding)
     {
       expression = nsMsgSearchBoolExpression::AddSearchTerm(expression, pTerm, termEncoding);
       delete [] termEncoding;
     }
   }
 
   if (NS_SUCCEEDED(err))
   {
@@ -710,20 +710,20 @@ nsresult nsMsgSearchAdapter::EncodeImap 
 
 
 char *nsMsgSearchAdapter::TransformSpacesToStars (const char *spaceString, msg_TransformType transformType)
 {
   char *starString;
 
   if (transformType == kOverwrite)
   {
-    if ((starString = strdup(spaceString)) != nsnull)
+    if ((starString = strdup(spaceString)) != nullptr)
     {
       char *star = starString;
-      while ((star = PL_strchr(star, ' ')) != nsnull)
+      while ((star = PL_strchr(star, ' ')) != nullptr)
         *star = '*';
     }
   }
   else
   {
     int i, count;
 
     for (i = 0, count = 0; spaceString[i]; )
@@ -735,17 +735,17 @@ char *nsMsgSearchAdapter::TransformSpace
       }
     }
 
     if (transformType == kSurround)
       count *= 2;
 
     if (count > 0)
     {
-      if ((starString = (char *)PR_Malloc(i + count + 1)) != nsnull)
+      if ((starString = (char *)PR_Malloc(i + count + 1)) != nullptr)
       {
         int j;
 
         for (i = 0, j = 0; spaceString[i]; )
         {
           if (spaceString[i] == ' ')
           {
             starString[j++] = '*';
@@ -950,17 +950,17 @@ NS_IMPL_ISUPPORTS1(nsMsgSearchValidityMa
 // user actually searches that scope.
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP nsMsgSearchValidityManager::GetTable (int whichTable, nsIMsgSearchValidityTable **ppOutTable)
 {
   NS_ENSURE_ARG_POINTER(ppOutTable);
 
   nsresult rv;
-  *ppOutTable = nsnull;
+  *ppOutTable = nullptr;
 
   nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
   nsCString customHeaders;
   if (NS_SUCCEEDED(rv))
     pref->GetCharPref(PREF_CUSTOM_HEADERS, getter_Copies(customHeaders));
 
   switch (whichTable)
   {
--- a/mailnews/base/search/src/nsMsgSearchNews.cpp
+++ b/mailnews/base/search/src/nsMsgSearchNews.cpp
@@ -92,20 +92,20 @@ PRUnichar *nsMsgSearchNews::EncodeToWild
 
 
 char *nsMsgSearchNews::EncodeTerm (nsIMsgSearchTerm *term)
 {
   // Develop an XPAT-style encoding for the search term
 
   NS_ASSERTION(term, "null term");
   if (!term)
-    return nsnull;
+    return nullptr;
 
   // Find a string to represent the attribute
-  const char *attribEncoding = nsnull;
+  const char *attribEncoding = nullptr;
   nsMsgSearchAttribValue attrib;
 
   term->GetAttrib(&attrib);
 
   switch (attrib)
   {
   case nsMsgSearchAttrib::Sender:
     attribEncoding = m_kNntpFrom;
@@ -114,17 +114,17 @@ char *nsMsgSearchNews::EncodeTerm (nsIMs
     attribEncoding = m_kNntpSubject;
     break;
   default:
     nsCString header;
     term->GetArbitraryHeader(header);
     if (header.IsEmpty())
     {
       NS_ASSERTION(false,"malformed search"); // malformed search term?
-      return nsnull;
+      return nullptr;
     }
     attribEncoding = header.get();
   }
 
   // Build a string to represent the string pattern
   bool leadingStar = false;
   bool trailingStar = false;
   int overhead = 1; // null terminator
@@ -145,63 +145,63 @@ char *nsMsgSearchNews::EncodeTerm (nsIMs
     overhead++;
     break;
   case nsMsgSearchOp::EndsWith:
     leadingStar = true;
     overhead++;
     break;
   default:
     NS_ASSERTION(false,"malformed search"); // malformed search term?
-    return nsnull;
+    return nullptr;
   }
 
     // ### i18N problem Get the csid from FE, which is the correct csid for term
 //  int16 wincsid = INTL_GetCharSetID(INTL_DefaultTextWidgetCsidSel);
 
   // Do INTL_FormatNNTPXPATInRFC1522Format trick for non-ASCII string
 //  unsigned char *intlNonRFC1522Value = INTL_FormatNNTPXPATInNonRFC1522Format (wincsid, (unsigned char*)term->m_value.u.string);
   nsCOMPtr <nsIMsgSearchValue> searchValue;
 
   nsresult rv = term->GetValue(getter_AddRefs(searchValue));
   if (NS_FAILED(rv) || !searchValue)
-    return nsnull;
+    return nullptr;
 
 
   nsString intlNonRFC1522Value;
   rv = searchValue->GetStr(intlNonRFC1522Value);
   if (NS_FAILED(rv) || intlNonRFC1522Value.IsEmpty())
-    return nsnull;
+    return nullptr;
 
   PRUnichar *caseInsensitiveValue = EncodeToWildmat (intlNonRFC1522Value.get());
   if (!caseInsensitiveValue)
-    return nsnull;
+    return nullptr;
 
   // TO DO: Do INTL_FormatNNTPXPATInRFC1522Format trick for non-ASCII string
   // Unfortunately, we currently do not handle xxx or xxx search in XPAT
   // Need to add the INTL_FormatNNTPXPATInRFC1522Format call after we can do that
   // so we should search a string in either RFC1522 format and non-RFC1522 format
 
   PRUnichar *escapedValue = EscapeSearchUrl (caseInsensitiveValue);
   nsMemory::Free(caseInsensitiveValue);
   if (!escapedValue)
-    return nsnull;
+    return nullptr;
 
 #if 0
   // We also need to apply NET_Escape to it since we have to pass 8-bits data
   // And sometimes % in the 7-bit doulbe byte JIS
   //
   PRUnichar * urlEncoded = nsEscape(escapedValue, url_Path);
   NS_Free(escapedValue);
 
   if (! urlEncoded)
-    return nsnull;
+    return nullptr;
 
   char *pattern = new char [NS_strlen(urlEncoded) + overhead];
   if (!pattern)
-    return nsnull;
+    return nullptr;
   else
     pattern[0] = '\0';
 #else
     nsCAutoString pattern;
 #endif
 
 
   if (leadingStar)
@@ -409,17 +409,17 @@ void nsMsgSearchNews::ReportHit (nsIMsgD
     err = m_scope->GetFolder(getter_AddRefs(scopeFolder));
     m_scope->GetSearchSession(getter_AddRefs(session));
     if (session)
       session->AddSearchHit (pHeaders, scopeFolder);
 }
 
 nsresult nsMsgSearchValidityManager::InitNewsTable()
 {
-  NS_ASSERTION (nsnull == m_newsTable,"don't call this twice!");
+  NS_ASSERTION (nullptr == m_newsTable,"don't call this twice!");
   nsresult rv = NewTable (getter_AddRefs(m_newsTable));
 
   if (NS_SUCCEEDED(rv))
   {
     m_newsTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Contains, 1);
     m_newsTable->SetEnabled   (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Contains, 1);
     m_newsTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Is, 1);
     m_newsTable->SetEnabled   (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Is, 1);
@@ -455,17 +455,17 @@ nsresult nsMsgSearchValidityManager::Ini
     m_newsTable->SetEnabled   (nsMsgSearchAttrib::OtherHeader, nsMsgSearchOp::EndsWith, 1);
   }
 
   return rv;
 }
 
 nsresult nsMsgSearchValidityManager::InitNewsFilterTable()
 {
-  NS_ASSERTION (nsnull == m_newsFilterTable, "news filter table already initted");
+  NS_ASSERTION (nullptr == m_newsFilterTable, "news filter table already initted");
   nsresult rv = NewTable (getter_AddRefs(m_newsFilterTable));
 
   if (NS_SUCCEEDED(rv))
   {
     m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Contains, 1);
     m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Sender, nsMsgSearchOp::Contains, 1);
     m_newsFilterTable->SetAvailable (nsMsgSearchAttrib::Sender, nsMsgSearchOp::DoesntContain, 1);
     m_newsFilterTable->SetEnabled   (nsMsgSearchAttrib::Sender, nsMsgSearchOp::DoesntContain, 1);
--- a/mailnews/base/search/src/nsMsgSearchSession.cpp
+++ b/mailnews/base/search/src/nsMsgSearchSession.cpp
@@ -26,17 +26,17 @@ NS_IMPL_ISUPPORTS3(nsMsgSearchSession, n
                    nsISupportsWeakReference)
 
 nsMsgSearchSession::nsMsgSearchSession()
 {
   m_sortAttribute = nsMsgSearchAttrib::Sender;
   m_idxRunningScope = 0;
   m_urlQueueIndex = 0;
   m_handlingError = false;
-  m_expressionTree = nsnull;
+  m_expressionTree = nullptr;
   m_searchPaused = false;
   NS_NewISupportsArray(getter_AddRefs(m_termList));
 }
 
 nsMsgSearchSession::~nsMsgSearchSession()
 {
   InterruptSearch();
   delete m_expressionTree;
@@ -59,27 +59,27 @@ nsMsgSearchSession::AddSearchTerm(nsMsgS
     boolOp = (nsMsgSearchBooleanOperator)nsMsgSearchBooleanOp::BooleanOR;
   nsMsgSearchTerm *pTerm = new nsMsgSearchTerm(attrib, op, value,
                                                boolOp, customString);
   NS_ENSURE_TRUE(pTerm, NS_ERROR_OUT_OF_MEMORY);
 
   m_termList->AppendElement(pTerm);
   // force the expression tree to rebuild whenever we change the terms
   delete m_expressionTree;
-  m_expressionTree = nsnull;
+  m_expressionTree = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgSearchSession::AppendTerm(nsIMsgSearchTerm *aTerm)
 {
     NS_ENSURE_ARG_POINTER(aTerm);
     NS_ENSURE_TRUE(m_termList, NS_ERROR_NOT_INITIALIZED);
     delete m_expressionTree;
-    m_expressionTree = nsnull;
+    m_expressionTree = nullptr;
     return m_termList->AppendElement(aTerm);
 }
 
 NS_IMETHODIMP
 nsMsgSearchSession::GetSearchTerms(nsISupportsArray **aResult)
 {
     NS_ENSURE_ARG_POINTER(aResult);
     *aResult = m_termList;
@@ -153,17 +153,17 @@ NS_IMETHODIMP nsMsgSearchSession::CountS
 NS_IMETHODIMP
 nsMsgSearchSession::GetNthSearchScope(PRInt32 which,
                                       nsMsgSearchScopeValue *scopeId,
                                       nsIMsgFolder **folder)
 {
   NS_ENSURE_ARG_POINTER(scopeId);
   NS_ENSURE_ARG_POINTER(folder);
 
-  nsMsgSearchScopeTerm *scopeTerm = m_scopeList.SafeElementAt(which, nsnull);
+  nsMsgSearchScopeTerm *scopeTerm = m_scopeList.SafeElementAt(which, nullptr);
   NS_ENSURE_ARG(scopeTerm);
 
   *scopeId = scopeTerm->m_attribute;
   *folder = scopeTerm->m_folder;
   NS_IF_ADDREF(*folder);
   return NS_OK;
 }
 
@@ -182,17 +182,17 @@ nsMsgSearchSession::AddScopeTerm(nsMsgSe
 
   m_scopeList.AppendElement(pScopeTerm);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgSearchSession::AddDirectoryScopeTerm(nsMsgSearchScopeValue scope)
 {
-  nsMsgSearchScopeTerm *pScopeTerm = new nsMsgSearchScopeTerm(this, scope, nsnull);
+  nsMsgSearchScopeTerm *pScopeTerm = new nsMsgSearchScopeTerm(this, scope, nullptr);
   NS_ENSURE_TRUE(pScopeTerm, NS_ERROR_OUT_OF_MEMORY);
 
   m_scopeList.AppendElement(pScopeTerm);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgSearchSession::ClearScopes()
 {
@@ -262,17 +262,17 @@ NS_IMETHODIMP nsMsgSearchSession::Interr
     }
     //m_idxRunningScope = m_scopeList.Length() so it will make us not run another url
   }
   if (m_backgroundTimer)
   {
     m_backgroundTimer->Cancel();
     NotifyListenersDone(NS_MSG_SEARCH_INTERRUPTED);
 
-    m_backgroundTimer = nsnull;
+    m_backgroundTimer = nullptr;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgSearchSession::PauseSearch()
 {
   if (m_backgroundTimer)
   {
@@ -321,17 +321,17 @@ NS_IMETHODIMP nsMsgSearchSession::SetWin
 {
   m_msgWindowWeak = do_GetWeakReference(aWindow);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgSearchSession::GetWindow(nsIMsgWindow **aWindow)
 {
   NS_ENSURE_ARG_POINTER(aWindow);
-  *aWindow = nsnull;
+  *aWindow = nullptr;
   nsCOMPtr<nsIMsgWindow> msgWindow(do_QueryReferent(m_msgWindowWeak));
   msgWindow.swap(*aWindow);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgSearchSession::OnStartRunningUrl(nsIURI *url)
 {
     return NS_OK;
@@ -365,17 +365,17 @@ nsresult nsMsgSearchSession::Initialize(
   // Loop over scope terms, initializing an adapter per term. This
   // architecture is necessitated by two things:
   // 1. There might be more than one kind of adapter per if online
   //    *and* offline mail mail folders are selected, or if newsgroups
   //    belonging to Dredd *and* INN are selected
   // 2. Most of the protocols are only capable of searching one scope at a
   //    time, so we'll do each scope in a separate adapter on the client
 
-  nsMsgSearchScopeTerm *scopeTerm = nsnull;
+  nsMsgSearchScopeTerm *scopeTerm = nullptr;
   nsresult rv = NS_OK;
 
   PRUint32 numTerms;
   m_termList->Count(&numTerms);
   // Ensure that the FE has added scopes and terms to this search
   NS_ASSERTION(numTerms > 0, "no terms to search!");
   if (numTerms == 0)
     return NS_MSG_ERROR_NO_SEARCH_VALUES;
@@ -492,17 +492,17 @@ void nsMsgSearchSession::TimerCallback(n
   nsCOMPtr<nsIMsgWindow> msgWindow(do_QueryReferent(searchSession->m_msgWindowWeak));
   if (msgWindow)
     msgWindow->GetStopped(&stopped);
 
   if (done || stopped)
   {
     if (aTimer)
       aTimer->Cancel();
-    searchSession->m_backgroundTimer = nsnull;
+    searchSession->m_backgroundTimer = nullptr;
     if (searchSession->m_idxRunningScope < searchSession->m_scopeList.Length())
       searchSession->DoNextSearch();
     else
       searchSession->NotifyListenersDone(NS_OK);
   }
 }
 
 nsresult nsMsgSearchSession::StartTimer()
@@ -522,17 +522,17 @@ nsresult nsMsgSearchSession::SearchWOUrl
   EnableFolderNotifications(false);
   return StartTimer();
 }
 
 NS_IMETHODIMP
 nsMsgSearchSession::GetRunningAdapter(nsIMsgSearchAdapter **aSearchAdapter)
 {
   NS_ENSURE_ARG_POINTER(aSearchAdapter);
-  *aSearchAdapter = nsnull;
+  *aSearchAdapter = nullptr;
   nsMsgSearchScopeTerm *scope = GetRunningScope();
   if (scope)
   {
     NS_IF_ADDREF(*aSearchAdapter = scope->m_adapter);    
   }
   return NS_OK;
 }
 
@@ -568,17 +568,17 @@ nsresult nsMsgSearchSession::NotifyListe
       listener->OnSearchDone(aStatus);
   }
   m_iListener = -1;
   return NS_OK;
 }
 
 void nsMsgSearchSession::DestroyScopeList()
 {
-  nsMsgSearchScopeTerm *scope = nsnull;
+  nsMsgSearchScopeTerm *scope = nullptr;
 
   for (PRInt32 i = m_scopeList.Length() - 1; i >= 0; i--)
   {
     scope = m_scopeList.ElementAt(i);
     //    NS_ASSERTION (scope->IsValid(), "invalid search scope");
     if (scope->m_adapter)
       scope->m_adapter->ClearScope();
     delete scope;
@@ -589,17 +589,17 @@ void nsMsgSearchSession::DestroyScopeLis
 
 void nsMsgSearchSession::DestroyTermList()
 {
   m_termList->Clear();
 }
 
 nsMsgSearchScopeTerm *nsMsgSearchSession::GetRunningScope()
 {
-  return m_scopeList.SafeElementAt(m_idxRunningScope, nsnull);
+  return m_scopeList.SafeElementAt(m_idxRunningScope, nullptr);
 }
 
 nsresult nsMsgSearchSession::TimeSlice(bool *aDone)
 {
   // we only do serial for now.
   return TimeSliceSerial(aDone);
 }
 
@@ -618,17 +618,17 @@ void nsMsgSearchSession::ReleaseFolderDB
     return;
 
   mailSession->IsFolderOpenInWindow(folder, &isOpen);
   folder->GetFlags(&flags);
 
   /*we don't null out the db reference for inbox because inbox is like the "main" folder
     and performance outweighs footprint */
   if (!isOpen && !(nsMsgFolderFlags::Inbox & flags))
-    folder->SetMsgDatabase(nsnull);
+    folder->SetMsgDatabase(nullptr);
 }
 nsresult nsMsgSearchSession::TimeSliceSerial(bool *aDone)
 {
   // This version of TimeSlice runs each scope term one at a time, and waits until one
   // scope term is finished before starting another one. When we're searching the local
   // disk, this is the fastest way to do it.
 
   NS_ENSURE_ARG_POINTER(aDone);
@@ -674,17 +674,17 @@ nsMsgSearchSession::EnableFolderNotifica
       folder->EnableNotifications(nsIMsgFolder::allMessageCountNotifications, aEnable, false);
   }
 }
 
 //this method is used for adding new hdrs to quick search view
 NS_IMETHODIMP
 nsMsgSearchSession::MatchHdr(nsIMsgDBHdr *aMsgHdr, nsIMsgDatabase *aDatabase, bool *aResult)
 {
-  nsMsgSearchScopeTerm *scope = m_scopeList.SafeElementAt(0, nsnull);
+  nsMsgSearchScopeTerm *scope = m_scopeList.SafeElementAt(0, nullptr);
   if (scope)
   {
     if (!scope->m_adapter)
       scope->InitializeAdapter(m_termList);
     if (scope->m_adapter)
     {
       nsAutoString nullCharset, folderCharset;
       scope->m_adapter->GetSearchCharsets(nullCharset, folderCharset);
--- a/mailnews/base/search/src/nsMsgSearchTerm.cpp
+++ b/mailnews/base/search/src/nsMsgSearchTerm.cpp
@@ -137,17 +137,17 @@ nsresult NS_MsgGetAttributeFromString(co
       return NS_MSG_INVALID_CUSTOM_HEADER;
     //49 is for showing customize... in ui, headers start from 50 onwards up until 99.
     *attrib = nsMsgSearchAttrib::OtherHeader+1;
 
     nsCOMPtr<nsIPrefService> prefService = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsIPrefBranch> prefBranch;
-    rv = prefService->GetBranch(nsnull, getter_AddRefs(prefBranch));
+    rv = prefService->GetBranch(nullptr, getter_AddRefs(prefBranch));
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCString headers;
     prefBranch->GetCharPref(MAILNEWS_CUSTOM_HEADERS, getter_Copies(headers));
 
     if (!headers.IsEmpty())
     {
       nsCAutoString hdrStr(headers);
@@ -343,17 +343,17 @@ PRInt32 NS_MsgGetStatusValueFromName(cha
   return 0;
 }
 
 
 // Needed for DeStream method.
 nsMsgSearchTerm::nsMsgSearchTerm()
 {
     // initialize this to zero
-    m_value.string=nsnull;
+    m_value.string=nullptr;
     m_value.attribute=0;
     m_value.u.priority=0;
     m_attribute = nsMsgSearchAttrib::Default;
     m_operator = nsMsgSearchOp::Contains;
     mBeginsGrouping = false;
     mEndsGrouping = false;
     m_matchAll = false;
 }
@@ -847,17 +847,17 @@ nsresult nsMsgSearchTerm::MatchArbitrary
 
 NS_IMETHODIMP nsMsgSearchTerm::MatchHdrProperty(nsIMsgDBHdr *aHdr, bool *aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
   NS_ENSURE_ARG_POINTER(aHdr);
 
   nsCString dbHdrValue;
   aHdr->GetStringProperty(m_hdrProperty.get(), getter_Copies(dbHdrValue));
-  nsresult rv = MatchString(dbHdrValue.get(), nsnull, aResult);
+  nsresult rv = MatchString(dbHdrValue.get(), nullptr, aResult);
   return rv;
 }
 
 NS_IMETHODIMP nsMsgSearchTerm::MatchFolderFlag(nsIMsgDBHdr *aMsgToMatch, bool *aResult)
 {
   NS_ENSURE_ARG_POINTER(aMsgToMatch);
   NS_ENSURE_ARG_POINTER(aResult);
   nsCOMPtr<nsIMsgFolder> msgFolder;
@@ -934,17 +934,17 @@ nsresult nsMsgSearchTerm::MatchBody (nsI
   // quoted printable decoding. Otherwise we assume everything is
   // quoted printable. Obviously everything isn't quoted printable, but
   // since we don't have a MIME parser handy, and we want to err on the
   // side of too many hits rather than not enough, we'll assume in that
   // general direction. Blech. ### FIX ME
   // bug fix #314637: for stateful charsets like ISO-2022-JP, we don't
   // want to decode quoted printable since it contains '='.
   bool isQuotedPrintable = !nsMsgI18Nstateful_charset(folderCharset) &&
-    (PL_strchr (m_value.string, '=') == nsnull);
+    (PL_strchr (m_value.string, '=') == nullptr);
 
   nsCString compare;
   while (!endOfFile && result == boolContinueLoop)
   {
     if (bodyHan->GetNextLine(buf) >= 0)
     {
       bool softLineBreak = false;
       // Do in-place decoding of quoted printable
@@ -995,17 +995,17 @@ nsresult nsMsgSearchTerm::InitializeAddr
   if (mDirectory)
   {
     nsCString uri;
     rv = mDirectory->GetURI(uri);
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (!uri.Equals(m_value.string))
       // clear out the directory....we are no longer pointing to the right one
-      mDirectory = nsnull;
+      mDirectory = nullptr;
   }
   if (!mDirectory)
   {
     nsCOMPtr<nsIAbManager> abManager = do_GetService(NS_ABMANAGER_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = abManager->GetDirectory(nsDependentCString(m_value.string), getter_AddRefs(mDirectory));
     NS_ENSURE_SUCCESS(rv, rv);
@@ -1020,17 +1020,17 @@ nsresult nsMsgSearchTerm::MatchInAddress
   *pResult = false;
 
   // Some junkmails have empty From: fields.
   if (aAddress == NULL || strlen(aAddress) == 0)
     return rv;
 
   if (mDirectory)
   {
-    nsIAbCard* cardForAddress = nsnull;
+    nsIAbCard* cardForAddress = nullptr;
     rv = mDirectory->CardForEmailAddress(nsDependentCString(aAddress),
                                          &cardForAddress);
     if (NS_FAILED(rv) && rv != NS_ERROR_NOT_IMPLEMENTED)
       return rv;
     if ((m_operator == nsMsgSearchOp::IsInAB && cardForAddress) || (m_operator == nsMsgSearchOp::IsntInAB && !cardForAddress))
       *pResult = true;
     NS_IF_RELEASE(cardForAddress);
   }
@@ -1054,17 +1054,17 @@ nsresult nsMsgSearchTerm::MatchRfc2047St
 
     if ( m_operator == nsMsgSearchOp::IsInAB ||
          m_operator == nsMsgSearchOp::IsntInAB)
     {
       res = MatchInAddressBook(stringToMatch ? stringToMatch : rfc2047string, pResult);
     }
     else
     res = MatchString(stringToMatch ? stringToMatch : rfc2047string,
-                      nsnull, pResult);
+                      nullptr, pResult);
 
     PR_Free(stringToMatch);
 
   return res;
 }
 
 // *pResult is false when strings don't match, true if they do.
 nsresult nsMsgSearchTerm::MatchString (const char *stringToMatch,
@@ -1080,17 +1080,17 @@ nsresult nsMsgSearchTerm::MatchString (c
 
   // Save some performance for opIsEmpty / opIsntEmpty
   if(nsMsgSearchOp::IsEmpty != m_operator && nsMsgSearchOp::IsntEmpty != m_operator)
   {
     NS_ASSERTION(MsgIsUTF8(nsDependentCString(m_value.string)),
                  "m_value.string is not UTF-8");
     CopyUTF8toUTF16(nsDependentCString(m_value.string), needle);
 
-    if (charset != nsnull)
+    if (charset != nullptr)
     {
       ConvertToUnicode(charset, stringToMatch ? stringToMatch : "",
                        utf16StrToMatch);
     }
     else {
       NS_ASSERTION(MsgIsUTF8(nsDependentCString(stringToMatch)),
                    "stringToMatch is not UTF-8");
       CopyUTF8toUTF16(nsDependentCString(stringToMatch), utf16StrToMatch);
@@ -1156,17 +1156,17 @@ NS_IMETHODIMP nsMsgSearchTerm::GetMatchA
    bool result;
    nsresult err = InitHeaderAddressParser();
    if (NS_FAILED(err))
      return err;
    // Isolate the RFC 822 parsing weirdnesses here. MSG_ParseRFC822Addresses
    // returns a catenated string of null-terminated strings, which we walk
    // across, tring to match the target string to either the name OR the address
 
-   char *names = nsnull, *addresses = nsnull;
+   char *names = nullptr, *addresses = nullptr;
 
    // Change the sense of the loop so we don't bail out prematurely
    // on negative terms. i.e. opDoesntContain must look at all recipients
    bool boolContinueLoop;
    GetMatchAllBeforeDeciding(&boolContinueLoop);
    result = boolContinueLoop;
 
    PRUint32 count;
@@ -1822,17 +1822,17 @@ nsMsgSearchScopeTerm::nsMsgSearchScopeTe
 {
   m_searchServer = true;
 }
 
 nsMsgSearchScopeTerm::~nsMsgSearchScopeTerm ()
 {
   if (m_inputStream)
     m_inputStream->Close();
-  m_inputStream = nsnull;
+  m_inputStream = nullptr;
 }
 
 NS_IMPL_ISUPPORTS1(nsMsgSearchScopeTerm, nsIMsgSearchScopeTerm)
 
 NS_IMETHODIMP
 nsMsgSearchScopeTerm::GetFolder(nsIMsgFolder **aResult)
 {
     NS_IF_ADDREF(*aResult = m_folder);
@@ -1863,17 +1863,17 @@ nsMsgSearchScopeTerm::GetInputStream(nsI
   return rv;
 }
 
 NS_IMETHODIMP nsMsgSearchScopeTerm::CloseInputStream()
 {
   if (m_inputStream)
 {
     m_inputStream->Close();
-    m_inputStream = nsnull;
+    m_inputStream = nullptr;
   }
   return NS_OK;
 }
 
 nsresult nsMsgSearchScopeTerm::TimeSlice (bool *aDone)
 {
   return m_adapter->Search(aDone);
 }
@@ -1921,17 +1921,17 @@ nsresult nsMsgSearchScopeTerm::Initializ
     err = m_adapter->ValidateTerms ();
 
   return err;
 }
 
 
 char *nsMsgSearchScopeTerm::GetStatusBarName ()
 {
-  return nsnull;
+  return nullptr;
 }
 
 
 //-----------------------------------------------------------------------------
 // nsMsgResultElement implementation
 //-----------------------------------------------------------------------------
 
 
--- a/mailnews/base/src/nsMailDirProvider.cpp
+++ b/mailnews/base/src/nsMailDirProvider.cpp
@@ -42,17 +42,17 @@ NS_IMPL_ISUPPORTS2(nsMailDirProvider,
 
 NS_IMETHODIMP
 nsMailDirProvider::GetFile(const char *aKey, bool *aPersist,
                            nsIFile **aResult)
 {
   // NOTE: This function can be reentrant through the NS_GetSpecialDirectory
   // call, so be careful not to cause infinite recursion.
   // i.e. the check for supported files must come first.
-  const char* leafName = nsnull;
+  const char* leafName = nullptr;
   bool isDirectory = true;
 
   if (!strcmp(aKey, NS_APP_MAIL_50_DIR))
     leafName = MAIL_DIR_50_NAME;
   else if (!strcmp(aKey, NS_APP_IMAP_MAIL_50_DIR))
     leafName = IMAP_MAIL_DIR_50_NAME;
   else if (!strcmp(aKey, NS_APP_NEWS_50_DIR))
     leafName = NEWS_DIR_50_NAME;
@@ -145,21 +145,21 @@ nsMailDirProvider::AppendingEnumerator::
 {
   // Set the return value to the next directory we want to enumerate over
   if (aResult)
     NS_ADDREF(*aResult = mNext);
 
   if (mNextWithLocale)
   {
     mNext = mNextWithLocale;
-    mNextWithLocale = nsnull;
+    mNextWithLocale = nullptr;
     return NS_OK;
   }
 
-  mNext = nsnull;
+  mNext = nullptr;
 
   // Ignore all errors
 
   bool more;
   while (NS_SUCCEEDED(mBase->HasMoreElements(&more)) && more) {
     nsCOMPtr<nsISupports> nextbasesupp;
     mBase->GetNext(getter_AddRefs(nextbasesupp));
 
@@ -177,30 +177,30 @@ nsMailDirProvider::AppendingEnumerator::
     if (NS_SUCCEEDED(rv) && exists)
     {
       if (!mLocale.IsEmpty())
       {
         mNext->Clone(getter_AddRefs(mNextWithLocale));
         mNextWithLocale->AppendNative(mLocale);
         rv = mNextWithLocale->Exists(&exists);
         if (NS_FAILED(rv) || !exists)
-          mNextWithLocale = nsnull; // clear out mNextWithLocale, so we don't try to iterate over it
+          mNextWithLocale = nullptr; // clear out mNextWithLocale, so we don't try to iterate over it
       } 
       break;
     }
 
-    mNext = nsnull;
+    mNext = nullptr;
   }
 
   return NS_OK;
 }
 
 nsMailDirProvider::AppendingEnumerator::AppendingEnumerator
     (nsISimpleEnumerator* aBase) :
   mBase(aBase)
 {
   nsCOMPtr<nsIXULChromeRegistry> packageRegistry =
     mozilla::services::GetXULChromeRegistryService();
   if (packageRegistry)
     packageRegistry->GetSelectedLocale(NS_LITERAL_CSTRING("global"), mLocale);
   // Initialize mNext to begin
-  GetNext(nsnull);
+  GetNext(nullptr);
 }
--- a/mailnews/base/src/nsMessenger.cpp
+++ b/mailnews/base/src/nsMessenger.cpp
@@ -255,17 +255,17 @@ NS_IMETHODIMP nsMessenger::SetWindow(nsI
     nsCOMPtr<nsIDocShellTreeItem> rootDocShellAsItem;
     docShellAsItem->GetSameTypeRootTreeItem(getter_AddRefs(rootDocShellAsItem));
 
     nsCOMPtr<nsIDocShellTreeNode> rootDocShellAsNode(do_QueryInterface(rootDocShellAsItem));
     if (rootDocShellAsNode)
     {
       nsCOMPtr<nsIDocShellTreeItem> childAsItem;
       rv = rootDocShellAsNode->FindChildWithName(NS_LITERAL_STRING("messagepane").get(),
-                                                 true, false, nsnull, nsnull, getter_AddRefs(childAsItem));
+                                                 true, false, nullptr, nullptr, getter_AddRefs(childAsItem));
 
       mDocShell = do_QueryInterface(childAsItem);
       if (NS_SUCCEEDED(rv) && mDocShell) {
         mCurrentDisplayCharset = ""; // Important! Clear out mCurrentDisplayCharset so we reset a default charset on mDocshell the next time we try to load something into it.
 
         if (aMsgWindow)
           aMsgWindow->GetTransactionManager(getter_AddRefs(mTxnMgr));
       }
@@ -281,17 +281,17 @@ NS_IMETHODIMP nsMessenger::SetWindow(nsI
   {
     // Remove the folder listener if we added it, i.e. if mWindow is non-null
     if (mWindow)
     {
       rv = mailSession->RemoveFolderListener(this);
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
-    mWindow = nsnull;
+    mWindow = nullptr;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMessenger::SetDisplayCharset(const nsACString& aCharset)
 {
   // libmime always converts to UTF-8 (both HTML and XML)
@@ -336,17 +336,17 @@ nsMessenger::PromptIfFileExists(nsIFile 
     {
       rv = InitStringBundle();
       NS_ENSURE_SUCCESS(rv, rv);
     }
     rv = mStringBundle->FormatStringFromName(NS_LITERAL_STRING("fileExists").get(),
                                              pathFormatStrings, 1,
                                              getter_Copies(errorMessage));
     NS_ENSURE_SUCCESS(rv, rv);
-    rv = dialog->Confirm(nsnull, errorMessage.get(), &dialogResult);
+    rv = dialog->Confirm(nullptr, errorMessage.get(), &dialogResult);
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (dialogResult)
     {
       return NS_OK; // user says okay to replace
     }
     else
     {
@@ -443,30 +443,30 @@ nsMessenger::OpenURL(const nsACString& a
   // This is to setup the display DocShell as UTF-8 capable...
   SetDisplayCharset(NS_LITERAL_CSTRING("UTF-8"));
 
   nsCOMPtr <nsIMsgMessageService> messageService;
   nsresult rv = GetMessageServiceFromURI(aURL, getter_AddRefs(messageService));
 
   if (NS_SUCCEEDED(rv) && messageService)
   {
-    messageService->DisplayMessage(PromiseFlatCString(aURL).get(), mDocShell, mMsgWindow, nsnull, nsnull, nsnull);
+    messageService->DisplayMessage(PromiseFlatCString(aURL).get(), mDocShell, mMsgWindow, nullptr, nullptr, nullptr);
     AddMsgUrlToNavigateHistory(aURL);
     mLastDisplayURI = aURL; // remember the last uri we displayed....
     return NS_OK;
   }
 
   nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
   if(!webNav)
     return NS_ERROR_FAILURE;
   rv = webNav->LoadURI(NS_ConvertASCIItoUTF16(aURL).get(),   // URI string
                        nsIWebNavigation::LOAD_FLAGS_IS_LINK, // Load flags
-                       nsnull,                               // Referring URI
-                       nsnull,                               // Post stream
-                       nsnull);                              // Extra headers
+                       nullptr,                               // Referring URI
+                       nullptr,                               // Post stream
+                       nullptr);                              // Extra headers
   return rv;
 }
 
 NS_IMETHODIMP nsMessenger::LaunchExternalURL(const nsACString& aURL)
 {
   nsresult rv;
 
   nsCOMPtr<nsIURI> uri;
@@ -577,17 +577,17 @@ nsMessenger::LoadURL(nsIDOMWindow *aWin,
 }
 
 NS_IMETHODIMP nsMessenger::SaveAttachmentToFile(nsIFile *aFile,
                                                 const nsACString &aURL,
                                                 const nsACString &aMessageUri,
                                                 const nsACString &aContentType,
                                                 nsIUrlListener *aListener)
 {
-  return SaveAttachment(aFile, aURL, aMessageUri, aContentType, nsnull, aListener);
+  return SaveAttachment(aFile, aURL, aMessageUri, aContentType, nullptr, aListener);
 }
 
 NS_IMETHODIMP
 nsMessenger::DetachAttachmentsWOPrompts(nsIFile* aDestFolder,
                                         PRUint32 aCount,
                                         const char **aContentTypeArray,
                                         const char **aUrlArray,
                                         const char **aDisplayNameArray,
@@ -718,19 +718,19 @@ nsresult nsMessenger::SaveAttachment(nsI
         rv = streamConverterService->AsyncConvertData(APPLICATION_BINHEX,
                                                       "*/*",
                                                       listener,
                                                       channelSupport,
                                                       getter_AddRefs(convertedListener));
       }
 #endif
       if (fetchService)
-        rv = fetchService->FetchMimePart(URL, fullMessageUri.get(), convertedListener, mMsgWindow, saveListener, nsnull);
+        rv = fetchService->FetchMimePart(URL, fullMessageUri.get(), convertedListener, mMsgWindow, saveListener, nullptr);
       else
-        rv = messageService->DisplayMessage(fullMessageUri.get(), convertedListener, mMsgWindow, nsnull, nsnull, nsnull);
+        rv = messageService->DisplayMessage(fullMessageUri.get(), convertedListener, mMsgWindow, nullptr, nullptr, nullptr);
     } // if we got a message service
   } // if we created a url
 
   if (NS_FAILED(rv))
     Alert("saveAttachmentFailed");
 
   return rv;
 }
@@ -747,17 +747,17 @@ nsMessenger::OpenAttachment(const nsACSt
     rv = OpenURL(aURL);
   else
   {
     nsCOMPtr <nsIMsgMessageService> messageService;
     rv = GetMessageServiceFromURI(aMessageUri, getter_AddRefs(messageService));
     if (messageService)
       rv = messageService->OpenAttachment(PromiseFlatCString(aContentType).get(), PromiseFlatCString(aDisplayName).get(),
                                           PromiseFlatCString(aURL).get(), PromiseFlatCString(aMessageUri).get(),
-                                          mDocShell, mMsgWindow, nsnull);
+                                          mDocShell, mMsgWindow, nullptr);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsMessenger::SaveAttachmentToFolder(const nsACString& contentType, const nsACString& url, const nsACString& displayName,
                                     const nsACString& messageUri, nsIFile * aDestFolder, nsIFile ** aOutFile)
@@ -773,17 +773,17 @@ nsMessenger::SaveAttachmentToFolder(cons
   ConvertAndSanitizeFileName(PromiseFlatCString(displayName).get(), unescapedFileName);
   rv = attachmentDestination->Append(unescapedFileName);
   NS_ENSURE_SUCCESS(rv, rv);
 #ifdef XP_MACOSX
   rv = attachmentDestination->CreateUnique(nsIFile::NORMAL_FILE_TYPE, ATTACHMENT_PERMISSION);
   NS_ENSURE_SUCCESS(rv, rv);
 #endif
 
-  rv = SaveAttachment(attachmentDestination, url, messageUri, contentType, nsnull, nsnull);
+  rv = SaveAttachment(attachmentDestination, url, messageUri, contentType, nullptr, nullptr);
   attachmentDestination.swap(*aOutFile);
   return rv;
 }
 
 NS_IMETHODIMP
 nsMessenger::SaveAttachment(const nsACString& aContentType, const nsACString& aURL,
                             const nsACString& aDisplayName, const nsACString& aMessageUri, bool aIsExternalAttachment)
 {
@@ -844,17 +844,17 @@ nsMessenger::SaveOneAttachment(const cha
                                   &aContentType,
                                   &aURL,
                                   &aDisplayName,
                                   &aMessageUri,
                                   dirName.get(),
                                   detaching);
 
   return SaveAttachment(localFile, nsDependentCString(aURL), nsDependentCString(aMessageUri),
-                        nsDependentCString(aContentType), (void *)saveState, nsnull);
+                        nsDependentCString(aContentType), (void *)saveState, nullptr);
 }
 
 
 NS_IMETHODIMP
 nsMessenger::SaveAllAttachments(PRUint32 count,
                                 const char **contentTypeArray,
                                 const char **urlArray,
                                 const char **displayNameArray,
@@ -897,17 +897,17 @@ nsMessenger::SaveAllAttachments(PRUint32
 
   rv = filePicker->GetFile(getter_AddRefs(localFile));
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = SetLastSaveDirectory(localFile);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCString dirName;
-  nsSaveAllAttachmentsState *saveState = nsnull;
+  nsSaveAllAttachmentsState *saveState = nullptr;
   rv = localFile->GetNativePath(dirName);
   NS_ENSURE_SUCCESS(rv, rv);
 
   saveState = new nsSaveAllAttachmentsState(count,
                                             contentTypeArray,
                                             urlArray,
                                             displayNameArray,
                                             messageUriArray,
@@ -917,17 +917,17 @@ nsMessenger::SaveAllAttachments(PRUint32
   ConvertAndSanitizeFileName(displayNameArray[0], unescapedName);
   rv = localFile->Append(unescapedName);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = PromptIfFileExists(localFile);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = SaveAttachment(localFile, nsDependentCString(urlArray[0]), nsDependentCString(messageUriArray[0]),
-                      nsDependentCString(contentTypeArray[0]), (void *)saveState, nsnull);
+                      nsDependentCString(contentTypeArray[0]), (void *)saveState, nullptr);
   return rv;
 }
 
 enum MESSENGER_SAVEAS_FILE_TYPE
 {
  EML_FILE_TYPE =  0,
  HTML_FILE_TYPE = 1,
  TEXT_FILE_TYPE = 2,
@@ -939,17 +939,17 @@ enum MESSENGER_SAVEAS_FILE_TYPE
 
 NS_IMETHODIMP
 nsMessenger::SaveAs(const nsACString& aURI, bool aAsFile,
                     nsIMsgIdentity *aIdentity, const nsAString& aMsgFilename,
                     bool aBypassFilePicker)
 {
   nsCOMPtr<nsIMsgMessageService> messageService;
   nsCOMPtr<nsIUrlListener> urlListener;
-  nsSaveMsgListener *saveListener = nsnull;
+  nsSaveMsgListener *saveListener = nullptr;
   nsCOMPtr<nsIURI> url;
   nsCOMPtr<nsIStreamListener> convertedListener;
   PRInt32 saveAsFileType = EML_FILE_TYPE;
 
   nsresult rv = GetMessageServiceFromURI(aURI, getter_AddRefs(messageService));
   if (NS_FAILED(rv))
     goto done;
 
@@ -979,29 +979,29 @@ nsMessenger::SaveAs(const nsACString& aU
                                nsCaseInsensitiveStringComparator())))
         saveAsFileType = HTML_FILE_TYPE;
       else
         saveAsFileType = EML_FILE_TYPE;
     } 
 
     // After saveListener goes out of scope, the listener will be owned by
     // whoever the listener is registered with, usually a URL.
-    nsRefPtr<nsSaveMsgListener> saveListener = new nsSaveMsgListener(saveAsFile, this, nsnull);
+    nsRefPtr<nsSaveMsgListener> saveListener = new nsSaveMsgListener(saveAsFile, this, nullptr);
     if (!saveListener) {
       rv = NS_ERROR_OUT_OF_MEMORY;
       goto done;
     }
     rv = saveListener->QueryInterface(NS_GET_IID(nsIUrlListener), getter_AddRefs(urlListener));
     if (NS_FAILED(rv))
       goto done;
 
     if (saveAsFileType == EML_FILE_TYPE)
     {
       rv = messageService->SaveMessageToDisk(PromiseFlatCString(aURI).get(), saveAsFile, false,
-        urlListener, nsnull,
+        urlListener, nullptr,
         true, mMsgWindow);
     }
     else
     {
       nsCAutoString urlString(aURI);
 
       // we can't go RFC822 to TXT until bug #1775 is fixed
       // so until then, do the HTML to TXT conversion in
@@ -1023,20 +1023,20 @@ nsMessenger::SaveAs(const nsACString& aU
         urlString.AppendLiteral("?header=saveas");
       }
 
       rv = CreateStartupUrl(urlString.get(), getter_AddRefs(url));
       NS_ASSERTION(NS_SUCCEEDED(rv), "CreateStartupUrl failed");
       if (NS_FAILED(rv))
         goto done;
 
-      saveListener->m_channel = nsnull;
+      saveListener->m_channel = nullptr;
       rv = NS_NewInputStreamChannel(getter_AddRefs(saveListener->m_channel),
         url,
-        nsnull);                // inputStream
+        nullptr);                // inputStream
       NS_ASSERTION(NS_SUCCEEDED(rv), "NS_NewInputStreamChannel failed");
       if (NS_FAILED(rv))
         goto done;
 
       nsCOMPtr<nsIStreamConverterService> streamConverterService = do_GetService("@mozilla.org/streamConverters;1");
       nsCOMPtr<nsISupports> channelSupport = do_QueryInterface(saveListener->m_channel);
 
       // we can't go RFC822 to TXT until bug #1775 is fixed
@@ -1047,17 +1047,17 @@ nsMessenger::SaveAs(const nsACString& aU
         saveListener,
         channelSupport,
         getter_AddRefs(convertedListener));
       NS_ASSERTION(NS_SUCCEEDED(rv), "AsyncConvertData failed");
       if (NS_FAILED(rv))
         goto done;
 
       rv = messageService->DisplayMessage(urlString.get(), convertedListener, mMsgWindow,
-        nsnull, nsnull, nsnull);
+        nullptr, nullptr, nullptr);
     }
   }
   else
   {
     // ** save as Template
     nsCOMPtr <nsIFile> tmpFile;
     nsresult rv = GetSpecialDirectoryWithFileName(NS_OS_TEMP_DIR,
                                                   "nsmail.tmp",
@@ -1066,17 +1066,17 @@ nsMessenger::SaveAs(const nsACString& aU
     NS_ENSURE_SUCCESS(rv, rv);
 
     // For temp file, we should use restrictive 00600 instead of ATTACHMENT_PERMISSION 
     rv = tmpFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 00600);
     if (NS_FAILED(rv)) goto done;
 
     // The saveListener is owned by whoever we ultimately register the
     // listener with, generally a URL.
-    saveListener = new nsSaveMsgListener(tmpFile, this, nsnull);
+    saveListener = new nsSaveMsgListener(tmpFile, this, nullptr);
     if (!saveListener) {
       rv = NS_ERROR_OUT_OF_MEMORY;
       goto done;
     }
 
     if (aIdentity)
       rv = aIdentity->GetStationeryFolder(saveListener->m_templateUri);
     if (NS_FAILED(rv))
@@ -1088,17 +1088,17 @@ nsMessenger::SaveAs(const nsACString& aU
     rv = saveListener->QueryInterface(
       NS_GET_IID(nsIUrlListener),
       getter_AddRefs(urlListener));
     if (NS_FAILED(rv))
       goto done;
 
     rv = messageService->SaveMessageToDisk(PromiseFlatCString(aURI).get(), tmpFile,
       needDummyHeader,
-      urlListener, nsnull,
+      urlListener, nullptr,
       canonicalLineEnding, mMsgWindow);
   }
 
 done:
   if (NS_FAILED(rv))
   {
     NS_IF_RELEASE(saveListener);
     Alert("saveMessageFailed");
@@ -1158,17 +1158,17 @@ nsMessenger::GetSaveAsFile(const nsAStri
     filePicker->SetDisplayDirectory(lastSaveDir);
 
   nsCOMPtr<nsIFile> localFile;
   rv = filePicker->Show(&dialogResult);
   NS_ENSURE_SUCCESS(rv, rv);
   if (dialogResult == nsIFilePicker::returnCancel)
   {
     // We'll indicate this by setting the outparam to null.
-    *aSaveAsFile = nsnull;
+    *aSaveAsFile = nullptr;
     return NS_OK;
   }
 
   rv = filePicker->GetFile(getter_AddRefs(localFile));
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = SetLastSaveDirectory(localFile);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -1213,17 +1213,17 @@ nsMessenger::GetSaveAsFile(const nsAStri
     }
     else
     {
       // We failed, or this isn't a file. We can't do anything about it.
       return NS_ERROR_FAILURE;
     }
   }
 
-  *aSaveAsFile = nsnull;
+  *aSaveAsFile = nullptr;
   localFile.swap(*aSaveAsFile);
   return NS_OK;
 }
 
 /**
  * Show a Save All dialog allowing the user to pick which folder to save
  * messages to.
  * @param [out] aSaveDir directory to save to. Will be null on cancel.
@@ -1245,28 +1245,28 @@ nsMessenger::GetSaveToDir(nsIFile **aSav
   if (NS_SUCCEEDED(rv) && lastSaveDir)
     filePicker->SetDisplayDirectory(lastSaveDir);
 
   PRInt16 dialogResult;
   rv = filePicker->Show(&dialogResult);
   if (NS_FAILED(rv) || dialogResult == nsIFilePicker::returnCancel)
   {
     // We'll indicate this by setting the outparam to null.
-    *aSaveDir = nsnull;
+    *aSaveDir = nullptr;
     return NS_OK;
   }
 
   nsCOMPtr<nsIFile> dir;
   rv = filePicker->GetFile(getter_AddRefs(dir));
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = SetLastSaveDirectory(dir);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  *aSaveDir = nsnull;
+  *aSaveDir = nullptr;
   dir.swap(*aSaveDir);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMessenger::SaveMessages(PRUint32 aCount,
                           const PRUnichar **aFilenameArray,
                           const char **aMessageUriArray)
@@ -1304,17 +1304,17 @@ nsMessenger::SaveMessages(PRUint32 aCoun
 
     rv = GetMessageServiceFromURI(nsDependentCString(aMessageUriArray[i]),
                                   getter_AddRefs(messageService));
     if (NS_FAILED(rv)) {
       Alert("saveMessageFailed");
       return rv;
     }
 
-    nsSaveMsgListener *saveListener = new nsSaveMsgListener(saveToFile, this, nsnull);
+    nsSaveMsgListener *saveListener = new nsSaveMsgListener(saveToFile, this, nullptr);
     if (!saveListener) {
       NS_IF_RELEASE(saveListener);
       Alert("saveMessageFailed");
       return NS_ERROR_OUT_OF_MEMORY;
     }
     NS_ADDREF(saveListener);
 
     rv = saveListener->QueryInterface(NS_GET_IID(nsIUrlListener),
@@ -1323,17 +1323,17 @@ nsMessenger::SaveMessages(PRUint32 aCoun
       NS_IF_RELEASE(saveListener);
       Alert("saveMessageFailed");
       return rv;
     }
 
     // Ok, now save the message.
     rv = messageService->SaveMessageToDisk(aMessageUriArray[i],
                                            saveToFile, false,
-                                           urlListener, nsnull,
+                                           urlListener, nullptr,
                                            true, mMsgWindow);
   }
   return rv;
 }
 
 nsresult
 nsMessenger::Alert(const char *stringName)
 {
@@ -1342,17 +1342,17 @@ nsMessenger::Alert(const char *stringNam
   if (mDocShell)
   {
     nsCOMPtr<nsIPrompt> dialog(do_GetInterface(mDocShell));
 
     if (dialog)
     {
       nsString alertStr;
       GetString(NS_ConvertASCIItoUTF16(stringName), alertStr);
-      rv = dialog->Alert(nsnull, alertStr.get());
+      rv = dialog->Alert(nullptr, alertStr.get());
     }
   }
   return rv;
 }
 
 NS_IMETHODIMP
 nsMessenger::MessageServiceFromURI(const nsACString& aUri, nsIMsgMessageService **aMsgService)
 {
@@ -1512,18 +1512,18 @@ NS_IMETHODIMP nsMessenger::SetDocumentCh
   {
     SetDisplayCharset(NS_LITERAL_CSTRING("UTF-8"));
 
     nsCOMPtr <nsIMsgMessageService> messageService;
     nsresult rv = GetMessageServiceFromURI(mLastDisplayURI, getter_AddRefs(messageService));
 
     if (NS_SUCCEEDED(rv) && messageService)
     {
-      messageService->DisplayMessage(mLastDisplayURI.get(), mDocShell, mMsgWindow, nsnull,
-                                     PromiseFlatCString(aCharacterSet).get(), nsnull);
+      messageService->DisplayMessage(mLastDisplayURI.get(), mDocShell, mMsgWindow, nullptr,
+                                     PromiseFlatCString(aCharacterSet).get(), nullptr);
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMessenger::GetLastDisplayedMessageUri(nsACString& aLastDisplayedMessageUri)
@@ -1537,17 +1537,17 @@ nsSaveMsgListener::nsSaveMsgListener(nsI
   m_file = do_QueryInterface(aFile);
   m_messenger = aMessenger;
   mListener = aListener;
   mUrlHasStopped = false;
   mRequestHasStopped = false;
   
     // rhp: for charset handling
   m_doCharsetConversion = false;
-  m_saveAllAttachmentsState = nsnull;
+  m_saveAllAttachmentsState = nullptr;
   mProgress = 0;
   mMaxProgress = -1;
   mCanceled = false;
   m_outputFormat = eUnknown;
   mInitialized = false;
   m_dataBuffer = new char[FOUR_K];
 }
 
@@ -1600,28 +1600,28 @@ nsSaveMsgListener::OnStopRunningUrl(nsIU
     nsCOMPtr<nsIMsgFolder> templateFolder;
     templateFolder = do_QueryInterface(res, &rv);
     if (NS_FAILED(rv)) goto done;
     nsCOMPtr<nsIMsgCopyService> copyService = do_GetService(NS_MSGCOPYSERVICE_CONTRACTID);
     if (copyService)
     {
       nsCOMPtr<nsIFile> clone;
       m_file->Clone(getter_AddRefs(clone));
-      rv = copyService->CopyFileMessage(clone, templateFolder, nsnull,
+      rv = copyService->CopyFileMessage(clone, templateFolder, nullptr,
                                         true, nsMsgMessageFlags::Read,
-                                        EmptyCString(), this, nsnull);
+                                        EmptyCString(), this, nullptr);
       // Clear this so we don't end up in a loop if OnStopRunningUrl gets
       // called again.
       m_templateUri.Truncate();
     }
   }
   else if (m_outputStream && mRequestHasStopped)
   {
     m_outputStream->Close();
-    m_outputStream = nsnull;
+    m_outputStream = nullptr;
   }
 
 done:
   if (NS_FAILED(rv))
   {
     if (m_file)
       m_file->Remove(false);
     if (m_messenger)
@@ -1718,17 +1718,17 @@ nsresult nsSaveMsgListener::InitializeDo
         PRTime timeDownloadStarted = PR_Now();
         
         nsCOMPtr<nsIURI> outputURI;
         NS_NewFileURI(getter_AddRefs(outputURI), m_file);
         
         nsCOMPtr<nsIURI> url;
         channel->GetURI(getter_AddRefs(url));
         rv = tr->Init(url, outputURI, EmptyString(), mimeinfo,
-                      timeDownloadStarted, nsnull, this);
+                      timeDownloadStarted, nullptr, this);
         
           // now store the web progresslistener
         mTransfer = tr;
       }
     }
     
 #if defined(XP_MACOSX) && !defined(__LP64__)
     /* if we are saving an appledouble or applesingle attachment, we need to use an Apple File Decoder */
@@ -1769,17 +1769,17 @@ nsSaveMsgListener::OnStopRequest(nsIRequ
   nsresult rv = NS_OK;
   mRequestHasStopped = true;
   
   // rhp: If we are doing the charset conversion magic, this is different
   // processing, otherwise, its just business as usual.
   //
   if ( (m_doCharsetConversion) && (m_outputStream) )
   {
-    char        *conBuf = nsnull;
+    char        *conBuf = nullptr;
     PRUint32    conLength = 0;
     
     // If we need text/plain, then we need to convert the HTML and then convert
     // to the systems charset
     //
     if (m_outputFormat == ePlainText)
     {
       NS_ConvertUTF8toUTF16 utf16Buffer(m_msgBuffer);
@@ -1799,17 +1799,17 @@ nsSaveMsgListener::OnStopRequest(nsIRequ
     }
     
     NS_Free(conBuf);
   }
  
   if (m_outputStream)
   {
     m_outputStream->Close();
-    m_outputStream = nsnull;
+    m_outputStream = nullptr;
   }
   
   if (m_saveAllAttachmentsState)
   {
     m_saveAllAttachmentsState->m_curIndex++;
     if (!mCanceled && m_saveAllAttachmentsState->m_curIndex < m_saveAllAttachmentsState->m_count)
     {
       nsSaveAllAttachmentsState *state = m_saveAllAttachmentsState;
@@ -1838,22 +1838,22 @@ nsSaveMsgListener::OnStopRequest(nsIRequ
       {
         rv = localFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, ATTACHMENT_PERMISSION);
         if (NS_FAILED(rv)) goto done;
       }
       rv = m_messenger->SaveAttachment(localFile,
                                        nsDependentCString(state->m_urlArray[i]),
                                        nsDependentCString(state->m_messageUriArray[i]),
                                        nsDependentCString(state->m_contentTypeArray[i]),
-                                       (void *)state, nsnull);
+                                       (void *)state, nullptr);
       done:
         if (NS_FAILED(rv))
         {
           delete state;
-          m_saveAllAttachmentsState = nsnull;
+          m_saveAllAttachmentsState = nullptr;
         }
     }
     else
     {
           // check if we're saving attachments prior to detaching them.
       if (m_saveAllAttachmentsState->m_detachingAttachments && !mCanceled)
       {
         nsSaveAllAttachmentsState *state = m_saveAllAttachmentsState;
@@ -1862,26 +1862,26 @@ nsSaveMsgListener::OnStopRequest(nsIRequ
                                        (const char **) state->m_urlArray,
                                        (const char **) state->m_displayNameArray,
                                        (const char **) state->m_messageUriArray,
                                        &state->m_savedFiles,
                                        state->m_withoutWarning);
       }
 
       delete m_saveAllAttachmentsState;
-      m_saveAllAttachmentsState = nsnull;
+      m_saveAllAttachmentsState = nullptr;
     }
   }
 
   if(mTransfer)
   {
-    mTransfer->OnProgressChange64(nsnull, nsnull, mMaxProgress, mMaxProgress, mMaxProgress, mMaxProgress);
-    mTransfer->OnStateChange(nsnull, nsnull, nsIWebProgressListener::STATE_STOP |
+    mTransfer->OnProgressChange64(nullptr, nullptr, mMaxProgress, mMaxProgress, mMaxProgress, mMaxProgress);
+    mTransfer->OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP |
       nsIWebProgressListener::STATE_IS_NETWORK, NS_OK);
-    mTransfer = nsnull; // break any circular dependencies between the progress dialog and use
+    mTransfer = nullptr; // break any circular dependencies between the progress dialog and use
   }
 
   if (mUrlHasStopped && mListener)
     mListener->OnStopRunningUrl(mListenerUri, rv);
 
   return NS_OK;
 }
 
@@ -1926,17 +1926,17 @@ nsSaveMsgListener::OnDataAvailable(nsIRe
         else
           rv = m_outputStream->Write(m_dataBuffer, readCount, &writeCount);
 
         available -= readCount;
       }
     }
 
     if (NS_SUCCEEDED(rv) && mTransfer) // Send progress notification.
-      mTransfer->OnProgressChange64(nsnull, request, mProgress, mMaxProgress, mProgress, mMaxProgress);
+      mTransfer->OnProgressChange64(nullptr, request, mProgress, mMaxProgress, mProgress, mMaxProgress);
   }
   return rv;
 }
 
 #define MESSENGER_STRING_URL       "chrome://messenger/locale/messenger.properties"
 
 nsresult
 nsMessenger::InitStringBundle()
@@ -2216,17 +2216,17 @@ NS_IMETHODIMP nsMessenger::OnItemEvent(n
 ///////////////////////////////////////////////////////////////////////////////
 // Detach/Delete Attachments
 ///////////////////////////////////////////////////////////////////////////////
 
 static const char * GetAttachmentPartId(const char * aAttachmentUrl)
 {
   static const char partIdPrefix[] = "part=";
   const char * partId = PL_strstr(aAttachmentUrl, partIdPrefix);
-  return partId ? (partId + sizeof(partIdPrefix) - 1) : nsnull;
+  return partId ? (partId + sizeof(partIdPrefix) - 1) : nullptr;
 }
 
 static int CompareAttachmentPartId(const char * aAttachUrlLeft, const char * aAttachUrlRight)
 {
   // part ids are numbers separated by periods, like "1.2.3.4".
   // we sort by doing a numerical comparison on each item in turn. e.g. "1.4" < "1.25"
   // shorter entries come before longer entries. e.g. "1.4" < "1.4.1.2"
   // return values:
@@ -2282,20 +2282,20 @@ static int CompareAttachmentPartId(const
 }
 
 // ------------------------------------
 
 // struct on purpose -> show that we don't ever want a vtable
 struct msgAttachment
 {
   msgAttachment()
-    : mContentType(nsnull),
-      mUrl(nsnull),
-      mDisplayName(nsnull),
-      mMessageUri(nsnull)
+    : mContentType(nullptr),
+      mUrl(nullptr),
+      mDisplayName(nullptr),
+      mMessageUri(nullptr)
   {
   }
 
   ~msgAttachment()
   {
     Clear();
   }
 
@@ -2323,20 +2323,20 @@ struct msgAttachment
   {
     Clear();
 
     mContentType = aSource.mContentType;
     mUrl = aSource.mUrl;
     mDisplayName = aSource.mDisplayName;
     mMessageUri = aSource.mMessageUri;
 
-    aSource.mContentType = nsnull;
-    aSource.mUrl = nsnull;
-    aSource.mDisplayName = nsnull;
-    aSource.mMessageUri = nsnull;
+    aSource.mContentType = nullptr;
+    aSource.mUrl = nullptr;
+    aSource.mDisplayName = nullptr;
+    aSource.mMessageUri = nullptr;
   }
 
   char* mContentType;
   char* mUrl;
   char* mDisplayName;
   char* mMessageUri;
 
 private:
@@ -2366,17 +2366,17 @@ public:
   PRUint32        mCount;
   PRUint32        mCurIndex;
   msgAttachment*  mAttachmentArray;
 };
 
 nsAttachmentState::nsAttachmentState()
   : mCount(0),
     mCurIndex(0),
-    mAttachmentArray(nsnull)
+    mAttachmentArray(nullptr)
 {
 }
 
 nsAttachmentState::~nsAttachmentState()
 {
   delete[] mAttachmentArray;
 }
 
@@ -2418,17 +2418,17 @@ nsAttachmentState::PrepareForAttachmentD
   // removal of the parent.
   //
   // e.g. the attachment list processing (showing only part ids)
   // before: 1.11, 1.3, 1.2, 1.2.1.3, 1.4.1.2
   // sorted: 1.2, 1.2.1.3, 1.3, 1.4.1.2, 1.11
   // after:  1.2, 1.3, 1.4.1.2, 1.11
 
   // sort
-  NS_QuickSort(mAttachmentArray, mCount, sizeof(msgAttachment), SortAttachmentsByPartId, nsnull);
+  NS_QuickSort(mAttachmentArray, mCount, sizeof(msgAttachment), SortAttachmentsByPartId, nullptr);
 
   // remove duplicates and sub-items
   int nCompare;
   for(PRUint32 u = 1; u < mCount;)
   {
     nCompare = ::CompareAttachmentPartId(mAttachmentArray[u-1].mUrl, mAttachmentArray[u].mUrl);
     if (nCompare == 0 || nCompare == -2) // [u-1] is the same as or a parent of [u]
     {
@@ -2544,17 +2544,17 @@ nsDelAttachListener::OnStopRequest(nsIRe
 
   // copy the file back into the folder. Note: setting msgToReplace only copies
   // metadata, so we do the delete ourselves
   nsCOMPtr<nsIMsgCopyServiceListener> listenerCopyService;
   rv = this->QueryInterface( NS_GET_IID(nsIMsgCopyServiceListener), getter_AddRefs(listenerCopyService) );
   NS_ENSURE_SUCCESS(rv,rv);
 
   mMsgFileStream->Close();
-  mMsgFileStream = nsnull;
+  mMsgFileStream = nullptr;
   mNewMessageKey = PR_UINT32_MAX;
   nsCOMPtr<nsIMsgCopyService> copyService = do_GetService(NS_MSGCOPYSERVICE_CONTRACTID);
   m_state = eCopyingNewMsg;
   // clone file because nsIFile on Windows caches the wrong file size.
   nsCOMPtr <nsIFile> clone;
   mMsgFile->Clone(getter_AddRefs(clone));
   if (copyService)
   {
@@ -2599,17 +2599,17 @@ nsresult nsDelAttachListener::DeleteOrig
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = messageArray->AppendElement(mOriginalMessage, false);
   NS_ENSURE_SUCCESS(rv,rv);
   nsCOMPtr<nsIMsgCopyServiceListener> listenerCopyService;
 
   QueryInterface( NS_GET_IID(nsIMsgCopyServiceListener), getter_AddRefs(listenerCopyService) );
 
-  mOriginalMessage = nsnull;
+  mOriginalMessage = nullptr;
   m_state = eDeletingOldMessage;
   return mMessageFolder->DeleteMessages(
     messageArray,         // messages
     mMsgWindow,           // msgWindow
     true,              // deleteStorage
     false,              // isMove
     listenerCopyService,  // listener
     false);            // allowUndo
@@ -2716,33 +2716,33 @@ nsDelAttachListener::OnStopCopy(nsresult
 }
 
 //
 // local methods
 //
 
 nsDelAttachListener::nsDelAttachListener()
 {
-  mAttach = nsnull;
+  mAttach = nullptr;
   mSaveFirst = false;
   mWrittenExtra = false;
   mNewMessageKey = PR_UINT32_MAX;
   m_state = eStarting;
 }
 
 nsDelAttachListener::~nsDelAttachListener()
 {
   if (mAttach)
   {
     delete mAttach;
   }
   if (mMsgFileStream)
   {
     mMsgFileStream->Close();
-    mMsgFileStream = nsnull;
+    mMsgFileStream = nullptr;
   }
   if (mMsgFile)
   {
     mMsgFile->Remove(false);
   }
 }
 
 nsresult
@@ -2819,17 +2819,17 @@ nsDelAttachListener::StartProcessing(nsM
   nsCOMPtr<nsISupports> listenerSupports;
   rv = this->QueryInterface(NS_GET_IID(nsISupports), getter_AddRefs(listenerSupports));
   NS_ENSURE_SUCCESS(rv,rv);
   nsCOMPtr<nsIUrlListener> listenerUrlListener = do_QueryInterface(listenerSupports, &rv);
   NS_ENSURE_SUCCESS(rv,rv);
 
   rv = mMessageService->StreamMessage(messageUri, listenerSupports, mMsgWindow,
                                       listenerUrlListener, true, sHeader,
-                                      false, nsnull);
+                                      false, nullptr);
   NS_ENSURE_SUCCESS(rv,rv);
 
   return NS_OK;
 }
 
 // ------------------------------------
 
 NS_IMETHODIMP
@@ -2839,17 +2839,17 @@ nsMessenger::DetachAttachment(const char
 {
   NS_ENSURE_ARG_POINTER(aContentType);
   NS_ENSURE_ARG_POINTER(aUrl);
   NS_ENSURE_ARG_POINTER(aDisplayName);
   NS_ENSURE_ARG_POINTER(aMessageUri);
 
   if (aSaveFirst)
     return SaveOneAttachment(aContentType, aUrl, aDisplayName, aMessageUri, true);
-  return DetachAttachments(1, &aContentType, &aUrl, &aDisplayName, &aMessageUri, nsnull, withoutWarning);
+  return DetachAttachments(1, &aContentType, &aUrl, &aDisplayName, &aMessageUri, nullptr, withoutWarning);
 }
 
 NS_IMETHODIMP
 nsMessenger::DetachAllAttachments(PRUint32 aCount,
                                   const char ** aContentTypeArray,
                                   const char ** aUrlArray,
                                   const char ** aDisplayNameArray,
                                   const char ** aMessageUriArray,
@@ -2860,30 +2860,30 @@ nsMessenger::DetachAllAttachments(PRUint
   NS_ENSURE_ARG_POINTER(aContentTypeArray);
   NS_ENSURE_ARG_POINTER(aUrlArray);
   NS_ENSURE_ARG_POINTER(aDisplayNameArray);
   NS_ENSURE_ARG_POINTER(aMessageUriArray);
 
   if (aSaveFirst)
     return SaveAllAttachments(aCount, aContentTypeArray, aUrlArray, aDisplayNameArray, aMessageUriArray, true);
   else
-    return DetachAttachments(aCount, aContentTypeArray, aUrlArray, aDisplayNameArray, aMessageUriArray, nsnull, withoutWarning);
+    return DetachAttachments(aCount, aContentTypeArray, aUrlArray, aDisplayNameArray, aMessageUriArray, nullptr, withoutWarning);
 }
 
 nsresult
 nsMessenger::DetachAttachments(PRUint32 aCount,
                                const char ** aContentTypeArray,
                                const char ** aUrlArray,
                                const char ** aDisplayNameArray,
                                const char ** aMessageUriArray,
                                nsTArray<nsCString> *saveFileUris,
                                bool withoutWarning)
 {
   // if withoutWarning no dialog for user
-  if (!withoutWarning && NS_FAILED(PromptIfDeleteAttachments(saveFileUris != nsnull, aCount, aDisplayNameArray)))
+  if (!withoutWarning && NS_FAILED(PromptIfDeleteAttachments(saveFileUris != nullptr, aCount, aDisplayNameArray)))
       return NS_OK;
   
   nsresult rv = NS_OK;
 
   // ensure that our arguments are valid
 //  char * partId;
   for (PRUint32 u = 0; u < aCount; ++u)
   {
@@ -2945,17 +2945,17 @@ nsMessenger::DetachAttachments(PRUint32 
   if (NS_FAILED(rv))
   {
     delete attach;
     return rv;
   }
 
   // initialize our listener with the attachments and details. The listener takes ownership
   // of 'attach' immediately irrespective of the return value (error or not).
-  return listener->StartProcessing(this, mMsgWindow, attach, saveFileUris != nsnull);
+  return listener->StartProcessing(this, mMsgWindow, attach, saveFileUris != nullptr);
 }
 
 nsresult
 nsMessenger::PromptIfDeleteAttachments(bool aSaveFirst,
                                        PRUint32 aCount,
                                        const char ** aDisplayNameArray)
 {
   nsresult rv = NS_ERROR_FAILURE;
@@ -2983,14 +2983,14 @@ nsMessenger::PromptIfDeleteAttachments(b
   // format the message and display
   nsString promptMessage;
   const PRUnichar * propertyName = aSaveFirst ?
     NS_LITERAL_STRING("detachAttachments").get() : NS_LITERAL_STRING("deleteAttachments").get();
   rv = mStringBundle->FormatStringFromName(propertyName, formatStrings, 1,getter_Copies(promptMessage));
   NS_ENSURE_SUCCESS(rv, rv);
 
   bool dialogResult = false;
-  rv = dialog->Confirm(nsnull, promptMessage.get(), &dialogResult);
+  rv = dialog->Confirm(nullptr, promptMessage.get(), &dialogResult);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return dialogResult ? NS_OK : NS_ERROR_FAILURE;
 }
 
--- a/mailnews/base/src/nsMessengerOSXIntegration.mm
+++ b/mailnews/base/src/nsMessengerOSXIntegration.mm
@@ -59,17 +59,17 @@
 #define kNewMailAlertIcon "chrome://messenger/skin/icons/new-mail-alert.png"
 #define kChatEnabledPref "mail.chat.enabled"
 #define kBiffShowAlertPref "mail.biff.show_alert"
 #define kBiffAnimateDockIconPref "mail.biff.animate_dock_icon"
 #define kMaxDisplayCount 10
 #define kNewChatMessageTopic "new-directed-incoming-message"
 #define kUnreadImCountChangedTopic "unread-im-count-changed"
 
-static PRLogModuleInfo *MsgDockCountsLogModule = nsnull;
+static PRLogModuleInfo *MsgDockCountsLogModule = nullptr;
 
 // HACK: Limitations in Focus/SetFocus on Mac (see bug 465446)
 nsresult FocusAppNative()
 {
   ProcessSerialNumber psn;
 
   if (::GetCurrentProcess(&psn) != 0)
    return NS_ERROR_FAILURE;
--- a/mailnews/base/src/nsMessengerUnixIntegration.cpp
+++ b/mailnews/base/src/nsMessengerUnixIntegration.cpp
@@ -478,18 +478,18 @@ void nsMessengerUnixIntegration::FillToo
   nsCString folderUri;
   GetFirstFolderWithNewMail(folderUri);
 
   PRUint32 count = 0;
   if (NS_FAILED(mFoldersWithNewMail->Count(&count)))
     return;
 
   nsCOMPtr<nsIWeakReference> weakReference;
-  nsCOMPtr<nsIMsgFolder> folder = nsnull;
-  nsCOMPtr<nsIMsgFolder> folderWithNewMail = nsnull;
+  nsCOMPtr<nsIMsgFolder> folder = nullptr;
+  nsCOMPtr<nsIMsgFolder> folderWithNewMail = nullptr;
 
   PRUint32 i;
   for (i = 0; i < count && !folderWithNewMail; i++)
   {
     weakReference = do_QueryElementAt(mFoldersWithNewMail, i);
     folder = do_QueryReferent(weakReference);
     folder->GetChildWithURI(folderUri, true, true,
                             getter_AddRefs(folderWithNewMail));
@@ -552,17 +552,17 @@ void nsMessengerUnixIntegration::FillToo
     NS_Free(newMessageKeys);
 
     // If we didn't happen to add any message headers, bail out
     if (!newMsgHdrs.Count())
       return;
 
     // Sort the message headers by dateInSeconds, in ascending
     // order
-    newMsgHdrs.Sort(nsMsgDbHdrTimestampComparator, nsnull);
+    newMsgHdrs.Sort(nsMsgDbHdrTimestampComparator, nullptr);
 
     nsString alertBody;
 
     // Build the body text of the notification.
     if (!BuildNotificationBody(newMsgHdrs[0], bundle, alertBody))
       return;
 
     // Show the notification
@@ -788,17 +788,17 @@ nsMessengerUnixIntegration::OnStopRunnin
 #endif
   return NS_OK;
 }
 
 nsresult
 nsMessengerUnixIntegration::GetMRUTimestampForFolder(nsIMsgFolder *aFolder,
                                                      PRUint32 *aLastMRUTime)
 {
-  nsCOMPtr<nsIMsgFolder> rootFolder = nsnull;
+  nsCOMPtr<nsIMsgFolder> rootFolder = nullptr;
   nsresult rv = aFolder->GetRootFolder(getter_AddRefs(rootFolder));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCString rootFolderURI;
   rootFolder->GetURI(rootFolderURI);
   if (!mLastMRUTimes.Get(rootFolderURI, aLastMRUTime))
     aLastMRUTime = 0;
 
@@ -806,17 +806,17 @@ nsMessengerUnixIntegration::GetMRUTimest
 }
 
 #ifdef MOZ_THUNDERBIRD
 nsresult
 nsMessengerUnixIntegration::PutMRUTimestampForFolder(nsIMsgFolder *aFolder,
                                                      PRUint32 aLastMRUTime)
 {
   nsresult rv;
-  nsCOMPtr<nsIMsgFolder> rootFolder = nsnull;
+  nsCOMPtr<nsIMsgFolder> rootFolder = nullptr;
   rv = aFolder->GetRootFolder(getter_AddRefs(rootFolder));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCString rootFolderURI;
   rootFolder->GetURI(rootFolderURI);
   mLastMRUTimes.Put(rootFolderURI, aLastMRUTime);
 
   return NS_OK;
--- a/mailnews/base/src/nsMessengerWinIntegration.cpp
+++ b/mailnews/base/src/nsMessengerWinIntegration.cpp
@@ -247,17 +247,17 @@ nsMessengerWinIntegration::nsMessengerWi
   mBiffIconInitialized = false;
   NS_NewISupportsArray(getter_AddRefs(mFoldersWithNewMail));
 }
 
 nsMessengerWinIntegration::~nsMessengerWinIntegration()
 {
   if (mUnreadCountUpdateTimer) {
     mUnreadCountUpdateTimer->Cancel();
-    mUnreadCountUpdateTimer = nsnull;
+    mUnreadCountUpdateTimer = nullptr;
   }
 
   // one last attempt, update the registry
   nsresult rv = UpdateRegistryWithCurrent();
   NS_ASSERTION(NS_SUCCEEDED(rv), "failed to update registry on shutdown");
   DestroyBiffIcon();
 }
 
@@ -356,17 +356,17 @@ nsMessengerWinIntegration::Init()
                              getter_AddRefs(profilePath));
   NS_ENSURE_SUCCESS(rv,rv);
 
   rv = profilePath->GetPath(mProfilePath);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // get application path
   WCHAR appPath[_MAX_PATH] = {0};
-  ::GetModuleFileNameW(nsnull, appPath, sizeof(appPath));
+  ::GetModuleFileNameW(nullptr, appPath, sizeof(appPath));
   mAppName.Assign((PRUnichar *)appPath);
 
   rv = ResetCurrent();
   NS_ENSURE_SUCCESS(rv,rv);
 
   return NS_OK;
 }
 
--- a/mailnews/base/src/nsMsgAccount.cpp
+++ b/mailnews/base/src/nsMsgAccount.cpp
@@ -134,17 +134,17 @@ nsMsgAccount::SetIncomingServer(nsIMsgIn
     // this is the point at which we can notify listeners about the
     // creation of the root folder, which implies creation of the new server.
     nsCOMPtr<nsIMsgFolder> rootFolder;
     rv = aIncomingServer->GetRootFolder(getter_AddRefs(rootFolder));
     NS_ENSURE_SUCCESS(rv, rv);
     nsCOMPtr<nsIFolderListener> mailSession =
              do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
-    mailSession->OnItemAdded(nsnull, rootFolder);
+    mailSession->OnItemAdded(nullptr, rootFolder);
     nsCOMPtr<nsIMsgFolderNotificationService> notifier(do_GetService(NS_MSGNOTIFICATIONSERVICE_CONTRACTID, &rv));
     NS_ENSURE_SUCCESS(rv, rv);
     notifier->NotifyFolderAdded(rootFolder);
 
     nsCOMPtr<nsIMsgAccountManager> accountManager = do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
     if (NS_SUCCEEDED(rv))
       accountManager->NotifyServerLoaded(aIncomingServer);
 
@@ -241,17 +241,17 @@ nsMsgAccount::createIdentities()
 
 
 /* attribute nsIMsgIdentity defaultIdentity; */
 NS_IMETHODIMP
 nsMsgAccount::GetDefaultIdentity(nsIMsgIdentity **aDefaultIdentity)
 {
   NS_ENSURE_ARG_POINTER(aDefaultIdentity);
 
-  *aDefaultIdentity = nsnull;
+  *aDefaultIdentity = nullptr;
   nsresult rv;
 
   if (!m_identities)
   {
     rv = Init();
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
@@ -375,17 +375,17 @@ nsMsgAccount::RemoveIdentity(nsIMsgIdent
   m_identities->RemoveElement(aIdentity);
   count--;
 
   // clear out the actual pref values associated with the identity
   aIdentity->ClearAllValues();
 
   // if we just deleted the default identity, clear it out so we pick a new one
   if (m_defaultIdentity == aIdentity)
-    m_defaultIdentity = nsnull;
+    m_defaultIdentity = nullptr;
 
   // now rebuild the identity pref
   nsCAutoString identitiesKeyPref("mail.account.");
   identitiesKeyPref.Append(m_accountKey);
   identitiesKeyPref.Append(".identities");
 
   nsCAutoString newIdentityList;
 
--- a/mailnews/base/src/nsMsgAccountManager.cpp
+++ b/mailnews/base/src/nsMsgAccountManager.cpp
@@ -99,17 +99,17 @@ struct findServerEntry {
   nsIMsgIncomingServer *server;
   findServerEntry(const nsACString& aHostName, const nsACString& aUserName,
                   const nsACString& aType, PRInt32 aPort, bool aUseRealSetting)
     : hostname(aHostName),
       username(aUserName),
       type(aType),
       port(aPort),
       useRealSetting(aUseRealSetting),
-      server(nsnull)
+      server(nullptr)
     {}
 };
 
 typedef struct _findServerByKeyEntry {
   nsCString key;
   PRInt32 index;
 } findServerByKeyEntry;
 
@@ -230,17 +230,17 @@ nsresult nsMsgAccountManager::Shutdown()
   if (NS_SUCCEEDED(rv) && biffService)
     biffService->Shutdown();
 
   //shutdown removes nsIIncomingServer listener from purge service, so do it after accounts have been unloaded
   nsCOMPtr<nsIMsgPurgeService> purgeService = do_GetService(NS_MSGPURGESERVICE_CONTRACTID, &rv);
   if (NS_SUCCEEDED(rv) && purgeService)
     purgeService->Shutdown();
 
-  m_msgFolderCache = nsnull;
+  m_msgFolderCache = nullptr;
   m_haveShutdown = true;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgAccountManager::GetShutdownInProgress(bool *_retval)
 {
     NS_ENSURE_ARG_POINTER(_retval);
@@ -349,20 +349,20 @@ nsMsgAccountManager::getUniqueAccountKey
     aResult.Assign(ACCOUNT_PREFIX);
     aResult.AppendInt(++lastKey);
     rv = prefBranch->SetIntPref("mail.account.lastKey", lastKey);
   } else {
     // If pref service is not working, try to find a free accountX key
     // by checking which keys exist.
     PRInt32 i = 1;
     findAccountByKeyEntry findEntry;
-    findEntry.account = nsnull;
+    findEntry.account = nullptr;
 
     do {
-      findEntry.account = nsnull;
+      findEntry.account = nullptr;
       aResult = ACCOUNT_PREFIX;
       aResult.AppendInt(i++);
       findEntry.key = aResult.get();
       accounts->EnumerateForwards(findAccountByKey, (void *)&findEntry);
     } while (findEntry.account);
   }
 }
 
@@ -384,17 +384,17 @@ nsMsgAccountManager::CreateIdentity(nsIM
   return rv;
 }
 
 NS_IMETHODIMP
 nsMsgAccountManager::GetIdentity(const nsACString& key, nsIMsgIdentity **_retval)
 {
   NS_ENSURE_ARG_POINTER(_retval);
   nsresult rv = NS_OK;
-  *_retval = nsnull;
+  *_retval = nullptr;
 
   if (!key.IsEmpty())
   {
     nsCOMPtr<nsIMsgIdentity> identity;
     m_identities.Get(key, getter_AddRefs(identity));
     if (identity)
       identity.swap(*_retval);
     else // identity doesn't exist. create it.
@@ -506,17 +506,17 @@ nsMsgAccountManager::RemoveIncomingServe
   nsCString serverKey;
   nsresult rv = aServer->GetKey(serverKey);
   NS_ENSURE_SUCCESS(rv, rv);
 
   LogoutOfServer(aServer); // close cached connections and forget session password
 
   // invalidate the FindServer() cache if we are removing the cached server
   if (m_lastFindServerResult == aServer)
-    SetLastServerFound(nsnull, EmptyCString(), EmptyCString(), 0, EmptyCString());
+    SetLastServerFound(nullptr, EmptyCString(), EmptyCString(), 0, EmptyCString());
 
   m_incomingServers.Remove(serverKey);
 
   nsCOMPtr<nsIMsgFolder> rootFolder;
   nsCOMPtr<nsISupportsArray> allDescendents;
 
   rv = aServer->GetRootFolder(getter_AddRefs(rootFolder));
   NS_ENSURE_SUCCESS(rv, rv);
@@ -549,17 +549,17 @@ nsMsgAccountManager::RemoveIncomingServe
         folder->GetParent(getter_AddRefs(parentFolder));
         mailSession->OnItemRemoved(parentFolder, folder);
       }
     }
   }
   if (notifier)
     notifier->NotifyFolderDeleted(rootFolder);
   if (mailSession)
-    mailSession->OnItemRemoved(nsnull, rootFolder);
+    mailSession->OnItemRemoved(nullptr, rootFolder);
 
   mFolderListeners->EnumerateForwards(removeListenerFromFolder, (void*)rootFolder);
   NotifyServerUnloaded(aServer);
   if (aCleanupFiles)
   {
     rv = aServer->RemoveFiles();
     NS_ENSURE_SUCCESS(rv, rv);
   }
@@ -577,17 +577,17 @@ nsMsgAccountManager::RemoveIncomingServe
 nsresult
 nsMsgAccountManager::createKeyedServer(const nsACString& key,
                                        const nsACString& username,
                                        const nsACString& hostname,
                                        const nsACString& type,
                                        nsIMsgIncomingServer ** aServer)
 {
   nsresult rv;
-  *aServer = nsnull;
+  *aServer = nullptr;
 
   //construct the contractid
   nsCAutoString serverContractID(NS_MSGINCOMINGSERVER_CONTRACTID_PREFIX);
   serverContractID += type;
 
   // finally, create the server
   nsCOMPtr<nsIMsgIncomingServer> server =
            do_CreateInstance(serverContractID.get(), &rv);
@@ -656,17 +656,17 @@ nsMsgAccountManager::RemoveAccount(nsIMs
   if (NS_FAILED(rv) && accountRemoved)
   {
     m_accounts->AppendElement(aAccount);
     return rv;
   }
 
   // if it's the default, clear the default account
   if (m_defaultAccount.get() == aAccount)
-    SetDefaultAccount(nsnull);
+    SetDefaultAccount(nullptr);
 
   // XXX - need to figure out if this is the last time this server is
   // being used, and only send notification then.
   // (and only remove from hashtable then too!)
   nsCOMPtr<nsIMsgIncomingServer> server;
   rv = aAccount->GetIncomingServer(getter_AddRefs(server));
   if (NS_SUCCEEDED(rv) && server)
     RemoveIncomingServer(server, false);
@@ -747,17 +747,17 @@ nsMsgAccountManager::GetDefaultAccount(n
 
   nsresult rv = LoadAccounts();
   NS_ENSURE_SUCCESS(rv, rv);
 
   PRUint32 count;
   if (!m_defaultAccount) {
     m_accounts->Count(&count);
     if (!count) {
-      *aDefaultAccount = nsnull;
+      *aDefaultAccount = nullptr;
       return NS_ERROR_FAILURE;
     }
 
     nsCString defaultKey;
     rv = m_prefs->GetCharPref(PREF_MAIL_ACCOUNTMANAGER_DEFAULTACCOUNT, getter_Copies(defaultKey));
 
     if (NS_SUCCEEDED(rv))
       GetAccount(defaultKey, getter_AddRefs(m_defaultAccount));
@@ -847,17 +847,17 @@ nsMsgAccountManager::notifyDefaultServer
   }
 
   if (aOldAccount && aNewAccount)  //only notify if the user goes and changes default account
   {
     nsCOMPtr<nsIObserverService> observerService =
       mozilla::services::GetObserverService();
 
     if (observerService)
-      observerService->NotifyObservers(nsnull,"mailDefaultAccountChanged",nsnull);
+      observerService->NotifyObservers(nullptr,"mailDefaultAccountChanged",nullptr);
   }
 
   return NS_OK;
 }
 
 nsresult
 nsMsgAccountManager::setDefaultAccountPref(nsIMsgAccount* aDefaultAccount)
 {
@@ -997,28 +997,28 @@ hashCleanupOnExit(nsCStringHashKey::KeyT
                  nsCOMPtr<nsIMsgFolder> inboxFolder(do_QueryInterface(item));
                  if (!inboxFolder)
                    continue;
 
                  PRUint32 flags;
                  inboxFolder->GetFlags(&flags);
                  if (flags & nsMsgFolderFlags::Inbox)
                  {
-                   rv = inboxFolder->Compact(urlListener, nsnull /* msgwindow */);
+                   rv = inboxFolder->Compact(urlListener, nullptr /* msgwindow */);
                    if (NS_SUCCEEDED(rv))
                      accountManager->SetFolderDoingCleanupInbox(inboxFolder);
                    break;
                  }
                }
              }
            }
 
            if (emptyTrashOnExit)
            {
-             rv = folder->EmptyTrash(nsnull, urlListener);
+             rv = folder->EmptyTrash(nullptr, urlListener);
              if (isImap && NS_SUCCEEDED(rv))
                accountManager->SetFolderDoingEmptyTrash(folder);
            }
 
            if (isImap && urlListener)
            {
              nsCOMPtr<nsIThread> thread(do_GetCurrentThread());
 
@@ -1387,17 +1387,17 @@ nsMsgAccountManager::LoadAccounts()
     serverKeyPref += ".server";
     nsCString serverKey;
     rv = m_prefs->GetCharPref(serverKeyPref.get(), getter_Copies(serverKey));
     if (NS_FAILED(rv))
       continue;
 
     findAccountByKeyEntry entry;
     entry.key = serverKey;
-    entry.account = nsnull;
+    entry.account = nullptr;
 
     m_accounts->EnumerateForwards(findAccountByServerKey, (void *)&entry);
     // If we have an existing account with the same server, ignore this account
     if (entry.account)
       continue;
 
     if (NS_FAILED(createKeyedAccount(accountsArray[i],
                                      getter_AddRefs(account))) || !account)
@@ -1455,17 +1455,17 @@ nsMsgAccountManager::LoadAccounts()
   nsCString localFoldersServerKey;
   rv = m_prefs->GetCharPref(PREF_MAIL_ACCOUNTMANAGER_LOCALFOLDERSSERVER,
                             getter_Copies(localFoldersServerKey));
 
   if (!localFoldersServerKey.IsEmpty())
   {
     findAccountByKeyEntry entry;
     entry.key = localFoldersServerKey;
-    entry.account = nsnull;
+    entry.account = nullptr;
 
     nsCOMPtr<nsIMsgIncomingServer> server;
     rv = GetIncomingServer(localFoldersServerKey, getter_AddRefs(server));
     if (server)
     {
       m_accounts->EnumerateForwards(findAccountByServerKey, (void *)&entry);
       // If we don't have an existing account pointing at the local folders
       // server, we're going to add one.
@@ -1579,54 +1579,54 @@ nsMsgAccountManager::SetSpecialFolders()
   // set the JUNK folder flag on the spam folders, right?
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgAccountManager::UnloadAccounts()
 {
   // release the default account
-  kDefaultServerAtom = nsnull;
-  mFolderFlagAtom = nsnull;
-
-  m_defaultAccount=nsnull;
+  kDefaultServerAtom = nullptr;
+  mFolderFlagAtom = nullptr;
+
+  m_defaultAccount=nullptr;
   m_incomingServers.Enumerate(hashUnloadServer, this);
 
   m_accounts->Clear();          // will release all elements
   m_identities.Clear();
   m_incomingServers.Clear();
   m_accountsLoaded = false;
   mAccountKeyList.Truncate();
-  SetLastServerFound(nsnull, EmptyCString(), EmptyCString(), 0, EmptyCString());
+  SetLastServerFound(nullptr, EmptyCString(), EmptyCString(), 0, EmptyCString());
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgAccountManager::ShutdownServers()
 {
-  m_incomingServers.Enumerate(hashShutdown, nsnull);
+  m_incomingServers.Enumerate(hashShutdown, nullptr);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgAccountManager::CloseCachedConnections()
 {
-  m_incomingServers.Enumerate(hashCloseCachedConnections, nsnull);
+  m_incomingServers.Enumerate(hashCloseCachedConnections, nullptr);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgAccountManager::CleanupOnExit()
 {
   // This can get called multiple times, and potentially re-entrantly.
   // So add some protection against that.
   if (m_shutdownInProgress)
     return NS_OK;
   m_shutdownInProgress = true;
-  m_incomingServers.Enumerate(hashCleanupOnExit, nsnull);
+  m_incomingServers.Enumerate(hashCleanupOnExit, nullptr);
   // Try to do this early on in the shutdown process before
   // necko shuts itself down.
   CloseCachedConnections();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgAccountManager::WriteToFolderCache(nsIMsgFolderCache *folderCache)
@@ -1675,24 +1675,24 @@ nsMsgAccountManager::CreateAccount(nsIMs
 
 NS_IMETHODIMP
 nsMsgAccountManager::GetAccount(const nsACString& key, nsIMsgAccount **_retval)
 {
   NS_ENSURE_ARG_POINTER(_retval);
 
   findAccountByKeyEntry findEntry;
   findEntry.key = key;
-  findEntry.account = nsnull;
+  findEntry.account = nullptr;
 
   m_accounts->EnumerateForwards(findAccountByKey, (void *)&findEntry);
 
   if (findEntry.account)
     NS_ADDREF(*_retval = findEntry.account);
   else
-    *_retval = nsnull;
+    *_retval = nullptr;
 
   // not found, create on demand
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgAccountManager::FindServerIndex(nsIMsgIncomingServer* server, PRInt32* result)
 {
@@ -1786,17 +1786,17 @@ NS_IMETHODIMP nsMsgAccountManager::Notif
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgAccountManager::NotifyServerUnloaded(nsIMsgIncomingServer *server)
 {
   NS_ENSURE_ARG_POINTER(server);
 
   PRInt32 count = m_incomingServerListeners.Count();
-  server->SetFilterList(nsnull); // clear this to cut shutdown leaks. we are always passing valid non-null server here.
+  server->SetFilterList(nullptr); // clear this to cut shutdown leaks. we are always passing valid non-null server here.
 
   for(PRInt32 i = 0; i < count; i++)
   {
     nsIIncomingServerListener* listener = m_incomingServerListeners[i];
     listener->OnServerUnloaded(server);
   }
 
   return NS_OK;
@@ -1912,17 +1912,17 @@ nsMsgAccountManager::FindServer(const ns
 // Interface called by UI js only (always return true).
 NS_IMETHODIMP
 nsMsgAccountManager::FindRealServer(const nsACString& username,
                                     const nsACString& hostname,
                                     const nsACString& type,
                                     PRInt32 port,
                                     nsIMsgIncomingServer** aResult)
 {
-  *aResult = nsnull;
+  *aResult = nullptr;
   findServerInternal(username, hostname, type, port, true, aResult);
   return NS_OK;
 }
 
 bool
 nsMsgAccountManager::findAccountByServerKey(nsISupports *element,
                                           void *aData)
 {
@@ -1954,29 +1954,29 @@ nsMsgAccountManager::findAccountByServer
 NS_IMETHODIMP
 nsMsgAccountManager::FindAccountForServer(nsIMsgIncomingServer *server,
                                             nsIMsgAccount **aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
   if (!server)
   {
-    (*aResult) = nsnull;
+    (*aResult) = nullptr;
     return NS_OK;
   }
 
   nsresult rv;
 
   nsCString key;
   rv = server->GetKey(key);
   NS_ENSURE_SUCCESS(rv, rv);
 
   findAccountByKeyEntry entry;
   entry.key = key;
-  entry.account = nsnull;
+  entry.account = nullptr;
 
   m_accounts->EnumerateForwards(findAccountByServerKey, (void *)&entry);
 
   if (entry.account)
     NS_ADDREF(*aResult = entry.account);
   return NS_OK;
 }
 
@@ -2055,17 +2055,17 @@ nsMsgAccountManager::GetFirstIdentityFor
   {
     nsCOMPtr<nsIMsgIdentity> identity;
     rv = identities->QueryElementAt(0, NS_GET_IID(nsIMsgIdentity),
                                   (void **)getter_AddRefs(identity));
     NS_ENSURE_SUCCESS(rv, rv);
     identity.swap(*aIdentity);
   }
   else
-    *aIdentity = nsnull;
+    *aIdentity = nullptr;
   return rv;
 }
 
 NS_IMETHODIMP
 ns