[HarfBuzz] harfbuzz: Branch 'master' - 3 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Fri Oct 27 16:19:44 UTC 2017


 src/hb-atomic-private.hh     |    4 ++--
 src/hb-private.hh            |   22 +++-------------------
 src/test-buffer-serialize.cc |    4 +---
 src/test-size-params.cc      |    4 +---
 src/test-would-substitute.cc |    4 +---
 util/ansi-print.hh           |    1 +
 util/helper-cairo-ansi.hh    |    5 +++--
 util/helper-cairo.hh         |    7 ++++---
 util/main-font-text.hh       |    5 +++--
 util/options.hh              |   11 +----------
 util/shape-consumer.hh       |    5 +++--
 util/view-cairo.hh           |    7 ++++---
 12 files changed, 27 insertions(+), 52 deletions(-)

New commits:
commit 62e312ead808cec055049592b0d40aa3a8882bc9
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Oct 27 09:29:20 2017 -0600

    Use NULL instead of polyfill, if nullptr is not available
    
    Part of fixing https://github.com/behdad/harfbuzz/issues/585

diff --git a/src/hb-private.hh b/src/hb-private.hh
index 268a2b0a..a6b3ab8c 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -80,25 +80,9 @@ extern "C" void  hb_free_impl(void *ptr);
 
 #if __cplusplus < 201103L
 
-// Null pointer literal
-// Source: SC22/WG21/N2431 = J16/07-0301
-// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf
-
-const                        // this is a const object...
-class {
-public:
-    template<class T>          // convertible to any type
-    operator T*() const {    // of null non-member
-        return 0;    // pointer...
-    }
-    template<class C, class T> // or any type of null
-    operator T C::*() const { // member pointer...
-        return 0;
-    }
-private:
-    void operator&() const;    // whose address can't be taken
-} _hb_nullptr = {};            // and whose name is nullptr
-#define nullptr _hb_nullptr
+#ifndef nullptr
+#define nullptr NULL
+#endif
 
 // Static assertions
 #ifndef static_assert
commit 17f40b7cad240eadeccdf23eb11da7ed52252ca2
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Oct 27 09:22:30 2017 -0600

    Include hb-private.hh more consistently
    
    Part of fixing https://github.com/behdad/harfbuzz/issues/585

diff --git a/src/test-buffer-serialize.cc b/src/test-buffer-serialize.cc
index c52d88a0..74de9a0e 100644
--- a/src/test-buffer-serialize.cc
+++ b/src/test-buffer-serialize.cc
@@ -24,9 +24,7 @@
  * Google Author(s): Behdad Esfahbod
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include "hb-private.hh"
 
 #include "hb.h"
 #ifdef HAVE_FREETYPE
diff --git a/src/test-size-params.cc b/src/test-size-params.cc
index faa82805..9741b87e 100644
--- a/src/test-size-params.cc
+++ b/src/test-size-params.cc
@@ -24,9 +24,7 @@
  * Google Author(s): Behdad Esfahbod
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include "hb-private.hh"
 
 #include "hb.h"
 #include "hb-ot.h"
diff --git a/src/test-would-substitute.cc b/src/test-would-substitute.cc
index cad5b5a0..efebf2d0 100644
--- a/src/test-would-substitute.cc
+++ b/src/test-would-substitute.cc
@@ -24,9 +24,7 @@
  * Google Author(s): Behdad Esfahbod
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include "hb-private.hh"
 
 #include "hb.h"
 #include "hb-ot.h"
diff --git a/util/ansi-print.hh b/util/ansi-print.hh
index dad4d4cf..1ea5b374 100644
--- a/util/ansi-print.hh
+++ b/util/ansi-print.hh
@@ -27,6 +27,7 @@
 #ifndef ANSI_PRINT_HH
 #define ANSI_PRINT_HH
 
+#include "hb-private.hh"
 #include <hb.h> /* for int types */
 
 void
diff --git a/util/helper-cairo-ansi.hh b/util/helper-cairo-ansi.hh
index eeaaa506..cf18ea49 100644
--- a/util/helper-cairo-ansi.hh
+++ b/util/helper-cairo-ansi.hh
@@ -24,11 +24,12 @@
  * Google Author(s): Behdad Esfahbod
  */
 
-#include <cairo.h>
-
 #ifndef HELPER_CAIRO_ANSI_HH
 #define HELPER_CAIRO_ANSI_HH
 
+#include "hb-private.hh"
+
+#include <cairo.h>
 
 cairo_status_t
 helper_cairo_surface_write_to_ansi_stream (cairo_surface_t	*surface,
diff --git a/util/helper-cairo.hh b/util/helper-cairo.hh
index 27b6eb3d..50bc0af0 100644
--- a/util/helper-cairo.hh
+++ b/util/helper-cairo.hh
@@ -24,13 +24,14 @@
  * Google Author(s): Behdad Esfahbod
  */
 
+#ifndef HELPER_CAIRO_HH
+#define HELPER_CAIRO_HH
+
+#include "hb-private.hh"
 #include "options.hh"
 
 #include <cairo.h>
 
-#ifndef HELPER_CAIRO_HH
-#define HELPER_CAIRO_HH
-
 
 cairo_scaled_font_t *
 helper_cairo_create_scaled_font (const font_options_t *font_opts);
diff --git a/util/main-font-text.hh b/util/main-font-text.hh
index 53478e75..3390371c 100644
--- a/util/main-font-text.hh
+++ b/util/main-font-text.hh
@@ -24,11 +24,12 @@
  * Google Author(s): Behdad Esfahbod
  */
 
-#include "options.hh"
-
 #ifndef HB_MAIN_FONT_TEXT_HH
 #define HB_MAIN_FONT_TEXT_HH
 
+#include "hb-private.hh"
+#include "options.hh"
+
 /* main() body for utilities taking font and processing text.*/
 
 static char *
diff --git a/util/options.hh b/util/options.hh
index c2f37dca..4f9d85e5 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -27,10 +27,7 @@
 #ifndef OPTIONS_HH
 #define OPTIONS_HH
 
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
+#include "hb-private.hh"
 
 #include <stdlib.h>
 #include <stddef.h>
@@ -59,12 +56,6 @@
 # define g_mapped_file_unref g_mapped_file_free
 #endif
 
-/* Normally I don't like including private headers, but hb-private.hh
- * is generic utility stuff and in no way exposes the internals of
- * libharfbuzz.
- */
-#include "hb-private.hh"
-
 void fail (hb_bool_t suggest_help, const char *format, ...) G_GNUC_NORETURN G_GNUC_PRINTF (2, 3);
 
 extern hb_bool_t debug;
diff --git a/util/shape-consumer.hh b/util/shape-consumer.hh
index 1aa30cde..fa419f18 100644
--- a/util/shape-consumer.hh
+++ b/util/shape-consumer.hh
@@ -24,11 +24,12 @@
  * Google Author(s): Behdad Esfahbod
  */
 
-#include "options.hh"
-
 #ifndef HB_SHAPE_CONSUMER_HH
 #define HB_SHAPE_CONSUMER_HH
 
+#include "hb-private.hh"
+#include "options.hh"
+
 
 template <typename output_t>
 struct shape_consumer_t
diff --git a/util/view-cairo.hh b/util/view-cairo.hh
index bf56da3c..d28c3cd1 100644
--- a/util/view-cairo.hh
+++ b/util/view-cairo.hh
@@ -24,12 +24,13 @@
  * Google Author(s): Behdad Esfahbod
  */
 
-#include "options.hh"
-#include "helper-cairo.hh"
-
 #ifndef VIEW_CAIRO_HH
 #define VIEW_CAIRO_HH
 
+#include "hb-private.hh"
+#include "options.hh"
+#include "helper-cairo.hh"
+
 
 struct view_cairo_t
 {
commit 42d518513c683fd5e932898ceec891c3003d75e1
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Oct 27 00:25:11 2017 -0600

    Towards compiling with pre-C++11 compilers and nullptr fallback
    
    https://github.com/behdad/harfbuzz/issues/585

diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh
index 2d567579..93438401 100644
--- a/src/hb-atomic-private.hh
+++ b/src/hb-atomic-private.hh
@@ -89,9 +89,9 @@ typedef int32_t hb_atomic_int_impl_t;
 #define hb_atomic_ptr_impl_cmpexch(P,O,N)	OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P))
 #else
 #if __ppc64__ || __x86_64__ || __aarch64__
-#define hb_atomic_ptr_impl_cmpexch(P,O,N)	OSAtomicCompareAndSwap64Barrier ((int64_t) (O), (int64_t) (N), (int64_t*) (P))
+#define hb_atomic_ptr_impl_cmpexch(P,O,N)	OSAtomicCompareAndSwap64Barrier ((int64_t) (void *) (O), (int64_t) (void *) (N), (int64_t*) (P))
 #else
-#define hb_atomic_ptr_impl_cmpexch(P,O,N)	OSAtomicCompareAndSwap32Barrier ((int32_t) (O), (int32_t) (N), (int32_t*) (P))
+#define hb_atomic_ptr_impl_cmpexch(P,O,N)	OSAtomicCompareAndSwap32Barrier ((int32_t) (void *) (O), (int32_t) (void *) (N), (int32_t*) (P))
 #endif
 #endif
 


More information about the HarfBuzz mailing list