diff --git a/caps/include/nsScriptSecurityManager.h b/caps/include/nsScriptSecurityManager.h index 4a574d46a16..6228642f98e 100644 --- a/caps/include/nsScriptSecurityManager.h +++ b/caps/include/nsScriptSecurityManager.h @@ -57,6 +57,8 @@ #include "plstr.h" #include "nsIScriptExternalNameSet.h" +#include "mozilla/StandardInteger.h" + class nsIDocShell; class nsString; class nsIClassInfo; @@ -147,8 +149,8 @@ private: // Property Policy union SecurityLevel { - PRWord level; - char* capability; + intptr_t level; + char* capability; }; // Security levels diff --git a/caps/src/nsScriptSecurityManager.cpp b/caps/src/nsScriptSecurityManager.cpp index aadee7ffecb..f7e10baeb9e 100644 --- a/caps/src/nsScriptSecurityManager.cpp +++ b/caps/src/nsScriptSecurityManager.cpp @@ -95,6 +95,7 @@ #include "nsIAsyncVerifyRedirectCallback.h" #include "mozilla/Preferences.h" #include "mozilla/dom/bindings/Utils.h" +#include "mozilla/StandardInteger.h" using namespace mozilla; using namespace mozilla::dom; @@ -3374,9 +3375,9 @@ nsScriptSecurityManager::nsScriptSecurityManager(void) mIsWritingPrefs(false), mPolicyPrefsChanged(true) { - NS_ASSERTION(sizeof(PRWord) == sizeof(void*), - "PRWord and void* have different lengths on this platform. " - "This may cause a security failure with the SecurityLevel union."); + MOZ_STATIC_ASSERT(sizeof(intptr_t) == sizeof(void*), + "intptr_t and void* have different lengths on this platform. " + "This may cause a security failure with the SecurityLevel union."); mPrincipals.Init(31); } diff --git a/content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp b/content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp index 14353352335..bde4c23753f 100644 --- a/content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp +++ b/content/xslt/src/xpath/txMozillaXPathTreeWalker.cpp @@ -55,6 +55,7 @@ #include "nsAttrName.h" #include "nsTArray.h" #include "mozilla/dom/Element.h" +#include "mozilla/StandardInteger.h" const PRUint32 kUnknownIndex = PRUint32(-1); @@ -587,7 +588,7 @@ txXPathNodeUtils::getXSLTId(const txXPathNode& aNode, const txXPathNode& aBase, nsAString& aResult) { - PRUword nodeid = ((PRUword)aNode.mNode) - ((PRUword)aBase.mNode); + uintptr_t nodeid = ((uintptr_t)aNode.mNode) - ((uintptr_t)aBase.mNode); if (!aNode.isAttribute()) { CopyASCIItoUTF16(nsPrintfCString(kFmtSize, gPrintfFmt, nodeid), aResult); diff --git a/dom/plugins/base/nsNPAPIPluginStreamListener.cpp b/dom/plugins/base/nsNPAPIPluginStreamListener.cpp index ee9e388db9e..b79cbb23a13 100644 --- a/dom/plugins/base/nsNPAPIPluginStreamListener.cpp +++ b/dom/plugins/base/nsNPAPIPluginStreamListener.cpp @@ -48,6 +48,8 @@ #include "nsPluginLogging.h" #include "nsPluginStreamListenerPeer.h" +#include "mozilla/StandardInteger.h" + NS_IMPL_ISUPPORTS1(nsPluginStreamToFile, nsIOutputStream) nsPluginStreamToFile::nsPluginStreamToFile(const char* target, @@ -653,7 +655,7 @@ nsNPAPIPluginStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo, // This alignment code is most likely bogus, but we'll leave // it in for now in case it matters for some plugins on some // architectures. Who knows... - if (writeCount % sizeof(PRWord)) { + if (writeCount % sizeof(intptr_t)) { // memmove will take care about alignment memmove(mStreamBuffer, ptrStreamBuffer + writeCount, mStreamBufferByteCount); diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrappedNative.cpp index d8a03717012..89391e50e47 100644 --- a/js/xpconnect/src/XPCWrappedNative.cpp +++ b/js/xpconnect/src/XPCWrappedNative.cpp @@ -55,6 +55,7 @@ #include "nsContentUtils.h" +#include "mozilla/StandardInteger.h" #include "mozilla/Util.h" bool @@ -968,7 +969,7 @@ XPCWrappedNative::~XPCWrappedNative() Destroy(); } -static const PRWord WRAPPER_WORD_POISON = 0xa8a8a8a8; +static const intptr_t WRAPPER_WORD_POISON = 0xa8a8a8a8; void XPCWrappedNative::Destroy() diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index 4343b1a3985..ea70c69cde2 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -48,6 +48,7 @@ #include "mozilla/Assertions.h" #include "mozilla/Attributes.h" +#include "mozilla/StandardInteger.h" #include "mozilla/Util.h" #include @@ -2769,7 +2770,7 @@ public: void SetWrapper(JSObject *obj) { js::IncrementalReferenceBarrier(GetWrapperPreserveColor()); - PRWord newval = PRWord(obj) | (mWrapperWord & FLAG_MASK); + intptr_t newval = intptr_t(obj) | (mWrapperWord & FLAG_MASK); mWrapperWord = newval; } @@ -2854,7 +2855,7 @@ private: JSObject* mFlatJSObject; XPCNativeScriptableInfo* mScriptableInfo; XPCWrappedNativeTearOffChunk mFirstChunk; - PRWord mWrapperWord; + intptr_t mWrapperWord; #ifdef XPC_CHECK_WRAPPER_THREADSAFETY public: diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index f3d918dfc83..0abdab431ca 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -67,6 +67,8 @@ #include "nsSVGEffects.h" #include "nsSVGClipPathFrame.h" +#include "mozilla/StandardInteger.h" + using namespace mozilla; using namespace mozilla::layers; typedef FrameMetrics::ViewID ViewID; @@ -2017,13 +2019,13 @@ nsDisplayScrollLayer::ShouldFlattenAway(nsDisplayListBuilder* aBuilder) return GetScrollLayerCount() > 1; } -PRWord +intptr_t nsDisplayScrollLayer::GetScrollLayerCount() { FrameProperties props = mScrolledFrame->Properties(); #ifdef DEBUG bool hasCount = false; - PRWord result = reinterpret_cast( + intptr_t result = reinterpret_cast( props.Get(nsIFrame::ScrollLayerCount(), &hasCount)); // If this aborts, then the property was either not added before scroll // layers were created or the property was deleted to early. If the latter, @@ -2032,14 +2034,14 @@ nsDisplayScrollLayer::GetScrollLayerCount() NS_ABORT_IF_FALSE(hasCount, "nsDisplayScrollLayer should always be defined"); return result; #else - return reinterpret_cast(props.Get(nsIFrame::ScrollLayerCount())); + return reinterpret_cast(props.Get(nsIFrame::ScrollLayerCount())); #endif } -PRWord +intptr_t nsDisplayScrollLayer::RemoveScrollLayerCount() { - PRWord result = GetScrollLayerCount(); + intptr_t result = GetScrollLayerCount(); FrameProperties props = mScrolledFrame->Properties(); props.Remove(nsIFrame::ScrollLayerCount()); return result; diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 2e90cfaff36..17e31c5b060 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -57,6 +57,8 @@ #include "FrameLayerBuilder.h" #include "nsThemeConstants.h" +#include "mozilla/StandardInteger.h" + #include class nsIPresShell; @@ -1887,8 +1889,8 @@ public: // Get the number of nsDisplayScrollLayers for a scroll frame. Note that this // number does not include nsDisplayScrollInfoLayers. If this number is not 1 // after merging, all the nsDisplayScrollLayers should flatten away. - PRWord GetScrollLayerCount(); - PRWord RemoveScrollLayerCount(); + intptr_t GetScrollLayerCount(); + intptr_t RemoveScrollLayerCount(); private: nsIFrame* mScrollFrame; diff --git a/layout/base/nsPresArena.cpp b/layout/base/nsPresArena.cpp index d7fe95355e2..8a8c7a90747 100644 --- a/layout/base/nsPresArena.cpp +++ b/layout/base/nsPresArena.cpp @@ -60,12 +60,14 @@ #include "nsPrintfCString.h" #endif +#include "mozilla/StandardInteger.h" + // Even on 32-bit systems, we allocate objects from the frame arena -// that require 8-byte alignment. The cast to PRUword is needed +// that require 8-byte alignment. The cast to uintptr_t is needed // because plarena isn't as careful about mask construction as it // ought to be. #define ALIGN_SHIFT 3 -#define PL_ARENA_CONST_ALIGN_MASK ((PRUword(1) << ALIGN_SHIFT) - 1) +#define PL_ARENA_CONST_ALIGN_MASK ((uintptr_t(1) << ALIGN_SHIFT) - 1) #include "plarena.h" #ifdef _WIN32 @@ -95,31 +97,31 @@ static const size_t ARENA_PAGE_SIZE = 8192; #ifdef _WIN32 static void * -ReserveRegion(PRUword region, PRUword size) +ReserveRegion(uintptr_t region, uintptr_t size) { return VirtualAlloc((void *)region, size, MEM_RESERVE, PAGE_NOACCESS); } static void -ReleaseRegion(void *region, PRUword size) +ReleaseRegion(void *region, uintptr_t size) { VirtualFree(region, size, MEM_RELEASE); } static bool -ProbeRegion(PRUword region, PRUword size) +ProbeRegion(uintptr_t region, uintptr_t size) { SYSTEM_INFO sinfo; GetSystemInfo(&sinfo); - if (region >= (PRUword)sinfo.lpMaximumApplicationAddress && - region + size >= (PRUword)sinfo.lpMaximumApplicationAddress) { + if (region >= (uintptr_t)sinfo.lpMaximumApplicationAddress && + region + size >= (uintptr_t)sinfo.lpMaximumApplicationAddress) { return true; } else { return false; } } -static PRUword +static uintptr_t GetDesiredRegionSize() { SYSTEM_INFO sinfo; @@ -131,7 +133,7 @@ GetDesiredRegionSize() #elif defined(__OS2__) static void * -ReserveRegion(PRUword region, PRUword size) +ReserveRegion(uintptr_t region, uintptr_t size) { // OS/2 doesn't support allocation at an arbitrary address, // so return an address that is known to be invalid. @@ -139,20 +141,20 @@ ReserveRegion(PRUword region, PRUword size) } static void -ReleaseRegion(void *region, PRUword size) +ReleaseRegion(void *region, uintptr_t size) { return; } static bool -ProbeRegion(PRUword region, PRUword size) +ProbeRegion(uintptr_t region, uintptr_t size) { // There's no reliable way to probe an address in the system // arena other than by touching it and seeing if a trap occurs. return false; } -static PRUword +static uintptr_t GetDesiredRegionSize() { // Page size is fixed at 4k. @@ -164,19 +166,19 @@ GetDesiredRegionSize() #else // Unix static void * -ReserveRegion(PRUword region, PRUword size) +ReserveRegion(uintptr_t region, uintptr_t size) { return mmap((caddr_t)region, size, PROT_NONE, MAP_PRIVATE|MAP_ANON, -1, 0); } static void -ReleaseRegion(void *region, PRUword size) +ReleaseRegion(void *region, uintptr_t size) { munmap((caddr_t)region, size); } static bool -ProbeRegion(PRUword region, PRUword size) +ProbeRegion(uintptr_t region, uintptr_t size) { if (madvise((caddr_t)region, size, MADV_NORMAL)) { return true; @@ -185,7 +187,7 @@ ProbeRegion(PRUword region, PRUword size) } } -static PRUword +static uintptr_t GetDesiredRegionSize() { return sysconf(_SC_PAGESIZE); @@ -195,23 +197,23 @@ GetDesiredRegionSize() #endif // system dependencies -PR_STATIC_ASSERT(sizeof(PRUword) == 4 || sizeof(PRUword) == 8); -PR_STATIC_ASSERT(sizeof(PRUword) == sizeof(void *)); +PR_STATIC_ASSERT(sizeof(uintptr_t) == 4 || sizeof(uintptr_t) == 8); +PR_STATIC_ASSERT(sizeof(uintptr_t) == sizeof(void *)); -static PRUword -ReservePoisonArea(PRUword rgnsize) +static uintptr_t +ReservePoisonArea(uintptr_t rgnsize) { - if (sizeof(PRUword) == 8) { + if (sizeof(uintptr_t) == 8) { // Use the hardware-inaccessible region. // We have to avoid 64-bit constants and shifts by 32 bits, since this // code is compiled in 32-bit mode, although it is never executed there. return - (((PRUword(0x7FFFFFFFu) << 31) << 1 | PRUword(0xF0DEAFFFu)) + (((uintptr_t(0x7FFFFFFFu) << 31) << 1 | uintptr_t(0xF0DEAFFFu)) & ~(rgnsize-1)); } else { // First see if we can allocate the preferred poison address from the OS. - PRUword candidate = (0xF0DEAFFF & ~(rgnsize-1)); + uintptr_t candidate = (0xF0DEAFFF & ~(rgnsize-1)); void *result = ReserveRegion(candidate, rgnsize); if (result == (void *)candidate) { // success - inaccessible page allocated @@ -230,14 +232,14 @@ ReservePoisonArea(PRUword rgnsize) // The preferred address is already in use. Did the OS give us a // consolation prize? if (result != RESERVE_FAILED) { - return PRUword(result); + return uintptr_t(result); } // It didn't, so try to allocate again, without any constraint on // the address. result = ReserveRegion(0, rgnsize); if (result != RESERVE_FAILED) { - return PRUword(result); + return uintptr_t(result); } NS_RUNTIMEABORT("no usable poison region identified"); @@ -245,14 +247,14 @@ ReservePoisonArea(PRUword rgnsize) } } -static PRUword ARENA_POISON; +static uintptr_t ARENA_POISON; static PRCallOnceType ARENA_POISON_guard; static PRStatus ARENA_POISON_init() { - PRUword rgnsize = GetDesiredRegionSize(); - PRUword rgnbase = ReservePoisonArea(rgnsize); + uintptr_t rgnsize = GetDesiredRegionSize(); + uintptr_t rgnbase = ReservePoisonArea(rgnsize); if (rgnsize == 0) // can't happen return PR_FAILURE; @@ -357,8 +359,8 @@ struct nsPresArena::State { { char* p = reinterpret_cast(result); char* limit = p + list->mEntrySize; - for (; p < limit; p += sizeof(PRUword)) { - NS_ABORT_IF_FALSE(*reinterpret_cast(p) == ARENA_POISON, + for (; p < limit; p += sizeof(uintptr_t)) { + NS_ABORT_IF_FALSE(*reinterpret_cast(p) == ARENA_POISON, "PresArena: poison overwritten"); } } @@ -380,8 +382,8 @@ struct nsPresArena::State { char* p = reinterpret_cast(aPtr); char* limit = p + list->mEntrySize; - for (; p < limit; p += sizeof(PRUword)) { - *reinterpret_cast(p) = ARENA_POISON; + for (; p < limit; p += sizeof(uintptr_t)) { + *reinterpret_cast(p) = ARENA_POISON; } list->mEntries.AppendElement(aPtr); @@ -478,7 +480,7 @@ nsPresArena::FreeByCode(nsQueryFrame::FrameIID aCode, void* aPtr) mState->Free(aCode, aPtr); } -/* static */ PRUword +/* static */ uintptr_t nsPresArena::GetPoisonValue() { return ARENA_POISON; diff --git a/layout/base/nsPresArena.h b/layout/base/nsPresArena.h index ab2fb2e027b..cabfedfffd7 100644 --- a/layout/base/nsPresArena.h +++ b/layout/base/nsPresArena.h @@ -48,6 +48,8 @@ #include "nscore.h" #include "nsQueryFrame.h" +#include "mozilla/StandardInteger.h" + // Uncomment this to disable arenas, instead forwarding to // malloc for every allocation. //#define DEBUG_TRACEMALLOC_PRESARENA 1 @@ -83,7 +85,7 @@ public: * The caller is responsible for ensuring that a pres shell has been * initialized before calling this. */ - static PRUword GetPoisonValue(); + static uintptr_t GetPoisonValue(); private: struct State; diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 57310d47512..205a09ab3c8 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -79,6 +79,7 @@ #include "mozilla/Preferences.h" #include "mozilla/LookAndFeel.h" #include "mozilla/dom/Element.h" +#include "mozilla/StandardInteger.h" #include "FrameLayerBuilder.h" #include "nsSMILKeySpline.h" #include "nsSubDocumentFrame.h" @@ -2100,11 +2101,11 @@ public: } protected: - void SetCount(PRWord aCount) { + void SetCount(intptr_t aCount) { mProps.Set(nsIFrame::ScrollLayerCount(), reinterpret_cast(aCount)); } - PRWord mCount; + intptr_t mCount; FrameProperties mProps; nsIFrame* mScrollFrame; nsIFrame* mScrolledFrame; diff --git a/layout/style/nsRuleData.cpp b/layout/style/nsRuleData.cpp index f22325d65e4..590272c1213 100644 --- a/layout/style/nsRuleData.cpp +++ b/layout/style/nsRuleData.cpp @@ -40,20 +40,22 @@ #include "nsCSSProps.h" #include "nsPresArena.h" +#include "mozilla/StandardInteger.h" + inline size_t nsRuleData::GetPoisonOffset() { // Fill in mValueOffsets such that mValueStorage + mValueOffsets[i] // will yield the frame poison value for all uninitialized value // offsets. - MOZ_STATIC_ASSERT(sizeof(PRUword) == sizeof(size_t), - "expect PRUword and size_t to be the same size"); - MOZ_STATIC_ASSERT(PRUword(-1) > PRUword(0), - "expect PRUword to be unsigned"); + MOZ_STATIC_ASSERT(sizeof(uintptr_t) == sizeof(size_t), + "expect uintptr_t and size_t to be the same size"); + MOZ_STATIC_ASSERT(uintptr_t(-1) > uintptr_t(0), + "expect uintptr_t to be unsigned"); MOZ_STATIC_ASSERT(size_t(-1) > size_t(0), "expect size_t to be unsigned"); - PRUword framePoisonValue = nsPresArena::GetPoisonValue(); - return size_t(framePoisonValue - PRUword(mValueStorage)) / + uintptr_t framePoisonValue = nsPresArena::GetPoisonValue(); + return size_t(framePoisonValue - uintptr_t(mValueStorage)) / sizeof(nsCSSValue); } diff --git a/layout/style/nsRuleNode.h b/layout/style/nsRuleNode.h index a8de6e28dbc..e3b0f1c8b0d 100644 --- a/layout/style/nsRuleNode.h +++ b/layout/style/nsRuleNode.h @@ -48,6 +48,8 @@ #include "nsPresContext.h" #include "nsStyleStruct.h" +#include "mozilla/StandardInteger.h" + class nsStyleContext; struct PLDHashTable; struct nsRuleData; @@ -352,7 +354,7 @@ private: return mChildren.asVoid != nsnull; } bool ChildrenAreHashed() { - return (PRWord(mChildren.asVoid) & kTypeMask) == kHashType; + return (intptr_t(mChildren.asVoid) & kTypeMask) == kHashType; } nsRuleNode* ChildrenList() { return mChildren.asList; @@ -361,17 +363,17 @@ private: return &mChildren.asList; } PLDHashTable* ChildrenHash() { - return (PLDHashTable*) (PRWord(mChildren.asHash) & ~PRWord(kTypeMask)); + return (PLDHashTable*) (intptr_t(mChildren.asHash) & ~intptr_t(kTypeMask)); } void SetChildrenList(nsRuleNode *aList) { - NS_ASSERTION(!(PRWord(aList) & kTypeMask), + NS_ASSERTION(!(intptr_t(aList) & kTypeMask), "pointer not 2-byte aligned"); mChildren.asList = aList; } void SetChildrenHash(PLDHashTable *aHashtable) { - NS_ASSERTION(!(PRWord(aHashtable) & kTypeMask), + NS_ASSERTION(!(intptr_t(aHashtable) & kTypeMask), "pointer not 2-byte aligned"); - mChildren.asHash = (PLDHashTable*)(PRWord(aHashtable) | kHashType); + mChildren.asHash = (PLDHashTable*)(intptr_t(aHashtable) | kHashType); } void ConvertChildrenToHash(); diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index 2d6d4b585b1..69120f07ed9 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -169,6 +169,7 @@ #include "mozilla/Mutex.h" #include "mozilla/CondVar.h" +#include "mozilla/StandardInteger.h" #include "mozilla/Telemetry.h" using namespace mozilla; @@ -854,7 +855,7 @@ public: mFreeList = entries; for (PRUint32 i = 1; i < ArrayLength(aBlock->mEntries); ++i) { entries[i - 1].mNextInFreeList = - (nsPurpleBufferEntry*)(PRUword(entries + i) | 1); + (nsPurpleBufferEntry*)(uintptr_t(entries + i) | 1); } entries[ArrayLength(aBlock->mEntries) - 1].mNextInFreeList = (nsPurpleBufferEntry*)1; @@ -883,7 +884,7 @@ public: for (nsPurpleBufferEntry *e = b->mEntries, *eEnd = ArrayEnd(b->mEntries); e != eEnd; ++e) { - if (!(PRUword(e->mObject) & PRUword(1))) { + if (!(uintptr_t(e->mObject) & uintptr_t(1))) { // This is a real entry (rather than something on the // free list). if (e->mObject) { @@ -935,7 +936,7 @@ public: nsPurpleBufferEntry *e = mFreeList; mFreeList = (nsPurpleBufferEntry*) - (PRUword(mFreeList->mNextInFreeList) & ~PRUword(1)); + (uintptr_t(mFreeList->mNextInFreeList) & ~uintptr_t(1)); return e; } @@ -967,7 +968,7 @@ public: #endif e->mNextInFreeList = - (nsPurpleBufferEntry*)(PRUword(mFreeList) | PRUword(1)); + (nsPurpleBufferEntry*)(uintptr_t(mFreeList) | uintptr_t(1)); mFreeList = e; --mCount; @@ -1033,7 +1034,7 @@ nsPurpleBuffer::SelectPointers(GCGraphBuilder &aBuilder) for (nsPurpleBufferEntry *e = b->mEntries, *eEnd = ArrayEnd(b->mEntries); e != eEnd; ++e) { - if (!(PRUword(e->mObject) & PRUword(1))) { + if (!(uintptr_t(e->mObject) & uintptr_t(1))) { if (e->mObject) { ++realCount; } @@ -1058,7 +1059,7 @@ nsPurpleBuffer::SelectPointers(GCGraphBuilder &aBuilder) for (nsPurpleBufferEntry *e = b->mEntries, *eEnd = ArrayEnd(b->mEntries); e != eEnd; ++e) { - if (!(PRUword(e->mObject) & PRUword(1))) { + if (!(uintptr_t(e->mObject) & uintptr_t(1))) { // This is a real entry (rather than something on the // free list). if (!e->mObject || AddPurpleRoot(aBuilder, e->mObject)) { @@ -2163,7 +2164,7 @@ nsPurpleBuffer::RemoveSkippable(bool removeChildlessNodes) for (nsPurpleBufferEntry *e = b->mEntries, *eEnd = ArrayEnd(b->mEntries); e != eEnd; ++e) { - if (!(PRUword(e->mObject) & PRUword(1))) { + if (!(uintptr_t(e->mObject) & uintptr_t(1))) { // This is a real entry (rather than something on the // free list). if (e->mObject) { @@ -2201,7 +2202,7 @@ nsPurpleBuffer::NoteAll(GCGraphBuilder &builder) for (nsPurpleBufferEntry *e = b->mEntries, *eEnd = ArrayEnd(b->mEntries); e != eEnd; ++e) { - if (!(PRUword(e->mObject) & PRUword(1)) && e->mObject) { + if (!(uintptr_t(e->mObject) & uintptr_t(1)) && e->mObject) { builder.NoteXPCOMRoot(e->mObject); } } diff --git a/xpcom/base/nscore.h b/xpcom/base/nscore.h index 1da7038084b..17043a9a37a 100644 --- a/xpcom/base/nscore.h +++ b/xpcom/base/nscore.h @@ -56,6 +56,7 @@ * Incorporate the core NSPR data types which XPCOM uses. */ #include "prtypes.h" +#include "mozilla/StandardInteger.h" /* * This is for functions that are like malloc_usable_size. Such functions are @@ -393,9 +394,9 @@ typedef PRUint32 nsrefcnt; * Use these macros to do 64bit safe pointer conversions. */ -#define NS_PTR_TO_INT32(x) ((PRInt32) (PRWord) (x)) -#define NS_PTR_TO_UINT32(x) ((PRUint32) (PRWord) (x)) -#define NS_INT32_TO_PTR(x) ((void *) (PRWord) (x)) +#define NS_PTR_TO_INT32(x) ((PRInt32) (intptr_t) (x)) +#define NS_PTR_TO_UINT32(x) ((PRUint32) (intptr_t) (x)) +#define NS_INT32_TO_PTR(x) ((void *) (intptr_t) (x)) /* * Use NS_STRINGIFY to form a string literal from the value of a macro. diff --git a/xpcom/glue/nsVoidArray.h b/xpcom/glue/nsVoidArray.h index 9d3415b0084..46258959798 100644 --- a/xpcom/glue/nsVoidArray.h +++ b/xpcom/glue/nsVoidArray.h @@ -41,6 +41,8 @@ #include "nsDebug.h" +#include "mozilla/StandardInteger.h" + // Comparator callback function for sorting array values. typedef int (* nsVoidArrayComparatorFunc) (const void* aElement1, const void* aElement2, void* aData); @@ -297,19 +299,19 @@ private: bool HasSingle() const { - return !!(reinterpret_cast(mImpl) & 0x1); + return !!(reinterpret_cast(mImpl) & 0x1); } void* GetSingle() const { NS_ASSERTION(HasSingle(), "wrong type"); return reinterpret_cast - (reinterpret_cast(mImpl) & ~0x1); + (reinterpret_cast(mImpl) & ~0x1); } void SetSingle(void *aChild) { NS_ASSERTION(HasSingle() || !mImpl, "overwriting array"); mImpl = reinterpret_cast - (reinterpret_cast(aChild) | 0x1); + (reinterpret_cast(aChild) | 0x1); } bool IsEmpty() const { diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp index b22ad1018c2..baff4dcbde8 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp +++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_mips.cpp @@ -46,6 +46,7 @@ #include "xptcprivate.h" +#include "mozilla/StandardInteger.h" extern "C" uint32 invoke_count_words(PRUint32 paramCount, nsXPTCVariant* s) @@ -96,19 +97,19 @@ invoke_copy_to_stack(PRUint32* d, PRUint32 paramCount, case nsXPTType::T_I16 : *d = (PRUint32) s->val.i16; break; case nsXPTType::T_I32 : *d = (PRUint32) s->val.i32; break; case nsXPTType::T_I64 : - if ((PRWord)d & 4) d++; + if ((intptr_t)d & 4) d++; *((PRInt64*) d) = s->val.i64; d++; break; case nsXPTType::T_U8 : *d = (PRUint32) s->val.u8; break; case nsXPTType::T_U16 : *d = (PRUint32) s->val.u16; break; case nsXPTType::T_U32 : *d = (PRUint32) s->val.u32; break; case nsXPTType::T_U64 : - if ((PRWord)d & 4) d++; + if ((intptr_t)d & 4) d++; *((PRUint64*) d) = s->val.u64; d++; break; case nsXPTType::T_FLOAT : *((float*) d) = s->val.f; break; case nsXPTType::T_DOUBLE : - if ((PRWord)d & 4) d++; + if ((intptr_t)d & 4) d++; *((double*) d) = s->val.d; d++; break; case nsXPTType::T_BOOL : *d = (bool) s->val.b; break; diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_mips.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_mips.cpp index 535f4c77ca1..d02d09b3b78 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_mips.cpp +++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_mips.cpp @@ -41,6 +41,8 @@ #include "xptcprivate.h" #include "xptiprivate.h" +#include "mozilla/StandardInteger.h" + /* * This is for MIPS O32 ABI * Args contains a0-3 and then the stack. @@ -90,15 +92,15 @@ PrepareAndDispatch(nsXPTCStubBase* self, PRUint32 methodIndex, PRUint32* args) switch(type) { case nsXPTType::T_I64 : - if ((PRWord)ap & 4) ap++; + if ((intptr_t)ap & 4) ap++; dp->val.i64 = *((PRInt64*) ap); ap++; break; case nsXPTType::T_U64 : - if ((PRWord)ap & 4) ap++; + if ((intptr_t)ap & 4) ap++; dp->val.u64 = *((PRInt64*) ap); ap++; break; case nsXPTType::T_DOUBLE: - if ((PRWord)ap & 4) ap++; + if ((intptr_t)ap & 4) ap++; dp->val.d = *((double*) ap); ap++; break; #ifdef IS_LITTLE_ENDIAN