[Zlib-devel] zlib 1.2.4.1 beta

William A. Rowe Jr. wrowe at rowe-clan.net
Sun Mar 28 21:06:28 EDT 2010


On 3/28/2010 7:37 PM, Mark Adler wrote:
> On Mar 28, 2010, at 4:16 PM, Vincent Torri wrote:
>> _setmode for Windows CE is declared in stdlib.h :
> 
> So would the code below in minigzip.c solve the problem?

This isn't making sense, because this code is used in the stdin/stdout
case, and as far as I've ever read, CE has no stdin/stdout, right?  The
entire block of stdin/stdout options should be commented out for CE?

It would make no sense to do this for __CYGWIN__ because I'd presume
cygwin doesn't try to play 'text' games, right?

But none of this makes sense in this context;

            file = gzdopen(fileno(stdin), "rb");
            if (file == NULL) error("can't gzdopen stdin");
            gz_uncompress(file, stdout);

because it's easier to go directly to the source;

{...}
#define SET_BINARY_MODE(fd) setmode(fd, O_BINARY);
{...}

/* Well-defined fd */
#define Z_STDIN  0
#define Z_STDOUT 1

            SET_BINARY_MODE(Z_STDIN);
            file = gzdopen(Z_STDIN, "rb");
            if (file == NULL) error("can't gzdopen stdin");
            gz_uncompress(file, file);

Does this all make more sense, ignoring FILE *stdin/*stdout altogether?  In fact,
it probably makes more sense to use fd based open, etc.

which does leave me with a question, what purpose does the char *mode arg
serve, in the gzdopen() API?






More information about the Zlib-devel mailing list