Skip to content

Commit 71119f4

Browse files
committed
Consolidate guid definitions
1 parent e8a1e2d commit 71119f4

29 files changed

+150
-216
lines changed

src/coreclr/debug/di/hash.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ void CordbHashTableEnum::BuildOrThrow(
201201
CordbBase * pOwnerObj,
202202
NeuterList * pOwnerList,
203203
CordbHashTable *pTable,
204-
const _GUID &id,
204+
const GUID &id,
205205
RSInitHolder<CordbHashTableEnum> * pHolder)
206206
{
207207
CordbHashTableEnum * pEnum = new CordbHashTableEnum(pOwnerObj, pOwnerList, pTable, id);

src/coreclr/debug/di/rspriv.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1837,14 +1837,14 @@ public ICorDebugAssemblyEnum
18371837
CordbBase * pOwnerObj,
18381838
NeuterList * pOwnerList,
18391839
CordbHashTable *table,
1840-
const _GUID &id);
1840+
const GUID &id);
18411841

18421842
public:
18431843
static void BuildOrThrow(
18441844
CordbBase * pOwnerObj,
18451845
NeuterList * pOwnerList,
18461846
CordbHashTable *table,
1847-
const _GUID &id,
1847+
const GUID &id,
18481848
RSInitHolder<CordbHashTableEnum> * pHolder);
18491849

18501850
CordbHashTableEnum(CordbHashTableEnum *cloneSrc);

src/coreclr/ildasm/dasm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5157,10 +5157,10 @@ void DumpCodeManager(IMAGE_COR20_HEADER *CORHeader, void* GUICookie)
51575157
ULONG iCount = VAL32(CORHeader->CodeManagerTable.Size) / sizeof(GUID);
51585158
for (ULONG i=0; i<iCount; i++)
51595159
{
5160-
CHAR rcguid[GUID_STR_BUFFER_LEN];
5160+
CHAR rcguid[MINIPAL_GUID_BUFFER_LEN];
51615161
GUID Guid = *pcm;
51625162
SwapGuid(&Guid);
5163-
GuidToLPSTR(Guid, rcguid);
5163+
minipal_guid_as_string(Guid, rcguid, MINIPAL_GUID_BUFFER_LEN);
51645164
sprintf_s(szString,SZSTRING_SIZE,"// [0x%08x] %s", i, rcguid);
51655165
printLine(GUICookie,szStr);
51665166
pcm++;

src/coreclr/ildasm/dis.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ BOOL SourceLinesHelper(void *GUICookie, LineCodeDescr* pLCD, _Out_writes_(nSize)
819819

820820
PAL_TRY(Param *, pParam, &param) {
821821
GUID guidLang={0},guidLangVendor={0},guidDoc={0};
822-
CHAR zLang[GUID_STR_BUFFER_LEN],zVendor[GUID_STR_BUFFER_LEN],zDoc[GUID_STR_BUFFER_LEN];
822+
CHAR zLang[MINIPAL_GUID_BUFFER_LEN],zVendor[MINIPAL_GUID_BUFFER_LEN],zDoc[MINIPAL_GUID_BUFFER_LEN];
823823
ULONG32 k;
824824
if(pParam->pLCD->FileToken != ulWasFileToken)
825825
{
@@ -830,9 +830,9 @@ BOOL SourceLinesHelper(void *GUICookie, LineCodeDescr* pLCD, _Out_writes_(nSize)
830830
||memcmp(&guidLangVendor,&guidWasLangVendor,sizeof(GUID))
831831
||memcmp(&guidDoc,&guidWasDoc,sizeof(GUID)))
832832
{
833-
GuidToLPSTR(guidLang,zLang);
834-
GuidToLPSTR(guidLangVendor,zVendor);
835-
GuidToLPSTR(guidDoc,zDoc);
833+
minipal_guid_as_string(guidLang, zLang, MINIPAL_GUID_BUFFER_LEN);
834+
minipal_guid_as_string(guidLangVendor, zVendor, MINIPAL_GUID_BUFFER_LEN);
835+
minipal_guid_as_string(guidDoc, zDoc, MINIPAL_GUID_BUFFER_LEN);
836836
sprintf_s(szString,SZSTRING_SIZE,"%s%s '%s', '%s', '%s'", g_szAsmCodeIndent,KEYWORD(".language"),
837837
zLang,zVendor,zDoc);
838838
printLine(pParam->GUICookie,szString);

src/coreclr/ildasm/dman.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void DumpScope(void* GUICookie)
120120
mdModule mdm;
121121
GUID mvid;
122122
WCHAR scopeName[1024];
123-
CHAR guidString[GUID_STR_BUFFER_LEN];
123+
CHAR guidString[MINIPAL_GUID_BUFFER_LEN];
124124
memset(scopeName,0,1024*sizeof(WCHAR));
125125
if(SUCCEEDED(g_pPubImport->GetScopeProps( scopeName, 1024, NULL, &mvid))&& scopeName[0])
126126
{
@@ -133,7 +133,7 @@ void DumpScope(void* GUICookie)
133133
VDELETE(sz);
134134
}
135135
printLine(GUICookie,szString);
136-
GuidToLPSTR(mvid, guidString);
136+
minipal_guid_as_string(mvid, guidString, MINIPAL_GUID_BUFFER_LEN);
137137
sprintf_s(szString,SZSTRING_SIZE,COMMENT("%s// MVID: %s"),g_szAsmCodeIndent,guidString);
138138

139139
printLine(GUICookie,szString);

src/coreclr/inc/corjit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class ICorJitCompiler
140140
// return the version identifier that the EE expects), then the EE fails to load the JIT.
141141
//
142142
virtual void getVersionIdentifier(
143-
GUID* versionIdentifier /* OUT */
143+
minipal_guid_t* versionIdentifier /* OUT */
144144
) = 0;
145145

146146
// Some JIT's may support multiple OSs. This api provides a means to specify to the JIT what OS it should

src/coreclr/inc/jiteeversionguid.h

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,9 @@
3232
//////////////////////////////////////////////////////////////////////////////////////////////////////////
3333
//
3434

35-
#ifndef GUID_DEFINED
36-
typedef struct _GUID {
37-
uint32_t Data1; // NOTE: diff from Win32, for LP64
38-
uint16_t Data2;
39-
uint16_t Data3;
40-
uint8_t Data4[ 8 ];
41-
} GUID;
42-
typedef const GUID *LPCGUID;
43-
#define GUID_DEFINED
44-
#endif // !GUID_DEFINED
35+
#include <minipal/guid.h>
36+
37+
typedef minipal_guid_t GUID;
4538

4639
constexpr GUID JITEEVersionIdentifier = { /* 4463d6ac-dfcb-4ab0-a941-c53b56089b7c */
4740
0x4463d6ac,

src/coreclr/inc/utilcode.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3031,23 +3031,6 @@ class ConfigMethodSet
30313031
BYTE m_inited;
30323032
};
30333033

3034-
// 38 characters + 1 null terminating.
3035-
#define GUID_STR_BUFFER_LEN (ARRAY_SIZE("{12345678-1234-1234-1234-123456789abc}"))
3036-
3037-
//*****************************************************************************
3038-
// Convert a GUID into a pointer to a string
3039-
//*****************************************************************************
3040-
int GuidToLPSTR(
3041-
REFGUID guid, // [IN] The GUID to convert.
3042-
LPSTR szGuid, // [OUT] String into which the GUID is stored
3043-
DWORD cchGuid); // [IN] Size in chars of szGuid
3044-
3045-
template<DWORD N>
3046-
int GuidToLPSTR(REFGUID guid, CHAR (&s)[N])
3047-
{
3048-
return GuidToLPSTR(guid, s, N);
3049-
}
3050-
30513034
//*****************************************************************************
30523035
// Convert a pointer to a string into a GUID.
30533036
//*****************************************************************************

src/coreclr/pal/inc/pal_mstypes.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
#define __PAL_MSTYPES_H__
1010

1111
#include <stdint.h>
12+
#include <minipal/guid.h>
13+
14+
typedef minipal_guid_t GUID;
1215

1316
#ifdef __cplusplus
1417
extern "C" {
@@ -316,17 +319,6 @@ typedef union _LARGE_INTEGER {
316319
LONGLONG QuadPart;
317320
} LARGE_INTEGER, *PLARGE_INTEGER;
318321

319-
#ifndef GUID_DEFINED
320-
typedef struct _GUID {
321-
ULONG Data1; // NOTE: diff from Win32, for LP64
322-
USHORT Data2;
323-
USHORT Data3;
324-
UCHAR Data4[ 8 ];
325-
} GUID;
326-
typedef const GUID *LPCGUID;
327-
#define GUID_DEFINED
328-
#endif // !GUID_DEFINED
329-
330322
typedef struct _FILETIME {
331323
DWORD dwLowDateTime;
332324
DWORD dwHighDateTime;

src/coreclr/pal/inc/rt/palrt.h

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,12 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
//
44

5-
//
6-
// ===========================================================================
7-
// File: palrt.h
8-
//
9-
// ===========================================================================
10-
115
/*++
12-
13-
146
Abstract:
157
168
PAL runtime functions. These are functions which are ordinarily
179
implemented as part of the Win32 API set, but when compiling CoreCLR for
1810
Unix-like systems, are implemented as a runtime library on top of the PAL.
19-
20-
Author:
21-
22-
23-
24-
Revision History:
25-
2611
--*/
2712

2813
#ifndef __PALRT_H__
@@ -213,19 +198,7 @@ EXTERN_C const GUID GUID_NULL;
213198
typedef GUID *LPGUID;
214199
typedef const GUID FAR *LPCGUID;
215200

216-
#ifdef __cplusplus
217-
extern "C++" {
218-
#if !defined _SYS_GUID_OPERATOR_EQ_ && !defined _NO_SYS_GUID_OPERATOR_EQ_
219-
#define _SYS_GUID_OPERATOR_EQ_
220-
inline int IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
221-
{ return !memcmp(&rguid1, &rguid2, sizeof(GUID)); }
222-
inline int operator==(REFGUID guidOne, REFGUID guidOther)
223-
{ return IsEqualGUID(guidOne,guidOther); }
224-
inline int operator!=(REFGUID guidOne, REFGUID guidOther)
225-
{ return !IsEqualGUID(guidOne,guidOther); }
226-
#endif
227-
};
228-
#endif // __cplusplus
201+
#define IsEqualGUID(guid1, guid2) guid1 == guid2
229202

230203
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
231204
EXTERN_C const GUID FAR name

0 commit comments

Comments
 (0)