[HarfBuzz] Fixes for harfbuzz-ng on Windows MSVC2010

Koji Ishii kojiishi at gmail.com
Sat Jul 7 20:37:26 PDT 2012


Hi,

I tried to build harfbuzz-ng on Windows MSVC2010 and got a few errors.
I'm not sure how many people needs this but I'm sharing the patches
here for who is interested in.

hb-atomic-private.hh fix is for x86 only. The current code builds fine
for x64 but not for x86.

hb-unicode-private.hh fix is probably not related with Windows nor
MSVC, but when neither GLIB nor ICU is available.

hb-uniscribe.cc fix is required for me, maybe Windows SDK was changed?
I'm using VC2010 SP1, but the fix should be safe for prior compilers I
believe.


Regards,
Koji

commit c5174b35c59ee80ed8e81989ddeb73baabbfe9ed
Author: Koji Ishii <kojiishi at gmail.com>
Date:   Sat Jul 7 23:45:23 2012 +0900

    msvc10 fixes

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index 918852d..967b6c0 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -45,7 +45,15 @@
 #elif !defined(HB_NO_MT) && defined(_MSC_VER) && _MSC_VER >= 1600

 #include <intrin.h>
+#if defined(_M_IX86)
+#define _InterlockedCompareExchangePointer(_Target, _Exchange,
_Comparand) reinterpret_cast<void *>(static_cast<__w64
long>(_InterlockedCompareExchange( \
+    static_cast<long volatile *>(reinterpret_cast<__w64 long volatile
*>(static_cast<void * volatile *>(_Target))), \
+    static_cast<long>(reinterpret_cast<__w64 long>(static_cast<void
*>(_Exchange))), \
+    static_cast<long>(reinterpret_cast<__w64 long>(static_cast<void
*>(_Comparand))))))
+#pragma intrinsic(_InterlockedExchangeAdd)
+#else
 #pragma intrinsic(_InterlockedExchangeAdd, _InterlockedCompareExchangePointer)
+#endif

 typedef long hb_atomic_int_t;
 #define hb_atomic_int_add(AI, V)	_InterlockedExchangeAdd (&(AI), (V))
diff --git a/src/hb-unicode-private.hh b/src/hb-unicode-private.hh
index eaf151a..c781035 100644
--- a/src/hb-unicode-private.hh
+++ b/src/hb-unicode-private.hh
@@ -99,6 +99,7 @@ extern HB_INTERNAL const hb_unicode_funcs_t
_hb_icu_unicode_funcs;
 #define _hb_unicode_funcs_default _hb_icu_unicode_funcs
 #else
 #define HB_UNICODE_FUNCS_NIL 1
+extern HB_INTERNAL const hb_unicode_funcs_t _hb_unicode_funcs_nil;
 #define _hb_unicode_funcs_default _hb_unicode_funcs_nil
 #endif

diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc
index b71b00a..3bedc7d 100644
--- a/src/hb-uniscribe.cc
+++ b/src/hb-uniscribe.cc
@@ -29,6 +29,10 @@
 #include "hb-private.hh"

 #include <windows.h>
+// usp10.h defines UNISCRIBE_OPENTYPE only if _WIN32_WINNT >= 0x0600
+#if !defined(UNISCRIBE_OPENTYPE) && (_WIN32_WINNT < 0x0600)
+#define UNISCRIBE_OPENTYPE 0x0100
+#endif
 #include <usp10.h>

 typedef ULONG WIN_ULONG;



More information about the HarfBuzz mailing list