Bug 784912 - nsIStreamListener.onDataAvailable should handle 64-bit offset. r=standard8
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Thu, 06 Sep 2012 11:47:38 +0900
changeset 12246 4618a55d24457657d13ddc7b56b0271ba475e39c
parent 12245 9fcf8235df70a8bb8b09b4da814ffa81f97c2ad8
child 12247 655ce139a246dc9fd785dae3017cb7c41c88c69b
push id738
push userbugzilla@standard8.plus.com
push dateMon, 08 Oct 2012 19:38:39 +0000
treeherdercomm-aurora@6694e4ec3767 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstandard8
bugs784912
Bug 784912 - nsIStreamListener.onDataAvailable should handle 64-bit offset. r=standard8
mailnews/base/src/nsCopyMessageStreamListener.cpp
mailnews/base/src/nsMessenger.cpp
mailnews/base/src/nsMsgFolderCompactor.cpp
mailnews/base/src/nsMsgFolderCompactor.h
mailnews/base/util/nsMsgMailNewsUrl.cpp
mailnews/base/util/nsMsgProtocol.cpp
mailnews/base/util/nsMsgProtocol.h
mailnews/compose/src/nsMsgCompose.cpp
mailnews/compose/src/nsMsgComposeService.cpp
mailnews/compose/src/nsMsgSendLater.cpp
mailnews/compose/src/nsSmtpProtocol.cpp
mailnews/compose/src/nsSmtpProtocol.h
mailnews/compose/src/nsURLFetcher.cpp
mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp
mailnews/imap/src/nsImapProtocol.cpp
mailnews/imap/src/nsImapProtocol.h
mailnews/imap/src/nsSyncRunnableHelpers.cpp
mailnews/local/src/nsMailboxProtocol.cpp
mailnews/local/src/nsMailboxProtocol.h
mailnews/local/src/nsParseMailbox.cpp
mailnews/local/src/nsPop3Protocol.cpp
mailnews/local/src/nsPop3Protocol.h
mailnews/mime/cthandlers/pgpmime/nsPgpMimeProxy.cpp
mailnews/mime/src/nsStreamConverter.cpp
mailnews/news/src/nsNNTPProtocol.cpp
mailnews/news/src/nsNNTPProtocol.h
--- a/mailnews/base/src/nsCopyMessageStreamListener.cpp
+++ b/mailnews/base/src/nsCopyMessageStreamListener.cpp
@@ -82,17 +82,17 @@ NS_IMETHODIMP nsCopyMessageStreamListene
 {
 	if (mDestination)
 		mDestination->EndMessage(key);
 
 	return NS_OK;
 }
 
 
-NS_IMETHODIMP nsCopyMessageStreamListener::OnDataAvailable(nsIRequest * /* request */, nsISupports *ctxt, nsIInputStream *aIStream, uint32_t sourceOffset, uint32_t aLength)
+NS_IMETHODIMP nsCopyMessageStreamListener::OnDataAvailable(nsIRequest * /* request */, nsISupports *ctxt, nsIInputStream *aIStream, uint64_t sourceOffset, uint32_t aLength)
 {
 	nsresult rv;
 	rv = mDestination->CopyData(aIStream, aLength);
 	return rv;
 }
 
 NS_IMETHODIMP nsCopyMessageStreamListener::OnStartRequest(nsIRequest * request, nsISupports *ctxt)
 {
--- a/mailnews/base/src/nsMessenger.cpp
+++ b/mailnews/base/src/nsMessenger.cpp
@@ -1884,17 +1884,17 @@ nsSaveMsgListener::OnStopRequest(nsIRequ
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSaveMsgListener::OnDataAvailable(nsIRequest* request,
                                   nsISupports* aSupport,
                                   nsIInputStream* inStream,
-                                  uint32_t srcOffset,
+                                  uint64_t srcOffset,
                                   uint32_t count)
 {
   nsresult rv = NS_ERROR_FAILURE;
   // first, check to see if we've been canceled....
   if (mCanceled) // then go cancel our underlying channel too
     return request->Cancel(NS_BINDING_ABORTED);
   
   if (!mInitialized)
@@ -2568,17 +2568,17 @@ nsDelAttachListener::OnStopRequest(nsIRe
 }
 
 //
 // nsIStreamListener
 //
 
 NS_IMETHODIMP
 nsDelAttachListener::OnDataAvailable(nsIRequest * aRequest, nsISupports * aSupport,
-                                     nsIInputStream * aInStream, uint32_t aSrcOffset,
+                                     nsIInputStream * aInStream, uint64_t aSrcOffset,
                                      uint32_t aCount)
 {
   if (!mMsgFileStream)
     return NS_ERROR_NULL_POINTER;
   return mMessageFolder->CopyDataToOutputStreamForAppend(aInStream, aCount, mMsgFileStream);
 }
 
 //
--- a/mailnews/base/src/nsMsgFolderCompactor.cpp
+++ b/mailnews/base/src/nsMsgFolderCompactor.cpp
@@ -613,17 +613,17 @@ nsFolderCompactState::OnStopRequest(nsIR
   }
   Release(); // kill self
   return status;
 }
 
 NS_IMETHODIMP
 nsFolderCompactState::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
                                       nsIInputStream *inStr,
-                                      uint32_t sourceOffset, uint32_t count)
+                                      uint64_t sourceOffset, uint32_t count)
 {
   if (!m_fileStream || !inStr) 
     return NS_ERROR_FAILURE;
 
   nsresult rv = NS_OK;
   uint32_t msgFlags;
   bool checkForKeyword = m_startOfMsg;
   bool addKeywordHdr = false;
@@ -1144,17 +1144,17 @@ nsresult nsOfflineStoreCompactState::Sta
   ReleaseFolderLock();
   FinishCompact();
   return rv;
 }
 
 NS_IMETHODIMP
 nsOfflineStoreCompactState::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
                                             nsIInputStream *inStr,
-                                            uint32_t sourceOffset, uint32_t count)
+                                            uint64_t sourceOffset, uint32_t count)
 {
   if (!m_fileStream || !inStr) 
     return NS_ERROR_FAILURE;
 
   nsresult rv = NS_OK;
 
   if (m_startOfMsg)
   {
--- a/mailnews/base/src/nsMsgFolderCompactor.h
+++ b/mailnews/base/src/nsMsgFolderCompactor.h
@@ -91,17 +91,17 @@ class nsOfflineStoreCompactState : publi
 public:
 
   nsOfflineStoreCompactState(void);
   virtual ~nsOfflineStoreCompactState(void);
   NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *ctxt,
                                     nsresult status);
   NS_IMETHODIMP OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
                                 nsIInputStream *inStr,
-                                uint32_t sourceOffset, uint32_t count);
+                                uint64_t sourceOffset, uint32_t count);
 
 protected:
     nsresult         CopyNextMessage(bool &done);
     virtual nsresult InitDB(nsIMsgDatabase *db);
     virtual nsresult StartCompacting();
     virtual nsresult FinishCompact();
 
     uint32_t m_offlineMsgSize;
--- a/mailnews/base/util/nsMsgMailNewsUrl.cpp
+++ b/mailnews/base/util/nsMsgMailNewsUrl.cpp
@@ -815,17 +815,17 @@ nsMsgSaveAsListener::OnStopRequest(nsIRe
     m_outputStream->Close();
   }
   return NS_OK;
 } 
 
 NS_IMETHODIMP nsMsgSaveAsListener::OnDataAvailable(nsIRequest* request, 
                                   nsISupports* aSupport,
                                   nsIInputStream* inStream, 
-                                  uint32_t srcOffset,
+                                  uint64_t srcOffset,
                                   uint32_t count)
 {
   nsresult rv;
   uint64_t available;
   rv = inStream->Available(&available);
   if (!m_writtenData)
   {
     m_writtenData = true;
--- a/mailnews/base/util/nsMsgProtocol.cpp
+++ b/mailnews/base/util/nsMsgProtocol.cpp
@@ -345,17 +345,17 @@ nsresult nsMsgProtocol::SendData(const c
     return m_outputStream->Write(dataBuffer, PL_strlen(dataBuffer), &writeCount);
     // TODO make sure all the bytes in PL_strlen(dataBuffer) were written
   else
     return NS_ERROR_INVALID_ARG;
 }
 
 // Whenever data arrives from the connection, core netlib notifices the protocol by calling
 // OnDataAvailable. We then read and process the incoming data from the input stream.
-NS_IMETHODIMP nsMsgProtocol::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *inStr, uint32_t sourceOffset, uint32_t count)
+NS_IMETHODIMP nsMsgProtocol::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *inStr, uint64_t sourceOffset, uint32_t count)
 {
   // right now, this really just means turn around and churn through the state machine
   nsCOMPtr<nsIURI> uri = do_QueryInterface(ctxt);
   return ProcessProtocolState(uri, inStr, sourceOffset, count);
 }
 
 NS_IMETHODIMP nsMsgProtocol::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
 {
@@ -1165,17 +1165,17 @@ NS_IMETHODIMP nsMsgFilePostHelper::OnSto
   if (!mSuspendedPostFileRead)
     protInst->PostDataFinished();
 
   mSuspendedPostFileRead = false;
   protInst->mFilePostHelper = nullptr;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsMsgFilePostHelper::OnDataAvailable(nsIRequest * /* aChannel */, nsISupports *ctxt, nsIInputStream *inStr, uint32_t sourceOffset, uint32_t count)
+NS_IMETHODIMP nsMsgFilePostHelper::OnDataAvailable(nsIRequest * /* aChannel */, nsISupports *ctxt, nsIInputStream *inStr, uint64_t sourceOffset, uint32_t count)
 {
   nsMsgAsyncWriteProtocol *protInst = nullptr;
   nsCOMPtr<nsIStreamListener> callback = do_QueryReferent(mProtInstance);
   if (!callback)
     return NS_OK;
 
   protInst = static_cast<nsMsgAsyncWriteProtocol *>(callback.get());
 
--- a/mailnews/base/util/nsMsgProtocol.h
+++ b/mailnews/base/util/nsMsgProtocol.h
@@ -105,17 +105,17 @@ protected:
   virtual nsresult CloseSocket(); 
 
   virtual nsresult SetupTransportState(); // private method used by OpenNetworkSocket and OpenFileSocket
 
   // ProcessProtocolState - This is the function that gets churned by calls to OnDataAvailable. 
   // As data arrives on the socket, OnDataAvailable calls ProcessProtocolState.
   
   virtual nsresult ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream, 
-                  uint32_t sourceOffset, uint32_t length) = 0;
+                                        uint64_t sourceOffset, uint32_t length) = 0;
 
   // SendData -- Writes the data contained in dataBuffer into the current output stream. 
   // It also informs the transport layer that this data is now available for transmission.
   // Returns a positive number for success, 0 for failure (not all the bytes were written to the
   // stream, etc). 
     // aSuppressLogging is a hint that sensitive data is being sent and should not be logged
   virtual nsresult SendData(const char * dataBuffer, bool aSuppressLogging = false);
 
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -2930,17 +2930,17 @@ NS_IMETHODIMP QuotingOutputStreamListene
     if (mQuoteOriginal)
       compose->NotifyStateListeners(nsIMsgComposeNotificationType::ComposeBodyReady, NS_OK);
   }
   return rv;
 }
 
 NS_IMETHODIMP QuotingOutputStreamListener::OnDataAvailable(nsIRequest *request,
                               nsISupports *ctxt, nsIInputStream *inStr,
-                              uint32_t sourceOffset, uint32_t count)
+                              uint64_t sourceOffset, uint32_t count)
 {
   nsresult rv = NS_OK;
   NS_ENSURE_ARG(inStr);
 
   if (mHeadersOnly)
     return rv;
 
   char *newBuf = (char *)PR_Malloc(count + 1);
--- a/mailnews/compose/src/nsMsgComposeService.cpp
+++ b/mailnews/compose/src/nsMsgComposeService.cpp
@@ -1009,17 +1009,17 @@ nsMsgTemplateReplyHelper::OnStopRequest(
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgTemplateReplyHelper::OnDataAvailable(nsIRequest* request,
                                   nsISupports* aSupport,
                                   nsIInputStream* inStream,
-                                  uint32_t srcOffset,
+                                  uint64_t srcOffset,
                                   uint32_t count)
 {
   nsresult rv = NS_OK;
 
   char readBuf[1024];
 
   uint64_t available;
   uint32_t readCount;
--- a/mailnews/compose/src/nsMsgSendLater.cpp
+++ b/mailnews/compose/src/nsMsgSendLater.cpp
@@ -314,17 +314,17 @@ nsMsgSendLater::BuildNewBuffer(const cha
 
   memcpy(mLeftoverBuffer + leftoverSize, aBuf, aCount);
   *totalBufSize = aCount + leftoverSize;
   return NS_OK;
 }
 
 // Got data?
 NS_IMETHODIMP
-nsMsgSendLater::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *inStr, uint32_t sourceOffset, uint32_t count)
+nsMsgSendLater::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *inStr, uint64_t sourceOffset, uint32_t count)
 {
   NS_ENSURE_ARG_POINTER(inStr);
 
   // This is a little bit tricky since we have to chop random 
   // buffers into lines and deliver the lines...plus keeping the
   // leftovers for next time...some fun, eh?
   //
   nsresult    rv = NS_OK;
--- a/mailnews/compose/src/nsSmtpProtocol.cpp
+++ b/mailnews/compose/src/nsSmtpProtocol.cpp
@@ -1760,18 +1760,18 @@ nsresult nsSmtpProtocol::LoadUrl(nsIURI 
   return nsMsgProtocol::LoadUrl(aURL, aConsumer);
 }
 
 /*
  * returns negative if the transfer is finished or error'd out
  *
  * returns zero or more if the transfer needs to be continued.
  */
- nsresult nsSmtpProtocol::ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream,
-   uint32_t sourceOffset, uint32_t length)
+nsresult nsSmtpProtocol::ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream,
+                                              uint64_t sourceOffset, uint32_t length)
  {
    nsresult status = NS_OK;
    ClearFlag(SMTP_PAUSE_FOR_READ); /* already paused; reset */
 
    while(!TestFlag(SMTP_PAUSE_FOR_READ))
    {
      PR_LOG(SMTPLogModule, PR_LOG_ALWAYS, ("SMTP entering state: %d",
        m_nextState));
--- a/mailnews/compose/src/nsSmtpProtocol.h
+++ b/mailnews/compose/src/nsSmtpProtocol.h
@@ -142,17 +142,17 @@ private:
     char *m_dataBuf;
     uint32_t m_dataBufSize;
 
     int32_t   m_originalContentLength; /* the content length at the time of calling graph progress */
 
     // initialization function given a new url and transport layer
     void Initialize(nsIURI * aURL);
     virtual nsresult ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream, 
-                                          uint32_t sourceOffset, uint32_t length);
+                                          uint64_t sourceOffset, uint32_t length);
 
     ////////////////////////////////////////////////////////////////////////////////////////
     // Communication methods --> Reading and writing protocol
     ////////////////////////////////////////////////////////////////////////////////////////
 
     void UpdateStatus(int32_t aStatusID);
     void UpdateStatusWithString(const PRUnichar * aStatusString);
 
--- a/mailnews/compose/src/nsURLFetcher.cpp
+++ b/mailnews/compose/src/nsURLFetcher.cpp
@@ -191,17 +191,17 @@ nsURLFetcher::StillRunning(bool *running
   *running = mStillRunning;
   return NS_OK;
 }
 
 
 // Methods for nsIStreamListener...
 nsresult
 nsURLFetcher::OnDataAvailable(nsIRequest *request, nsISupports * ctxt, nsIInputStream *aIStream, 
-                              uint32_t sourceOffset, uint32_t aLength)
+                              uint64_t sourceOffset, uint32_t aLength)
 {
   /* let our converter or consumer process the data */
   if (!mConverter)
     return NS_ERROR_FAILURE;
 
   return mConverter->OnDataAvailable(request, ctxt, aIStream, sourceOffset, aLength);
 }
 
@@ -469,18 +469,18 @@ NS_IMETHODIMP nsURLFetcherStreamConsumer
     mURLFetcher->mCharset = charset;
   }
 
   return NS_OK;
 }
 
 /** nsIStreamListener methods **/
 
-/* void onDataAvailable (in nsIRequest request, in nsISupports ctxt, in nsIInputStream inStr, in unsigned long sourceOffset, in unsigned long count); */
-NS_IMETHODIMP nsURLFetcherStreamConsumer::OnDataAvailable(nsIRequest *aRequest, nsISupports *ctxt, nsIInputStream *inStr, uint32_t sourceOffset, uint32_t count)
+/* void onDataAvailable (in nsIRequest request, in nsISupports ctxt, in nsIInputStream inStr, in unsigned long long sourceOffset, in unsigned long count); */
+NS_IMETHODIMP nsURLFetcherStreamConsumer::OnDataAvailable(nsIRequest *aRequest, nsISupports *ctxt, nsIInputStream *inStr, uint64_t sourceOffset, uint32_t count)
 {
   uint32_t        readLen = count;
   uint32_t        wroteIt;
 
   if (!mURLFetcher)
     return NS_ERROR_FAILURE;
 
   if (!mURLFetcher->mOutStream)
--- a/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp
+++ b/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp
@@ -1071,18 +1071,18 @@ NS_IMETHODIMP TokenStreamListener::OnSta
         nsCOMPtr<nsIMsgMailNewsUrl> mailUrl = do_QueryInterface(uri);
         if (mailUrl)
             mailUrl->SetMsgHeaderSink(static_cast<nsIMsgHeaderSink*>(this));
     }
 
     return NS_OK;
 }
 
-/* void onDataAvailable (in nsIRequest aRequest, in nsISupports aContext, in nsIInputStream aInputStream, in unsigned long aOffset, in unsigned long aCount); */
-NS_IMETHODIMP TokenStreamListener::OnDataAvailable(nsIRequest *aRequest, nsISupports *aContext, nsIInputStream *aInputStream, uint32_t aOffset, uint32_t aCount)
+/* void onDataAvailable (in nsIRequest aRequest, in nsISupports aContext, in nsIInputStream aInputStream, in unsigned long long aOffset, in unsigned long aCount); */
+NS_IMETHODIMP TokenStreamListener::OnDataAvailable(nsIRequest *aRequest, nsISupports *aContext, nsIInputStream *aInputStream, uint64_t aOffset, uint32_t aCount)
 {
     nsresult rv = NS_OK;
 
     while (aCount > 0) {
         uint32_t readCount, totalCount = (aCount + mLeftOverCount);
         if (totalCount >= mBufferSize) {
             readCount = mBufferSize - mLeftOverCount - 1;
         } else {
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -1962,17 +1962,17 @@ nsresult nsImapProtocol::SendData(const 
 
 /////////////////////////////////////////////////////////////////////////////////////////////
 // Begin protocol state machine functions...
 //////////////////////////////////////////////////////////////////////////////////////////////
 
   // ProcessProtocolState - we override this only so we'll link - it should never get called.
 
 nsresult nsImapProtocol::ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream,
-                                              uint32_t sourceOffset, uint32_t length)
+                                              uint64_t sourceOffset, uint32_t length)
 {
   return NS_OK;
 }
 
 class UrlListenerNotifierEvent : public nsRunnable
 {
 public:
   UrlListenerNotifierEvent(nsIMsgMailNewsUrl *aUrl, nsIImapProtocol *aProtocol)
@@ -8578,17 +8578,17 @@ nsImapCacheStreamListener::OnStopRequest
 
   mListener = nullptr;
   mChannelToUse->Close();
   mChannelToUse = nullptr;
   return rv;
 }
 
 NS_IMETHODIMP
-nsImapCacheStreamListener::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt, nsIInputStream * aInStream, uint32_t aSourceOffset, uint32_t aCount)
+nsImapCacheStreamListener::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt, nsIInputStream * aInStream, uint64_t aSourceOffset, uint32_t aCount)
 {
   return mListener->OnDataAvailable(mChannelToUse, aCtxt, aInStream, aSourceOffset, aCount);
 }
 
 NS_IMPL_THREADSAFE_ADDREF(nsImapMockChannel)
 NS_IMPL_THREADSAFE_RELEASE(nsImapMockChannel)
 
 NS_INTERFACE_MAP_BEGIN(nsImapMockChannel)
--- a/mailnews/imap/src/nsImapProtocol.h
+++ b/mailnews/imap/src/nsImapProtocol.h
@@ -134,17 +134,17 @@ class nsImapProtocol : public nsIImapPro
 public:
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIINPUTSTREAMCALLBACK
   nsImapProtocol();
   virtual ~nsImapProtocol();
 
   virtual nsresult ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream,
-                  uint32_t sourceOffset, uint32_t length);
+                                        uint64_t sourceOffset, uint32_t length);
 
   // nsIRunnable method
   NS_IMETHOD Run();
 
   //////////////////////////////////////////////////////////////////////////////////
   // we support the nsIImapProtocol interface
   //////////////////////////////////////////////////////////////////////////////////
   NS_DECL_NSIIMAPPROTOCOL
--- a/mailnews/imap/src/nsSyncRunnableHelpers.cpp
+++ b/mailnews/imap/src/nsSyncRunnableHelpers.cpp
@@ -352,17 +352,17 @@ NS_IMETHODIMP iface##Proxy::Set##attribu
     return DispatchSyncRunnable(r);                                 \
   }
 
 
 #define NS_NOTIMPLEMENTED \
   { NS_RUNTIMEABORT("Not implemented"); return NS_ERROR_UNEXPECTED; }
 
 NS_SYNCRUNNABLEMETHOD5(StreamListener, OnDataAvailable,
-                       nsIRequest *, nsISupports *, nsIInputStream *, uint32_t, uint32_t)
+                       nsIRequest *, nsISupports *, nsIInputStream *, uint64_t, uint32_t)
 
 NS_SYNCRUNNABLEMETHOD2(StreamListener, OnStartRequest,
                        nsIRequest *, nsISupports *)
 
 NS_SYNCRUNNABLEMETHOD3(StreamListener, OnStopRequest,
                        nsIRequest *, nsISupports *, nsresult)
 
 NS_SYNCRUNNABLEMETHOD2(ImapProtocolSink, GetUrlWindow, nsIMsgMailNewsUrl *,
--- a/mailnews/local/src/nsMailboxProtocol.cpp
+++ b/mailnews/local/src/nsMailboxProtocol.cpp
@@ -546,17 +546,17 @@ nsresult nsMailboxProtocol::LoadUrl(nsIU
       rv = nsMsgProtocol::LoadUrl(aURL, m_channelListener);
       
     } // if we received an MAILBOX url...
   } // if we received a url!
   
   return rv;
 }
 
-int32_t nsMailboxProtocol::ReadFolderResponse(nsIInputStream * inputStream, uint32_t sourceOffset, uint32_t length)
+int32_t nsMailboxProtocol::ReadFolderResponse(nsIInputStream * inputStream, uint64_t sourceOffset, uint32_t length)
 {
   // okay we are doing a folder read in 8K chunks of a mail folder....
   // this is almost too easy....we can just forward the data in this stream on to our
   // folder parser object!!!
   
   nsresult rv = NS_OK;
   mCurrentProgress += length;
   
@@ -577,17 +577,17 @@ int32_t nsMailboxProtocol::ReadFolderRes
   // leave our state alone so when the next chunk of the mailbox comes in we jump to this state
   // and repeat....how does this process end? Well when the file is done being read in, core net lib
   // will issue an ::OnStopRequest to us...we'll use that as our sign to drop out of this state and to
   // close the protocol instance...
   
   return 0; 
 }
 
-int32_t nsMailboxProtocol::ReadMessageResponse(nsIInputStream * inputStream, uint32_t sourceOffset, uint32_t length)
+int32_t nsMailboxProtocol::ReadMessageResponse(nsIInputStream * inputStream, uint64_t sourceOffset, uint32_t length)
 {
   char *line = nullptr;
   uint32_t status = 0;
   nsresult rv = NS_OK;
   mCurrentProgress += length;
   
   // if we are doing a move or a copy, forward the data onto the copy handler...
   // if we want to display the message then parse the incoming data...
@@ -660,17 +660,17 @@ int32_t nsMailboxProtocol::ReadMessageRe
 }
 
 
 /*
  * returns negative if the transfer is finished or error'd out
  *
  * returns zero or more if the transfer needs to be continued.
  */
-nsresult nsMailboxProtocol::ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream, uint32_t offset, uint32_t length)
+nsresult nsMailboxProtocol::ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream, uint64_t offset, uint32_t length)
 {
   nsresult rv = NS_OK;
   int32_t status = 0;
   ClearFlag(MAILBOX_PAUSE_FOR_READ); /* already paused; reset */
   
   while(!TestFlag(MAILBOX_PAUSE_FOR_READ))
   {
     
--- a/mailnews/local/src/nsMailboxProtocol.h
+++ b/mailnews/local/src/nsMailboxProtocol.h
@@ -87,34 +87,34 @@ private:
   nsCOMPtr<nsIFile> m_tempMessageFile;
         nsCOMPtr<nsIOutputStream> m_msgFileOutputStream;
 
   // this is used to hold the source mailbox file open when move/copying
   // multiple messages.
   nsCOMPtr<nsIInputStream> m_multipleMsgMoveCopyStream;
 
   virtual nsresult ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream,
-                        uint32_t sourceOffset, uint32_t length);
+                                        uint64_t sourceOffset, uint32_t length);
   virtual nsresult CloseSocket();
 
   nsresult SetupMessageExtraction();
   nsresult OpenMultipleMsgTransport(uint64_t offset, int32_t size);
   nsresult OpenFileSocketForReuse(nsIURI * aURL, uint64_t aStartPosition, int32_t aReadCount);
   bool RunningMultipleMsgUrl();
 
   ////////////////////////////////////////////////////////////////////////////////////////
   // Protocol Methods --> This protocol is state driven so each protocol method is
   //            designed to re-act to the current "state". I've attempted to
   //            group them together based on functionality.
   ////////////////////////////////////////////////////////////////////////////////////////
 
   // When parsing a mailbox folder in chunks, this protocol state reads in the current chunk
   // and forwards it to the mailbox parser.
-  int32_t ReadFolderResponse(nsIInputStream * inputStream, uint32_t sourceOffset, uint32_t length);
-  int32_t ReadMessageResponse(nsIInputStream * inputStream, uint32_t sourceOffset, uint32_t length);
+  int32_t ReadFolderResponse(nsIInputStream * inputStream, uint64_t sourceOffset, uint32_t length);
+  int32_t ReadMessageResponse(nsIInputStream * inputStream, uint64_t sourceOffset, uint32_t length);
   int32_t DoneReadingMessage();
 
   ////////////////////////////////////////////////////////////////////////////////////////
   // End of Protocol Methods
   ////////////////////////////////////////////////////////////////////////////////////////
 };
 
 #endif  // nsMailboxProtocol_h___
--- a/mailnews/local/src/nsParseMailbox.cpp
+++ b/mailnews/local/src/nsParseMailbox.cpp
@@ -66,17 +66,17 @@ static NS_DEFINE_CID(kRDFServiceCID, NS_
 /* the following macros actually implement addref, release and query interface for our component. */
 NS_IMPL_ISUPPORTS_INHERITED2(nsMsgMailboxParser,
                              nsParseMailMessageState,
                              nsIStreamListener,
                              nsIRequestObserver)
 
 // Whenever data arrives from the connection, core netlib notifices the protocol by calling
 // OnDataAvailable. We then read and process the incoming data from the input stream.
-NS_IMETHODIMP nsMsgMailboxParser::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *aIStream, uint32_t sourceOffset, uint32_t aLength)
+NS_IMETHODIMP nsMsgMailboxParser::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *aIStream, uint64_t sourceOffset, uint32_t aLength)
 {
     // right now, this really just means turn around and process the url
     nsresult rv = NS_OK;
     nsCOMPtr<nsIURI> url = do_QueryInterface(ctxt, &rv);
     if (NS_SUCCEEDED(rv))
         rv = ProcessMailboxInputStream(url, aIStream, aLength);
     return rv;
 }
--- a/mailnews/local/src/nsPop3Protocol.cpp
+++ b/mailnews/local/src/nsPop3Protocol.cpp
@@ -3712,17 +3712,17 @@ nsPop3Protocol::CommitState(bool remove_
 /* NET_process_Pop3  will control the state machine that
  * loads messages from a pop3 server
  *
  * returns negative if the transfer is finished or error'd out
  *
  * returns zero or more if the transfer needs to be continued.
  */
 nsresult nsPop3Protocol::ProcessProtocolState(nsIURI * url, nsIInputStream * aInputStream,
-                                              uint32_t sourceOffset, uint32_t aLength)
+                                              uint64_t sourceOffset, uint32_t aLength)
 {
   int32_t status = 0;
   bool urlStatusSet = false;
   nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_url);
 
   PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS, ("Entering NET_ProcessPop3 %d",
     aLength));
 
--- a/mailnews/local/src/nsPop3Protocol.h
+++ b/mailnews/local/src/nsPop3Protocol.h
@@ -305,17 +305,17 @@ private:
   int32_t  m_bytesInMsgReceived;
   int32_t  m_totalFolderSize;
   int32_t  m_totalDownloadSize; /* Number of bytes we're going to
                                     download.  Might be much less
                                     than the total_folder_size. */
   int32_t m_totalBytesReceived; // total # bytes received for the connection
 
   virtual nsresult ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream,
-                                        uint32_t sourceOffset, uint32_t length);
+                                        uint64_t sourceOffset, uint32_t length);
   virtual nsresult SendData(const char * dataBuffer, bool aSuppressLogging = false);
 
   virtual const char* GetType() {return "pop3";}
 
   nsCOMPtr<nsIURI> m_url;
   nsCOMPtr<nsIPop3Sink> m_nsIPop3Sink;
   nsCOMPtr<nsIPop3IncomingServer> m_pop3Server;
 
--- a/mailnews/mime/cthandlers/pgpmime/nsPgpMimeProxy.cpp
+++ b/mailnews/mime/cthandlers/pgpmime/nsPgpMimeProxy.cpp
@@ -531,17 +531,17 @@ nsPgpMimeProxy::OnStopRequest(nsIRequest
 
 ///////////////////////////////////////////////////////////////////////////////
 // nsIStreamListener method
 ///////////////////////////////////////////////////////////////////////////////
 
 NS_IMETHODIMP
 nsPgpMimeProxy::OnDataAvailable(nsIRequest* aRequest, nsISupports* aContext,
                               nsIInputStream *aInputStream,
-                              uint32_t aSourceOffset,
+                              uint64_t aSourceOffset,
                               uint32_t aLength)
 {
   NS_ENSURE_TRUE(mInitialized, NS_ERROR_NOT_INITIALIZED);
 
   NS_ENSURE_ARG(aInputStream);
   NS_ENSURE_ARG_MIN(aLength, 0);
 
   char buf[kCharMax];
--- a/mailnews/mime/src/nsStreamConverter.cpp
+++ b/mailnews/mime/src/nsStreamConverter.cpp
@@ -862,17 +862,17 @@ nsStreamConverter::GetOrigMsgHdr(nsIMsgD
 // Notify the client that data is available in the input stream.  This
 // method is called whenver data is written into the input stream by the
 // networking library...
 //
 nsresult
 nsStreamConverter::OnDataAvailable(nsIRequest     *request,
                                    nsISupports    *ctxt,
                                    nsIInputStream *aIStream,
-                                   uint32_t       sourceOffset,
+                                   uint64_t       sourceOffset,
                                    uint32_t       aLength)
 {
   nsresult        rc=NS_OK;     // should this be an error instead?
   uint32_t        readLen = aLength;
   uint32_t        written;
 
   // If this is the first time through and we are supposed to be
   // outputting the wrapper two pane URL, then do it now.
--- a/mailnews/news/src/nsNNTPProtocol.cpp
+++ b/mailnews/news/src/nsNNTPProtocol.cpp
@@ -618,17 +618,17 @@ nsNntpCacheStreamListener::OnStopRequest
     rv = nntpProtocol->SetIsBusy(false);
     NS_ENSURE_SUCCESS(rv,rv);
   }
   mChannelToUse = nullptr;
   return rv;
 }
 
 NS_IMETHODIMP
-nsNntpCacheStreamListener::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt, nsIInputStream * aInStream, uint32_t aSourceOffset, uint32_t aCount)
+nsNntpCacheStreamListener::OnDataAvailable(nsIRequest *request, nsISupports * aCtxt, nsIInputStream * aInStream, uint64_t aSourceOffset, uint32_t aCount)
 {
     NS_ENSURE_STATE(mListener);
     nsCOMPtr <nsIRequest> ourRequest = do_QueryInterface(mChannelToUse);
     return mListener->OnDataAvailable(ourRequest, aCtxt, aInStream, aSourceOffset, aCount);
 }
 
 NS_IMETHODIMP nsNNTPProtocol::GetOriginalURI(nsIURI* *aURI)
 {
@@ -4342,17 +4342,17 @@ int32_t nsNNTPProtocol::SetupForTransfer
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////////////////////
 // The following method is used for processing the news state machine.
 // It returns a negative number (mscott: we'll change this to be an enumerated type which we'll coordinate
 // with the netlib folks?) when we are done processing.
 //////////////////////////////////////////////////////////////////////////////////////////////////////////
 nsresult nsNNTPProtocol::ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream,
-                                              uint32_t sourceOffset, uint32_t length)
+                                              uint64_t sourceOffset, uint32_t length)
 {
   int32_t status = 0;
   nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
   if (inputStream && (!mailnewsurl || !m_nntpServer))
   {
     // In these cases, we are going to return since our data is effectively
     // invalid. However, nsInputStream would really rather that we at least read
     // some of our input data (even if not all of it). Therefore, we'll read a
--- a/mailnews/news/src/nsNNTPProtocol.h
+++ b/mailnews/news/src/nsNNTPProtocol.h
@@ -167,17 +167,17 @@ private:
    * NNTP_SUSPENDED: A state where the state machine does not read input until
    *                 reenabled by a non-network related callback
    *
    * @note Use of NNTP_SUSPENDED is dangerous: if input comes along the socket,
    * the code will not read the input stream at all. Therefore, it is strongly
    * advised to suspend the request before using this state.
    */
   virtual nsresult ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream,
-    uint32_t sourceOffset, uint32_t length);
+                                        uint64_t sourceOffset, uint32_t length);
   virtual nsresult CloseSocket();
 
   // we have our own implementation of SendData which writes to the nntp log
   // and then calls the base class to transmit the data
   nsresult SendData(const char * dataBuffer, bool aSuppressLogging = false);
 
   nsresult CleanupAfterRunningUrl();
   void Cleanup(); //free char* member variables