diff --git a/include/vkd3d_windows.h b/include/vkd3d_windows.h index cf971f14..855b3240 100644 --- a/include/vkd3d_windows.h +++ b/include/vkd3d_windows.h @@ -139,7 +139,6 @@ typedef struct SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES; # ifdef __GNUC__ # define DECLSPEC_SELECTANY __attribute__((weak)) -# define DECLSPEC_HIDDEN __attribute__((visibility("hidden"))) # endif /* Macros for COM interfaces */ @@ -190,6 +189,17 @@ typedef struct SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES; # endif /* NONAMELESSUNION */ #endif /* __C89_NAMELESS */ +/* Define DECLSPEC_HIDDEN */ +#ifndef DECLSPEC_HIDDEN +# if defined(__MINGW32__) +# define DECLSPEC_HIDDEN +# elif defined(__GNUC__) +# define DECLSPEC_HIDDEN __attribute__((visibility("hidden"))) +# else +# define DECLSPEC_HIDDEN +# endif +#endif /* DECLSPEC_HIDDEN */ + /* Define min() & max() macros */ #ifndef min # define min(a, b) (((a) <= (b)) ? (a) : (b)) diff --git a/libs/vkd3d/debug.c b/libs/vkd3d/debug.c index f67dad9f..6040fb94 100644 --- a/libs/vkd3d/debug.c +++ b/libs/vkd3d/debug.c @@ -84,8 +84,8 @@ void vkd3d_dbg_printf(enum vkd3d_dbg_level level, const char *function, const ch static char *get_buffer(void) { static char buffers[64][VKD3D_DEBUG_BUFFER_SIZE]; - static unsigned int buffer_index; - unsigned int current_index; + static ULONG buffer_index; + ULONG current_index; current_index = InterlockedIncrement(&buffer_index) % ARRAY_SIZE(buffers); return buffers[current_index]; diff --git a/libs/vkd3d/vkd3d_common.h b/libs/vkd3d/vkd3d_common.h index 54924177..472492a8 100644 --- a/libs/vkd3d/vkd3d_common.h +++ b/libs/vkd3d/vkd3d_common.h @@ -28,22 +28,24 @@ #define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) -#if HAVE_SYNC_ADD_AND_FETCH +#ifndef _WIN32 +# if HAVE_SYNC_ADD_AND_FETCH static inline ULONG InterlockedIncrement(ULONG volatile *x) { return __sync_add_and_fetch(x, 1); } -#else -# error "InterlockedIncrement not implemented for this platform" -#endif /* HAVE_SYNC_ADD_AND_FETCH */ +# else +# error "InterlockedIncrement not implemented for this platform" +# endif /* HAVE_SYNC_ADD_AND_FETCH */ -#if HAVE_SYNC_SUB_AND_FETCH +# if HAVE_SYNC_SUB_AND_FETCH static inline ULONG InterlockedDecrement(ULONG volatile *x) { return __sync_sub_and_fetch(x, 1); } -#else -# error "InterlockedDecrement not implemented for this platform" -#endif +# else +# error "InterlockedDecrement not implemented for this platform" +# endif +#endif /* _WIN32 */ #endif /* __VKD3D_COMMON_H */ diff --git a/libs/vkd3d/vkd3d_debug.h b/libs/vkd3d/vkd3d_debug.h index e5da92c7..8084890f 100644 --- a/libs/vkd3d/vkd3d_debug.h +++ b/libs/vkd3d/vkd3d_debug.h @@ -72,10 +72,10 @@ static inline const char *debugstr_guid(const GUID *guid) if (!guid) return "(null)"; - return vkd3d_dbg_sprintf("{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", - guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1], - guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5], - guid->Data4[6], guid->Data4[7]); + return vkd3d_dbg_sprintf("{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", + (unsigned long)guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], + guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4], + guid->Data4[5], guid->Data4[6], guid->Data4[7]); } #endif /* __VKD3D_DEBUG_H */