emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r113823: Fix zlib support on MS-Windows.


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r113823: Fix zlib support on MS-Windows.
Date: Mon, 12 Aug 2013 19:48:25 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113823
revision-id: address@hidden
parent: address@hidden
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Mon 2013-08-12 22:48:04 +0300
message:
  Fix zlib support on MS-Windows.
  
   configure.ac (HAVE_ZLIB): Don't use -lz on MinGW.
  
   src/decompress.c <zlib_initialized> [WINDOWSNT]: New static variable.
   (Fzlib_decompress_region) [WINDOWSNT]: Call init_zlib_functions if
   not yet initialized.
modified:
  ChangeLog                      changelog-20091113204419-o5vbwnq5f7feedwu-1538
  configure.ac                   
configure.in-20091113204419-o5vbwnq5f7feedwu-783
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/decompress.c               decompress.c-20130811194033-wfhl0tqmmc36jfmu-1
=== modified file 'ChangeLog'
--- a/ChangeLog 2013-08-12 16:05:58 +0000
+++ b/ChangeLog 2013-08-12 19:48:04 +0000
@@ -1,3 +1,7 @@
+2013-08-12  Eli Zaretskii  <address@hidden>
+
+       * configure.ac (HAVE_ZLIB): Don't use -lz on MinGW.
+
 2013-08-12  Paul Eggert  <address@hidden>
 
        Minor zlib configuration tweaks.

=== modified file 'configure.ac'
--- a/configure.ac      2013-08-12 16:05:58 +0000
+++ b/configure.ac      2013-08-12 19:48:04 +0000
@@ -2955,6 +2955,10 @@
 fi
 if test "${HAVE_ZLIB}" = "yes"; then
   AC_DEFINE([HAVE_ZLIB], 1, [Define to 1 if you have the zlib library (-lz).])
+  ### mingw32 doesn't use -lz, since it loads the library dynamically.
+  if test "${opsys}" = "mingw32"; then
+     LIBZ=
+  fi
 fi
 AC_SUBST(LIBZ)
 

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-08-12 17:02:31 +0000
+++ b/src/ChangeLog     2013-08-12 19:48:04 +0000
@@ -1,3 +1,9 @@
+2013-08-12  Eli Zaretskii  <address@hidden>
+
+       * decompress.c <zlib_initialized> [WINDOWSNT]: New static variable.
+       (Fzlib_decompress_region) [WINDOWSNT]: Call init_zlib_functions if
+       not yet initialized.
+
 2013-08-12  Lars Magne Ingebrigtsen  <address@hidden>
 
        * decompress.c (Fzlib_decompress_region): Support zlib

=== modified file 'src/decompress.c'
--- a/src/decompress.c  2013-08-12 17:02:31 +0000
+++ b/src/decompress.c  2013-08-12 19:48:04 +0000
@@ -38,7 +38,7 @@
 /* Macro for loading zlib functions from the library.  */
 #define LOAD_ZLIB_FN(lib,func) {                                       \
     fn_##func = (void *) GetProcAddress (lib, #func);                  \
-    if (!fn_##func) return 0;                                          \
+    if (!fn_##func) return false;                                      \
   }
 
 DEF_ZLIB_FN (int, inflateInit2_,
@@ -50,6 +50,8 @@
 DEF_ZLIB_FN (int, inflateEnd,
             (z_streamp strm));
 
+static bool zlib_initialized;
+
 static bool
 init_zlib_functions (void)
 {
@@ -58,13 +60,13 @@
   if (!library)
     {
       message1 ("zlib library not found");
-      return 0;
+      return false;
     }
 
   LOAD_ZLIB_FN (library, inflateInit2_);
   LOAD_ZLIB_FN (library, inflate);
   LOAD_ZLIB_FN (library, inflateEnd);
-  return 1;
+  return true;
 }
 
 #define fn_inflateInit2(strm, windowBits) \
@@ -139,6 +141,11 @@
   if (! NILP (BVAR (current_buffer, enable_multibyte_characters)))
     error ("This function can be called only in unibyte buffers");
 
+#ifdef WINDOWSNT
+  if (!zlib_initialized)
+    zlib_initialized = init_zlib_functions ();
+#endif
+
   /* This is a unibyte buffer, so character positions and bytes are
      the same.  */
   istart = XINT (start);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]