| View previous topic :: View next topic |
| Author |
Message |
Ong Hong Peow Guest
|
Posted: Fri Jul 25, 2003 8:23 am Post subject: zlib to compress file more than 65k in one go? |
|
|
Hi,
I using the compress() in zlib 1.1.4 to compress buffers in memory at one
go.
my mem settings are
MAX_WBITS 10
MAX_MEM_LEVEL 4
My main concern is not the memory usage for compression, rather it>s
decompression.
Setting uInt to be 16bits wide, compressing buffers that>s more than 65k
would result result in Z_BUF_ERROR.
excerpt from compress.c line 38, 39
stream.avail_out = (uInt)*destLen;
if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
I see that the cause to be in line 38 where if the *destLen is greater than
65535, typecasting to a uInt(16bit wide) would result an overflow thus
Z_BUF_ERROR.
I>ve no problem if uInt is set to be 32bits but that will bump up my memory
usage almost by 2.
My question is,
1) am I thus suppose to use those deflate functions instead?
1. deflateInit()
2. repeatedly call deflate() till Z_STREAM_END
3. deflateEnd()
2) btw, what>s mmap>ed?
Thanks,
Ong Hong Peow |
|
| |
|
Back to top |
Mark Adler Guest
|
Posted: Sat Jul 26, 2003 10:55 pm Post subject: Re: zlib to compress file more than 65k in one go? |
|
|
"Ong Hong Peow" <iou@iwow.com.sg> wrote in message news:<bfq74b$fpt$1@mawar.singnet.com.sg>...
[quote]1) am I thus suppose to use those deflate functions instead?
[/quote]
Yes.
[quote]2. repeatedly call deflate() till Z_STREAM_END
[/quote]
You invoke Z_STREAM_END by telling deflate() you>ve sent it the last
of the input with Z_FINISH.
[quote]2) btw, what>s mmap>ed?
[/quote]
minigzip.
mark |
|
| |
|
Back to top |
Ong Hong Peow Guest
|
Posted: Mon Jul 28, 2003 6:56 am Post subject: Re: zlib to compress file more than 65k in one go? |
|
|
Thanks Mark,
Hong Peow
"Mark Adler" <madler@alumni.caltech.edu> wrote in message
news:7ab39013.0307260955.302775b3@posting.google.com...
[quote]"Ong Hong Peow" <iou@iwow.com.sg> wrote in message
news:<bfq74b$fpt$1@mawar.singnet.com.sg>...
1) am I thus suppose to use those deflate functions instead?
Yes.
2. repeatedly call deflate() till Z_STREAM_END
You invoke Z_STREAM_END by telling deflate() you>ve sent it the last
of the input with Z_FINISH.
2) btw, what>s mmap>ed?
minigzip.
mark[/quote] |
|
| |
|
Back to top |
|