diff options
Diffstat (limited to 'WebCore/platform/UUID.cpp')
-rw-r--r-- | WebCore/platform/UUID.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/WebCore/platform/UUID.cpp b/WebCore/platform/UUID.cpp index d8ac749..852e3ae 100644 --- a/WebCore/platform/UUID.cpp +++ b/WebCore/platform/UUID.cpp @@ -33,6 +33,10 @@ #include "NotImplemented.h" +#if PLATFORM(QT) +#include <QUuid> +#endif + #if OS(WINDOWS) #include <objbase.h> #ifndef ARRAYSIZE @@ -51,7 +55,12 @@ static const int uuidVersionIdentifierIndex = 14; String createCanonicalUUIDString() { -#if OS(WINDOWS) +#if PLATFORM(QT) + QUuid uuid = QUuid::createUuid(); + String canonicalUuidStr = uuid.toString().mid(1, 36).toLower(); // remove opening and closing bracket and make it lower. + ASSERT(canonicalUuidStr[uuidVersionIdentifierIndex] == uuidVersionRequired); + return canonicalUuidStr; +#elif OS(WINDOWS) GUID uuid = { 0 }; HRESULT hr = CoCreateGuid(&uuid); if (FAILED(hr)) @@ -76,7 +85,8 @@ String createCanonicalUUIDString() if (!fptr) return String(); char uuidStr[37] = {0}; - fgets(uuidStr, sizeof(uuidStr) - 1, fptr); + if (!fgets(uuidStr, sizeof(uuidStr) - 1, fptr)) + return String(); fclose(fptr); String canonicalUuidStr = String(uuidStr).lower(); // make it lower. ASSERT(canonicalUuidStr[uuidVersionIdentifierIndex] == uuidVersionRequired); |