Skip to content

Commit 5e4834e

Browse files
authored
Consolidate guid definitions (#112826)
* Consolidate guid definitions * Replace minipal_guid_t with GUID
1 parent fa3beb9 commit 5e4834e

File tree

31 files changed

+140
-217
lines changed

31 files changed

+140
-217
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/debug/inc/dbgtransportsession.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ class DbgTransportSession
521521
// Struct defining the format of the data block sent with a SessionRequest.
522522
struct SessionRequestData
523523
{
524-
minipal_guid_t m_sSessionID; // Unique session ID. Treated as byte blob so no endian-ness
524+
GUID m_sSessionID; // Unique session ID. Treated as byte blob so no endian-ness
525525
};
526526

527527
// Struct used to track a message that is being (or will soon be) sent but has not yet been acknowledged.
@@ -676,7 +676,7 @@ class DbgTransportSession
676676
// Session ID randomly allocated by the right side and sent over in the SessionRequest message. This
677677
// serves to disambiguate a re-send of the SessionRequest due to a network error versus a SessionRequest
678678
// from a different debugger.
679-
minipal_guid_t m_sSessionID;
679+
GUID m_sSessionID;
680680

681681
// Lock used to synchronize sending messages and updating the session state. This ensures message bytes
682682
// don't become interleaved on the transport connection, the send queue is updated consistently across

src/coreclr/ilasm/portable_pdb.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ HRESULT PortablePdbWriter::Init(IMetaDataDispenserEx2* mdDispenser)
9393
time_t now;
9494
time(&now);
9595
m_pdbStream.id.pdbTimeStamp = (ULONG)now;
96-
if (!minipal_guid_v4_create(reinterpret_cast<minipal_guid_t*>(&m_pdbStream.id.pdbGuid)))
96+
if (!minipal_guid_v4_create(&m_pdbStream.id.pdbGuid))
9797
{
9898
hr = E_FAIL;
9999
goto exit;

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/jiteeversionguid.h

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,10 @@
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+
#ifndef JIT_EE_VERSIONING_GUID_H
36+
#define JIT_EE_VERSIONING_GUID_H
37+
38+
#include <minipal/guid.h>
4539

4640
constexpr GUID JITEEVersionIdentifier = { /* 4463d6ac-dfcb-4ab0-a941-c53b56089b7c */
4741
0x4463d6ac,
@@ -50,8 +44,4 @@ constexpr GUID JITEEVersionIdentifier = { /* 4463d6ac-dfcb-4ab0-a941-c53b56089b7
5044
{0xa9, 0x41, 0xc5, 0x3b, 0x56, 0x08, 0x9b, 0x7c}
5145
};
5246

53-
//////////////////////////////////////////////////////////////////////////////////////////////////////////
54-
//
55-
// END JITEEVersionIdentifier
56-
//
57-
//////////////////////////////////////////////////////////////////////////////////////////////////////////
47+
#endif // JIT_EE_VERSIONING_GUID_H

src/coreclr/inc/utilcode.h

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ using std::nothrow;
3535

3636
#include "contract.h"
3737

38-
#include <minipal/utils.h>
38+
#include <stddef.h>
39+
#include <minipal/guid.h>
3940
#include <dn-u16.h>
4041

4142
#include "clrnt.h"
@@ -149,14 +150,10 @@ typedef LPSTR LPUTF8;
149150
#endif
150151
#endif
151152

152-
#include <stddef.h> // for offsetof
153-
#include <minipal/utils.h>
154-
155153
#define IS_DIGIT(ch) (((ch) >= W('0')) && ((ch) <= W('9')))
156154
#define DIGIT_TO_INT(ch) ((ch) - W('0'))
157155
#define INT_TO_DIGIT(i) ((WCHAR)(W('0') + (i)))
158156

159-
160157
// Helper will 4 byte align a value, rounding up.
161158
#define ALIGN4BYTE(val) (((val) + 3) & ~0x3)
162159

@@ -3031,23 +3028,6 @@ class ConfigMethodSet
30313028
BYTE m_inited;
30323029
};
30333030

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-
30513031
//*****************************************************************************
30523032
// Convert a pointer to a string into a GUID.
30533033
//*****************************************************************************

src/coreclr/nativeaot/Runtime/inc/CommonTypes.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@ typedef uint32_t ULONG;
5353
typedef int64_t LONGLONG;
5454
typedef uint8_t BYTE;
5555
typedef uint16_t UINT16;
56-
typedef struct _GUID {
57-
uint32_t Data1;
58-
uint16_t Data2;
59-
uint16_t Data3;
60-
uint8_t Data4[8];
61-
} GUID;
6256
#endif // FEATURE_EVENT_TRACE && !_INC_WINDOWS
6357

6458
// Hijack funcs are not called, they are "returned to". And when done, they return to the actual caller.

0 commit comments

Comments
 (0)