summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-09-10 09:23:43 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-09-10 09:23:43 -0500
commit093bfb82967719e95a8753f81fce0bee1bb1a0a5 (patch)
tree7bfac495fa2511ccaa4904aef1d182d6eb4bf281 /src
parent6c72a84e6e27b69e5c5e99cc4996d5a7e03c932e (diff)
downloadqt3-093bfb82967719e95a8753f81fce0bee1bb1a0a5.tar.gz
qt3-093bfb82967719e95a8753f81fce0bee1bb1a0a5.zip
Use high quality uuid_generate on Linux instead of PRNG
Diffstat (limited to 'src')
-rw-r--r--src/tools/quuid.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/tools/quuid.cpp b/src/tools/quuid.cpp
index ee663d7..c745613 100644
--- a/src/tools/quuid.cpp
+++ b/src/tools/quuid.cpp
@@ -389,6 +389,18 @@ QUuid QUuid::createUuid()
return result;
}
#else // !Q_OS_WIN32
+#if defined(Q_OS_LINUX)
+#include <uuid/uuid.h>
+QUuid QUuid::createUuid()
+{
+ uuid_t raw_uuid;
+ char uuid_string[37];
+
+ uuid_generate(raw_uuid);
+ uuid_unparse(raw_uuid, uuid_string);
+ return QUuid(uuid_string);
+}
+#else // !Q_OS_LINUX
#include "qdatetime.h"
#include "stdlib.h" // For srand/rand
QUuid QUuid::createUuid()
@@ -417,5 +429,6 @@ QUuid QUuid::createUuid()
return result;
}
+#endif // !Q_OS_LINUX
#endif // !Q_OS_WIN32