projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix checking for GTK+ 3.0 in configure.
[wxWidgets.git]
/
src
/
msw
/
ole
/
uuid.cpp
diff --git
a/src/msw/ole/uuid.cpp
b/src/msw/ole/uuid.cpp
index 4df4faa7bae7c59e6cb3a0c617ef113171594d32..2153a25391f5135fba51b19a1fa2a807134afcd7 100644
(file)
--- a/
src/msw/ole/uuid.cpp
+++ b/
src/msw/ole/uuid.cpp
@@
-1,22
+1,18
@@
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
-// Name: ole/uuid.cpp
+// Name:
src/msw/
ole/uuid.cpp
// Purpose: implements Uuid class, see uuid.h for details
// Author: Vadim Zeitlin
// Purpose: implements Uuid class, see uuid.h for details
// Author: Vadim Zeitlin
-// Modified by:
+// Modified by:
// Created: 12.09.96
// RCS-ID: $Id$
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Created: 12.09.96
// RCS-ID: $Id$
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
-// Licence: wxWindows licen
s
e
+// Licence: wxWindows licen
c
e
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// Declarations
// ============================================================================
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// Declarations
// ============================================================================
-#ifdef __GNUG__
-#pragma implementation "uuid.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
@@
-24,14
+20,15
@@
#pragma hdrstop
#endif
#pragma hdrstop
#endif
-#i
nclude <wx/setup.h>
+#i
f wxUSE_OLE && (wxUSE_DRAG_AND_DROP || wxUSE_DATAOBJ)
-#if wxUSE_DRAG_AND_DROP
+#ifndef WX_PRECOMP
+ #include "wx/msw/wrapwin.h"
+#endif
-// standard headers
#include <rpc.h> // UUID related functions
#include <rpc.h> // UUID related functions
-#include
<wx/msw/ole/uuid.h>
+#include
"wx/msw/ole/uuid.h"
@@
-45,17
+42,21
@@
// copy ctor
Uuid::Uuid(const Uuid& uuid)
{
// copy ctor
Uuid::Uuid(const Uuid& uuid)
{
- // bitwise copy Ok for UUIDs
- m_uuid = uuid.m_uuid;
+ // bitwise copy Ok for UUIDs
+ m_uuid = uuid.m_uuid;
// force the string to be allocated by RPC
// (we free it later with RpcStringFree)
// force the string to be allocated by RPC
// (we free it later with RpcStringFree)
+#ifdef _UNICODE
+ UuidToString(&m_uuid, (unsigned short **)&m_pszUuid);
+#else
UuidToString(&m_uuid, &m_pszUuid);
UuidToString(&m_uuid, &m_pszUuid);
+#endif
// allocate new buffer
// allocate new buffer
- m_pszCForm = new
c
har[UUID_CSTRLEN];
+ m_pszCForm = new
wxC
har[UUID_CSTRLEN];
// and fill it
// and fill it
- memcpy(m_pszCForm, uuid.m_pszCForm, UUID_CSTRLEN);
+ memcpy(m_pszCForm, uuid.m_pszCForm, UUID_CSTRLEN
*sizeof(wxChar)
);
}
// assignment operator
}
// assignment operator
@@
-65,25
+66,40
@@
Uuid& Uuid::operator=(const Uuid& uuid)
// force the string to be allocated by RPC
// (we free it later with RpcStringFree)
// force the string to be allocated by RPC
// (we free it later with RpcStringFree)
+#ifdef _UNICODE
+ UuidToString(&m_uuid, (unsigned short **)&m_pszUuid);
+#else
UuidToString(&m_uuid, &m_pszUuid);
UuidToString(&m_uuid, &m_pszUuid);
+#endif
// allocate new buffer if not done yet
if ( !m_pszCForm )
// allocate new buffer if not done yet
if ( !m_pszCForm )
- m_pszCForm = new
c
har[UUID_CSTRLEN];
+ m_pszCForm = new
wxC
har[UUID_CSTRLEN];
// and fill it
// and fill it
- memcpy(m_pszCForm, uuid.m_pszCForm, UUID_CSTRLEN);
+ memcpy(m_pszCForm, uuid.m_pszCForm, UUID_CSTRLEN
*sizeof(wxChar)
);
return *this;
}
return *this;
}
+bool Uuid::operator==(const Uuid& uuid) const
+{
+ // IsEqualGUID() returns BOOL and not bool so use an explicit comparison to
+ // avoid MSVC warnings about int->bool conversion
+ return IsEqualGUID(m_uuid, uuid.m_uuid) != 0;
+}
+
// dtor
// dtor
-Uuid::~Uuid()
-{
+Uuid::~Uuid()
+{
// this string must be allocated by RPC!
// (otherwise you get a debug breakpoint deep inside RPC DLL)
// this string must be allocated by RPC!
// (otherwise you get a debug breakpoint deep inside RPC DLL)
- if ( m_pszUuid )
+ if ( m_pszUuid )
+#ifdef _UNICODE
+ RpcStringFree((unsigned short **)&m_pszUuid);
+#else
RpcStringFree(&m_pszUuid);
RpcStringFree(&m_pszUuid);
+#endif
// perhaps we should just use a static buffer and not bother
// with new and delete?
// perhaps we should just use a static buffer and not bother
// with new and delete?
@@
-97,7
+113,11
@@
void Uuid::Set(const UUID &uuid)
m_uuid = uuid;
// get string representation
m_uuid = uuid;
// get string representation
+#ifdef _UNICODE
+ UuidToString(&m_uuid, (unsigned short **)&m_pszUuid);
+#else
UuidToString(&m_uuid, &m_pszUuid);
UuidToString(&m_uuid, &m_pszUuid);
+#endif
// cache UUID in C format
UuidToCForm();
// cache UUID in C format
UuidToCForm();
@@
-110,25
+130,33
@@
void Uuid::Create()
// can't fail
UuidCreate(&uuid);
// can't fail
UuidCreate(&uuid);
-
+
Set(uuid);
}
// set the value
Set(uuid);
}
// set the value
-bool Uuid::Set(const
c
har *pc)
+bool Uuid::Set(const
wxC
har *pc)
{
// get UUID from string
{
// get UUID from string
- if ( UuidFromString((uchar *)pc, &m_uuid) != RPC_S_OK)
+#ifdef _UNICODE
+ if ( UuidFromString((unsigned short *)pc, &m_uuid) != RPC_S_OK)
+#else
+ if ( UuidFromString((wxUChar *)pc, &m_uuid) != RPC_S_OK)
+#endif
// failed: probably invalid string
// failed: probably invalid string
- return
FALSE
;
+ return
false
;
// transform it back to string to normalize it
// transform it back to string to normalize it
+#ifdef _UNICODE
+ UuidToString(&m_uuid, (unsigned short **)&m_pszUuid);
+#else
UuidToString(&m_uuid, &m_pszUuid);
UuidToString(&m_uuid, &m_pszUuid);
+#endif
// update m_pszCForm
UuidToCForm();
// update m_pszCForm
UuidToCForm();
- return
TRUE
;
+ return
true
;
}
// stores m_uuid in m_pszCForm in a format required by
}
// stores m_uuid in m_pszCForm in a format required by
@@
-139,13
+167,12
@@
bool Uuid::Set(const char *pc)
void Uuid::UuidToCForm()
{
if ( m_pszCForm == NULL )
void Uuid::UuidToCForm()
{
if ( m_pszCForm == NULL )
- m_pszCForm = new
c
har[UUID_CSTRLEN];
+ m_pszCForm = new
wxC
har[UUID_CSTRLEN];
- wsprintf(m_pszCForm, "0x%8.8X,0x%4.4X,0x%4.4X,0x%2.2X,0x2.2%X,"
- "0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X",
+ wsprintf(m_pszCForm, wxT("0x%8.8X,0x%4.4X,0x%4.4X,0x%2.2X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X,0x2.2%X"),
m_uuid.Data1, m_uuid.Data2, m_uuid.Data3,
m_uuid.Data1, m_uuid.Data2, m_uuid.Data3,
- m_uuid.Data4[
1], m_uuid.Data4[2], m_uuid.Data4[3], m_uuid.Data4[4
],
- m_uuid.Data4[
5], m_uuid.Data4[6], m_uuid.Data4[7], m_uuid.Data4[8
]);
+ m_uuid.Data4[
0], m_uuid.Data4[1], m_uuid.Data4[2], m_uuid.Data4[3
],
+ m_uuid.Data4[
4], m_uuid.Data4[5], m_uuid.Data4[6], m_uuid.Data4[7
]);
}
#endif
}
#endif