Bug 647481 - Remove nsInt64, nsUint64 and nsTime from comm-central r=neil sr=bienvenu
authorIan Neal <iann_cvs@blueyonder.co.uk>
Wed, 06 Apr 2011 21:18:36 +0100
changeset 7512 c831c107de255938939497b8b70e07da333410f7
parent 7508 ce7a512aff7ae3beea08d527439df45745a3d488
child 7513 000c04a87624ce94e1efbb9ee22c4a1184f2bb14
push idunknown
push userunknown
push dateunknown
reviewersneil, bienvenu
bugs647481
Bug 647481 - Remove nsInt64, nsUint64 and nsTime from comm-central r=neil sr=bienvenu
mail/components/migration/src/nsNetscapeProfileMigratorBase.cpp
mailnews/base/search/src/nsMsgSearchTerm.cpp
mailnews/base/src/nsMessengerOSXIntegration.h
mailnews/base/src/nsMessengerWinIntegration.h
mailnews/base/src/nsMsgBiffManager.cpp
mailnews/base/src/nsMsgBiffManager.h
mailnews/base/src/nsMsgProgress.cpp
mailnews/base/src/nsMsgPurgeService.cpp
mailnews/base/src/nsMsgPurgeService.h
mailnews/base/src/nsMsgStatusFeedback.cpp
mailnews/base/util/nsMsgDBFolder.cpp
mailnews/base/util/nsMsgFileStream.cpp
mailnews/base/util/nsMsgProtocol.cpp
mailnews/db/msgdb/src/nsMsgDatabase.cpp
mailnews/imap/src/nsImapMailFolder.cpp
mailnews/imap/src/nsImapService.cpp
mailnews/local/src/nsLocalMailFolder.cpp
mailnews/local/src/nsMailboxProtocol.cpp
mailnews/local/src/nsParseMailbox.cpp
mailnews/local/src/nsParseMailbox.h
mailnews/local/src/nsPop3Protocol.cpp
mailnews/local/src/nsPop3Service.cpp
mailnews/news/src/nsNNTPProtocol.cpp
mailnews/news/src/nsNntpIncomingServer.cpp
--- a/mail/components/migration/src/nsNetscapeProfileMigratorBase.cpp
+++ b/mail/components/migration/src/nsNetscapeProfileMigratorBase.cpp
@@ -35,17 +35,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsIFile.h"
 #include "nsIInputStream.h"
 #include "nsILineInputStream.h"
-#include "nsInt64.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefLocalizedString.h"
 #include "nsIPrefService.h"
 #include "nsIRDFService.h"
 #include "NSReg.h"
 #include "nsIServiceManager.h"
 #include "nsIMutableArray.h"
 #include "nsISupportsPrimitives.h"
--- a/mailnews/base/search/src/nsMsgSearchTerm.cpp
+++ b/mailnews/base/search/src/nsMsgSearchTerm.cpp
@@ -53,17 +53,16 @@
 #include "nsIMsgImapMailFolder.h"
 #include "nsMsgSearchImap.h"
 #include "nsMsgLocalSearch.h"
 #include "nsMsgSearchNews.h"
 #include "nsMsgSearchValue.h"
 #include "nsMsgI18N.h"
 #include "nsIMimeConverter.h"
 #include "nsMsgMimeCID.h"
-#include "nsTime.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 #include "nsIMsgFilterPlugin.h"
 #include "nsILocalFile.h"
 #include "nsIRDFService.h"
 #include "nsISupportsObsolete.h"
 #include "nsNetCID.h"
 #include "nsIFileStreams.h"
@@ -876,17 +875,16 @@ NS_IMETHODIMP nsMsgSearchTerm::MatchFold
 
 NS_IMETHODIMP nsMsgSearchTerm::MatchUint32HdrProperty(nsIMsgDBHdr *aHdr, PRBool *aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
   NS_ENSURE_ARG_POINTER(aHdr);
 
   PRUint32 dbHdrValue;
   aHdr->GetUint32Property(m_hdrProperty.get(), &dbHdrValue);
-  nsresult rv = NS_OK;
 
   PRBool result = PR_FALSE;
   switch (m_operator)
   {
   case nsMsgSearchOp::IsGreaterThan:
     if (dbHdrValue > m_value.u.msgStatus)
       result = PR_TRUE;
     break;
@@ -1234,29 +1232,28 @@ nsresult nsMsgSearchTerm::GetLocalTimes 
 
 
 nsresult nsMsgSearchTerm::MatchDate (PRTime dateToMatch, PRBool *pResult)
 {
   NS_ENSURE_ARG_POINTER(pResult);
 
   nsresult err = NS_OK;
   PRBool result = PR_FALSE;
-  nsTime t_date(dateToMatch);
 
   switch (m_operator)
   {
   case nsMsgSearchOp::IsBefore:
-    if (t_date < nsTime(m_value.u.date))
+    if (dateToMatch < m_value.u.date)
       result = PR_TRUE;
     break;
   case nsMsgSearchOp::IsAfter:
     {
-      nsTime adjustedDate = nsTime(m_value.u.date);
+      PRTime adjustedDate = m_value.u.date;
       adjustedDate += 60*60*24; // we want to be greater than the next day....
-      if (t_date > adjustedDate)
+      if (dateToMatch > adjustedDate)
         result = PR_TRUE;
     }
     break;
   case nsMsgSearchOp::Is:
     {
       PRExplodedTime tmToMatch, tmThis;
       if (NS_OK == GetLocalTimes (dateToMatch, m_value.u.date, tmToMatch, tmThis))
       {
--- a/mailnews/base/src/nsMessengerOSXIntegration.h
+++ b/mailnews/base/src/nsMessengerOSXIntegration.h
@@ -42,17 +42,16 @@
 #define __nsMessengerOSXIntegration_h
 
 #include "nsIMessengerOSIntegration.h"
 #include "nsIFolderListener.h"
 #include "nsIAtom.h"
 #include "nsITimer.h"
 #include "nsCOMPtr.h"
 #include "nsStringGlue.h"
-#include "nsInt64.h"
 #include "nsIObserver.h"
 #include "nsIAlertsService.h"
 
 #define NS_MESSENGEROSXINTEGRATION_CID \
   {0xaa83266, 0x4225, 0x4c4b, \
   {0x93, 0xf8, 0x94, 0xb1, 0x82, 0x58, 0x6f, 0x93}}
 
 class nsIStringBundle;
--- a/mailnews/base/src/nsMessengerWinIntegration.h
+++ b/mailnews/base/src/nsMessengerWinIntegration.h
@@ -47,17 +47,16 @@
 #include <shellapi.h>
 
 #include "nsIMessengerOSIntegration.h"
 #include "nsIFolderListener.h"
 #include "nsIAtom.h"
 #include "nsITimer.h"
 #include "nsCOMPtr.h"
 #include "nsStringGlue.h"
-#include "nsInt64.h"
 #include "nsISupportsArray.h"
 #include "nsIObserver.h"
 
 // this function is exported by shell32.dll version 5.60 or later (Windows XP or greater)
 extern "C"
 {
 typedef HRESULT (__stdcall *fnSHSetUnreadMailCount)(LPCWSTR pszMailAddress, DWORD dwCount, LPCWSTR pszShellExecuteCommand);
 typedef HRESULT (__stdcall *fnSHEnumerateUnreadMailAccounts)(HKEY hKeyUser, DWORD dwIndex, LPCWSTR pszMailAddress, int cchMailAddress);
--- a/mailnews/base/src/nsMsgBiffManager.cpp
+++ b/mailnews/base/src/nsMsgBiffManager.cpp
@@ -142,18 +142,17 @@ NS_IMETHODIMP nsMsgBiffManager::AddServe
   if (biffMinutes > 0)
   {
     PRInt32 serverIndex = FindServer(server);
     // Only add it if it hasn't been added already.
     if (serverIndex == -1)
     {
       nsBiffEntry biffEntry;
       biffEntry.server = server;
-      nsTime currentTime;
-      rv = SetNextBiffTime(biffEntry, currentTime);
+      rv = SetNextBiffTime(biffEntry, PR_Now());
       if (NS_FAILED(rv))
         return rv;
 
       AddBiffEntry(biffEntry);
       SetupNextBiff();
     }
   }
   return NS_OK;
@@ -224,29 +223,29 @@ nsresult nsMsgBiffManager::AddBiffEntry(
     if (biffEntry.nextBiffTime < mBiffArray[i].nextBiffTime)
       break;
   }
   PR_LOG(MsgBiffLogModule, PR_LOG_ALWAYS, ("inserting biff entry at %d\n", i));
   mBiffArray.InsertElementAt(i, biffEntry);
   return NS_OK;
 }
 
-nsresult nsMsgBiffManager::SetNextBiffTime(nsBiffEntry &biffEntry, const nsTime currentTime)
+nsresult nsMsgBiffManager::SetNextBiffTime(nsBiffEntry &biffEntry, PRTime currentTime)
 {
   nsIMsgIncomingServer *server = biffEntry.server;
   if (!server)
     return NS_ERROR_FAILURE;
 
   PRInt32 biffInterval;
   nsresult rv = server->GetBiffMinutes(&biffInterval);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Add biffInterval, converted in microseconds, to current time.
   // Force 64-bit multiplication.
-  nsTime chosenTimeInterval = biffInterval * 60000000LL;
+  PRTime chosenTimeInterval = biffInterval * 60000000LL;
   biffEntry.nextBiffTime = currentTime + chosenTimeInterval;
 
   // Check if we should jitter.
   nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
   if (prefs)
   {
     PRBool shouldUseBiffJitter = PR_FALSE;
     prefs->GetBoolPref(PREF_BIFF_JITTER, &shouldUseBiffJitter);
@@ -267,32 +266,32 @@ nsresult nsMsgBiffManager::SetNextBiffTi
 }
 
 nsresult nsMsgBiffManager::SetupNextBiff()
 {
   if (mBiffArray.Length() > 0)
   {
     // Get the next biff entry
     const nsBiffEntry &biffEntry = mBiffArray[0];
-    nsTime currentTime;
-    nsInt64 biffDelay;
-    nsInt64 ms(1000);
+    PRTime currentTime = PR_Now();
+    PRInt64 biffDelay;
+    PRInt64 ms(1000);
 
     if (currentTime > biffEntry.nextBiffTime)
     {
       PRInt64 microSecondsPerSecond;
 
       LL_I2L(microSecondsPerSecond, PR_USEC_PER_SEC);
       LL_MUL(biffDelay, 30, microSecondsPerSecond); //let's wait 30 seconds before firing biff again
     }
     else
       biffDelay = biffEntry.nextBiffTime - currentTime;
 
     // Convert biffDelay into milliseconds
-    nsInt64 timeInMS = biffDelay / ms;
+    PRInt64 timeInMS = biffDelay / ms;
     PRUint32 timeInMSUint32 = (PRUint32)timeInMS;
 
     // Can't currently reset a timer when it's in the process of
     // calling Notify. So, just release the timer here and create a new one.
     if (mBiffTimer)
       mBiffTimer->Cancel();
 
     PR_LOG(MsgBiffLogModule, PR_LOG_ALWAYS, ("setting %d timer\n", timeInMSUint32));
@@ -302,17 +301,17 @@ nsresult nsMsgBiffManager::SetupNextBiff
 
   }
   return NS_OK;
 }
 
 //This is the function that does a biff on all of the servers whose time it is to biff.
 nsresult nsMsgBiffManager::PerformBiff()
 {
-  nsTime currentTime;
+  PRTime currentTime = PR_Now();
   nsCOMArray<nsIMsgFolder> targetFolders;
   PR_LOG(MsgBiffLogModule, PR_LOG_ALWAYS, ("performing biffs\n"));
 
   PRUint32 count = mBiffArray.Length();
   for (PRUint32 i = 0; i < count; i++)
   {
     // Take a copy of the entry rather than the a reference so that we can
     // remove and add if necessary, but keep the references and memory alive.
--- a/mailnews/base/src/nsMsgBiffManager.h
+++ b/mailnews/base/src/nsMsgBiffManager.h
@@ -37,24 +37,23 @@
 
 #ifndef NSMSGBIFFMANAGER_H
 #define NSMSGBIFFMANAGER_H
 
 #include "msgCore.h"
 #include "nsIMsgBiffManager.h"
 #include "nsITimer.h"
 #include "nsTArray.h"
-#include "nsTime.h"
 #include "nsCOMPtr.h"
 #include "nsIIncomingServerListener.h"
 #include "nsWeakReference.h"
 
 typedef struct {
 	nsCOMPtr<nsIMsgIncomingServer> server;
-	nsTime nextBiffTime;
+	PRTime nextBiffTime;
 } nsBiffEntry;
 
 
 class nsMsgBiffManager
 	: public nsIMsgBiffManager,
 		public nsIIncomingServerListener,
 		public nsSupportsWeakReference
 {
@@ -65,17 +64,17 @@ public:
 	NS_DECL_ISUPPORTS
 	NS_DECL_NSIMSGBIFFMANAGER
 	NS_DECL_NSIINCOMINGSERVERLISTENER
 
 	nsresult PerformBiff();
 
 protected:
 	PRInt32 FindServer(nsIMsgIncomingServer *server);
-	nsresult SetNextBiffTime(nsBiffEntry &biffEntry, const nsTime currentTime);
+	nsresult SetNextBiffTime(nsBiffEntry &biffEntry, PRTime currentTime);
 	nsresult SetupNextBiff();
 	nsresult AddBiffEntry(nsBiffEntry &biffEntry);
 
 protected:
   nsCOMPtr<nsITimer> mBiffTimer;
   nsTArray<nsBiffEntry> mBiffArray;
   PRBool mHaveShutdown;
   PRBool mInited;
--- a/mailnews/base/src/nsMsgProgress.cpp
+++ b/mailnews/base/src/nsMsgProgress.cpp
@@ -39,17 +39,16 @@
 #include "nsMsgProgress.h"
 
 #include "nsIBaseWindow.h"
 #include "nsISupportsArray.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIComponentManager.h"
 #include "nsNetError.h"
-#include "nsInt64.h"
 #include "nsIWindowWatcher.h"
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsMsgUtils.h"
 
 NS_IMPL_THREADSAFE_ADDREF(nsMsgProgress)
 NS_IMPL_THREADSAFE_RELEASE(nsMsgProgress)
 
@@ -277,18 +276,18 @@ NS_IMETHODIMP nsMsgProgress::GetMsgWindo
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgProgress::OnProgress(nsIRequest *request, nsISupports* ctxt,
                                         PRUint64 aProgress, PRUint64 aProgressMax)
 {
   // XXX: What should the nsIWebProgress be?
   // XXX: This truncates 64-bit to 32-bit
-  return OnProgressChange(nsnull, request, nsUint64(aProgress), nsUint64(aProgressMax),
-                          nsUint64(aProgress) /* current total progress */, nsUint64(aProgressMax) /* max total progress */);
+  return OnProgressChange(nsnull, request, PRInt32(aProgress), PRInt32(aProgressMax),
+                          PRInt32(aProgress) /* current total progress */, PRInt32(aProgressMax) /* max total progress */);
 }
 
 NS_IMETHODIMP nsMsgProgress::OnStatus(nsIRequest *request, nsISupports* ctxt,
                                       nsresult aStatus, const PRUnichar* aStatusArg)
 {
   nsresult rv;
   nsCOMPtr<nsIStringBundleService> sbs = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
--- a/mailnews/base/src/nsMsgPurgeService.cpp
+++ b/mailnews/base/src/nsMsgPurgeService.cpp
@@ -177,17 +177,17 @@ nsresult nsMsgPurgeService::PerformPurge
   if (NS_SUCCEEDED(rv) && allServers)
   {
     PRUint32 numServers;
     rv = allServers->Count(&numServers);
     PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("%d servers", numServers));
     nsCOMPtr<nsIMsgFolder> folderToPurge;
     PRIntervalTime startTime = PR_IntervalNow();
     PRInt32 purgeIntervalToUse;
-    nsTime oldestPurgeTime = 0; // we're going to pick the least-recently purged folder
+    PRTime oldestPurgeTime = 0; // we're going to pick the least-recently purged folder
 
     // apply retention settings to folders that haven't had retention settings
     // applied in mMinDelayBetweenPurges minutes (default 8 hours)
     // Because we get last purge time from the folder cache,
     // this code won't open db's for folders until it decides it needs
     // to apply retention settings, and since nsIMsgFolder::ApplyRetentionSettings
     // will close any db's it opens, this code won't leave db's open.
     for (PRUint32 serverIndex=0; serverIndex < numServers; serverIndex++)
@@ -217,17 +217,17 @@ nsresult nsMsgPurgeService::PerformPurge
           {
             childFolder = do_QueryElementAt(childFolders, index);
             if (childFolder)
             {
               PRUint32 folderFlags;
               (void) childFolder->GetFlags(&folderFlags);
               if (folderFlags & nsMsgFolderFlags::Virtual)
                 continue;
-              nsTime curFolderLastPurgeTime=0;
+              PRTime curFolderLastPurgeTime = 0;
               nsCString curFolderLastPurgeTimeString, curFolderUri;
               rv = childFolder->GetStringProperty("LastPurgeTime", curFolderLastPurgeTimeString);
               if (NS_FAILED(rv))
                 continue; // it is ok to fail, go on to next folder
 
               if (!curFolderLastPurgeTimeString.IsEmpty())
               {
                 PRInt64 theTime;
@@ -236,21 +236,20 @@ nsresult nsMsgPurgeService::PerformPurge
               }
 
               childFolder->GetURI(curFolderUri);
               PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("%s curFolderLastPurgeTime=%s (if blank, then never)", curFolderUri.get(), curFolderLastPurgeTimeString.get()));
 
               // check if this folder is due to purge
               // has to have been purged at least mMinDelayBetweenPurges minutes ago
               // we don't want to purge the folders all the time - once a day is good enough
-              nsInt64 minDelayBetweenPurges(mMinDelayBetweenPurges);
-              nsInt64 microSecondsPerMinute(60000000);
-              nsTime nextPurgeTime = curFolderLastPurgeTime + (minDelayBetweenPurges * microSecondsPerMinute);
-              nsTime currentTime; // nsTime defaults to PR_Now
-              if (nextPurgeTime < currentTime)
+              PRInt64 minDelayBetweenPurges(mMinDelayBetweenPurges);
+              PRInt64 microSecondsPerMinute(60000000);
+              PRTime nextPurgeTime = curFolderLastPurgeTime + (minDelayBetweenPurges * microSecondsPerMinute);
+              if (nextPurgeTime < PR_Now())
               {
                 PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("purging %s", curFolderUri.get()));
                 childFolder->ApplyRetentionSettings();
               }
               PRIntervalTime elapsedTime;
               LL_SUB(elapsedTime, PR_IntervalNow(), startTime);
               // check if more than 500 milliseconds have elapsed in this purge process
               if (PR_IntervalToMilliseconds(elapsedTime) > 500)
@@ -310,17 +309,17 @@ nsresult nsMsgPurgeService::PerformPurge
         // skip this account
         nsCOMPtr<nsIMsgFolder> junkFolder;
         GetExistingFolder(junkFolderURI, getter_AddRefs(junkFolder));
 
         PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] %s exists? %s (if doesn't exist, don't purge)", serverIndex, junkFolderURI.get(), junkFolder ? "true" : "false"));
         if (!junkFolder)
           continue;
 
-        nsTime curJunkFolderLastPurgeTime=0;
+        PRTime curJunkFolderLastPurgeTime = 0;
         nsCString curJunkFolderLastPurgeTimeString;
         rv = junkFolder->GetStringProperty("curJunkFolderLastPurgeTime", curJunkFolderLastPurgeTimeString);
         if (NS_FAILED(rv))
           continue; // it is ok to fail, junk folder may not exist
 
         if (!curJunkFolderLastPurgeTimeString.IsEmpty())
         {
           PRInt64 theTime;
@@ -328,19 +327,18 @@ nsresult nsMsgPurgeService::PerformPurge
           curJunkFolderLastPurgeTime = theTime;
         }
 
         PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] %s curJunkFolderLastPurgeTime=%s (if blank, then never)", serverIndex, junkFolderURI.get(), curJunkFolderLastPurgeTimeString.get()));
 
         // check if this account is due to purge
         // has to have been purged at least mMinDelayBetweenPurges minutes ago
         // we don't want to purge the folders all the time
-        nsTime nextPurgeTime = curJunkFolderLastPurgeTime + nsInt64(mMinDelayBetweenPurges * 60000000 /* convert mMinDelayBetweenPurges to into microseconds */);
-        nsTime currentTime;
-        if (nextPurgeTime < currentTime)
+        PRTime nextPurgeTime = curJunkFolderLastPurgeTime + mMinDelayBetweenPurges * 60000000 /* convert mMinDelayBetweenPurges to into microseconds */;
+        if (nextPurgeTime < PR_Now())
         {
           PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] last purge greater than min delay", serverIndex));
 
           nsCOMPtr <nsIMsgIncomingServer> junkFolderServer;
           rv = junkFolder->GetServer(getter_AddRefs(junkFolderServer));
           NS_ENSURE_SUCCESS(rv,rv);
 
           PRBool serverBusy = PR_FALSE;
@@ -358,24 +356,24 @@ nsresult nsMsgPurgeService::PerformPurge
           PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] (server busy? %s)", serverIndex, serverBusy ? "true" : "false"));
           PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] (serverRequiresPassword? %s)", serverIndex, serverRequiresPassword ? "true" : "false"));
           PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] (passwordPromptRequired? %s)", serverIndex, passwordPromptRequired ? "true" : "false"));
           if (canSearchMessages && !mSearchSession && !serverBusy && (!serverRequiresPassword || !passwordPromptRequired))
           {
             PRInt32 purgeInterval;
             spamSettings->GetPurgeInterval(&purgeInterval);
 
-            if ((oldestPurgeTime == nsInt64(0)) || (curJunkFolderLastPurgeTime < oldestPurgeTime))
+            if ((oldestPurgeTime == 0) || (curJunkFolderLastPurgeTime < oldestPurgeTime))
             {
               PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] purging! searching for messages older than %d days", serverIndex, purgeInterval));
               oldestPurgeTime = curJunkFolderLastPurgeTime;
               purgeIntervalToUse = purgeInterval;
               folderToPurge = junkFolder;
               // if we've never purged this folder, do it...
-              if (curJunkFolderLastPurgeTime == nsInt64(0))
+              if (curJunkFolderLastPurgeTime == 0)
                 break;
             }
           }
           else {
             NS_ASSERTION(canSearchMessages, "unexpected, you should be able to search");
             PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] not a good time for this server, try again later", serverIndex));
           }
         }
--- a/mailnews/base/src/nsMsgPurgeService.h
+++ b/mailnews/base/src/nsMsgPurgeService.h
@@ -40,17 +40,16 @@
 #ifndef NSMSGPURGESERVICE_H
 #define NSMSGPURGESERVICE_H
 
 #include "msgCore.h"
 #include "nsIMsgPurgeService.h"
 #include "nsIMsgSearchSession.h"
 #include "nsITimer.h"
 #include "nsVoidArray.h"
-#include "nsTime.h"
 #include "nsCOMPtr.h"
 #include "nsIMsgSearchNotify.h"
 #include "nsIMsgFolder.h"
 #include "nsIMsgFolderCache.h"
 #include "nsIMsgFolderCacheElement.h"
 #include "nsIMutableArray.h"
 
 class nsMsgPurgeService
--- a/mailnews/base/src/nsMsgStatusFeedback.cpp
+++ b/mailnews/base/src/nsMsgStatusFeedback.cpp
@@ -42,17 +42,16 @@
 #include "nsMsgStatusFeedback.h"
 #include "nsIDocumentViewer.h"
 #include "nsIDocument.h"
 #include "nsIDOMElement.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIChannel.h"
 #include "prinrval.h"
-#include "nsInt64.h"
 #include "nsITimelineService.h"
 #include "nsIMsgMailNewsUrl.h"
 #include "nsIMimeMiscStatus.h"
 #include "nsIMsgWindow.h"
 #include "nsMsgUtils.h"
 #include "nsIMsgHdr.h"
 #include "nsIMsgFolder.h"
 #include "nsServiceManagerUtils.h"
@@ -302,18 +301,18 @@ NS_IMETHODIMP nsMsgStatusFeedback::SetWr
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgStatusFeedback::OnProgress(nsIRequest *request, nsISupports* ctxt, 
                                           PRUint64 aProgress, PRUint64 aProgressMax)
 {
   // XXX: What should the nsIWebProgress be?
   // XXX: this truncates 64-bit to 32-bit
-  return OnProgressChange(nsnull, request, nsUint64(aProgress), nsUint64(aProgressMax), 
-                          nsUint64(aProgress) /* current total progress */, nsUint64(aProgressMax) /* max total progress */);
+  return OnProgressChange(nsnull, request, PRInt32(aProgress), PRInt32(aProgressMax), 
+                          PRInt32(aProgress) /* current total progress */, PRInt32(aProgressMax) /* max total progress */);
 }
 
 NS_IMETHODIMP nsMsgStatusFeedback::OnStatus(nsIRequest *request, nsISupports* ctxt, 
                                             nsresult aStatus, const PRUnichar* aStatusArg)
 {
   nsresult rv;
   nsCOMPtr<nsIStringBundleService> sbs = do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
--- a/mailnews/base/util/nsMsgDBFolder.cpp
+++ b/mailnews/base/util/nsMsgDBFolder.cpp
@@ -67,17 +67,16 @@
 #include "nsIAbCard.h"
 #include "nsIAbDirectory.h"
 #include "nsISpamSettings.h"
 #include "nsIMsgFilterPlugin.h"
 #include "nsIMsgMailSession.h"
 #include "nsIRDFService.h"
 #include "nsTextFormatter.h"
 #include "nsMsgDBCID.h"
-#include "nsInt64.h"
 #include "nsReadLine.h"
 #include "nsParserCIID.h"
 #include "nsIParser.h"
 #include "nsIHTMLContentSink.h"
 #include "nsIContentSerializer.h"
 #include "nsLayoutCID.h"
 #include "nsIHTMLToTextSink.h"
 #include "nsIDocumentEncoder.h"
--- a/mailnews/base/util/nsMsgFileStream.cpp
+++ b/mailnews/base/util/nsMsgFileStream.cpp
@@ -1,11 +1,10 @@
 #include "nsILocalFile.h"
 #include "nsMsgFileStream.h"
-#include "nsInt64.h"
 #include "prerr.h"
 #include "prerror.h"
 
 /* From nsDebugImpl.cpp: */
 static nsresult
 ErrorAccordingToNSPR()
 {
     PRErrorCode err = PR_GetError();
@@ -47,31 +46,31 @@ nsresult nsMsgFileStream::InitWithFile(n
 }
 
 NS_IMETHODIMP
 nsMsgFileStream::Seek(PRInt32 whence, PRInt64 offset)
 {
   if (mFileDesc == nsnull)
     return NS_BASE_STREAM_CLOSED;
   
-  nsInt64 cnt = PR_Seek64(mFileDesc, offset, (PRSeekWhence)whence);
-  if (cnt == nsInt64(-1)) {
+  PRInt64 cnt = PR_Seek64(mFileDesc, offset, (PRSeekWhence)whence);
+  if (cnt == PRInt64(-1)) {
     return ErrorAccordingToNSPR();
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgFileStream::Tell(PRInt64 *result)
 {
   if (mFileDesc == nsnull)
     return NS_BASE_STREAM_CLOSED;
   
-  nsInt64 cnt = PR_Seek64(mFileDesc, 0, PR_SEEK_CUR);
-  if (cnt == nsInt64(-1)) {
+  PRInt64 cnt = PR_Seek64(mFileDesc, 0, PR_SEEK_CUR);
+  if (cnt == PRInt64(-1)) {
     return ErrorAccordingToNSPR();
   }
   *result = cnt;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgFileStream::SetEOF()
--- a/mailnews/base/util/nsMsgProtocol.cpp
+++ b/mailnews/base/util/nsMsgProtocol.cpp
@@ -294,18 +294,18 @@ nsresult nsMsgProtocol::OpenFileSocket(n
   rv = NS_NewLocalFileInputStream(getter_AddRefs(stream), file);
   if (NS_FAILED(rv)) return rv;
 
   // create input stream transport
   nsCOMPtr<nsIStreamTransportService> sts =
       do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv);
   if (NS_FAILED(rv)) return rv;
 
-  rv = sts->CreateInputTransport(stream, nsInt64(aStartPosition),
-                                 nsInt64(aReadCount), PR_TRUE,
+  rv = sts->CreateInputTransport(stream, PRInt64(aStartPosition),
+                                 PRInt64(aReadCount), PR_TRUE,
                                  getter_AddRefs(m_transport));
 
   m_socketIsOpen = PR_FALSE;
   return rv;
 }
 
 nsresult nsMsgProtocol::GetTopmostMsgWindow(nsIMsgWindow **aWindow)
 {
--- a/mailnews/db/msgdb/src/nsMsgDatabase.cpp
+++ b/mailnews/db/msgdb/src/nsMsgDatabase.cpp
@@ -53,17 +53,16 @@
 #include "nsMsgThread.h"
 #include "nsIMsgSearchTerm.h"
 #include "nsIMsgHeaderParser.h"
 #include "nsMsgBaseCID.h"
 #include "nsMorkCID.h"
 #include "nsIMdbFactoryFactory.h"
 #include "prlog.h"
 #include "prprf.h"
-#include "nsTime.h"
 #include "nsMsgDBCID.h"
 #include "nsILocale.h"
 #include "nsLocaleCID.h"
 #include "nsMsgMimeCID.h"
 #include "nsILocaleService.h"
 #include "nsMsgFolderFlags.h"
 #include "nsIMsgAccountManager.h"
 #include "nsIMsgFolderCache.h"
@@ -2638,32 +2637,28 @@ NS_IMETHODIMP nsMsgDatabase::MarkReadByD
   nsMsgHdr  *pHeader;
   PRInt32 numChanged = 0;
 
   nsISimpleEnumerator* hdrs;
   rv = EnumerateMessages(&hdrs);
   if (NS_FAILED(rv))
     return rv;
 
-  nsTime t_startDate(startDate);
-  nsTime t_endDate(endDate);
-
   PRBool hasMore = PR_FALSE;
 
   while (NS_SUCCEEDED(rv = hdrs->HasMoreElements(&hasMore)) && hasMore)
   {
     rv = hdrs->GetNext((nsISupports**)&pHeader);
     NS_ASSERTION(NS_SUCCEEDED(rv), "nsMsgDBEnumerator broken");
     if (NS_FAILED(rv)) break;
 
     PRTime headerDate;
     (void)pHeader->GetDate(&headerDate);
-    nsTime t_headerDate(headerDate);
-
-    if (t_headerDate > t_startDate && t_headerDate <= t_endDate)
+
+    if (headerDate > startDate && headerDate <= endDate)
     {
       PRBool isRead;
       nsMsgKey key;
       (void)pHeader->GetMessageKey(&key);
       IsRead(key, &isRead);
       if (!isRead)
       {
         numChanged++;
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -104,17 +104,16 @@
 #include "nsIWebNavigation.h"
 #include "nsNetUtil.h"
 #include "nsIMAPNamespace.h"
 #include "nsIMsgFolderCompactor.h"
 #include "nsMsgMessageFlags.h"
 #include "nsIMimeHeaders.h"
 #include "nsIMsgMdnGenerator.h"
 #include "nsISpamSettings.h"
-#include "nsInt64.h"
 #include <time.h>
 #include "nsIMsgMailNewsUrl.h"
 #include "nsEmbedCID.h"
 #include "nsIMsgComposeService.h"
 #include "nsMsgCompCID.h"
 #include "nsICacheEntryDescriptor.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsIMsgIdentity.h"
--- a/mailnews/imap/src/nsImapService.cpp
+++ b/mailnews/imap/src/nsImapService.cpp
@@ -95,17 +95,16 @@
 #include "nsIPrompt.h"
 #include "nsIWindowWatcher.h"
 #include "nsImapProtocol.h"
 #include "nsIMsgMailSession.h"
 #include "nsIStreamConverterService.h"
 #include "nsIAutoSyncManager.h"
 #include "nsThreadUtils.h"
 #include "nsNetUtil.h"
-#include "nsInt64.h"
 #include "nsMsgMessageFlags.h"
 
 #define PREF_MAIL_ROOT_IMAP "mail.root.imap"            // old - for backward compatibility only
 #define PREF_MAIL_ROOT_IMAP_REL "mail.root.imap-rel"
 
 static NS_DEFINE_CID(kImapUrlCID, NS_IMAPURL_CID);
 static NS_DEFINE_CID(kCImapMockChannel, NS_IMAPMOCKCHANNEL_CID);
 static NS_DEFINE_CID(kCacheServiceCID, NS_CACHESERVICE_CID);
--- a/mailnews/local/src/nsLocalMailFolder.cpp
+++ b/mailnews/local/src/nsLocalMailFolder.cpp
@@ -3923,19 +3923,18 @@ nsMsgLocalMailFolder::WarnIfLocalFileToo
   *aTooBig = PR_FALSE;
   PRInt64 sizeOnDisk;
   nsCOMPtr <nsILocalFile> filePath;
   nsresult rv = GetFilePath(getter_AddRefs(filePath));
   NS_ENSURE_SUCCESS(rv, rv);
   rv = filePath->GetFileSize(&sizeOnDisk);
   if (NS_SUCCEEDED(rv))
   {
-    const nsInt64 kMaxFolderSize = 0xFFF00000;
-    nsInt64 folderSize(sizeOnDisk);
-    if (folderSize > kMaxFolderSize)
+    const PRInt64 kMaxFolderSize = 0xFFF00000;
+    if (sizeOnDisk > kMaxFolderSize)
     {
       ThrowAlertMsg("mailboxTooLarge", aWindow);
       *aTooBig = PR_TRUE;
     }
   }
   else
   {
       // We are failing to obtain the size in the first place!
--- a/mailnews/local/src/nsMailboxProtocol.cpp
+++ b/mailnews/local/src/nsMailboxProtocol.cpp
@@ -102,18 +102,18 @@ nsresult nsMailboxProtocol::OpenMultiple
 {
   nsresult rv;
 
   nsCOMPtr<nsIStreamTransportService> serv =
       do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // XXX 64-bit
-  rv = serv->CreateInputTransport(m_multipleMsgMoveCopyStream, nsInt64(offset),
-                                  nsInt64(size), PR_FALSE,
+  rv = serv->CreateInputTransport(m_multipleMsgMoveCopyStream, PRInt64(offset),
+                                  PRInt64(size), PR_FALSE,
                                   getter_AddRefs(m_transport));
 
   return rv;
 }
 
 nsresult nsMailboxProtocol::OpenFileSocketForReuse(nsIURI * aURL, PRUint32 aStartPosition, PRInt32 aReadCount)
 {
   NS_ENSURE_ARG_POINTER(aURL);
--- a/mailnews/local/src/nsParseMailbox.cpp
+++ b/mailnews/local/src/nsParseMailbox.cpp
@@ -113,18 +113,17 @@ NS_IMETHODIMP nsMsgMailboxParser::OnData
     nsCOMPtr<nsIURI> url = do_QueryInterface(ctxt, &rv);
     if (NS_SUCCEEDED(rv))
         rv = ProcessMailboxInputStream(url, aIStream, aLength);
     return rv;
 }
 
 NS_IMETHODIMP nsMsgMailboxParser::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
 {
-    nsTime currentTime;
-    m_startTime = currentTime;
+    m_startTime = PR_Now();
 
 
     // extract the appropriate event sinks from the url and initialize them in our protocol data
     // the URL should be queried for a nsIMailboxURL. If it doesn't support a mailbox URL interface then
     // we have an error.
     nsresult rv = NS_OK;
 
     nsCOMPtr<nsIIOService> ioServ(do_GetService(NS_IOSERVICE_CONTRACTID, &rv));
--- a/mailnews/local/src/nsParseMailbox.h
+++ b/mailnews/local/src/nsParseMailbox.h
@@ -44,17 +44,16 @@
 #include "nsIStreamListener.h"
 #include "nsMsgLineBuffer.h"
 #include "nsIMsgHeaderParser.h"
 #include "nsIMsgDatabase.h"
 #include "nsIMsgHdr.h"
 #include "nsIMsgStatusFeedback.h"
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
-#include "nsTime.h"
 #include "nsIDBChangeListener.h"
 #include "nsIWeakReference.h"
 #include "nsIWeakReferenceUtils.h"
 #include "nsIMsgWindow.h"
 #include "nsImapMoveCoalescer.h"
 #include "nsAutoPtr.h"
 
 #include "nsIMsgFilterList.h"
@@ -214,17 +213,17 @@ protected:
   nsString        m_folderName;
   nsCString       m_inboxUri;
   nsByteArray     m_inputStream;
   PRInt32         m_obuffer_size;
   char            *m_obuffer;
   PRUint32        m_graph_progress_total;
   PRUint32        m_graph_progress_received;
   PRBool          m_parsingDone;
-  nsTime          m_startTime;
+  PRTime          m_startTime;
 private:
   // the following flag is used to determine when a url is currently being run. It is cleared on calls
   // to ::StopBinding and it is set whenever we call Load on a url
   PRBool    m_urlInProgress;
   nsWeakPtr m_folder;
   void Init();
   void ReleaseFolderLock();
 
--- a/mailnews/local/src/nsPop3Protocol.cpp
+++ b/mailnews/local/src/nsPop3Protocol.cpp
@@ -689,17 +689,17 @@ void nsPop3Protocol::UpdateStatusWithStr
         NS_ASSERTION(NS_SUCCEEDED(rv), "dropping error result");
     }
 }
 
 void nsPop3Protocol::UpdateProgressPercent (PRUint32 totalDone, PRUint32 total)
 {
   // XXX 64-bit
   if (mProgressEventSink)
-    mProgressEventSink->OnProgress(this, m_channelContext, nsUint64(totalDone), nsUint64(total));
+    mProgressEventSink->OnProgress(this, m_channelContext, PRUint64(totalDone), PRUint64(total));
 }
 
 // note:  SetUsername() expects an unescaped string
 // do not pass in an escaped string
 void nsPop3Protocol::SetUsername(const char* name)
 {
   NS_ASSERTION(name, "no name specified!");
     if (name)
--- a/mailnews/local/src/nsPop3Service.cpp
+++ b/mailnews/local/src/nsPop3Service.cpp
@@ -56,17 +56,16 @@
 #include "nsIDirectoryService.h"
 #include "nsMailDirServiceDefs.h"
 #include "prprf.h"
 #include "nsMsgUtils.h"
 #include "nsIMsgAccountManager.h"
 #include "nsIMsgAccount.h"
 #include "nsLocalMailFolder.h"
 #include "nsIMailboxUrl.h"
-#include "nsInt64.h"
 #include "nsIPrompt.h"
 #include "nsLocalStrings.h"
 #include "nsINetUtil.h"
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
 
 #define PREF_MAIL_ROOT_POP3 "mail.root.pop3"        // old - for backward compatibility only
 #define PREF_MAIL_ROOT_POP3_REL "mail.root.pop3-rel"
--- a/mailnews/news/src/nsNNTPProtocol.cpp
+++ b/mailnews/news/src/nsNNTPProtocol.cpp
@@ -5140,18 +5140,18 @@ nsresult nsNNTPProtocol::CloseSocket()
   CleanupAfterRunningUrl(); // is this needed?
   return nsMsgProtocol::CloseSocket();
 }
 
 void nsNNTPProtocol::SetProgressBarPercent(PRUint32 aProgress, PRUint32 aProgressMax)
 {
   // XXX 64-bit
   if (mProgressEventSink)
-    mProgressEventSink->OnProgress(this, m_channelContext, nsUint64(aProgress),
-                                   nsUint64(aProgressMax));
+    mProgressEventSink->OnProgress(this, m_channelContext, PRUint64(aProgress),
+                                   PRUint64(aProgressMax));
 }
 
 nsresult
 nsNNTPProtocol::SetProgressStatus(const PRUnichar *aMessage)
 {
   nsresult rv = NS_OK;
   if (mProgressEventSink)
     rv = mProgressEventSink->OnStatus(this, m_channelContext, NS_OK, aMessage);
--- a/mailnews/news/src/nsNntpIncomingServer.cpp
+++ b/mailnews/news/src/nsNntpIncomingServer.cpp
@@ -46,17 +46,16 @@
 #include "nsILocalFile.h"
 #include "nsCOMPtr.h"
 #include "nsINntpService.h"
 #include "nsINNTPProtocol.h"
 #include "nsMsgNewsCID.h"
 #include "nsNNTPProtocol.h"
 #include "nsIDirectoryService.h"
 #include "nsMailDirServiceDefs.h"
-#include "nsInt64.h"
 #include "nsMsgUtils.h"
 #include "nsIPrompt.h"
 #include "nsIStringBundle.h"
 #include "nntpCore.h"
 #include "nsIWindowWatcher.h"
 #include "nsITreeColumns.h"
 #include "nsIDOMElement.h"
 #include "nsMsgFolderFlags.h"
@@ -275,17 +274,17 @@ nsNntpIncomingServer::GetNewsrcRootPath(
 /* static */ void nsNntpIncomingServer::OnNewsrcSaveTimer(nsITimer *timer, void *voidIncomingServer)
 {
   nsNntpIncomingServer *incomingServer = (nsNntpIncomingServer*)voidIncomingServer;
   incomingServer->WriteNewsrcFile();
 }
 
 nsresult nsNntpIncomingServer::SetupNewsrcSaveTimer()
 {
-  nsInt64 ms(300000);   // hard code, 5 minutes.
+  PRInt64 ms(300000);   // hard code, 5 minutes.
   //Convert biffDelay into milliseconds
   PRUint32 timeInMSUint32 = (PRUint32)ms;
   //Can't currently reset a timer when it's in the process of
   //calling Notify. So, just release the timer here and create a new one.
   if(mNewsrcSaveTimer)
     mNewsrcSaveTimer->Cancel();
   mNewsrcSaveTimer = do_CreateInstance("@mozilla.org/timer;1");
   mNewsrcSaveTimer->InitWithFuncCallback(OnNewsrcSaveTimer, (void*)this, timeInMSUint32,