diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp index ee9f6989f61..6a8e3d38383 100644 --- a/image/src/RasterImage.cpp +++ b/image/src/RasterImage.cpp @@ -1531,7 +1531,7 @@ RasterImage::AddSourceData(const char *aBuffer, PRUint32 aCount) /* Note! buf must be declared as char buf[9]; */ // just used for logging and hashing the header static void -get_header_str (char *buf, char *data, PRSize data_len) +get_header_str (char *buf, char *data, size_t data_len) { int i; int n; diff --git a/layout/base/nsBidi.cpp b/layout/base/nsBidi.cpp index 0a797bfdf63..86eadbfb7d0 100644 --- a/layout/base/nsBidi.cpp +++ b/layout/base/nsBidi.cpp @@ -184,7 +184,7 @@ void nsBidi::Init() * which we know we don't need any more; * is this the best way to do this?? */ -bool nsBidi::GetMemory(void **aMemory, PRSize *aSize, bool aMayAllocate, PRSize aSizeNeeded) +bool nsBidi::GetMemory(void **aMemory, size_t *aSize, bool aMayAllocate, size_t aSizeNeeded) { /* check for existing memory */ if(*aMemory==NULL) { diff --git a/layout/base/nsBidi.h b/layout/base/nsBidi.h index 29888cacd72..d0e338912f5 100644 --- a/layout/base/nsBidi.h +++ b/layout/base/nsBidi.h @@ -823,7 +823,7 @@ protected: PRInt32 mLength; /** memory sizes in bytes */ - PRSize mDirPropsSize, mLevelsSize, mRunsSize; + size_t mDirPropsSize, mLevelsSize, mRunsSize; /** allocated memory */ DirProp* mDirPropsMemory; @@ -860,7 +860,7 @@ private: void Init(); - bool GetMemory(void **aMemory, PRSize* aSize, bool aMayAllocate, PRSize aSizeNeeded); + bool GetMemory(void **aMemory, size_t* aSize, bool aMayAllocate, size_t aSizeNeeded); void Free(); diff --git a/netwerk/protocol/http/nsHttpAuthCache.cpp b/netwerk/protocol/http/nsHttpAuthCache.cpp index 0bd80f262bf..246f426feb8 100644 --- a/netwerk/protocol/http/nsHttpAuthCache.cpp +++ b/netwerk/protocol/http/nsHttpAuthCache.cpp @@ -190,7 +190,7 @@ nsHttpAuthCache::LookupAuthNode(const char *scheme, } void * -nsHttpAuthCache::AllocTable(void *self, PRSize size) +nsHttpAuthCache::AllocTable(void *self, size_t size) { return malloc(size); } diff --git a/netwerk/protocol/http/nsHttpAuthCache.h b/netwerk/protocol/http/nsHttpAuthCache.h index c9c75179028..e312b9a9007 100644 --- a/netwerk/protocol/http/nsHttpAuthCache.h +++ b/netwerk/protocol/http/nsHttpAuthCache.h @@ -221,7 +221,7 @@ private: nsCString &key); // hash table allocation functions - static void* AllocTable(void *, PRSize size); + static void* AllocTable(void *, size_t size); static void FreeTable(void *, void *item); static PLHashEntry* AllocEntry(void *, const void *key); static void FreeEntry(void *, PLHashEntry *he, PRUintn flag); diff --git a/rdf/base/src/nsRDFService.cpp b/rdf/base/src/nsRDFService.cpp index 34113d3ccf4..65b88fa56c6 100644 --- a/rdf/base/src/nsRDFService.cpp +++ b/rdf/base/src/nsRDFService.cpp @@ -82,7 +82,7 @@ class BlobImpl; // XXX sigh, why were DefaultAllocTable et. al. declared static, anyway? static void * -DataSourceAllocTable(void *pool, PRSize size) +DataSourceAllocTable(void *pool, size_t size) { return PR_MALLOC(size); } diff --git a/xpcom/base/nsMemoryImpl.cpp b/xpcom/base/nsMemoryImpl.cpp index dc8523e9437..4d9dee82406 100644 --- a/xpcom/base/nsMemoryImpl.cpp +++ b/xpcom/base/nsMemoryImpl.cpp @@ -26,13 +26,13 @@ static nsMemoryImpl sGlobalMemory; NS_IMPL_QUERY_INTERFACE1(nsMemoryImpl, nsIMemory) NS_IMETHODIMP_(void*) -nsMemoryImpl::Alloc(PRSize size) +nsMemoryImpl::Alloc(size_t size) { return NS_Alloc(size); } NS_IMETHODIMP_(void*) -nsMemoryImpl::Realloc(void* ptr, PRSize size) +nsMemoryImpl::Realloc(void* ptr, size_t size) { return NS_Realloc(ptr, size); } @@ -158,13 +158,13 @@ nsMemoryImpl::FlushEvent nsMemoryImpl::sFlushEvent; XPCOM_API(void*) -NS_Alloc(PRSize size) +NS_Alloc(size_t size) { return moz_xmalloc(size); } XPCOM_API(void*) -NS_Realloc(void* ptr, PRSize size) +NS_Realloc(void* ptr, size_t size) { return moz_xrealloc(ptr, size); } diff --git a/xpcom/base/nsTraceRefcntImpl.cpp b/xpcom/base/nsTraceRefcntImpl.cpp index 8ae61a663a8..eb4a540075e 100644 --- a/xpcom/base/nsTraceRefcntImpl.cpp +++ b/xpcom/base/nsTraceRefcntImpl.cpp @@ -155,7 +155,7 @@ AssertActivityIsLegal() // the BloatEntry. static void * -DefaultAllocTable(void *pool, PRSize size) +DefaultAllocTable(void *pool, size_t size) { return PR_MALLOC(size); } diff --git a/xpcom/base/nsUUIDGenerator.cpp b/xpcom/base/nsUUIDGenerator.cpp index 4c17e7614be..5871d19cc3f 100644 --- a/xpcom/base/nsUUIDGenerator.cpp +++ b/xpcom/base/nsUUIDGenerator.cpp @@ -40,9 +40,9 @@ nsUUIDGenerator::Init() /* initialize random number generator using NSPR random noise */ unsigned int seed; - PRSize bytes = 0; + size_t bytes = 0; while (bytes < sizeof(seed)) { - PRSize nbytes = PR_GetRandomNoise(((unsigned char *)&seed)+bytes, + size_t nbytes = PR_GetRandomNoise(((unsigned char *)&seed)+bytes, sizeof(seed)-bytes); if (nbytes == 0) { return NS_ERROR_FAILURE; @@ -120,7 +120,7 @@ nsUUIDGenerator::GenerateUUIDInPlace(nsID* id) setstate(mState); #endif - PRSize bytesLeft = sizeof(nsID); + size_t bytesLeft = sizeof(nsID); while (bytesLeft > 0) { #ifdef ANDROID long rval = arc4random(); @@ -137,8 +137,8 @@ nsUUIDGenerator::GenerateUUIDInPlace(nsID* id) src += sizeof(rval) - mRBytes; #endif PRUint8 *dst = ((PRUint8*) id) + (sizeof(nsID) - bytesLeft); - PRSize toWrite = (bytesLeft < mRBytes ? bytesLeft : mRBytes); - for (PRSize i = 0; i < toWrite; i++) + size_t toWrite = (bytesLeft < mRBytes ? bytesLeft : mRBytes); + for (size_t i = 0; i < toWrite; i++) dst[i] = src[i]; bytesLeft -= toWrite; diff --git a/xpcom/build/nsXPCOM.h b/xpcom/build/nsXPCOM.h index 88ed01838a3..5546d7764be 100644 --- a/xpcom/build/nsXPCOM.h +++ b/xpcom/build/nsXPCOM.h @@ -214,7 +214,7 @@ NS_NewNativeLocalFile(const nsACString &path, * @note This function is thread-safe. */ XPCOM_API(void*) -NS_Alloc(PRSize size); +NS_Alloc(size_t size); /** * Reallocates a block of memory to a new size. @@ -232,7 +232,7 @@ NS_Alloc(PRSize size); * allocation fails, the process aborts. */ XPCOM_API(void*) -NS_Realloc(void* ptr, PRSize size); +NS_Realloc(void* ptr, size_t size); /** * Frees a block of memory. Null is a permissible value, in which case no diff --git a/xpcom/build/nsXPCOMPrivate.h b/xpcom/build/nsXPCOMPrivate.h index 5f616e4ab95..d55dce2658f 100644 --- a/xpcom/build/nsXPCOMPrivate.h +++ b/xpcom/build/nsXPCOMPrivate.h @@ -68,8 +68,8 @@ typedef bool (* CStringGetIsVoidFunc)(const nsACString &); typedef nsresult (* CStringToUTF16)(const nsACString &, nsCStringEncoding, nsAString &); typedef nsresult (* UTF16ToCString)(const nsAString &, nsCStringEncoding, nsACString &); -typedef void* (* AllocFunc)(PRSize size); -typedef void* (* ReallocFunc)(void* ptr, PRSize size); +typedef void* (* AllocFunc)(size_t size); +typedef void* (* ReallocFunc)(void* ptr, size_t size); typedef void (* FreeFunc)(void* ptr); typedef void (* DebugBreakFunc)(PRUint32 aSeverity, diff --git a/xpcom/glue/DeadlockDetector.h b/xpcom/glue/DeadlockDetector.h index c1161725671..27157cf55a6 100644 --- a/xpcom/glue/DeadlockDetector.h +++ b/xpcom/glue/DeadlockDetector.h @@ -203,7 +203,7 @@ private: HashEntryArray mOrderedLT; // this <_o Other }; - static void* TableAlloc(void* /*pool*/, PRSize size) + static void* TableAlloc(void* /*pool*/, size_t size) { return operator new(size); } diff --git a/xpcom/glue/nsMemory.cpp b/xpcom/glue/nsMemory.cpp index 8c6445fe4d3..a2790b74ba3 100644 --- a/xpcom/glue/nsMemory.cpp +++ b/xpcom/glue/nsMemory.cpp @@ -24,7 +24,7 @@ nsMemory::HeapMinimize(bool aImmediate) } NS_COM_GLUE void* -nsMemory::Clone(const void* ptr, PRSize size) +nsMemory::Clone(const void* ptr, size_t size) { void* newPtr = NS_Alloc(size); if (newPtr) diff --git a/xpcom/glue/nsMemory.h b/xpcom/glue/nsMemory.h index 04c11b22307..6ce3dce8745 100644 --- a/xpcom/glue/nsMemory.h +++ b/xpcom/glue/nsMemory.h @@ -35,14 +35,14 @@ public: static NS_HIDDEN_(void*) Alloc(size_t size) { return NS_Alloc(size); } - static NS_HIDDEN_(void*) Realloc(void* ptr, PRSize size) + static NS_HIDDEN_(void*) Realloc(void* ptr, size_t size) { return NS_Realloc(ptr, size); } static NS_HIDDEN_(void) Free(void* ptr) { NS_Free(ptr); } static NS_COM_GLUE nsresult HeapMinimize(bool aImmediate); - static NS_COM_GLUE void* Clone(const void* ptr, PRSize size); + static NS_COM_GLUE void* Clone(const void* ptr, size_t size); static NS_COM_GLUE nsIMemory* GetGlobalMemoryService(); // AddRefs }; diff --git a/xpcom/glue/standalone/nsXPCOMGlue.cpp b/xpcom/glue/standalone/nsXPCOMGlue.cpp index 704bb109fa5..de2da7b4c2f 100644 --- a/xpcom/glue/standalone/nsXPCOMGlue.cpp +++ b/xpcom/glue/standalone/nsXPCOMGlue.cpp @@ -408,7 +408,7 @@ NS_UTF16ToCString(const nsAString &aSrc, nsCStringEncoding aDestEncoding, nsACSt } XPCOM_API(void*) -NS_Alloc(PRSize size) +NS_Alloc(size_t size) { if (!xpcomFunctions.allocFunc) return nullptr; @@ -416,7 +416,7 @@ NS_Alloc(PRSize size) } XPCOM_API(void*) -NS_Realloc(void* ptr, PRSize size) +NS_Realloc(void* ptr, size_t size) { if (!xpcomFunctions.reallocFunc) return nullptr; diff --git a/xpcom/stub/nsXPComStub.cpp b/xpcom/stub/nsXPComStub.cpp index 9d6282a5294..b74f5247db1 100644 --- a/xpcom/stub/nsXPComStub.cpp +++ b/xpcom/stub/nsXPComStub.cpp @@ -196,14 +196,14 @@ NS_GetTraceRefcnt(nsITraceRefcnt **result) #undef NS_Alloc EXPORT_XPCOM_API(void*) -NS_Alloc(PRSize size) +NS_Alloc(size_t size) { return NS_Alloc_P(size); } #undef NS_Realloc EXPORT_XPCOM_API(void*) -NS_Realloc(void* ptr, PRSize size) +NS_Realloc(void* ptr, size_t size) { return NS_Realloc_P(ptr, size); }