mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-29 06:28:29 +00:00
windows: Try to unify all the GUID comparison code into a core helper function.
There are likely several more I missed.
This commit is contained in:
@@ -158,7 +158,7 @@ WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
|
||||
DWORD len = 0;
|
||||
char *retval = NULL;
|
||||
|
||||
if (SDL_memcmp(guid, &nullguid, sizeof (*guid)) == 0) {
|
||||
if (WIN_IsEqualGUID(guid, &nullguid)) {
|
||||
return WIN_StringToUTF8(name); /* No GUID, go with what we've got. */
|
||||
}
|
||||
|
||||
@@ -202,6 +202,18 @@ WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid)
|
||||
#endif /* if __WINRT__ / else */
|
||||
}
|
||||
|
||||
BOOL
|
||||
WIN_IsEqualGUID(const GUID * a, const GUID * b)
|
||||
{
|
||||
return (SDL_memcmp(a, b, sizeof (*a)) == 0);
|
||||
}
|
||||
|
||||
BOOL
|
||||
WIN_IsEqualIID(REFIID a, REFIID b)
|
||||
{
|
||||
return (SDL_memcmp(a, b, sizeof (*a)) == 0);
|
||||
}
|
||||
|
||||
#endif /* __WIN32__ || __WINRT__ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
@@ -62,6 +62,10 @@ extern BOOL WIN_IsWindowsVistaOrGreater(void);
|
||||
/* You need to SDL_free() the result of this call. */
|
||||
extern char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid);
|
||||
|
||||
/* Checks to see if two GUID are the same. */
|
||||
extern BOOL WIN_IsEqualGUID(const GUID * a, const GUID * b);
|
||||
extern BOOL WIN_IsEqualIID(REFIID a, REFIID b);
|
||||
|
||||
#endif /* _INCLUDED_WINDOWS_H */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
Reference in New Issue
Block a user