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:
Ryan C. Gordon
2017-02-13 17:00:46 -05:00
parent e5fc93baca
commit 70c0400b12
4 changed files with 32 additions and 28 deletions

View File

@@ -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: */

View File

@@ -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: */