Make nsUUIDGenerator use the low bits, not the high ones, so we actually get
random numbers on 64-bit systems. Bug 335549, r=vlad, sr=roc git-svn-id: svn://10.0.0.236/trunk@199951 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -152,7 +152,9 @@ nsUUIDGenerator::GenerateUUIDInPlace(nsID* id)
|
||||
long rval = random();
|
||||
|
||||
PRUint8 *src = (PRUint8*)&rval;
|
||||
#ifdef IS_LITTLE_ENDIAN
|
||||
// We want to grab the mRBytes least significant bytes of rval, since
|
||||
// mRBytes less than sizeof(rval) means the high bytes are 0.
|
||||
#ifdef IS_BIG_ENDIAN
|
||||
src += sizeof(rval) - mRBytes;
|
||||
#endif
|
||||
PRUint8 *dst = ((PRUint8*) id) + (sizeof(nsID) - bytesLeft);
|
||||
|
||||
Reference in New Issue
Block a user