From bc71ad4973842f25216b48842a46d6c9cbce6aa3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 1 Mar 2012 17:30:29 -0800 Subject: [PATCH] Fix atomic-int op on Apple The OSAtomicAdd32Barrier operator returns the new value, we want the old value. --- src/hb-blob.cc | 2 +- src/hb-object-private.hh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-blob.cc b/src/hb-blob.cc index b2b1d9c..ee997ad 100644 --- a/src/hb-blob.cc +++ b/src/hb-blob.cc @@ -301,7 +301,7 @@ _try_writable (hb_blob_t *blob) return TRUE; - DEBUG_MSG_FUNC (BLOB, blob, "currect data is -> %p\n", blob->data); + DEBUG_MSG_FUNC (BLOB, blob, "current data is -> %p\n", blob->data); char *new_data; diff --git a/src/hb-object-private.hh b/src/hb-object-private.hh index b96f6d8..0cb5ebd 100644 --- a/src/hb-object-private.hh +++ b/src/hb-object-private.hh @@ -72,7 +72,7 @@ typedef long hb_atomic_int_t; #include typedef int32_t hb_atomic_int_t; -#define hb_atomic_int_add(AI, V) OSAtomicAdd32Barrier(V, &(AI)) +#define hb_atomic_int_add(AI, V) (OSAtomicAdd32Barrier((V), &(AI)), (AI) - (V)) #define hb_atomic_int_get(AI) OSAtomicAdd32Barrier(0, &(AI)) #else -- 2.7.4