Bug 385154 - remove nsInt64 usage from the tree. r=roc
authorNavin Lal <navinjlal@gmail.com>
Wed, 12 Aug 2009 10:51:46 +0200
changeset 31382 269e64bb5421a4fbcf6ed27913a1e543a5932904
parent 31381 425a7c8b476ab53f19ad999b4761f1fffcc0e7d9
child 31383 6470caf066b2883c890199ba87604a6576f0fcb7
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs385154
milestone1.9.2a2pre
Bug 385154 - remove nsInt64 usage from the tree. r=roc
content/html/document/src/nsWyciwygChannel.cpp
embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
embedding/tests/wxEmbed/GeckoProtocolHandler.cpp
modules/libjar/nsJARChannel.cpp
netwerk/base/src/nsSocketTransport2.h
netwerk/base/src/nsStreamTransportService.cpp
netwerk/protocol/http/src/nsHttpChannel.cpp
netwerk/protocol/http/src/nsHttpChannel.h
netwerk/protocol/http/src/nsHttpTransaction.cpp
netwerk/streamconv/converters/nsMultiMixedConv.cpp
netwerk/streamconv/converters/nsMultiMixedConv.h
uriloader/base/nsDocLoader.cpp
xpinstall/src/nsXPInstallManager.cpp
--- a/content/html/document/src/nsWyciwygChannel.cpp
+++ b/content/html/document/src/nsWyciwygChannel.cpp
@@ -504,18 +504,18 @@ nsWyciwygChannel::OnDataAvailable(nsIReq
       this, request, offset, count));
 
   nsresult rv;
   
   rv = mListener->OnDataAvailable(this, mListenerContext, input, offset, count);
 
   // XXX handle 64-bit stuff for real
   if (mProgressSink && NS_SUCCEEDED(rv) && !(mLoadFlags & LOAD_BACKGROUND))
-    mProgressSink->OnProgress(this, nsnull, nsUint64(offset + count),
-                              nsUint64(mContentLength));
+    mProgressSink->OnProgress(this, nsnull, PRUint64(offset + count),
+                              PRUint64(mContentLength));
 
   return rv; // let the pump cancel on failure
 }
 
 //////////////////////////////////////////////////////////////////////////////
 // nsIRequestObserver
 //////////////////////////////////////////////////////////////////////////////
 
--- a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
+++ b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
@@ -981,18 +981,18 @@ NS_IMETHODIMP nsWebBrowserPersist::OnPro
     if (mProgressListener2)
     {
       mProgressListener2->OnProgressChange64(nsnull, request, aProgress,
             aProgressMax, mTotalCurrentProgress, mTotalMaxProgress);
     }
     else
     {
       // have to truncate 64-bit to 32bit
-      mProgressListener->OnProgressChange(nsnull, request, nsUint64(aProgress),
-              nsUint64(aProgressMax), mTotalCurrentProgress, mTotalMaxProgress);
+      mProgressListener->OnProgressChange(nsnull, request, PRUint64(aProgress),
+              PRUint64(aProgressMax), mTotalCurrentProgress, mTotalMaxProgress);
     }
 
     // If our progress listener implements nsIProgressEventSink,
     // forward the notification
     if (mEventSink)
     {
         mEventSink->OnProgress(request, ctxt, aProgress, aProgressMax);
     }
--- a/embedding/tests/wxEmbed/GeckoProtocolHandler.cpp
+++ b/embedding/tests/wxEmbed/GeckoProtocolHandler.cpp
@@ -554,13 +554,13 @@ GeckoProtocolChannel::OnDataAvailable(ns
                                       PRUint32 offset, PRUint32 count)
 {
     nsresult rv;
 
     rv = mListener->OnDataAvailable(this, mListenerContext, stream, offset, count);
 
     // XXX can this use real 64-bit ints?
     if (mProgressSink && NS_SUCCEEDED(rv) && !(mLoadFlags & LOAD_BACKGROUND))
-        mProgressSink->OnProgress(this, nsnull, nsUint64(offset + count),
-                                  nsUint64(mContentLength));
+        mProgressSink->OnProgress(this, nsnull, PRUint64(offset + count),
+                                  PRUint64(mContentLength));
 
     return rv; // let the pump cancel on failure
 }
--- a/modules/libjar/nsJARChannel.cpp
+++ b/modules/libjar/nsJARChannel.cpp
@@ -908,13 +908,13 @@ nsJARChannel::OnDataAvailable(nsIRequest
     nsresult rv;
 
     rv = mListener->OnDataAvailable(this, mListenerContext, stream, offset, count);
 
     // simply report progress here instead of hooking ourselves up as a
     // nsITransportEventSink implementation.
     // XXX do the 64-bit stuff for real
     if (mProgressSink && NS_SUCCEEDED(rv) && !(mLoadFlags & LOAD_BACKGROUND))
-        mProgressSink->OnProgress(this, nsnull, nsUint64(offset + count),
-                                  nsUint64(mContentLength));
+        mProgressSink->OnProgress(this, nsnull, PRUint64(offset + count),
+                                  PRUint64(mContentLength));
 
     return rv; // let the pump cancel on failure
 }
--- a/netwerk/base/src/nsSocketTransport2.h
+++ b/netwerk/base/src/nsSocketTransport2.h
@@ -85,17 +85,17 @@ public:
 private:
     nsSocketTransport               *mTransport;
     nsrefcnt                         mReaderRefCnt;
 
     // access to these is protected by mTransport->mLock
     nsresult                         mCondition;
     nsCOMPtr<nsIInputStreamCallback> mCallback;
     PRUint32                         mCallbackFlags;
-    nsUint64                         mByteCount;
+    PRUint64                         mByteCount;
 };
 
 //-----------------------------------------------------------------------------
 
 class nsSocketOutputStream : public nsIAsyncOutputStream
 {
 public:
     NS_DECL_ISUPPORTS_INHERITED
@@ -119,17 +119,17 @@ private:
 
     nsSocketTransport                *mTransport;
     nsrefcnt                          mWriterRefCnt;
 
     // access to these is protected by mTransport->mLock
     nsresult                          mCondition;
     nsCOMPtr<nsIOutputStreamCallback> mCallback;
     PRUint32                          mCallbackFlags;
-    nsUint64                          mByteCount;
+    PRUint64                          mByteCount;
 };
 
 //-----------------------------------------------------------------------------
 
 class nsSocketTransport : public nsASocketHandler
                         , public nsISocketTransport
                         , public nsIDNSListener
                         , public nsIClassInfo
--- a/netwerk/base/src/nsStreamTransportService.cpp
+++ b/netwerk/base/src/nsStreamTransportService.cpp
@@ -89,18 +89,18 @@ public:
 
 private:
     nsCOMPtr<nsIAsyncInputStream>   mPipeIn;
 
     // while the copy is active, these members may only be accessed from the
     // nsIInputStream implementation.
     nsCOMPtr<nsITransportEventSink> mEventSink;
     nsCOMPtr<nsIInputStream>        mSource;
-    nsUint64                        mOffset;
-    nsUint64                        mLimit;
+    PRUint64                        mOffset;
+    PRUint64                        mLimit;
     PRPackedBool                    mCloseWhenDone;
     PRPackedBool                    mFirstTime;
 
     // this variable serves as a lock to prevent the state of the transport
     // from being modified once the copy is in progress.
     PRPackedBool                    mInProgress;
 };
 
@@ -203,24 +203,22 @@ nsInputStreamTransport::Available(PRUint
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsInputStreamTransport::Read(char *buf, PRUint32 count, PRUint32 *result)
 {
     if (mFirstTime) {
         mFirstTime = PR_FALSE;
-        if (mOffset != nsUint64(0)) {
+        if (mOffset != 0) {
             // read from current position if offset equal to max
             if (mOffset != LL_MAXUINT) {
                 nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mSource);
-                // Note: The casts to PRUint64 are needed to cast to PRInt64, as
-                // nsUint64 can't directly be cast to PRInt64
                 if (seekable)
-                    seekable->Seek(nsISeekableStream::NS_SEEK_SET, PRUint64(mOffset));
+                    seekable->Seek(nsISeekableStream::NS_SEEK_SET, mOffset);
             }
             // reset offset to zero so we can use it to enforce limit
             mOffset = 0;
         }
     }
 
     // limit amount read
     PRUint32 max = mLimit - mOffset;
@@ -291,18 +289,18 @@ public:
 
 private:
     nsCOMPtr<nsIAsyncOutputStream>  mPipeOut;
  
     // while the copy is active, these members may only be accessed from the
     // nsIOutputStream implementation.
     nsCOMPtr<nsITransportEventSink> mEventSink;
     nsCOMPtr<nsIOutputStream>       mSink;
-    nsUint64                        mOffset;
-    nsUint64                        mLimit;
+    PRUint64                        mOffset;
+    PRUint64                        mLimit;
     PRPackedBool                    mCloseWhenDone;
     PRPackedBool                    mFirstTime;
 
     // this variable serves as a lock to prevent the state of the transport
     // from being modified once the copy is in progress.
     PRPackedBool                    mInProgress;
 };
 
@@ -405,24 +403,22 @@ nsOutputStreamTransport::Flush()
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsOutputStreamTransport::Write(const char *buf, PRUint32 count, PRUint32 *result)
 {
     if (mFirstTime) {
         mFirstTime = PR_FALSE;
-        if (mOffset != nsUint64(0)) {
+        if (mOffset != 0) {
             // write to current position if offset equal to max
             if (mOffset != LL_MAXUINT) {
                 nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mSink);
-                // Note: The casts to PRUint64 are needed to cast to PRInt64, as
-                // nsUint64 can't directly be cast to PRInt64
                 if (seekable)
-                    seekable->Seek(nsISeekableStream::NS_SEEK_SET, PRUint64(mOffset));
+                    seekable->Seek(nsISeekableStream::NS_SEEK_SET, mOffset);
             }
             // reset offset to zero so we can use it to enforce limit
             mOffset = 0;
         }
     }
 
     // limit amount written
     PRUint32 max = mLimit - mOffset;
--- a/netwerk/protocol/http/src/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/src/nsHttpChannel.cpp
@@ -5259,18 +5259,18 @@ nsHttpChannel::OnDataAvailable(nsIReques
         else
             transportStatus = nsISocketTransport::STATUS_RECEIVING_FROM;
 
         // mResponseHead may reference new or cached headers, but either way it
         // holds our best estimate of the total content length.  Even in the case
         // of a byte range request, the content length stored in the cached
         // response headers is what we want to use here.
 
-        nsUint64 progressMax(PRUint64(mResponseHead->ContentLength()));
-        nsUint64 progress = mLogicalOffset + nsUint64(count);
+        PRUint64 progressMax(PRUint64(mResponseHead->ContentLength()));
+        PRUint64 progress = mLogicalOffset + PRUint64(count);
         NS_ASSERTION(progress <= progressMax, "unexpected progress values");
 
         OnTransportStatus(nsnull, transportStatus, progress, progressMax);
 
         //
         // we have to manually keep the logical offset of the stream up-to-date.
         // we cannot depend solely on the offset provided, since we may have 
         // already streamed some data from another source (see, for example,
--- a/netwerk/protocol/http/src/nsHttpChannel.h
+++ b/netwerk/protocol/http/src/nsHttpChannel.h
@@ -280,17 +280,17 @@ private:
     nsRefPtr<nsInputStreamPump>       mTransactionPump;
     nsHttpTransaction                *mTransaction;     // hard ref
     nsHttpConnectionInfo             *mConnectionInfo;  // hard ref
 
     nsCString                         mSpec; // ASCII encoded URL spec
 
     PRUint32                          mLoadFlags;
     PRUint32                          mStatus;
-    nsUint64                          mLogicalOffset;
+    PRUint64                          mLogicalOffset;
     PRUint8                           mCaps;
     PRInt16                           mPriority;
 
     nsCString                         mContentTypeHint;
     nsCString                         mContentCharsetHint;
     nsCString                         mUserSetCookieHeader;
 
     // cache specific data
--- a/netwerk/protocol/http/src/nsHttpTransaction.cpp
+++ b/netwerk/protocol/http/src/nsHttpTransaction.cpp
@@ -373,17 +373,17 @@ nsHttpTransaction::OnTransportStatus(nsr
             progress,
             EmptyCString());
     }
 
     // nsHttpChannel synthesizes progress events in OnDataAvailable
     if (status == nsISocketTransport::STATUS_RECEIVING_FROM)
         return;
 
-    nsUint64 progressMax;
+    PRUint64 progressMax;
 
     if (status == nsISocketTransport::STATUS_SENDING_TO) {
         // suppress progress when only writing request headers
         if (!mHasRequestBody)
             return;
 
         nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mRequestStream);
         NS_ASSERTION(seekable, "Request stream isn't seekable?!?");
--- a/netwerk/streamconv/converters/nsMultiMixedConv.cpp
+++ b/netwerk/streamconv/converters/nsMultiMixedConv.cpp
@@ -809,17 +809,17 @@ nsMultiMixedConv::SendData(char *aBuffer
 
     nsresult rv = NS_OK;
     
     if (!mPartChannel) return NS_ERROR_FAILURE; // something went wrong w/ processing
 
     if (mContentLength != LL_MAXUINT) {
         // make sure that we don't send more than the mContentLength
         // XXX why? perhaps the Content-Length header was actually wrong!!
-        if ((nsUint64(aLen) + mTotalSent) > mContentLength)
+        if ((PRUint64(aLen) + mTotalSent) > mContentLength)
             aLen = mContentLength - mTotalSent;
 
         if (aLen == 0)
             return NS_OK;
     }
 
     PRUint32 offset = mTotalSent;
     mTotalSent += aLen;
--- a/netwerk/streamconv/converters/nsMultiMixedConv.h
+++ b/netwerk/streamconv/converters/nsMultiMixedConv.h
@@ -88,17 +88,17 @@ protected:
   nsresult                mStatus;
   nsLoadFlags             mLoadFlags;
 
   nsCOMPtr<nsILoadGroup>  mLoadGroup;
 
   nsCString               mContentType;
   nsCString               mContentCharset;
   nsCString               mContentDisposition;
-  nsUint64                mContentLength;
+  PRUint64                mContentLength;
 
   PRBool                  mIsByteRangeRequest;
   nsInt64                 mByteRangeStart;
   nsInt64                 mByteRangeEnd;
 
   PRUint32                mPartID; // unique ID that can be used to identify
                                    // this part of the multipart document
   PRBool                  mIsLastPart;
@@ -169,21 +169,21 @@ protected:
     nsCString           mToken;
     PRUint32            mTokenLen;
 
     nsRefPtr<nsPartChannel> mPartChannel;   // the channel for the given part we're processing.
                                         // one channel per part.
     nsCOMPtr<nsISupports> mContext;
     nsCString           mContentType;
     nsCString           mContentDisposition;
-    nsUint64            mContentLength;
+    PRUint64            mContentLength;
     
     char                *mBuffer;
     PRUint32            mBufLen;
-    nsUint64            mTotalSent;
+    PRUint64            mTotalSent;
     PRBool              mFirstOnData;   // used to determine if we're in our first OnData callback.
 
     // The following members are for tracking the byte ranges in
     // multipart/mixed content which specified the 'Content-Range:'
     // header...
     nsInt64             mByteRangeStart;
     nsInt64             mByteRangeEnd;
     PRBool              mIsByteRangeRequest;
--- a/uriloader/base/nsDocLoader.cpp
+++ b/uriloader/base/nsDocLoader.cpp
@@ -1063,17 +1063,17 @@ NS_IMETHODIMP nsDocLoader::OnProgress(ns
       }
 
       //
       // This is the first progress notification for the entry.  If
       // (aMaxProgress > 0) then the content-length of the data is known,
       // so update mMaxSelfProgress...  Otherwise, set it to -1 to indicate
       // that the content-length is no longer known.
       //
-      if (nsUint64(aProgressMax) != LL_MAXUINT) {
+      if (PRUint64(aProgressMax) != LL_MAXUINT) {
         mMaxSelfProgress  += PRInt64(aProgressMax);
         info->mMaxProgress = PRInt64(aProgressMax);
       } else {
         mMaxSelfProgress   =  nsInt64(-1);
         info->mMaxProgress =  nsInt64(-1);
       }
 
       // Send a STATE_TRANSFERRING notification for the request.
--- a/xpinstall/src/nsXPInstallManager.cpp
+++ b/xpinstall/src/nsXPInstallManager.cpp
@@ -1275,17 +1275,17 @@ nsXPInstallManager::OnProgress(nsIReques
         if (mContentLength < 1) {
             nsCOMPtr<nsIChannel> channel = do_QueryInterface(request,&rv);
             NS_ASSERTION(channel, "should have a channel");
             if (NS_FAILED(rv)) return rv;
             rv = channel->GetContentLength(&mContentLength);
             if (NS_FAILED(rv)) return rv;
         }
         // XXX once channels support that, use 64-bit contentlength
-        rv = mDlg->OnProgress( mNextItem-1, aProgress, nsUint64(mContentLength) );
+        rv = mDlg->OnProgress( mNextItem-1, aProgress, PRUint64(mContentLength) );
     }
 
     return rv;
 }
 
 NS_IMETHODIMP
 nsXPInstallManager::OnStatus(nsIRequest* request, nsISupports *ctxt,
                              nsresult aStatus, const PRUnichar *aStatusArg)