summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin/quuid.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-07-08 15:31:55 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-07-08 15:31:55 (GMT)
commitd38f4cd66ae6e86923ebc46f6857ee11e11163ba (patch)
tree18fb12f0e2306900819b8e5e43aa4273c931142f /src/corelib/plugin/quuid.cpp
parent76da3ecd74ad55fe923eb59f10c1f371611642f4 (diff)
parentc48eb6d5d0a299449330dea8a6a59514942c8781 (diff)
downloadQt-d38f4cd66ae6e86923ebc46f6857ee11e11163ba.zip
Qt-d38f4cd66ae6e86923ebc46f6857ee11e11163ba.tar.gz
Qt-d38f4cd66ae6e86923ebc46f6857ee11e11163ba.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Initalize the nativeDialogInUse variable Compile QUUid::createUuid() should not generate identical sequences on UNIX
Diffstat (limited to 'src/corelib/plugin/quuid.cpp')
-rw-r--r--src/corelib/plugin/quuid.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp
index 8541c7d..f48cc2e 100644
--- a/src/corelib/plugin/quuid.cpp
+++ b/src/corelib/plugin/quuid.cpp
@@ -577,23 +577,20 @@ QUuid QUuid::createUuid()
QT_BEGIN_INCLUDE_NAMESPACE
#include "qdatetime.h"
-#include "stdlib.h" // For srand/rand
+#include <stdlib.h> // for RAND_MAX
QT_END_INCLUDE_NAMESPACE
-extern void qsrand(); // in qglobal.cpp
-
QUuid QUuid::createUuid()
{
static const int intbits = sizeof(int)*8;
static int randbits = 0;
if (!randbits) {
+ int r = 0;
int max = RAND_MAX;
- do { ++randbits; } while ((max=max>>1));
+ do { ++r; } while ((max=max>>1));
+ randbits = r;
}
- // reseed, but only if not already seeded
- qsrand();
-
QUuid result;
uint *data = &(result.data1);
int chunks = 16 / sizeof(uint);
@@ -601,7 +598,7 @@ QUuid QUuid::createUuid()
uint randNumber = 0;
for (int filled = 0; filled < intbits; filled += randbits)
randNumber |= qrand()<<filled;
- *(data+chunks) = randNumber;
+ *(data+chunks) = randNumber;
}
result.data4[0] = (result.data4[0] & 0x3F) | 0x80; // UV_DCE