blob: 7b2ea93237791e55e3236fa37f6b57600b09234a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// **********************************************************************
//
// Copyright (c) 2001
// ZeroC, Inc.
// Huntsville, AL, USA
//
// All Rights Reserved
//
// **********************************************************************
#include <IceUtil/UUID.h>
#ifdef _WIN32
# include <rpc.h>
#else
extern "C" // uuid/uuid.h seems to miss extern "C" declarations.
{
# include <uuid/uuid.h>
}
#endif
using namespace std;
string
IceUtil::generateUUID()
{
#ifdef _WIN32
UUID uuid;
UuidCreate(&uuid);
#if _MSC_VER == 1200
unsigned char* str;
#else
unsigned short* str; // Type has changed for some reason in VC++ 2002 (but doc still
#endif // says it's unsigned char *...)
UuidToString(&uuid, &str);
string result(reinterpret_cast<char*>(str));
RpcStringFree(&str);
return result;
#else
uuid_t uuid;
uuid_generate(uuid);
char str[37];
uuid_unparse(uuid, str);
return str;
#endif
}
|