I just ran the new sourceforge-based tool cppcheck over the source code of the 4.5 snapshot 20100304 and cppcheck said [./zlib/contrib/iostream2/zstream.h:101]: (style) The function 'izstream::fp' can be const [./zlib/contrib/iostream2/zstream.h:234]: (style) The function 'ozstream::fp' can be const I checked the source code and I agree with cppcheck. Both these functions could be marked const.
zlib is not maintained as part of gcc -- it is just imported into the tree for convenience. As such we minimize the changes we make to zlib. A change like this one should be reported to the real zlib maintainers.
besides which, making it const would allow: void bork_the_stream(const izstream& i) { ::gzclose(i.fp()); } which doesn't help anyone. cppcheck is a very simplistic pattern matcher, in this case it's wrong IMHO, that it could be const does not mean _should_ be const.