зеркало из https://github.com/mozilla/gecko-dev.git
Use NS_PTR_TO_INT32 macros to do 64-bit safe pointer conversions.
Bug #20860 r=Roland.Mainz@informatik.med.uni-giessen.de sr=brendan@mozilla.org
This commit is contained in:
Родитель
aee71e6700
Коммит
80edcd8228
|
@ -20,6 +20,7 @@
|
|||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsLogging.h"
|
||||
|
||||
#ifdef NS_ENABLE_LOGGING
|
||||
|
@ -92,7 +93,7 @@ nsLoggingService::Release(void)
|
|||
static void* PR_CALLBACK
|
||||
levelClone(nsHashKey *aKey, void *aData, void* closure)
|
||||
{
|
||||
PRUint32 level = (PRUint32)aData;
|
||||
PRUint32 level = NS_PTR_TO_INT32(aData);
|
||||
return (void*)level;
|
||||
}
|
||||
|
||||
|
@ -421,7 +422,7 @@ nsLog::Init(const char* name, PRUint32 controlFlags, nsILogEventSink* sink)
|
|||
mSink = sink;
|
||||
|
||||
nsCStringKey key(name);
|
||||
PRUint32 level = (PRUint32)gSettings->Get(&key);
|
||||
PRUint32 level = NS_PTR_TO_INT32(gSettings->Get(&key));
|
||||
if (level != 0) {
|
||||
mControlFlags |= nsILog::DEFAULT_ENABLED;
|
||||
}
|
||||
|
@ -690,7 +691,7 @@ nsFileLogEventSink::Print(nsILog* log, const char* msg)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (flags & nsILog::PRINT_THREAD_ID) {
|
||||
::fprintf(mOutput, "%8x ", (PRInt32)PR_CurrentThread());
|
||||
::fprintf(mOutput, "%8p ", PR_CurrentThread());
|
||||
mBeginningOfLine = PR_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
* L. David Baron <dbaron@fas.harvard.edu>
|
||||
*/
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "prprf.h"
|
||||
|
@ -571,7 +572,7 @@ static PRInt32 GetSerialNumber(void* aPtr, PRBool aCreate)
|
|||
// need to disguise this pointer, so the table won't keep the object alive.
|
||||
aPtr = (void*) ~PLHashNumber(aPtr);
|
||||
#endif
|
||||
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(aPtr), aPtr);
|
||||
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr);
|
||||
if (hep && *hep) {
|
||||
return PRInt32((NS_REINTERPRET_CAST(serialNumberRecord*,(*hep)->value))->serialNumber);
|
||||
}
|
||||
|
@ -580,7 +581,7 @@ static PRInt32 GetSerialNumber(void* aPtr, PRBool aCreate)
|
|||
record->serialNumber = ++gNextSerialNumber;
|
||||
record->refCount = 0;
|
||||
record->COMPtrCount = 0;
|
||||
PL_HashTableRawAdd(gSerialNumbers, hep, PLHashNumber(aPtr), aPtr, NS_REINTERPRET_CAST(void*,record));
|
||||
PL_HashTableRawAdd(gSerialNumbers, hep, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr, NS_REINTERPRET_CAST(void*,record));
|
||||
return gNextSerialNumber;
|
||||
}
|
||||
else {
|
||||
|
@ -594,7 +595,7 @@ static PRInt32* GetRefCount(void* aPtr)
|
|||
// need to disguise this pointer, so the table won't keep the object alive.
|
||||
aPtr = (void*) ~PLHashNumber(aPtr);
|
||||
#endif
|
||||
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(aPtr), aPtr);
|
||||
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr);
|
||||
if (hep && *hep) {
|
||||
return &((NS_REINTERPRET_CAST(serialNumberRecord*,(*hep)->value))->refCount);
|
||||
} else {
|
||||
|
@ -608,7 +609,7 @@ static PRInt32* GetCOMPtrCount(void* aPtr)
|
|||
// need to disguise this pointer, so the table won't keep the object alive.
|
||||
aPtr = (void*) ~PLHashNumber(aPtr);
|
||||
#endif
|
||||
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(aPtr), aPtr);
|
||||
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr);
|
||||
if (hep && *hep) {
|
||||
return &((NS_REINTERPRET_CAST(serialNumberRecord*,(*hep)->value))->COMPtrCount);
|
||||
} else {
|
||||
|
@ -667,7 +668,7 @@ static PRBool InitLog(const char* envVar, const char* msg, FILE* *result)
|
|||
|
||||
static PLHashNumber PR_CALLBACK HashNumber(const void* aKey)
|
||||
{
|
||||
return PLHashNumber(aKey);
|
||||
return PLHashNumber(NS_PTR_TO_INT32(aKey));
|
||||
}
|
||||
|
||||
static void InitTraceLog(void)
|
||||
|
@ -1163,7 +1164,7 @@ write_address_file(void * pc, FILE* aStream)
|
|||
static mutex_t lock;
|
||||
struct bucket * ptr;
|
||||
|
||||
unsigned int val = (unsigned int)pc;
|
||||
unsigned int val = NS_PTR_TO_INT32(pc);
|
||||
|
||||
ptr = table + ((val >> 2)&2047);
|
||||
|
||||
|
@ -1206,10 +1207,10 @@ write_address_file(void * pc, FILE* aStream)
|
|||
#endif /*__GNUC__*/
|
||||
|
||||
fprintf(aStream, "%u %s:%s+0x%x\n",
|
||||
ptr->next->index,
|
||||
lib,
|
||||
func,
|
||||
(unsigned int)pc - (unsigned int)info.dli_saddr);
|
||||
ptr->next->index,
|
||||
lib,
|
||||
func,
|
||||
(char *)pc - (char*)info.dli_saddr);
|
||||
|
||||
return (ptr->next->index);
|
||||
}
|
||||
|
@ -1617,8 +1618,8 @@ nsTraceRefcnt::LogAddRef(void* aPtr,
|
|||
|
||||
PRBool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
|
||||
if (aRefCnt == 1 && gAllocLog && loggingThisType && loggingThisObject) {
|
||||
fprintf(gAllocLog, "\n<%s> 0x%08X %d Create\n",
|
||||
aClazz, PRInt32(aPtr), serialno);
|
||||
fprintf(gAllocLog, "\n<%s> 0x%08p %d Create\n",
|
||||
aClazz, aPtr, serialno);
|
||||
WalkTheStack(gAllocLog);
|
||||
}
|
||||
|
||||
|
@ -1631,7 +1632,7 @@ nsTraceRefcnt::LogAddRef(void* aPtr,
|
|||
else {
|
||||
// Can't use PR_LOG(), b/c it truncates the line
|
||||
fprintf(gRefcntsLog,
|
||||
"\n<%s> 0x%08X %d AddRef %d\n", aClazz, PRInt32(aPtr), serialno, aRefCnt);
|
||||
"\n<%s> 0x%08p %d AddRef %d\n", aClazz, aPtr, serialno, aRefCnt);
|
||||
WalkTheStack(gRefcntsLog);
|
||||
fflush(gRefcntsLog);
|
||||
}
|
||||
|
@ -1684,7 +1685,7 @@ nsTraceRefcnt::LogRelease(void* aPtr,
|
|||
else {
|
||||
// Can't use PR_LOG(), b/c it truncates the line
|
||||
fprintf(gRefcntsLog,
|
||||
"\n<%s> 0x%08X %d Release %d\n", aClazz, PRInt32(aPtr), serialno, aRefCnt);
|
||||
"\n<%s> 0x%08p %d Release %d\n", aClazz, aPtr, serialno, aRefCnt);
|
||||
WalkTheStack(gRefcntsLog);
|
||||
fflush(gRefcntsLog);
|
||||
}
|
||||
|
@ -1697,8 +1698,8 @@ nsTraceRefcnt::LogRelease(void* aPtr,
|
|||
// using LogDeleteXPCOM instead to get file and line numbers.)
|
||||
if (aRefCnt == 0 && gAllocLog && loggingThisType && loggingThisObject) {
|
||||
fprintf(gAllocLog,
|
||||
"\n<%s> 0x%08X %d Destroy\n",
|
||||
aClazz, PRInt32(aPtr), serialno);
|
||||
"\n<%s> 0x%08p %d Destroy\n",
|
||||
aClazz, aPtr, serialno);
|
||||
WalkTheStack(gAllocLog);
|
||||
}
|
||||
|
||||
|
@ -1844,8 +1845,8 @@ nsTraceRefcnt::LogCtor(void* aPtr,
|
|||
// using LogNewXPCOM instead to get file and line numbers.)
|
||||
PRBool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
|
||||
if (gAllocLog && loggingThisType && loggingThisObject) {
|
||||
fprintf(gAllocLog, "\n<%s> 0x%08X %d Ctor (%d)\n",
|
||||
aType, PRInt32(aPtr), serialno, aInstanceSize);
|
||||
fprintf(gAllocLog, "\n<%s> 0x%08p %d Ctor (%d)\n",
|
||||
aType, aPtr, serialno, aInstanceSize);
|
||||
WalkTheStack(gAllocLog);
|
||||
}
|
||||
#endif
|
||||
|
@ -1887,8 +1888,8 @@ nsTraceRefcnt::LogDtor(void* aPtr, const char* aType,
|
|||
// (If we're on a losing architecture, don't do this because we'll be
|
||||
// using LogDeleteXPCOM instead to get file and line numbers.)
|
||||
if (gAllocLog && loggingThisType && loggingThisObject) {
|
||||
fprintf(gAllocLog, "\n<%s> 0x%08X %d Dtor (%d)\n",
|
||||
aType, PRInt32(aPtr), serialno, aInstanceSize);
|
||||
fprintf(gAllocLog, "\n<%s> 0x%08p %d Dtor (%d)\n",
|
||||
aType, aPtr, serialno, aInstanceSize);
|
||||
WalkTheStack(gAllocLog);
|
||||
}
|
||||
#endif
|
||||
|
@ -1930,8 +1931,8 @@ nsTraceRefcnt::LogAddCOMPtr(void* aCOMPtr,
|
|||
PRBool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
|
||||
|
||||
if (gCOMPtrLog && loggingThisObject) {
|
||||
fprintf(gCOMPtrLog, "\n<?> 0x%08X %d nsCOMPtrAddRef %d 0x%08X\n",
|
||||
PRInt32(object), serialno, count?(*count):-1, PRInt32(aCOMPtr));
|
||||
fprintf(gCOMPtrLog, "\n<?> 0x%08p %d nsCOMPtrAddRef %d 0x%08p\n",
|
||||
object, serialno, count?(*count):-1, aCOMPtr);
|
||||
WalkTheStack(gCOMPtrLog);
|
||||
}
|
||||
#endif
|
||||
|
@ -1973,8 +1974,8 @@ nsTraceRefcnt::LogReleaseCOMPtr(void* aCOMPtr,
|
|||
PRBool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
|
||||
|
||||
if (gCOMPtrLog && loggingThisObject) {
|
||||
fprintf(gCOMPtrLog, "\n<?> 0x%08X %d nsCOMPtrRelease %d 0x%08X\n",
|
||||
PRInt32(object), serialno, count?(*count):-1, PRInt32(aCOMPtr));
|
||||
fprintf(gCOMPtrLog, "\n<?> 0x%08p %d nsCOMPtrRelease %d 0x%08p\n",
|
||||
object, serialno, count?(*count):-1, aCOMPtr);
|
||||
WalkTheStack(gCOMPtrLog);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
* L. David Baron <dbaron@fas.harvard.edu>
|
||||
*/
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "prprf.h"
|
||||
|
@ -571,7 +572,7 @@ static PRInt32 GetSerialNumber(void* aPtr, PRBool aCreate)
|
|||
// need to disguise this pointer, so the table won't keep the object alive.
|
||||
aPtr = (void*) ~PLHashNumber(aPtr);
|
||||
#endif
|
||||
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(aPtr), aPtr);
|
||||
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr);
|
||||
if (hep && *hep) {
|
||||
return PRInt32((NS_REINTERPRET_CAST(serialNumberRecord*,(*hep)->value))->serialNumber);
|
||||
}
|
||||
|
@ -580,7 +581,7 @@ static PRInt32 GetSerialNumber(void* aPtr, PRBool aCreate)
|
|||
record->serialNumber = ++gNextSerialNumber;
|
||||
record->refCount = 0;
|
||||
record->COMPtrCount = 0;
|
||||
PL_HashTableRawAdd(gSerialNumbers, hep, PLHashNumber(aPtr), aPtr, NS_REINTERPRET_CAST(void*,record));
|
||||
PL_HashTableRawAdd(gSerialNumbers, hep, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr, NS_REINTERPRET_CAST(void*,record));
|
||||
return gNextSerialNumber;
|
||||
}
|
||||
else {
|
||||
|
@ -594,7 +595,7 @@ static PRInt32* GetRefCount(void* aPtr)
|
|||
// need to disguise this pointer, so the table won't keep the object alive.
|
||||
aPtr = (void*) ~PLHashNumber(aPtr);
|
||||
#endif
|
||||
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(aPtr), aPtr);
|
||||
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr);
|
||||
if (hep && *hep) {
|
||||
return &((NS_REINTERPRET_CAST(serialNumberRecord*,(*hep)->value))->refCount);
|
||||
} else {
|
||||
|
@ -608,7 +609,7 @@ static PRInt32* GetCOMPtrCount(void* aPtr)
|
|||
// need to disguise this pointer, so the table won't keep the object alive.
|
||||
aPtr = (void*) ~PLHashNumber(aPtr);
|
||||
#endif
|
||||
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(aPtr), aPtr);
|
||||
PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr);
|
||||
if (hep && *hep) {
|
||||
return &((NS_REINTERPRET_CAST(serialNumberRecord*,(*hep)->value))->COMPtrCount);
|
||||
} else {
|
||||
|
@ -667,7 +668,7 @@ static PRBool InitLog(const char* envVar, const char* msg, FILE* *result)
|
|||
|
||||
static PLHashNumber PR_CALLBACK HashNumber(const void* aKey)
|
||||
{
|
||||
return PLHashNumber(aKey);
|
||||
return PLHashNumber(NS_PTR_TO_INT32(aKey));
|
||||
}
|
||||
|
||||
static void InitTraceLog(void)
|
||||
|
@ -1163,7 +1164,7 @@ write_address_file(void * pc, FILE* aStream)
|
|||
static mutex_t lock;
|
||||
struct bucket * ptr;
|
||||
|
||||
unsigned int val = (unsigned int)pc;
|
||||
unsigned int val = NS_PTR_TO_INT32(pc);
|
||||
|
||||
ptr = table + ((val >> 2)&2047);
|
||||
|
||||
|
@ -1206,10 +1207,10 @@ write_address_file(void * pc, FILE* aStream)
|
|||
#endif /*__GNUC__*/
|
||||
|
||||
fprintf(aStream, "%u %s:%s+0x%x\n",
|
||||
ptr->next->index,
|
||||
lib,
|
||||
func,
|
||||
(unsigned int)pc - (unsigned int)info.dli_saddr);
|
||||
ptr->next->index,
|
||||
lib,
|
||||
func,
|
||||
(char *)pc - (char*)info.dli_saddr);
|
||||
|
||||
return (ptr->next->index);
|
||||
}
|
||||
|
@ -1617,8 +1618,8 @@ nsTraceRefcnt::LogAddRef(void* aPtr,
|
|||
|
||||
PRBool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
|
||||
if (aRefCnt == 1 && gAllocLog && loggingThisType && loggingThisObject) {
|
||||
fprintf(gAllocLog, "\n<%s> 0x%08X %d Create\n",
|
||||
aClazz, PRInt32(aPtr), serialno);
|
||||
fprintf(gAllocLog, "\n<%s> 0x%08p %d Create\n",
|
||||
aClazz, aPtr, serialno);
|
||||
WalkTheStack(gAllocLog);
|
||||
}
|
||||
|
||||
|
@ -1631,7 +1632,7 @@ nsTraceRefcnt::LogAddRef(void* aPtr,
|
|||
else {
|
||||
// Can't use PR_LOG(), b/c it truncates the line
|
||||
fprintf(gRefcntsLog,
|
||||
"\n<%s> 0x%08X %d AddRef %d\n", aClazz, PRInt32(aPtr), serialno, aRefCnt);
|
||||
"\n<%s> 0x%08p %d AddRef %d\n", aClazz, aPtr, serialno, aRefCnt);
|
||||
WalkTheStack(gRefcntsLog);
|
||||
fflush(gRefcntsLog);
|
||||
}
|
||||
|
@ -1684,7 +1685,7 @@ nsTraceRefcnt::LogRelease(void* aPtr,
|
|||
else {
|
||||
// Can't use PR_LOG(), b/c it truncates the line
|
||||
fprintf(gRefcntsLog,
|
||||
"\n<%s> 0x%08X %d Release %d\n", aClazz, PRInt32(aPtr), serialno, aRefCnt);
|
||||
"\n<%s> 0x%08p %d Release %d\n", aClazz, aPtr, serialno, aRefCnt);
|
||||
WalkTheStack(gRefcntsLog);
|
||||
fflush(gRefcntsLog);
|
||||
}
|
||||
|
@ -1697,8 +1698,8 @@ nsTraceRefcnt::LogRelease(void* aPtr,
|
|||
// using LogDeleteXPCOM instead to get file and line numbers.)
|
||||
if (aRefCnt == 0 && gAllocLog && loggingThisType && loggingThisObject) {
|
||||
fprintf(gAllocLog,
|
||||
"\n<%s> 0x%08X %d Destroy\n",
|
||||
aClazz, PRInt32(aPtr), serialno);
|
||||
"\n<%s> 0x%08p %d Destroy\n",
|
||||
aClazz, aPtr, serialno);
|
||||
WalkTheStack(gAllocLog);
|
||||
}
|
||||
|
||||
|
@ -1844,8 +1845,8 @@ nsTraceRefcnt::LogCtor(void* aPtr,
|
|||
// using LogNewXPCOM instead to get file and line numbers.)
|
||||
PRBool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
|
||||
if (gAllocLog && loggingThisType && loggingThisObject) {
|
||||
fprintf(gAllocLog, "\n<%s> 0x%08X %d Ctor (%d)\n",
|
||||
aType, PRInt32(aPtr), serialno, aInstanceSize);
|
||||
fprintf(gAllocLog, "\n<%s> 0x%08p %d Ctor (%d)\n",
|
||||
aType, aPtr, serialno, aInstanceSize);
|
||||
WalkTheStack(gAllocLog);
|
||||
}
|
||||
#endif
|
||||
|
@ -1887,8 +1888,8 @@ nsTraceRefcnt::LogDtor(void* aPtr, const char* aType,
|
|||
// (If we're on a losing architecture, don't do this because we'll be
|
||||
// using LogDeleteXPCOM instead to get file and line numbers.)
|
||||
if (gAllocLog && loggingThisType && loggingThisObject) {
|
||||
fprintf(gAllocLog, "\n<%s> 0x%08X %d Dtor (%d)\n",
|
||||
aType, PRInt32(aPtr), serialno, aInstanceSize);
|
||||
fprintf(gAllocLog, "\n<%s> 0x%08p %d Dtor (%d)\n",
|
||||
aType, aPtr, serialno, aInstanceSize);
|
||||
WalkTheStack(gAllocLog);
|
||||
}
|
||||
#endif
|
||||
|
@ -1930,8 +1931,8 @@ nsTraceRefcnt::LogAddCOMPtr(void* aCOMPtr,
|
|||
PRBool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
|
||||
|
||||
if (gCOMPtrLog && loggingThisObject) {
|
||||
fprintf(gCOMPtrLog, "\n<?> 0x%08X %d nsCOMPtrAddRef %d 0x%08X\n",
|
||||
PRInt32(object), serialno, count?(*count):-1, PRInt32(aCOMPtr));
|
||||
fprintf(gCOMPtrLog, "\n<?> 0x%08p %d nsCOMPtrAddRef %d 0x%08p\n",
|
||||
object, serialno, count?(*count):-1, aCOMPtr);
|
||||
WalkTheStack(gCOMPtrLog);
|
||||
}
|
||||
#endif
|
||||
|
@ -1973,8 +1974,8 @@ nsTraceRefcnt::LogReleaseCOMPtr(void* aCOMPtr,
|
|||
PRBool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
|
||||
|
||||
if (gCOMPtrLog && loggingThisObject) {
|
||||
fprintf(gCOMPtrLog, "\n<?> 0x%08X %d nsCOMPtrRelease %d 0x%08X\n",
|
||||
PRInt32(object), serialno, count?(*count):-1, PRInt32(aCOMPtr));
|
||||
fprintf(gCOMPtrLog, "\n<?> 0x%08p %d nsCOMPtrRelease %d 0x%08p\n",
|
||||
object, serialno, count?(*count):-1, aCOMPtr);
|
||||
WalkTheStack(gCOMPtrLog);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -211,7 +211,7 @@ class NS_COM nsISupportsKey : public nsHashKey {
|
|||
}
|
||||
|
||||
PRUint32 HashCode(void) const {
|
||||
return (PRUint32)mKey;
|
||||
return NS_PTR_TO_INT32(mKey);
|
||||
}
|
||||
|
||||
PRBool Equals(const nsHashKey *aKey) const {
|
||||
|
@ -243,7 +243,7 @@ class nsVoidKey : public nsHashKey {
|
|||
}
|
||||
|
||||
PRUint32 HashCode(void) const {
|
||||
return (PRUint32)mKey;
|
||||
return NS_PTR_TO_INT32(mKey);
|
||||
}
|
||||
|
||||
PRBool Equals(const nsHashKey *aKey) const {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#include "nscore.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "plhash.h"
|
||||
|
@ -95,7 +96,7 @@ SizeOfDataStats::Update(PRUint32 aSize)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#define POINTER_HASH_KEY(_atom) ((PLHashNumber) _atom)
|
||||
#define POINTER_HASH_KEY(_atom) (PLHashNumber) NS_PTR_TO_INT32(_atom)
|
||||
|
||||
static PLHashNumber
|
||||
PointerHashKey(nsIAtom* key)
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
/* Class to manage lookup of static names in a table. */
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStaticNameTable.h"
|
||||
|
||||
|
@ -92,7 +93,7 @@ LookupLowercasedKeyword(const nsCString& aLowercasedKeyword,
|
|||
{
|
||||
nsCStringKey key(aLowercasedKeyword);
|
||||
void* val = aTable->Get(&key);
|
||||
return val ? ((PRInt32)val) - 1 :
|
||||
return val ? NS_PTR_TO_INT32(val) - 1 :
|
||||
nsStaticCaseInsensitiveNameTable::NOT_FOUND;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
* Chris Waterson <waterson@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsStatistics.h"
|
||||
#include "nsISupportsUtils.h"
|
||||
#include "nsTraceRefcnt.h" // for NS_MeanAndStdDev
|
||||
|
@ -27,7 +28,7 @@
|
|||
inline PLHashNumber
|
||||
nsStatistics::HashPRInt32(const void* aKey)
|
||||
{
|
||||
return PLHashNumber(aKey);
|
||||
return PLHashNumber(NS_PTR_TO_INT32(aKey));
|
||||
}
|
||||
|
||||
nsStatistics::nsStatistics(const char* aTopic)
|
||||
|
@ -72,7 +73,7 @@ nsStatistics::Record(PRInt32 aValue)
|
|||
NS_REINTERPRET_CAST(const void*, aValue));
|
||||
|
||||
if (hep && *hep) {
|
||||
PRInt32 count = NS_REINTERPRET_CAST(PRUint32, (*hep)->value);
|
||||
PRInt32 count = NS_PTR_TO_INT32((*hep)->value);
|
||||
(*hep)->value = NS_REINTERPRET_CAST(void*, ++count);
|
||||
}
|
||||
else {
|
||||
|
@ -92,7 +93,7 @@ nsStatistics::Print(FILE* aFile)
|
|||
mTopic, mCount, mMinimum, mMaximum, mean, stddev);
|
||||
|
||||
for (PRInt32 i = mMinimum; i <= mMaximum; ++i) {
|
||||
PRUint32 count = NS_REINTERPRET_CAST(PRUint32, PL_HashTableLookup(mDistribution, NS_REINTERPRET_CAST(const void*, i)));
|
||||
PRUint32 count = NS_PTR_TO_INT32(PL_HashTableLookup(mDistribution, NS_INT32_TO_PTR(i)));
|
||||
if (! count)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <string.h>
|
||||
#include "prtypes.h"
|
||||
#include "nscore.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsMemory.h"
|
||||
|
||||
|
@ -406,7 +407,7 @@ objmap_ClearEntry(PLDHashTable *aTable, PLDHashEntryHdr *aHdr)
|
|||
|
||||
// Ignore tagged object ids stored as object pointer keys (the updater
|
||||
// code does this).
|
||||
if ((NSFastLoadOID(entry->mObject) & MFL_OBJECT_DEF_TAG) == 0)
|
||||
if ((NSFastLoadOID(NS_PTR_TO_INT32(entry->mObject)) & MFL_OBJECT_DEF_TAG) == 0)
|
||||
NS_IF_RELEASE(entry->mObject);
|
||||
PL_DHashClearEntryStub(aTable, aHdr);
|
||||
}
|
||||
|
@ -1507,7 +1508,7 @@ nsFastLoadFileWriter::ObjectMapEnumerate(PLDHashTable *aTable,
|
|||
#ifdef NS_DEBUG
|
||||
NS_ASSERTION(entry->mInfo.mStrongRefCnt, "no strong ref in serialization!");
|
||||
|
||||
if ((NSFastLoadOID(entry->mObject) & MFL_OBJECT_DEF_TAG) == 0) {
|
||||
if ((NSFastLoadOID(NS_PTR_TO_INT32(entry->mObject)) & MFL_OBJECT_DEF_TAG) == 0) {
|
||||
nsrefcnt rc = entry->mObject->AddRef();
|
||||
NS_ASSERTION(entry->mInfo.mStrongRefCnt <= rc - 2,
|
||||
"too many strong refs in serialization");
|
||||
|
@ -1517,7 +1518,7 @@ nsFastLoadFileWriter::ObjectMapEnumerate(PLDHashTable *aTable,
|
|||
|
||||
// Ignore tagged object ids stored as object pointer keys (the updater
|
||||
// code does this).
|
||||
if ((NSFastLoadOID(entry->mObject) & MFL_OBJECT_DEF_TAG) == 0)
|
||||
if ((NSFastLoadOID(NS_PTR_TO_INT32(entry->mObject)) & MFL_OBJECT_DEF_TAG) == 0)
|
||||
NS_RELEASE(entry->mObject);
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
|
@ -1735,7 +1736,7 @@ nsFastLoadFileWriter::WriteObjectCommon(nsISupports* aObject,
|
|||
nsrefcnt rc;
|
||||
nsresult rv;
|
||||
|
||||
NS_ASSERTION((NSFastLoadOID(aObject) & MFL_OBJECT_DEF_TAG) == 0,
|
||||
NS_ASSERTION((NSFastLoadOID(NS_PTR_TO_INT32(aObject)) & MFL_OBJECT_DEF_TAG) == 0,
|
||||
"odd nsISupports*, oh no!");
|
||||
|
||||
// Here be manual refcounting dragons!
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "prprf.h"
|
||||
#include "prmem.h"
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsProxyEvent.h"
|
||||
#include "nsIProxyObjectManager.h"
|
||||
#include "nsProxyEventPrivate.h"
|
||||
|
@ -48,8 +49,8 @@ public:
|
|||
}
|
||||
|
||||
PRUint32 HashCode(void) const {
|
||||
// XXX what about 64-bit machines?
|
||||
return (PRUint32)mRootObjectKey ^ (PRUint32)mDestQueueKey ^ mProxyType;
|
||||
return NS_PTR_TO_INT32(mRootObjectKey) ^
|
||||
NS_PTR_TO_INT32(mDestQueueKey) ^ mProxyType;
|
||||
}
|
||||
|
||||
PRBool Equals(const nsHashKey *aKey) const {
|
||||
|
|
|
@ -307,7 +307,7 @@ void TestCase_NestedLoop(void *arg)
|
|||
rv = eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, &eventQ);
|
||||
|
||||
printf("Thread (%d) Prior to calling proxyObject->Test.\n", threadNumber);
|
||||
rv = proxyObject->Test((PRInt32)eventQ, 0, &retval);
|
||||
rv = proxyObject->Test(NS_PTR_TO_INT32(eventQ), 0, &retval);
|
||||
printf("Thread (%d) proxyObject error: %d.\n", threadNumber, rv);
|
||||
|
||||
printf("Deleting Proxy Object (%d)\n", threadNumber );
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* Contributor(s):
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "nscore.h"
|
||||
#include "nsIUnicharInputStream.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
@ -42,7 +43,7 @@ int main(int argc, char** argv)
|
|||
|
||||
char* characterSetName = argv[2];
|
||||
nsString* cset = ConvertCharacterSetName(characterSetName);
|
||||
if (PRInt32(cset) < 0) {
|
||||
if (NS_PTR_TO_INT32(cset) < 0) {
|
||||
printf("illegal character set name: '%s'\n", characterSetName);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ OnMonitorRecycle(void* addr)
|
|||
PR_STATIC_CALLBACK(PLHashNumber)
|
||||
_hash_pointer(const void* key)
|
||||
{
|
||||
return PLHashNumber(key) >> 2;
|
||||
return PLHashNumber(NS_PTR_TO_INT32(key)) >> 2;
|
||||
}
|
||||
|
||||
// Must be single-threaded here, early in primordial thread.
|
||||
|
|
Загрузка…
Ссылка в новой задаче