Problem with ZLIB

Problem with ZLIB

Post by juanj » Thu, 20 Aug 1998 04:00:00



Hello:

    Sorry but I spent many hours to detect why doesn't work this
program, and I dont make anything. I'm using Zlib and compiling with
DJGPP MSDOS compiler.

This is the simple program:

#include <stdio.h>
#include <fcntl.h>
#include "zlib.h"
#include "zutil.h"
main()
{
#define SIZE 4000
unsigned char buf[SIZE];
unsigned char *ubuf;
int fp,fp2;
long uncomprLen=200000;
long comprLen=SIZE;
int err;

    z_stream d_stream; /* decompression stream */

 z_verbose=10;
 ubuf=(unsigned char *)malloc(200000);
 fp=open("prueba.gz",O_RDONLY|O_BINARY);
 comprLen=read(fp,buf,SIZE);

 memset(ubuf,0x00,200000);
 d_stream.zalloc = (alloc_func)0;
 d_stream.zfree = (free_func)0;
 d_stream.opaque = (voidpf)0;

 d_stream.next_in  = &buf[0];
 d_stream.avail_in = 0;
 d_stream.next_out = ubuf;

  err = inflateInit(&d_stream);
  printf("%d %s\n",err, "inflateInit");

  while (d_stream.total_out < uncomprLen && d_stream.total_in <
comprLen) {
        d_stream.avail_in = d_stream.avail_out = 1; /* force small
buffers */
        err = inflate(&d_stream, Z_NO_FLUSH);
        if (err == Z_STREAM_END) break;
        printf("%d %s\n",err, "inflate");
        if (err == Z_DATA_ERROR) break;
    }

Quote:}

What's happen ? Always return with Z_DATA_ERROR

Many thanks.

Juanjo Erauskin

 
 
 

1. Problem building zlib on Solaris 8

I'm probably missing something, but after getting this to build on AIX
so easily, I'm getting a little frustrated about doing the same on
Solaris 8.

I ran configure like this:

prefix=/bnr/gsmomc/3rdParty-SunOS CC=/opt/SUNWspro/bin/cc configure

It produced no errors, but when I run make I get

/opt/SUNWspro/bin/cc -fast -xcg89 -DNO_ERRNO_H  -c  example.c
ms_pipeliner_b::process_option -- unknown chip type in -Qms_pipe+xchip
ms_pipeliner::process_option -- unknown chip type in -Qms_pipe+xchip=<chip>

etc.

Is this something I need to worry about? Can I change something to fix
it? Have I just made a fool out of myself by not seeing something in
the documentation?

Thanks

2. Recommendations for cross platform server

3. Problems compiling zlib under SuSE 7.0

4. Quit All Applications AppleEvent

5. Memory problem using zlib

6. X-based MIB Browser

7. Problem with Zlib and 'compress' compatibility

8. Sharing and Security Folder Issue

9. Problem using ZLIB... help

10. Problems with Zlib's lib...

11. Problem in Zlib ???

12. Problems with ZLib C++ Builder port

13. Z_BUF_ERROR is a persistant problem with zLib library. Please Advise!