[Zlib-devel] Yet another small bunch of patches

Cosmin Truta cosmin at cs.toronto.edu
Wed Sep 17 00:37:09 EDT 2003


Hi, everyone,

So it seems that I can come every week with some modifications in
zlib... In this way, we will never have anything final!

At least, the modifications that I'll present below are really minor.
I don't want to go through another beta cycle because of them.

Mark, If you can integrate them without delaying the release, that's
fine. If you cannot, that's fine, too, and we'll postpone them for some
version after 1.2.1.

**

Fixes to contrib/untgz:

http://www.cs.toronto.edu/~cosmin/pngtech/zlib/untgz.tar.gz

I had fixed some bugs some time ago in zlib-cos5, yet now I discovered
(and fixed) others. untgz used to crash when reading a fake .tar.gz,
or when the extraction run out of disk space. There were other, minor
problems, such as it refused to extract zero-length files (this was,
apparently, a design decision, but it was a bad one).

Even though I am not the author of untgz, I took the liberty to bump
its version number from 0.1 to 0.2

I successfully tested the new untgz under Windows and Linux. Although
there are still things to be done (the header detection is not yet
completely reliable, the file attributes are not restored, etc.), at
least I can say the new untgz is better than the old one.

**

Fixes to example.c, minigzip.c, zutil.c
[These ones are only cosmetic]

I tried to simulate a non-STDC compilation by tampering with the STDC
macro. It went fine, but then I discovered the following cosmetic
problem:

#ifdef STDC
#  include <string.h>
#  include <stdlib.h>
#else
   extern void exit  OF((int));
#endif

Question: is something missing here, or rather is something too much?
Some people could say the str*() function protos are missing, others
could say the exit() proto is too much.

There is a third answer: instead of an all-or-nothing approach, it
would be better to have the function prototypes whose absence could
cause problems. Such problem functions have arguments of a different
size than the machine word, and/or different than the size of the
actual parameters used by the callers; they also have a non-void
returning type of a different size than the machine word.

But this is not the case of void exit(int). It could be the case of
str*() functions when sizeof(ptr*)!=sizeof(int), but to my knowledge
many non-STDC programs assume sizeof(ptr*)==sizeof(int), and the
non-STDC build environments really support this assumption.

Problems will still remain when mixing types of different sizes, like
int, short, long, float, or double. I tested if such problems exist in
zlib, but fortunately I didn't find any :)


The diffs below are provided to remove the exit() noise.

Best regards,
Cosmin


--- example.c~	Sat Sep 13 20:23:20 2003
+++ example.c	Sun Sep 14 22:01:00 2003
@@ -11,8 +11,6 @@
 #ifdef STDC
 #  include <string.h>
 #  include <stdlib.h>
-#else
-   extern void exit  OF((int));
 #endif


--- minigzip.c~	Wed Aug 20 12:59:58 2003
+++ minigzip.c	Sun Sep 14 22:01:00 2003
@@ -21,8 +21,6 @@
 #ifdef STDC
 #  include <string.h>
 #  include <stdlib.h>
-#else
-   extern void exit  OF((int));
 #endif


--- zutil.c~	Wed Aug 27 22:34:34 2003
+++ zutil.c	Sun Sep 14 22:01:00 2003
@@ -11,10 +11,6 @@
 struct internal_state      {int dummy;}; /* for buggy compilers */
 #endif

-#ifndef STDC
-extern void exit OF((int));
-#endif
-
 const char * const z_errmsg[10] = {





More information about the Zlib-devel mailing list