b=477727; remove CoCreateGuid usage on WinCE; r+sr=stuart
--- a/xpcom/base/nsUUIDGenerator.cpp
+++ b/xpcom/base/nsUUIDGenerator.cpp
@@ -132,18 +132,33 @@ nsUUIDGenerator::GenerateUUID(nsID** ret
}
NS_IMETHODIMP
nsUUIDGenerator::GenerateUUIDInPlace(nsID* id)
{
// The various code in this method is probably not threadsafe, so lock
// across the whole method.
nsAutoLock lock(mLock);
-
-#if defined(XP_WIN)
+
+#if defined(WINCE)
+ // WINCE only has CoCreateGuid if DCOM support is compiled into the BSP;
+ // there's usually very little reason for DCOM to be present!
+
+ if (!CeGenRandom(sizeof(nsID), (BYTE*) id))
+ return NS_ERROR_FAILURE;
+
+ /* Put in the version */
+ id->m2 &= 0x0fff;
+ id->m2 |= 0x4000;
+
+ /* Put in the variant */
+ id->m3[0] &= 0x3f;
+ id->m3[0] |= 0x80;
+
+#elif defined(XP_WIN)
HRESULT hr = CoCreateGuid((GUID*)id);
if (NS_FAILED(hr))
return NS_ERROR_FAILURE;
#elif defined(XP_MACOSX)
CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);
if (!uuid)
return NS_ERROR_FAILURE;
--- a/xpcom/base/nsUUIDGenerator.h
+++ b/xpcom/base/nsUUIDGenerator.h
@@ -53,17 +53,18 @@ public:
nsresult Init();
private:
~nsUUIDGenerator();
protected:
PRLock* mLock;
-#if !defined(XP_WIN) && !defined(XP_MACOSX)
+#if defined(WINCE)
+#elif !defined(XP_WIN) && !defined(XP_MACOSX)
char mState[128];
char *mSavedState;
PRUint8 mRBytes;
#endif
};
#define NS_UUID_GENERATOR_CONTRACTID "@mozilla.org/uuid-generator;1"
#define NS_UUID_GENERATOR_CLASSNAME "UUID Generator"