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

Behdad Esfahbod behdad at kemper.freedesktop.org
Sat Jun 30 03:29:03 UTC 2018


 .circleci/config.yml |    3 ++-
 src/hb-blob.cc       |   42 ++++++++++++++++++++++++------------------
 2 files changed, 26 insertions(+), 19 deletions(-)

New commits:
commit 25970a93aa6596d50ae538c6274625f95153572c
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Thu Jun 28 14:32:36 2018 +0430

    armcc compatibility, don't use EINTR if doesn't exist
    
    Fixes #1081

diff --git a/src/hb-blob.cc b/src/hb-blob.cc
index d29c6b2c..10db0978 100644
--- a/src/hb-blob.cc
+++ b/src/hb-blob.cc
@@ -617,7 +617,9 @@ fail_without_close:
     unsigned long addition = fread (data + len, 1, allocated - len, fp);
 
     int err = ferror (fp);
+#ifdef EINTR // armcc doesn't have it
     if (unlikely (err == EINTR)) continue;
+#endif
     if (unlikely (err)) goto fread_fail;
 
     len += addition;
commit 8a51f91b7035bbfaf39af1b962faf1613d2ea3b7
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Thu Jun 28 13:22:21 2018 +0430

    Minor on hb_blob_create_from_file, reuse ferror result
    
    Oops

diff --git a/src/hb-blob.cc b/src/hb-blob.cc
index d17627ff..d29c6b2c 100644
--- a/src/hb-blob.cc
+++ b/src/hb-blob.cc
@@ -618,7 +618,7 @@ fail_without_close:
 
     int err = ferror (fp);
     if (unlikely (err == EINTR)) continue;
-    if (unlikely (ferror (fp))) goto fread_fail;
+    if (unlikely (err)) goto fread_fail;
 
     len += addition;
   }
commit 71971800ed1c0501a58e6ff7730e3cebec2ef2f8
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Wed Jun 27 18:14:52 2018 +0430

    [ci] Don't fail on apt update and revive clang-O3-O0

diff --git a/.circleci/config.yml b/.circleci/config.yml
index de130b50..012873e2 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -68,7 +68,8 @@ jobs:
       - image: multiarch/crossbuild
     steps:
       - checkout
-      - run: apt update && apt install -y ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip
+      - run: apt update || true
+      - run: apt install -y ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip
       - run: pip install fonttools
       - run: wget http://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.bz2 && tar xf freetype-2.9.tar.bz2 && cd freetype-2.9 && ./autogen.sh && ./configure && make -j4 && cd ..
       - run: CFLAGS="-O3" CXXFLAGS="-O3" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2
commit 7b4099f35f766d33d483a4b9d0805ef16020ea23
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Wed Jun 27 16:54:44 2018 +0430

    Minor, rename blob to data on blob_from_file

diff --git a/src/hb-blob.cc b/src/hb-blob.cc
index 918a479c..d17627ff 100644
--- a/src/hb-blob.cc
+++ b/src/hb-blob.cc
@@ -593,10 +593,10 @@ fail_without_close:
 #endif
 
   // The following tries to read a file without knowing its size beforehand
-  // It's used for systems without mmap concept or to read from pipes
+  // It's used as a fallback for systems without mmap or to read from pipes
   unsigned long len = 0, allocated = BUFSIZ * 16;
-  char *blob = (char *) malloc (allocated);
-  if (unlikely (blob == nullptr)) return hb_blob_get_empty ();
+  char *data = (char *) malloc (allocated);
+  if (unlikely (data == nullptr)) return hb_blob_get_empty ();
 
   FILE *fp = fopen (file_name, "rb");
   if (unlikely (fp == nullptr)) goto fread_fail_without_close;
@@ -609,12 +609,12 @@ fail_without_close:
       // Don't allocate and go more than ~536MB, our mmap reader still
       // can cover files like that but lets limit our fallback reader
       if (unlikely (allocated > (2 << 28))) goto fread_fail;
-      char *new_blob = (char *) realloc (blob, allocated);
-      if (unlikely (new_blob == nullptr)) goto fread_fail;
-      blob = new_blob;
+      char *new_data = (char *) realloc (data, allocated);
+      if (unlikely (new_data == nullptr)) goto fread_fail;
+      data = new_data;
     }
 
-    unsigned long addition = fread (blob + len, 1, allocated - len, fp);
+    unsigned long addition = fread (data + len, 1, allocated - len, fp);
 
     int err = ferror (fp);
     if (unlikely (err == EINTR)) continue;
@@ -623,12 +623,12 @@ fail_without_close:
     len += addition;
   }
 
-  return hb_blob_create (blob, len, HB_MEMORY_MODE_WRITABLE, blob,
+  return hb_blob_create (data, len, HB_MEMORY_MODE_WRITABLE, data,
                          (hb_destroy_func_t) free);
 
 fread_fail:
   fclose (fp);
 fread_fail_without_close:
-  free (blob);
+  free (data);
   return hb_blob_get_empty ();
 }
commit fa090ed4d47df12b2e611c9a667c398742f7e4ba
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Wed Jun 27 14:13:26 2018 +0430

    Minor touches on hb_blob_create_from_file (#1079)
    
    * Handle EINTR on fallback reader
    * Increase fallback reader limitation size limitation to 2 << 28
    * Ensure _O_BINARY does exist if MMAP is used on Windows
      (maybe superfluous but makes me more confident)

diff --git a/src/hb-blob.cc b/src/hb-blob.cc
index 155c2e6b..918a479c 100644
--- a/src/hb-blob.cc
+++ b/src/hb-blob.cc
@@ -489,10 +489,10 @@ hb_blob_t::try_make_writable (void)
 
 #if defined(_WIN32) || defined(__CYGWIN__)
 # include <windows.h>
-#endif
-
-#ifndef _O_BINARY
-# define _O_BINARY 0
+#else
+# ifndef _O_BINARY
+#  define _O_BINARY 0
+# endif
 #endif
 
 #ifndef MAP_NORESERVE
@@ -594,8 +594,7 @@ fail_without_close:
 
   // The following tries to read a file without knowing its size beforehand
   // It's used for systems without mmap concept or to read from pipes
-  int len = 0;
-  int allocated = BUFSIZ * 16;
+  unsigned long len = 0, allocated = BUFSIZ * 16;
   char *blob = (char *) malloc (allocated);
   if (unlikely (blob == nullptr)) return hb_blob_get_empty ();
 
@@ -607,16 +606,21 @@ fail_without_close:
     if (allocated - len < BUFSIZ)
     {
       allocated *= 2;
-      // Don't allocate more than 200MB, our mmap reader still
+      // Don't allocate and go more than ~536MB, our mmap reader still
       // can cover files like that but lets limit our fallback reader
-      if (unlikely (allocated > 200000000)) goto fread_fail;
+      if (unlikely (allocated > (2 << 28))) goto fread_fail;
       char *new_blob = (char *) realloc (blob, allocated);
       if (unlikely (new_blob == nullptr)) goto fread_fail;
       blob = new_blob;
     }
 
-    len += fread (blob + len, 1, allocated - len, fp);
+    unsigned long addition = fread (blob + len, 1, allocated - len, fp);
+
+    int err = ferror (fp);
+    if (unlikely (err == EINTR)) continue;
     if (unlikely (ferror (fp))) goto fread_fail;
+
+    len += addition;
   }
 
   return hb_blob_create (blob, len, HB_MEMORY_MODE_WRITABLE, blob,


More information about the HarfBuzz mailing list