Warning, /education/marble/src/3rdparty/zlib/FAQ is written in an unsupported language. File is not indexed.

0001 
0002                 Frequently Asked Questions about zlib
0003 
0004 
0005 If your question is not there, please check the zlib home page
0006 http://zlib.net/ which may have more recent information.
0007 The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
0008 
0009 
0010  1. Is zlib Y2K-compliant?
0011 
0012     Yes. zlib doesn't handle dates.
0013 
0014  2. Where can I get a Windows DLL version?
0015 
0016     The zlib sources can be compiled without change to produce a DLL.  See the
0017     file win32/DLL_FAQ.txt in the zlib distribution.  Pointers to the
0018     precompiled DLL are found in the zlib web site at http://zlib.net/ .
0019 
0020  3. Where can I get a Visual Basic interface to zlib?
0021 
0022     See
0023         * http://marknelson.us/1997/01/01/zlib-engine/
0024         * win32/DLL_FAQ.txt in the zlib distribution
0025 
0026  4. compress() returns Z_BUF_ERROR.
0027 
0028     Make sure that before the call of compress(), the length of the compressed
0029     buffer is equal to the available size of the compressed buffer and not
0030     zero.  For Visual Basic, check that this parameter is passed by reference
0031     ("as any"), not by value ("as long").
0032 
0033  5. deflate() or inflate() returns Z_BUF_ERROR.
0034 
0035     Before making the call, make sure that avail_in and avail_out are not zero.
0036     When setting the parameter flush equal to Z_FINISH, also make sure that
0037     avail_out is big enough to allow processing all pending input.  Note that a
0038     Z_BUF_ERROR is not fatal--another call to deflate() or inflate() can be
0039     made with more input or output space.  A Z_BUF_ERROR may in fact be
0040     unavoidable depending on how the functions are used, since it is not
0041     possible to tell whether or not there is more output pending when
0042     strm.avail_out returns with zero.  See http://zlib.net/zlib_how.html for a
0043     heavily annotated example.
0044 
0045  6. Where's the zlib documentation (man pages, etc.)?
0046 
0047     It's in zlib.h .  Examples of zlib usage are in the files test/example.c
0048     and test/minigzip.c, with more in examples/ .
0049 
0050  7. Why don't you use GNU autoconf or libtool or ...?
0051 
0052     Because we would like to keep zlib as a very small and simple package.
0053     zlib is rather portable and doesn't need much configuration.
0054 
0055  8. I found a bug in zlib.
0056 
0057     Most of the time, such problems are due to an incorrect usage of zlib.
0058     Please try to reproduce the problem with a small program and send the
0059     corresponding source to us at zlib@gzip.org .  Do not send multi-megabyte
0060     data files without prior agreement.
0061 
0062  9. Why do I get "undefined reference to gzputc"?
0063 
0064     If "make test" produces something like
0065 
0066        example.o(.text+0x154): undefined reference to `gzputc'
0067 
0068     check that you don't have old files libz.* in /usr/lib, /usr/local/lib or
0069     /usr/X11R6/lib. Remove any old versions, then do "make install".
0070 
0071 10. I need a Delphi interface to zlib.
0072 
0073     See the contrib/delphi directory in the zlib distribution.
0074 
0075 11. Can zlib handle .zip archives?
0076 
0077     Not by itself, no.  See the directory contrib/minizip in the zlib
0078     distribution.
0079 
0080 12. Can zlib handle .Z files?
0081 
0082     No, sorry.  You have to spawn an uncompress or gunzip subprocess, or adapt
0083     the code of uncompress on your own.
0084 
0085 13. How can I make a Unix shared library?
0086 
0087     By default a shared (and a static) library is built for Unix.  So:
0088 
0089     make distclean
0090     ./configure
0091     make
0092 
0093 14. How do I install a shared zlib library on Unix?
0094 
0095     After the above, then:
0096 
0097     make install
0098 
0099     However, many flavors of Unix come with a shared zlib already installed.
0100     Before going to the trouble of compiling a shared version of zlib and
0101     trying to install it, you may want to check if it's already there!  If you
0102     can #include <zlib.h>, it's there.  The -lz option will probably link to
0103     it.  You can check the version at the top of zlib.h or with the
0104     ZLIB_VERSION symbol defined in zlib.h .
0105 
0106 15. I have a question about OttoPDF.
0107 
0108     We are not the authors of OttoPDF. The real author is on the OttoPDF web
0109     site: Joel Hainley, jhainley@myndkryme.com.
0110 
0111 16. Can zlib decode Flate data in an Adobe PDF file?
0112 
0113     Yes. See http://www.pdflib.com/ . To modify PDF forms, see
0114     http://sourceforge.net/projects/acroformtool/ .
0115 
0116 17. Why am I getting this "register_frame_info not found" error on Solaris?
0117 
0118     After installing zlib 1.1.4 on Solaris 2.6, running applications using zlib
0119     generates an error such as:
0120 
0121         ld.so.1: rpm: fatal: relocation error: file /usr/local/lib/libz.so:
0122         symbol __register_frame_info: referenced symbol not found
0123 
0124     The symbol __register_frame_info is not part of zlib, it is generated by
0125     the C compiler (cc or gcc).  You must recompile applications using zlib
0126     which have this problem.  This problem is specific to Solaris.  See
0127     http://www.sunfreeware.com for Solaris versions of zlib and applications
0128     using zlib.
0129 
0130 18. Why does gzip give an error on a file I make with compress/deflate?
0131 
0132     The compress and deflate functions produce data in the zlib format, which
0133     is different and incompatible with the gzip format.  The gz* functions in
0134     zlib on the other hand use the gzip format.  Both the zlib and gzip formats
0135     use the same compressed data format internally, but have different headers
0136     and trailers around the compressed data.
0137 
0138 19. Ok, so why are there two different formats?
0139 
0140     The gzip format was designed to retain the directory information about a
0141     single file, such as the name and last modification date.  The zlib format
0142     on the other hand was designed for in-memory and communication channel
0143     applications, and has a much more compact header and trailer and uses a
0144     faster integrity check than gzip.
0145 
0146 20. Well that's nice, but how do I make a gzip file in memory?
0147 
0148     You can request that deflate write the gzip format instead of the zlib
0149     format using deflateInit2().  You can also request that inflate decode the
0150     gzip format using inflateInit2().  Read zlib.h for more details.
0151 
0152 21. Is zlib thread-safe?
0153 
0154     Yes.  However any library routines that zlib uses and any application-
0155     provided memory allocation routines must also be thread-safe.  zlib's gz*
0156     functions use stdio library routines, and most of zlib's functions use the
0157     library memory allocation routines by default.  zlib's *Init* functions
0158     allow for the application to provide custom memory allocation routines.
0159 
0160     Of course, you should only operate on any given zlib or gzip stream from a
0161     single thread at a time.
0162 
0163 22. Can I use zlib in my commercial application?
0164 
0165     Yes.  Please read the license in zlib.h.
0166 
0167 23. Is zlib under the GNU license?
0168 
0169     No.  Please read the license in zlib.h.
0170 
0171 24. The license says that altered source versions must be "plainly marked". So
0172     what exactly do I need to do to meet that requirement?
0173 
0174     You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h.  In
0175     particular, the final version number needs to be changed to "f", and an
0176     identification string should be appended to ZLIB_VERSION.  Version numbers
0177     x.x.x.f are reserved for modifications to zlib by others than the zlib
0178     maintainers.  For example, if the version of the base zlib you are altering
0179     is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and
0180     ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3".  You can also
0181     update the version strings in deflate.c and inftrees.c.
0182 
0183     For altered source distributions, you should also note the origin and
0184     nature of the changes in zlib.h, as well as in ChangeLog and README, along
0185     with the dates of the alterations.  The origin should include at least your
0186     name (or your company's name), and an email address to contact for help or
0187     issues with the library.
0188 
0189     Note that distributing a compiled zlib library along with zlib.h and
0190     zconf.h is also a source distribution, and so you should change
0191     ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes
0192     in zlib.h as you would for a full source distribution.
0193 
0194 25. Will zlib work on a big-endian or little-endian architecture, and can I
0195     exchange compressed data between them?
0196 
0197     Yes and yes.
0198 
0199 26. Will zlib work on a 64-bit machine?
0200 
0201     Yes.  It has been tested on 64-bit machines, and has no dependence on any
0202     data types being limited to 32-bits in length.  If you have any
0203     difficulties, please provide a complete problem report to zlib@gzip.org
0204 
0205 27. Will zlib decompress data from the PKWare Data Compression Library?
0206 
0207     No.  The PKWare DCL uses a completely different compressed data format than
0208     does PKZIP and zlib.  However, you can look in zlib's contrib/blast
0209     directory for a possible solution to your problem.
0210 
0211 28. Can I access data randomly in a compressed stream?
0212 
0213     No, not without some preparation.  If when compressing you periodically use
0214     Z_FULL_FLUSH, carefully write all the pending data at those points, and
0215     keep an index of those locations, then you can start decompression at those
0216     points.  You have to be careful to not use Z_FULL_FLUSH too often, since it
0217     can significantly degrade compression.  Alternatively, you can scan a
0218     deflate stream once to generate an index, and then use that index for
0219     random access.  See examples/zran.c .
0220 
0221 29. Does zlib work on MVS, OS/390, CICS, etc.?
0222 
0223     It has in the past, but we have not heard of any recent evidence.  There
0224     were working ports of zlib 1.1.4 to MVS, but those links no longer work.
0225     If you know of recent, successful applications of zlib on these operating
0226     systems, please let us know.  Thanks.
0227 
0228 30. Is there some simpler, easier to read version of inflate I can look at to
0229     understand the deflate format?
0230 
0231     First off, you should read RFC 1951.  Second, yes.  Look in zlib's
0232     contrib/puff directory.
0233 
0234 31. Does zlib infringe on any patents?
0235 
0236     As far as we know, no.  In fact, that was originally the whole point behind
0237     zlib.  Look here for some more information:
0238 
0239     http://www.gzip.org/#faq11
0240 
0241 32. Can zlib work with greater than 4 GB of data?
0242 
0243     Yes.  inflate() and deflate() will process any amount of data correctly.
0244     Each call of inflate() or deflate() is limited to input and output chunks
0245     of the maximum value that can be stored in the compiler's "unsigned int"
0246     type, but there is no limit to the number of chunks.  Note however that the
0247     strm.total_in and strm_total_out counters may be limited to 4 GB.  These
0248     counters are provided as a convenience and are not used internally by
0249     inflate() or deflate().  The application can easily set up its own counters
0250     updated after each call of inflate() or deflate() to count beyond 4 GB.
0251     compress() and uncompress() may be limited to 4 GB, since they operate in a
0252     single call.  gzseek() and gztell() may be limited to 4 GB depending on how
0253     zlib is compiled.  See the zlibCompileFlags() function in zlib.h.
0254 
0255     The word "may" appears several times above since there is a 4 GB limit only
0256     if the compiler's "long" type is 32 bits.  If the compiler's "long" type is
0257     64 bits, then the limit is 16 exabytes.
0258 
0259 33. Does zlib have any security vulnerabilities?
0260 
0261     The only one that we are aware of is potentially in gzprintf().  If zlib is
0262     compiled to use sprintf() or vsprintf(), then there is no protection
0263     against a buffer overflow of an 8K string space (or other value as set by
0264     gzbuffer()), other than the caller of gzprintf() assuring that the output
0265     will not exceed 8K.  On the other hand, if zlib is compiled to use
0266     snprintf() or vsnprintf(), which should normally be the case, then there is
0267     no vulnerability.  The ./configure script will display warnings if an
0268     insecure variation of sprintf() will be used by gzprintf().  Also the
0269     zlibCompileFlags() function will return information on what variant of
0270     sprintf() is used by gzprintf().
0271 
0272     If you don't have snprintf() or vsnprintf() and would like one, you can
0273     find a portable implementation here:
0274 
0275         http://www.ijs.si/software/snprintf/
0276 
0277     Note that you should be using the most recent version of zlib.  Versions
0278     1.1.3 and before were subject to a double-free vulnerability, and versions
0279     1.2.1 and 1.2.2 were subject to an access exception when decompressing
0280     invalid compressed data.
0281 
0282 34. Is there a Java version of zlib?
0283 
0284     Probably what you want is to use zlib in Java. zlib is already included
0285     as part of the Java SDK in the java.util.zip package. If you really want
0286     a version of zlib written in the Java language, look on the zlib home
0287     page for links: http://zlib.net/ .
0288 
0289 35. I get this or that compiler or source-code scanner warning when I crank it
0290     up to maximally-pedantic. Can't you guys write proper code?
0291 
0292     Many years ago, we gave up attempting to avoid warnings on every compiler
0293     in the universe.  It just got to be a waste of time, and some compilers
0294     were downright silly as well as contradicted each other.  So now, we simply
0295     make sure that the code always works.
0296 
0297 36. Valgrind (or some similar memory access checker) says that deflate is
0298     performing a conditional jump that depends on an uninitialized value.
0299     Isn't that a bug?
0300 
0301     No.  That is intentional for performance reasons, and the output of deflate
0302     is not affected.  This only started showing up recently since zlib 1.2.x
0303     uses malloc() by default for allocations, whereas earlier versions used
0304     calloc(), which zeros out the allocated memory.  Even though the code was
0305     correct, versions 1.2.4 and later was changed to not stimulate these
0306     checkers.
0307 
0308 37. Will zlib read the (insert any ancient or arcane format here) compressed
0309     data format?
0310 
0311     Probably not. Look in the comp.compression FAQ for pointers to various
0312     formats and associated software.
0313 
0314 38. How can I encrypt/decrypt zip files with zlib?
0315 
0316     zlib doesn't support encryption.  The original PKZIP encryption is very
0317     weak and can be broken with freely available programs.  To get strong
0318     encryption, use GnuPG, http://www.gnupg.org/ , which already includes zlib
0319     compression.  For PKZIP compatible "encryption", look at
0320     http://www.info-zip.org/
0321 
0322 39. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings?
0323 
0324     "gzip" is the gzip format, and "deflate" is the zlib format.  They should
0325     probably have called the second one "zlib" instead to avoid confusion with
0326     the raw deflate compressed data format.  While the HTTP 1.1 RFC 2616
0327     correctly points to the zlib specification in RFC 1950 for the "deflate"
0328     transfer encoding, there have been reports of servers and browsers that
0329     incorrectly produce or expect raw deflate data per the deflate
0330     specification in RFC 1951, most notably Microsoft.  So even though the
0331     "deflate" transfer encoding using the zlib format would be the more
0332     efficient approach (and in fact exactly what the zlib format was designed
0333     for), using the "gzip" transfer encoding is probably more reliable due to
0334     an unfortunate choice of name on the part of the HTTP 1.1 authors.
0335 
0336     Bottom line: use the gzip format for HTTP 1.1 encoding.
0337 
0338 40. Does zlib support the new "Deflate64" format introduced by PKWare?
0339 
0340     No.  PKWare has apparently decided to keep that format proprietary, since
0341     they have not documented it as they have previous compression formats.  In
0342     any case, the compression improvements are so modest compared to other more
0343     modern approaches, that it's not worth the effort to implement.
0344 
0345 41. I'm having a problem with the zip functions in zlib, can you help?
0346 
0347     There are no zip functions in zlib.  You are probably using minizip by
0348     Giles Vollant, which is found in the contrib directory of zlib.  It is not
0349     part of zlib.  In fact none of the stuff in contrib is part of zlib.  The
0350     files in there are not supported by the zlib authors.  You need to contact
0351     the authors of the respective contribution for help.
0352 
0353 42. The match.asm code in contrib is under the GNU General Public License.
0354     Since it's part of zlib, doesn't that mean that all of zlib falls under the
0355     GNU GPL?
0356 
0357     No.  The files in contrib are not part of zlib.  They were contributed by
0358     other authors and are provided as a convenience to the user within the zlib
0359     distribution.  Each item in contrib has its own license.
0360 
0361 43. Is zlib subject to export controls?  What is its ECCN?
0362 
0363     zlib is not subject to export controls, and so is classified as EAR99.
0364 
0365 44. Can you please sign these lengthy legal documents and fax them back to us
0366     so that we can use your software in our product?
0367 
0368     No. Go away. Shoo.