[PATCH] InlineIsEqualGUID makes use of undefined ULONG type
Puetz Kevin A
PuetzKevinA at JohnDeere.com
Wed Jul 15 08:15:02 CDT 2020
This breaks stand-alone inclusion of <guiddef.h>
(without first including <basetsd.h>), which is supposed to be OK.
According to <basetsd.h> wine supports ILP32, LP64 or P64,
so `unsigned long` isn't safe - `long` might be a 64-bit type.
But `unsigned int` should be 32-bit for any of those models
This is a type-punning cast regardless; REFGUID is not actually ULONG[4] either
Signed-off-by: Kevin Puetz <PuetzKevinA at JohnDeere.com>
---
E.g. https://docs.microsoft.com/en-us/windows/win32/api/guiddef/nf-guiddef-isequalguid says
> Header: guiddef.h (include GuidDef.h, Objbase.h)
Rather than the common "(include Windows.h)"; this header is meant to be usable stand-alone
---
include/guiddef.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/guiddef.h b/include/guiddef.h
index 664f74fac3..a25b3a7107 100644
--- a/include/guiddef.h
+++ b/include/guiddef.h
@@ -156,18 +156,18 @@ typedef GUID FMTID,*LPFMTID;
#define IsEqualGUID(rguid1, rguid2) (!memcmp(&(rguid1), &(rguid2), sizeof(GUID)))
inline int InlineIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
{
- return (((ULONG *)&rguid1)[0] == ((ULONG *)&rguid2)[0] &&
- ((ULONG *)&rguid1)[1] == ((ULONG *)&rguid2)[1] &&
- ((ULONG *)&rguid1)[2] == ((ULONG *)&rguid2)[2] &&
- ((ULONG *)&rguid1)[3] == ((ULONG *)&rguid2)[3]);
+ return (((unsigned int *)&rguid1)[0] == ((unsigned int *)&rguid2)[0] &&
+ ((unsigned int *)&rguid1)[1] == ((unsigned int *)&rguid2)[1] &&
+ ((unsigned int *)&rguid1)[2] == ((unsigned int *)&rguid2)[2] &&
+ ((unsigned int *)&rguid1)[3] == ((unsigned int *)&rguid2)[3]);
}
#else
#define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
#define InlineIsEqualGUID(rguid1, rguid2) \
- (((ULONG *)rguid1)[0] == ((ULONG *)rguid2)[0] && \
- ((ULONG *)rguid1)[1] == ((ULONG *)rguid2)[1] && \
- ((ULONG *)rguid1)[2] == ((ULONG *)rguid2)[2] && \
- ((ULONG *)rguid1)[3] == ((ULONG *)rguid2)[3])
+ (((unsigned int *)rguid1)[0] == ((unsigned int *)rguid2)[0] && \
+ ((unsigned int *)rguid1)[1] == ((unsigned int *)rguid2)[1] && \
+ ((unsigned int *)rguid1)[2] == ((unsigned int *)rguid2)[2] && \
+ ((unsigned int *)rguid1)[3] == ((unsigned int *)rguid2)[3])
#endif
#ifdef __cplusplus
More information about the wine-devel
mailing list