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

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Oct 30 08:36:21 UTC 2018


 src/hb-machinery.hh    |   13 +++++++------
 test/api/test-ot-tag.c |    6 +++---
 util/hb-shape.cc       |    6 ++----
 util/options.cc        |    6 ------
 util/options.hh        |    8 ++------
 5 files changed, 14 insertions(+), 25 deletions(-)

New commits:
commit edaa768253cfeb97d614537253f90d47aa93ff6f
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Oct 30 01:35:58 2018 -0700

    [util] Use fgets instead of getline such that windows passes

diff --git a/util/hb-shape.cc b/util/hb-shape.cc
index 6c727d01..1a671230 100644
--- a/util/hb-shape.cc
+++ b/util/hb-shape.cc
@@ -163,9 +163,8 @@ main (int argc, char **argv)
   if (argc == 2 && !strcmp (argv[1], "--batch"))
   {
     unsigned int ret = 0;
-    char *buf = nullptr;
-    size_t len;
-    while (getline (&buf, &len, stdin) > 0)
+    char buf[4092];
+    while (fgets (buf, sizeof (buf), stdin))
     {
       size_t l = strlen (buf);
       if (l && buf[l - 1] == '\n') buf[l - 1] = '\0';
@@ -187,7 +186,6 @@ main (int argc, char **argv)
       if (ret)
         break;
     }
-    free (buf);
     return ret;
   }
   main_font_text_t<shape_consumer_t<output_buffer_t>, FONT_SIZE_UPEM, 0> driver;
commit 56738429d667f6c35e5c7af30b51604fc133c23c
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Oct 30 01:33:22 2018 -0700

    [test] Fix warnings

diff --git a/test/api/test-ot-tag.c b/test/api/test-ot-tag.c
index f89c25de..c0329bff 100644
--- a/test/api/test-ot-tag.c
+++ b/test/api/test-ot-tag.c
@@ -60,7 +60,7 @@ test_script_tags_from_language (const char *s, const char *lang_s, hb_script_t s
 {
   hb_script_t tag;
   unsigned int count = 1;
-  hb_script_t t;
+  hb_tag_t t;
 
   g_test_message ("Testing script %c%c%c%c: script tag %s, language tag %s", HB_UNTAG (hb_script_to_iso15924_tag (script)), s, lang_s);
   tag = hb_tag_from_string (s, -1);
@@ -78,7 +78,7 @@ static void
 test_indic_tags (const char *s1, const char *s2, const char *s3, hb_script_t script)
 {
   hb_script_t tag1, tag2, tag3;
-  hb_script_t t[3];
+  hb_tag_t t[3];
   unsigned int count = 3;
 
   g_test_message ("Testing script %c%c%c%c: USE tag %s, new tag %s, old tag %s", HB_UNTAG (hb_script_to_iso15924_tag (script)), s1, s2, s3);
@@ -103,7 +103,7 @@ test_indic_tags (const char *s1, const char *s2, const char *s3, hb_script_t scr
 static void
 test_ot_tag_script_degenerate (void)
 {
-  hb_script_t t[2];
+  hb_tag_t t[2];
   unsigned int count = 2;
 
   g_assert_cmphex (HB_TAG_CHAR4 ("DFLT"), ==, HB_OT_TAG_DEFAULT_SCRIPT);
commit 138f9e0f25752bbf7f8e867f230ca91442f40028
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Oct 30 01:31:13 2018 -0700

    Minor

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index 9e50bc02..465bbb14 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -82,7 +82,8 @@ static inline Type& StructAfter(TObject &X)
 /* Check _assertion in a method environment */
 #define _DEFINE_INSTANCE_ASSERTION1(_line, _assertion) \
   inline void _instance_assertion_on_line_##_line (void) const \
-  { static_assert ((_assertion), ""); }
+  { static_assert ((_assertion), ""); } \
+  static_assert (true, "") /* So we require semicolon here. */
 # define _DEFINE_INSTANCE_ASSERTION0(_line, _assertion) _DEFINE_INSTANCE_ASSERTION1 (_line, _assertion)
 # define DEFINE_INSTANCE_ASSERTION(_assertion) _DEFINE_INSTANCE_ASSERTION0 (__LINE__, _assertion)
 
@@ -95,21 +96,21 @@ static inline Type& StructAfter(TObject &X)
 
 
 #define DEFINE_SIZE_STATIC(size) \
-  DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)) \
+  DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)); \
   inline unsigned int get_size (void) const { return (size); } \
   enum { static_size = (size) }; \
   enum { min_size = (size) }
 
 #define DEFINE_SIZE_UNION(size, _member) \
-  DEFINE_INSTANCE_ASSERTION (0*sizeof(this->u._member.static_size) + sizeof(this->u._member) == (size)) \
+  DEFINE_INSTANCE_ASSERTION (0*sizeof(this->u._member.static_size) + sizeof(this->u._member) == (size)); \
   static const unsigned int min_size = (size)
 
 #define DEFINE_SIZE_MIN(size) \
-  DEFINE_INSTANCE_ASSERTION (sizeof (*this) >= (size)) \
+  DEFINE_INSTANCE_ASSERTION (sizeof (*this) >= (size)); \
   static const unsigned int min_size = (size)
 
 #define DEFINE_SIZE_ARRAY(size, array) \
-  DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + VAR * sizeof (array[0])) \
+  DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + VAR * sizeof (array[0])); \
   DEFINE_COMPILES_ASSERTION ((void) array[0].static_size) \
   enum { min_size = (size) }
 
@@ -118,7 +119,7 @@ static inline Type& StructAfter(TObject &X)
 	DEFINE_SIZE_ARRAY(size, array)
 
 #define DEFINE_SIZE_ARRAY2(size, array1, array2) \
-  DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + sizeof (this->array1[0]) + sizeof (this->array2[0])) \
+  DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + sizeof (this->array1[0]) + sizeof (this->array2[0])); \
   DEFINE_COMPILES_ASSERTION ((void) array1[0].static_size; (void) array2[0].static_size) \
   static const unsigned int min_size = (size)
 
commit 83a612739accf6b0f2e1cb1be15097402f7ecf33
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Oct 30 01:24:23 2018 -0700

    [util] Minor

diff --git a/util/options.cc b/util/options.cc
index 4815770f..5661cd05 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -758,10 +758,7 @@ text_options_t::get_line (unsigned int *len)
       fail (true, "At least one of text or text-file must be set");
 
     if (0 != strcmp (text_file, "-"))
-    {
       fp = fopen (text_file, "r");
-      close_fp = true;
-    }
     else
       fp = stdin;
 
@@ -798,10 +795,7 @@ output_options_t::get_file_handle (void)
     return fp;
 
   if (output_file)
-  {
     fp = fopen (output_file, "wb");
-    close_fp = true;
-  }
   else {
 #if defined(_WIN32) || defined(__CYGWIN__)
     setmode (fileno (stdout), O_BINARY);
diff --git a/util/options.hh b/util/options.hh
index 36f680f0..6d57d7d6 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -510,7 +510,6 @@ struct text_options_t : option_group_t
     text_file = nullptr;
 
     fp = nullptr;
-    close_fp = false;
     gs = nullptr;
     line = nullptr;
     line_len = (unsigned int) -1;
@@ -525,7 +524,7 @@ struct text_options_t : option_group_t
     g_free (text_file);
     if (gs)
       g_string_free (gs, true);
-    if (close_fp)
+    if (fp && fp != stdin)
       fclose (fp);
   }
 
@@ -548,7 +547,6 @@ struct text_options_t : option_group_t
 
   private:
   FILE *fp;
-  bool close_fp;
   GString *gs;
   char *line;
   unsigned int line_len;
@@ -565,7 +563,6 @@ struct output_options_t : option_group_t
     explicit_output_format = false;
 
     fp = nullptr;
-    close_fp = false;
 
     add_options (parser);
   }
@@ -573,7 +570,7 @@ struct output_options_t : option_group_t
   {
     g_free (output_file);
     g_free (output_format);
-    if (close_fp)
+    if (fp && fp != stdout)
       fclose (fp);
   }
 
@@ -605,7 +602,6 @@ struct output_options_t : option_group_t
   bool explicit_output_format;
 
   mutable FILE *fp;
-  bool close_fp;
 };
 
 struct format_options_t : option_group_t


More information about the HarfBuzz mailing list