www.GetXFactor.com

Leading Technology, Science,
Agriculture News and information


Part of the Identityscape.com network...

getxfactor.com jmoodmusic.com smartbusinesschoices.com mintdepot.com lowfaresalways.com evangelicalview.com shoppingpodder.com soproudlywehail.com webnews.ws currenthumor.com

 

 

zlib to compress file more than 65k in one go?
   Science and Technology news... Forum Index -> Compression Forum  
View previous topic :: View next topic  
Author Message
Ong Hong Peow
Guest






PostPosted: Fri Jul 25, 2003 8:23 am    Post subject: zlib to compress file more than 65k in one go? Reply with quote

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






PostPosted: Sat Jul 26, 2003 10:55 pm    Post subject: Re: zlib to compress file more than 65k in one go? Reply with quote

"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






PostPosted: Mon Jul 28, 2003 6:56 am    Post subject: Re: zlib to compress file more than 65k in one go? Reply with quote

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
Display posts from previous:   
   Science and Technology news... Forum Index -> Compression Forum  
Page 1 of 1
All times are GMT

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum