-/*****************************************************************************/
-/* */
-/* zlib.h */
-/* */
-/* Decompression routines for the 'deflate' format */
-/* */
-/* */
-/* */
-/* (C) 2000-2001 Piotr Fusik */
-/* a.k.a. Fox/Taquart */
-/* EMail: fox@scene.pl */
-/* */
-/* */
-/* This software is provided 'as-is', without any expressed or implied */
-/* warranty. In no event will the authors be held liable for any damages */
-/* arising from the use of this software. */
-/* */
-/* Permission is granted to anyone to use this software for any purpose, */
-/* including commercial applications, and to alter it and redistribute it */
-/* freely, subject to the following restrictions: */
-/* */
-/* 1. The origin of this software must not be misrepresented; you must not */
-/* claim that you wrote the original software. If you use this software */
-/* in a product, an acknowledgment in the product documentation would be */
-/* appreciated but is not required. */
-/* 2. Altered source versions must be plainly marked as such, and must not */
-/* be misrepresented as being the original software. */
-/* 3. This notice may not be removed or altered from any source */
-/* distribution. */
-/* */
-/*****************************************************************************/
-
-
-
-#ifndef _ZLIB_H
-#define _ZLIB_H
-
-
-
-void* inflatemem (void* dest, void* src);
-/* Read the deflate compressed data starting from src and store
- * the uncompressed data starting from dest.
- * Return pointer to a byte after the decompressed data. That is, the result
- * minus dest is the size of the decompressed data.
- */
-
-
-
-/* end of zlib.h */
-#endif
-
-
-
+/*****************************************************************************/\r
+/* */\r
+/* zlib.h */\r
+/* */\r
+/* Decompression routines for the 'deflate' format */\r
+/* */\r
+/* */\r
+/* */\r
+/* (C) 2000-2001 Piotr Fusik <fox@scene.pl> */\r
+/* */\r
+/* This file is based on the zlib.h from 'zlib' general purpose compression */\r
+/* library, version 1.1.3, (C) 1995-1998 Jean-loup Gailly and Mark Adler. */\r
+/* */\r
+/* Jean-loup Gailly Mark Adler */\r
+/* jloup@gzip.org madler@alumni.caltech.edu */\r
+/* */\r
+/* This software is provided 'as-is', without any expressed or implied */\r
+/* warranty. In no event will the authors be held liable for any damages */\r
+/* arising from the use of this software. */\r
+/* */\r
+/* Permission is granted to anyone to use this software for any purpose, */\r
+/* including commercial applications, and to alter it and redistribute it */\r
+/* freely, subject to the following restrictions: */\r
+/* */\r
+/* 1. The origin of this software must not be misrepresented; you must not */\r
+/* claim that you wrote the original software. If you use this software */\r
+/* in a product, an acknowledgment in the product documentation would be */\r
+/* appreciated but is not required. */\r
+/* 2. Altered source versions must be plainly marked as such, and must not */\r
+/* be misrepresented as being the original software. */\r
+/* 3. This notice may not be removed or altered from any source */\r
+/* distribution. */\r
+/* */\r
+/*****************************************************************************/\r
+\r
+\r
+\r
+#ifndef _ZLIB_H\r
+#define _ZLIB_H\r
+\r
+#define Z_OK 0\r
+#define Z_DATA_ERROR (-3)\r
+/* Return codes for uncompress() */\r
+\r
+#define Z_DEFLATED 8\r
+/* The deflate compression method (the only one supported) */\r
+\r
+#define Z_NULL 0\r
+\r
+\r
+unsigned __fastcall__ inflatemem (char* dest, const char* source);\r
+/*\r
+ Decompresses the source buffer into the destination buffer.\r
+ Returns the size of the uncompressed data (number of bytes written starting\r
+ from dest).\r
+\r
+ This function expects data in the DEFLATE format, described in RFC\r
+ (Request for Comments) 1951 in the file\r
+ ftp://ds.internic.net/rfc/rfc1951.txt.\r
+\r
+ This function does not exist in the original zlib. Its implementation\r
+ using original zlib might be following:\r
+\r
+ unsigned inflatemem (char* dest, const char* source)\r
+ {\r
+ z_stream stream;\r
+\r
+ stream.next_in = (Bytef*) source;\r
+ stream.avail_in = 65535;\r
+\r
+ stream.next_out = dest;\r
+ stream.avail_out = 65535;\r
+\r
+ stream.zalloc = (alloc_func) 0;\r
+ stream.zfree = (free_func) 0;\r
+\r
+ inflateInit2(&stream, -MAX_WBITS);\r
+ inflate(&stream, Z_FINISH);\r
+ inflateEnd(&stream);\r
+\r
+ return stream.total_out;\r
+ }\r
+*/\r
+\r
+\r
+int uncompress (char* dest, unsigned* destLen,\r
+ const char* source, unsigned sourceLen);\r
+/*\r
+ Original zlib description:\r
+\r
+ Decompresses the source buffer into the destination buffer. sourceLen is\r
+ the byte length of the source buffer. Upon entry, destLen is the total\r
+ size of the destination buffer, which must be large enough to hold the\r
+ entire uncompressed data. (The size of the uncompressed data must have\r
+ been saved previously by the compressor and transmitted to the decompressor\r
+ by some mechanism outside the scope of this compression library.)\r
+ Upon exit, destLen is the actual size of the compressed buffer.\r
+ This function can be used to decompress a whole file at once if the\r
+ input file is mmap'ed.\r
+\r
+ uncompress returns Z_OK if success, Z_MEM_ERROR if there was not\r
+ enough memory, Z_BUF_ERROR if there was not enough room in the output\r
+ buffer, or Z_DATA_ERROR if the input data was corrupted.\r
+\r
+ Implementation notes:\r
+\r
+ This function expects data in the ZLIB format, described in RFC 1950\r
+ in the file ftp://ds.internic.net/rfc/rfc1950.txt. The ZLIB format is\r
+ essentially the DEFLATE format plus a very small header and Adler-32\r
+ checksum.\r
+\r
+ Z_MEM_ERROR and Z_BUF_ERROR are never returned in this implementation.\r
+*/\r
+\r
+\r
+unsigned long __fastcall__ adler32 (unsigned long adler, const char* buf,\r
+ unsigned len);\r
+\r
+/*\r
+ Original zlib description:\r
+\r
+ Update a running Adler-32 checksum with the bytes buf[0..len-1] and\r
+ return the updated checksum. If buf is NULL, this function returns\r
+ the required initial value for the checksum.\r
+ An Adler-32 checksum is almost as reliable as a CRC32 but can be computed\r
+ much faster. Usage example:\r
+\r
+ unsigned long adler = adler32(0L, Z_NULL, 0);\r
+\r
+ while (read_buffer(buffer, length) != EOF) {\r
+ adler = adler32(adler, buffer, length);\r
+ }\r
+ if (adler != original_adler) error();\r
+\r
+ Implementation notes:\r
+\r
+ This function isn't actually much faster than crc32(), but it is smaller\r
+ and does not use any lookup tables.\r
+*/\r
+\r
+\r
+unsigned long __fastcall__ crc32 (unsigned long crc, const char* buf,\r
+ unsigned len);\r
+/*\r
+ Original zlib description:\r
+\r
+ Update a running crc with the bytes buf[0..len-1] and return the updated\r
+ crc. If buf is NULL, this function returns the required initial value\r
+ for the crc. Pre- and post-conditioning (one's complement) is performed\r
+ within this function so it shouldn't be done by the application.\r
+ Usage example:\r
+\r
+ unsigned long crc = crc32(0L, Z_NULL, 0);\r
+\r
+ while (read_buffer(buffer, length) != EOF) {\r
+ crc = crc32(crc, buffer, length);\r
+ }\r
+ if (crc != original_crc) error();\r
+\r
+ Implementation notes:\r
+\r
+ This function uses statically allocated 1 KB lookup table. The table is\r
+ initialised before it is used for the first time (that is, if buffer is\r
+ NULL or length is zero, then the lookup table isn't initialised).\r
+*/\r
+\r
+\r
+/* end of zlib.h */\r
+#endif\r
+\r
+\r
+\r