Use of Win32 API in harfbuzz

Ken Brown kbrown@cornell.edu
Thu Jul 12 16:25:00 GMT 2018


Yaakov,

A recent commit in upstream harfbuzz (ce17340) used the Win32 API on 
Cygwin.  I was about to send a patch upstream to fix this, but I thought 
I should first check for such uses in the current Cygwin release 
(1.7.6-1).  The attached patch removes the ones I found.

Am I right in removing all of these, or should some be kept?  I wasn't 
sure about the calls to setmode(), for example.

And is it OK with you for me to send Cygwin patches upstream, or would 
you rather be the one communicating with them?

Ken
-------------- next part --------------
--- origsrc/harfbuzz-1.7.6/src/hb-mutex-private.hh	2018-02-13 19:27:23.000000000 -0500
+++ src/harfbuzz-1.7.6/src/hb-mutex-private.hh	2018-07-12 09:20:15.256706400 -0400
@@ -48,7 +48,7 @@
 /* Defined externally, i.e. in config.h; must have typedef'ed hb_mutex_impl_t as well. */
 
 
-#elif !defined(HB_NO_MT) && (defined(_WIN32) || defined(__CYGWIN__))
+#elif !defined(HB_NO_MT) && defined(_WIN32)
 
 #include <windows.h>
 typedef CRITICAL_SECTION hb_mutex_impl_t;
--- origsrc/harfbuzz-1.7.6/src/hb-ot-shape-complex-arabic-fallback.hh	2018-02-13 19:27:23.000000000 -0500
+++ src/harfbuzz-1.7.6/src/hb-ot-shape-complex-arabic-fallback.hh	2018-07-12 09:20:44.040285600 -0400
@@ -207,7 +207,7 @@ struct arabic_fallback_plan_t
 
 static const arabic_fallback_plan_t arabic_fallback_plan_nil = {};
 
-#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(HB_NO_WIN1256)
+#if defined(_WIN32) && !defined(HB_NO_WIN1256)
 #define HB_WITH_WIN1256
 #endif
 
--- origsrc/harfbuzz-1.7.6/src/hb-private.hh	2018-02-18 14:36:12.000000000 -0500
+++ src/harfbuzz-1.7.6/src/hb-private.hh	2018-07-12 09:21:34.168948600 -0400
@@ -177,7 +177,7 @@ extern "C" void  hb_free_impl(void *ptr)
 #  define HB_FALLTHROUGH /* FALLTHROUGH */
 #endif
 
-#if defined(_WIN32) || defined(__CYGWIN__)
+#ifdef _WIN32
    /* We need Windows Vista for both Uniscribe backend and for
     * MemoryBarrier.  We don't support compiling on Windows XP,
     * though we run on it fine. */
--- origsrc/harfbuzz-1.7.6/util/options.cc	2018-02-27 13:50:36.000000000 -0500
+++ src/harfbuzz-1.7.6/util/options.cc	2018-07-12 09:22:22.266873400 -0400
@@ -644,7 +644,7 @@ font_options_t::get_font (void) const
       /* read it */
       GString *gs = g_string_new (nullptr);
       char buf[BUFSIZ];
-#if defined(_WIN32) || defined(__CYGWIN__)
+#ifdef _WIN32
       setmode (fileno (stdin), O_BINARY);
 #endif
       while (!feof (stdin)) {
@@ -837,7 +837,7 @@ output_options_t::get_file_handle (void)
   if (output_file)
     fp = fopen (output_file, "wb");
   else {
-#if defined(_WIN32) || defined(__CYGWIN__)
+#ifdef _WIN32
     setmode (fileno (stdout), O_BINARY);
 #endif
     fp = stdout;
--- origsrc/harfbuzz-1.7.6/util/options.hh	2018-02-27 13:50:36.000000000 -0500
+++ src/harfbuzz-1.7.6/util/options.hh	2018-07-12 09:22:52.566393200 -0400
@@ -41,7 +41,7 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h> /* for isatty() */
 #endif
-#if defined(_WIN32) || defined(__CYGWIN__)
+#ifdef _WIN32
 #include <io.h> /* for setmode() under Windows */
 #endif
 


More information about the Cygwin-apps mailing list