"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "gb.compress.zlib/src/main.c" between
gambas-3.16.2.tar.bz2 and gambas-3.16.3.tar.bz2

About: Gambas is a graphical development environment based on a Basic interpreter with object extensions, a bit like Visual Basic (requires Qt).

main.c  (gambas-3.16.2.tar.bz2):main.c  (gambas-3.16.3.tar.bz2)
skipping to change at line 190 skipping to change at line 190
static void u_String(char **target,unsigned int *lent,char *source,unsigned int len) static void u_String(char **target,unsigned int *lent,char *source,unsigned int len)
{ {
int res, try_gzip = 0; int res, try_gzip = 0;
z_stream stream = { z_stream stream = {
.zalloc = Z_NULL, .zalloc = Z_NULL,
.zfree = Z_NULL, .zfree = Z_NULL,
.opaque = Z_NULL, .opaque = Z_NULL,
.avail_in = len, .avail_in = len,
.next_in = (Bytef *) source, .next_in = (Bytef *) source,
}; };
unsigned long pos = 0;
*lent = 2 * len; size_t pos = 0;
*lent = 2; // * len;
GB.Alloc((void **) target, *lent); GB.Alloc((void **) target, *lent);
stream.avail_out = *lent; stream.avail_out = *lent;
stream.next_out = (Bytef *) *target; stream.next_out = (Bytef *) *target;
inflateInit(&stream); inflateInit(&stream);
while (1) { while (1) {
res = inflate(&stream, Z_NO_FLUSH); res = inflate(&stream, Z_NO_FLUSH);
switch (res) { switch (res) {
case Z_OK: case Z_OK:
break; break;
case Z_BUF_ERROR: case Z_BUF_ERROR:
pos = (unsigned long) (stream.next_out - (unsigned long) *target); pos = (unsigned long) (stream.next_out - (unsigned long) *target);
if (stream.avail_in == 0) // BM: No idea why zlib returns
Z_BUF_ERROR and not Z_STREAM_END in that case.
goto out;
*lent += *lent / 2; *lent += *lent / 2;
GB.Realloc((void **) target, *lent); GB.Realloc((void **) target, *lent);
stream.avail_out = *lent - pos; stream.avail_out = *lent - pos;
stream.next_out = (Bytef *) (*target + pos); stream.next_out = (Bytef *) (*target + pos);
break; break;
case Z_STREAM_END: case Z_STREAM_END:
pos = (unsigned long) (stream.next_out - (unsigned long) *target); pos = (unsigned long) (stream.next_out - (unsigned long) *target);
goto out; goto out;
case Z_DATA_ERROR: case Z_DATA_ERROR:
/* Maybe we have gzip format? */ /* Maybe we have gzip format? */
 End of changes. 3 change blocks. 
2 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)