misc/libphysfs/physfs_miniz.h
changeset 12213 bb5522e88ab2
parent 10017 de822cd3df3a
equal deleted inserted replaced
12212:ea891871f481 12213:bb5522e88ab2
     1 /* tinfl.c v1.11 - public domain inflate with zlib header parsing/adler32 checking (inflate-only subset of miniz.c)
     1 /* tinfl.c v1.11 - public domain inflate with zlib header parsing/adler32 checking (inflate-only subset of miniz.c)
     2    See "unlicense" statement at the end of this file.
     2    See "unlicense" statement at the end of this file.
     3    Rich Geldreich <richgel99@gmail.com>, last updated May 20, 2011
     3    Rich Geldreich <richgel99@gmail.com>, last updated May 20, 2011
     4    Implements RFC 1950: http://www.ietf.org/rfc/rfc1950.txt and RFC 1951: http://www.ietf.org/rfc/rfc1951.txt
     4    Implements RFC 1950: https://www.ietf.org/rfc/rfc1950.txt and RFC 1951: https://www.ietf.org/rfc/rfc1951.txt
     5 
     5 
     6    The entire decompressor coroutine is implemented in tinfl_decompress(). The other functions are optional high-level helpers.
     6    The entire decompressor coroutine is implemented in tinfl_decompress(). The other functions are optional high-level helpers.
     7 */
     7 */
     8 #ifndef TINFL_HEADER_INCLUDED
     8 #ifndef TINFL_HEADER_INCLUDED
     9 #define TINFL_HEADER_INCLUDED
     9 #define TINFL_HEADER_INCLUDED
    10 
    10 
    11 typedef PHYSFS_uint8 mz_uint8;
    11 typedef PHYSFS_uint8 mz_uint8;
    12 typedef PHYSFS_sint16 mz_int16;
    12 typedef PHYSFS_sint16 mz_int16;
    13 typedef PHYSFS_uint16 mz_uint16;
    13 typedef PHYSFS_uint16 mz_uint16;
    14 typedef PHYSFS_uint32 mz_uint32;
    14 typedef PHYSFS_uint32 mz_uint32;
    15 typedef unsigned int mz_uint;
    15 typedef unsigned int mz_uint; 
    16 typedef PHYSFS_uint64 mz_uint64;
    16 typedef PHYSFS_uint64 mz_uint64;
    17 
    17 
    18 /* For more compatibility with zlib, miniz.c uses unsigned long for some parameters/struct members. */
    18 /* For more compatibility with zlib, miniz.c uses unsigned long for some parameters/struct members. */
    19 typedef unsigned long mz_ulong;
    19 typedef unsigned long mz_ulong;
    20 
    20 
   264     {
   264     {
   265       if (r->m_type == 1)
   265       if (r->m_type == 1)
   266       {
   266       {
   267         mz_uint8 *p = r->m_tables[0].m_code_size; mz_uint i;
   267         mz_uint8 *p = r->m_tables[0].m_code_size; mz_uint i;
   268         r->m_table_sizes[0] = 288; r->m_table_sizes[1] = 32; TINFL_MEMSET(r->m_tables[1].m_code_size, 5, 32);
   268         r->m_table_sizes[0] = 288; r->m_table_sizes[1] = 32; TINFL_MEMSET(r->m_tables[1].m_code_size, 5, 32);
   269         for ( i = 0; i <= 143; ++i) *p++ = 8; for ( ; i <= 255; ++i) *p++ = 9; for ( ; i <= 279; ++i) *p++ = 7; for ( ; i <= 287; ++i) *p++ = 8;
   269         for ( i = 0; i <= 143; ++i) *p++ = 8;
       
   270         for ( ; i <= 255; ++i) *p++ = 9;
       
   271         for ( ; i <= 279; ++i) *p++ = 7;
       
   272         for ( ; i <= 287; ++i) *p++ = 8;
   270       }
   273       }
   271       else
   274       else
   272       {
   275       {
   273         for (counter = 0; counter < 3; counter++) { TINFL_GET_BITS(11, r->m_table_sizes[counter], "\05\05\04"[counter]); r->m_table_sizes[counter] += s_min_table_sizes[counter]; }
   276         for (counter = 0; counter < 3; counter++) { TINFL_GET_BITS(11, r->m_table_sizes[counter], "\05\05\04"[counter]); r->m_table_sizes[counter] += s_min_table_sizes[counter]; }
   274         MZ_CLEAR_OBJ(r->m_tables[2].m_code_size); for (counter = 0; counter < r->m_table_sizes[2]; counter++) { mz_uint s; TINFL_GET_BITS(14, s, 3); r->m_tables[2].m_code_size[s_length_dezigzag[counter]] = (mz_uint8)s; }
   277         MZ_CLEAR_OBJ(r->m_tables[2].m_code_size); for (counter = 0; counter < r->m_table_sizes[2]; counter++) { mz_uint s; TINFL_GET_BITS(14, s, 3); r->m_tables[2].m_code_size[s_length_dezigzag[counter]] = (mz_uint8)s; }
   668   #define Z_VERSION_ERROR       MZ_VERSION_ERROR
   671   #define Z_VERSION_ERROR       MZ_VERSION_ERROR
   669   #define MAX_WBITS             15
   672   #define MAX_WBITS             15
   670 
   673 
   671 #endif /* #ifndef TINFL_HEADER_FILE_ONLY */
   674 #endif /* #ifndef TINFL_HEADER_FILE_ONLY */
   672 
   675 
   673 /*
   676 /* 
   674   This is free and unencumbered software released into the public domain.
   677   This is free and unencumbered software released into the public domain.
   675 
   678 
   676   Anyone is free to copy, modify, publish, use, compile, sell, or
   679   Anyone is free to copy, modify, publish, use, compile, sell, or
   677   distribute this software, either in source code form or as a compiled
   680   distribute this software, either in source code form or as a compiled
   678   binary, for any purpose, commercial or non-commercial, and by any
   681   binary, for any purpose, commercial or non-commercial, and by any
   692   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
   695   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
   693   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
   696   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
   694   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
   697   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
   695   OTHER DEALINGS IN THE SOFTWARE.
   698   OTHER DEALINGS IN THE SOFTWARE.
   696 
   699 
   697   For more information, please refer to <http://unlicense.org/>
   700   For more information, please refer to <https://unlicense.org/>
   698 */
   701 */