Bug 1404489 - always use uint64_t as offset and int64_t as size for functions containing SlicedInputStream(). r=jorgk
--- a/mailnews/base/util/nsMsgProtocol.cpp
+++ b/mailnews/base/util/nsMsgProtocol.cpp
@@ -187,17 +187,17 @@ nsresult nsMsgProtocol::GetFileFromURL(n
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(uri);
if (!fileURL) return NS_ERROR_FAILURE;
return fileURL->GetFile(aResult);
// dougt
}
-nsresult nsMsgProtocol::OpenFileSocket(nsIURI * aURL, uint32_t aStartPosition, int32_t aReadCount)
+nsresult nsMsgProtocol::OpenFileSocket(nsIURI *aURL, uint64_t aStartPosition, int64_t aReadCount)
{
// mscott - file needs to be encoded directly into aURL. I should be able to get
// rid of this method completely.
nsresult rv = NS_OK;
m_readCount = aReadCount;
nsCOMPtr <nsIFile> file;
@@ -209,17 +209,17 @@ nsresult nsMsgProtocol::OpenFileSocket(n
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;
RefPtr<SlicedInputStream> slicedStream =
- new SlicedInputStream(stream, uint64_t(aStartPosition), uint64_t(aReadCount));
+ new SlicedInputStream(stream, aStartPosition, uint64_t(aReadCount));
rv = sts->CreateInputTransport(slicedStream, true,
getter_AddRefs(m_transport));
m_socketIsOpen = false;
return rv;
}
nsresult nsMsgProtocol::GetTopmostMsgWindow(nsIMsgWindow **aWindow)
--- a/mailnews/base/util/nsMsgProtocol.h
+++ b/mailnews/base/util/nsMsgProtocol.h
@@ -81,17 +81,17 @@ protected:
// aHostName must be UTF-8 encoded.
virtual nsresult OpenNetworkSocketWithInfo(const char * aHostName,
int32_t aGetPort,
const char *connectionType,
nsIProxyInfo *aProxyInfo,
nsIInterfaceRequestor* callbacks);
// helper routine
nsresult GetFileFromURL(nsIURI * aURL, nsIFile **aResult);
- virtual nsresult OpenFileSocket(nsIURI * aURL, uint32_t aStartPosition, int32_t aReadCount); // used to open a file socket connection
+ virtual nsresult OpenFileSocket(nsIURI * aURL, uint64_t aStartPosition, int64_t aReadCount); // used to open a file socket connection
nsresult GetTopmostMsgWindow(nsIMsgWindow **aWindow);
virtual const char* GetType() {return nullptr;}
nsresult GetQoSBits(uint8_t *aQoSBits);
// a Protocol typically overrides this method. They free any of their own connection state and then
// they call up into the base class to free the generic connection objects
@@ -129,17 +129,17 @@ protected:
nsCOMPtr<nsITransport> m_transport;
nsCOMPtr<nsIRequest> m_request;
nsCOMPtr<nsICancelable> m_proxyRequest;
bool m_socketIsOpen; // mscott: we should look into keeping this state in the nsSocketTransport...
// I'm using it to make sure I open the socket the first time a URL is loaded into the connection
uint32_t m_flags; // used to store flag information
//uint32_t m_startPosition;
- int32_t m_readCount;
+ int64_t m_readCount;
nsCOMPtr<nsIFile> m_tempMsgFile; // we currently have a hack where displaying a msg involves writing it to a temp file first
// auth module for access to NTLM functions
nsCOMPtr<nsIAuthModule> m_authModule;
// the following is a catch all for nsIChannel related data
nsCOMPtr<nsIURI> m_originalUrl; // the original url
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -9651,17 +9651,17 @@ bool nsImapMockChannel::ReadFromLocalCac
if (fileStream && NS_SUCCEEDED(rv))
{
// dougt - This may break the ablity to "cancel" a read from offline mail reading.
// fileChannel->SetLoadGroup(m_loadGroup);
RefPtr<nsImapCacheStreamListener> cacheListener = new nsImapCacheStreamListener();
cacheListener->Init(m_channelListener, this);
// create a stream pump that will async read the specified amount of data.
- // XXX make offset/size 64-bit ints
+ // XXX make size 64-bit int
RefPtr<SlicedInputStream> slicedStream =
new SlicedInputStream(fileStream, uint64_t(offset), uint64_t(size));
nsCOMPtr<nsIInputStreamPump> pump;
rv = NS_NewInputStreamPump(getter_AddRefs(pump), slicedStream);
if (NS_SUCCEEDED(rv))
rv = pump->AsyncRead(cacheListener, m_channelContext);
if (NS_SUCCEEDED(rv)) // ONLY if we succeeded in actually starting the read should we return
--- a/mailnews/local/src/nsMailboxProtocol.cpp
+++ b/mailnews/local/src/nsMailboxProtocol.cpp
@@ -56,17 +56,17 @@ nsMailboxProtocol::nsMailboxProtocol(nsI
}
nsMailboxProtocol::~nsMailboxProtocol()
{
// free our local state
delete m_lineStreamBuffer;
}
-nsresult nsMailboxProtocol::OpenMultipleMsgTransport(uint64_t offset, int32_t size)
+nsresult nsMailboxProtocol::OpenMultipleMsgTransport(uint64_t offset, int64_t size)
{
nsresult rv;
nsCOMPtr<nsIStreamTransportService> serv =
do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
// XXX 64-bit
@@ -112,21 +112,21 @@ nsresult nsMailboxProtocol::Initialize(n
rv = OpenFileSocket(aURL, 0, -1 /* read in all the bytes in the file */);
}
else
{
// we need to specify a byte range to read in so we read in JUST the message we want.
rv = SetupMessageExtraction();
if (NS_FAILED(rv)) return rv;
- uint32_t aMsgSize = 0;
- rv = m_runningUrl->GetMessageSize(&aMsgSize);
+ uint32_t msgSize = 0;
+ rv = m_runningUrl->GetMessageSize(&msgSize);
NS_ASSERTION(NS_SUCCEEDED(rv), "oops....i messed something up");
- SetContentLength(aMsgSize);
- mailnewsUrl->SetMaxProgress(aMsgSize);
+ SetContentLength(msgSize);
+ mailnewsUrl->SetMaxProgress(msgSize);
if (RunningMultipleMsgUrl())
{
// if we're running multiple msg url, we clear the event sink because the multiple
// msg urls will handle setting the progress.
mProgressEventSink = nullptr;
}
@@ -149,32 +149,32 @@ nsresult nsMailboxProtocol::Initialize(n
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISeekableStream> seekableStream(do_QueryInterface(stream, &rv));
NS_ENSURE_SUCCESS(rv, rv);
seekableStream->Tell(&offset);
// create input stream transport
nsCOMPtr<nsIStreamTransportService> sts =
do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv);
if (NS_FAILED(rv)) return rv;
- m_readCount = aMsgSize;
+ m_readCount = msgSize;
// Save the stream for reuse, but only for multiple URLs.
if (reusable && RunningMultipleMsgUrl())
m_multipleMsgMoveCopyStream = stream;
else
reusable = false;
RefPtr<SlicedInputStream> slicedStream =
- new SlicedInputStream(stream, uint64_t(offset), uint64_t(aMsgSize));
+ new SlicedInputStream(stream, offset, uint64_t(msgSize));
rv = sts->CreateInputTransport(slicedStream, !reusable,
getter_AddRefs(m_transport));
m_socketIsOpen = false;
}
}
if (!folder) // must be a .eml file
- rv = OpenFileSocket(aURL, 0, aMsgSize);
+ rv = OpenFileSocket(aURL, 0, int64_t(msgSize));
}
NS_ASSERTION(NS_SUCCEEDED(rv), "oops....i messed something up");
}
}
}
m_lineStreamBuffer = new nsMsgLineStreamBuffer(OUTPUT_BUFFER_SIZE, true);
--- a/mailnews/local/src/nsMailboxProtocol.h
+++ b/mailnews/local/src/nsMailboxProtocol.h
@@ -90,17 +90,17 @@ private:
// multiple messages.
nsCOMPtr<nsIInputStream> m_multipleMsgMoveCopyStream;
virtual nsresult ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream,
uint64_t sourceOffset, uint32_t length) override;
virtual nsresult CloseSocket() override;
nsresult SetupMessageExtraction();
- nsresult OpenMultipleMsgTransport(uint64_t offset, int32_t size);
+ nsresult OpenMultipleMsgTransport(uint64_t offset, int64_t size);
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.
////////////////////////////////////////////////////////////////////////////////////////