More MSVC fixes from Jonathan Kew

This commit is contained in:
Behdad Esfahbod 2009-11-03 10:52:45 -05:00
parent d3480ba37f
commit ffbe0a853d
2 changed files with 11 additions and 1 deletions

View File

@ -28,13 +28,18 @@
#define HB_COMMON_H #define HB_COMMON_H
#ifdef _MSC_VER #ifdef _MSC_VER
#warning "Not using stdint.h. Integer types may have wrong size." #define __STR2__(x) #x
#define __STR1__(x) __STR2__(x)
#define __LOC__ __FILE__ "("__STR1__(__LINE__)") : Warning Msg: "
#pragma message(__LOC__"Not using stdint.h; integer types may have wrong size")
typedef signed char int8_t; typedef signed char int8_t;
typedef unsigned char uint8_t; typedef unsigned char uint8_t;
typedef signed short int16_t; typedef signed short int16_t;
typedef unsigned short uint16_t; typedef unsigned short uint16_t;
typedef signed int int32_t; typedef signed int int32_t;
typedef unsigned int uint32_t; typedef unsigned int uint32_t;
typedef signed long long int64_t;
typedef unsigned long long uint64_t;
#ifndef __cplusplus #ifndef __cplusplus
#define inline __inline #define inline __inline
#endif #endif

View File

@ -65,8 +65,13 @@ typedef GStaticMutex hb_mutex_t;
#define hb_mutex_trylock(M) g_static_mutex_trylock (&M) #define hb_mutex_trylock(M) g_static_mutex_trylock (&M)
#define hb_mutex_unlock(M) g_static_mutex_unlock (&M) #define hb_mutex_unlock(M) g_static_mutex_unlock (&M)
#else
#ifdef _MSC_VER
#pragma message(__LOC__"Could not find any system to define platform macros, library will NOT be thread-safe")
#else #else
#warning "Could not find any system to define platform macros, library will NOT be thread-safe" #warning "Could not find any system to define platform macros, library will NOT be thread-safe"
#endif
typedef int hb_atomic_int_t; typedef int hb_atomic_int_t;
#define hb_atomic_int_fetch_and_add(AI, V) ((AI) += (V), (AI) - (V)) #define hb_atomic_int_fetch_and_add(AI, V) ((AI) += (V), (AI) - (V))