Bug 780387 - Part e: Stop using PRSize; r=bsmedberg

This commit is contained in:
Ms2ger 2012-08-09 09:10:11 +02:00
parent 8fcd7f8f16
commit aa7cd71f5c
16 changed files with 29 additions and 29 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -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();

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -155,7 +155,7 @@ AssertActivityIsLegal()
// the BloatEntry.
static void *
DefaultAllocTable(void *pool, PRSize size)
DefaultAllocTable(void *pool, size_t size)
{
return PR_MALLOC(size);
}

View File

@ -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;

View File

@ -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

View File

@ -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,

View File

@ -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);
}

View File

@ -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)

View File

@ -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
};

View File

@ -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;

View File

@ -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);
}