From 6765a029888ba714eb19afa42c4ef3d16e35d5e9 Mon Sep 17 00:00:00 2001 From: Isaac Aggrey Date: Fri, 28 Sep 2012 01:57:33 -0500 Subject: [PATCH] Bug 791906: Replace NSPR integer limit constants with stdint ones; r=ehsan --- .../src/base/nsAccessibilityService.cpp | 2 +- accessible/src/generic/Accessible.h | 2 +- accessible/src/generic/TextLeafAccessible.h | 2 +- accessible/src/html/HTMLListAccessible.h | 2 +- caps/idl/nsIScriptSecurityManager.idl | 2 +- content/base/src/WebSocket.cpp | 2 +- content/base/src/nsAttrValue.h | 4 +- content/base/src/nsContentList.cpp | 2 +- content/base/src/nsContentList.h | 2 +- content/base/src/nsDOMFile.cpp | 2 +- content/base/src/nsDOMFileReader.cpp | 4 +- content/base/src/nsDocument.cpp | 2 +- content/base/src/nsFrameMessageManager.cpp | 4 +- content/base/src/nsNodeInfo.cpp | 2 +- content/base/src/nsNodeInfo.h | 4 +- content/base/src/nsSyncLoadService.cpp | 8 ++-- content/base/src/nsXMLHttpRequest.cpp | 2 +- content/events/src/nsContentEventHandler.cpp | 6 +-- content/events/src/nsEventStateManager.cpp | 2 +- content/events/src/nsEventStateManager.h | 4 +- .../html/content/src/nsHTMLCanvasElement.cpp | 4 +- content/media/AudioSegment.cpp | 2 +- content/media/FileBlockCache.cpp | 2 +- content/media/MediaResource.cpp | 2 +- content/media/MediaSegment.h | 4 +- content/media/TimeVarying.h | 14 +++---- content/media/VideoUtils.cpp | 2 +- content/media/nsAudioStream.cpp | 4 +- content/media/nsBuiltinDecoderReader.cpp | 2 +- .../media/nsBuiltinDecoderStateMachine.cpp | 6 +-- content/media/nsMediaCache.cpp | 16 +++---- content/media/ogg/nsOggCodecState.cpp | 4 +- content/media/ogg/nsOggReader.cpp | 6 +-- content/media/wave/nsWaveReader.cpp | 12 +++--- content/smil/nsSMILInstanceTime.cpp | 2 +- content/svg/content/src/nsSVGFilters.cpp | 2 +- content/svg/content/src/nsSVGFilters.h | 2 +- content/xslt/src/xslt/txNodeSorter.cpp | 4 +- .../xul/document/src/nsXULPrototypeCache.cpp | 2 +- .../document/src/nsXULPrototypeDocument.cpp | 4 +- content/xul/templates/src/nsTemplateRule.h | 2 +- .../templates/src/nsXULTemplateBuilder.cpp | 2 +- docshell/base/nsDocShell.cpp | 2 +- dom/base/nsDOMClassInfo.cpp | 2 +- dom/base/nsGlobalWindow.cpp | 2 +- dom/base/nsJSEnvironment.cpp | 10 ++--- dom/camera/GonkCameraControl.cpp | 2 +- dom/devicestorage/nsDeviceStorage.cpp | 2 +- dom/file/ArchiveZipFile.cpp | 2 +- dom/file/MemoryStreams.cpp | 2 +- dom/indexedDB/FileInfo.cpp | 4 +- dom/indexedDB/FileStream.cpp | 2 +- dom/indexedDB/IDBCursor.cpp | 2 +- dom/indexedDB/IDBIndex.cpp | 8 ++-- dom/indexedDB/IDBObjectStore.cpp | 4 +- dom/plugins/base/nsNPAPIPlugin.cpp | 2 +- dom/plugins/ipc/BrowserStreamParent.cpp | 2 +- dom/plugins/ipc/PluginModuleChild.cpp | 2 +- dom/plugins/ipc/PluginModuleParent.cpp | 2 +- dom/src/json/nsJSON.cpp | 4 +- dom/telephony/TelephonyCommon.h | 2 +- dom/workers/ScriptLoader.cpp | 10 ++--- dom/workers/WorkerPrivate.cpp | 10 ++--- dom/workers/XMLHttpRequest.cpp | 16 +++---- editor/libeditor/html/nsHTMLDataTransfer.cpp | 2 +- .../browser/webBrowser/nsEmbedStream.cpp | 2 +- .../windowwatcher/src/nsWindowWatcher.cpp | 20 ++++----- extensions/gio/nsGIOProtocolHandler.cpp | 2 +- .../gnomevfs/nsGnomeVFSProtocolHandler.cpp | 6 +-- .../pref/autoconfig/src/nsReadConfig.cpp | 2 +- .../spellcheck/src/mozInlineSpellWordUtil.cpp | 2 +- gfx/gl/GLContextProviderEGL.cpp | 2 +- gfx/layers/Layers.h | 2 +- gfx/layers/basic/BasicLayerManager.cpp | 2 +- gfx/layers/basic/BasicLayers.h | 2 +- gfx/layers/opengl/LayerManagerOGL.cpp | 2 +- gfx/src/nsCoord.h | 6 +-- gfx/src/nsRegion.cpp | 4 +- gfx/tests/TestColorNames.cpp | 2 +- gfx/thebes/gfxASurface.cpp | 2 +- gfx/thebes/gfxDWriteShaper.cpp | 2 +- gfx/thebes/gfxFont.cpp | 2 +- gfx/thebes/gfxFont.h | 6 +-- gfx/thebes/gfxFontUtils.cpp | 2 +- image/decoders/nsPNGDecoder.cpp | 2 +- image/src/imgTools.cpp | 2 +- intl/lwbrk/src/nsJISx4501LineBreaker.cpp | 2 +- ipc/glue/Shmem.cpp | 2 +- ipc/glue/SyncChannel.cpp | 2 +- js/xpconnect/loader/mozJSComponentLoader.cpp | 4 +- js/xpconnect/src/XPCConvert.cpp | 8 ++-- js/xpconnect/src/XPCWrappedNative.cpp | 4 +- layout/base/FrameLayerBuilder.cpp | 2 +- layout/base/FrameLayerBuilder.h | 2 +- layout/base/nsCounterManager.h | 6 +-- layout/base/nsDisplayList.h | 2 +- layout/base/nsLayoutUtils.cpp | 2 +- layout/base/nsLayoutUtils.h | 2 +- layout/base/nsPresShell.cpp | 2 +- layout/base/nsQuoteList.h | 2 +- layout/generic/nsBlockFrame.cpp | 4 +- layout/generic/nsColumnSetFrame.cpp | 10 ++--- layout/generic/nsFrameSetFrame.cpp | 4 +- layout/generic/nsIFrame.h | 2 +- layout/generic/nsLineBox.h | 2 +- layout/generic/nsLineLayout.cpp | 4 +- layout/generic/nsLineLayout.h | 4 +- layout/generic/nsObjectFrame.cpp | 4 +- layout/generic/nsTextFrame.h | 2 +- layout/generic/nsTextFrameThebes.cpp | 42 +++++++++---------- layout/style/Declaration.cpp | 2 +- layout/style/StyleRule.cpp | 2 +- layout/style/StyleRule.h | 2 +- layout/style/nsAnimationManager.cpp | 2 +- layout/style/nsCSSDataBlock.h | 2 +- layout/style/nsCSSRules.cpp | 4 +- layout/style/nsCSSScanner.cpp | 4 +- layout/style/nsCSSStyleSheet.cpp | 4 +- layout/style/nsFontFaceLoader.cpp | 2 +- layout/style/nsStyleContext.cpp | 2 +- layout/style/nsStyleContext.h | 4 +- layout/style/nsStyleStruct.cpp | 2 +- layout/svg/nsSVGUtils.h | 4 +- layout/xul/base/src/nsMenuPopupFrame.cpp | 2 +- layout/xul/base/src/nsXULPopupManager.cpp | 2 +- modules/libjar/nsJAR.cpp | 2 +- modules/libjar/nsJARChannel.cpp | 2 +- modules/libjar/nsZipArchive.cpp | 2 +- modules/libpref/src/Preferences.cpp | 2 +- netwerk/base/public/nsASocketHandler.h | 6 +-- netwerk/base/public/nsICryptoHMAC.idl | 2 +- netwerk/base/public/nsICryptoHash.idl | 2 +- .../base/public/nsIProtocolProxyService.idl | 2 +- netwerk/base/public/nsISocketTransport.idl | 2 +- netwerk/base/public/nsNetUtil.h | 2 +- netwerk/base/src/nsBaseChannel.cpp | 2 +- netwerk/base/src/nsInputStreamPump.cpp | 6 +-- netwerk/base/src/nsProtocolProxyService.cpp | 4 +- netwerk/base/src/nsProxyInfo.h | 2 +- netwerk/base/src/nsSocketTransport2.cpp | 6 +-- .../base/src/nsSocketTransportService2.cpp | 8 ++-- netwerk/base/src/nsStandardURL.cpp | 2 +- netwerk/base/src/nsStreamLoader.cpp | 2 +- netwerk/base/src/nsSyncStreamListener.cpp | 2 +- netwerk/cache/nsCacheEntryDescriptor.cpp | 2 +- netwerk/cookie/nsCookieService.cpp | 2 +- netwerk/protocol/about/nsAboutCacheEntry.cpp | 2 +- netwerk/protocol/data/nsDataChannel.cpp | 2 +- .../protocol/device/GonkCaptureProvider.cpp | 2 +- netwerk/protocol/file/nsFileChannel.cpp | 2 +- netwerk/protocol/http/HttpChannelChild.cpp | 2 +- netwerk/protocol/http/nsHttpChannel.cpp | 2 +- netwerk/protocol/http/nsHttpConnectionMgr.cpp | 4 +- netwerk/protocol/http/nsHttpHeaderArray.h | 4 +- netwerk/protocol/http/nsHttpPipeline.cpp | 2 +- netwerk/protocol/http/nsHttpTransaction.cpp | 2 +- .../protocol/websocket/WebSocketChannel.cpp | 4 +- .../converters/nsFTPDirListingConv.cpp | 2 +- netwerk/streamconv/test/Converters.cpp | 2 +- netwerk/streamconv/test/TestStreamConv.cpp | 4 +- parser/html/nsHtml5Highlighter.cpp | 6 +-- parser/html/nsHtml5MetaScanner.cpp | 38 ++++++++--------- parser/html/nsHtml5Parser.cpp | 2 +- parser/html/nsHtml5StringParser.cpp | 4 +- parser/html/nsHtml5Tokenizer.cpp | 6 +-- parser/html/nsHtml5TreeBuilder.h | 2 +- parser/html/nsHtml5TreeBuilderCppSupplement.h | 4 +- parser/htmlparser/src/nsScannerString.cpp | 2 +- parser/xml/src/nsSAXXMLReader.cpp | 4 +- rdf/base/src/nsInMemoryDataSource.cpp | 4 +- rdf/base/src/nsRDFXMLDataSource.cpp | 4 +- security/manager/ssl/src/nsNSSComponent.cpp | 8 ++-- startupcache/StartupCacheUtils.cpp | 4 +- storage/src/Variant.h | 2 +- toolkit/components/places/Helpers.cpp | 2 +- toolkit/components/places/History.cpp | 4 +- .../components/places/nsFaviconService.cpp | 8 ++-- toolkit/components/places/nsNavBookmarks.cpp | 14 +++---- .../components/places/nsNavHistoryResult.cpp | 12 +++--- .../components/places/nsNavHistoryResult.h | 2 +- .../places/nsPlacesExportService.cpp | 2 +- .../components/url-classifier/HashStore.cpp | 2 +- .../exthandler/ExternalHelperAppParent.cpp | 2 +- view/src/nsViewManager.cpp | 2 +- widget/android/nsWindow.cpp | 2 +- widget/cocoa/nsChildView.mm | 2 +- widget/cocoa/nsIdleServiceX.mm | 2 +- widget/cocoa/nsNativeThemeCocoa.mm | 4 +- widget/cocoa/nsPrintDialogX.mm | 2 +- widget/gtk2/nsGtkIMModule.cpp | 18 ++++---- widget/gtk2/nsGtkKeyUtils.cpp | 2 +- widget/gtk2/nsWindow.cpp | 4 +- widget/nsGUIEvent.h | 2 +- widget/nsIRollupListener.h | 2 +- widget/os2/nsWindow.cpp | 6 +-- widget/os2/os2FrameWindow.cpp | 2 +- widget/qt/nsWindow.cpp | 2 +- widget/windows/WinUtils.cpp | 2 +- widget/windows/nsIMM32Handler.cpp | 4 +- widget/windows/nsTextStore.cpp | 10 ++--- widget/windows/nsWindow.cpp | 6 +-- widget/xpwidgets/PuppetWidget.cpp | 4 +- widget/xpwidgets/nsIdleService.cpp | 10 ++--- widget/xpwidgets/nsNativeTheme.cpp | 4 +- xpcom/base/nsCycleCollector.cpp | 6 +-- xpcom/build/FileLocation.cpp | 4 +- xpcom/build/nsXPCOMStrings.cpp | 20 ++++----- xpcom/ds/nsArray.cpp | 2 +- xpcom/ds/nsAtomTable.cpp | 2 +- xpcom/glue/FileUtils.cpp | 2 +- xpcom/glue/nsStringAPI.cpp | 6 +-- xpcom/glue/nsStringAPI.h | 40 +++++++++--------- xpcom/glue/nsVersionComparator.cpp | 2 +- xpcom/io/Base64.cpp | 6 +-- xpcom/io/nsEscape.cpp | 6 +-- xpcom/io/nsIPipe.idl | 6 +-- xpcom/io/nsIStorageStream.idl | 2 +- xpcom/io/nsPipe3.cpp | 6 +-- xpcom/io/nsScriptableInputStream.cpp | 2 +- xpcom/io/nsStreamUtils.cpp | 2 +- xpcom/io/nsStreamUtils.h | 2 +- xpcom/string/public/nsReadableUtils.h | 2 +- xpcom/string/src/nsReadableUtils.cpp | 2 +- xpcom/tests/TestPipes.cpp | 6 +-- xpcom/tests/TestStorageStream.cpp | 2 +- xpcom/tests/TestStreamUtils.cpp | 4 +- xpcom/tests/TestStrings.cpp | 4 +- xpcom/tests/TestTArray.cpp | 4 +- xpcom/tests/external/TestMinStringAPI.cpp | 6 +-- xpcom/threads/LazyIdleThread.cpp | 6 +-- 230 files changed, 485 insertions(+), 485 deletions(-) diff --git a/accessible/src/base/nsAccessibilityService.cpp b/accessible/src/base/nsAccessibilityService.cpp index e090b81bf0cbe..c399a8e4a732a 100644 --- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -955,7 +955,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode, // Create accessible for visible text frames. if (content->IsNodeOfType(nsINode::eTEXT)) { nsAutoString text; - weakFrame->GetRenderedText(&text, nullptr, nullptr, 0, PR_UINT32_MAX); + weakFrame->GetRenderedText(&text, nullptr, nullptr, 0, UINT32_MAX); if (text.IsEmpty()) { if (aIsSubtreeHidden) *aIsSubtreeHidden = true; diff --git a/accessible/src/generic/Accessible.h b/accessible/src/generic/Accessible.h index cff577e6b0308..47387b821401a 100644 --- a/accessible/src/generic/Accessible.h +++ b/accessible/src/generic/Accessible.h @@ -452,7 +452,7 @@ class Accessible : public nsAccessNodeWrap, * then text form start offset till the end is appended */ virtual void AppendTextTo(nsAString& aText, uint32_t aStartOffset = 0, - uint32_t aLength = PR_UINT32_MAX); + uint32_t aLength = UINT32_MAX); /** * Assert if child not in parent's cache if the cache was initialized at this diff --git a/accessible/src/generic/TextLeafAccessible.h b/accessible/src/generic/TextLeafAccessible.h index b659cfb09711b..71db7c82eae68 100644 --- a/accessible/src/generic/TextLeafAccessible.h +++ b/accessible/src/generic/TextLeafAccessible.h @@ -23,7 +23,7 @@ class TextLeafAccessible : public LinkableAccessible // Accessible virtual mozilla::a11y::role NativeRole(); virtual void AppendTextTo(nsAString& aText, uint32_t aStartOffset = 0, - uint32_t aLength = PR_UINT32_MAX); + uint32_t aLength = UINT32_MAX); virtual ENameValueFlag Name(nsString& aName); // TextLeafAccessible diff --git a/accessible/src/html/HTMLListAccessible.h b/accessible/src/html/HTMLListAccessible.h index b31b2b1e856b4..238ec0ef1db94 100644 --- a/accessible/src/html/HTMLListAccessible.h +++ b/accessible/src/html/HTMLListAccessible.h @@ -86,7 +86,7 @@ class HTMLListBulletAccessible : public LeafAccessible virtual a11y::role NativeRole(); virtual uint64_t NativeState(); virtual void AppendTextTo(nsAString& aText, uint32_t aStartOffset = 0, - uint32_t aLength = PR_UINT32_MAX); + uint32_t aLength = UINT32_MAX); // HTMLListBulletAccessible diff --git a/caps/idl/nsIScriptSecurityManager.idl b/caps/idl/nsIScriptSecurityManager.idl index 1efff1d067668..047568f0ce3d6 100644 --- a/caps/idl/nsIScriptSecurityManager.idl +++ b/caps/idl/nsIScriptSecurityManager.idl @@ -271,7 +271,7 @@ interface nsIScriptSecurityManager : nsIXPCSecurityManager const unsigned long NO_APP_ID = 0; - const unsigned long UNKNOWN_APP_ID = 4294967295; // PR_UINT32_MAX + const unsigned long UNKNOWN_APP_ID = 4294967295; // UINT32_MAX /** * Returns the extended origin for the uri. diff --git a/content/base/src/WebSocket.cpp b/content/base/src/WebSocket.cpp index aca1ed2f0c205..ff16884f7a13a 100644 --- a/content/base/src/WebSocket.cpp +++ b/content/base/src/WebSocket.cpp @@ -1264,7 +1264,7 @@ WebSocket::Send(nsIDOMBlob* aData, return; } - if (msgLength > PR_UINT32_MAX) { + if (msgLength > UINT32_MAX) { aRv.Throw(NS_ERROR_FILE_TOO_BIG); return; } diff --git a/content/base/src/nsAttrValue.h b/content/base/src/nsAttrValue.h index b4e0003171ec6..86ae9ebdcb642 100644 --- a/content/base/src/nsAttrValue.h +++ b/content/base/src/nsAttrValue.h @@ -279,7 +279,7 @@ class nsAttrValue { * @return whether the value could be parsed */ bool ParseIntValue(const nsAString& aString) { - return ParseIntWithBounds(aString, PR_INT32_MIN, PR_INT32_MAX); + return ParseIntWithBounds(aString, INT32_MIN, INT32_MAX); } /** @@ -291,7 +291,7 @@ class nsAttrValue { * @return whether the value could be parsed */ bool ParseIntWithBounds(const nsAString& aString, int32_t aMin, - int32_t aMax = PR_INT32_MAX); + int32_t aMax = INT32_MAX); /** * Parse a string value into a non-negative integer. diff --git a/content/base/src/nsContentList.cpp b/content/base/src/nsContentList.cpp index b82d6160a252b..49502c122120f 100644 --- a/content/base/src/nsContentList.cpp +++ b/content/base/src/nsContentList.cpp @@ -577,7 +577,7 @@ nsContentList::Item(uint32_t aIndex, bool aDoFlush) } if (mState != LIST_UP_TO_DATE) - PopulateSelf(NS_MIN(aIndex, PR_UINT32_MAX - 1) + 1); + PopulateSelf(NS_MIN(aIndex, UINT32_MAX - 1) + 1); ASSERT_IN_SYNC; NS_ASSERTION(!mRootNode || mState != LIST_DIRTY, diff --git a/content/base/src/nsContentList.h b/content/base/src/nsContentList.h index 29bda6fa31c2f..3bf6f746496a2 100644 --- a/content/base/src/nsContentList.h +++ b/content/base/src/nsContentList.h @@ -28,7 +28,7 @@ // Magic namespace id that means "match all namespaces". This is // negative so it won't collide with actual namespace constants. -#define kNameSpaceID_Wildcard PR_INT32_MIN +#define kNameSpaceID_Wildcard INT32_MIN // This is a callback function type that can be used to implement an // arbitrary matching algorithm. aContent is the content that may diff --git a/content/base/src/nsDOMFile.cpp b/content/base/src/nsDOMFile.cpp index 4e6504a0c7b7e..3cb76e555fb65 100644 --- a/content/base/src/nsDOMFile.cpp +++ b/content/base/src/nsDOMFile.cpp @@ -653,7 +653,7 @@ nsDOMMemoryFile::CreateSlice(uint64_t aStart, uint64_t aLength, NS_IMETHODIMP nsDOMMemoryFile::GetInternalStream(nsIInputStream **aStream) { - if (mLength > PR_INT32_MAX) + if (mLength > INT32_MAX) return NS_ERROR_FAILURE; return DataOwnerAdapter::Create(mDataOwner, mStart, mLength, aStream); diff --git a/content/base/src/nsDOMFileReader.cpp b/content/base/src/nsDOMFileReader.cpp index 5c889c70ede6e..8f789abe0dc9f 100644 --- a/content/base/src/nsDOMFileReader.cpp +++ b/content/base/src/nsDOMFileReader.cpp @@ -294,7 +294,7 @@ nsDOMFileReader::DoOnDataAvailable(nsIRequest *aRequest, NS_ASSERTION(mResult.Length() == aOffset, "unexpected mResult length"); uint32_t oldLen = mResult.Length(); - if (uint64_t(oldLen) + aCount > PR_UINT32_MAX) + if (uint64_t(oldLen) + aCount > UINT32_MAX) return NS_ERROR_OUT_OF_MEMORY; PRUnichar *buf = nullptr; @@ -314,7 +314,7 @@ nsDOMFileReader::DoOnDataAvailable(nsIRequest *aRequest, } else { //Update memory buffer to reflect the contents of the file - if (aOffset + aCount > PR_UINT32_MAX) { + if (aOffset + aCount > UINT32_MAX) { // PR_Realloc doesn't support over 4GB memory size even if 64-bit OS return NS_ERROR_OUT_OF_MEMORY; } diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index d9d7adab1c7f8..fde7e2d738388 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -8238,7 +8238,7 @@ nsresult nsIDocument::ScheduleFrameRequestCallback(nsIFrameRequestCallback* aCallback, int32_t *aHandle) { - if (mFrameRequestCallbackCounter == PR_INT32_MAX) { + if (mFrameRequestCallbackCounter == INT32_MAX) { // Can't increment without overflowing; bail out return NS_ERROR_NOT_AVAILABLE; } diff --git a/content/base/src/nsFrameMessageManager.cpp b/content/base/src/nsFrameMessageManager.cpp index cc56ed8890446..c3bbbb3b57fe3 100644 --- a/content/base/src/nsFrameMessageManager.cpp +++ b/content/base/src/nsFrameMessageManager.cpp @@ -901,11 +901,11 @@ nsFrameScriptExecutor::TryCacheLoadAndCompileScript(const nsAString& aURL, nsString dataString; uint64_t avail64 = 0; if (input && NS_SUCCEEDED(input->Available(&avail64)) && avail64) { - if (avail64 > PR_UINT32_MAX) { + if (avail64 > UINT32_MAX) { return; } nsCString buffer; - uint32_t avail = (uint32_t)NS_MIN(avail64, (uint64_t)PR_UINT32_MAX); + uint32_t avail = (uint32_t)NS_MIN(avail64, (uint64_t)UINT32_MAX); if (NS_FAILED(NS_ReadInputStreamToString(input, buffer, avail))) { return; } diff --git a/content/base/src/nsNodeInfo.cpp b/content/base/src/nsNodeInfo.cpp index 194ec62e93c16..8b1c64a1a9fdd 100644 --- a/content/base/src/nsNodeInfo.cpp +++ b/content/base/src/nsNodeInfo.cpp @@ -134,7 +134,7 @@ nsNodeInfo::nsNodeInfo(nsIAtom *aName, nsIAtom *aPrefix, int32_t aNamespaceID, SetDOMStringToNull(mLocalName); break; default: - NS_ABORT_IF_FALSE(aNodeType == PR_UINT16_MAX, + NS_ABORT_IF_FALSE(aNodeType == UINT16_MAX, "Unknown node type"); } } diff --git a/content/base/src/nsNodeInfo.h b/content/base/src/nsNodeInfo.h index 5835fa6de2f04..ba6875fef2282 100644 --- a/content/base/src/nsNodeInfo.h +++ b/content/base/src/nsNodeInfo.h @@ -81,7 +81,7 @@ CheckValidNodeInfo(uint16_t aNodeType, nsIAtom *aName, int32_t aNamespaceID, aNodeType == nsIDOMNode::DOCUMENT_NODE || aNodeType == nsIDOMNode::DOCUMENT_TYPE_NODE || aNodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE || - aNodeType == PR_UINT16_MAX, + aNodeType == UINT16_MAX, "Invalid nodeType"); NS_ABORT_IF_FALSE((aNodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE || aNodeType == nsIDOMNode::DOCUMENT_TYPE_NODE) == @@ -89,7 +89,7 @@ CheckValidNodeInfo(uint16_t aNodeType, nsIAtom *aName, int32_t aNamespaceID, "Supply aExtraName for and only for PIs and doctypes"); NS_ABORT_IF_FALSE(aNodeType == nsIDOMNode::ELEMENT_NODE || aNodeType == nsIDOMNode::ATTRIBUTE_NODE || - aNodeType == PR_UINT16_MAX || + aNodeType == UINT16_MAX || aNamespaceID == kNameSpaceID_None, "Only attributes and elements can be in a namespace"); NS_ABORT_IF_FALSE(aName && aName != nsGkAtoms::_empty, "Invalid localName"); diff --git a/content/base/src/nsSyncLoadService.cpp b/content/base/src/nsSyncLoadService.cpp index 42c35177ff253..fd324ee45081f 100644 --- a/content/base/src/nsSyncLoadService.cpp +++ b/content/base/src/nsSyncLoadService.cpp @@ -342,7 +342,7 @@ nsSyncLoadService::PushSyncStreamToListener(nsIInputStream* aIn, if (NS_FAILED(rv)) { chunkSize = 4096; } - chunkSize = NS_MIN(int32_t(PR_UINT16_MAX), chunkSize); + chunkSize = NS_MIN(int32_t(UINT16_MAX), chunkSize); rv = NS_NewBufferedInputStream(getter_AddRefs(bufferedStream), aIn, chunkSize); @@ -366,11 +366,11 @@ nsSyncLoadService::PushSyncStreamToListener(nsIInputStream* aIn, break; } - if (readCount > PR_UINT32_MAX) - readCount = PR_UINT32_MAX; + if (readCount > UINT32_MAX) + readCount = UINT32_MAX; rv = aListener->OnDataAvailable(aChannel, nullptr, aIn, - (uint32_t)NS_MIN(sourceOffset, (uint64_t)PR_UINT32_MAX), + (uint32_t)NS_MIN(sourceOffset, (uint64_t)UINT32_MAX), (uint32_t)readCount); if (NS_FAILED(rv)) { break; diff --git a/content/base/src/nsXMLHttpRequest.cpp b/content/base/src/nsXMLHttpRequest.cpp index 4ab4e9ada91cf..f0427bff8fd53 100644 --- a/content/base/src/nsXMLHttpRequest.cpp +++ b/content/base/src/nsXMLHttpRequest.cpp @@ -2443,7 +2443,7 @@ GetRequestBody(nsIDOMDocument* aDoc, nsIInputStream** aResult, NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr storStream; - rv = NS_NewStorageStream(4096, PR_UINT32_MAX, getter_AddRefs(storStream)); + rv = NS_NewStorageStream(4096, UINT32_MAX, getter_AddRefs(storStream)); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr output; diff --git a/content/events/src/nsContentEventHandler.cpp b/content/events/src/nsContentEventHandler.cpp index 090ff70ac33a1..c827808716cfc 100644 --- a/content/events/src/nsContentEventHandler.cpp +++ b/content/events/src/nsContentEventHandler.cpp @@ -181,7 +181,7 @@ static uint32_t CountNewlinesInXPLength(nsIContent* aContent, return 0; // For automated tests, we should abort on debug build. NS_ABORT_IF_FALSE( - (aXPLength == PR_UINT32_MAX || aXPLength <= text->GetLength()), + (aXPLength == UINT32_MAX || aXPLength <= text->GetLength()), "aXPLength is out-of-bounds"); const uint32_t length = NS_MIN(aXPLength, text->GetLength()); uint32_t newlines = 0; @@ -204,7 +204,7 @@ static uint32_t CountNewlinesInNativeLength(nsIContent* aContent, } // For automated tests, we should abort on debug build. NS_ABORT_IF_FALSE( - (aNativeLength == PR_UINT32_MAX || aNativeLength <= text->GetLength() * 2), + (aNativeLength == UINT32_MAX || aNativeLength <= text->GetLength() * 2), "aNativeLength is unexpected value"); const uint32_t xpLength = text->GetLength(); uint32_t newlines = 0; @@ -222,7 +222,7 @@ static uint32_t CountNewlinesInNativeLength(nsIContent* aContent, } #endif -static uint32_t GetNativeTextLength(nsIContent* aContent, uint32_t aMaxLength = PR_UINT32_MAX) +static uint32_t GetNativeTextLength(nsIContent* aContent, uint32_t aMaxLength = UINT32_MAX) { if (aContent->IsNodeOfType(nsINode::eTEXT)) { uint32_t textLengthDifference = diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 34c2c4c5b12b4..1879d209d1240 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -5252,7 +5252,7 @@ nsEventStateManager::DeltaAccumulator::Reset() { mX = mY = 0.0; mPendingScrollAmountX = mPendingScrollAmountY = 0.0; - mHandlingDeltaMode = PR_UINT32_MAX; + mHandlingDeltaMode = UINT32_MAX; mHandlingPixelOnlyDevice = false; } diff --git a/content/events/src/nsEventStateManager.h b/content/events/src/nsEventStateManager.h index e8bc1d8d4928b..b2f2e5247230b 100644 --- a/content/events/src/nsEventStateManager.h +++ b/content/events/src/nsEventStateManager.h @@ -558,7 +558,7 @@ class nsEventStateManager : public nsSupportsWeakReference, sInstance = nullptr; } - bool IsInTransaction() { return mHandlingDeltaMode != PR_UINT32_MAX; } + bool IsInTransaction() { return mHandlingDeltaMode != UINT32_MAX; } /** * InitLineOrPageDelta() stores pixel delta values of WheelEvents which are @@ -585,7 +585,7 @@ class nsEventStateManager : public nsSupportsWeakReference, private: DeltaAccumulator() : mX(0.0), mY(0.0), mPendingScrollAmountX(0.0), mPendingScrollAmountY(0.0), - mHandlingDeltaMode(PR_UINT32_MAX), mHandlingPixelOnlyDevice(false) + mHandlingDeltaMode(UINT32_MAX), mHandlingPixelOnlyDevice(false) { } diff --git a/content/html/content/src/nsHTMLCanvasElement.cpp b/content/html/content/src/nsHTMLCanvasElement.cpp index bd5d90fe11370..e370152419832 100644 --- a/content/html/content/src/nsHTMLCanvasElement.cpp +++ b/content/html/content/src/nsHTMLCanvasElement.cpp @@ -545,7 +545,7 @@ nsHTMLCanvasElement::ToDataURLImpl(const nsAString& aMimeType, uint64_t count; rv = stream->Available(&count); NS_ENSURE_SUCCESS(rv, rv); - NS_ENSURE_TRUE(count <= PR_UINT32_MAX, NS_ERROR_FILE_TOO_BIG); + NS_ENSURE_TRUE(count <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG); return Base64EncodeInputStream(stream, aDataURL, (uint32_t)count, aDataURL.Length()); } @@ -585,7 +585,7 @@ nsHTMLCanvasElement::MozGetAsFileImpl(const nsAString& aName, uint64_t imgSize; rv = stream->Available(&imgSize); NS_ENSURE_SUCCESS(rv, rv); - NS_ENSURE_TRUE(imgSize <= PR_UINT32_MAX, NS_ERROR_FILE_TOO_BIG); + NS_ENSURE_TRUE(imgSize <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG); void* imgData = nullptr; rv = NS_ReadInputStreamToBuffer(stream, &imgData, (uint32_t)imgSize); diff --git a/content/media/AudioSegment.cpp b/content/media/AudioSegment.cpp index 8e19afc8bb065..27eeb8206b0b7 100644 --- a/content/media/AudioSegment.cpp +++ b/content/media/AudioSegment.cpp @@ -161,7 +161,7 @@ AudioSegment::WriteTo(nsAudioStream* aOutput) uint32_t frameSize = GetSampleSize(aOutput->GetFormat())*mChannels; for (ChunkIterator ci(*this); !ci.IsEnded(); ci.Next()) { AudioChunk& c = *ci; - if (frameSize*c.mDuration > PR_UINT32_MAX) { + if (frameSize*c.mDuration > UINT32_MAX) { NS_ERROR("Buffer overflow"); return; } diff --git a/content/media/FileBlockCache.cpp b/content/media/FileBlockCache.cpp index 88fe8ef3aa0e3..590a291983afe 100644 --- a/content/media/FileBlockCache.cpp +++ b/content/media/FileBlockCache.cpp @@ -238,7 +238,7 @@ nsresult FileBlockCache::Read(int64_t aOffset, { MonitorAutoLock mon(mDataMonitor); - if (!mFD || (aOffset / BLOCK_SIZE) > PR_INT32_MAX) + if (!mFD || (aOffset / BLOCK_SIZE) > INT32_MAX) return NS_ERROR_FAILURE; int32_t bytesToRead = aLength; diff --git a/content/media/MediaResource.cpp b/content/media/MediaResource.cpp index 19908f93d4791..498981d318dca 100644 --- a/content/media/MediaResource.cpp +++ b/content/media/MediaResource.cpp @@ -1069,7 +1069,7 @@ void FileMediaResource::EnsureSizeInitialized() // Get the file size and inform the decoder. uint64_t size; nsresult res = mInput->Available(&size); - if (NS_SUCCEEDED(res) && size <= PR_INT64_MAX) { + if (NS_SUCCEEDED(res) && size <= INT64_MAX) { mSize = (int64_t)size; nsCOMPtr event = new LoadedEvent(mDecoder); NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL); diff --git a/content/media/MediaSegment.h b/content/media/MediaSegment.h index 89e54f12372fe..a3aca47e5098f 100644 --- a/content/media/MediaSegment.h +++ b/content/media/MediaSegment.h @@ -16,7 +16,7 @@ namespace mozilla { */ typedef int64_t MediaTime; const int64_t MEDIA_TIME_FRAC_BITS = 20; -const int64_t MEDIA_TIME_MAX = PR_INT64_MAX; +const int64_t MEDIA_TIME_MAX = INT64_MAX; inline MediaTime MillisecondsToMediaTime(int32_t aMS) { @@ -41,7 +41,7 @@ inline double MediaTimeToSeconds(MediaTime aTime) * 2^MEDIA_TIME_FRAC_BITS doesn't overflow, so we set its max accordingly. */ typedef int64_t TrackTicks; -const int64_t TRACK_TICKS_MAX = PR_INT64_MAX >> MEDIA_TIME_FRAC_BITS; +const int64_t TRACK_TICKS_MAX = INT64_MAX >> MEDIA_TIME_FRAC_BITS; /** * A MediaSegment is a chunk of media data sequential in time. Different diff --git a/content/media/TimeVarying.h b/content/media/TimeVarying.h index 109f1d58475d5..3ebab04e1d548 100644 --- a/content/media/TimeVarying.h +++ b/content/media/TimeVarying.h @@ -81,13 +81,13 @@ class TimeVarying : public TimeVaryingBase { /** * Returns the final value of the function. If aTime is non-null, * sets aTime to the time at which the function changes to that final value. - * If there are no changes after the current time, returns PR_INT64_MIN in aTime. + * If there are no changes after the current time, returns INT64_MIN in aTime. */ const T& GetLast(Time* aTime = nullptr) const { if (mChanges.IsEmpty()) { if (aTime) { - *aTime = PR_INT64_MIN; + *aTime = INT64_MIN; } return mCurrent; } @@ -119,10 +119,10 @@ class TimeVarying : public TimeVaryingBase { /** * Returns the value of the function at time aTime. * If aEnd is non-null, sets *aEnd to the time at which the function will - * change from the returned value to a new value, or PR_INT64_MAX if that + * change from the returned value to a new value, or INT64_MAX if that * never happens. * If aStart is non-null, sets *aStart to the time at which the function - * changed to the returned value, or PR_INT64_MIN if that happened at or + * changed to the returned value, or INT64_MIN if that happened at or * before the current time. * * Currently uses a linear search, but could use a binary search. @@ -131,17 +131,17 @@ class TimeVarying : public TimeVaryingBase { { if (mChanges.IsEmpty() || aTime < mChanges[0].mTime) { if (aStart) { - *aStart = PR_INT64_MIN; + *aStart = INT64_MIN; } if (aEnd) { - *aEnd = mChanges.IsEmpty() ? PR_INT64_MAX : mChanges[0].mTime; + *aEnd = mChanges.IsEmpty() ? INT64_MAX : mChanges[0].mTime; } return mCurrent; } int32_t changesLength = mChanges.Length(); if (mChanges[changesLength - 1].mTime <= aTime) { if (aEnd) { - *aEnd = PR_INT64_MAX; + *aEnd = INT64_MAX; } if (aStart) { *aStart = mChanges[changesLength - 1].mTime; diff --git a/content/media/VideoUtils.cpp b/content/media/VideoUtils.cpp index 8c974f2c00036..6083f6401dfba 100644 --- a/content/media/VideoUtils.cpp +++ b/content/media/VideoUtils.cpp @@ -25,7 +25,7 @@ CheckedInt64 UsecsToFrames(int64_t aUsecs, uint32_t aRate) { static int32_t ConditionDimension(float aValue) { // This will exclude NaNs and too-big values. - if (aValue > 1.0 && aValue <= PR_INT32_MAX) + if (aValue > 1.0 && aValue <= INT32_MAX) return int32_t(NS_round(aValue)); return 0; } diff --git a/content/media/nsAudioStream.cpp b/content/media/nsAudioStream.cpp index bab777b020fd5..2094b4924db09 100644 --- a/content/media/nsAudioStream.cpp +++ b/content/media/nsAudioStream.cpp @@ -609,7 +609,7 @@ int32_t nsNativeAudioStream::GetMinWriteSize() &size); if (r == SA_ERROR_NOT_SUPPORTED) return 1; - else if (r != SA_SUCCESS || size > PR_INT32_MAX) + else if (r != SA_SUCCESS || size > INT32_MAX) return -1; return static_cast(size / mChannels / sizeof(short)); @@ -1152,7 +1152,7 @@ nsBufferedAudioStream::GetPositionInFramesUnlocked() if (position >= mLostFrames) { adjustedPosition = position - mLostFrames; } - return NS_MIN(adjustedPosition, PR_INT64_MAX); + return NS_MIN(adjustedPosition, INT64_MAX); } bool diff --git a/content/media/nsBuiltinDecoderReader.cpp b/content/media/nsBuiltinDecoderReader.cpp index 35092914b717c..7f313301f8416 100644 --- a/content/media/nsBuiltinDecoderReader.cpp +++ b/content/media/nsBuiltinDecoderReader.cpp @@ -22,7 +22,7 @@ using mozilla::layers::PlanarYCbCrImage; // can do less integer overflow checking. PR_STATIC_ASSERT(MAX_VIDEO_WIDTH < PlanarYCbCrImage::MAX_DIMENSION); PR_STATIC_ASSERT(MAX_VIDEO_HEIGHT < PlanarYCbCrImage::MAX_DIMENSION); -PR_STATIC_ASSERT(PlanarYCbCrImage::MAX_DIMENSION < PR_UINT32_MAX / PlanarYCbCrImage::MAX_DIMENSION); +PR_STATIC_ASSERT(PlanarYCbCrImage::MAX_DIMENSION < UINT32_MAX / PlanarYCbCrImage::MAX_DIMENSION); // Un-comment to enable logging of seek bisections. //#define SEEK_LOGGING diff --git a/content/media/nsBuiltinDecoderStateMachine.cpp b/content/media/nsBuiltinDecoderStateMachine.cpp index 6822d8198223c..100423bf1c73c 100644 --- a/content/media/nsBuiltinDecoderStateMachine.cpp +++ b/content/media/nsBuiltinDecoderStateMachine.cpp @@ -588,7 +588,7 @@ void nsBuiltinDecoderStateMachine::SendStreamData() if (mState == DECODER_STATE_DECODING_METADATA) return; - int64_t minLastAudioPacketTime = PR_INT64_MAX; + int64_t minLastAudioPacketTime = INT64_MAX; SourceMediaStream* mediaStream = stream->mStream; StreamTime endPosition = 0; @@ -1106,7 +1106,7 @@ void nsBuiltinDecoderStateMachine::AudioLoop() // and so that audio will not start playing. Write silence to ensure // the last block gets pushed to hardware, so that playback starts. int64_t framesToWrite = minWriteFrames - unplayedFrames; - if (framesToWrite < PR_UINT32_MAX / channels) { + if (framesToWrite < UINT32_MAX / channels) { // Write silence manually rather than using PlaySilence(), so that // the AudioAPI doesn't get a copy of the audio frames. ReentrantMonitorAutoExit exit(mDecoder->GetReentrantMonitor()); @@ -2345,7 +2345,7 @@ void nsBuiltinDecoderStateMachine::Wait(int64_t aUsecs) { IsPlaying()) { int64_t ms = static_cast(NS_round((end - now).ToSeconds() * 1000)); - if (ms == 0 || ms > PR_UINT32_MAX) { + if (ms == 0 || ms > UINT32_MAX) { break; } mDecoder->GetReentrantMonitor().Wait(PR_MillisecondsToInterval(static_cast(ms))); diff --git a/content/media/nsMediaCache.cpp b/content/media/nsMediaCache.cpp index b843dd826706b..0b4aee659b79c 100644 --- a/content/media/nsMediaCache.cpp +++ b/content/media/nsMediaCache.cpp @@ -685,7 +685,7 @@ static int32_t GetMaxBlocks() int32_t cacheSize = Preferences::GetInt("media.cache_size", 500*1024); int64_t maxBlocks = static_cast(cacheSize)*1024/nsMediaCache::BLOCK_SIZE; maxBlocks = NS_MAX(maxBlocks, 1); - return int32_t(NS_MIN(maxBlocks, PR_INT32_MAX)); + return int32_t(NS_MIN(maxBlocks, INT32_MAX)); } int32_t @@ -695,7 +695,7 @@ nsMediaCache::FindBlockForIncomingData(TimeStamp aNow, mReentrantMonitor.AssertCurrentThreadIn(); int32_t blockIndex = FindReusableBlock(aNow, aStream, - aStream->mChannelOffset/BLOCK_SIZE, PR_INT32_MAX); + aStream->mChannelOffset/BLOCK_SIZE, INT32_MAX); if (blockIndex < 0 || !IsBlockFree(blockIndex)) { // The block returned is already allocated. @@ -989,7 +989,7 @@ nsMediaCache::PredictNextUse(TimeStamp aNow, int32_t aBlock) int64_t millisecondsAhead = bytesAhead*1000/bo->mStream->mPlaybackBytesPerSecond; prediction = TimeDuration::FromMilliseconds( - NS_MIN(millisecondsAhead, PR_INT32_MAX)); + NS_MIN(millisecondsAhead, INT32_MAX)); break; } default: @@ -1017,7 +1017,7 @@ nsMediaCache::PredictNextUseForIncomingData(nsMediaCacheStream* aStream) return TimeDuration(0); int64_t millisecondsAhead = bytesAhead*1000/aStream->mPlaybackBytesPerSecond; return TimeDuration::FromMilliseconds( - NS_MIN(millisecondsAhead, PR_INT32_MAX)); + NS_MIN(millisecondsAhead, INT32_MAX)); } enum StreamAction { NONE, SEEK, SEEK_AND_RESUME, RESUME, SUSPEND }; @@ -2098,7 +2098,7 @@ nsMediaCacheStream::Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes) } size = NS_MIN(size, bytesRemaining); // Clamp size until 64-bit file size issues (bug 500784) are fixed. - size = NS_MIN(size, int64_t(PR_INT32_MAX)); + size = NS_MIN(size, int64_t(INT32_MAX)); } int32_t bytes; @@ -2153,7 +2153,7 @@ nsMediaCacheStream::Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes) gMediaCache->NoteBlockUsage(this, cacheBlock, mCurrentMode, TimeStamp::Now()); int64_t offset = cacheBlock*BLOCK_SIZE + offsetInStreamBlock; - NS_ABORT_IF_FALSE(size >= 0 && size <= PR_INT32_MAX, "Size out of range."); + NS_ABORT_IF_FALSE(size >= 0 && size <= INT32_MAX, "Size out of range."); nsresult rv = gMediaCache->ReadCacheFile(offset, aBuffer + count, int32_t(size), &bytes); if (NS_FAILED(rv)) { if (count == 0) @@ -2202,7 +2202,7 @@ nsMediaCacheStream::ReadFromCache(char* aBuffer, } size = NS_MIN(size, bytesRemaining); // Clamp size until 64-bit file size issues (bug 500784) are fixed. - size = NS_MIN(size, int64_t(PR_INT32_MAX)); + size = NS_MIN(size, int64_t(INT32_MAX)); } int32_t bytes; @@ -2221,7 +2221,7 @@ nsMediaCacheStream::ReadFromCache(char* aBuffer, return NS_ERROR_FAILURE; } int64_t offset = cacheBlock*BLOCK_SIZE + offsetInStreamBlock; - NS_ABORT_IF_FALSE(size >= 0 && size <= PR_INT32_MAX, "Size out of range."); + NS_ABORT_IF_FALSE(size >= 0 && size <= INT32_MAX, "Size out of range."); nsresult rv = gMediaCache->ReadCacheFile(offset, aBuffer + count, int32_t(size), &bytes); if (NS_FAILED(rv)) { return rv; diff --git a/content/media/ogg/nsOggCodecState.cpp b/content/media/ogg/nsOggCodecState.cpp index 040c75885c4c0..0cf3a25389b8c 100644 --- a/content/media/ogg/nsOggCodecState.cpp +++ b/content/media/ogg/nsOggCodecState.cpp @@ -933,7 +933,7 @@ bool nsOpusState::DecodeHeader(ogg_packet* aPacket) mGain = static_cast(pow(10,0.05*gain_dB)); #else mGain_Q16 = static_cast(NS_MIN(65536*pow(10,0.05*gain_dB)+0.5, - static_cast(PR_INT32_MAX))); + static_cast(INT32_MAX))); #endif mChannelMapping = aPacket->packet[18]; @@ -1141,7 +1141,7 @@ bool nsOpusState::ReconstructOpusGranulepos(void) ogg_packet* packet = mUnstamped[i]; int offset = GetOpusDeltaGP(packet); // Check for error (negative offset) and overflow. - if (offset >= 0 && gp <= PR_INT64_MAX - offset) { + if (offset >= 0 && gp <= INT64_MAX - offset) { gp += offset; if (gp >= last_gp) { NS_WARNING("Opus end trimming removed more than a full packet."); diff --git a/content/media/ogg/nsOggReader.cpp b/content/media/ogg/nsOggReader.cpp index bb06ee2f8db3e..017b95f7cad55 100644 --- a/content/media/ogg/nsOggReader.cpp +++ b/content/media/ogg/nsOggReader.cpp @@ -874,7 +874,7 @@ int64_t nsOggReader::RangeEndTime(int64_t aStartOffset, readHead = NS_MAX(aStartOffset, readStartOffset); } - int64_t limit = NS_MIN(static_cast(PR_UINT32_MAX), + int64_t limit = NS_MIN(static_cast(UINT32_MAX), aEndOffset - readHead); limit = NS_MAX(static_cast(0), limit); limit = NS_MIN(limit, static_cast(step)); @@ -1292,7 +1292,7 @@ PageSync(MediaResource* aResource, // Read from the file into the buffer int64_t bytesToRead = NS_MIN(static_cast(PAGE_STEP), aEndOffset - readHead); - NS_ASSERTION(bytesToRead <= PR_UINT32_MAX, "bytesToRead range check"); + NS_ASSERTION(bytesToRead <= UINT32_MAX, "bytesToRead range check"); if (bytesToRead <= 0) { return PAGE_SYNC_END_OF_RANGE; } @@ -1366,7 +1366,7 @@ nsresult nsOggReader::SeekBisection(int64_t aTarget, DebugOnly previousGuess = -1; int backsteps = 0; const int maxBackStep = 10; - NS_ASSERTION(static_cast(PAGE_STEP) * pow(2.0, maxBackStep) < PR_INT32_MAX, + NS_ASSERTION(static_cast(PAGE_STEP) * pow(2.0, maxBackStep) < INT32_MAX, "Backstep calculation must not overflow"); // Seek via bisection search. Loop until we find the offset where the page diff --git a/content/media/wave/nsWaveReader.cpp b/content/media/wave/nsWaveReader.cpp index c31d1317c1429..403f3645e12ea 100644 --- a/content/media/wave/nsWaveReader.cpp +++ b/content/media/wave/nsWaveReader.cpp @@ -179,9 +179,9 @@ bool nsWaveReader::DecodeAudioData() if (mSampleFormat == nsAudioStream::FORMAT_U8) { uint8_t v = ReadUint8(&d); #if defined(MOZ_SAMPLE_TYPE_S16) - *s++ = (v * (1.F/PR_UINT8_MAX)) * PR_UINT16_MAX + PR_INT16_MIN; + *s++ = (v * (1.F/UINT8_MAX)) * UINT16_MAX + INT16_MIN; #elif defined(MOZ_SAMPLE_TYPE_FLOAT32) - *s++ = (v * (1.F/PR_UINT8_MAX)) * 2.F - 1.F; + *s++ = (v * (1.F/UINT8_MAX)) * 2.F - 1.F; #endif } else if (mSampleFormat == nsAudioStream::FORMAT_S16) { @@ -189,7 +189,7 @@ bool nsWaveReader::DecodeAudioData() #if defined(MOZ_SAMPLE_TYPE_S16) *s++ = v; #elif defined(MOZ_SAMPLE_TYPE_FLOAT32) - *s++ = (int32_t(v) - PR_INT16_MIN) / float(PR_UINT16_MAX) * 2.F - 1.F; + *s++ = (int32_t(v) - INT16_MIN) / float(UINT16_MAX) * 2.F - 1.F; #endif } } @@ -199,7 +199,7 @@ bool nsWaveReader::DecodeAudioData() double readSizeTime = BytesToTime(readSize); NS_ASSERTION(posTime <= INT64_MAX / USECS_PER_S, "posTime overflow"); NS_ASSERTION(readSizeTime <= INT64_MAX / USECS_PER_S, "readSizeTime overflow"); - NS_ASSERTION(frames < PR_INT32_MAX, "frames overflow"); + NS_ASSERTION(frames < INT32_MAX, "frames overflow"); mAudioQueue.Push(new AudioData(pos, static_cast(posTime * USECS_PER_S), @@ -421,7 +421,7 @@ nsWaveReader::LoadFormatChunk() extra += extra % 2; if (extra > 0) { - PR_STATIC_ASSERT(PR_UINT16_MAX + (PR_UINT16_MAX % 2) < UINT_MAX / sizeof(char)); + PR_STATIC_ASSERT(UINT16_MAX + (UINT16_MAX % 2) < UINT_MAX / sizeof(char)); nsAutoArrayPtr chunkExtension(new char[extra]); if (!ReadAll(chunkExtension.get(), extra)) { return false; @@ -473,7 +473,7 @@ nsWaveReader::FindDataOffset() } int64_t offset = mDecoder->GetResource()->Tell(); - if (offset <= 0 || offset > PR_UINT32_MAX) { + if (offset <= 0 || offset > UINT32_MAX) { NS_WARNING("PCM data offset out of range"); return false; } diff --git a/content/smil/nsSMILInstanceTime.cpp b/content/smil/nsSMILInstanceTime.cpp index 79fda524aacdc..013ae4bd83401 100644 --- a/content/smil/nsSMILInstanceTime.cpp +++ b/content/smil/nsSMILInstanceTime.cpp @@ -138,7 +138,7 @@ nsSMILInstanceTime::UnmarkShouldPreserve() void nsSMILInstanceTime::AddRefFixedEndpoint() { - NS_ABORT_IF_FALSE(mFixedEndpointRefCnt < PR_UINT16_MAX, + NS_ABORT_IF_FALSE(mFixedEndpointRefCnt < UINT16_MAX, "Fixed endpoint reference count upper limit reached"); ++mFixedEndpointRefCnt; mFlags &= ~kMayUpdate; // Once fixed, always fixed diff --git a/content/svg/content/src/nsSVGFilters.cpp b/content/svg/content/src/nsSVGFilters.cpp index ca681777a20da..d5ea6cf285e9d 100644 --- a/content/svg/content/src/nsSVGFilters.cpp +++ b/content/svg/content/src/nsSVGFilters.cpp @@ -486,7 +486,7 @@ nsSVGFEGaussianBlurElement::SetStdDeviation(float stdDeviationX, float stdDeviat */ static uint32_t ComputeScaledDivisor(uint32_t aDivisor) { - return PR_UINT32_MAX/(255*aDivisor); + return UINT32_MAX/(255*aDivisor); } static void diff --git a/content/svg/content/src/nsSVGFilters.h b/content/svg/content/src/nsSVGFilters.h index 6c868eba0df06..d14253a463c35 100644 --- a/content/svg/content/src/nsSVGFilters.h +++ b/content/svg/content/src/nsSVGFilters.h @@ -182,7 +182,7 @@ class nsSVGFE : public nsSVGFEBase static nsIntRect GetMaxRect() { // Try to avoid overflow errors dealing with this rect. It will // be intersected with some other reasonable-sized rect eventually. - return nsIntRect(PR_INT32_MIN/2, PR_INT32_MIN/2, PR_INT32_MAX, PR_INT32_MAX); + return nsIntRect(INT32_MIN/2, INT32_MIN/2, INT32_MAX, INT32_MAX); } operator nsISupports*() { return static_cast(this); } diff --git a/content/xslt/src/xslt/txNodeSorter.cpp b/content/xslt/src/xslt/txNodeSorter.cpp index c5c46105b9810..848835148ea0b 100644 --- a/content/xslt/src/xslt/txNodeSorter.cpp +++ b/content/xslt/src/xslt/txNodeSorter.cpp @@ -147,8 +147,8 @@ txNodeSorter::sortNodeSet(txNodeSet* aNodes, txExecutionState* aEs, // Limit resource use to something sane. uint32_t itemSize = sizeof(uint32_t) + mNKeys * sizeof(txObject*); - if (mNKeys > (PR_UINT32_MAX - sizeof(uint32_t)) / sizeof(txObject*) || - len >= PR_UINT32_MAX / itemSize) { + if (mNKeys > (UINT32_MAX - sizeof(uint32_t)) / sizeof(txObject*) || + len >= UINT32_MAX / itemSize) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/content/xul/document/src/nsXULPrototypeCache.cpp b/content/xul/document/src/nsXULPrototypeCache.cpp index 902e7464fdd59..c709a27cbeaf3 100644 --- a/content/xul/document/src/nsXULPrototypeCache.cpp +++ b/content/xul/document/src/nsXULPrototypeCache.cpp @@ -651,7 +651,7 @@ nsXULPrototypeCache::BeginCaching(nsIURI* aURI) uint64_t len64; rv = inputStream->Available(&len64); if (NS_SUCCEEDED(rv)) { - if (len64 <= PR_UINT32_MAX) + if (len64 <= UINT32_MAX) len = (uint32_t)len64; else rv = NS_ERROR_FILE_TOO_BIG; diff --git a/content/xul/document/src/nsXULPrototypeDocument.cpp b/content/xul/document/src/nsXULPrototypeDocument.cpp index 3a115030eb000..e7eba8d87da87 100644 --- a/content/xul/document/src/nsXULPrototypeDocument.cpp +++ b/content/xul/document/src/nsXULPrototypeDocument.cpp @@ -321,11 +321,11 @@ nsXULPrototypeDocument::Read(nsIObjectInputStream* aStream) } nsCOMPtr nodeInfo; - // Using PR_UINT16_MAX here as we don't know which nodeinfos will be + // Using UINT16_MAX here as we don't know which nodeinfos will be // used for attributes and which for elements. And that doesn't really // matter. tmp = mNodeInfoManager->GetNodeInfo(localName, prefix, namespaceURI, - PR_UINT16_MAX, + UINT16_MAX, getter_AddRefs(nodeInfo)); if (NS_FAILED(tmp)) { rv = tmp; diff --git a/content/xul/templates/src/nsTemplateRule.h b/content/xul/templates/src/nsTemplateRule.h index 6794b81f3bb2a..f821dc42e4757 100644 --- a/content/xul/templates/src/nsTemplateRule.h +++ b/content/xul/templates/src/nsTemplateRule.h @@ -294,7 +294,7 @@ class nsTemplateQuerySet { // nsTemplateMatch stores the index as a 16-bit value, // so check to make sure for overflow - if (mRules.Length() == PR_INT16_MAX) + if (mRules.Length() == INT16_MAX) return nullptr; return mRules.AppendElement(nsTemplateRule(aRuleNode, aAction, diff --git a/content/xul/templates/src/nsXULTemplateBuilder.cpp b/content/xul/templates/src/nsXULTemplateBuilder.cpp index f95c8cf34d81f..27408cf64760e 100644 --- a/content/xul/templates/src/nsXULTemplateBuilder.cpp +++ b/content/xul/templates/src/nsXULTemplateBuilder.cpp @@ -1830,7 +1830,7 @@ nsXULTemplateBuilder::CompileTemplate(nsIContent* aTemplate, nsINodeInfo *ni = rulenode->NodeInfo(); // don't allow more queries than can be supported - if (*aPriority == PR_INT16_MAX) + if (*aPriority == INT16_MAX) return NS_ERROR_FAILURE; // XXXndeakin queryset isn't a good name for this tag since it only diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index a5906e8171beb..2c5e27fd31b70 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -9372,7 +9372,7 @@ nsDocShell::AddHeadersToChannel(nsIInputStream *aHeadersData, nsAutoCString headersString; nsresult rv = aHeadersData->ReadSegments(AppendSegmentToString, &headersString, - PR_UINT32_MAX, + UINT32_MAX, &numRead); NS_ENSURE_SUCCESS(rv, rv); diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index f9d2222c5d5ac..66c6dbe7a5ae2 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -9207,7 +9207,7 @@ static inline uint32_t PrivateToFlags(void *priv) { uintptr_t intPriv = reinterpret_cast(priv); - MOZ_ASSERT(intPriv <= PR_UINT32_MAX && (intPriv & 1) == 0); + MOZ_ASSERT(intPriv <= UINT32_MAX && (intPriv & 1) == 0); return static_cast(intPriv >> 1); } diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 187b93cd7a3b2..811a556df6d3a 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -8769,7 +8769,7 @@ nsGlobalWindow::RegisterIdleObserver(nsIIdleObserver* aIdleObserver) tmpIdleObserver.mIdleObserver = aIdleObserver; rv = aIdleObserver->GetTime(&tmpIdleObserver.mTimeInS); NS_ENSURE_SUCCESS(rv, rv); - NS_ENSURE_ARG_MAX(tmpIdleObserver.mTimeInS, PR_UINT32_MAX / 1000); + NS_ENSURE_ARG_MAX(tmpIdleObserver.mTimeInS, UINT32_MAX / 1000); NS_ENSURE_ARG_MIN(tmpIdleObserver.mTimeInS, MIN_IDLE_NOTIFICATION_TIME_S); uint32_t insertAtIndex = FindInsertionIndex(&tmpIdleObserver); diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 467750562a085..8094e55c0064b 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -162,14 +162,14 @@ static bool sPostGCEventsToConsole; static bool sPostGCEventsToObserver; static bool sDisableExplicitCompartmentGC; static uint32_t sCCTimerFireCount = 0; -static uint32_t sMinForgetSkippableTime = PR_UINT32_MAX; +static uint32_t sMinForgetSkippableTime = UINT32_MAX; static uint32_t sMaxForgetSkippableTime = 0; static uint32_t sTotalForgetSkippableTime = 0; static uint32_t sRemovedPurples = 0; static uint32_t sForgetSkippableBeforeCC = 0; static uint32_t sPreviousSuspectedCount = 0; static uint32_t sCompartmentGCCount = NS_MAX_COMPARTMENT_GC_COUNT; -static uint32_t sCleanupsSinceLastGC = PR_UINT32_MAX; +static uint32_t sCleanupsSinceLastGC = UINT32_MAX; static bool sNeedsFullCC = false; static nsJSContext *sContextList = nullptr; @@ -3095,7 +3095,7 @@ nsJSContext::CycleCollectNow(nsICycleCollectorListener *aListener, PRTime delta = GetCollectionTimeDelta(); uint32_t cleanups = sForgetSkippableBeforeCC ? sForgetSkippableBeforeCC : 1; - uint32_t minForgetSkippableTime = (sMinForgetSkippableTime == PR_UINT32_MAX) + uint32_t minForgetSkippableTime = (sMinForgetSkippableTime == UINT32_MAX) ? 0 : sMinForgetSkippableTime; if (sPostGCEventsToConsole) { @@ -3172,7 +3172,7 @@ nsJSContext::CycleCollectNow(nsICycleCollectorListener *aListener, observerService->NotifyObservers(nullptr, "cycle-collection-statistics", json.get()); } } - sMinForgetSkippableTime = PR_UINT32_MAX; + sMinForgetSkippableTime = UINT32_MAX; sMaxForgetSkippableTime = 0; sTotalForgetSkippableTime = 0; sRemovedPurples = 0; @@ -3892,7 +3892,7 @@ ReadSourceFromFilename(JSContext *cx, const char *filename, jschar **src, uint32 NS_ENSURE_SUCCESS(rv, rv); if (!rawLen) return NS_ERROR_FAILURE; - if (rawLen > PR_UINT32_MAX) + if (rawLen > UINT32_MAX) return NS_ERROR_FILE_TOO_BIG; // Allocate an internal buf the size of the file. diff --git a/dom/camera/GonkCameraControl.cpp b/dom/camera/GonkCameraControl.cpp index 111023ec3ff74..115bc8d5a22df 100644 --- a/dom/camera/GonkCameraControl.cpp +++ b/dom/camera/GonkCameraControl.cpp @@ -757,7 +757,7 @@ nsGonkCameraControl::SetPreviewSize(uint32_t aWidth, uint32_t aHeight) Vector previewSizes; uint32_t bestWidth = aWidth; uint32_t bestHeight = aHeight; - uint32_t minSizeDelta = PR_UINT32_MAX; + uint32_t minSizeDelta = UINT32_MAX; uint32_t delta; Size size; diff --git a/dom/devicestorage/nsDeviceStorage.cpp b/dom/devicestorage/nsDeviceStorage.cpp index 613a5274cad59..81ccdb7ca7fc6 100644 --- a/dom/devicestorage/nsDeviceStorage.cpp +++ b/dom/devicestorage/nsDeviceStorage.cpp @@ -367,7 +367,7 @@ DeviceStorageFile::Write(nsIInputStream* aInputStream) while (bufSize) { uint32_t wrote; rv = bufferedOutputStream->WriteFrom(aInputStream, - static_cast(NS_MIN(bufSize, PR_UINT32_MAX)), + static_cast(NS_MIN(bufSize, UINT32_MAX)), &wrote); if (NS_FAILED(rv)) { break; diff --git a/dom/file/ArchiveZipFile.cpp b/dom/file/ArchiveZipFile.cpp index ec639248bf9cd..aac124c4fa67c 100644 --- a/dom/file/ArchiveZipFile.cpp +++ b/dom/file/ArchiveZipFile.cpp @@ -342,7 +342,7 @@ ArchiveInputStream::SetEOF() NS_IMETHODIMP ArchiveZipFile::GetInternalStream(nsIInputStream** aStream) { - if (mLength > PR_INT32_MAX) + if (mLength > INT32_MAX) return NS_ERROR_FAILURE; uint64_t size; diff --git a/dom/file/MemoryStreams.cpp b/dom/file/MemoryStreams.cpp index 4f09d3544f412..1a62229cc287c 100644 --- a/dom/file/MemoryStreams.cpp +++ b/dom/file/MemoryStreams.cpp @@ -16,7 +16,7 @@ MemoryOutputStream::Create(uint64_t aSize) { NS_ASSERTION(aSize, "Passed zero size!"); - NS_ENSURE_TRUE(aSize <= PR_UINT32_MAX, nullptr); + NS_ENSURE_TRUE(aSize <= UINT32_MAX, nullptr); nsRefPtr stream = new MemoryOutputStream(); diff --git a/dom/indexedDB/FileInfo.cpp b/dom/indexedDB/FileInfo.cpp index 730ab5db673c9..77d8830fd1a7e 100644 --- a/dom/indexedDB/FileInfo.cpp +++ b/dom/indexedDB/FileInfo.cpp @@ -14,11 +14,11 @@ FileInfo::Create(FileManager* aFileManager, int64_t aId) { NS_ASSERTION(aId > 0, "Wrong id!"); - if (aId <= PR_INT16_MAX) { + if (aId <= INT16_MAX) { return new FileInfo16(aFileManager, aId); } - if (aId <= PR_INT32_MAX) { + if (aId <= INT32_MAX) { return new FileInfo32(aFileManager, aId); } diff --git a/dom/indexedDB/FileStream.cpp b/dom/indexedDB/FileStream.cpp index 648d36e053f16..dddf5d5276a96 100644 --- a/dom/indexedDB/FileStream.cpp +++ b/dom/indexedDB/FileStream.cpp @@ -29,7 +29,7 @@ NS_IMETHODIMP FileStream::Seek(int32_t aWhence, int64_t aOffset) { // TODO: Add support for 64 bit file sizes, bug 752431 - NS_ENSURE_TRUE(aOffset <= PR_INT32_MAX, NS_ERROR_INVALID_ARG); + NS_ENSURE_TRUE(aOffset <= INT32_MAX, NS_ERROR_INVALID_ARG); nsresult rv = DoPendingOpen(); NS_ENSURE_SUCCESS(rv, rv); diff --git a/dom/indexedDB/IDBCursor.cpp b/dom/indexedDB/IDBCursor.cpp index ef8828eee9ee4..2708b20b3ce98 100644 --- a/dom/indexedDB/IDBCursor.cpp +++ b/dom/indexedDB/IDBCursor.cpp @@ -744,7 +744,7 @@ IDBCursor::Advance(int64_t aCount) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); - if (aCount < 1 || aCount > PR_UINT32_MAX) { + if (aCount < 1 || aCount > UINT32_MAX) { return NS_ERROR_TYPE_ERR; } diff --git a/dom/indexedDB/IDBIndex.cpp b/dom/indexedDB/IDBIndex.cpp index 17f8eac64996e..6ccf9dcf8987b 100644 --- a/dom/indexedDB/IDBIndex.cpp +++ b/dom/indexedDB/IDBIndex.cpp @@ -852,7 +852,7 @@ IDBIndex::GetAll(const jsval& aKey, } if (aOptionalArgCount < 2 || aLimit == 0) { - aLimit = PR_UINT32_MAX; + aLimit = UINT32_MAX; } nsRefPtr request; @@ -886,7 +886,7 @@ IDBIndex::GetAllKeys(const jsval& aKey, } if (aOptionalArgCount < 2 || aLimit == 0) { - aLimit = PR_UINT32_MAX; + aLimit = UINT32_MAX; } nsRefPtr request; @@ -1323,7 +1323,7 @@ GetAllKeysHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */) } nsCString limitClause; - if (mLimit != PR_UINT32_MAX) { + if (mLimit != UINT32_MAX) { limitClause = NS_LITERAL_CSTRING(" LIMIT "); limitClause.AppendInt(mLimit); } @@ -1490,7 +1490,7 @@ GetAllHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */) } nsCString limitClause; - if (mLimit != PR_UINT32_MAX) { + if (mLimit != UINT32_MAX) { limitClause = NS_LITERAL_CSTRING(" LIMIT "); limitClause.AppendInt(mLimit); } diff --git a/dom/indexedDB/IDBObjectStore.cpp b/dom/indexedDB/IDBObjectStore.cpp index 6db64f4575520..d68722b8f1fbf 100644 --- a/dom/indexedDB/IDBObjectStore.cpp +++ b/dom/indexedDB/IDBObjectStore.cpp @@ -2127,7 +2127,7 @@ IDBObjectStore::GetAll(const jsval& aKey, } if (aOptionalArgCount < 2 || aLimit == 0) { - aLimit = PR_UINT32_MAX; + aLimit = UINT32_MAX; } nsRefPtr request; @@ -3679,7 +3679,7 @@ GetAllHelper::DoDatabaseWork(mozIStorageConnection* aConnection) } nsAutoCString limitClause; - if (mLimit != PR_UINT32_MAX) { + if (mLimit != UINT32_MAX) { limitClause.AssignLiteral(" LIMIT "); limitClause.AppendInt(mLimit); } diff --git a/dom/plugins/base/nsNPAPIPlugin.cpp b/dom/plugins/base/nsNPAPIPlugin.cpp index 2f75cecee0c62..f6af9c083a024 100644 --- a/dom/plugins/base/nsNPAPIPlugin.cpp +++ b/dom/plugins/base/nsNPAPIPlugin.cpp @@ -1295,7 +1295,7 @@ _intfromidentifier(NPIdentifier id) } if (!NPIdentifierIsInt(id)) { - return PR_INT32_MIN; + return INT32_MIN; } return NPIdentifierToInt(id); diff --git a/dom/plugins/ipc/BrowserStreamParent.cpp b/dom/plugins/ipc/BrowserStreamParent.cpp index 49fc75b2b188e..598fe23362a5a 100644 --- a/dom/plugins/ipc/BrowserStreamParent.cpp +++ b/dom/plugins/ipc/BrowserStreamParent.cpp @@ -52,7 +52,7 @@ BrowserStreamParent::AnswerNPN_RequestRead(const IPCByteRanges& ranges, if (!mStream) return false; - if (ranges.size() > PR_INT32_MAX) + if (ranges.size() > INT32_MAX) return false; nsAutoArrayPtr rp(new NPByteRange[ranges.size()]); diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index 6275eb6b4fc78..bebbd0cc15ff1 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -2296,7 +2296,7 @@ PluginModuleChild::NPN_IntFromIdentifier(NPIdentifier aIdentifier) if (!static_cast(aIdentifier)->IsString()) { return static_cast(aIdentifier)->ToInt(); } - return PR_INT32_MIN; + return INT32_MIN; } #ifdef OS_WIN diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index 4647ce80fa0ae..37822aa3d5978 100755 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -408,7 +408,7 @@ PluginModuleParent::ProcessFirstMinidump() return; } - uint32_t sequence = PR_UINT32_MAX; + uint32_t sequence = UINT32_MAX; nsCOMPtr dumpFile; nsAutoCString flashProcessType; TakeMinidump(getter_AddRefs(dumpFile), &sequence); diff --git a/dom/src/json/nsJSON.cpp b/dom/src/json/nsJSON.cpp index 96727dc915ee8..3d71dabcf1ecd 100644 --- a/dom/src/json/nsJSON.cpp +++ b/dom/src/json/nsJSON.cpp @@ -450,8 +450,8 @@ nsJSON::DecodeInternal(JSContext* cx, if (!available) break; // blocking input stream has none available when done - if (available > PR_UINT32_MAX) - available = PR_UINT32_MAX; + if (available > UINT32_MAX) + available = UINT32_MAX; rv = jsonListener->OnDataAvailable(jsonChannel, nullptr, aStream, diff --git a/dom/telephony/TelephonyCommon.h b/dom/telephony/TelephonyCommon.h index 53b3638936683..41e7467da1d25 100644 --- a/dom/telephony/TelephonyCommon.h +++ b/dom/telephony/TelephonyCommon.h @@ -28,7 +28,7 @@ class nsIDOMTelephonyCall; BEGIN_TELEPHONY_NAMESPACE enum { - kOutgoingPlaceholderCallIndex = PR_UINT32_MAX + kOutgoingPlaceholderCallIndex = UINT32_MAX }; class Telephony; diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp index 265a2a492d24e..0be3780da2d58 100644 --- a/dom/workers/ScriptLoader.cpp +++ b/dom/workers/ScriptLoader.cpp @@ -150,7 +150,7 @@ class ScriptLoaderRunnable : public WorkerFeature, nsCOMPtr indexSupports(do_QueryInterface(aContext)); NS_ASSERTION(indexSupports, "This should never fail!"); - uint32_t index = PR_UINT32_MAX; + uint32_t index = UINT32_MAX; if (NS_FAILED(indexSupports->GetData(&index)) || index >= mLoadInfos.Length()) { NS_ERROR("Bad index!"); @@ -513,8 +513,8 @@ class ScriptLoaderRunnable : public WorkerFeature, void ExecuteFinishedScripts() { - uint32_t firstIndex = PR_UINT32_MAX; - uint32_t lastIndex = PR_UINT32_MAX; + uint32_t firstIndex = UINT32_MAX; + uint32_t lastIndex = UINT32_MAX; // Find firstIndex based on whether mExecutionScheduled is unset. for (uint32_t index = 0; index < mLoadInfos.Length(); index++) { @@ -526,7 +526,7 @@ class ScriptLoaderRunnable : public WorkerFeature, // Find lastIndex based on whether mChannel is set, and update // mExecutionScheduled on the ones we're about to schedule. - if (firstIndex != PR_UINT32_MAX) { + if (firstIndex != UINT32_MAX) { for (uint32_t index = firstIndex; index < mLoadInfos.Length(); index++) { ScriptLoadInfo& loadInfo = mLoadInfos[index]; @@ -542,7 +542,7 @@ class ScriptLoaderRunnable : public WorkerFeature, } } - if (firstIndex != PR_UINT32_MAX && lastIndex != PR_UINT32_MAX) { + if (firstIndex != UINT32_MAX && lastIndex != UINT32_MAX) { nsRefPtr runnable = new ScriptExecutorRunnable(*this, mSyncQueueKey, firstIndex, lastIndex); if (!runnable->Dispatch(nullptr)) { diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index 75d44bea5e42a..20d25688d1f47 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -3132,11 +3132,11 @@ uint32_t WorkerPrivate::RemainingRunTimeMS() const { if (mKillTime.IsNull()) { - return PR_UINT32_MAX; + return UINT32_MAX; } TimeDuration runtime = mKillTime - TimeStamp::Now(); double ms = runtime > TimeDuration(0) ? runtime.ToMilliseconds() : 0; - return ms > double(PR_UINT32_MAX) ? PR_UINT32_MAX : uint32_t(ms); + return ms > double(UINT32_MAX) ? UINT32_MAX : uint32_t(ms); } bool @@ -3337,7 +3337,7 @@ WorkerPrivate::CreateNewSyncLoop() { AssertIsOnWorkerThread(); - NS_ASSERTION(mSyncQueues.Length() < PR_UINT32_MAX, + NS_ASSERTION(mSyncQueues.Length() < UINT32_MAX, "Should have bailed by now!"); mSyncQueues.AppendElement(new SyncQueue()); @@ -3674,7 +3674,7 @@ WorkerPrivate::SetTimeout(JSContext* aCx, unsigned aArgc, jsval* aVp, newInfo->mIsInterval = aIsInterval; newInfo->mId = timerId; - if (NS_UNLIKELY(timerId == PR_UINT32_MAX)) { + if (NS_UNLIKELY(timerId == UINT32_MAX)) { NS_WARNING("Timeout ids overflowed!"); mNextTimeoutId = 1; } @@ -3938,7 +3938,7 @@ WorkerPrivate::RescheduleTimeoutTimer(JSContext* aCx) double delta = (mTimeouts[0]->mTargetTime - TimeStamp::Now()).ToMilliseconds(); - uint32_t delay = delta > 0 ? NS_MIN(delta, double(PR_UINT32_MAX)) : 0; + uint32_t delay = delta > 0 ? NS_MIN(delta, double(UINT32_MAX)) : 0; nsresult rv = mTimer->InitWithFuncCallback(DummyCallback, nullptr, delay, nsITimer::TYPE_ONE_SHOT); diff --git a/dom/workers/XMLHttpRequest.cpp b/dom/workers/XMLHttpRequest.cpp index 855b6497cccb9..07fa9bbfab55d 100644 --- a/dom/workers/XMLHttpRequest.cpp +++ b/dom/workers/XMLHttpRequest.cpp @@ -134,8 +134,8 @@ class Proxy MOZ_FINAL : public nsIDOMEventListener mLastUploadLoaded(0), mLastUploadTotal(0), mIsSyncXHR(false), mLastLengthComputable(false), mLastUploadLengthComputable(false), mSeenLoadStart(false), mSeenUploadLoadStart(false), - mSyncQueueKey(PR_UINT32_MAX), - mSyncEventResponseSyncQueueKey(PR_UINT32_MAX), + mSyncQueueKey(UINT32_MAX), + mSyncEventResponseSyncQueueKey(UINT32_MAX), mUploadEventListenersAttached(false), mMainThreadSeenLoadStart(false), mInOpen(false) { } @@ -201,7 +201,7 @@ class Proxy MOZ_FINAL : public nsIDOMEventListener GetSyncQueueKey() { AssertIsOnMainThread(); - return mSyncEventResponseSyncQueueKey == PR_UINT32_MAX ? + return mSyncEventResponseSyncQueueKey == UINT32_MAX ? mSyncQueueKey : mSyncEventResponseSyncQueueKey; } @@ -211,8 +211,8 @@ class Proxy MOZ_FINAL : public nsIDOMEventListener { AssertIsOnMainThread(); - return mSyncQueueKey == PR_UINT32_MAX && - mSyncEventResponseSyncQueueKey == PR_UINT32_MAX; + return mSyncQueueKey == UINT32_MAX && + mSyncEventResponseSyncQueueKey == UINT32_MAX; } }; @@ -430,7 +430,7 @@ class LoadStartDetectionRunnable MOZ_FINAL : public nsIRunnable, return true; } - if (mSyncQueueKey != PR_UINT32_MAX) { + if (mSyncQueueKey != UINT32_MAX) { aWorkerPrivate->StopSyncLoop(mSyncQueueKey, true); } @@ -1199,7 +1199,7 @@ class SendRunnable : public WorkerThreadProxySyncRunnable NS_ASSERTION(!mProxy->mWorkerPrivate, "Should be null!"); mProxy->mWorkerPrivate = mWorkerPrivate; - NS_ASSERTION(mProxy->mSyncQueueKey == PR_UINT32_MAX, "Should be unset!"); + NS_ASSERTION(mProxy->mSyncQueueKey == UINT32_MAX, "Should be unset!"); mProxy->mSyncQueueKey = mSyncQueueKey; if (mHasUploadListeners) { @@ -1693,7 +1693,7 @@ XMLHttpRequest::SendInternal(const nsAString& aStringBody, AutoUnpinXHR autoUnpin(this); - uint32_t syncQueueKey = PR_UINT32_MAX; + uint32_t syncQueueKey = UINT32_MAX; if (mProxy->mIsSyncXHR) { syncQueueKey = mWorkerPrivate->CreateNewSyncLoop(); } diff --git a/editor/libeditor/html/nsHTMLDataTransfer.cpp b/editor/libeditor/html/nsHTMLDataTransfer.cpp index ac099ad234485..aff5f816bc9ac 100644 --- a/editor/libeditor/html/nsHTMLDataTransfer.cpp +++ b/editor/libeditor/html/nsHTMLDataTransfer.cpp @@ -1222,7 +1222,7 @@ nsresult nsHTMLEditor::InsertObject(const char* aType, nsISupports* aObject, boo } nsCString imageData; - rv = NS_ConsumeStream(imageStream, PR_UINT32_MAX, imageData); + rv = NS_ConsumeStream(imageStream, UINT32_MAX, imageData); NS_ENSURE_SUCCESS(rv, rv); rv = imageStream->Close(); diff --git a/embedding/browser/webBrowser/nsEmbedStream.cpp b/embedding/browser/webBrowser/nsEmbedStream.cpp index 572b622a22645..4f311e67966d9 100644 --- a/embedding/browser/webBrowser/nsEmbedStream.cpp +++ b/embedding/browser/webBrowser/nsEmbedStream.cpp @@ -50,7 +50,7 @@ nsEmbedStream::OpenStream(nsIURI *aBaseURI, const nsACString& aContentType) nsCOMPtr outputStream; rv = NS_NewPipe2(getter_AddRefs(inputStream), getter_AddRefs(outputStream), - true, false, 0, PR_UINT32_MAX); + true, false, 0, UINT32_MAX); if (NS_FAILED(rv)) return rv; diff --git a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp index 913ca968d2f5b..328a7f35fdffa 100644 --- a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp +++ b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp @@ -1861,18 +1861,18 @@ nsWindowWatcher::CalcSizeSpec(const char* aFeatures, SizeSpec& aResult) aResult.mTopSpecified = present; // Parse size spec, if any. Chrome size overrides content size. - if ((temp = WinHasOption(aFeatures, "outerWidth", PR_INT32_MIN, nullptr))) { - if (temp == PR_INT32_MIN) { + if ((temp = WinHasOption(aFeatures, "outerWidth", INT32_MIN, nullptr))) { + if (temp == INT32_MIN) { aResult.mUseDefaultWidth = true; } else { aResult.mOuterWidth = temp; } aResult.mOuterWidthSpecified = true; - } else if ((temp = WinHasOption(aFeatures, "width", PR_INT32_MIN, nullptr)) || - (temp = WinHasOption(aFeatures, "innerWidth", PR_INT32_MIN, + } else if ((temp = WinHasOption(aFeatures, "width", INT32_MIN, nullptr)) || + (temp = WinHasOption(aFeatures, "innerWidth", INT32_MIN, nullptr))) { - if (temp == PR_INT32_MIN) { + if (temp == INT32_MIN) { aResult.mUseDefaultWidth = true; } else { aResult.mInnerWidth = temp; @@ -1880,19 +1880,19 @@ nsWindowWatcher::CalcSizeSpec(const char* aFeatures, SizeSpec& aResult) aResult.mInnerWidthSpecified = true; } - if ((temp = WinHasOption(aFeatures, "outerHeight", PR_INT32_MIN, nullptr))) { - if (temp == PR_INT32_MIN) { + if ((temp = WinHasOption(aFeatures, "outerHeight", INT32_MIN, nullptr))) { + if (temp == INT32_MIN) { aResult.mUseDefaultHeight = true; } else { aResult.mOuterHeight = temp; } aResult.mOuterHeightSpecified = true; - } else if ((temp = WinHasOption(aFeatures, "height", PR_INT32_MIN, + } else if ((temp = WinHasOption(aFeatures, "height", INT32_MIN, nullptr)) || - (temp = WinHasOption(aFeatures, "innerHeight", PR_INT32_MIN, + (temp = WinHasOption(aFeatures, "innerHeight", INT32_MIN, nullptr))) { - if (temp == PR_INT32_MIN) { + if (temp == INT32_MIN) { aResult.mUseDefaultHeight = true; } else { aResult.mInnerHeight = temp; diff --git a/extensions/gio/nsGIOProtocolHandler.cpp b/extensions/gio/nsGIOProtocolHandler.cpp index 4108cd8348882..8d74d9a674b7c 100644 --- a/extensions/gio/nsGIOProtocolHandler.cpp +++ b/extensions/gio/nsGIOProtocolHandler.cpp @@ -145,7 +145,7 @@ class nsGIOInputStream : public nsIInputStream , mChannel(nullptr) , mHandle(nullptr) , mStream(nullptr) - , mBytesRemaining(PR_UINT64_MAX) + , mBytesRemaining(UINT64_MAX) , mStatus(NS_OK) , mDirList(nullptr) , mDirListPtr(nullptr) diff --git a/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp b/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp index 0ed9c98ff5d52..da31f5a3084a4 100644 --- a/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp +++ b/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp @@ -319,7 +319,7 @@ class nsGnomeVFSInputStream MOZ_FINAL : public nsIInputStream : mSpec(uriSpec) , mChannel(nullptr) , mHandle(nullptr) - , mBytesRemaining(PR_UINT64_MAX) + , mBytesRemaining(UINT64_MAX) , mStatus(NS_OK) , mDirList(nullptr) , mDirListPtr(nullptr) @@ -433,9 +433,9 @@ nsGnomeVFSInputStream::DoOpen() // Update the content length attribute on the channel. We do this // synchronously without proxying. This hack is not as bad as it looks! - if (mBytesRemaining != PR_UINT64_MAX) { + if (mBytesRemaining != UINT64_MAX) { // XXX 64-bit - mChannel->SetContentLength(NS_MAX((int32_t)mBytesRemaining, PR_INT32_MAX)); + mChannel->SetContentLength(NS_MAX((int32_t)mBytesRemaining, INT32_MAX)); } } else diff --git a/extensions/pref/autoconfig/src/nsReadConfig.cpp b/extensions/pref/autoconfig/src/nsReadConfig.cpp index 49af8ad12c654..2a1d28152357a 100644 --- a/extensions/pref/autoconfig/src/nsReadConfig.cpp +++ b/extensions/pref/autoconfig/src/nsReadConfig.cpp @@ -284,7 +284,7 @@ nsresult nsReadConfig::openAndEvaluateJSFile(const char *aFileName, int32_t obsc if (NS_FAILED(rv)) return rv; // PR_Malloc dones't support over 4GB - if (fs64 > PR_UINT32_MAX) + if (fs64 > UINT32_MAX) return NS_ERROR_FILE_TOO_BIG; uint32_t fs = (uint32_t)fs64; diff --git a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp index 4646ac5941df1..000eee29f0b13 100644 --- a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp +++ b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp @@ -482,7 +482,7 @@ mozInlineSpellWordUtil::BuildSoftText() } break; } - checkBeforeOffset = PR_INT32_MAX; + checkBeforeOffset = INT32_MAX; if (IsBreakElement(node)) { // Since GetPreviousContent follows tree *preorder*, we're about to traverse // up out of 'node'. Since node induces breaks (e.g., it's a block), diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp index 724f67e023869..5fb192c3a73d9 100644 --- a/gfx/gl/GLContextProviderEGL.cpp +++ b/gfx/gl/GLContextProviderEGL.cpp @@ -346,7 +346,7 @@ class GLContextEGL : public GLContext bool ok = InitWithPrefix("gl", true); PR_STATIC_ASSERT(sizeof(GLint) >= sizeof(int32_t)); - mMaxTextureImageSize = PR_INT32_MAX; + mMaxTextureImageSize = INT32_MAX; mShareWithEGLImage = sEGLLibrary.HasKHRImageBase() && sEGLLibrary.HasKHRImageTexture2D() && diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index d187d7d7a18cb..c2060c926f15a 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -388,7 +388,7 @@ class THEBES_API LayerManager { virtual bool CanUseCanvasLayerForSize(const gfxIntSize &aSize) { return true; } /** - * returns the maximum texture size on this layer backend, or PR_INT32_MAX + * returns the maximum texture size on this layer backend, or INT32_MAX * if there is no maximum */ virtual int32_t GetMaxTextureSize() const = 0; diff --git a/gfx/layers/basic/BasicLayerManager.cpp b/gfx/layers/basic/BasicLayerManager.cpp index 6c02b9e819ea2..206f2d34e7d18 100644 --- a/gfx/layers/basic/BasicLayerManager.cpp +++ b/gfx/layers/basic/BasicLayerManager.cpp @@ -1039,7 +1039,7 @@ BasicShadowLayerManager::GetMaxTextureSize() const return ShadowLayerForwarder::GetMaxTextureSize(); } - return PR_INT32_MAX; + return INT32_MAX; } void diff --git a/gfx/layers/basic/BasicLayers.h b/gfx/layers/basic/BasicLayers.h index aff584a65a858..6a7d7c37c830e 100644 --- a/gfx/layers/basic/BasicLayers.h +++ b/gfx/layers/basic/BasicLayers.h @@ -152,7 +152,7 @@ class THEBES_API BasicLayerManager : void PopGroupToSourceWithCachedSurface(gfxContext *aTarget, gfxContext *aPushed); virtual bool IsCompositingCheap() { return false; } - virtual int32_t GetMaxTextureSize() const { return PR_INT32_MAX; } + virtual int32_t GetMaxTextureSize() const { return INT32_MAX; } bool CompositorMightResample() { return mCompositorMightResample; } protected: diff --git a/gfx/layers/opengl/LayerManagerOGL.cpp b/gfx/layers/opengl/LayerManagerOGL.cpp index f8df9821fbfce..2536dc9dc2a57 100644 --- a/gfx/layers/opengl/LayerManagerOGL.cpp +++ b/gfx/layers/opengl/LayerManagerOGL.cpp @@ -1185,7 +1185,7 @@ LayerManagerOGL::CopyToTarget(gfxContext *aTarget) GLint width = rect.width; GLint height = rect.height; - if ((int64_t(width) * int64_t(height) * int64_t(4)) > PR_INT32_MAX) { + if ((int64_t(width) * int64_t(height) * int64_t(4)) > INT32_MAX) { NS_ERROR("Widget size too big - integer overflow!"); return; } diff --git a/gfx/src/nsCoord.h b/gfx/src/nsCoord.h index 4931b680c655f..3eb1da0c1209b 100644 --- a/gfx/src/nsCoord.h +++ b/gfx/src/nsCoord.h @@ -292,7 +292,7 @@ NSCoordGreaterThan(nscoord a,nscoord b) /** * Convert an nscoord to a int32_t. This *does not* do rounding because * coords are never fractional. They can be out of range, so this does - * clamp out of bounds coord values to PR_INT32_MIN and PR_INT32_MAX. + * clamp out of bounds coord values to INT32_MIN and INT32_MAX. */ inline int32_t NSCoordToInt(nscoord aCoord) { VERIFY_COORD(aCoord); @@ -301,11 +301,11 @@ inline int32_t NSCoordToInt(nscoord aCoord) { if (aCoord < -2147483648.0f) { // -2147483648 is the smallest 32-bit signed integer that can be // exactly represented as a float - return PR_INT32_MIN; + return INT32_MIN; } else if (aCoord > 2147483520.0f) { // 2147483520 is the largest 32-bit signed integer that can be // exactly represented as an IEEE float - return PR_INT32_MAX; + return INT32_MAX; } else { return (int32_t)aCoord; } diff --git a/gfx/src/nsRegion.cpp b/gfx/src/nsRegion.cpp index 7875a831048c9..16c76c36663ba 100644 --- a/gfx/src/nsRegion.cpp +++ b/gfx/src/nsRegion.cpp @@ -20,8 +20,8 @@ #define NS_COORD_LESS_SENTINEL nscoord_MIN #define NS_COORD_GREATER_SENTINEL nscoord_MAX #else -#define NS_COORD_LESS_SENTINEL PR_INT32_MIN -#define NS_COORD_GREATER_SENTINEL PR_INT32_MAX +#define NS_COORD_LESS_SENTINEL INT32_MIN +#define NS_COORD_GREATER_SENTINEL INT32_MAX #endif // Fast inline analogues of nsRect methods for nsRegion::nsRectFast. diff --git a/gfx/tests/TestColorNames.cpp b/gfx/tests/TestColorNames.cpp index ed0041ca28adf..10d352d46cfe3 100644 --- a/gfx/tests/TestColorNames.cpp +++ b/gfx/tests/TestColorNames.cpp @@ -79,7 +79,7 @@ int main(int argc, char** argv) uint8_t g = NS_GET_G(rgb); uint8_t b = NS_GET_B(rgb); uint8_t a = NS_GET_A(rgb); - if (a != PR_UINT8_MAX) { + if (a != UINT8_MAX) { // NS_HexToRGB() can not handle a color with alpha channel rgb = NS_RGB(r, g, b); } diff --git a/gfx/thebes/gfxASurface.cpp b/gfx/thebes/gfxASurface.cpp index 03fadf1d569ae..fd97800d7aac9 100644 --- a/gfx/thebes/gfxASurface.cpp +++ b/gfx/thebes/gfxASurface.cpp @@ -754,7 +754,7 @@ gfxASurface::WriteAsPNG_internal(FILE* aFile, bool aBinary) if (NS_FAILED(rv)) return; - if (bufSize64 > PR_UINT32_MAX - 16) + if (bufSize64 > UINT32_MAX - 16) return; uint32_t bufSize = (uint32_t)bufSize64; diff --git a/gfx/thebes/gfxDWriteShaper.cpp b/gfx/thebes/gfxDWriteShaper.cpp index d661043329220..a03d4e0dbc51c 100644 --- a/gfx/thebes/gfxDWriteShaper.cpp +++ b/gfx/thebes/gfxDWriteShaper.cpp @@ -55,7 +55,7 @@ gfxDWriteShaper::ShapeWord(gfxContext *aContext, UINT32 maxGlyphs = 0; trymoreglyphs: - if ((PR_UINT32_MAX - 3 * length / 2 + 16) < maxGlyphs) { + if ((UINT32_MAX - 3 * length / 2 + 16) < maxGlyphs) { // This isn't going to work, we're going to cross the UINT32 upper // limit. Give up. NS_WARNING("Shaper needs to generate more than 2^32 glyphs?!"); diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index cf152cda484f9..4fc087a5dbebe 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -5214,7 +5214,7 @@ gfxTextRun::BreakAndMeasureText(uint32_t aStart, uint32_t aMaxLength, } if (aLastBreak && charsFit == aMaxLength) { if (lastBreak < 0) { - *aLastBreak = PR_UINT32_MAX; + *aLastBreak = UINT32_MAX; } else { *aLastBreak = lastBreak - aStart; } diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index cce4b119d33c0..845136b3a5341 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -2609,7 +2609,7 @@ class THEBES_API gfxTextRun { * SetLineBreaks(aStart, result, aLineBreakBefore, result < aMaxLength, aProvider) * and the returned metrics and the invariants above reflect this. * - * @param aMaxLength this can be PR_UINT32_MAX, in which case the length used + * @param aMaxLength this can be UINT32_MAX, in which case the length used * is up to the end of the string * @param aLineBreakBefore set to true if and only if there is an actual * line break at the start of this string. @@ -2633,7 +2633,7 @@ class THEBES_API gfxTextRun { * the maximal N such that * N < aMaxLength && line break at N && GetAdvanceWidth(aStart, N) <= aWidth * OR N < aMaxLength && hyphen break at N && GetAdvanceWidth(aStart, N) + GetHyphenWidth() <= aWidth - * or PR_UINT32_MAX if no such N exists, where GetAdvanceWidth assumes + * or UINT32_MAX if no such N exists, where GetAdvanceWidth assumes * the effect of * SetLineBreaks(aStart, N, aLineBreakBefore, N < aMaxLength, aProvider) * @@ -3109,7 +3109,7 @@ class THEBES_API gfxFontGroup : public gfxTextRunFactory { // If this group has such "bad" font, each platform's gfxFontGroup initialized mUnderlineOffset. // The value should be lower value of first font's metrics and the bad font's metrics. // Otherwise, this returns from first font's metrics. - enum { UNDERLINE_OFFSET_NOT_SET = PR_INT16_MAX }; + enum { UNDERLINE_OFFSET_NOT_SET = INT16_MAX }; virtual gfxFloat GetUnderlineOffset() { if (mUnderlineOffset == UNDERLINE_OFFSET_NOT_SET) mUnderlineOffset = GetFontAt(0)->GetMetrics().underlineOffset; diff --git a/gfx/thebes/gfxFontUtils.cpp b/gfx/thebes/gfxFontUtils.cpp index 20792c378ad49..fd54b35b2f9c9 100644 --- a/gfx/thebes/gfxFontUtils.cpp +++ b/gfx/thebes/gfxFontUtils.cpp @@ -1347,7 +1347,7 @@ gfxFontUtils::RenameFont(const nsAString& aName, const uint8_t *aFontData, nameStrLength + 3) & ~3; - if (dataLength + nameTableSize > PR_UINT32_MAX) + if (dataLength + nameTableSize > UINT32_MAX) return NS_ERROR_FAILURE; // bug 505386 - need to handle unpadded font length diff --git a/image/decoders/nsPNGDecoder.cpp b/image/decoders/nsPNGDecoder.cpp index 8bce3acc57b56..67839df698884 100644 --- a/image/decoders/nsPNGDecoder.cpp +++ b/image/decoders/nsPNGDecoder.cpp @@ -631,7 +631,7 @@ nsPNGDecoder::info_callback(png_structp png_ptr, png_infop info_ptr) } if (interlace_type == PNG_INTERLACE_ADAM7) { - if (height < PR_INT32_MAX / (width * channels)) + if (height < INT32_MAX / (width * channels)) decoder->interlacebuf = (uint8_t *)moz_malloc(channels * width * height); if (!decoder->interlacebuf) { longjmp(png_jmpbuf(decoder->mPNG), 5); // NS_ERROR_OUT_OF_MEMORY diff --git a/image/src/imgTools.cpp b/image/src/imgTools.cpp index 748cf419c2ba7..1cb12fb67c744 100644 --- a/image/src/imgTools.cpp +++ b/image/src/imgTools.cpp @@ -83,7 +83,7 @@ NS_IMETHODIMP imgTools::DecodeImageData(nsIInputStream* aInStr, uint64_t length; rv = inStream->Available(&length); NS_ENSURE_SUCCESS(rv, rv); - NS_ENSURE_TRUE(length <= PR_UINT32_MAX, NS_ERROR_FILE_TOO_BIG); + NS_ENSURE_TRUE(length <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG); // Send the source data to the Image. WriteToRasterImage always // consumes everything it gets if it doesn't run out of memory. diff --git a/intl/lwbrk/src/nsJISx4501LineBreaker.cpp b/intl/lwbrk/src/nsJISx4501LineBreaker.cpp index b6b2758e65db5..644b121817b18 100644 --- a/intl/lwbrk/src/nsJISx4501LineBreaker.cpp +++ b/intl/lwbrk/src/nsJISx4501LineBreaker.cpp @@ -328,7 +328,7 @@ static const uint16_t gPairConservative[MAX_CLASSES] = { */ -#define CLASS_NONE PR_INT8_MAX +#define CLASS_NONE INT8_MAX #define CLASS_OPEN 0x00 #define CLASS_CLOSE 0x01 diff --git a/ipc/glue/Shmem.cpp b/ipc/glue/Shmem.cpp index 7feb7b6ee54b5..bca66ce87be94 100644 --- a/ipc/glue/Shmem.cpp +++ b/ipc/glue/Shmem.cpp @@ -356,7 +356,7 @@ Shmem::Alloc(IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead, bool aUnsafe, bool aProtect) { - NS_ASSERTION(aNBytes <= PR_UINT32_MAX, "Will truncate shmem segment size!"); + NS_ASSERTION(aNBytes <= UINT32_MAX, "Will truncate shmem segment size!"); NS_ABORT_IF_FALSE(!aProtect || !aUnsafe, "protect => !unsafe"); size_t pageSize = SharedMemory::SystemPageSize(); diff --git a/ipc/glue/SyncChannel.cpp b/ipc/glue/SyncChannel.cpp index 0a3debd66afa2..fc61371ac9a30 100644 --- a/ipc/glue/SyncChannel.cpp +++ b/ipc/glue/SyncChannel.cpp @@ -22,7 +22,7 @@ struct RunnableMethodTraits namespace mozilla { namespace ipc { -const int32_t SyncChannel::kNoTimeout = PR_INT32_MIN; +const int32_t SyncChannel::kNoTimeout = INT32_MIN; SyncChannel::SyncChannel(SyncListener* aListener) : AsyncChannel(aListener) diff --git a/js/xpconnect/loader/mozJSComponentLoader.cpp b/js/xpconnect/loader/mozJSComponentLoader.cpp index a4ede72145900..5b5845ebde8ce 100644 --- a/js/xpconnect/loader/mozJSComponentLoader.cpp +++ b/js/xpconnect/loader/mozJSComponentLoader.cpp @@ -743,7 +743,7 @@ mozJSComponentLoader::GlobalForLocation(nsIFile *aComponentFile, } int64_t maxSize; - LL_UI2L(maxSize, PR_UINT32_MAX); + LL_UI2L(maxSize, UINT32_MAX); if (LL_CMP(fileSize, >, maxSize)) { NS_ERROR("file too large"); JS_SetOptions(cx, oldopts); @@ -845,7 +845,7 @@ mozJSComponentLoader::GlobalForLocation(nsIFile *aComponentFile, rv = scriptStream->Available(&len64); NS_ENSURE_SUCCESS(rv, rv); - NS_ENSURE_TRUE(len64 < PR_UINT32_MAX, NS_ERROR_FILE_TOO_BIG); + NS_ENSURE_TRUE(len64 < UINT32_MAX, NS_ERROR_FILE_TOO_BIG); if (!len64) return NS_ERROR_FAILURE; uint32_t len = (uint32_t)len64; diff --git a/js/xpconnect/src/XPCConvert.cpp b/js/xpconnect/src/XPCConvert.cpp index 5c4bc474bfbed..56d8ca67c1a29 100644 --- a/js/xpconnect/src/XPCConvert.cpp +++ b/js/xpconnect/src/XPCConvert.cpp @@ -1482,7 +1482,7 @@ XPCConvert::NativeArray2JS(XPCLazyCallContext& lccx, // Check that the tag part of the type matches the type // of the array. If the check succeeds, check that the size -// of the output does not exceed PR_UINT32_MAX bytes. Allocate +// of the output does not exceed UINT32_MAX bytes. Allocate // the memory and copy the elements by memcpy. static JSBool CheckTargetAndPopulate(JSContext *cx, @@ -1505,8 +1505,8 @@ CheckTargetAndPopulate(JSContext *cx, } // Calulate the maximum number of elements that can fit in - // PR_UINT32_MAX bytes. - size_t max = PR_UINT32_MAX / typeSize; + // UINT32_MAX bytes. + size_t max = UINT32_MAX / typeSize; // This could overflow on 32-bit systems so check max first. size_t byteSize = count * typeSize; @@ -1690,7 +1690,7 @@ XPCConvert::JSArray2Native(JSContext* cx, void** d, JS::Value s, #define POPULATE(_mode, _t) \ PR_BEGIN_MACRO \ cleanupMode = _mode; \ - size_t max = PR_UINT32_MAX / sizeof(_t); \ + size_t max = UINT32_MAX / sizeof(_t); \ if (count > max || \ nullptr == (array = nsMemory::Alloc(count * sizeof(_t)))) { \ if (pErr) \ diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrappedNative.cpp index 701831404201e..5c982dbbb635d 100644 --- a/js/xpconnect/src/XPCWrappedNative.cpp +++ b/js/xpconnect/src/XPCWrappedNative.cpp @@ -2335,8 +2335,8 @@ class CallMethodHelper , mCallee(ccx.GetTearOff()->GetNative()) , mVTableIndex(ccx.GetMethodIndex()) , mIdxValueId(ccx.GetRuntime()->GetStringID(XPCJSRuntime::IDX_VALUE)) - , mJSContextIndex(PR_UINT8_MAX) - , mOptArgcIndex(PR_UINT8_MAX) + , mJSContextIndex(UINT8_MAX) + , mOptArgcIndex(UINT8_MAX) , mArgv(ccx.GetArgv()) , mArgc(ccx.GetArgc()) diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 0c5acd8c9cfef..3760eb8d83e03 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -456,7 +456,7 @@ class ContainerState { * aRoundedRectClipCount rounded rects in aClip */ void SetupMaskLayer(Layer *aLayer, const FrameLayerBuilder::Clip& aClip, - uint32_t aRoundedRectClipCount = PR_UINT32_MAX); + uint32_t aRoundedRectClipCount = UINT32_MAX); nsDisplayListBuilder* mBuilder; LayerManager* mManager; diff --git a/layout/base/FrameLayerBuilder.h b/layout/base/FrameLayerBuilder.h index a1204b9e961ad..d906899f0f4fc 100644 --- a/layout/base/FrameLayerBuilder.h +++ b/layout/base/FrameLayerBuilder.h @@ -464,7 +464,7 @@ class FrameLayerBuilder : public layers::LayerUserData { // or clearing of other clips must be done by the caller. // See aBegin/aEnd note on ApplyRoundedRectsTo. void ApplyTo(gfxContext* aContext, nsPresContext* aPresContext, - uint32_t aBegin = 0, uint32_t aEnd = PR_UINT32_MAX); + uint32_t aBegin = 0, uint32_t aEnd = UINT32_MAX); void ApplyRectTo(gfxContext* aContext, int32_t A2D) const; // Applies the rounded rects in this Clip to aContext diff --git a/layout/base/nsCounterManager.h b/layout/base/nsCounterManager.h index 178cb7c8a766d..89857fc498940 100644 --- a/layout/base/nsCounterManager.h +++ b/layout/base/nsCounterManager.h @@ -89,7 +89,7 @@ struct nsCounterUseNode : public nsCounterNode { , mCounterStyle(aCounterStyle) , mAllCounters(aAllCounters) { - NS_ASSERTION(aContentIndex <= PR_INT32_MAX, "out of range"); + NS_ASSERTION(aContentIndex <= INT32_MAX, "out of range"); } virtual bool InitTextFrame(nsGenConList* aList, @@ -119,8 +119,8 @@ struct nsCounterChangeNode : public nsCounterNode { // that comes before all the real content, with // the resets first, in order, and then the increments. aPropIndex + (aChangeType == RESET - ? (PR_INT32_MIN) - : (PR_INT32_MIN / 2)), + ? (INT32_MIN) + : (INT32_MIN / 2)), aChangeType) , mChangeValue(aChangeValue) { diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 13ea4b78df282..4e5b400550ecd 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -2563,7 +2563,7 @@ class nsDisplayTransform: public nsDisplayItem virtual uint32_t GetPerFrameKey() MOZ_OVERRIDE { return (mIndex << nsDisplayItem::TYPE_BITS) | nsDisplayItem::GetPerFrameKey(); } enum { - INDEX_MAX = PR_UINT32_MAX >> nsDisplayItem::TYPE_BITS + INDEX_MAX = UINT32_MAX >> nsDisplayItem::TYPE_BITS }; const gfx3DMatrix& GetTransform(float aAppUnitsPerPixel); diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 8d2c7efa5f492..d7b646b03366b 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -4464,7 +4464,7 @@ nsLayoutUtils::GetFontFacesForFrames(nsIFrame* aFrame, NS_PRECONDITION(aFrame, "NULL frame pointer"); if (aFrame->GetType() == nsGkAtoms::textFrame) { - return GetFontFacesForText(aFrame, 0, PR_INT32_MAX, false, + return GetFontFacesForText(aFrame, 0, INT32_MAX, false, aFontFaceList); } diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 6a27d860d44fd..7e7e59ba99eef 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -1494,7 +1494,7 @@ class nsLayoutUtils /** * Adds all font faces used within the specified range of text in aFrame, * and optionally its continuations, to the list in aFontFaceList. - * Pass 0 and PR_INT32_MAX for aStartOffset and aEndOffset to specify the + * Pass 0 and INT32_MAX for aStartOffset and aEndOffset to specify the * entire text is to be considered. */ static nsresult GetFontFacesForText(nsIFrame* aFrame, diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 7dc007ee61875..6bd524f81fbdd 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -8110,7 +8110,7 @@ DumpToPNG(nsIPresShell* shell, nsAString& name) { uint64_t length64; rv = encoder->Available(&length64); NS_ENSURE_SUCCESS(rv, rv); - if (length64 > PR_UINT32_MAX) + if (length64 > UINT32_MAX) return NS_ERROR_FILE_TOO_BIG; uint32_t length = (uint32_t)length64; diff --git a/layout/base/nsQuoteList.h b/layout/base/nsQuoteList.h index aae3e7ea97593..b8e5b883511b3 100644 --- a/layout/base/nsQuoteList.h +++ b/layout/base/nsQuoteList.h @@ -28,7 +28,7 @@ struct nsQuoteNode : public nsGenConNode { aType == eStyleContentType_NoOpenQuote || aType == eStyleContentType_NoCloseQuote, "incorrect type"); - NS_ASSERTION(aContentIndex <= PR_INT32_MAX, "out of range"); + NS_ASSERTION(aContentIndex <= INT32_MAX, "out of range"); } virtual bool InitTextFrame(nsGenConList* aList, diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index 5d559727f1a32..b7986540c96cb 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -6158,8 +6158,8 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, } else { bool nonDecreasingYs = true; int32_t lineCount = 0; - nscoord lastY = PR_INT32_MIN; - nscoord lastYMost = PR_INT32_MIN; + nscoord lastY = INT32_MIN; + nscoord lastYMost = INT32_MIN; for (line_iterator line = begin_lines(); line != line_end; ++line) { diff --git a/layout/generic/nsColumnSetFrame.cpp b/layout/generic/nsColumnSetFrame.cpp index 97d4ba21b2ceb..dec2767ac0064 100644 --- a/layout/generic/nsColumnSetFrame.cpp +++ b/layout/generic/nsColumnSetFrame.cpp @@ -415,7 +415,7 @@ nsColumnSetFrame::ChooseColumnStrategy(const nsHTMLReflowState& aReflowState) } else { // This is the case when the column-fill property is set to 'auto'. // No balancing, so don't limit the column count - numColumns = PR_INT32_MAX; + numColumns = INT32_MAX; } #ifdef DEBUG_roc @@ -632,7 +632,7 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize, aReflowState.ComputedHeight()); kidReflowState.mFlags.mIsTopOfPage = true; kidReflowState.mFlags.mTableIsSplittable = false; - kidReflowState.mFlags.mIsColumnBalancing = aConfig.mBalanceColCount < PR_INT32_MAX; + kidReflowState.mFlags.mIsColumnBalancing = aConfig.mBalanceColCount < INT32_MAX; #ifdef DEBUG_roc printf("*** Reflowing child #%d %p: availHeight=%d\n", @@ -739,7 +739,7 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize, if ((contentBottom > aReflowState.mComputedMaxHeight || contentBottom > aReflowState.ComputedHeight()) && - aConfig.mBalanceColCount < PR_INT32_MAX) { + aConfig.mBalanceColCount < INT32_MAX) { // We overflowed vertically, but have not exceeded the number // of columns. If we're balancing, then we should try reverting // to auto instead. @@ -909,7 +909,7 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext, //------------ Handle Incremental Reflow ----------------- ReflowConfig config = ChooseColumnStrategy(aReflowState); - bool isBalancing = config.mBalanceColCount < PR_INT32_MAX; + bool isBalancing = config.mBalanceColCount < INT32_MAX; // If balancing, then we allow the last column to grow to unbounded // height during the first reflow. This gives us a way to estimate @@ -933,7 +933,7 @@ nsColumnSetFrame::Reflow(nsPresContext* aPresContext, if (colData.mShouldRevertToAuto) { config = ChooseColumnStrategy(aReflowState); isBalancing = false; - config.mBalanceColCount = PR_INT32_MAX; + config.mBalanceColCount = INT32_MAX; } bool feasible = ReflowChildren(aDesiredSize, aReflowState, diff --git a/layout/generic/nsFrameSetFrame.cpp b/layout/generic/nsFrameSetFrame.cpp index 782de93db3652..49746e728d906 100644 --- a/layout/generic/nsFrameSetFrame.cpp +++ b/layout/generic/nsFrameSetFrame.cpp @@ -292,7 +292,7 @@ nsHTMLFramesetFrame::Init(nsIContent* aContent, return NS_ERROR_OUT_OF_MEMORY; // Ensure we can't overflow numCells - PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < PR_INT32_MAX / NS_MAX_FRAMESET_SPEC_COUNT); + PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < INT32_MAX / NS_MAX_FRAMESET_SPEC_COUNT); int32_t numCells = mNumRows*mNumCols; PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < UINT_MAX / sizeof(nsHTMLFramesetBorderFrame*)); @@ -1320,7 +1320,7 @@ nsHTMLFramesetFrame::RecalculateBorderResize() return; } - PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < PR_INT32_MAX / NS_MAX_FRAMESET_SPEC_COUNT); + PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < INT32_MAX / NS_MAX_FRAMESET_SPEC_COUNT); int32_t numCells = mNumRows * mNumCols; // max number of cells PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < UINT_MAX / sizeof(int32_t) / NS_MAX_FRAMESET_SPEC_COUNT); diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 583a7fca662ac..39996ffbd9aeb 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -1914,7 +1914,7 @@ class nsIFrame : public nsQueryFrame gfxSkipChars* aSkipChars = nullptr, gfxSkipCharsIterator* aSkipIter = nullptr, uint32_t aSkippedStartOffset = 0, - uint32_t aSkippedMaxLength = PR_UINT32_MAX) + uint32_t aSkippedMaxLength = UINT32_MAX) { return NS_ERROR_NOT_IMPLEMENTED; } /** diff --git a/layout/generic/nsLineBox.h b/layout/generic/nsLineBox.h index 58a6c81a1cbc3..d9a7939fd60ff 100644 --- a/layout/generic/nsLineBox.h +++ b/layout/generic/nsLineBox.h @@ -142,7 +142,7 @@ class nsFloatCacheFreeList : private nsFloatCacheList { //---------------------------------------------------------------------- #define LINE_MAX_BREAK_TYPE ((1 << 4) - 1) -#define LINE_MAX_CHILD_COUNT PR_INT32_MAX +#define LINE_MAX_CHILD_COUNT INT32_MAX #if NS_STYLE_CLEAR_LAST_VALUE > 15 need to rearrange the mBits bitfield; diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index b25376b4ed387..d824b18e54178 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -1034,8 +1034,8 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, if (!psd->mNoWrap && (!LineIsEmpty() || placedFloat)) { // record soft break opportunity after this content that can't be // part of a text run. This is not a text frame so we know - // that offset PR_INT32_MAX means "after the content". - if (NotifyOptionalBreakPosition(aFrame->GetContent(), PR_INT32_MAX, optionalBreakAfterFits, eNormalBreak)) { + // that offset INT32_MAX means "after the content". + if (NotifyOptionalBreakPosition(aFrame->GetContent(), INT32_MAX, optionalBreakAfterFits, eNormalBreak)) { // If this returns true then we are being told to actually break here. aReflowStatus = NS_INLINE_LINE_BREAK_AFTER(aReflowStatus); } diff --git a/layout/generic/nsLineLayout.h b/layout/generic/nsLineLayout.h index 3c32f6be25285..90677f10b1c65 100644 --- a/layout/generic/nsLineLayout.h +++ b/layout/generic/nsLineLayout.h @@ -205,7 +205,7 @@ class nsLineLayout { * can call SetLastOptionalBreakPosition to record where a break could * have been made, but wasn't because we decided to place more content on * the line. For non-text frames, offset 0 means - * before the content, offset PR_INT32_MAX means after the content. + * before the content, offset INT32_MAX means after the content. * * Currently this is used to handle cases where a single word comprises * multiple frames, and the first frame fits on the line but the whole word @@ -388,7 +388,7 @@ class nsLineLayout { void SetFlag(uint32_t aFlag, bool aValue) { NS_ASSERTION(aFlag<=PFD_LASTFLAG, "bad flag"); - NS_ASSERTION(aFlag<=PR_UINT8_MAX, "bad flag"); + NS_ASSERTION(aFlag<=UINT8_MAX, "bad flag"); NS_ASSERTION(aValue==false || aValue==true, "bad value"); if (aValue) { // set flag mFlags |= aFlag; diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index cd2b2679f9946..84549728450e2 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -528,8 +528,8 @@ nsObjectFrame::GetDesiredSize(nsPresContext* aPresContext, // exceed the maximum size of X coordinates. See bug #225357 for // more information. In theory Gtk2 can handle large coordinates, // but underlying plugins can't. - aMetrics.height = NS_MIN(aPresContext->DevPixelsToAppUnits(PR_INT16_MAX), aMetrics.height); - aMetrics.width = NS_MIN(aPresContext->DevPixelsToAppUnits(PR_INT16_MAX), aMetrics.width); + aMetrics.height = NS_MIN(aPresContext->DevPixelsToAppUnits(INT16_MAX), aMetrics.height); + aMetrics.width = NS_MIN(aPresContext->DevPixelsToAppUnits(INT16_MAX), aMetrics.width); #endif } diff --git a/layout/generic/nsTextFrame.h b/layout/generic/nsTextFrame.h index b28c3bd02e191..775c8972f9898 100644 --- a/layout/generic/nsTextFrame.h +++ b/layout/generic/nsTextFrame.h @@ -239,7 +239,7 @@ class nsTextFrame : public nsTextFrameBase { gfxSkipChars* aSkipChars = nullptr, gfxSkipCharsIterator* aSkipIter = nullptr, uint32_t aSkippedStartOffset = 0, - uint32_t aSkippedMaxLength = PR_UINT32_MAX); + uint32_t aSkippedMaxLength = UINT32_MAX); nsOverflowAreas RecomputeOverflow(const nsHTMLReflowState& aBlockReflowState); diff --git a/layout/generic/nsTextFrameThebes.cpp b/layout/generic/nsTextFrameThebes.cpp index 7d2136c8d51f8..499678372e68c 100644 --- a/layout/generic/nsTextFrameThebes.cpp +++ b/layout/generic/nsTextFrameThebes.cpp @@ -955,7 +955,7 @@ class BuildTextRunsScanner { // on the line, or null if there was no previous leaf frame. nsIFrame* mCommonAncestorWithLastFrame; // mMaxTextLength is an upper bound on the size of the text in all mapped frames - // The value PR_UINT32_MAX represents overflow; text will be discarded + // The value UINT32_MAX represents overflow; text will be discarded uint32_t mMaxTextLength; bool mDoubleByteText; bool mBidiEnabled; @@ -1401,7 +1401,7 @@ void BuildTextRunsScanner::FlushFrames(bool aFlushLineBreaks, bool aSuppressTrai } else { AutoFallibleTArray buffer; uint32_t bufferSize = mMaxTextLength*(mDoubleByteText ? 2 : 1); - if (bufferSize < mMaxTextLength || bufferSize == PR_UINT32_MAX || + if (bufferSize < mMaxTextLength || bufferSize == UINT32_MAX || !buffer.AppendElements(bufferSize)) { return; } @@ -1448,10 +1448,10 @@ void BuildTextRunsScanner::FlushLineBreaks(gfxTextRun* aTrailingTextRun) void BuildTextRunsScanner::AccumulateRunInfo(nsTextFrame* aFrame) { - if (mMaxTextLength != PR_UINT32_MAX) { - NS_ASSERTION(mMaxTextLength < PR_UINT32_MAX - aFrame->GetContentLength(), "integer overflow"); - if (mMaxTextLength >= PR_UINT32_MAX - aFrame->GetContentLength()) { - mMaxTextLength = PR_UINT32_MAX; + if (mMaxTextLength != UINT32_MAX) { + NS_ASSERTION(mMaxTextLength < UINT32_MAX - aFrame->GetContentLength(), "integer overflow"); + if (mMaxTextLength >= UINT32_MAX - aFrame->GetContentLength()) { + mMaxTextLength = UINT32_MAX; } else { mMaxTextLength += aFrame->GetContentLength(); } @@ -2098,7 +2098,7 @@ BuildTextRunsScanner::SetupLineBreakerContext(gfxTextRun *aTextRun) { AutoFallibleTArray buffer; uint32_t bufferSize = mMaxTextLength*(mDoubleByteText ? 2 : 1); - if (bufferSize < mMaxTextLength || bufferSize == PR_UINT32_MAX) { + if (bufferSize < mMaxTextLength || bufferSize == UINT32_MAX) { return false; } void *textPtr = buffer.AppendElements(bufferSize); @@ -2652,7 +2652,7 @@ static bool IsInBounds(const gfxSkipCharsIterator& aStart, int32_t aContentLengt uint32_t aOffset, uint32_t aLength) { if (aStart.GetSkippedOffset() > aOffset) return false; - if (aContentLength == PR_INT32_MAX) + if (aContentLength == INT32_MAX) return true; gfxSkipCharsIterator iter(aStart); iter.AdvanceOriginal(aContentLength); @@ -2666,9 +2666,9 @@ class NS_STACK_CLASS PropertyProvider : public gfxTextRun::PropertyProvider { * Use this constructor for reflow, when we don't know what text is * really mapped by the frame and we have a lot of other data around. * - * @param aLength can be PR_INT32_MAX to indicate we cover all the text + * @param aLength can be INT32_MAX to indicate we cover all the text * associated with aFrame up to where its flow chain ends in the given - * textrun. If PR_INT32_MAX is passed, justification and hyphen-related methods + * textrun. If INT32_MAX is passed, justification and hyphen-related methods * cannot be called, nor can GetOriginalLength(). */ PropertyProvider(gfxTextRun* aTextRun, const nsStyleText* aTextStyle, @@ -2751,9 +2751,9 @@ class NS_STACK_CLASS PropertyProvider : public gfxTextRun::PropertyProvider { // adjusted for whitespace trimming according to the state bits set in the frame // (for the static provider) const gfxSkipCharsIterator& GetStart() { return mStart; } - // May return PR_INT32_MAX if that was given to the constructor + // May return INT32_MAX if that was given to the constructor uint32_t GetOriginalLength() { - NS_ASSERTION(mLength != PR_INT32_MAX, "Length not known"); + NS_ASSERTION(mLength != INT32_MAX, "Length not known"); return mLength; } const nsTextFragment* GetFragment() { return mFrag; } @@ -2800,7 +2800,7 @@ class NS_STACK_CLASS PropertyProvider : public gfxTextRun::PropertyProvider { // when mTabWidths is NULL (otherwise rely on mTabWidths->mLimit instead) uint32_t mTabWidthsAnalyzedLimit; - int32_t mLength; // DOM string length, may be PR_INT32_MAX + int32_t mLength; // DOM string length, may be INT32_MAX gfxFloat mWordSpacing; // space for each whitespace char gfxFloat mLetterSpacing; // space for each letter gfxFloat mJustificationSpacing; @@ -3099,7 +3099,7 @@ PropertyProvider::GetHyphenationBreaks(uint32_t aStart, uint32_t aLength, bool* aBreakBefore) { NS_PRECONDITION(IsInBounds(mStart, mLength, aStart, aLength), "Range out of bounds"); - NS_PRECONDITION(mLength != PR_INT32_MAX, "Can't call this with undefined length"); + NS_PRECONDITION(mLength != INT32_MAX, "Can't call this with undefined length"); if (!mTextStyle->WhiteSpaceCanWrap() || mTextStyle->mHyphens == NS_STYLE_HYPHENS_NONE) @@ -3169,7 +3169,7 @@ void PropertyProvider::FindJustificationRange(gfxSkipCharsIterator* aStart, gfxSkipCharsIterator* aEnd) { - NS_PRECONDITION(mLength != PR_INT32_MAX, "Can't call this with undefined length"); + NS_PRECONDITION(mLength != INT32_MAX, "Can't call this with undefined length"); NS_ASSERTION(aStart && aEnd, "aStart or/and aEnd is null"); aStart->SetOriginalOffset(mStart.GetOriginalOffset()); @@ -3199,7 +3199,7 @@ PropertyProvider::FindJustificationRange(gfxSkipCharsIterator* aStart, void PropertyProvider::SetupJustificationSpacing() { - NS_PRECONDITION(mLength != PR_INT32_MAX, "Can't call this with undefined length"); + NS_PRECONDITION(mLength != INT32_MAX, "Can't call this with undefined length"); if (!(mFrame->GetStateBits() & TEXT_JUSTIFICATION_ENABLED)) return; @@ -4016,7 +4016,7 @@ class nsContinuingTextFrame : public nsTextFrame { gfxSkipChars* aSkipChars = nullptr, gfxSkipCharsIterator* aSkipIter = nullptr, uint32_t aSkippedStartOffset = 0, - uint32_t aSkippedMaxLength = PR_UINT32_MAX) + uint32_t aSkippedMaxLength = UINT32_MAX) { return NS_ERROR_NOT_IMPLEMENTED; } // Call on a primary text frame only protected: @@ -6958,8 +6958,8 @@ nsTextFrame::AddInlineMinWidthForFlow(nsRenderingContext *aRenderingContext, const nsTextFragment* frag = mContent->GetText(); // If we're hyphenating, the PropertyProvider needs the actual length; - // otherwise we can just pass PR_INT32_MAX to mean "all the text" - int32_t len = PR_INT32_MAX; + // otherwise we can just pass INT32_MAX to mean "all the text" + int32_t len = INT32_MAX; bool hyphenating = frag->GetLength() > 0 && (textStyle->mHyphens == NS_STYLE_HYPHENS_AUTO || (textStyle->mHyphens == NS_STYLE_HYPHENS_MANUAL && @@ -7131,7 +7131,7 @@ nsTextFrame::AddInlinePrefWidthForFlow(nsRenderingContext *aRenderingContext, const nsStyleText* textStyle = GetStyleText(); const nsTextFragment* frag = mContent->GetText(); PropertyProvider provider(textRun, textStyle, frag, this, - iter, PR_INT32_MAX, nullptr, 0, aTextRunType); + iter, INT32_MAX, nullptr, 0, aTextRunType); bool collapseWhitespace = !textStyle->WhiteSpaceIsSignificant(); bool preformatNewlines = textStyle->NewlineIsSignificant(); @@ -7892,7 +7892,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth, int32_t lastBreak = -1; if (charsFit >= limitLength) { charsFit = limitLength; - if (transformedLastBreak != PR_UINT32_MAX) { + if (transformedLastBreak != UINT32_MAX) { // lastBreak is needed. // This may set lastBreak greater than 'length', but that's OK lastBreak = end.ConvertSkippedToOriginal(transformedOffset + transformedLastBreak); diff --git a/layout/style/Declaration.cpp b/layout/style/Declaration.cpp index 0e4c0dc445ac9..bf5247119732b 100644 --- a/layout/style/Declaration.cpp +++ b/layout/style/Declaration.cpp @@ -18,7 +18,7 @@ namespace css { // check that we can fit all the CSS properties into a uint8_t // for the mOrder array - if not, might need to use uint16_t! -MOZ_STATIC_ASSERT(eCSSProperty_COUNT_no_shorthands - 1 <= PR_UINT8_MAX, +MOZ_STATIC_ASSERT(eCSSProperty_COUNT_no_shorthands - 1 <= UINT8_MAX, "CSS longhand property numbers no longer fit in a uint8_t"); Declaration::Declaration() diff --git a/layout/style/StyleRule.cpp b/layout/style/StyleRule.cpp index 43b68f22aa856..e36e88ea36fcf 100644 --- a/layout/style/StyleRule.cpp +++ b/layout/style/StyleRule.cpp @@ -309,7 +309,7 @@ nsCSSSelector::nsCSSSelector(void) mPseudoType(nsCSSPseudoElements::ePseudo_NotPseudoElement) { MOZ_COUNT_CTOR(nsCSSSelector); - MOZ_STATIC_ASSERT(nsCSSPseudoElements::ePseudo_MAX < PR_INT16_MAX, + MOZ_STATIC_ASSERT(nsCSSPseudoElements::ePseudo_MAX < INT16_MAX, "nsCSSPseudoElements::Type values overflow mPseudoType"); } diff --git a/layout/style/StyleRule.h b/layout/style/StyleRule.h index 040a476781e09..5f919624823b6 100644 --- a/layout/style/StyleRule.h +++ b/layout/style/StyleRule.h @@ -183,7 +183,7 @@ struct nsCSSSelector { return static_cast(mPseudoType); } void SetPseudoType(nsCSSPseudoElements::Type aType) { - NS_ASSERTION(aType > PR_INT16_MIN && aType < PR_INT16_MAX, "Out of bounds"); + NS_ASSERTION(aType > INT16_MIN && aType < INT16_MAX, "Out of bounds"); mPseudoType = static_cast(aType); } diff --git a/layout/style/nsAnimationManager.cpp b/layout/style/nsAnimationManager.cpp index dcd57aa6290fc..df102b1c11c19 100644 --- a/layout/style/nsAnimationManager.cpp +++ b/layout/style/nsAnimationManager.cpp @@ -598,7 +598,7 @@ class PercentageHashKey : public PLDHashEntryHdr "this hash function assumes PLDHashNumber is uint32_t"); float key = *aKey; NS_ABORT_IF_FALSE(0.0f <= key && key <= 1.0f, "out of range"); - return PLDHashNumber(key * PR_UINT32_MAX); + return PLDHashNumber(key * UINT32_MAX); } enum { ALLOW_MEMMOVE = true }; diff --git a/layout/style/nsCSSDataBlock.h b/layout/style/nsCSSDataBlock.h index 1d7d14cf2d443..e12a119ec3e25 100644 --- a/layout/style/nsCSSDataBlock.h +++ b/layout/style/nsCSSDataBlock.h @@ -101,7 +101,7 @@ class nsCSSCompressedDataBlock { // enums. So we manually squeeze nsCSSProperty into 16 bits ourselves. // The static assertion below ensures it fits. typedef int16_t CompressedCSSProperty; - static const size_t MaxCompressedCSSProperty = PR_INT16_MAX; + static const size_t MaxCompressedCSSProperty = INT16_MAX; private: static size_t DataSize(uint32_t aNumProps) { diff --git a/layout/style/nsCSSRules.cpp b/layout/style/nsCSSRules.cpp index 3a3244e30c43c..3076124ddd19a 100644 --- a/layout/style/nsCSSRules.cpp +++ b/layout/style/nsCSSRules.cpp @@ -676,7 +676,7 @@ GroupRule::InsertRule(const nsAString & aRule, uint32_t aIndex, uint32_t* _retva if (aIndex > uint32_t(mRules.Count())) return NS_ERROR_DOM_INDEX_SIZE_ERR; - NS_ASSERTION(uint32_t(mRules.Count()) <= PR_INT32_MAX, + NS_ASSERTION(uint32_t(mRules.Count()) <= INT32_MAX, "Too many style rules!"); return mSheet->InsertRuleIntoGroup(aRule, this, aIndex, _retval); @@ -690,7 +690,7 @@ GroupRule::DeleteRule(uint32_t aIndex) if (aIndex >= uint32_t(mRules.Count())) return NS_ERROR_DOM_INDEX_SIZE_ERR; - NS_ASSERTION(uint32_t(mRules.Count()) <= PR_INT32_MAX, + NS_ASSERTION(uint32_t(mRules.Count()) <= INT32_MAX, "Too many style rules!"); return mSheet->DeleteRuleFromGroup(this, aIndex); diff --git a/layout/style/nsCSSScanner.cpp b/layout/style/nsCSSScanner.cpp index 9d69ee1505100..1d1744ab5f166 100644 --- a/layout/style/nsCSSScanner.cpp +++ b/layout/style/nsCSSScanner.cpp @@ -1241,9 +1241,9 @@ nsCSSScanner::ParseNumber(int32_t c, nsCSSToken& aToken) } else if (!gotDot) { // Clamp values outside of integer range. if (sign > 0) { - aToken.mInteger = int32_t(NS_MIN(intPart, double(PR_INT32_MAX))); + aToken.mInteger = int32_t(NS_MIN(intPart, double(INT32_MAX))); } else { - aToken.mInteger = int32_t(NS_MAX(-intPart, double(PR_INT32_MIN))); + aToken.mInteger = int32_t(NS_MAX(-intPart, double(INT32_MIN))); } aToken.mIntegerValid = true; } diff --git a/layout/style/nsCSSStyleSheet.cpp b/layout/style/nsCSSStyleSheet.cpp index a2313b68ca4a5..06be12521c645 100644 --- a/layout/style/nsCSSStyleSheet.cpp +++ b/layout/style/nsCSSStyleSheet.cpp @@ -1822,7 +1822,7 @@ nsCSSStyleSheet::InsertRuleInternal(const nsAString& aRule, if (aIndex > uint32_t(mInner->mOrderedRules.Count())) return NS_ERROR_DOM_INDEX_SIZE_ERR; - NS_ASSERTION(uint32_t(mInner->mOrderedRules.Count()) <= PR_INT32_MAX, + NS_ASSERTION(uint32_t(mInner->mOrderedRules.Count()) <= INT32_MAX, "Too many style rules!"); // Hold strong ref to the CSSLoader in case the document update @@ -1956,7 +1956,7 @@ nsCSSStyleSheet::DeleteRule(uint32_t aIndex) if (aIndex >= uint32_t(mInner->mOrderedRules.Count())) return NS_ERROR_DOM_INDEX_SIZE_ERR; - NS_ASSERTION(uint32_t(mInner->mOrderedRules.Count()) <= PR_INT32_MAX, + NS_ASSERTION(uint32_t(mInner->mOrderedRules.Count()) <= INT32_MAX, "Too many style rules!"); // Hold a strong ref to the rule so it doesn't die when we RemoveObjectAt diff --git a/layout/style/nsFontFaceLoader.cpp b/layout/style/nsFontFaceLoader.cpp index aba96a46abc6d..3cf39cf3cf22a 100644 --- a/layout/style/nsFontFaceLoader.cpp +++ b/layout/style/nsFontFaceLoader.cpp @@ -877,7 +877,7 @@ nsUserFontSet::SyncLoadFontData(gfxProxyFontEntry *aFontToLoad, if (bufferLength64 == 0) { return NS_ERROR_FAILURE; } - if (bufferLength64 > PR_UINT32_MAX) { + if (bufferLength64 > UINT32_MAX) { return NS_ERROR_FILE_TOO_BIG; } aBufferLength = static_cast(bufferLength64); diff --git a/layout/style/nsStyleContext.cpp b/layout/style/nsStyleContext.cpp index 96153c1cb7537..329373f1636ac 100644 --- a/layout/style/nsStyleContext.cpp +++ b/layout/style/nsStyleContext.cpp @@ -46,7 +46,7 @@ nsStyleContext::nsStyleContext(nsStyleContext* aParent, { // This check has to be done "backward", because if it were written the // more natural way it wouldn't fail even when it needed to. - MOZ_STATIC_ASSERT((PR_UINT32_MAX >> NS_STYLE_CONTEXT_TYPE_SHIFT) >= + MOZ_STATIC_ASSERT((UINT32_MAX >> NS_STYLE_CONTEXT_TYPE_SHIFT) >= nsCSSPseudoElements::ePseudo_MAX, "pseudo element bits no longer fit in a uint32_t"); diff --git a/layout/style/nsStyleContext.h b/layout/style/nsStyleContext.h index 9d3d451c75088..76c1cfffa4148 100644 --- a/layout/style/nsStyleContext.h +++ b/layout/style/nsStyleContext.h @@ -66,7 +66,7 @@ class nsStyleContext void Destroy(); nsrefcnt AddRef() { - if (mRefCnt == PR_UINT32_MAX) { + if (mRefCnt == UINT32_MAX) { NS_WARNING("refcount overflow, leaking object"); return mRefCnt; } @@ -76,7 +76,7 @@ class nsStyleContext } nsrefcnt Release() { - if (mRefCnt == PR_UINT32_MAX) { + if (mRefCnt == UINT32_MAX) { NS_WARNING("refcount overflow, leaking object"); return mRefCnt; } diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index cb351c7813880..b0c637da8d0bb 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -1569,7 +1569,7 @@ ConvertToPixelCoord(const nsStyleCoord& aCoord, int32_t aPercentScale) return 0; } NS_ABORT_IF_FALSE(pixelValue >= 0, "we ensured non-negative while parsing"); - pixelValue = NS_MIN(pixelValue, double(PR_INT32_MAX)); // avoid overflow + pixelValue = NS_MIN(pixelValue, double(INT32_MAX)); // avoid overflow return NS_lround(pixelValue); } diff --git a/layout/svg/nsSVGUtils.h b/layout/svg/nsSVGUtils.h index 55d2d7767e9e9..cbdc25e6f6293 100644 --- a/layout/svg/nsSVGUtils.h +++ b/layout/svg/nsSVGUtils.h @@ -562,8 +562,8 @@ class nsSVGUtils */ static int32_t ClampToInt(double aVal) { - return NS_lround(NS_MAX(double(PR_INT32_MIN), - NS_MIN(double(PR_INT32_MAX), aVal))); + return NS_lround(NS_MAX(double(INT32_MIN), + NS_MIN(double(INT32_MAX), aVal))); } static nscolor GetFallbackOrPaintColor(gfxContext *aContext, diff --git a/layout/xul/base/src/nsMenuPopupFrame.cpp b/layout/xul/base/src/nsMenuPopupFrame.cpp index 220b7b68caba2..b66280a9691d2 100644 --- a/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -1902,7 +1902,7 @@ nsMenuPopupFrame::CreatePopupView() // Create a view nsIView* parentView = viewManager->GetRootView(); nsViewVisibility visibility = nsViewVisibility_kHide; - int32_t zIndex = PR_INT32_MAX; + int32_t zIndex = INT32_MAX; bool autoZIndex = false; NS_ASSERTION(parentView, "no parent view"); diff --git a/layout/xul/base/src/nsXULPopupManager.cpp b/layout/xul/base/src/nsXULPopupManager.cpp index 6c9c9d95e182c..d4588f9bc85bb 100644 --- a/layout/xul/base/src/nsXULPopupManager.cpp +++ b/layout/xul/base/src/nsXULPopupManager.cpp @@ -192,7 +192,7 @@ nsXULPopupManager::Rollup(uint32_t aCount, bool aGetLastRolledUp) // if a number of popups to close has been specified, determine the last // popup to close nsIContent* lastPopup = nullptr; - if (aCount != PR_UINT32_MAX) { + if (aCount != UINT32_MAX) { nsMenuChainItem* last = item; while (--aCount && last->GetParent()) { last = last->GetParent(); diff --git a/modules/libjar/nsJAR.cpp b/modules/libjar/nsJAR.cpp index 803fa6c3b10fd..b6c7c8a5701bc 100644 --- a/modules/libjar/nsJAR.cpp +++ b/modules/libjar/nsJAR.cpp @@ -425,7 +425,7 @@ nsJAR::LoadEntry(const nsACString &aFilename, char** aBuf, uint32_t* aBufLen) uint64_t len64; rv = manifestStream->Available(&len64); if (NS_FAILED(rv)) return rv; - NS_ENSURE_TRUE(len64 < PR_UINT32_MAX, NS_ERROR_FILE_CORRUPTED); // bug 164695 + NS_ENSURE_TRUE(len64 < UINT32_MAX, NS_ERROR_FILE_CORRUPTED); // bug 164695 uint32_t len = (uint32_t)len64; buf = (char*)malloc(len+1); if (!buf) return NS_ERROR_OUT_OF_MEMORY; diff --git a/modules/libjar/nsJARChannel.cpp b/modules/libjar/nsJARChannel.cpp index d7b0e6ff57579..fc4c04d38e36e 100644 --- a/modules/libjar/nsJARChannel.cpp +++ b/modules/libjar/nsJARChannel.cpp @@ -136,7 +136,7 @@ nsJARInputThunk::EnsureJarStream() rv = mJarStream->Available((uint64_t *) &avail); if (NS_FAILED(rv)) return rv; - mContentLength = avail < PR_INT32_MAX ? (int32_t) avail : -1; + mContentLength = avail < INT32_MAX ? (int32_t) avail : -1; return NS_OK; } diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp index d5c6803a3f7e1..fa7f5c5bfd80a 100644 --- a/modules/libjar/nsZipArchive.cpp +++ b/modules/libjar/nsZipArchive.cpp @@ -105,7 +105,7 @@ nsresult nsZipHandle::Init(nsIFile *file, nsZipHandle **ret) return rv; int64_t size = PR_Available64(fd); - if (size >= PR_INT32_MAX) + if (size >= INT32_MAX) return NS_ERROR_FILE_TOO_BIG; PRFileMap *map = PR_CreateFileMap(fd, size, PR_PROT_READONLY); diff --git a/modules/libpref/src/Preferences.cpp b/modules/libpref/src/Preferences.cpp index 4f85a464aa8ee..be05d57562ff4 100644 --- a/modules/libpref/src/Preferences.cpp +++ b/modules/libpref/src/Preferences.cpp @@ -754,7 +754,7 @@ static nsresult openPrefFile(nsIFile* aFile) rv = inStr->Available(&fileSize64); if (NS_FAILED(rv)) return rv; - NS_ENSURE_TRUE(fileSize64 <= PR_UINT32_MAX, NS_ERROR_FILE_TOO_BIG); + NS_ENSURE_TRUE(fileSize64 <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG); uint32_t fileSize = (uint32_t)fileSize64; nsAutoArrayPtr fileBuffer(new char[fileSize]); diff --git a/netwerk/base/public/nsASocketHandler.h b/netwerk/base/public/nsASocketHandler.h index ab0ee92582b6b..3e2efe95231ba 100644 --- a/netwerk/base/public/nsASocketHandler.h +++ b/netwerk/base/public/nsASocketHandler.h @@ -14,7 +14,7 @@ class nsASocketHandler : public nsISupports nsASocketHandler() : mCondition(NS_OK) , mPollFlags(0) - , mPollTimeout(PR_UINT16_MAX) + , mPollTimeout(UINT16_MAX) {} // @@ -36,8 +36,8 @@ class nsASocketHandler : public nsISupports // spent waiting for activity on this socket. if this timeout is reached, // then OnSocketReady will be called with outFlags = -1. // - // the default value for this member is PR_UINT16_MAX, which disables the - // timeout error checking. (i.e., a timeout value of PR_UINT16_MAX is + // the default value for this member is UINT16_MAX, which disables the + // timeout error checking. (i.e., a timeout value of UINT16_MAX is // never reached.) // uint16_t mPollTimeout; diff --git a/netwerk/base/public/nsICryptoHMAC.idl b/netwerk/base/public/nsICryptoHMAC.idl index d7591e52c91ee..92e06a0a4818d 100644 --- a/netwerk/base/public/nsICryptoHMAC.idl +++ b/netwerk/base/public/nsICryptoHMAC.idl @@ -68,7 +68,7 @@ interface nsICryptoHMAC : nsISupports * @param aStream an input stream to read from. * * @param aLen how much to read from the given |aStream|. Passing - * PR_UINT32_MAX indicates that all data available will be used + * UINT32_MAX indicates that all data available will be used * to update the hash. * * @throws NS_ERROR_NOT_INITIALIZED if |init| has not been diff --git a/netwerk/base/public/nsICryptoHash.idl b/netwerk/base/public/nsICryptoHash.idl index 7952ec34abd3f..cd865a3a9d337 100644 --- a/netwerk/base/public/nsICryptoHash.idl +++ b/netwerk/base/public/nsICryptoHash.idl @@ -72,7 +72,7 @@ interface nsICryptoHash : nsISupports * @param aStream an input stream to read from. * * @param aLen how much to read from the given |aStream|. Passing - * PR_UINT32_MAX indicates that all data available will be used + * UINT32_MAX indicates that all data available will be used * to update the hash. * * @throws NS_ERROR_NOT_INITIALIZED if |init| has not been diff --git a/netwerk/base/public/nsIProtocolProxyService.idl b/netwerk/base/public/nsIProtocolProxyService.idl index 975f158568ea3..526eab8ab2999 100644 --- a/netwerk/base/public/nsIProtocolProxyService.idl +++ b/netwerk/base/public/nsIProtocolProxyService.idl @@ -122,7 +122,7 @@ interface nsIProtocolProxyService : nsISupports * for currently defined flags. * @param aFailoverTimeout * Specifies the length of time (in seconds) to ignore this proxy if - * this proxy fails. Pass PR_UINT32_MAX to specify the default + * this proxy fails. Pass UINT32_MAX to specify the default * timeout value, causing nsIProxyInfo::failoverTimeout to be * assigned the default value. * @param aFailoverProxy diff --git a/netwerk/base/public/nsISocketTransport.idl b/netwerk/base/public/nsISocketTransport.idl index 50213ccfcce1a..205de9703978c 100644 --- a/netwerk/base/public/nsISocketTransport.idl +++ b/netwerk/base/public/nsISocketTransport.idl @@ -80,7 +80,7 @@ interface nsISocketTransport : nsITransport boolean isAlive(); /** - * Socket timeouts in seconds. To specify no timeout, pass PR_UINT32_MAX + * Socket timeouts in seconds. To specify no timeout, pass UINT32_MAX * as aValue to setTimeout. The implementation may truncate timeout values * to a smaller range of values (e.g., 0 to 0xFFFF). */ diff --git a/netwerk/base/public/nsNetUtil.h b/netwerk/base/public/nsNetUtil.h index a9e99d64d3691..923b5cd09f574 100644 --- a/netwerk/base/public/nsNetUtil.h +++ b/netwerk/base/public/nsNetUtil.h @@ -728,7 +728,7 @@ NS_NewProxyInfo(const nsACString &type, nsCOMPtr pps = do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv); if (NS_SUCCEEDED(rv)) - rv = pps->NewProxyInfo(type, host, port, flags, PR_UINT32_MAX, nullptr, + rv = pps->NewProxyInfo(type, host, port, flags, UINT32_MAX, nullptr, result); return rv; } diff --git a/netwerk/base/src/nsBaseChannel.cpp b/netwerk/base/src/nsBaseChannel.cpp index 164ab4d44b072..f3252200ee6a0 100644 --- a/netwerk/base/src/nsBaseChannel.cpp +++ b/netwerk/base/src/nsBaseChannel.cpp @@ -509,7 +509,7 @@ NS_IMETHODIMP nsBaseChannel::GetContentLength(int32_t *aContentLength) { int64_t len = ContentLength64(); - if (len > PR_INT32_MAX || len < 0) + if (len > INT32_MAX || len < 0) *aContentLength = -1; else *aContentLength = (int32_t) len; diff --git a/netwerk/base/src/nsInputStreamPump.cpp b/netwerk/base/src/nsInputStreamPump.cpp index a327e70c77e10..2898790b1c6c1 100644 --- a/netwerk/base/src/nsInputStreamPump.cpp +++ b/netwerk/base/src/nsInputStreamPump.cpp @@ -105,7 +105,7 @@ nsInputStreamPump::PeekStream(PeekSegmentFun callback, void* closure) nsresult rv = mAsyncStream->Available(&dummy64); if (NS_FAILED(rv)) return rv; - uint32_t dummy = (uint32_t)NS_MIN(dummy64, (uint64_t)PR_UINT32_MAX); + uint32_t dummy = (uint32_t)NS_MIN(dummy64, (uint64_t)UINT32_MAX); PeekData data(callback, closure); return mAsyncStream->ReadSegments(CallPeekFunc, @@ -473,8 +473,8 @@ nsInputStreamPump::OnStateTransfer() } uint32_t odaAvail = - avail > PR_UINT32_MAX ? - PR_UINT32_MAX : uint32_t(avail); + avail > UINT32_MAX ? + UINT32_MAX : uint32_t(avail); LOG((" calling OnDataAvailable [offset=%llu count=%llu(%u)]\n", mStreamOffset, avail, odaAvail)); diff --git a/netwerk/base/src/nsProtocolProxyService.cpp b/netwerk/base/src/nsProtocolProxyService.cpp index 5d13eced77b1f..742cb33c041ce 100644 --- a/netwerk/base/src/nsProtocolProxyService.cpp +++ b/netwerk/base/src/nsProtocolProxyService.cpp @@ -1452,7 +1452,7 @@ nsProtocolProxyService::NewProxyInfo_Internal(const char *aType, proxyInfo->mPort = aPort; proxyInfo->mFlags = aFlags; proxyInfo->mResolveFlags = aResolveFlags; - proxyInfo->mTimeout = aFailoverTimeout == PR_UINT32_MAX + proxyInfo->mTimeout = aFailoverTimeout == UINT32_MAX ? mFailedProxyTimeout : aFailoverTimeout; failover.swap(proxyInfo->mNext); @@ -1608,7 +1608,7 @@ nsProtocolProxyService::Resolve_Internal(nsIURI *uri, if (type) { rv = NewProxyInfo_Internal(type, *host, port, proxyFlags, - PR_UINT32_MAX, nullptr, flags, + UINT32_MAX, nullptr, flags, result); if (NS_FAILED(rv)) return rv; diff --git a/netwerk/base/src/nsProxyInfo.h b/netwerk/base/src/nsProxyInfo.h index 571901f963b8a..bfb5af4970f42 100644 --- a/netwerk/base/src/nsProxyInfo.h +++ b/netwerk/base/src/nsProxyInfo.h @@ -44,7 +44,7 @@ class nsProxyInfo MOZ_FINAL : public nsIProxyInfo , mPort(-1) , mFlags(0) , mResolveFlags(0) - , mTimeout(PR_UINT32_MAX) + , mTimeout(UINT32_MAX) , mNext(nullptr) {} diff --git a/netwerk/base/src/nsSocketTransport2.cpp b/netwerk/base/src/nsSocketTransport2.cpp index d7f518de505eb..f2504a6afada8 100644 --- a/netwerk/base/src/nsSocketTransport2.cpp +++ b/netwerk/base/src/nsSocketTransport2.cpp @@ -702,8 +702,8 @@ nsSocketTransport::nsSocketTransport() NS_ADDREF(gSocketTransportService); - mTimeouts[TIMEOUT_CONNECT] = PR_UINT16_MAX; // no timeout - mTimeouts[TIMEOUT_READ_WRITE] = PR_UINT16_MAX; // no timeout + mTimeouts[TIMEOUT_CONNECT] = UINT16_MAX; // no timeout + mTimeouts[TIMEOUT_READ_WRITE] = UINT16_MAX; // no timeout } nsSocketTransport::~nsSocketTransport() @@ -1983,7 +1983,7 @@ nsSocketTransport::SetTimeout(uint32_t type, uint32_t value) { NS_ENSURE_ARG_MAX(type, nsISocketTransport::TIMEOUT_READ_WRITE); // truncate overly large timeout values. - mTimeouts[type] = (uint16_t) NS_MIN(value, PR_UINT16_MAX); + mTimeouts[type] = (uint16_t) NS_MIN(value, UINT16_MAX); PostEvent(MSG_TIMEOUT_CHANGED); return NS_OK; } diff --git a/netwerk/base/src/nsSocketTransportService2.cpp b/netwerk/base/src/nsSocketTransportService2.cpp index cdbf60323983a..68d8cad841464 100644 --- a/netwerk/base/src/nsSocketTransportService2.cpp +++ b/netwerk/base/src/nsSocketTransportService2.cpp @@ -344,7 +344,7 @@ nsSocketTransportService::PollTimeout() return NS_SOCKET_POLL_TIMEOUT; // compute minimum time before any socket timeout expires. - uint32_t minR = PR_UINT16_MAX; + uint32_t minR = UINT16_MAX; for (uint32_t i=0; iOnSocketReady(desc.fd, desc.out_flags); } // check for timeout errors unless disabled... - else if (s.mHandler->mPollTimeout != PR_UINT16_MAX) { + else if (s.mHandler->mPollTimeout != UINT16_MAX) { // update elapsed time counter - if (NS_UNLIKELY(pollInterval > (PR_UINT16_MAX - s.mElapsedTime))) - s.mElapsedTime = PR_UINT16_MAX; + if (NS_UNLIKELY(pollInterval > (UINT16_MAX - s.mElapsedTime))) + s.mElapsedTime = UINT16_MAX; else s.mElapsedTime += uint16_t(pollInterval); // check for timeout expiration diff --git a/netwerk/base/src/nsStandardURL.cpp b/netwerk/base/src/nsStandardURL.cpp index 081203d16bf38..e54281ce3ecce 100644 --- a/netwerk/base/src/nsStandardURL.cpp +++ b/netwerk/base/src/nsStandardURL.cpp @@ -836,7 +836,7 @@ nsStandardURL::AppendToSubstring(uint32_t pos, uint32_t tailLen = strlen(tail); // Check for int overflow for proposed length of combined string - if (PR_UINT32_MAX - ((uint32_t)len + 1) < tailLen) + if (UINT32_MAX - ((uint32_t)len + 1) < tailLen) return NULL; char *result = (char *) NS_Alloc(len + tailLen + 1); diff --git a/netwerk/base/src/nsStreamLoader.cpp b/netwerk/base/src/nsStreamLoader.cpp index de8dee180ab65..fa4ee50c3d05f 100644 --- a/netwerk/base/src/nsStreamLoader.cpp +++ b/netwerk/base/src/nsStreamLoader.cpp @@ -118,7 +118,7 @@ nsStreamLoader::WriteSegmentFun(nsIInputStream *inStr, { nsStreamLoader *self = (nsStreamLoader *) closure; - if (count > PR_UINT32_MAX - self->mLength) { + if (count > UINT32_MAX - self->mLength) { return NS_ERROR_ILLEGAL_VALUE; // is there a better error to use here? } diff --git a/netwerk/base/src/nsSyncStreamListener.cpp b/netwerk/base/src/nsSyncStreamListener.cpp index 9663ab4ed5ca9..1e9194ca722e4 100644 --- a/netwerk/base/src/nsSyncStreamListener.cpp +++ b/netwerk/base/src/nsSyncStreamListener.cpp @@ -12,7 +12,7 @@ nsSyncStreamListener::Init() return NS_NewPipe(getter_AddRefs(mPipeIn), getter_AddRefs(mPipeOut), nsIOService::gDefaultSegmentSize, - PR_UINT32_MAX, // no size limit + UINT32_MAX, // no size limit false, false); } diff --git a/netwerk/cache/nsCacheEntryDescriptor.cpp b/netwerk/cache/nsCacheEntryDescriptor.cpp index c0b3849ba0eaf..792d549ba08c3 100644 --- a/netwerk/cache/nsCacheEntryDescriptor.cpp +++ b/netwerk/cache/nsCacheEntryDescriptor.cpp @@ -870,7 +870,7 @@ nsOutputStreamWrapper::LazyInit() nsresult nsCacheEntryDescriptor:: nsOutputStreamWrapper::OnWrite(uint32_t count) { - if (count > PR_INT32_MAX) return NS_ERROR_UNEXPECTED; + if (count > INT32_MAX) return NS_ERROR_UNEXPECTED; return mDescriptor->RequestDataSizeChange((int32_t)count); } diff --git a/netwerk/cookie/nsCookieService.cpp b/netwerk/cookie/nsCookieService.cpp index cc2831673008a..4fd6943404a31 100644 --- a/netwerk/cookie/nsCookieService.cpp +++ b/netwerk/cookie/nsCookieService.cpp @@ -1713,7 +1713,7 @@ nsCookieService::PrefChanged(nsIPrefBranch *aPrefBranch) if (NS_SUCCEEDED(aPrefBranch->GetIntPref(kPrefCookiePurgeAge, &val))) { mCookiePurgeAge = - int64_t(LIMIT(val, 0, PR_INT32_MAX, PR_INT32_MAX)) * PR_USEC_PER_SEC; + int64_t(LIMIT(val, 0, INT32_MAX, INT32_MAX)) * PR_USEC_PER_SEC; } bool boolval; diff --git a/netwerk/protocol/about/nsAboutCacheEntry.cpp b/netwerk/protocol/about/nsAboutCacheEntry.cpp index 91ec6ffc93a4d..3e150de018cf7 100644 --- a/netwerk/protocol/about/nsAboutCacheEntry.cpp +++ b/netwerk/protocol/about/nsAboutCacheEntry.cpp @@ -115,7 +115,7 @@ nsAboutCacheEntry::GetContentStream(nsIURI *uri, nsIInputStream **result) rv = NS_NewPipe2(getter_AddRefs(inputStream), getter_AddRefs(mOutputStream), true, false, - 256, PR_UINT32_MAX); + 256, UINT32_MAX); if (NS_FAILED(rv)) return rv; NS_NAMED_LITERAL_CSTRING( diff --git a/netwerk/protocol/data/nsDataChannel.cpp b/netwerk/protocol/data/nsDataChannel.cpp index 8e113b7551abf..4233ad809291d 100644 --- a/netwerk/protocol/data/nsDataChannel.cpp +++ b/netwerk/protocol/data/nsDataChannel.cpp @@ -51,7 +51,7 @@ nsDataChannel::OpenContentStream(bool async, nsIInputStream **result, rv = NS_NewPipe(getter_AddRefs(bufInStream), getter_AddRefs(bufOutStream), nsIOService::gDefaultSegmentSize, - PR_UINT32_MAX, + UINT32_MAX, async, true); if (NS_FAILED(rv)) return rv; diff --git a/netwerk/protocol/device/GonkCaptureProvider.cpp b/netwerk/protocol/device/GonkCaptureProvider.cpp index 94b6a45faab08..923f5c6b9944f 100644 --- a/netwerk/protocol/device/GonkCaptureProvider.cpp +++ b/netwerk/protocol/device/GonkCaptureProvider.cpp @@ -311,7 +311,7 @@ GonkCameraInputStream::Init(nsACString& aContentType, nsCaptureParams* aParams) params.getSupportedPreviewSizes(previewSizes); // find the available preview size closest to the requested size. - uint32_t minSizeDelta = PR_UINT32_MAX; + uint32_t minSizeDelta = UINT32_MAX; uint32_t bestWidth = mWidth; uint32_t bestHeight = mHeight; for (uint32_t i = 0; i < previewSizes.size(); i++) { diff --git a/netwerk/protocol/file/nsFileChannel.cpp b/netwerk/protocol/file/nsFileChannel.cpp index 8f0ba873011b4..709a2a2acdb6f 100644 --- a/netwerk/protocol/file/nsFileChannel.cpp +++ b/netwerk/protocol/file/nsFileChannel.cpp @@ -426,7 +426,7 @@ nsFileChannel::SetUploadStream(nsIInputStream *stream, nsresult rv = mUploadStream->Available(&avail); if (NS_FAILED(rv)) return rv; - if (avail < PR_INT64_MAX) + if (avail < INT64_MAX) mUploadLength = avail; } } else { diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index 08d0e76c4cc47..1ca6fdfcd7de4 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -1193,7 +1193,7 @@ HttpChannelChild::ResumeAt(uint64_t startPos, const nsACString& entityID) NS_IMETHODIMP HttpChannelChild::SetPriority(int32_t aPriority) { - int16_t newValue = clamped(aPriority, PR_INT16_MIN, PR_INT16_MAX); + int16_t newValue = clamped(aPriority, INT16_MIN, INT16_MAX); if (mPriority == newValue) return NS_OK; mPriority = newValue; diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 10a1ce8c46d59..1ffd2f333be4d 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -4489,7 +4489,7 @@ nsHttpChannel::SetupFallbackChannel(const char *aFallbackKey) NS_IMETHODIMP nsHttpChannel::SetPriority(int32_t value) { - int16_t newValue = clamped(value, PR_INT16_MIN, PR_INT16_MAX); + int16_t newValue = clamped(value, INT16_MIN, INT16_MAX); if (mPriority == newValue) return NS_OK; mPriority = newValue; diff --git a/netwerk/protocol/http/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp index 4d9aa6e1eabc7..170db7c72a808 100644 --- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp +++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp @@ -758,7 +758,7 @@ nsHttpConnectionMgr::PruneDeadConnectionsCB(const nsACString &key, // Find out how long it will take for next idle connection to not be reusable // anymore. - uint32_t timeToNextExpire = PR_UINT32_MAX; + uint32_t timeToNextExpire = UINT32_MAX; int32_t count = ent->mIdleConns.Length(); if (count > 0) { for (int32_t i=count-1; i>=0; --i) { @@ -793,7 +793,7 @@ nsHttpConnectionMgr::PruneDeadConnectionsCB(const nsACString &key, // If time to next expire found is shorter than time to next wake-up, we need to // change the time for next wake-up. - if (timeToNextExpire != PR_UINT32_MAX) { + if (timeToNextExpire != UINT32_MAX) { uint32_t now = NowInSeconds(); uint64_t timeOfNextExpire = now + timeToNextExpire; // If pruning of dead connections is not already scheduled to happen diff --git a/netwerk/protocol/http/nsHttpHeaderArray.h b/netwerk/protocol/http/nsHttpHeaderArray.h index aafb4fedc39bd..a977c7d9ae00a 100644 --- a/netwerk/protocol/http/nsHttpHeaderArray.h +++ b/netwerk/protocol/http/nsHttpHeaderArray.h @@ -133,7 +133,7 @@ inline int32_t nsHttpHeaderArray::LookupEntry(nsHttpAtom header, const nsEntry **entry) const { uint32_t index = mHeaders.IndexOf(header, 0, nsEntry::MatchHeader()); - if (index != PR_UINT32_MAX) + if (index != UINT32_MAX) *entry = &mHeaders[index]; return index; } @@ -142,7 +142,7 @@ inline int32_t nsHttpHeaderArray::LookupEntry(nsHttpAtom header, nsEntry **entry) { uint32_t index = mHeaders.IndexOf(header, 0, nsEntry::MatchHeader()); - if (index != PR_UINT32_MAX) + if (index != UINT32_MAX) *entry = &mHeaders[index]; return index; } diff --git a/netwerk/protocol/http/nsHttpPipeline.cpp b/netwerk/protocol/http/nsHttpPipeline.cpp index 9e598787dbc8e..7ea108e788531 100644 --- a/netwerk/protocol/http/nsHttpPipeline.cpp +++ b/netwerk/protocol/http/nsHttpPipeline.cpp @@ -855,7 +855,7 @@ nsHttpPipeline::FillSendBuf() nsAHttpTransaction *response = Response(0); if (response && !response->PipelinePosition()) response->SetPipelinePosition(1); - rv = trans->ReadSegments(this, (uint32_t)NS_MIN(avail, (uint64_t)PR_UINT32_MAX), &n); + rv = trans->ReadSegments(this, (uint32_t)NS_MIN(avail, (uint64_t)UINT32_MAX), &n); if (NS_FAILED(rv)) return rv; if (n == 0) { diff --git a/netwerk/protocol/http/nsHttpTransaction.cpp b/netwerk/protocol/http/nsHttpTransaction.cpp index b06ac15d9a804..52fd97b6f8891 100644 --- a/netwerk/protocol/http/nsHttpTransaction.cpp +++ b/netwerk/protocol/http/nsHttpTransaction.cpp @@ -1332,7 +1332,7 @@ nsHttpTransaction::HandleContent(char *buf, if (toReadBeforeRestart && *contentRead) { uint32_t ignore = - static_cast(NS_MIN(toReadBeforeRestart, PR_UINT32_MAX)); + static_cast(NS_MIN(toReadBeforeRestart, UINT32_MAX)); ignore = NS_MIN(*contentRead, ignore); LOG(("Due To Restart ignoring %d of remaining %ld", ignore, toReadBeforeRestart)); diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp index f29199b3cab20..95e46242a1361 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.cpp +++ b/netwerk/protocol/websocket/WebSocketChannel.cpp @@ -930,7 +930,7 @@ WebSocketChannel::WebSocketChannel() : mDataStarted(0), mIncrementedSessionCount(0), mDecrementedSessionCount(0), - mMaxMessageSize(PR_INT32_MAX), + mMaxMessageSize(INT32_MAX), mStopOnClose(NS_OK), mServerCloseCode(CLOSE_ABNORMAL), mScriptCloseCode(0), @@ -2481,7 +2481,7 @@ WebSocketChannel::AsyncOpen(nsIURI *aURI, rv = prefService->GetIntPref("network.websocket.max-message-size", &intpref); if (NS_SUCCEEDED(rv)) { - mMaxMessageSize = clamped(intpref, 1024, PR_INT32_MAX); + mMaxMessageSize = clamped(intpref, 1024, INT32_MAX); } rv = prefService->GetIntPref("network.websocket.timeout.close", &intpref); if (NS_SUCCEEDED(rv)) { diff --git a/netwerk/streamconv/converters/nsFTPDirListingConv.cpp b/netwerk/streamconv/converters/nsFTPDirListingConv.cpp index 65e817290fed8..88ae748fbab93 100644 --- a/netwerk/streamconv/converters/nsFTPDirListingConv.cpp +++ b/netwerk/streamconv/converters/nsFTPDirListingConv.cpp @@ -90,7 +90,7 @@ nsFTPDirListingConv::OnDataAvailable(nsIRequest* request, nsISupports *ctxt, uint64_t streamLen64; rv = inStr->Available(&streamLen64); NS_ENSURE_SUCCESS(rv, rv); - streamLen = (uint32_t)NS_MIN(streamLen64, uint64_t(PR_UINT32_MAX - 1)); + streamLen = (uint32_t)NS_MIN(streamLen64, uint64_t(UINT32_MAX - 1)); nsAutoArrayPtr buffer(new char[streamLen + 1]); NS_ENSURE_TRUE(buffer, NS_ERROR_OUT_OF_MEMORY); diff --git a/netwerk/streamconv/test/Converters.cpp b/netwerk/streamconv/test/Converters.cpp index 71e6a42fa7e7b..0129a0deb7caf 100644 --- a/netwerk/streamconv/test/Converters.cpp +++ b/netwerk/streamconv/test/Converters.cpp @@ -81,7 +81,7 @@ TestConverter::AsyncConvertData(const char *aFromType, static inline uint32_t saturated(uint64_t aValue) { - return (uint32_t) NS_MIN(aValue, (uint64_t) PR_UINT32_MAX); + return (uint32_t) NS_MIN(aValue, (uint64_t) UINT32_MAX); } // nsIStreamListener method diff --git a/netwerk/streamconv/test/TestStreamConv.cpp b/netwerk/streamconv/test/TestStreamConv.cpp index 2a83b426d3d34..cc3eca988284a 100644 --- a/netwerk/streamconv/test/TestStreamConv.cpp +++ b/netwerk/streamconv/test/TestStreamConv.cpp @@ -66,7 +66,7 @@ class EndListener MOZ_FINAL : public nsIStreamListener { uint64_t len64; rv = inStr->Available(&len64); if (NS_FAILED(rv)) return rv; - uint32_t len = (uint32_t)NS_MIN(len64, (uint64_t)(PR_UINT32_MAX - 1)); + uint32_t len = (uint32_t)NS_MIN(len64, (uint64_t)(UINT32_MAX - 1)); char *buffer = (char*)nsMemory::Alloc(len + 1); if (!buffer) return NS_ERROR_OUT_OF_MEMORY; @@ -100,7 +100,7 @@ NS_IMPL_ISUPPORTS2(EndListener, static uint32_t saturated(uint64_t aValue) { - return (uint32_t)NS_MIN(aValue, (uint64_t)PR_UINT32_MAX); + return (uint32_t)NS_MIN(aValue, (uint64_t)UINT32_MAX); } nsresult SendData(const char * aData, nsIStreamListener* aListener, nsIRequest* request) { diff --git a/parser/html/nsHtml5Highlighter.cpp b/parser/html/nsHtml5Highlighter.cpp index 43b55aaf553c3..b704f9cdd8599 100644 --- a/parser/html/nsHtml5Highlighter.cpp +++ b/parser/html/nsHtml5Highlighter.cpp @@ -47,7 +47,7 @@ PRUnichar nsHtml5Highlighter::sPi[] = nsHtml5Highlighter::nsHtml5Highlighter(nsAHtml5TreeOpSink* aOpSink) : mState(NS_HTML5TOKENIZER_DATA) - , mCStart(PR_INT32_MAX) + , mCStart(INT32_MAX) , mPos(0) , mLineNumber(1) , mInlinesOpen(0) @@ -87,8 +87,8 @@ nsHtml5Highlighter::Start(const nsAutoString& aTitle) Push(nsGkAtoms::title, nullptr); // XUL will add the "Source of: " prefix. uint32_t length = aTitle.Length(); - if (length > PR_INT32_MAX) { - length = PR_INT32_MAX; + if (length > INT32_MAX) { + length = INT32_MAX; } AppendCharacters(aTitle.get(), 0, (int32_t)length); Pop(); // title diff --git a/parser/html/nsHtml5MetaScanner.cpp b/parser/html/nsHtml5MetaScanner.cpp index af561e28988a4..e780093948367 100644 --- a/parser/html/nsHtml5MetaScanner.cpp +++ b/parser/html/nsHtml5MetaScanner.cpp @@ -67,10 +67,10 @@ staticJArray nsHtml5MetaScanner::CONTENT_TYPE = { CONTENT_TYP nsHtml5MetaScanner::nsHtml5MetaScanner() : readable(nullptr), metaState(NS_HTML5META_SCANNER_NO), - contentIndex(PR_INT32_MAX), - charsetIndex(PR_INT32_MAX), - httpEquivIndex(PR_INT32_MAX), - contentTypeIndex(PR_INT32_MAX), + contentIndex(INT32_MAX), + charsetIndex(INT32_MAX), + httpEquivIndex(INT32_MAX), + contentTypeIndex(INT32_MAX), stateSave(NS_HTML5META_SCANNER_DATA), strBufLen(0), strBuf(jArray::newJArray(36)), @@ -247,25 +247,25 @@ nsHtml5MetaScanner::stateLoop(int32_t state) case 'C': { contentIndex = 0; charsetIndex = 0; - httpEquivIndex = PR_INT32_MAX; - contentTypeIndex = PR_INT32_MAX; + httpEquivIndex = INT32_MAX; + contentTypeIndex = INT32_MAX; state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME; NS_HTML5_BREAK(beforeattributenameloop); } case 'h': case 'H': { - contentIndex = PR_INT32_MAX; - charsetIndex = PR_INT32_MAX; + contentIndex = INT32_MAX; + charsetIndex = INT32_MAX; httpEquivIndex = 0; - contentTypeIndex = PR_INT32_MAX; + contentTypeIndex = INT32_MAX; state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME; NS_HTML5_BREAK(beforeattributenameloop); } default: { - contentIndex = PR_INT32_MAX; - charsetIndex = PR_INT32_MAX; - httpEquivIndex = PR_INT32_MAX; - contentTypeIndex = PR_INT32_MAX; + contentIndex = INT32_MAX; + charsetIndex = INT32_MAX; + httpEquivIndex = INT32_MAX; + contentTypeIndex = INT32_MAX; state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME; NS_HTML5_BREAK(beforeattributenameloop); } @@ -312,17 +312,17 @@ nsHtml5MetaScanner::stateLoop(int32_t state) if (contentIndex < CONTENT.length && c == CONTENT[contentIndex]) { ++contentIndex; } else { - contentIndex = PR_INT32_MAX; + contentIndex = INT32_MAX; } if (charsetIndex < CHARSET.length && c == CHARSET[charsetIndex]) { ++charsetIndex; } else { - charsetIndex = PR_INT32_MAX; + charsetIndex = INT32_MAX; } if (httpEquivIndex < HTTP_EQUIV.length && c == HTTP_EQUIV[httpEquivIndex]) { ++httpEquivIndex; } else { - httpEquivIndex = PR_INT32_MAX; + httpEquivIndex = INT32_MAX; } } continue; @@ -520,8 +520,8 @@ nsHtml5MetaScanner::stateLoop(int32_t state) NS_HTML5_CONTINUE(stateloop); } default: { - contentIndex = PR_INT32_MAX; - charsetIndex = PR_INT32_MAX; + contentIndex = INT32_MAX; + charsetIndex = INT32_MAX; state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME; NS_HTML5_CONTINUE(stateloop); } @@ -729,7 +729,7 @@ nsHtml5MetaScanner::handleCharInAttributeValue(int32_t c) if (contentTypeIndex < CONTENT_TYPE.length && toAsciiLowerCase(c) == CONTENT_TYPE[contentTypeIndex]) { ++contentTypeIndex; } else { - contentTypeIndex = PR_INT32_MAX; + contentTypeIndex = INT32_MAX; } } } diff --git a/parser/html/nsHtml5Parser.cpp b/parser/html/nsHtml5Parser.cpp index 4f6431dd5bd26..3f7046b60c0db 100644 --- a/parser/html/nsHtml5Parser.cpp +++ b/parser/html/nsHtml5Parser.cpp @@ -198,7 +198,7 @@ nsHtml5Parser::Parse(const nsAString& aSourceBuffer, if (NS_FAILED(rv = mExecutor->IsBroken())) { return rv; } - if (aSourceBuffer.Length() > PR_INT32_MAX) { + if (aSourceBuffer.Length() > INT32_MAX) { return mExecutor->MarkAsBroken(NS_ERROR_OUT_OF_MEMORY); } diff --git a/parser/html/nsHtml5StringParser.cpp b/parser/html/nsHtml5StringParser.cpp index 20b008bb1a0aa..b7a010be26e23 100644 --- a/parser/html/nsHtml5StringParser.cpp +++ b/parser/html/nsHtml5StringParser.cpp @@ -36,7 +36,7 @@ nsHtml5StringParser::ParseFragment(const nsAString& aSourceBuffer, bool aQuirks, bool aPreventScriptExecution) { - NS_ENSURE_TRUE(aSourceBuffer.Length() <= PR_INT32_MAX, + NS_ENSURE_TRUE(aSourceBuffer.Length() <= INT32_MAX, NS_ERROR_OUT_OF_MEMORY); nsIDocument* doc = aTargetNode->OwnerDoc(); @@ -73,7 +73,7 @@ nsHtml5StringParser::ParseDocument(const nsAString& aSourceBuffer, { MOZ_ASSERT(!aTargetDoc->GetFirstChild()); - NS_ENSURE_TRUE(aSourceBuffer.Length() <= PR_INT32_MAX, + NS_ENSURE_TRUE(aSourceBuffer.Length() <= INT32_MAX, NS_ERROR_OUT_OF_MEMORY); mTreeBuilder->setFragmentContext(nullptr, diff --git a/parser/html/nsHtml5Tokenizer.cpp b/parser/html/nsHtml5Tokenizer.cpp index e56a92b0e7ba8..7abd36ac001af 100644 --- a/parser/html/nsHtml5Tokenizer.cpp +++ b/parser/html/nsHtml5Tokenizer.cpp @@ -281,7 +281,7 @@ nsHtml5Tokenizer::flushChars(PRUnichar* buf, int32_t pos) if (pos > cstart) { tokenHandler->characters(buf, cstart, pos - cstart); } - cstart = PR_INT32_MAX; + cstart = INT32_MAX; } void @@ -398,7 +398,7 @@ nsHtml5Tokenizer::tokenizeBuffer(nsHtml5UTF16Buffer* buffer) break; } default: { - cstart = PR_INT32_MAX; + cstart = INT32_MAX; break; } } @@ -3471,7 +3471,7 @@ nsHtml5Tokenizer::emitCarriageReturn(PRUnichar* buf, int32_t pos) silentCarriageReturn(); flushChars(buf, pos); tokenHandler->characters(nsHtml5Tokenizer::LF, 0, 1); - cstart = PR_INT32_MAX; + cstart = INT32_MAX; } void diff --git a/parser/html/nsHtml5TreeBuilder.h b/parser/html/nsHtml5TreeBuilder.h index 624f719aedd95..29859b497a68c 100644 --- a/parser/html/nsHtml5TreeBuilder.h +++ b/parser/html/nsHtml5TreeBuilder.h @@ -353,7 +353,7 @@ class nsHtml5TreeBuilder : public nsAHtml5TreeBuilderState #define NS_HTML5TREE_BUILDER_CHARSET_SINGLE_QUOTED 9 #define NS_HTML5TREE_BUILDER_CHARSET_DOUBLE_QUOTED 10 #define NS_HTML5TREE_BUILDER_CHARSET_UNQUOTED 11 -#define NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK PR_INT32_MAX +#define NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK INT32_MAX #endif diff --git a/parser/html/nsHtml5TreeBuilderCppSupplement.h b/parser/html/nsHtml5TreeBuilderCppSupplement.h index d6687e1472ab7..e6f295064e728 100644 --- a/parser/html/nsHtml5TreeBuilderCppSupplement.h +++ b/parser/html/nsHtml5TreeBuilderCppSupplement.h @@ -705,8 +705,8 @@ nsHtml5TreeBuilder::StartPlainTextViewSource(const nsAutoString& aTitle) // XUL will add the "Source of: " prefix. uint32_t length = aTitle.Length(); - if (length > PR_INT32_MAX) { - length = PR_INT32_MAX; + if (length > INT32_MAX) { + length = INT32_MAX; } characters(aTitle.get(), 0, (int32_t)length); endTag(nsHtml5ElementName::ELT_TITLE); diff --git a/parser/htmlparser/src/nsScannerString.cpp b/parser/htmlparser/src/nsScannerString.cpp index b26da798555cb..29969a63ad369 100644 --- a/parser/htmlparser/src/nsScannerString.cpp +++ b/parser/htmlparser/src/nsScannerString.cpp @@ -12,7 +12,7 @@ * nsScannerBufferList */ -#define MAX_CAPACITY ((PR_UINT32_MAX / sizeof(PRUnichar)) - \ +#define MAX_CAPACITY ((UINT32_MAX / sizeof(PRUnichar)) - \ (sizeof(Buffer) + sizeof(PRUnichar))) nsScannerBufferList::Buffer* diff --git a/parser/xml/src/nsSAXXMLReader.cpp b/parser/xml/src/nsSAXXMLReader.cpp index ecb1626ff894d..457728f55658a 100644 --- a/parser/xml/src/nsSAXXMLReader.cpp +++ b/parser/xml/src/nsSAXXMLReader.cpp @@ -516,8 +516,8 @@ nsSAXXMLReader::ParseFromStream(nsIInputStream *aStream, if (! available) break; // blocking input stream has none available when done - if (available > PR_UINT32_MAX) - available = PR_UINT32_MAX; + if (available > UINT32_MAX) + available = UINT32_MAX; rv = mListener->OnDataAvailable(parserChannel, nullptr, aStream, diff --git a/rdf/base/src/nsInMemoryDataSource.cpp b/rdf/base/src/nsInMemoryDataSource.cpp index 504152349f17c..42316eb5d5e78 100644 --- a/rdf/base/src/nsInMemoryDataSource.cpp +++ b/rdf/base/src/nsInMemoryDataSource.cpp @@ -125,7 +125,7 @@ class Assertion ~Assertion(); void AddRef() { - if (mRefCnt == PR_UINT16_MAX) { + if (mRefCnt == UINT16_MAX) { NS_WARNING("refcount overflow, leaking Assertion"); return; } @@ -133,7 +133,7 @@ class Assertion } void Release(nsFixedSizeAllocator& aAllocator) { - if (mRefCnt == PR_UINT16_MAX) { + if (mRefCnt == UINT16_MAX) { NS_WARNING("refcount overflow, leaking Assertion"); return; } diff --git a/rdf/base/src/nsRDFXMLDataSource.cpp b/rdf/base/src/nsRDFXMLDataSource.cpp index dca82128de29a..df5d279902f29 100644 --- a/rdf/base/src/nsRDFXMLDataSource.cpp +++ b/rdf/base/src/nsRDFXMLDataSource.cpp @@ -533,8 +533,8 @@ RDFXMLDataSourceImpl::BlockingParse(nsIURI* aURL, nsIStreamListener* aConsumer) if (avail == 0) break; // eof - if (avail > PR_UINT32_MAX) - avail = PR_UINT32_MAX; + if (avail > UINT32_MAX) + avail = UINT32_MAX; rv = aConsumer->OnDataAvailable(channel, nullptr, bufStream, offset, (uint32_t)avail); if (NS_SUCCEEDED(rv)) diff --git a/security/manager/ssl/src/nsNSSComponent.cpp b/security/manager/ssl/src/nsNSSComponent.cpp index 688e261e7597b..da3fd293938ca 100644 --- a/security/manager/ssl/src/nsNSSComponent.cpp +++ b/security/manager/ssl/src/nsNSSComponent.cpp @@ -2778,11 +2778,11 @@ nsCryptoHash::UpdateFromStream(nsIInputStream *data, uint32_t aLen) if (NS_FAILED(rv)) return rv; - // if the user has passed PR_UINT32_MAX, then read + // if the user has passed UINT32_MAX, then read // everything in the stream uint64_t len = aLen; - if (aLen == PR_UINT32_MAX) + if (aLen == UINT32_MAX) len = n; // So, if the stream has NO data available for the hash, @@ -2971,11 +2971,11 @@ NS_IMETHODIMP nsCryptoHMAC::UpdateFromStream(nsIInputStream *aStream, uint32_t a if (NS_FAILED(rv)) return rv; - // if the user has passed PR_UINT32_MAX, then read + // if the user has passed UINT32_MAX, then read // everything in the stream uint64_t len = aLen; - if (aLen == PR_UINT32_MAX) + if (aLen == UINT32_MAX) len = n; // So, if the stream has NO data available for the hash, diff --git a/startupcache/StartupCacheUtils.cpp b/startupcache/StartupCacheUtils.cpp index 3ce748daf71c3..3f032e933223c 100644 --- a/startupcache/StartupCacheUtils.cpp +++ b/startupcache/StartupCacheUtils.cpp @@ -40,7 +40,7 @@ NewObjectOutputWrappedStorageStream(nsIObjectOutputStream **wrapperStream, { nsCOMPtr storageStream; - nsresult rv = NS_NewStorageStream(256, PR_UINT32_MAX, getter_AddRefs(storageStream)); + nsresult rv = NS_NewStorageStream(256, UINT32_MAX, getter_AddRefs(storageStream)); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr objectOutput @@ -82,7 +82,7 @@ NewBufferFromStorageStream(nsIStorageStream *storageStream, uint64_t avail64; rv = inputStream->Available(&avail64); NS_ENSURE_SUCCESS(rv, rv); - NS_ENSURE_TRUE(avail64 <= PR_UINT32_MAX, NS_ERROR_FILE_TOO_BIG); + NS_ENSURE_TRUE(avail64 <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG); uint32_t avail = (uint32_t)avail64; nsAutoArrayPtr temp (new char[avail]); diff --git a/storage/src/Variant.h b/storage/src/Variant.h index e96724e1170da..6af6bcb9a25f0 100644 --- a/storage/src/Variant.h +++ b/storage/src/Variant.h @@ -112,7 +112,7 @@ struct variant_integer_traits static inline nsresult asInt32(int64_t aValue, int32_t *_result) { - if (aValue > PR_INT32_MAX || aValue < PR_INT32_MIN) + if (aValue > INT32_MAX || aValue < INT32_MIN) return NS_ERROR_CANNOT_CONVERT_DATA; *_result = static_cast(aValue); diff --git a/toolkit/components/places/Helpers.cpp b/toolkit/components/places/Helpers.cpp index 225dd6ade2131..4ebb661eb639c 100644 --- a/toolkit/components/places/Helpers.cpp +++ b/toolkit/components/places/Helpers.cpp @@ -253,7 +253,7 @@ GenerateRandomBytes(uint32_t aSize, // On Unix, we'll just read in from /dev/urandom. #elif defined(XP_UNIX) - NS_ENSURE_ARG_MAX(aSize, PR_INT32_MAX); + NS_ENSURE_ARG_MAX(aSize, INT32_MAX); PRFileDesc* urandom = PR_Open("/dev/urandom", PR_RDONLY, 0); nsresult rv = NS_ERROR_FAILURE; if (urandom) { diff --git a/toolkit/components/places/History.cpp b/toolkit/components/places/History.cpp index fd9731561d27b..3b5edda623cbb 100644 --- a/toolkit/components/places/History.cpp +++ b/toolkit/components/places/History.cpp @@ -64,7 +64,7 @@ struct VisitData { , sessionId(0) , hidden(true) , typed(false) - , transitionType(PR_UINT32_MAX) + , transitionType(UINT32_MAX) , visitTime(0) , frecency(-1) , titleChanged(false) @@ -80,7 +80,7 @@ struct VisitData { , sessionId(0) , hidden(true) , typed(false) - , transitionType(PR_UINT32_MAX) + , transitionType(UINT32_MAX) , visitTime(0) , frecency(-1) , titleChanged(false) diff --git a/toolkit/components/places/nsFaviconService.cpp b/toolkit/components/places/nsFaviconService.cpp index 112b27fb7494b..30ce0f1c27a3d 100644 --- a/toolkit/components/places/nsFaviconService.cpp +++ b/toolkit/components/places/nsFaviconService.cpp @@ -605,7 +605,7 @@ nsFaviconService::ReplaceFaviconDataFromDataURL(nsIURI* aFaviconURI, uint64_t available64; rv = stream->Available(&available64); NS_ENSURE_SUCCESS(rv, rv); - if (available64 == 0 || available64 > PR_UINT32_MAX / sizeof(uint8_t)) + if (available64 == 0 || available64 > UINT32_MAX / sizeof(uint8_t)) return NS_ERROR_FILE_TOO_BIG; uint32_t available = (uint32_t)available64; @@ -668,7 +668,7 @@ nsFaviconService::SetFaviconDataFromDataURL(nsIURI* aFaviconURI, uint64_t available64; rv = stream->Available(&available64); NS_ENSURE_SUCCESS(rv, rv); - if (available64 == 0 || available64 > PR_UINT32_MAX / sizeof(uint8_t)) + if (available64 == 0 || available64 > UINT32_MAX / sizeof(uint8_t)) return NS_ERROR_FAILURE; uint32_t available = (uint32_t)available64; @@ -762,7 +762,7 @@ nsFaviconService::GetDefaultFaviconData(nsCString& byteStr) rv = NS_OpenURI(getter_AddRefs(istream), defaultFaviconURI); NS_ENSURE_SUCCESS(rv, rv); - rv = NS_ConsumeStream(istream, PR_UINT32_MAX, mDefaultFaviconData); + rv = NS_ConsumeStream(istream, UINT32_MAX, mDefaultFaviconData); NS_ENSURE_SUCCESS(rv, rv); rv = istream->Close(); @@ -1075,7 +1075,7 @@ nsFaviconService::OptimizeFaviconImage(const uint8_t* aData, uint32_t aDataLen, NS_ENSURE_SUCCESS(rv, rv); // Read the stream into a new buffer. - rv = NS_ConsumeStream(iconStream, PR_UINT32_MAX, aNewData); + rv = NS_ConsumeStream(iconStream, UINT32_MAX, aNewData); NS_ENSURE_SUCCESS(rv, rv); return NS_OK; diff --git a/toolkit/components/places/nsNavBookmarks.cpp b/toolkit/components/places/nsNavBookmarks.cpp index 04341e9469e08..93732188f541b 100644 --- a/toolkit/components/places/nsNavBookmarks.cpp +++ b/toolkit/components/places/nsNavBookmarks.cpp @@ -341,7 +341,7 @@ nsNavBookmarks::AdjustIndices(int64_t aFolderId, int32_t aEndIndex, int32_t aDelta) { - NS_ASSERTION(aStartIndex >= 0 && aEndIndex <= PR_INT32_MAX && + NS_ASSERTION(aStartIndex >= 0 && aEndIndex <= INT32_MAX && aStartIndex <= aEndIndex, "Bad indices"); // Expire all cached items for this parent, since all positions are going to @@ -578,7 +578,7 @@ nsNavBookmarks::InsertBookmark(int64_t aFolder, else { index = aIndex; // Create space for the insertion. - rv = AdjustIndices(aFolder, index, PR_INT32_MAX, 1); + rv = AdjustIndices(aFolder, index, INT32_MAX, 1); NS_ENSURE_SUCCESS(rv, rv); } @@ -689,7 +689,7 @@ nsNavBookmarks::RemoveItem(int64_t aItemId) // Fix indices in the parent. if (bookmark.position != DEFAULT_INDEX) { rv = AdjustIndices(bookmark.parentId, - bookmark.position + 1, PR_INT32_MAX, -1); + bookmark.position + 1, INT32_MAX, -1); NS_ENSURE_SUCCESS(rv, rv); } @@ -841,7 +841,7 @@ nsNavBookmarks::CreateContainerWithID(int64_t aItemId, } else { index = *aIndex; // Create space for the insertion. - rv = AdjustIndices(aParent, index, PR_INT32_MAX, 1); + rv = AdjustIndices(aParent, index, INT32_MAX, 1); NS_ENSURE_SUCCESS(rv, rv); } @@ -894,7 +894,7 @@ nsNavBookmarks::InsertSeparator(int64_t aParent, else { index = aIndex; // Create space for the insertion. - rv = AdjustIndices(aParent, index, PR_INT32_MAX, 1); + rv = AdjustIndices(aParent, index, INT32_MAX, 1); NS_ENSURE_SUCCESS(rv, rv); } @@ -1357,10 +1357,10 @@ nsNavBookmarks::MoveItem(int64_t aItemId, int64_t aNewParent, int32_t aIndex) else { // We're moving between containers, so this happens in two steps. // First, fill the hole from the removal from the old parent. - rv = AdjustIndices(bookmark.parentId, bookmark.position + 1, PR_INT32_MAX, -1); + rv = AdjustIndices(bookmark.parentId, bookmark.position + 1, INT32_MAX, -1); NS_ENSURE_SUCCESS(rv, rv); // Now, make room in the new parent for the insertion. - rv = AdjustIndices(aNewParent, newIndex, PR_INT32_MAX, 1); + rv = AdjustIndices(aNewParent, newIndex, INT32_MAX, 1); NS_ENSURE_SUCCESS(rv, rv); } diff --git a/toolkit/components/places/nsNavHistoryResult.cpp b/toolkit/components/places/nsNavHistoryResult.cpp index 5399122722c18..6e6e18fbfd0e8 100644 --- a/toolkit/components/places/nsNavHistoryResult.cpp +++ b/toolkit/components/places/nsNavHistoryResult.cpp @@ -3701,7 +3701,7 @@ nsNavHistoryFolderResultNode::OnItemAdded(int64_t aItemId, !isQuery && excludeItems) { // don't update items when we aren't displaying them, but we still need // to adjust bookmark indices to account for the insertion - ReindexRange(aIndex, PR_INT32_MAX, 1); + ReindexRange(aIndex, INT32_MAX, 1); return NS_OK; } @@ -3709,7 +3709,7 @@ nsNavHistoryFolderResultNode::OnItemAdded(int64_t aItemId, return NS_OK; // folder was completely refreshed for us // adjust indices to account for insertion - ReindexRange(aIndex, PR_INT32_MAX, 1); + ReindexRange(aIndex, INT32_MAX, 1); nsRefPtr node; if (aItemType == nsINavBookmarksService::TYPE_BOOKMARK) { @@ -3793,7 +3793,7 @@ nsNavHistoryFolderResultNode::OnItemRemoved(int64_t aItemId, if ((node->IsURI() || node->IsSeparator()) && excludeItems) { // don't update items when we aren't displaying them, but we do need to // adjust everybody's bookmark indices to account for the removal - ReindexRange(aIndex, PR_INT32_MAX, -1); + ReindexRange(aIndex, INT32_MAX, -1); return NS_OK; } @@ -3801,7 +3801,7 @@ nsNavHistoryFolderResultNode::OnItemRemoved(int64_t aItemId, return NS_OK; // we are completely refreshed // shift all following indices down - ReindexRange(aIndex + 1, PR_INT32_MAX, -1); + ReindexRange(aIndex + 1, INT32_MAX, -1); return RemoveChildAt(index); } @@ -4015,8 +4015,8 @@ nsNavHistoryFolderResultNode::OnItemMoved(int64_t aItemId, // an add because that will lose your tree state. // adjust bookmark indices - ReindexRange(aOldIndex + 1, PR_INT32_MAX, -1); - ReindexRange(aNewIndex, PR_INT32_MAX, 1); + ReindexRange(aOldIndex + 1, INT32_MAX, -1); + ReindexRange(aNewIndex, INT32_MAX, 1); uint32_t index; nsNavHistoryResultNode* node = FindChildById(aItemId, &index); diff --git a/toolkit/components/places/nsNavHistoryResult.h b/toolkit/components/places/nsNavHistoryResult.h index d76862eeda0af..7ecc7a2a03455 100644 --- a/toolkit/components/places/nsNavHistoryResult.h +++ b/toolkit/components/places/nsNavHistoryResult.h @@ -51,7 +51,7 @@ class nsTrimInt64HashKey : public PLDHashEntryHdr static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; } static PLDHashNumber HashKey(KeyTypePointer aKey) - { return static_cast((*aKey) & PR_UINT32_MAX); } + { return static_cast((*aKey) & UINT32_MAX); } enum { ALLOW_MEMMOVE = true }; private: diff --git a/toolkit/components/places/nsPlacesExportService.cpp b/toolkit/components/places/nsPlacesExportService.cpp index 2643353413773..041d4358e5bfb 100644 --- a/toolkit/components/places/nsPlacesExportService.cpp +++ b/toolkit/components/places/nsPlacesExportService.cpp @@ -101,7 +101,7 @@ nsEscapeHTML(const char* string) /* XXX Hardcoded max entity len. The +1 is for the trailing null. */ char* escaped = nullptr; uint32_t len = strlen(string); - if (len >= (PR_UINT32_MAX / 6)) + if (len >= (UINT32_MAX / 6)) return nullptr; escaped = (char*)NS_Alloc((len * 6) + 1); diff --git a/toolkit/components/url-classifier/HashStore.cpp b/toolkit/components/url-classifier/HashStore.cpp index 9c0956fa494c8..267228d37bab5 100644 --- a/toolkit/components/url-classifier/HashStore.cpp +++ b/toolkit/components/url-classifier/HashStore.cpp @@ -378,7 +378,7 @@ HashStore::CalculateChecksum(nsAutoCString& aChecksum, bool aChecksumPresent) if (!aChecksumPresent) { // Hash entire file - rv = hash->UpdateFromStream(hashStream, PR_UINT32_MAX); + rv = hash->UpdateFromStream(hashStream, UINT32_MAX); } else { // Hash everything but last checksum bytes rv = hash->UpdateFromStream(hashStream, fileSize-CHECKSUM_SIZE); diff --git a/uriloader/exthandler/ExternalHelperAppParent.cpp b/uriloader/exthandler/ExternalHelperAppParent.cpp index b5eac945b835e..90ee3bca59ef7 100644 --- a/uriloader/exthandler/ExternalHelperAppParent.cpp +++ b/uriloader/exthandler/ExternalHelperAppParent.cpp @@ -307,7 +307,7 @@ ExternalHelperAppParent::GetContentDispositionHeader(nsACString& aContentDisposi NS_IMETHODIMP ExternalHelperAppParent::GetContentLength(int32_t *aContentLength) { - if (mContentLength > PR_INT32_MAX || mContentLength < 0) + if (mContentLength > INT32_MAX || mContentLength < 0) *aContentLength = -1; else *aContentLength = (int32_t)mContentLength; diff --git a/view/src/nsViewManager.cpp b/view/src/nsViewManager.cpp index 59e7987f39a15..120cdc1acdccb 100644 --- a/view/src/nsViewManager.cpp +++ b/view/src/nsViewManager.cpp @@ -42,7 +42,7 @@ we ask for a specific z-order, we don't assume that widget z-ordering actually works. */ -#define NSCOORD_NONE PR_INT32_MIN +#define NSCOORD_NONE INT32_MIN #undef DEBUG_MOUSE_LOCATION diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp index f25bb7f1146ea..3ce9935414701 100644 --- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -2187,7 +2187,7 @@ nsWindow::OnIMETextChange(uint32_t aStart, uint32_t aOldEnd, uint32_t aNewEnd) nsRefPtr kungFuDeathGrip(this); nsQueryContentEvent event(true, NS_QUERY_TEXT_CONTENT, this); InitEvent(event, nullptr); - event.InitForQueryTextContent(0, PR_UINT32_MAX); + event.InitForQueryTextContent(0, UINT32_MAX); DispatchEvent(&event); if (!event.mSucceeded) diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 8c358e1ee86b8..cfeb3dd2136a8 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -2654,7 +2654,7 @@ - (BOOL)maybeRollup:(NSEvent*)theEvent // if we're dealing with menus, we probably have submenus and // we don't want to rollup if the click is in a parent menu of // the current submenu - uint32_t popupsToRollup = PR_UINT32_MAX; + uint32_t popupsToRollup = UINT32_MAX; if (gRollupListener) { nsAutoTArray widgetChain; uint32_t sameTypeCount = gRollupListener->GetSubmenuWidgetChain(&widgetChain); diff --git a/widget/cocoa/nsIdleServiceX.mm b/widget/cocoa/nsIdleServiceX.mm index 53c178cce7be9..2e2e84ad62a07 100644 --- a/widget/cocoa/nsIdleServiceX.mm +++ b/widget/cocoa/nsIdleServiceX.mm @@ -59,7 +59,7 @@ // convert to ms from ns time /= 1000000; - if (time > PR_UINT32_MAX) // Overflow will occur + if (time > UINT32_MAX) // Overflow will occur return false; *aIdleTime = static_cast(time); diff --git a/widget/cocoa/nsNativeThemeCocoa.mm b/widget/cocoa/nsNativeThemeCocoa.mm index 33eec4c11d539..7f5194d556f87 100644 --- a/widget/cocoa/nsNativeThemeCocoa.mm +++ b/widget/cocoa/nsNativeThemeCocoa.mm @@ -149,8 +149,8 @@ - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView tdi.version = 0; tdi.min = 0; - tdi.value = PR_INT32_MAX * (mValue / mMax); - tdi.max = PR_INT32_MAX; + tdi.value = INT32_MAX * (mValue / mMax); + tdi.max = INT32_MAX; tdi.bounds = NSRectToCGRect(cellFrame); tdi.attributes = mIsHorizontal ? kThemeTrackHorizontal : 0; tdi.enableState = [self controlTint] == NSClearControlTint ? kThemeTrackInactive diff --git a/widget/cocoa/nsPrintDialogX.mm b/widget/cocoa/nsPrintDialogX.mm index b9336ed06acb6..99a0680b3ac16 100644 --- a/widget/cocoa/nsPrintDialogX.mm +++ b/widget/cocoa/nsPrintDialogX.mm @@ -105,7 +105,7 @@ OSStatus status = ::PMGetFirstPage(nativePrintSettings, &firstPage); if (status == noErr) { status = ::PMGetLastPage(nativePrintSettings, &lastPage); - if (status == noErr && lastPage != PR_UINT32_MAX) { + if (status == noErr && lastPage != UINT32_MAX) { aSettings->SetPrintRange(nsIPrintSettings::kRangeSpecifiedPageRange); aSettings->SetStartPageRange(firstPage); aSettings->SetEndPageRange(lastPage); diff --git a/widget/gtk2/nsGtkIMModule.cpp b/widget/gtk2/nsGtkIMModule.cpp index 06caa185280ad..0769413e8f28d 100644 --- a/widget/gtk2/nsGtkIMModule.cpp +++ b/widget/gtk2/nsGtkIMModule.cpp @@ -80,7 +80,7 @@ nsGtkIMModule::nsGtkIMModule(nsWindow* aOwnerWindow) : mSimpleContext(nullptr), #endif mDummyContext(nullptr), - mCompositionStart(PR_UINT32_MAX), mProcessingKeyEvent(nullptr), + mCompositionStart(UINT32_MAX), mProcessingKeyEvent(nullptr), mCompositionState(eCompositionState_NotComposing), mIsIMFocused(false), mIgnoreNativeCompositionEvent(false) { @@ -1055,7 +1055,7 @@ nsGtkIMModule::DispatchCompositionStart() InitEvent(selection); mLastFocusedWindow->DispatchEvent(&selection, status); - if (!selection.mSucceeded || selection.mReply.mOffset == PR_UINT32_MAX) { + if (!selection.mSucceeded || selection.mReply.mOffset == UINT32_MAX) { PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, (" FAILED, cannot query the selection offset")); return false; @@ -1139,7 +1139,7 @@ nsGtkIMModule::DispatchCompositionEnd() nsCOMPtr kungFuDeathGrip = mLastFocusedWindow; mLastFocusedWindow->DispatchEvent(&compEvent, status); mCompositionState = eCompositionState_NotComposing; - mCompositionStart = PR_UINT32_MAX; + mCompositionStart = UINT32_MAX; mDispatchedCompositionString.Truncate(); if (static_cast(kungFuDeathGrip.get())->IsDestroyed() || kungFuDeathGrip != mLastFocusedWindow) { @@ -1378,7 +1378,7 @@ nsGtkIMModule::SetCursorPosition(uint32_t aTargetOffset) ("GtkIMModule(%p): SetCursorPosition, aTargetOffset=%u", this, aTargetOffset)); - if (aTargetOffset == PR_UINT32_MAX) { + if (aTargetOffset == UINT32_MAX) { PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, (" FAILED, aTargetOffset is wrong offset")); return; @@ -1467,9 +1467,9 @@ nsGtkIMModule::GetCurrentParagraph(nsAString& aText, uint32_t& aCursorPos) // XXX nsString::Find and nsString::RFind take int32_t for offset, so, // we cannot support this request when the current offset is larger - // than PR_INT32_MAX. - if (selOffset > PR_INT32_MAX || selLength > PR_INT32_MAX || - selOffset + selLength > PR_INT32_MAX) { + // than INT32_MAX. + if (selOffset > INT32_MAX || selLength > INT32_MAX || + selOffset + selLength > INT32_MAX) { PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, (" FAILED, The selection is out of range")); return NS_ERROR_FAILURE; @@ -1479,7 +1479,7 @@ nsGtkIMModule::GetCurrentParagraph(nsAString& aText, uint32_t& aCursorPos) nsQueryContentEvent queryTextContentEvent(true, NS_QUERY_TEXT_CONTENT, mLastFocusedWindow); - queryTextContentEvent.InitForQueryTextContent(0, PR_UINT32_MAX); + queryTextContentEvent.InitForQueryTextContent(0, UINT32_MAX); mLastFocusedWindow->DispatchEvent(&queryTextContentEvent, status); NS_ENSURE_TRUE(queryTextContentEvent.mSucceeded, NS_ERROR_FAILURE); @@ -1574,7 +1574,7 @@ nsGtkIMModule::DeleteText(const int32_t aOffset, const uint32_t aNChars) nsQueryContentEvent queryTextContentEvent(true, NS_QUERY_TEXT_CONTENT, mLastFocusedWindow); - queryTextContentEvent.InitForQueryTextContent(0, PR_UINT32_MAX); + queryTextContentEvent.InitForQueryTextContent(0, UINT32_MAX); mLastFocusedWindow->DispatchEvent(&queryTextContentEvent, status); NS_ENSURE_TRUE(queryTextContentEvent.mSucceeded, NS_ERROR_FAILURE); if (queryTextContentEvent.mReply.mString.IsEmpty()) { diff --git a/widget/gtk2/nsGtkKeyUtils.cpp b/widget/gtk2/nsGtkKeyUtils.cpp index 5f3992d0aea1b..6d92aaf0fc8b8 100644 --- a/widget/gtk2/nsGtkKeyUtils.cpp +++ b/widget/gtk2/nsGtkKeyUtils.cpp @@ -385,7 +385,7 @@ KeymapWrapper::InitBySystemSettings() int32_t foundLevel[5]; for (uint32_t i = 0; i < ArrayLength(mod); i++) { mod[i] = NOT_MODIFIER; - foundLevel[i] = PR_INT32_MAX; + foundLevel[i] = INT32_MAX; } const uint32_t map_size = 8 * xmodmap->max_keypermod; for (uint32_t i = 0; i < map_size; i++) { diff --git a/widget/gtk2/nsWindow.cpp b/widget/gtk2/nsWindow.cpp index c3dd1813da84d..4823b311e0522 100644 --- a/widget/gtk2/nsWindow.cpp +++ b/widget/gtk2/nsWindow.cpp @@ -4731,7 +4731,7 @@ check_for_rollup(gdouble aMouseX, gdouble aMouseY, // if we're dealing with menus, we probably have submenus and // we don't want to rollup if the click is in a parent menu of // the current submenu - uint32_t popupsToRollup = PR_UINT32_MAX; + uint32_t popupsToRollup = UINT32_MAX; if (!aAlwaysRollup) { nsAutoTArray widgetChain; uint32_t sameTypeCount = gRollupListener->GetSubmenuWidgetChain(&widgetChain); @@ -4759,7 +4759,7 @@ check_for_rollup(gdouble aMouseX, gdouble aMouseY, // if we've determined that we should still rollup, do it. if (rollup) { gRollupListener->Rollup(popupsToRollup); - if (popupsToRollup == PR_UINT32_MAX) { + if (popupsToRollup == UINT32_MAX) { retVal = true; } } diff --git a/widget/nsGUIEvent.h b/widget/nsGUIEvent.h index ba0567fe54c94..0c4e39275e629 100644 --- a/widget/nsGUIEvent.h +++ b/widget/nsGUIEvent.h @@ -1374,7 +1374,7 @@ class nsQueryContentEvent : public nsGUIEvent } mReply; enum { - NOT_FOUND = PR_UINT32_MAX + NOT_FOUND = UINT32_MAX }; // values of mComputedScrollAction diff --git a/widget/nsIRollupListener.h b/widget/nsIRollupListener.h index d4878cf4c2135..12ff3e0f5c8ad 100644 --- a/widget/nsIRollupListener.h +++ b/widget/nsIRollupListener.h @@ -20,7 +20,7 @@ class nsIRollupListener { * was just rolled up. * * aCount is the number of popups in a chain to close. If this is - * PR_UINT32_MAX, then all popups are closed. + * UINT32_MAX, then all popups are closed. * If aGetLastRolledUp is true, then return the last rolled up popup, * if this is supported. */ diff --git a/widget/os2/nsWindow.cpp b/widget/os2/nsWindow.cpp index 6d93a56aaadaa..1aa07530c044f 100644 --- a/widget/os2/nsWindow.cpp +++ b/widget/os2/nsWindow.cpp @@ -496,7 +496,7 @@ NS_METHOD nsWindow::Destroy() // the rollup widget, rollup and turn off capture. if (this == gRollupWidget) { if (gRollupListener) { - gRollupListener->Rollup(PR_UINT32_MAX); + gRollupListener->Rollup(UINT32_MAX); } CaptureRollupEvents(nullptr, false, true); } @@ -1585,7 +1585,7 @@ bool nsWindow::RollupOnButtonDown(ULONG aMsg) // See if we're dealing with a menu. If so, exit if the // event was inside a parent of the current submenu. - uint32_t popupsToRollup = PR_UINT32_MAX; + uint32_t popupsToRollup = UINT32_MAX; if (gRollupListener) { nsAutoTArray widgetChain; @@ -1635,7 +1635,7 @@ void nsWindow::RollupOnFocusLost(HWND aFocus) } // Rollup all popups. - gRollupListener->Rollup(PR_UINT32_MAX); + gRollupListener->Rollup(UINT32_MAX); return; } diff --git a/widget/os2/os2FrameWindow.cpp b/widget/os2/os2FrameWindow.cpp index da82028b5a783..22a2cb6cdbf84 100644 --- a/widget/os2/os2FrameWindow.cpp +++ b/widget/os2/os2FrameWindow.cpp @@ -597,7 +597,7 @@ MRESULT EXPENTRY fnwpFrame(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) msg == WM_BUTTON3DOWN) { // Rollup if the event is outside the popup if (!nsWindow::EventIsInsideWindow((nsWindow*)gRollupWidget)) { - gRollupListener->Rollup(PR_UINT32_MAX); + gRollupListener->Rollup(UINT32_MAX); } } } diff --git a/widget/qt/nsWindow.cpp b/widget/qt/nsWindow.cpp index ab64479443fcb..e65ff313e7555 100644 --- a/widget/qt/nsWindow.cpp +++ b/widget/qt/nsWindow.cpp @@ -929,7 +929,7 @@ check_for_rollup(double aMouseX, double aMouseY, // if we're dealing with menus, we probably have submenus and // we don't want to rollup if the clickis in a parent menu of // the current submenu - uint32_t popupsToRollup = PR_UINT32_MAX; + uint32_t popupsToRollup = UINT32_MAX; if (gRollupListener) { nsAutoTArray widgetChain; uint32_t sameTypeCount = gRollupListener->GetSubmenuWidgetChain(&widgetChain); diff --git a/widget/windows/WinUtils.cpp b/widget/windows/WinUtils.cpp index 89eba4d55d518..95cc1fe2a9657 100644 --- a/widget/windows/WinUtils.cpp +++ b/widget/windows/WinUtils.cpp @@ -593,7 +593,7 @@ NS_IMETHODIMP AsyncWriteIconToDisk::Run() uint64_t bufSize64; rv = iconStream->Available(&bufSize64); NS_ENSURE_SUCCESS(rv, rv); - NS_ENSURE_TRUE(bufSize64 <= PR_UINT32_MAX, NS_ERROR_FILE_TOO_BIG); + NS_ENSURE_TRUE(bufSize64 <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG); uint32_t bufSize = (uint32_t)bufSize64; diff --git a/widget/windows/nsIMM32Handler.cpp b/widget/windows/nsIMM32Handler.cpp index 9ef883c906613..5118b0566ecfa 100644 --- a/widget/windows/nsIMM32Handler.cpp +++ b/widget/windows/nsIMM32Handler.cpp @@ -1482,7 +1482,7 @@ nsIMM32Handler::HandleDocumentFeed(nsWindow* aWindow, // XXX nsString::Find and nsString::RFind take int32_t for offset, so, // we cannot support this message when the current offset is larger than - // PR_INT32_MAX. + // INT32_MAX. if (targetOffset < 0 || targetLength < 0 || targetOffset + targetLength < 0) { PR_LOG(gIMM32Log, PR_LOG_ALWAYS, @@ -1492,7 +1492,7 @@ nsIMM32Handler::HandleDocumentFeed(nsWindow* aWindow, // Get all contents of the focused editor. nsQueryContentEvent textContent(true, NS_QUERY_TEXT_CONTENT, aWindow); - textContent.InitForQueryTextContent(0, PR_UINT32_MAX); + textContent.InitForQueryTextContent(0, UINT32_MAX); aWindow->InitEvent(textContent, &point); aWindow->DispatchWindowEvent(&textContent); if (!textContent.mSucceeded) { diff --git a/widget/windows/nsTextStore.cpp b/widget/windows/nsTextStore.cpp index 26bcc720bfb55..82d3bc212ad95 100644 --- a/widget/windows/nsTextStore.cpp +++ b/widget/windows/nsTextStore.cpp @@ -342,7 +342,7 @@ nsTextStore::nsTextStore() mWindow = nullptr; mLock = 0; mLockQueued = 0; - mTextChange.acpStart = PR_INT32_MAX; + mTextChange.acpStart = INT32_MAX; mTextChange.acpOldEnd = mTextChange.acpNewEnd = 0; mLastDispatchedTextEvent = nullptr; } @@ -1391,7 +1391,7 @@ nsTextStore::GetText(LONG acpStart, prgRunInfo->uCount = 0; prgRunInfo->type = TS_RT_PLAIN; } - uint32_t length = -1 == acpEnd ? PR_UINT32_MAX : uint32_t(acpEnd - acpStart); + uint32_t length = -1 == acpEnd ? UINT32_MAX : uint32_t(acpEnd - acpStart); if (cchPlainReq && cchPlainReq - 1 < length) { length = cchPlainReq - 1; } @@ -1696,7 +1696,7 @@ nsTextStore::GetEndACP(LONG *pacp) nsQueryContentEvent event(true, NS_QUERY_TEXT_CONTENT, mWindow); mWindow->InitEvent(event); // Return entire text - event.InitForQueryTextContent(0, PR_INT32_MAX); + event.InitForQueryTextContent(0, INT32_MAX); mWindow->DispatchWindowEvent(&event); if (!event.mSucceeded) { PR_LOG(sTextStoreLog, PR_LOG_ERROR, @@ -2599,14 +2599,14 @@ nsTextStore::OnTextChangeMsgInternal(void) mTextChange.acpOldEnd, mTextChange.acpNewEnd)); if (!mLock && mSink && 0 != (mSinkMask & TS_AS_TEXT_CHANGE) && - PR_INT32_MAX > mTextChange.acpStart) { + INT32_MAX > mTextChange.acpStart) { PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, ("TSF: 0x%p nsTextStore::OnTextChangeMsgInternal(), calling" "mSink->OnTextChange(0, { acpStart=%ld, acpOldEnd=%ld, " "acpNewEnd=%ld })...", this, mTextChange.acpStart, mTextChange.acpOldEnd, mTextChange.acpNewEnd)); mSink->OnTextChange(0, &mTextChange); - mTextChange.acpStart = PR_INT32_MAX; + mTextChange.acpStart = INT32_MAX; mTextChange.acpOldEnd = mTextChange.acpNewEnd = 0; } } diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 9d80cbcd6fa82..799c635f80a5f 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -7917,7 +7917,7 @@ nsWindow::DealWithPopups(HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inLPara // If we're dealing with menus, we probably have submenus and we don't // want to rollup if the click is in a parent menu of the current submenu. - uint32_t popupsToRollup = PR_UINT32_MAX; + uint32_t popupsToRollup = UINT32_MAX; if (rollup) { if ( sRollupListener ) { nsAutoTArray widgetChain; @@ -7941,7 +7941,7 @@ nsWindow::DealWithPopups(HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inLPara } // if rollup listener knows about menus } - if (inMsg == WM_MOUSEACTIVATE && popupsToRollup == PR_UINT32_MAX) { + if (inMsg == WM_MOUSEACTIVATE && popupsToRollup == UINT32_MAX) { // Prevent the click inside the popup from causing a change in window // activation. Since the popup is shown non-activated, we need to eat // any requests to activate the window while it is displayed. Windows @@ -8004,7 +8004,7 @@ nsWindow::DealWithPopups(HWND inWnd, UINT inMsg, WPARAM inWParam, LPARAM inLPara // if we are only rolling up some popups, don't activate and don't let // the event go through. This prevents clicks menus higher in the // chain from opening when a context menu is open - if (popupsToRollup != PR_UINT32_MAX && inMsg == WM_MOUSEACTIVATE) { + if (popupsToRollup != UINT32_MAX && inMsg == WM_MOUSEACTIVATE) { *outResult = MA_NOACTIVATEANDEAT; return TRUE; } diff --git a/widget/xpwidgets/PuppetWidget.cpp b/widget/xpwidgets/PuppetWidget.cpp index 5e55152d54441..5f1a738275f95 100644 --- a/widget/xpwidgets/PuppetWidget.cpp +++ b/widget/xpwidgets/PuppetWidget.cpp @@ -400,7 +400,7 @@ PuppetWidget::OnIMEFocusChange(bool aFocus) nsQueryContentEvent queryEvent(true, NS_QUERY_TEXT_CONTENT, this); InitEvent(queryEvent, nullptr); // Query entire content - queryEvent.InitForQueryTextContent(0, PR_UINT32_MAX); + queryEvent.InitForQueryTextContent(0, UINT32_MAX); DispatchEvent(&queryEvent, status); if (queryEvent.mSucceeded) { @@ -438,7 +438,7 @@ PuppetWidget::OnIMETextChange(uint32_t aStart, uint32_t aEnd, uint32_t aNewEnd) nsEventStatus status; nsQueryContentEvent queryEvent(true, NS_QUERY_TEXT_CONTENT, this); InitEvent(queryEvent, nullptr); - queryEvent.InitForQueryTextContent(0, PR_UINT32_MAX); + queryEvent.InitForQueryTextContent(0, UINT32_MAX); DispatchEvent(&queryEvent, status); if (queryEvent.mSucceeded) { diff --git a/widget/xpwidgets/nsIdleService.cpp b/widget/xpwidgets/nsIdleService.cpp index aed352eb0719c..b217e32a1c988 100644 --- a/widget/xpwidgets/nsIdleService.cpp +++ b/widget/xpwidgets/nsIdleService.cpp @@ -320,7 +320,7 @@ nsIdleService::GetInstance() nsIdleService::nsIdleService() : mCurrentlySetToTimeoutAtInPR(0), mAnyObserverIdle(false), - mDeltaToNextIdleSwitchInS(PR_UINT32_MAX), + mDeltaToNextIdleSwitchInS(UINT32_MAX), mLastUserInteractionInPR(PR_Now()) { #ifdef PR_LOGGING @@ -360,7 +360,7 @@ nsIdleService::AddIdleObserver(nsIObserver* aObserver, uint32_t aIdleTimeInS) NS_ENSURE_ARG_POINTER(aObserver); // We don't accept idle time at 0, and we can't handle idle time that are too // high either - no more than ~136 years. - NS_ENSURE_ARG_RANGE(aIdleTimeInS, 1, (PR_UINT32_MAX / 10) - 1); + NS_ENSURE_ARG_RANGE(aIdleTimeInS, 1, (UINT32_MAX / 10) - 1); // Put the time + observer in a struct we can keep: IdleListener listener(aObserver, aIdleTimeInS); @@ -455,7 +455,7 @@ nsIdleService::ResetIdleTimeOut(uint32_t idleDeltaInMS) // Mark all idle services as non-idle, and calculate the next idle timeout. Telemetry::AutoTimer timer; nsCOMArray notifyList; - mDeltaToNextIdleSwitchInS = PR_UINT32_MAX; + mDeltaToNextIdleSwitchInS = UINT32_MAX; // Loop through all listeners, and find any that have detected idle. for (uint32_t i = 0; i < mArrayListeners.Length(); i++) { @@ -632,7 +632,7 @@ nsIdleService::IdleTimerCallback(void) Telemetry::AutoTimer timer; // We need to initialise the time to the next idle switch. - mDeltaToNextIdleSwitchInS = PR_UINT32_MAX; + mDeltaToNextIdleSwitchInS = UINT32_MAX; // Create list of observers that should be notified. nsCOMArray notifyList; @@ -756,7 +756,7 @@ void nsIdleService::ReconfigureTimer(void) { // Check if either someone is idle, or someone will become idle. - if (!mAnyObserverIdle && PR_UINT32_MAX == mDeltaToNextIdleSwitchInS) { + if (!mAnyObserverIdle && UINT32_MAX == mDeltaToNextIdleSwitchInS) { // If not, just let any existing timers run to completion // And bail out. PR_LOG(sLog, PR_LOG_DEBUG, diff --git a/widget/xpwidgets/nsNativeTheme.cpp b/widget/xpwidgets/nsNativeTheme.cpp index f8ee3f08334f8..69ecec108a773 100644 --- a/widget/xpwidgets/nsNativeTheme.cpp +++ b/widget/xpwidgets/nsNativeTheme.cpp @@ -24,7 +24,7 @@ #include "mozilla/dom/Element.h" nsNativeTheme::nsNativeTheme() -: mAnimatedContentTimeout(PR_UINT32_MAX) +: mAnimatedContentTimeout(UINT32_MAX) { } @@ -571,7 +571,7 @@ nsNativeTheme::Notify(nsITimer* aTimer) } mAnimatedContentList.Clear(); - mAnimatedContentTimeout = PR_UINT32_MAX; + mAnimatedContentTimeout = UINT32_MAX; return NS_OK; } diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index e6a3191eb156d..4f0e7fb298e20 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -1786,7 +1786,7 @@ GCGraphBuilder::DescribeRefCountedNode(nsrefcnt refCount, const char *objName) { if (refCount == 0) Fault("zero refcount", mCurrPi); - if (refCount == PR_UINT32_MAX) + if (refCount == UINT32_MAX) Fault("overflowing refcount", mCurrPi); sCollector->mVisitedRefCounted++; @@ -1801,7 +1801,7 @@ GCGraphBuilder::DescribeRefCountedNode(nsrefcnt refCount, const char *objName) NS_IMETHODIMP_(void) GCGraphBuilder::DescribeGCedNode(bool isMarked, const char *objName) { - uint32_t refCount = isMarked ? PR_UINT32_MAX : 0; + uint32_t refCount = isMarked ? UINT32_MAX : 0; sCollector->mVisitedGCed++; if (mListener) { @@ -2736,7 +2736,7 @@ nsCycleCollector::BeginCollection(bool aMergeCompartments, while (!etor.IsDone()) { PtrInfo *pi = etor.GetNext(); if (pi->mColor == black && - pi->mRefCount > 0 && pi->mRefCount < PR_UINT32_MAX && + pi->mRefCount > 0 && pi->mRefCount < UINT32_MAX && pi->mInternalRefs != pi->mRefCount) { aListener->DescribeRoot((uint64_t)pi->mPointer, pi->mInternalRefs); diff --git a/xpcom/build/FileLocation.cpp b/xpcom/build/FileLocation.cpp index 9b36e29012223..91399e54a6bef 100644 --- a/xpcom/build/FileLocation.cpp +++ b/xpcom/build/FileLocation.cpp @@ -128,7 +128,7 @@ FileLocation::Data::GetSize(uint32_t *result) if (PR_SUCCESS != PR_GetOpenFileInfo64(mFd, &fileInfo)) return NS_ErrorAccordingToNSPR(); - if (fileInfo.size > int64_t(PR_UINT32_MAX)) + if (fileInfo.size > int64_t(UINT32_MAX)) return NS_ERROR_FILE_TOO_BIG; *result = fileInfo.size; @@ -145,7 +145,7 @@ FileLocation::Data::Copy(char *buf, uint32_t len) { if (mFd) { for (uint32_t totalRead = 0; totalRead < len; ) { - int32_t read = PR_Read(mFd, buf + totalRead, NS_MIN(len - totalRead, uint32_t(PR_INT32_MAX))); + int32_t read = PR_Read(mFd, buf + totalRead, NS_MIN(len - totalRead, uint32_t(INT32_MAX))); if (read < 0) return NS_ErrorAccordingToNSPR(); totalRead += read; diff --git a/xpcom/build/nsXPCOMStrings.cpp b/xpcom/build/nsXPCOMStrings.cpp index 811dcc17c4e52..d5df93ac32150 100644 --- a/xpcom/build/nsXPCOMStrings.cpp +++ b/xpcom/build/nsXPCOMStrings.cpp @@ -38,7 +38,7 @@ NS_StringContainerInit2(nsStringContainer &aContainer, } else { - if (aDataLength == PR_UINT32_MAX) + if (aDataLength == UINT32_MAX) { NS_ENSURE_ARG(!(aFlags & NS_STRING_CONTAINER_INIT_SUBSTRING)); aDataLength = nsCharTraits::length(aData); @@ -94,7 +94,7 @@ XPCOM_API(uint32_t) NS_StringGetMutableData(nsAString &aStr, uint32_t aDataLength, PRUnichar **aData) { - if (aDataLength != PR_UINT32_MAX) { + if (aDataLength != UINT32_MAX) { aStr.SetLength(aDataLength); if (aStr.Length() != aDataLength) { *aData = nullptr; @@ -126,7 +126,7 @@ NS_StringSetDataRange(nsAString &aStr, uint32_t aCutOffset, uint32_t aCutLength, const PRUnichar *aData, uint32_t aDataLength) { - if (aCutOffset == PR_UINT32_MAX) + if (aCutOffset == UINT32_MAX) { // append case if (aData) @@ -134,12 +134,12 @@ NS_StringSetDataRange(nsAString &aStr, return NS_OK; // XXX report errors } - if (aCutLength == PR_UINT32_MAX) + if (aCutLength == UINT32_MAX) aCutLength = aStr.Length() - aCutOffset; if (aData) { - if (aDataLength == PR_UINT32_MAX) + if (aDataLength == UINT32_MAX) aStr.Replace(aCutOffset, aCutLength, nsDependentString(aData)); else aStr.Replace(aCutOffset, aCutLength, Substring(aData, aDataLength)); @@ -198,7 +198,7 @@ NS_CStringContainerInit2(nsCStringContainer &aContainer, } else { - if (aDataLength == PR_UINT32_MAX) + if (aDataLength == UINT32_MAX) { NS_ENSURE_ARG(!(aFlags & NS_CSTRING_CONTAINER_INIT_SUBSTRING)); aDataLength = nsCharTraits::length(aData); @@ -253,7 +253,7 @@ NS_CStringGetData(const nsACString &aStr, const char **aData, XPCOM_API(uint32_t) NS_CStringGetMutableData(nsACString &aStr, uint32_t aDataLength, char **aData) { - if (aDataLength != PR_UINT32_MAX) { + if (aDataLength != UINT32_MAX) { aStr.SetLength(aDataLength); if (aStr.Length() != aDataLength) { *aData = nullptr; @@ -285,7 +285,7 @@ NS_CStringSetDataRange(nsACString &aStr, uint32_t aCutOffset, uint32_t aCutLength, const char *aData, uint32_t aDataLength) { - if (aCutOffset == PR_UINT32_MAX) + if (aCutOffset == UINT32_MAX) { // append case if (aData) @@ -293,12 +293,12 @@ NS_CStringSetDataRange(nsACString &aStr, return NS_OK; // XXX report errors } - if (aCutLength == PR_UINT32_MAX) + if (aCutLength == UINT32_MAX) aCutLength = aStr.Length() - aCutOffset; if (aData) { - if (aDataLength == PR_UINT32_MAX) + if (aDataLength == UINT32_MAX) aStr.Replace(aCutOffset, aCutLength, nsDependentCString(aData)); else aStr.Replace(aCutOffset, aCutLength, Substring(aData, aDataLength)); diff --git a/xpcom/ds/nsArray.cpp b/xpcom/ds/nsArray.cpp index d389ae299fb69..ee06ef3712ee1 100644 --- a/xpcom/ds/nsArray.cpp +++ b/xpcom/ds/nsArray.cpp @@ -77,7 +77,7 @@ nsArray::IndexOf(uint32_t aStartIndex, nsISupports* aElement, // optimize for the common case by forwarding to mArray if (aStartIndex == 0) { uint32_t idx = mArray.IndexOf(aElement); - if (idx == PR_UINT32_MAX) + if (idx == UINT32_MAX) return NS_ERROR_FAILURE; *aResult = idx; diff --git a/xpcom/ds/nsAtomTable.cpp b/xpcom/ds/nsAtomTable.cpp index dadbfdaf43ee8..67835e4a06ce2 100644 --- a/xpcom/ds/nsAtomTable.cpp +++ b/xpcom/ds/nsAtomTable.cpp @@ -84,7 +84,7 @@ class AtomImpl : public nsIAtom { NS_DECL_ISUPPORTS NS_DECL_NSIATOM - enum { REFCNT_PERMANENT_SENTINEL = PR_UINT32_MAX }; + enum { REFCNT_PERMANENT_SENTINEL = UINT32_MAX }; virtual bool IsPermanent(); diff --git a/xpcom/glue/FileUtils.cpp b/xpcom/glue/FileUtils.cpp index 1599b8fcbd770..1ddf88bcebc19 100644 --- a/xpcom/glue/FileUtils.cpp +++ b/xpcom/glue/FileUtils.cpp @@ -36,7 +36,7 @@ mozilla::fallocate(PRFileDesc *aFD, int64_t aLength) PR_Seek64(aFD, oldpos, PR_SEEK_SET); return retval; #elif defined(XP_OS2) - return aLength <= PR_UINT32_MAX + return aLength <= UINT32_MAX && 0 == DosSetFileSize(PR_FileDesc2NativeHandle(aFD), (uint32_t)aLength); #elif defined(XP_MACOSX) int fd = PR_FileDesc2NativeHandle(aFD); diff --git a/xpcom/glue/nsStringAPI.cpp b/xpcom/glue/nsStringAPI.cpp index f23b583388d54..6a2db49ec6ce0 100644 --- a/xpcom/glue/nsStringAPI.cpp +++ b/xpcom/glue/nsStringAPI.cpp @@ -66,7 +66,7 @@ nsAString::char_type* nsAString::EndWriting() { char_type *data; - uint32_t len = NS_StringGetMutableData(*this, PR_UINT32_MAX, &data); + uint32_t len = NS_StringGetMutableData(*this, UINT32_MAX, &data); return data + len; } @@ -597,7 +597,7 @@ nsACString::char_type* nsACString::EndWriting() { char_type *data; - uint32_t len = NS_CStringGetMutableData(*this, PR_UINT32_MAX, &data); + uint32_t len = NS_CStringGetMutableData(*this, UINT32_MAX, &data); return data + len; } @@ -1061,7 +1061,7 @@ void CompressWhitespace(nsAString& aString) { PRUnichar *start; - uint32_t len = NS_StringGetMutableData(aString, PR_UINT32_MAX, &start); + uint32_t len = NS_StringGetMutableData(aString, UINT32_MAX, &start); PRUnichar *end = start + len; PRUnichar *from = start, *to = start; diff --git a/xpcom/glue/nsStringAPI.h b/xpcom/glue/nsStringAPI.h index 72a75d967d246..8e0b847c8f502 100644 --- a/xpcom/glue/nsStringAPI.h +++ b/xpcom/glue/nsStringAPI.h @@ -70,15 +70,15 @@ class nsAString * Get the length, begin writing, and optionally set the length of a * string all in one operation. * - * @param newSize Size the string to this length. Pass PR_UINT32_MAX + * @param newSize Size the string to this length. Pass UINT32_MAX * to leave the length unchanged. * @return The new length of the string, or 0 if resizing failed. */ NS_HIDDEN_(uint32_t) BeginWriting(char_type **begin, char_type **end = nullptr, - uint32_t newSize = PR_UINT32_MAX); + uint32_t newSize = UINT32_MAX); - NS_HIDDEN_(char_type*) BeginWriting(uint32_t = PR_UINT32_MAX); + NS_HIDDEN_(char_type*) BeginWriting(uint32_t = UINT32_MAX); NS_HIDDEN_(char_type*) EndWriting(); NS_HIDDEN_(bool) SetLength(uint32_t aLen); @@ -107,7 +107,7 @@ class nsAString { NS_StringCopy(*this, aString); } - NS_HIDDEN_(void) Assign(const char_type* aData, size_type aLength = PR_UINT32_MAX) + NS_HIDDEN_(void) Assign(const char_type* aData, size_type aLength = UINT32_MAX) { NS_StringSetData(*this, aData, aLength); } @@ -416,15 +416,15 @@ class nsACString * Get the length, begin writing, and optionally set the length of a * string all in one operation. * - * @param newSize Size the string to this length. Pass PR_UINT32_MAX + * @param newSize Size the string to this length. Pass UINT32_MAX * to leave the length unchanged. * @return The new length of the string, or 0 if resizing failed. */ NS_HIDDEN_(uint32_t) BeginWriting(char_type **begin, char_type **end = nullptr, - uint32_t newSize = PR_UINT32_MAX); + uint32_t newSize = UINT32_MAX); - NS_HIDDEN_(char_type*) BeginWriting(uint32_t aLen = PR_UINT32_MAX); + NS_HIDDEN_(char_type*) BeginWriting(uint32_t aLen = UINT32_MAX); NS_HIDDEN_(char_type*) EndWriting(); NS_HIDDEN_(bool) SetLength(uint32_t aLen); @@ -453,7 +453,7 @@ class nsACString { NS_CStringCopy(*this, aString); } - NS_HIDDEN_(void) Assign(const char_type* aData, size_type aLength = PR_UINT32_MAX) + NS_HIDDEN_(void) Assign(const char_type* aData, size_type aLength = UINT32_MAX) { NS_CStringSetData(*this, aData, aLength); } @@ -803,7 +803,7 @@ class nsString : public nsStringContainer } explicit - nsString(const char_type* aData, size_type aLength = PR_UINT32_MAX) + nsString(const char_type* aData, size_type aLength = UINT32_MAX) { NS_StringContainerInit2(*this, aData, aLength, 0); } @@ -823,7 +823,7 @@ class nsString : public nsStringContainer self_type& operator=(const char_type* aPtr) { Assign(aPtr); return *this; } self_type& operator=(char_type aChar) { Assign(aChar); return *this; } - void Adopt(const char_type *aData, size_type aLength = PR_UINT32_MAX) + void Adopt(const char_type *aData, size_type aLength = UINT32_MAX) { NS_StringContainerFinish(*this); NS_StringContainerInit2(*this, aData, aLength, @@ -863,7 +863,7 @@ class nsCString : public nsCStringContainer } explicit - nsCString(const char_type* aData, size_type aLength = PR_UINT32_MAX) + nsCString(const char_type* aData, size_type aLength = UINT32_MAX) { NS_CStringContainerInit(*this); NS_CStringSetData(*this, aData, aLength); @@ -884,7 +884,7 @@ class nsCString : public nsCStringContainer self_type& operator=(const char_type* aPtr) { Assign(aPtr); return *this; } self_type& operator=(char_type aChar) { Assign(aChar); return *this; } - void Adopt(const char_type *aData, size_type aLength = PR_UINT32_MAX) + void Adopt(const char_type *aData, size_type aLength = UINT32_MAX) { NS_CStringContainerFinish(*this); NS_CStringContainerInit2(*this, aData, aLength, @@ -912,11 +912,11 @@ class nsDependentString : public nsString nsDependentString() {} explicit - nsDependentString(const char_type* aData, size_type aLength = PR_UINT32_MAX) + nsDependentString(const char_type* aData, size_type aLength = UINT32_MAX) : nsString(aData, aLength, NS_CSTRING_CONTAINER_INIT_DEPEND) {} - void Rebind(const char_type* aData, size_type aLength = PR_UINT32_MAX) + void Rebind(const char_type* aData, size_type aLength = UINT32_MAX) { NS_StringContainerFinish(*this); NS_StringContainerInit2(*this, aData, aLength, @@ -935,11 +935,11 @@ class nsDependentCString : public nsCString nsDependentCString() {} explicit - nsDependentCString(const char_type* aData, size_type aLength = PR_UINT32_MAX) + nsDependentCString(const char_type* aData, size_type aLength = UINT32_MAX) : nsCString(aData, aLength, NS_CSTRING_CONTAINER_INIT_DEPEND) {} - void Rebind(const char_type* aData, size_type aLength = PR_UINT32_MAX) + void Rebind(const char_type* aData, size_type aLength = UINT32_MAX) { NS_CStringContainerFinish(*this); NS_CStringContainerInit2(*this, aData, aLength, @@ -994,7 +994,7 @@ class NS_ConvertASCIItoUTF16 : public nsString } explicit - NS_ConvertASCIItoUTF16(const char* aData, uint32_t aLength = PR_UINT32_MAX) + NS_ConvertASCIItoUTF16(const char* aData, uint32_t aLength = UINT32_MAX) { NS_CStringToUTF16(nsDependentCString(aData, aLength), NS_CSTRING_ENCODING_ASCII, *this); @@ -1016,7 +1016,7 @@ class NS_ConvertUTF8toUTF16 : public nsString } explicit - NS_ConvertUTF8toUTF16(const char* aData, uint32_t aLength = PR_UINT32_MAX) + NS_ConvertUTF8toUTF16(const char* aData, uint32_t aLength = UINT32_MAX) { NS_CStringToUTF16(nsDependentCString(aData, aLength), NS_CSTRING_ENCODING_UTF8, *this); @@ -1038,7 +1038,7 @@ class NS_ConvertUTF16toUTF8 : public nsCString } explicit - NS_ConvertUTF16toUTF8(const PRUnichar* aData, uint32_t aLength = PR_UINT32_MAX) + NS_ConvertUTF16toUTF8(const PRUnichar* aData, uint32_t aLength = UINT32_MAX) { NS_UTF16ToCString(nsDependentString(aData, aLength), NS_CSTRING_ENCODING_UTF8, *this); @@ -1060,7 +1060,7 @@ class NS_LossyConvertUTF16toASCII : public nsCString } explicit - NS_LossyConvertUTF16toASCII(const PRUnichar* aData, uint32_t aLength = PR_UINT32_MAX) + NS_LossyConvertUTF16toASCII(const PRUnichar* aData, uint32_t aLength = UINT32_MAX) { NS_UTF16ToCString(nsDependentString(aData, aLength), NS_CSTRING_ENCODING_ASCII, *this); diff --git a/xpcom/glue/nsVersionComparator.cpp b/xpcom/glue/nsVersionComparator.cpp index f7bcf20c565bf..5c711850d5775 100644 --- a/xpcom/glue/nsVersionComparator.cpp +++ b/xpcom/glue/nsVersionComparator.cpp @@ -132,7 +132,7 @@ ParseVP(PRUnichar *part, VersionPartW &result) *dot = '\0'; if (part[0] == '*' && part[1] == '\0') { - result.numA = PR_INT32_MAX; + result.numA = INT32_MAX; result.strB = L""; } else { diff --git a/xpcom/io/Base64.cpp b/xpcom/io/Base64.cpp index bd3d3b704e84f..7b2bf24549a8f 100644 --- a/xpcom/io/Base64.cpp +++ b/xpcom/io/Base64.cpp @@ -171,7 +171,7 @@ EncodeInputStream(nsIInputStream *aInputStream, uint64_t countlong = (count64 + 2) / 3 * 4; // +2 due to integer math. - if (countlong + aOffset > PR_UINT32_MAX) + if (countlong + aOffset > UINT32_MAX) return NS_ERROR_OUT_OF_MEMORY; uint32_t count = uint32_t(countlong); @@ -239,7 +239,7 @@ nsresult Base64Encode(const nsACString &aBinaryData, nsACString &aString) { // Check for overflow. - if (aBinaryData.Length() > (PR_UINT32_MAX / 4) * 3) { + if (aBinaryData.Length() > (UINT32_MAX / 4) * 3) { return NS_ERROR_FAILURE; } @@ -283,7 +283,7 @@ nsresult Base64Decode(const nsACString &aString, nsACString &aBinaryData) { // Check for overflow. - if (aString.Length() > PR_UINT32_MAX / 3) { + if (aString.Length() > UINT32_MAX / 3) { return NS_ERROR_FAILURE; } diff --git a/xpcom/io/nsEscape.cpp b/xpcom/io/nsEscape.cpp index be1ad6bf99e9b..9f076a3d20521 100644 --- a/xpcom/io/nsEscape.cpp +++ b/xpcom/io/nsEscape.cpp @@ -75,7 +75,7 @@ static char* nsEscapeCount( // size_t is likely to be long unsigned int but nsMemory::Alloc(size_t) // calls NS_Alloc_P(size_t) which calls PR_Malloc(uint32_t), so there is // no chance to allocate more than 4GB using nsMemory::Alloc() - if (dstSize > PR_UINT32_MAX) + if (dstSize > UINT32_MAX) return 0; char* result = (char *)nsMemory::Alloc(dstSize); @@ -193,7 +193,7 @@ nsEscapeHTML(const char * string) char *rv = nullptr; /* XXX Hardcoded max entity len. The +1 is for the trailing null. */ uint32_t len = PL_strlen(string); - if (len >= (PR_UINT32_MAX / 6)) + if (len >= (UINT32_MAX / 6)) return nullptr; rv = (char *)NS_Alloc( (6 * len) + 1 ); @@ -263,7 +263,7 @@ nsEscapeHTML2(const PRUnichar *aSourceBuffer, int32_t aSourceBufferLen) /* XXX Hardcoded max entity len. */ if (uint32_t(aSourceBufferLen) >= - ((PR_UINT32_MAX - sizeof(PRUnichar)) / (6 * sizeof(PRUnichar))) ) + ((UINT32_MAX - sizeof(PRUnichar)) / (6 * sizeof(PRUnichar))) ) return nullptr; PRUnichar *resultBuffer = (PRUnichar *)nsMemory::Alloc(aSourceBufferLen * diff --git a/xpcom/io/nsIPipe.idl b/xpcom/io/nsIPipe.idl index 289fd73eef985..93951ffe5b6af 100644 --- a/xpcom/io/nsIPipe.idl +++ b/xpcom/io/nsIPipe.idl @@ -50,7 +50,7 @@ interface nsIPipe : nsISupports * specifies the segment size in bytes (pass 0 to use default value) * @param segmentCount * specifies the max number of segments (pass 0 to use default - * value). Passing PR_UINT32_MAX here causes the pipe to have + * value). Passing UINT32_MAX here causes the pipe to have * "infinite" space. This mode can be useful in some cases, but * should always be used with caution. The default value for this * parameter is a finite value. @@ -122,7 +122,7 @@ interface nsISearchableInputStream : nsISupports * specifies the segment size in bytes (pass 0 to use default value) * @param segmentCount * specifies the max number of segments (pass 0 to use default value) - * passing PR_UINT32_MAX here causes the pipe to have "infinite" space. + * passing UINT32_MAX here causes the pipe to have "infinite" space. * this mode can be useful in some cases, but should always be used with * caution. the default value for this parameter is a finite value. * @param segmentAlloc @@ -154,7 +154,7 @@ NS_NewPipe2(nsIAsyncInputStream **pipeIn, * @param maxSize * specifies the max size of the pipe (pass 0 to use default value) * number of segments is maxSize / segmentSize, and maxSize must be a - * multiple of segmentSize. passing PR_UINT32_MAX here causes the + * multiple of segmentSize. passing UINT32_MAX here causes the * pipe to have "infinite" space. this mode can be useful in some * cases, but should always be used with caution. the default value * for this parameter is a finite value. diff --git a/xpcom/io/nsIStorageStream.idl b/xpcom/io/nsIStorageStream.idl index 8212a9245ff0c..e49e80d00d05b 100644 --- a/xpcom/io/nsIStorageStream.idl +++ b/xpcom/io/nsIStorageStream.idl @@ -28,7 +28,7 @@ interface nsIStorageStream : nsISupports * Size of each segment. Must be a power of two. * @param maxSize * Maximum total size of this stream. length will always be less - * than or equal to this value. Passing PR_UINT32_MAX is safe. + * than or equal to this value. Passing UINT32_MAX is safe. * @param segmentAllocator * Which allocator to use for the segments. May be null, in which * case a default allocator will be used. diff --git a/xpcom/io/nsPipe3.cpp b/xpcom/io/nsPipe3.cpp index b22da977b095a..5dacc2a5f9466 100644 --- a/xpcom/io/nsPipe3.cpp +++ b/xpcom/io/nsPipe3.cpp @@ -1239,10 +1239,10 @@ NS_NewPipe(nsIInputStream **pipeIn, if (segmentSize == 0) segmentSize = DEFAULT_SEGMENT_SIZE; - // Handle maxSize of PR_UINT32_MAX as a special case + // Handle maxSize of UINT32_MAX as a special case uint32_t segmentCount; - if (maxSize == PR_UINT32_MAX) - segmentCount = PR_UINT32_MAX; + if (maxSize == UINT32_MAX) + segmentCount = UINT32_MAX; else segmentCount = maxSize / segmentSize; diff --git a/xpcom/io/nsScriptableInputStream.cpp b/xpcom/io/nsScriptableInputStream.cpp index e39dd41d2110c..820a103814d9f 100644 --- a/xpcom/io/nsScriptableInputStream.cpp +++ b/xpcom/io/nsScriptableInputStream.cpp @@ -41,7 +41,7 @@ nsScriptableInputStream::Read(uint32_t aCount, char **_retval) { if (NS_FAILED(rv)) return rv; // bug716556 - Ensure count+1 doesn't overflow - uint32_t count = NS_MIN((uint32_t)NS_MIN(count64, aCount), PR_UINT32_MAX - 1); + uint32_t count = NS_MIN((uint32_t)NS_MIN(count64, aCount), UINT32_MAX - 1); buffer = (char*)nsMemory::Alloc(count+1); // make room for '\0' if (!buffer) return NS_ERROR_OUT_OF_MEMORY; diff --git a/xpcom/io/nsStreamUtils.cpp b/xpcom/io/nsStreamUtils.cpp index 1360e3a521797..9b4a516ba5cfb 100644 --- a/xpcom/io/nsStreamUtils.cpp +++ b/xpcom/io/nsStreamUtils.cpp @@ -625,7 +625,7 @@ NS_ConsumeStream(nsIInputStream *stream, uint32_t maxCount, nsACString &result) // resize result buffer uint32_t length = result.Length(); - if (avail > PR_UINT32_MAX - length) + if (avail > UINT32_MAX - length) return NS_ERROR_FILE_TOO_BIG; result.SetLength(length + avail); diff --git a/xpcom/io/nsStreamUtils.h b/xpcom/io/nsStreamUtils.h index 1171ec413b938..3759dfea8850f 100644 --- a/xpcom/io/nsStreamUtils.h +++ b/xpcom/io/nsStreamUtils.h @@ -112,7 +112,7 @@ NS_CancelAsyncCopy(nsISupports *aCopierCtx, nsresult aReason); * The input stream to read. * @param aMaxCount * The maximum number of bytes to consume from the stream. Pass the - * value PR_UINT32_MAX to consume the entire stream. The number of + * value UINT32_MAX to consume the entire stream. The number of * bytes actually read is given by the length of aBuffer upon return. * @param aBuffer * The string object that will contain the stream data upon return. diff --git a/xpcom/string/public/nsReadableUtils.h b/xpcom/string/public/nsReadableUtils.h index 224732c9760ac..6116d389e8f23 100644 --- a/xpcom/string/public/nsReadableUtils.h +++ b/xpcom/string/public/nsReadableUtils.h @@ -343,7 +343,7 @@ const nsAFlatCString& NullCString(); * Returns 0 if the strings are equal, -1 if aUTF8String is less * than aUTF16Count, and 1 in the reverse case. In case of fatal * error (eg the strings are not valid UTF8 and UTF16 respectively), - * this method will return PR_INT32_MIN. + * this method will return INT32_MIN. */ int32_t CompareUTF8toUTF16(const nsASingleFragmentCString& aUTF8String, diff --git a/xpcom/string/src/nsReadableUtils.cpp b/xpcom/string/src/nsReadableUtils.cpp index 4cc8894fe9837..b2d093999e7ed 100644 --- a/xpcom/string/src/nsReadableUtils.cpp +++ b/xpcom/string/src/nsReadableUtils.cpp @@ -1054,7 +1054,7 @@ CompareUTF8toUTF16(const nsASingleFragmentCString& aUTF8String, bool err; c8_32 = UTF8CharEnumerator::NextChar(&u8, u8end, &err); if (err) - return PR_INT32_MIN; + return INT32_MIN; uint32_t c16_32 = UTF16CharEnumerator::NextChar(&u16, u16end); // The above UTF16CharEnumerator::NextChar() calls can diff --git a/xpcom/tests/TestPipes.cpp b/xpcom/tests/TestPipes.cpp index ecb69d01cc396..92576509ab239 100644 --- a/xpcom/tests/TestPipes.cpp +++ b/xpcom/tests/TestPipes.cpp @@ -63,10 +63,10 @@ nsresult TP_NewPipe(nsIInputStream **pipeIn, if (segmentSize == 0) segmentSize = TP_DEFAULT_SEGMENT_SIZE; - // Handle maxSize of PR_UINT32_MAX as a special case + // Handle maxSize of UINT32_MAX as a special case uint32_t segmentCount; - if (maxSize == PR_UINT32_MAX) - segmentCount = PR_UINT32_MAX; + if (maxSize == UINT32_MAX) + segmentCount = UINT32_MAX; else segmentCount = maxSize / segmentSize; diff --git a/xpcom/tests/TestStorageStream.cpp b/xpcom/tests/TestStorageStream.cpp index 24898b8086546..7b1dad018d1d6 100644 --- a/xpcom/tests/TestStorageStream.cpp +++ b/xpcom/tests/TestStorageStream.cpp @@ -16,7 +16,7 @@ int main() nsresult rv; nsCOMPtr stor; - rv = NS_NewStorageStream(4096, PR_UINT32_MAX, getter_AddRefs(stor)); + rv = NS_NewStorageStream(4096, UINT32_MAX, getter_AddRefs(stor)); if (NS_FAILED(rv)) return -1; diff --git a/xpcom/tests/TestStreamUtils.cpp b/xpcom/tests/TestStreamUtils.cpp index 50e93f3486d39..72640474fe5b8 100644 --- a/xpcom/tests/TestStreamUtils.cpp +++ b/xpcom/tests/TestStreamUtils.cpp @@ -22,7 +22,7 @@ static bool test_consume_stream() { nsCOMPtr output; NS_NewPipe(getter_AddRefs(input), getter_AddRefs(output), - 10, PR_UINT32_MAX); + 10, UINT32_MAX); if (!input || !output) return false; @@ -33,7 +33,7 @@ static bool test_consume_stream() { output = nullptr; // close output nsCString buf; - if (NS_FAILED(NS_ConsumeStream(input, PR_UINT32_MAX, buf))) + if (NS_FAILED(NS_ConsumeStream(input, UINT32_MAX, buf))) return false; if (!buf.Equals(kData)) diff --git a/xpcom/tests/TestStrings.cpp b/xpcom/tests/TestStrings.cpp index e213d2a952b4b..44dd2f4c5fd0a 100644 --- a/xpcom/tests/TestStrings.cpp +++ b/xpcom/tests/TestStrings.cpp @@ -719,13 +719,13 @@ bool test_appendint64() str.Truncate(); str.AppendInt(maxint_plus1); if (!str.Equals(maxint_plus1_expected)) { - fprintf(stderr, "Error appending PR_UINT32_MAX + 1: Got %s\n", str.get()); + fprintf(stderr, "Error appending UINT32_MAX + 1: Got %s\n", str.get()); return false; } str.Truncate(); str.AppendInt(maxint_plus1, 16); if (!str.Equals(maxint_plus1_expected_x)) { - fprintf(stderr, "Error appending PR_UINT32_MAX + 1 (hex): Got %s\n", str.get()); + fprintf(stderr, "Error appending UINT32_MAX + 1 (hex): Got %s\n", str.get()); return false; } diff --git a/xpcom/tests/TestTArray.cpp b/xpcom/tests/TestTArray.cpp index 490bdad26c2c0..663dec3a0b511 100644 --- a/xpcom/tests/TestTArray.cpp +++ b/xpcom/tests/TestTArray.cpp @@ -95,9 +95,9 @@ static bool test_basic_array(ElementType *data, return false; if (ary[index] != extra) return false; - if (ary.IndexOf(extra) == PR_UINT32_MAX) + if (ary.IndexOf(extra) == UINT32_MAX) return false; - if (ary.LastIndexOf(extra) == PR_UINT32_MAX) + if (ary.LastIndexOf(extra) == UINT32_MAX) return false; // ensure proper searching if (ary.IndexOf(extra) > ary.LastIndexOf(extra)) diff --git a/xpcom/tests/external/TestMinStringAPI.cpp b/xpcom/tests/external/TestMinStringAPI.cpp index dba84f1b2d422..226fca3a26d9c 100644 --- a/xpcom/tests/external/TestMinStringAPI.cpp +++ b/xpcom/tests/external/TestMinStringAPI.cpp @@ -30,7 +30,7 @@ static bool test_basic_1() return false; } - NS_CStringSetData(s, kAsciiData, PR_UINT32_MAX); + NS_CStringSetData(s, kAsciiData, UINT32_MAX); len = NS_CStringGetData(s, &ptr); if (ptr == nullptr || strcmp(ptr, kAsciiData) != 0) { @@ -89,7 +89,7 @@ static bool test_basic_2() return false; } - NS_StringSetData(s, kUnicodeData, PR_UINT32_MAX); + NS_StringSetData(s, kUnicodeData, UINT32_MAX); len = NS_StringGetData(s, &ptr); if (len != sizeof(kUnicodeData)/2 - 1) { @@ -361,7 +361,7 @@ static bool test_adopt() nsCStringContainer s; NS_ENSURE_SUCCESS( - NS_CStringContainerInit2(s, data, PR_UINT32_MAX, + NS_CStringContainerInit2(s, data, UINT32_MAX, NS_CSTRING_CONTAINER_INIT_ADOPT), false); // leaks data on failure *shrug* diff --git a/xpcom/threads/LazyIdleThread.cpp b/xpcom/threads/LazyIdleThread.cpp index c4d1cded03d97..73005b3f4dd1f 100644 --- a/xpcom/threads/LazyIdleThread.cpp +++ b/xpcom/threads/LazyIdleThread.cpp @@ -86,7 +86,7 @@ LazyIdleThread::DisableIdleTimeout() MutexAutoLock lock(mMutex); // Pretend we have a pending event to keep the idle timer from firing. - NS_ASSERTION(mPendingEventCount < PR_UINT32_MAX, "Way too many!"); + NS_ASSERTION(mPendingEventCount < UINT32_MAX, "Way too many!"); mPendingEventCount++; } @@ -119,7 +119,7 @@ LazyIdleThread::PreDispatch() { MutexAutoLock lock(mMutex); - NS_ASSERTION(mPendingEventCount < PR_UINT32_MAX, "Way too many!"); + NS_ASSERTION(mPendingEventCount < UINT32_MAX, "Way too many!"); mPendingEventCount++; } @@ -497,7 +497,7 @@ LazyIdleThread::AfterProcessNextEvent(nsIThreadInternal* /* aThread */, shouldNotifyIdle = !mPendingEventCount; if (shouldNotifyIdle) { - NS_ASSERTION(mIdleNotificationCount < PR_UINT32_MAX, "Way too many!"); + NS_ASSERTION(mIdleNotificationCount < UINT32_MAX, "Way too many!"); mIdleNotificationCount++; } }