Skip to content

Commit a093fe0

Browse files
committed
Make CompareGuid match EDK2 ABI
* return BOOLEAN instead of INTN * Use EFIAPI * Opposite return codes Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
1 parent 13c46e4 commit a093fe0

File tree

5 files changed

+58
-16
lines changed

5 files changed

+58
-16
lines changed

inc/efilib.h

+5-4
Original file line numberDiff line numberDiff line change
@@ -495,10 +495,11 @@ ReleaseLock (
495495
);
496496

497497

498-
INTN
499-
CompareGuid(
500-
IN EFI_GUID *Guid1,
501-
IN EFI_GUID *Guid2
498+
BOOLEAN
499+
EFIAPI
500+
CompareGuid_1 (
501+
IN CONST EFI_GUID *Guid1,
502+
IN CONST EFI_GUID *Guid2
502503
);
503504

504505
VOID *

inc/efirtlib.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,12 @@ RtStrSize (
151151
IN CONST CHAR16 *s1
152152
);
153153

154-
INTN
154+
BOOLEAN
155+
EFIAPI
155156
RUNTIMEFUNCTION
156157
RtCompareGuid (
157-
IN EFI_GUID *Guid1,
158-
IN EFI_GUID *Guid2
158+
IN CONST EFI_GUID *Guid1,
159+
IN CONST EFI_GUID *Guid2
159160
);
160161

161162
UINT8

inc/legacy.h

+34
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,39 @@ ReallocatePool_0 (
5757

5858
/* end CopyMem */
5959

60+
/* CompareGuid */
61+
62+
#ifndef GNU_EFI_USE_COMPAREGUID_ABI
63+
#define GNU_EFI_USE_COMPAREGUID_ABI 1
64+
#endif
65+
66+
#if GNU_EFI_USE_COMPAREGUID_ABI == 0
67+
#define CompareGuid CompareGuid_0
68+
#else
69+
#define CompareGuid CompareGuid_1
6070
#endif
6171

72+
/* prevent circular headers */
73+
BOOLEAN
74+
EFIAPI
75+
CompareGuid_1 (
76+
IN CONST EFI_GUID *Guid1,
77+
IN CONST EFI_GUID *Guid2
78+
);
79+
80+
static
81+
inline
82+
INTN
83+
EFIAPI
84+
CompareGuid_0 (
85+
IN EFI_GUID *Guid1,
86+
IN EFI_GUID *Guid2)
87+
{
88+
if (CompareGuid_1(Guid1, Guid2)) {
89+
return 0;
90+
} else {
91+
return 1;
92+
}
93+
}
94+
95+
#endif

lib/guid.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,11 @@ InitializeGuid (
114114
{
115115
}
116116

117-
INTN
118-
CompareGuid(
119-
IN EFI_GUID *Guid1,
120-
IN EFI_GUID *Guid2
117+
BOOLEAN
118+
EFIAPI
119+
CompareGuid_1 (
120+
IN CONST EFI_GUID *Guid1,
121+
IN CONST EFI_GUID *Guid2
121122
)
122123
/*++
123124

lib/runtime/efirtlib.c

+10-5
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,12 @@ RtCompareMem (
134134
#ifndef __GNUC__
135135
#pragma RUNTIME_CODE(RtCompareGuid)
136136
#endif
137-
INTN
137+
BOOLEAN
138+
EFIAPI
138139
RUNTIMEFUNCTION
139140
RtCompareGuid (
140-
IN EFI_GUID *Guid1,
141-
IN EFI_GUID *Guid2
141+
IN CONST EFI_GUID *Guid1,
142+
IN CONST EFI_GUID *Guid2
142143
)
143144
/*++
144145
@@ -152,7 +153,7 @@ Routine Description:
152153
Guid2 - guid to compare
153154
154155
Returns:
155-
= 0 if Guid1 == Guid2
156+
= 1 if Guid1 == Guid2
156157
157158
--*/
158159
{
@@ -170,7 +171,11 @@ Routine Description:
170171
r |= g1[2] - g2[2];
171172
r |= g1[3] - g2[3];
172173

173-
return r;
174+
if (r==0) {
175+
return 1;
176+
} else {
177+
return 0;
178+
}
174179
}
175180

176181

0 commit comments

Comments
 (0)