aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Adler <git@madler.net>2026-02-12 00:53:08 -0800
committerMark Adler <git@madler.net>2026-02-12 01:01:44 -0800
commit3f5d21e8f573a549ffc200e17dd95321db454aa1 (patch)
tree71e7bd8651e7f58416830d5fa82a5225e10fd930
parentaf0aa9b66a2d123a1ca26d9bfe138695012b045b (diff)
downloadzlib-3f5d21e8f573a549ffc200e17dd95321db454aa1.tar.gz
zlib-3f5d21e8f573a549ffc200e17dd95321db454aa1.tar.bz2
zlib-3f5d21e8f573a549ffc200e17dd95321db454aa1.zip
Use underscores for Windows POSIX names in zpipe.c.
-rw-r--r--examples/zlib_how.html11
-rw-r--r--examples/zpipe.c9
2 files changed, 9 insertions, 11 deletions
diff --git a/examples/zlib_how.html b/examples/zlib_how.html
index 43271b98..286308b3 100644
--- a/examples/zlib_how.html
+++ b/examples/zlib_how.html
@@ -4,7 +4,7 @@
4<head> 4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>zlib Usage Example</title> 6<title>zlib Usage Example</title>
7<!-- Copyright (c) 2004-2023 Mark Adler. --> 7<!-- Copyright (c) 2004-2026 Mark Adler. -->
8</head> 8</head>
9<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#00A000"> 9<body bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#00A000">
10<h2 align="center"> zlib Usage Example </h2> 10<h2 align="center"> zlib Usage Example </h2>
@@ -21,7 +21,7 @@ Without further ado, here is the program <a href="zpipe.c"><tt>zpipe.c</tt></a>:
21<pre><b> 21<pre><b>
22/* zpipe.c: example of proper use of zlib's inflate() and deflate() 22/* zpipe.c: example of proper use of zlib's inflate() and deflate()
23 Not copyrighted -- provided to the public domain 23 Not copyrighted -- provided to the public domain
24 Version 1.4 11 December 2005 Mark Adler */ 24 Version 1.5 11 February 2026 Mark Adler */
25 25
26/* Version history: 26/* Version history:
27 1.0 30 Oct 2004 First version 27 1.0 30 Oct 2004 First version
@@ -31,6 +31,7 @@ Without further ado, here is the program <a href="zpipe.c"><tt>zpipe.c</tt></a>:
31 1.3 6 Apr 2005 Remove incorrect assertion in inf() 31 1.3 6 Apr 2005 Remove incorrect assertion in inf()
32 1.4 11 Dec 2005 Add hack to avoid MSDOS end-of-line conversions 32 1.4 11 Dec 2005 Add hack to avoid MSDOS end-of-line conversions
33 Avoid some compiler warnings for input and output buffers 33 Avoid some compiler warnings for input and output buffers
34 1.5 11 Feb 2026 Use underscores for Windows POSIX names
34 */ 35 */
35</b></pre><!-- --> 36</b></pre><!-- -->
36We now include the header files for the required definitions. From 37We now include the header files for the required definitions. From
@@ -60,7 +61,7 @@ This sets the input and output to binary which suppresses the end-of-line conver
60#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__) 61#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
61# include &lt;fcntl.h&gt; 62# include &lt;fcntl.h&gt;
62# include &lt;io.h&gt; 63# include &lt;io.h&gt;
63# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) 64# define SET_BINARY_MODE(file) _setmode(_fileno(file), _O_BINARY)
64#else 65#else
65# define SET_BINARY_MODE(file) 66# define SET_BINARY_MODE(file)
66#endif 67#endif
@@ -538,8 +539,8 @@ int main(int argc, char **argv)
538} 539}
539</b></pre> 540</b></pre>
540<hr> 541<hr>
541<i>Last modified 24 January 2023<br> 542<i>Last modified 12 February 2026<br>
542Copyright &#169; 2004-2023 Mark Adler</i><br> 543Copyright &#169; 2004-2026 Mark Adler</i><br>
543<a rel="license" href="http://creativecommons.org/licenses/by-nd/4.0/"> 544<a rel="license" href="http://creativecommons.org/licenses/by-nd/4.0/">
544<img alt="Creative Commons License" style="border-width:0" 545<img alt="Creative Commons License" style="border-width:0"
545src="https://i.creativecommons.org/l/by-nd/4.0/88x31.png"></a> 546src="https://i.creativecommons.org/l/by-nd/4.0/88x31.png"></a>
diff --git a/examples/zpipe.c b/examples/zpipe.c
index 51dec474..021c8508 100644
--- a/examples/zpipe.c
+++ b/examples/zpipe.c
@@ -1,6 +1,6 @@
1/* zpipe.c: example of proper use of zlib's inflate() and deflate() 1/* zpipe.c: example of proper use of zlib's inflate() and deflate()
2 Not copyrighted -- provided to the public domain 2 Not copyrighted -- provided to the public domain
3 Version 1.4 11 December 2005 Mark Adler */ 3 Version 1.5 11 February 2026 Mark Adler */
4 4
5/* Version history: 5/* Version history:
6 1.0 30 Oct 2004 First version 6 1.0 30 Oct 2004 First version
@@ -10,12 +10,9 @@
10 1.3 6 Apr 2005 Remove incorrect assertion in inf() 10 1.3 6 Apr 2005 Remove incorrect assertion in inf()
11 1.4 11 Dec 2005 Add hack to avoid MSDOS end-of-line conversions 11 1.4 11 Dec 2005 Add hack to avoid MSDOS end-of-line conversions
12 Avoid some compiler warnings for input and output buffers 12 Avoid some compiler warnings for input and output buffers
13 1.5 11 Feb 2026 Use underscores for Windows POSIX names
13 */ 14 */
14 15
15#if defined(_WIN32) && !defined(_CRT_NONSTDC_NO_DEPRECATE)
16# define _CRT_NONSTDC_NO_DEPRECATE
17#endif
18
19#include <stdio.h> 16#include <stdio.h>
20#include <string.h> 17#include <string.h>
21#include <assert.h> 18#include <assert.h>
@@ -24,7 +21,7 @@
24#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__) 21#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
25# include <fcntl.h> 22# include <fcntl.h>
26# include <io.h> 23# include <io.h>
27# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) 24# define SET_BINARY_MODE(file) _setmode(_fileno(file), _O_BINARY)
28#else 25#else
29# define SET_BINARY_MODE(file) 26# define SET_BINARY_MODE(file)
30#endif 27#endif