packages feed

lzlib 1.0.7.3 → 1.0.7.4

raw patch · 14 files changed

+346/−347 lines, 14 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # lzlib +## 1.0.7.4++  * Bump C sources to lzlib 1.15+ ## 1.0.7.3    * Bump C sources to lzlib 1.14
cbits/cbuffer.c view
@@ -1,5 +1,5 @@ /* Lzlib - Compression library for the lzip format-   Copyright (C) 2009-2024 Antonio Diaz Diaz.+   Copyright (C) 2009-2025 Antonio Diaz Diaz.     This library is free software. Redistribution and use in source and    binary forms, with or without modification, are permitted provided@@ -17,15 +17,15 @@    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -struct Circular_buffer+typedef struct Circular_buffer   {   uint8_t * buffer;   unsigned buffer_size;		/* capacity == buffer_size - 1 */   unsigned get;			/* buffer is empty when get == put */   unsigned put;-  };+  } Circular_buffer; -static inline bool Cb_init( struct Circular_buffer * const cb,+static inline bool Cb_init( Circular_buffer * const cb,                             const unsigned buf_size )   {   cb->buffer_size = buf_size + 1;@@ -36,38 +36,36 @@   return cb->buffer != 0;   } -static inline void Cb_free( struct Circular_buffer * const cb )+static inline void Cb_free( Circular_buffer * const cb )   { free( cb->buffer ); cb->buffer = 0; } -static inline void Cb_reset( struct Circular_buffer * const cb )+static inline void Cb_reset( Circular_buffer * const cb )   { cb->get = 0; cb->put = 0; } -static inline unsigned Cb_empty( const struct Circular_buffer * const cb )+static inline unsigned Cb_empty( const Circular_buffer * const cb )   { return cb->get == cb->put; } -static inline unsigned Cb_used_bytes( const struct Circular_buffer * const cb )+static inline unsigned Cb_used_bytes( const Circular_buffer * const cb )   { return ( (cb->get <= cb->put) ? 0 : cb->buffer_size ) + cb->put - cb->get; } -static inline unsigned Cb_free_bytes( const struct Circular_buffer * const cb )+static inline unsigned Cb_free_bytes( const Circular_buffer * const cb )   { return ( (cb->get <= cb->put) ? cb->buffer_size : 0 ) - cb->put + cb->get - 1; } -static inline uint8_t Cb_get_byte( struct Circular_buffer * const cb )+static inline uint8_t Cb_get_byte( Circular_buffer * const cb )   {   const uint8_t b = cb->buffer[cb->get];   if( ++cb->get >= cb->buffer_size ) cb->get = 0;   return b;   } -static inline void Cb_put_byte( struct Circular_buffer * const cb,-                                const uint8_t b )+static inline void Cb_put_byte( Circular_buffer * const cb, const uint8_t b )   {   cb->buffer[cb->put] = b;   if( ++cb->put >= cb->buffer_size ) cb->put = 0;   }  -static bool Cb_unread_data( struct Circular_buffer * const cb,-                            const unsigned size )+static bool Cb_unread_data( Circular_buffer * const cb, const unsigned size )   {   if( size > Cb_free_bytes( cb ) ) return false;   if( cb->get >= size ) cb->get -= size;@@ -80,7 +78,7 @@    If 'out_buffer' is null, the bytes are discarded.    Return the number of bytes copied or discarded. */-static unsigned Cb_read_data( struct Circular_buffer * const cb,+static unsigned Cb_read_data( Circular_buffer * const cb,                               uint8_t * const out_buffer,                               const unsigned out_size )   {@@ -113,7 +111,7 @@ /* Copy up to 'in_size' bytes from 'in_buffer' and update 'put'.    Return the number of bytes copied. */-static unsigned Cb_write_data( struct Circular_buffer * const cb,+static unsigned Cb_write_data( Circular_buffer * const cb,                                const uint8_t * const in_buffer,                                const unsigned in_size )   {
cbits/decoder.c view
@@ -1,5 +1,5 @@ /* Lzlib - Compression library for the lzip format-   Copyright (C) 2009-2024 Antonio Diaz Diaz.+   Copyright (C) 2009-2025 Antonio Diaz Diaz.     This library is free software. Redistribution and use in source and    binary forms, with or without modification, are permitted provided@@ -17,7 +17,7 @@    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -static int LZd_try_check_trailer( struct LZ_decoder * const d )+static int LZd_try_check_trailer( LZ_decoder * const d )   {   Lzip_trailer trailer;   if( Rd_available_bytes( d->rdec ) < Lt_size )@@ -35,23 +35,24 @@  /* Return value: 0 = OK, 1 = decoder error, 2 = unexpected EOF,                  3 = trailer error, 4 = unknown marker found,-                 5 = library error. */-static int LZd_decode_member( struct LZ_decoder * const d )+                 5 = nonzero first LZMA byte found, 6 = library error. */+static int LZd_decode_member( LZ_decoder * const d )   {-  struct Range_decoder * const rdec = d->rdec;+  Range_decoder * const rdec = d->rdec;   State * const state = &d->state;-  /* unsigned old_mpos = rdec->member_position; */+  unsigned old_mpos = rdec->member_position;    if( d->member_finished ) return 0;-  if( !Rd_try_reload( rdec ) )-    { if( !rdec->at_stream_end ) return 0; else return 2; }+  const int tmp = Rd_try_reload( rdec );+  if( tmp > 1 ) return 5;+  if( !tmp ) { if( !rdec->at_stream_end ) return 0; else return 2; }   if( d->check_trailer_pending ) return LZd_try_check_trailer( d );    while( !Rd_finished( rdec ) )     {-    /* const unsigned mpos = rdec->member_position;-    if( mpos - old_mpos > rd_min_available_bytes ) return 5;-    old_mpos = mpos; */+    const unsigned mpos = rdec->member_position;+    if( mpos - old_mpos > rd_min_available_bytes ) return 6;+    old_mpos = mpos;     if( !Rd_enough_available_bytes( rdec ) )	/* check unexpected EOF */       { if( !rdec->at_stream_end ) return 0;         if( Cb_empty( &rdec->cb ) ) break; }	/* decode until EOF */@@ -74,7 +75,7 @@       if( Rd_decode_bit( rdec, &d->bm_rep0[*state] ) == 0 )	/* 3rd bit */         {         if( Rd_decode_bit( rdec, &d->bm_len[*state][pos_state] ) == 0 )	/* 4th bit */-          { *state = St_set_short_rep( *state );+          { *state = St_set_shortrep( *state );             LZd_put_byte( d, LZd_peek( d, d->rep0 ) ); continue; }         }       else@@ -116,9 +117,9 @@           if( distance == 0xFFFFFFFFU )		/* marker found */             {             Rd_normalize( rdec );-            /* const unsigned mpos = rdec->member_position;-            if( mpos - old_mpos > rd_min_available_bytes ) return 5;-            old_mpos = mpos; */+            const unsigned mpos = rdec->member_position;+            if( mpos - old_mpos > rd_min_available_bytes ) return 6;+            old_mpos = mpos;             if( len == min_match_len )		/* End Of Stream marker */               {               d->check_trailer_pending = true;@@ -127,7 +128,9 @@             if( len == min_match_len + 1 )	/* Sync Flush marker */               {               rdec->reload_pending = true;-              if( Rd_try_reload( rdec ) ) continue;+              const int tmp = Rd_try_reload( rdec );+              if( tmp > 1 ) return 5;+              if( tmp ) continue;               if( !rdec->at_stream_end ) return 0; else break;               }             return 4;
cbits/decoder.h view
@@ -1,5 +1,5 @@ /* Lzlib - Compression library for the lzip format-   Copyright (C) 2009-2024 Antonio Diaz Diaz.+   Copyright (C) 2009-2025 Antonio Diaz Diaz.     This library is free software. Redistribution and use in source and    binary forms, with or without modification, are permitted provided@@ -19,17 +19,17 @@  enum { rd_min_available_bytes = 10 }; -struct Range_decoder+typedef struct Range_decoder   {-  struct Circular_buffer cb;		/* input buffer */+  Circular_buffer cb;			/* input buffer */   unsigned long long member_position;   uint32_t code;   uint32_t range;   bool at_stream_end;   bool reload_pending;-  };+  } Range_decoder; -static inline bool Rd_init( struct Range_decoder * const rdec )+static inline bool Rd_init( Range_decoder * const rdec )   {   if( !Cb_init( &rdec->cb, 65536 + rd_min_available_bytes ) ) return false;   rdec->member_position = 0;@@ -40,25 +40,25 @@   return true;   } -static inline void Rd_free( struct Range_decoder * const rdec )+static inline void Rd_free( Range_decoder * const rdec )   { Cb_free( &rdec->cb ); } -static inline bool Rd_finished( const struct Range_decoder * const rdec )+static inline bool Rd_finished( const Range_decoder * const rdec )   { return rdec->at_stream_end && Cb_empty( &rdec->cb ); } -static inline void Rd_finish( struct Range_decoder * const rdec )+static inline void Rd_finish( Range_decoder * const rdec )   { rdec->at_stream_end = true; } -static inline bool Rd_enough_available_bytes( const struct Range_decoder * const rdec )+static inline bool Rd_enough_available_bytes( const Range_decoder * const rdec )   { return Cb_used_bytes( &rdec->cb ) >= rd_min_available_bytes; } -static inline unsigned Rd_available_bytes( const struct Range_decoder * const rdec )+static inline unsigned Rd_available_bytes( const Range_decoder * const rdec )   { return Cb_used_bytes( &rdec->cb ); } -static inline unsigned Rd_free_bytes( const struct Range_decoder * const rdec )+static inline unsigned Rd_free_bytes( const Range_decoder * const rdec )   { return rdec->at_stream_end ? 0 : Cb_free_bytes( &rdec->cb ); } -static inline unsigned long long Rd_purge( struct Range_decoder * const rdec )+static inline unsigned long long Rd_purge( Range_decoder * const rdec )   {   const unsigned long long size =     rdec->member_position + Cb_used_bytes( &rdec->cb );@@ -67,7 +67,7 @@   return size;   } -static inline void Rd_reset( struct Range_decoder * const rdec )+static inline void Rd_reset( Range_decoder * const rdec )   { Cb_reset( &rdec->cb );     rdec->member_position = 0; rdec->at_stream_end = false; } @@ -75,7 +75,7 @@ /* Seek for a member header and update 'get'. Set '*skippedp' to the number    of bytes skipped. Return true if a valid header is found. */-static bool Rd_find_header( struct Range_decoder * const rdec,+static bool Rd_find_header( Range_decoder * const rdec,                             unsigned * const skippedp )   {   *skippedp = 0;@@ -101,14 +101,14 @@   }  -static inline int Rd_write_data( struct Range_decoder * const rdec,+static inline int Rd_write_data( Range_decoder * const rdec,                                  const uint8_t * const inbuf, const int size )   {   if( rdec->at_stream_end || size <= 0 ) return 0;   return Cb_write_data( &rdec->cb, inbuf, size );   } -static inline uint8_t Rd_get_byte( struct Range_decoder * const rdec )+static inline uint8_t Rd_get_byte( Range_decoder * const rdec )   {   /* 0xFF avoids decoder error if member is truncated at EOS marker */   if( Rd_finished( rdec ) ) return 0xFF;@@ -116,7 +116,7 @@   return Cb_get_byte( &rdec->cb );   } -static inline int Rd_read_data( struct Range_decoder * const rdec,+static inline int Rd_read_data( Range_decoder * const rdec,                                 uint8_t * const outbuf, const int size )   {   const int sz = Cb_read_data( &rdec->cb, outbuf, size );@@ -124,7 +124,7 @@   return sz;   } -static inline bool Rd_unread_data( struct Range_decoder * const rdec,+static inline bool Rd_unread_data( Range_decoder * const rdec,                                    const unsigned size )   {   if( size > rdec->member_position || !Cb_unread_data( &rdec->cb, size ) )@@ -133,13 +133,15 @@   return true;   } -static bool Rd_try_reload( struct Range_decoder * const rdec )+static int Rd_try_reload( Range_decoder * const rdec )   {   if( rdec->reload_pending && Rd_available_bytes( rdec ) >= 5 )     {     rdec->reload_pending = false;     rdec->code = 0;     rdec->range = 0xFFFFFFFFU;+    /* check first byte of the LZMA stream without reading it */+    if( rdec->cb.buffer[rdec->cb.get] != 0 ) return 2;     Rd_get_byte( rdec );	/* discard first byte of the LZMA stream */     int i; for( i = 0; i < 4; ++i )       rdec->code = (rdec->code << 8) | Rd_get_byte( rdec );@@ -147,13 +149,13 @@   return !rdec->reload_pending;   } -static inline void Rd_normalize( struct Range_decoder * const rdec )+static inline void Rd_normalize( Range_decoder * const rdec )   {   if( rdec->range <= 0x00FFFFFFU )     { rdec->range <<= 8; rdec->code = (rdec->code << 8) | Rd_get_byte( rdec ); }   } -static inline unsigned Rd_decode( struct Range_decoder * const rdec,+static inline unsigned Rd_decode( Range_decoder * const rdec,                                   const int num_bits )   {   unsigned symbol = 0;@@ -164,14 +166,14 @@     rdec->range >>= 1; /*    symbol <<= 1; */ /*    if( rdec->code >= rdec->range ) { rdec->code -= rdec->range; symbol |= 1; } */-    const bool bit = ( rdec->code >= rdec->range );+    const bool bit = rdec->code >= rdec->range;     symbol <<= 1; symbol += bit;     rdec->code -= rdec->range & ( 0U - bit );     }   return symbol;   } -static inline unsigned Rd_decode_bit( struct Range_decoder * const rdec,+static inline unsigned Rd_decode_bit( Range_decoder * const rdec,                                       Bit_model * const probability )   {   Rd_normalize( rdec );@@ -191,7 +193,7 @@     }   } -static inline void Rd_decode_symbol_bit( struct Range_decoder * const rdec,+static inline void Rd_decode_symbol_bit( Range_decoder * const rdec,                          Bit_model * const probability, unsigned * symbol )   {   Rd_normalize( rdec );@@ -211,7 +213,7 @@     }   } -static inline void Rd_decode_symbol_bit_reversed( struct Range_decoder * const rdec,+static inline void Rd_decode_symbol_bit_reversed( Range_decoder * const rdec,                          Bit_model * const probability, unsigned * model,                          unsigned * symbol, const int i )   {@@ -233,7 +235,7 @@     }   } -static inline unsigned Rd_decode_tree6( struct Range_decoder * const rdec,+static inline unsigned Rd_decode_tree6( Range_decoder * const rdec,                                         Bit_model bm[] )   {   unsigned symbol = 1;@@ -246,7 +248,7 @@   return symbol & 0x3F;   } -static inline unsigned Rd_decode_tree8( struct Range_decoder * const rdec,+static inline unsigned Rd_decode_tree8( Range_decoder * const rdec,                                         Bit_model bm[] )   {   unsigned symbol = 1;@@ -262,7 +264,7 @@   }  static inline unsigned-Rd_decode_tree_reversed( struct Range_decoder * const rdec,+Rd_decode_tree_reversed( Range_decoder * const rdec,                          Bit_model bm[], const int num_bits )   {   unsigned model = 1;@@ -274,7 +276,7 @@   }  static inline unsigned-Rd_decode_tree_reversed4( struct Range_decoder * const rdec, Bit_model bm[] )+Rd_decode_tree_reversed4( Range_decoder * const rdec, Bit_model bm[] )   {   unsigned model = 1;   unsigned symbol = 0;@@ -285,7 +287,7 @@   return symbol;   } -static inline unsigned Rd_decode_matched( struct Range_decoder * const rdec,+static inline unsigned Rd_decode_matched( Range_decoder * const rdec,                                           Bit_model bm[], unsigned match_byte )   {   unsigned symbol = 1;@@ -300,8 +302,8 @@     }   } -static inline unsigned Rd_decode_len( struct Range_decoder * const rdec,-                                      struct Len_model * const lm,+static inline unsigned Rd_decode_len( Range_decoder * const rdec,+                                      Len_model * const lm,                                       const int pos_state )   {   Bit_model * bm;@@ -327,11 +329,11 @@  enum { lzd_min_free_bytes = max_match_len }; -struct LZ_decoder+typedef struct LZ_decoder   {-  struct Circular_buffer cb;+  Circular_buffer cb;   unsigned long long partial_data_pos;-  struct Range_decoder * rdec;+  Range_decoder * rdec;   unsigned dictionary_size;   uint32_t crc;   bool check_trailer_pending;@@ -354,25 +356,25 @@   Bit_model bm_dis[modeled_distances-end_dis_model+1];   Bit_model bm_align[dis_align_size]; -  struct Len_model match_len_model;-  struct Len_model rep_len_model;-  };+  Len_model match_len_model;+  Len_model rep_len_model;+  } LZ_decoder; -static inline bool LZd_enough_free_bytes( const struct LZ_decoder * const d )+static inline bool LZd_enough_free_bytes( const LZ_decoder * const d )   { return Cb_free_bytes( &d->cb ) >= lzd_min_free_bytes; } -static inline uint8_t LZd_peek_prev( const struct LZ_decoder * const d )+static inline uint8_t LZd_peek_prev( const LZ_decoder * const d )   { return d->cb.buffer[((d->cb.put > 0) ? d->cb.put : d->cb.buffer_size)-1]; } -static inline uint8_t LZd_peek( const struct LZ_decoder * const d,+static inline uint8_t LZd_peek( const LZ_decoder * const d,                                 const unsigned distance )   {-  const unsigned i = ( ( d->cb.put > distance ) ? 0 : d->cb.buffer_size ) ++  const unsigned i = ( (d->cb.put > distance) ? 0 : d->cb.buffer_size ) +                      d->cb.put - distance - 1;   return d->cb.buffer[i];   } -static inline void LZd_put_byte( struct LZ_decoder * const d, const uint8_t b )+static inline void LZd_put_byte( LZ_decoder * const d, const uint8_t b )   {   CRC32_update_byte( &d->crc, b );   d->cb.buffer[d->cb.put] = b;@@ -380,21 +382,21 @@     { d->partial_data_pos += d->cb.put; d->cb.put = 0; d->pos_wrapped = true; }   } -static inline void LZd_copy_block( struct LZ_decoder * const d,+static inline void LZd_copy_block( LZ_decoder * const d,                                    const unsigned distance, unsigned len )   {   unsigned lpos = d->cb.put, i = lpos - distance - 1;   bool fast, fast2;   if( lpos > distance )     {-    fast = ( len < d->cb.buffer_size - lpos );-    fast2 = ( fast && len <= lpos - i );+    fast = len < d->cb.buffer_size - lpos;+    fast2 = fast && len <= lpos - i;     }   else     {     i += d->cb.buffer_size;-    fast = ( len < d->cb.buffer_size - i );	/* (i == pos) may happen */-    fast2 = ( fast && len <= i - lpos );+    fast = len < d->cb.buffer_size - i;		/* (i == pos) may happen */+    fast2 = fast && len <= i - lpos;     }   if( fast )					/* no wrap */     {@@ -413,8 +415,7 @@     }   } -static inline bool LZd_init( struct LZ_decoder * const d,-                             struct Range_decoder * const rde,+static inline bool LZd_init( LZ_decoder * const d, Range_decoder * const rde,                              const unsigned dict_size )   {   if( !Cb_init( &d->cb, max( 65536, dict_size ) + lzd_min_free_bytes ) )@@ -449,15 +450,14 @@   return true;   } -static inline void LZd_free( struct LZ_decoder * const d )-  { Cb_free( &d->cb ); }+static inline void LZd_free( LZ_decoder * const d ) { Cb_free( &d->cb ); } -static inline bool LZd_member_finished( const struct LZ_decoder * const d )+static inline bool LZd_member_finished( const LZ_decoder * const d )   { return d->member_finished && Cb_empty( &d->cb ); } -static inline unsigned LZd_crc( const struct LZ_decoder * const d )+static inline unsigned LZd_crc( const LZ_decoder * const d )   { return d->crc ^ 0xFFFFFFFFU; }  static inline unsigned long long-LZd_data_position( const struct LZ_decoder * const d )+LZd_data_position( const LZ_decoder * const d )   { return d->partial_data_pos + d->cb.put; }
cbits/encoder.c view
@@ -1,5 +1,5 @@ /* Lzlib - Compression library for the lzip format-   Copyright (C) 2009-2024 Antonio Diaz Diaz.+   Copyright (C) 2009-2025 Antonio Diaz Diaz.     This library is free software. Redistribution and use in source and    binary forms, with or without modification, are permitted provided@@ -17,7 +17,7 @@    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -static int LZe_get_match_pairs( struct LZ_encoder * const e, struct Pair * pairs )+static int LZe_get_match_pairs( LZ_encoder * const e, Pair * pairs )   {   int32_t * ptr0 = e->eb.mb.pos_array + ( e->eb.mb.cyclic_pos << 1 );   int32_t * ptr1 = ptr0 + 1;@@ -31,8 +31,8 @@    int maxlen = 3;			/* only used if pairs != 0 */   int num_pairs = 0;-  const int min_pos = ( e->eb.mb.pos > e->eb.mb.dictionary_size ) ?-                        e->eb.mb.pos - e->eb.mb.dictionary_size : 0;+  const int min_pos = (e->eb.mb.pos > e->eb.mb.dictionary_size) ?+                       e->eb.mb.pos - e->eb.mb.dictionary_size : 0;   const uint8_t * const data = Mb_ptr_to_current_pos( &e->eb.mb );    unsigned tmp = crc32[data[0]] ^ data[1];@@ -121,7 +121,7 @@   }  -static void LZe_update_distance_prices( struct LZ_encoder * const e )+static void LZe_update_distance_prices( LZ_encoder * const e )   {   int dis, len_state;   for( dis = start_dis_model; dis < modeled_distances; ++dis )@@ -160,7 +160,7 @@    ( trials[0].dis4 == -1 ) means literal.    A match/rep longer or equal than match_len_limit finishes the sequence. */-static int LZe_sequence_optimizer( struct LZ_encoder * const e,+static int LZe_sequence_optimizer( LZ_encoder * const e,                                    const int reps[num_rep_distances],                                    const State state )   {@@ -174,7 +174,7 @@     }   else     num_pairs = LZe_read_match_distances( e );-  const int main_len = ( num_pairs > 0 ) ? e->pairs[num_pairs-1].len : 0;+  const int main_len = (num_pairs > 0) ? e->pairs[num_pairs-1].len : 0;    int replens[num_rep_distances];   int rep_index = 0;@@ -270,7 +270,7 @@       }      const int num_pairs = LZe_read_match_distances( e );-    const int newlen = ( num_pairs > 0 ) ? e->pairs[num_pairs-1].len : 0;+    const int newlen = (num_pairs > 0) ? e->pairs[num_pairs-1].len : 0;     if( newlen >= e->match_len_limit )       {       e->pending_num_pairs = num_pairs;@@ -279,7 +279,7 @@       }      /* give final values to current trial */-    struct Trial * cur_trial = &e->trials[cur];+    Trial * cur_trial = &e->trials[cur];     State cur_state;     {     const int dis4 = cur_trial->dis4;@@ -291,7 +291,7 @@       cur_state = e->trials[prev_index].state;       if( prev_index + 1 == cur )			/* len == 1 */         {-        if( dis4 == 0 ) cur_state = St_set_short_rep( cur_state );+        if( dis4 == 0 ) cur_state = St_set_shortrep( cur_state );         else cur_state = St_set_char( cur_state );	/* literal */         }       else if( dis4 < num_rep_distances ) cur_state = St_set_rep( cur_state );@@ -324,7 +324,7 @@       next_price += LZeb_price_matched( &e->eb, prev_byte, cur_byte, match_byte );      /* try last updates to next trial */-    struct Trial * next_trial = &e->trials[cur+1];+    Trial * next_trial = &e->trials[cur+1];      Tr_update( next_trial, next_price, -1, cur );	/* literal */ @@ -466,12 +466,12 @@   }  -static bool LZe_encode_member( struct LZ_encoder * const e )+static bool LZe_encode_member( LZ_encoder * const e )   {-  const bool best = ( e->match_len_limit > 12 );+  const bool best = e->match_len_limit > 12;   const int dis_price_count = best ? 1 : 512;   const int align_price_count = best ? 1 : dis_align_size;-  const int price_count = ( e->match_len_limit > 36 ) ? 1013 : 4093;+  const int price_count = (e->match_len_limit > 36) ? 1013 : 4093;   int i;   State * const state = &e->eb.state; @@ -522,7 +522,7 @@       const int len = e->trials[i].price;       int dis = e->trials[i].dis4; -      bool bit = ( dis < 0 );+      bool bit = dis < 0;       Re_encode_bit( &e->eb.renc, &e->eb.bm_match[*state][pos_state], !bit );       if( bit )					/* literal byte */         {@@ -541,11 +541,11 @@         {         CRC32_update_buf( &e->eb.crc, Mb_ptr_to_current_pos( &e->eb.mb ) - ahead, len );         mtf_reps( dis, e->eb.reps );-        bit = ( dis < num_rep_distances );+        bit = dis < num_rep_distances;         Re_encode_bit( &e->eb.renc, &e->eb.bm_rep[*state], bit );         if( bit )				/* repeated match */           {-          bit = ( dis == 0 );+          bit = dis == 0;           Re_encode_bit( &e->eb.renc, &e->eb.bm_rep0[*state], !bit );           if( bit )             Re_encode_bit( &e->eb.renc, &e->eb.bm_len[*state][pos_state], len > 1 );@@ -555,7 +555,7 @@             if( dis > 1 )               Re_encode_bit( &e->eb.renc, &e->eb.bm_rep2[*state], dis > 2 );             }-          if( len == 1 ) *state = St_set_short_rep( *state );+          if( len == 1 ) *state = St_set_shortrep( *state );           else             {             Re_encode_len( &e->eb.renc, &e->eb.rep_len_model, len, pos_state );
cbits/encoder.h view
@@ -1,5 +1,5 @@ /* Lzlib - Compression library for the lzip format-   Copyright (C) 2009-2024 Antonio Diaz Diaz.+   Copyright (C) 2009-2025 Antonio Diaz Diaz.     This library is free software. Redistribution and use in source and    binary forms, with or without modification, are permitted provided@@ -17,16 +17,16 @@    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -struct Len_prices+typedef struct Len_prices   {-  const struct Len_model * lm;+  const Len_model * lm;   int len_symbols;   int count;   int prices[pos_states][max_len_symbols];   int counters[pos_states];			/* may decrement below 0 */-  };+  } Len_prices; -static inline void Lp_update_low_mid_prices( struct Len_prices * const lp,+static inline void Lp_update_low_mid_prices( Len_prices * const lp,                                              const int pos_state )   {   int * const pps = lp->prices[pos_state];@@ -41,7 +41,7 @@                price_symbol3( lp->lm->bm_mid[pos_state], len - len_low_symbols );     } -static inline void Lp_update_high_prices( struct Len_prices * const lp )+static inline void Lp_update_high_prices( Len_prices * const lp )   {   const int tmp = price1( lp->lm->choice1 ) + price1( lp->lm->choice2 );   int len;@@ -52,24 +52,23 @@       price_symbol8( lp->lm->bm_high, len - len_low_symbols - len_mid_symbols );   } -static inline void Lp_reset( struct Len_prices * const lp )+static inline void Lp_reset( Len_prices * const lp )   { int i; for( i = 0; i < pos_states; ++i ) lp->counters[i] = 0; } -static inline void Lp_init( struct Len_prices * const lp,-                            const struct Len_model * const lm,+static inline void Lp_init( Len_prices * const lp, const Len_model * const lm,                             const int match_len_limit )   {   lp->lm = lm;   lp->len_symbols = match_len_limit + 1 - min_match_len;-  lp->count = ( match_len_limit > 12 ) ? 1 : lp->len_symbols;+  lp->count = (match_len_limit > 12) ? 1 : lp->len_symbols;   Lp_reset( lp );   } -static inline void Lp_decrement_counter( struct Len_prices * const lp,+static inline void Lp_decrement_counter( Len_prices * const lp,                                          const int pos_state )   { --lp->counters[pos_state]; } -static inline void Lp_update_prices( struct Len_prices * const lp )+static inline void Lp_update_prices( Len_prices * const lp )   {   int pos_state;   bool high_pending = false;@@ -81,23 +80,23 @@     Lp_update_high_prices( lp );   } -static inline int Lp_price( const struct Len_prices * const lp,+static inline int Lp_price( const Len_prices * const lp,                             const int len, const int pos_state )   { return lp->prices[pos_state][len - min_match_len]; }  -struct Pair			/* distance-length pair */+typedef struct Pair		/* distance-length pair */   {   int dis;   int len;-  };+  } Pair;  enum { infinite_price = 0x0FFFFFFF,        max_num_trials = 1 << 13,        single_step_trial = -2,        dual_step_trial = -1 }; -struct Trial+typedef struct Trial   {   State state;   int price;		/* dual use var; cumulative price, match length */@@ -107,9 +106,9 @@ 			/*   -1  literal + rep0 */ 			/* >= 0  ( rep or match ) + literal + rep0 */   int reps[num_rep_distances];-  };+  } Trial; -static inline void Tr_update( struct Trial * const trial, const int pr,+static inline void Tr_update( Trial * const trial, const int pr,                               const int distance4, const int p_i )   {   if( pr < trial->price )@@ -117,7 +116,7 @@       trial->prev_index2 = single_step_trial; }   } -static inline void Tr_update2( struct Trial * const trial, const int pr,+static inline void Tr_update2( Trial * const trial, const int pr,                                const int p_i )   {   if( pr < trial->price )@@ -125,7 +124,7 @@       trial->prev_index2 = dual_step_trial; }   } -static inline void Tr_update3( struct Trial * const trial, const int pr,+static inline void Tr_update3( Trial * const trial, const int pr,                                const int distance4, const int p_i,                                const int p_i2 )   {@@ -135,16 +134,16 @@   }  -struct LZ_encoder+typedef struct LZ_encoder   {-  struct LZ_encoder_base eb;+  LZ_encoder_base eb;   int cycles;   int match_len_limit;-  struct Len_prices match_len_prices;-  struct Len_prices rep_len_prices;+  Len_prices match_len_prices;+  Len_prices rep_len_prices;   int pending_num_pairs;-  struct Pair pairs[max_match_len+1];-  struct Trial trials[max_num_trials];+  Pair pairs[max_match_len+1];+  Trial trials[max_num_trials];    int dis_slot_prices[len_states][2*max_dictionary_bits];   int dis_prices[len_states][modeled_distances];@@ -154,10 +153,9 @@   int dis_price_counter;   int align_price_counter;   bool been_flushed;-  };+  } LZ_encoder; -static inline bool Mb_dec_pos( struct Matchfinder_base * const mb,-                               const int ahead )+static inline bool Mb_dec_pos( Matchfinder_base * const mb, const int ahead )   {   if( ahead < 0 || mb->pos < ahead ) return false;   mb->pos -= ahead;@@ -166,7 +164,7 @@   return true;   } -static int LZe_get_match_pairs( struct LZ_encoder * const e, struct Pair * pairs );+static int LZe_get_match_pairs( LZ_encoder * const e, Pair * pairs );         /* move-to-front dis in/into reps; do nothing if( dis4 <= 0 ) */ static inline void mtf_reps( const int dis4, int reps[num_rep_distances] )@@ -184,13 +182,13 @@     }   } -static inline int LZeb_price_shortrep( const struct LZ_encoder_base * const eb,+static inline int LZeb_price_shortrep( const LZ_encoder_base * const eb,                                        const State state, const int pos_state )   {   return price0( eb->bm_rep0[state] ) + price0( eb->bm_len[state][pos_state] );   } -static inline int LZeb_price_rep( const struct LZ_encoder_base * const eb,+static inline int LZeb_price_rep( const LZ_encoder_base * const eb,                                   const int rep, const State state,                                   const int pos_state )   {@@ -207,7 +205,7 @@   return price;   } -static inline int LZe_price_rep0_len( const struct LZ_encoder * const e,+static inline int LZe_price_rep0_len( const LZ_encoder * const e,                                       const int len, const State state,                                       const int pos_state )   {@@ -215,7 +213,7 @@          Lp_price( &e->rep_len_prices, len, pos_state );   } -static inline int LZe_price_pair( const struct LZ_encoder * const e,+static inline int LZe_price_pair( const LZ_encoder * const e,                                   const int dis, const int len,                                   const int pos_state )   {@@ -228,7 +226,7 @@            e->align_prices[dis & (dis_align_size - 1)];   } -static inline int LZe_read_match_distances( struct LZ_encoder * const e )+static inline int LZe_read_match_distances( LZ_encoder * const e )   {   const int num_pairs = LZe_get_match_pairs( e, e->pairs );   if( num_pairs > 0 )@@ -241,7 +239,7 @@   return num_pairs;   } -static inline bool LZe_move_and_update( struct LZ_encoder * const e, int n )+static inline bool LZe_move_and_update( LZ_encoder * const e, int n )   {   while( true )     {@@ -252,13 +250,13 @@   return true;   } -static inline void LZe_backward( struct LZ_encoder * const e, int cur )+static inline void LZe_backward( LZ_encoder * const e, int cur )   {   int dis4 = e->trials[cur].dis4;   while( cur > 0 )     {     const int prev_index = e->trials[cur].prev_index;-    struct Trial * const prev_trial = &e->trials[prev_index];+    Trial * const prev_trial = &e->trials[prev_index];      if( e->trials[cur].prev_index2 != single_step_trial )       {@@ -267,7 +265,7 @@       prev_trial->prev_index2 = single_step_trial;       if( e->trials[cur].prev_index2 >= 0 )         {-        struct Trial * const prev_trial2 = &e->trials[prev_index-1];+        Trial * const prev_trial2 = &e->trials[prev_index-1];         prev_trial2->dis4 = dis4; dis4 = 0;			/* rep0 */         prev_trial2->prev_index = e->trials[cur].prev_index2;         prev_trial2->prev_index2 = single_step_trial;@@ -282,7 +280,7 @@ enum { num_prev_positions3 = 1 << 16,        num_prev_positions2 = 1 << 10 }; -static inline bool LZe_init( struct LZ_encoder * const e,+static inline bool LZe_init( LZ_encoder * const e,                              const int dict_size, const int len_limit,                              const unsigned long long member_size )   {@@ -297,7 +295,7 @@   if( !LZeb_init( &e->eb, before_size, dict_size, after_size, dict_factor,                   num_prev_positions23, pos_array_factor, min_free_bytes,                   member_size ) ) return false;-  e->cycles = ( len_limit < max_match_len ) ? 16 + ( len_limit / 2 ) : 256;+  e->cycles = (len_limit < max_match_len) ? 16 + ( len_limit / 2 ) : 256;   e->match_len_limit = len_limit;   Lp_init( &e->match_len_prices, &e->eb.match_len_model, e->match_len_limit );   Lp_init( &e->rep_len_prices, &e->eb.rep_len_model, e->match_len_limit );@@ -312,7 +310,7 @@   return true;   } -static inline void LZe_reset( struct LZ_encoder * const e,+static inline void LZe_reset( LZ_encoder * const e,                               const unsigned long long member_size )   {   LZeb_reset( &e->eb, member_size );
cbits/encoder_base.c view
@@ -1,5 +1,5 @@ /* Lzlib - Compression library for the lzip format-   Copyright (C) 2009-2024 Antonio Diaz Diaz.+   Copyright (C) 2009-2025 Antonio Diaz Diaz.     This library is free software. Redistribution and use in source and    binary forms, with or without modification, are permitted provided@@ -17,7 +17,7 @@    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -static bool Mb_normalize_pos( struct Matchfinder_base * const mb )+static bool Mb_normalize_pos( Matchfinder_base * const mb )   {   if( mb->pos > mb->stream_pos )     { mb->pos = mb->stream_pos; return false; }@@ -40,7 +40,7 @@   }  -static bool Mb_init( struct Matchfinder_base * const mb, const int before_size,+static bool Mb_init( Matchfinder_base * const mb, const int before_size,                      const int dict_size, const int after_size,                      const int dict_factor, const int num_prev_positions23,                      const int pos_array_factor )@@ -83,7 +83,7 @@   }  -static void Mb_adjust_array( struct Matchfinder_base * const mb )+static void Mb_adjust_array( Matchfinder_base * const mb )   {   int size = 1 << max( 16, real_bits( mb->dictionary_size - 1 ) - 2 );   if( mb->dictionary_size > 1 << 26 ) size >>= 1;	/* 64 MiB */@@ -94,7 +94,7 @@   }  -static void Mb_adjust_dictionary_size( struct Matchfinder_base * const mb )+static void Mb_adjust_dictionary_size( Matchfinder_base * const mb )   {   if( mb->stream_pos < mb->dictionary_size )     {@@ -105,7 +105,7 @@   }  -static void Mb_reset( struct Matchfinder_base * const mb )+static void Mb_reset( Matchfinder_base * const mb )   {   int i;   if( mb->stream_pos > mb->pos )@@ -124,11 +124,10 @@   /* End Of Stream marker => (dis == 0xFFFFFFFFU, len == min_match_len) */-static void LZeb_try_full_flush( struct LZ_encoder_base * const eb )+static void LZeb_try_full_flush( LZ_encoder_base * const eb )   {-  if( eb->member_finished ||-      Cb_free_bytes( &eb->renc.cb ) < max_marker_size + eb->renc.ff_count + Lt_size )-    return;+  if( eb->member_finished || Cb_free_bytes( &eb->renc.cb ) <+      max_marker_size + eb->renc.ff_count + Lt_size ) return;   eb->member_finished = true;   const int pos_state = Mb_data_position( &eb->mb ) & pos_state_mask;   const State state = eb->state;@@ -145,7 +144,7 @@   /* Sync Flush marker => (dis == 0xFFFFFFFFU, len == min_match_len + 1) */-static void LZeb_try_sync_flush( struct LZ_encoder_base * const eb )+static void LZeb_try_sync_flush( LZ_encoder_base * const eb )   {   const unsigned min_size = eb->renc.ff_count + max_marker_size;   if( eb->member_finished ||@@ -164,16 +163,14 @@   }  -static void LZeb_reset( struct LZ_encoder_base * const eb,+static void LZeb_reset( LZ_encoder_base * const eb,                         const unsigned long long member_size )   {   const unsigned long long min_member_size = min_dictionary_size;   const unsigned long long max_member_size = 0x0008000000000000ULL; /* 2 PiB */-  int i;   Mb_reset( &eb->mb );-  eb->member_size_limit =-    min( max( min_member_size, member_size ), max_member_size ) --    Lt_size - max_marker_size;+  eb->member_size_limit = min( max( min_member_size, member_size ),+                          max_member_size ) - Lt_size - max_marker_size;   eb->crc = 0xFFFFFFFFU;   Bm_array_init( eb->bm_literal[0], (1 << literal_context_bits) * 0x300 );   Bm_array_init( eb->bm_match[0], states * pos_states );@@ -188,7 +185,7 @@   Lm_init( &eb->match_len_model );   Lm_init( &eb->rep_len_model );   Re_reset( &eb->renc, eb->mb.dictionary_size );-  for( i = 0; i < num_rep_distances; ++i ) eb->reps[i] = 0;+  int i; for( i = 0; i < num_rep_distances; ++i ) eb->reps[i] = 0;   eb->state = 0;   eb->member_finished = false;   }
cbits/encoder_base.h view
@@ -1,5 +1,5 @@ /* Lzlib - Compression library for the lzip format-   Copyright (C) 2009-2024 Antonio Diaz Diaz.+   Copyright (C) 2009-2025 Antonio Diaz Diaz.     This library is free software. Redistribution and use in source and    binary forms, with or without modification, are permitted provided@@ -217,7 +217,7 @@   }  -struct Matchfinder_base+typedef struct Matchfinder_base   {   unsigned long long partial_data_pos;   uint8_t * buffer;		/* input buffer */@@ -238,52 +238,52 @@   int saved_dictionary_size;	/* dictionary_size restored by Mb_reset */   bool at_stream_end;		/* stream_pos shows real end of file */   bool sync_flush_pending;-  };+  } Matchfinder_base; -static bool Mb_normalize_pos( struct Matchfinder_base * const mb );+static bool Mb_normalize_pos( Matchfinder_base * const mb ); -static bool Mb_init( struct Matchfinder_base * const mb, const int before_size,+static bool Mb_init( Matchfinder_base * const mb, const int before_size,                      const int dict_size, const int after_size,                      const int dict_factor, const int num_prev_positions23,                      const int pos_array_factor ); -static inline void Mb_free( struct Matchfinder_base * const mb )+static inline void Mb_free( Matchfinder_base * const mb )   { free( mb->prev_positions ); free( mb->buffer ); } -static inline uint8_t Mb_peek( const struct Matchfinder_base * const mb,+static inline uint8_t Mb_peek( const Matchfinder_base * const mb,                                const int distance )   { return mb->buffer[mb->pos-distance]; } -static inline int Mb_available_bytes( const struct Matchfinder_base * const mb )+static inline int Mb_available_bytes( const Matchfinder_base * const mb )   { return mb->stream_pos - mb->pos; }  static inline unsigned long long-Mb_data_position( const struct Matchfinder_base * const mb )+Mb_data_position( const Matchfinder_base * const mb )   { return mb->partial_data_pos + mb->pos; } -static inline void Mb_finish( struct Matchfinder_base * const mb )+static inline void Mb_finish( Matchfinder_base * const mb )   { mb->at_stream_end = true; mb->sync_flush_pending = false; } -static inline bool Mb_data_finished( const struct Matchfinder_base * const mb )+static inline bool Mb_data_finished( const Matchfinder_base * const mb )   { return mb->at_stream_end && mb->pos >= mb->stream_pos; } -static inline bool Mb_flushing_or_end( const struct Matchfinder_base * const mb )+static inline bool Mb_flushing_or_end( const Matchfinder_base * const mb )   { return mb->at_stream_end || mb->sync_flush_pending; } -static inline int Mb_free_bytes( const struct Matchfinder_base * const mb )+static inline int Mb_free_bytes( const Matchfinder_base * const mb )   { if( Mb_flushing_or_end( mb ) ) return 0;     return mb->buffer_size - mb->stream_pos; }  static inline bool-Mb_enough_available_bytes( const struct Matchfinder_base * const mb )+Mb_enough_available_bytes( const Matchfinder_base * const mb )   { return mb->pos + mb->after_size <= mb->stream_pos ||            ( Mb_flushing_or_end( mb ) && mb->pos < mb->stream_pos ); }  static inline const uint8_t *-Mb_ptr_to_current_pos( const struct Matchfinder_base * const mb )+Mb_ptr_to_current_pos( const Matchfinder_base * const mb )   { return mb->buffer + mb->pos; } -static int Mb_write_data( struct Matchfinder_base * const mb,+static int Mb_write_data( Matchfinder_base * const mb,                           const uint8_t * const inbuf, const int size )   {   const int sz = min( mb->buffer_size - mb->stream_pos, size );@@ -293,7 +293,7 @@   return sz;   } -static inline int Mb_true_match_len( const struct Matchfinder_base * const mb,+static inline int Mb_true_match_len( const Matchfinder_base * const mb,                                      const int index, const int distance )   {   const uint8_t * const data = mb->buffer + mb->pos;@@ -303,7 +303,7 @@   return i;   } -static inline bool Mb_move_pos( struct Matchfinder_base * const mb )+static inline bool Mb_move_pos( Matchfinder_base * const mb )   {   if( ++mb->cyclic_pos > mb->dictionary_size ) mb->cyclic_pos = 0;   if( ++mb->pos >= mb->pos_limit ) return Mb_normalize_pos( mb );@@ -311,9 +311,9 @@   }  -struct Range_encoder+typedef struct Range_encoder   {-  struct Circular_buffer cb;+  Circular_buffer cb;   unsigned min_free_bytes;   uint64_t low;   unsigned long long partial_member_pos;@@ -321,13 +321,13 @@   unsigned ff_count;   uint8_t cache;   Lzip_header header;-  };+  } Range_encoder; -static inline void Re_shift_low( struct Range_encoder * const renc )+static inline void Re_shift_low( Range_encoder * const renc )   {   if( renc->low >> 24 != 0xFF )     {-    const bool carry = ( renc->low > 0xFFFFFFFFU );+    const bool carry = renc->low > 0xFFFFFFFFU;     Cb_put_byte( &renc->cb, renc->cache + carry );     for( ; renc->ff_count > 0; --renc->ff_count )       Cb_put_byte( &renc->cb, 0xFF + carry );@@ -337,7 +337,7 @@   renc->low = ( renc->low & 0x00FFFFFFU ) << 8;   } -static inline void Re_reset( struct Range_encoder * const renc,+static inline void Re_reset( Range_encoder * const renc,                              const unsigned dictionary_size )   {   Cb_reset( &renc->cb );@@ -350,7 +350,7 @@   int i; for( i = 0; i < Lh_size; ++i ) Cb_put_byte( &renc->cb, renc->header[i] );   } -static inline bool Re_init( struct Range_encoder * const renc,+static inline bool Re_init( Range_encoder * const renc,                             const unsigned dictionary_size,                             const unsigned min_free_bytes )   {@@ -361,17 +361,17 @@   return true;   } -static inline void Re_free( struct Range_encoder * const renc )+static inline void Re_free( Range_encoder * const renc )   { Cb_free( &renc->cb ); }  static inline unsigned long long-Re_member_position( const struct Range_encoder * const renc )+Re_member_position( const Range_encoder * const renc )   { return renc->partial_member_pos + Cb_used_bytes( &renc->cb ) + renc->ff_count; } -static inline bool Re_enough_free_bytes( const struct Range_encoder * const renc )+static inline bool Re_enough_free_bytes( const Range_encoder * const renc )   { return Cb_free_bytes( &renc->cb ) >= renc->min_free_bytes + renc->ff_count; } -static inline int Re_read_data( struct Range_encoder * const renc,+static inline int Re_read_data( Range_encoder * const renc,                                 uint8_t * const out_buffer, const int out_size )   {   const int size = Cb_read_data( &renc->cb, out_buffer, out_size );@@ -379,7 +379,7 @@   return size;   } -static inline void Re_flush( struct Range_encoder * const renc )+static inline void Re_flush( Range_encoder * const renc )   {   int i; for( i = 0; i < 5; ++i ) Re_shift_low( renc );   renc->low = 0;@@ -388,7 +388,7 @@   renc->cache = 0;   } -static inline void Re_encode( struct Range_encoder * const renc,+static inline void Re_encode( Range_encoder * const renc,                               const int symbol, const int num_bits )   {   unsigned mask;@@ -400,7 +400,7 @@     }   } -static inline void Re_encode_bit( struct Range_encoder * const renc,+static inline void Re_encode_bit( Range_encoder * const renc,                                   Bit_model * const probability, const bool bit )   {   const uint32_t bound = ( renc->range >> bit_model_total_bits ) * *probability;@@ -418,7 +418,7 @@   if( renc->range <= 0x00FFFFFFU ) { renc->range <<= 8; Re_shift_low( renc ); }   } -static inline void Re_encode_tree3( struct Range_encoder * const renc,+static inline void Re_encode_tree3( Range_encoder * const renc,                                     Bit_model bm[], const int symbol )   {   bool bit = ( symbol >> 2 ) & 1;@@ -429,7 +429,7 @@   Re_encode_bit( renc, &bm[model], symbol & 1 );   } -static inline void Re_encode_tree6( struct Range_encoder * const renc,+static inline void Re_encode_tree6( Range_encoder * const renc,                                     Bit_model bm[], const unsigned symbol )   {   bool bit = ( symbol >> 5 ) & 1;@@ -446,7 +446,7 @@   Re_encode_bit( renc, &bm[model], symbol & 1 );   } -static inline void Re_encode_tree8( struct Range_encoder * const renc,+static inline void Re_encode_tree8( Range_encoder * const renc,                                     Bit_model bm[], const int symbol )   {   int model = 1;@@ -459,7 +459,7 @@     }   } -static inline void Re_encode_tree_reversed( struct Range_encoder * const renc,+static inline void Re_encode_tree_reversed( Range_encoder * const renc,                      Bit_model bm[], int symbol, const int num_bits )   {   int model = 1;@@ -473,7 +473,7 @@     }   } -static inline void Re_encode_matched( struct Range_encoder * const renc,+static inline void Re_encode_matched( Range_encoder * const renc,                                       Bit_model bm[], unsigned symbol,                                       unsigned match_byte )   {@@ -489,17 +489,17 @@     }   } -static inline void Re_encode_len( struct Range_encoder * const renc,-                                  struct Len_model * const lm,+static inline void Re_encode_len( Range_encoder * const renc,+                                  Len_model * const lm,                                   int symbol, const int pos_state )   {-  bool bit = ( ( symbol -= min_match_len ) >= len_low_symbols );+  bool bit = ( symbol -= min_match_len ) >= len_low_symbols;   Re_encode_bit( renc, &lm->choice1, bit );   if( !bit )     Re_encode_tree3( renc, lm->bm_low[pos_state], symbol );   else     {-    bit = ( ( symbol -= len_low_symbols ) >= len_mid_symbols );+    bit = ( symbol -= len_low_symbols ) >= len_mid_symbols;     Re_encode_bit( renc, &lm->choice2, bit );     if( !bit )       Re_encode_tree3( renc, lm->bm_mid[pos_state], symbol );@@ -512,9 +512,9 @@ enum { max_marker_size = 16,        num_rep_distances = 4 };		/* must be 4 */ -struct LZ_encoder_base+typedef struct LZ_encoder_base   {-  struct Matchfinder_base mb;+  Matchfinder_base mb;   unsigned long long member_size_limit;   uint32_t crc; @@ -528,18 +528,18 @@   Bit_model bm_dis_slot[len_states][1<<dis_slot_bits];   Bit_model bm_dis[modeled_distances-end_dis_model+1];   Bit_model bm_align[dis_align_size];-  struct Len_model match_len_model;-  struct Len_model rep_len_model;-  struct Range_encoder renc;+  Len_model match_len_model;+  Len_model rep_len_model;+  Range_encoder renc;   int reps[num_rep_distances];   State state;   bool member_finished;-  };+  } LZ_encoder_base; -static void LZeb_reset( struct LZ_encoder_base * const eb,+static void LZeb_reset( LZ_encoder_base * const eb,                         const unsigned long long member_size ); -static inline bool LZeb_init( struct LZ_encoder_base * const eb,+static inline bool LZeb_init( LZ_encoder_base * const eb,                               const int before_size, const int dict_size,                               const int after_size, const int dict_factor,                               const int num_prev_positions23,@@ -555,34 +555,34 @@   return true;   } -static inline bool LZeb_member_finished( const struct LZ_encoder_base * const eb )+static inline bool LZeb_member_finished( const LZ_encoder_base * const eb )   { return eb->member_finished && Cb_empty( &eb->renc.cb ); } -static inline void LZeb_free( struct LZ_encoder_base * const eb )+static inline void LZeb_free( LZ_encoder_base * const eb )   { Re_free( &eb->renc ); Mb_free( &eb->mb ); } -static inline unsigned LZeb_crc( const struct LZ_encoder_base * const eb )+static inline unsigned LZeb_crc( const LZ_encoder_base * const eb )   { return eb->crc ^ 0xFFFFFFFFU; } -static inline int LZeb_price_literal( const struct LZ_encoder_base * const eb,+static inline int LZeb_price_literal( const LZ_encoder_base * const eb,                             const uint8_t prev_byte, const uint8_t symbol )   { return price_symbol8( eb->bm_literal[get_lit_state(prev_byte)], symbol ); } -static inline int LZeb_price_matched( const struct LZ_encoder_base * const eb,+static inline int LZeb_price_matched( const LZ_encoder_base * const eb,   const uint8_t prev_byte, const uint8_t symbol, const uint8_t match_byte )   { return price_matched( eb->bm_literal[get_lit_state(prev_byte)], symbol,                           match_byte ); } -static inline void LZeb_encode_literal( struct LZ_encoder_base * const eb,+static inline void LZeb_encode_literal( LZ_encoder_base * const eb,                             const uint8_t prev_byte, const uint8_t symbol )   { Re_encode_tree8( &eb->renc, eb->bm_literal[get_lit_state(prev_byte)], symbol ); } -static inline void LZeb_encode_matched( struct LZ_encoder_base * const eb,+static inline void LZeb_encode_matched( LZ_encoder_base * const eb,   const uint8_t prev_byte, const uint8_t symbol, const uint8_t match_byte )   { Re_encode_matched( &eb->renc, eb->bm_literal[get_lit_state(prev_byte)],                        symbol, match_byte ); } -static inline void LZeb_encode_pair( struct LZ_encoder_base * const eb,+static inline void LZeb_encode_pair( LZ_encoder_base * const eb,                                      const unsigned dis, const int len,                                      const int pos_state )   {
cbits/fast_encoder.c view
@@ -1,5 +1,5 @@ /* Lzlib - Compression library for the lzip format-   Copyright (C) 2009-2024 Antonio Diaz Diaz.+   Copyright (C) 2009-2025 Antonio Diaz Diaz.     This library is free software. Redistribution and use in source and    binary forms, with or without modification, are permitted provided@@ -17,7 +17,7 @@    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -static int FLZe_longest_match_len( struct FLZ_encoder * const fe, int * const distance )+static int FLZe_longest_match_len( FLZ_encoder * const fe, int * const distance )   {   enum { len_limit = 16 };   int32_t * ptr0 = fe->eb.mb.pos_array + fe->eb.mb.cyclic_pos;@@ -58,7 +58,7 @@   }  -static bool FLZe_encode_member( struct FLZ_encoder * const fe )+static bool FLZe_encode_member( FLZ_encoder * const fe )   {   int rep = 0, i;   State * const state = &fe->eb.state;@@ -142,22 +142,22 @@      if( match_byte == cur_byte )       {-      const int short_rep_price = price1( fe->eb.bm_match[*state][pos_state] ) +-                                  price1( fe->eb.bm_rep[*state] ) +-                                  price0( fe->eb.bm_rep0[*state] ) +-                                  price0( fe->eb.bm_len[*state][pos_state] );+      const int shortrep_price = price1( fe->eb.bm_match[*state][pos_state] ) ++                                 price1( fe->eb.bm_rep[*state] ) ++                                 price0( fe->eb.bm_rep0[*state] ) ++                                 price0( fe->eb.bm_len[*state][pos_state] );       int price = price0( fe->eb.bm_match[*state][pos_state] );       if( St_is_char( *state ) )         price += LZeb_price_literal( &fe->eb, prev_byte, cur_byte );       else         price += LZeb_price_matched( &fe->eb, prev_byte, cur_byte, match_byte );-      if( short_rep_price < price )+      if( shortrep_price < price )         {         Re_encode_bit( &fe->eb.renc, &fe->eb.bm_match[*state][pos_state], 1 );         Re_encode_bit( &fe->eb.renc, &fe->eb.bm_rep[*state], 1 );         Re_encode_bit( &fe->eb.renc, &fe->eb.bm_rep0[*state], 0 );         Re_encode_bit( &fe->eb.renc, &fe->eb.bm_len[*state][pos_state], 0 );-        *state = St_set_short_rep( *state );+        *state = St_set_shortrep( *state );         continue;         }       }
cbits/fast_encoder.h view
@@ -1,5 +1,5 @@ /* Lzlib - Compression library for the lzip format-   Copyright (C) 2009-2024 Antonio Diaz Diaz.+   Copyright (C) 2009-2025 Antonio Diaz Diaz.     This library is free software. Redistribution and use in source and    binary forms, with or without modification, are permitted provided@@ -17,13 +17,13 @@    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -struct FLZ_encoder+typedef struct FLZ_encoder   {-  struct LZ_encoder_base eb;+  LZ_encoder_base eb;   unsigned key4;			/* key made from latest 4 bytes */-  };+  } FLZ_encoder; -static inline void FLZe_reset_key4( struct FLZ_encoder * const fe )+static inline void FLZe_reset_key4( FLZ_encoder * const fe )   {   int i;   fe->key4 = 0;@@ -31,9 +31,9 @@     fe->key4 = ( fe->key4 << 4 ) ^ fe->eb.mb.buffer[i];   } -static inline bool FLZe_update_and_move( struct FLZ_encoder * const fe, int n )+static inline bool FLZe_update_and_move( FLZ_encoder * const fe, int n )   {-  struct Matchfinder_base * const mb = &fe->eb.mb;+  Matchfinder_base * const mb = &fe->eb.mb;   while( --n >= 0 )     {     if( Mb_available_bytes( mb ) >= 4 )@@ -48,7 +48,7 @@   return true;   } -static inline bool FLZe_init( struct FLZ_encoder * const fe,+static inline bool FLZe_init( FLZ_encoder * const fe,                               const unsigned long long member_size )   {   enum { before_size = 0,@@ -65,6 +65,6 @@                     member_size );   } -static inline void FLZe_reset( struct FLZ_encoder * const fe,+static inline void FLZe_reset( FLZ_encoder * const fe,                                const unsigned long long member_size )   { LZeb_reset( &fe->eb, member_size ); }
cbits/lzip.h view
@@ -1,5 +1,5 @@ /* Lzlib - Compression library for the lzip format-   Copyright (C) 2009-2024 Antonio Diaz Diaz.+   Copyright (C) 2009-2025 Antonio Diaz Diaz.     This library is free software. Redistribution and use in source and    binary forms, with or without modification, are permitted provided@@ -40,7 +40,7 @@   { return ( st < 7 ) ? 7 : 10; } static inline State St_set_rep( const State st )   { return ( st < 7 ) ? 8 : 11; }-static inline State St_set_short_rep( const State st )+static inline State St_set_shortrep( const State st )   { return ( st < 7 ) ? 9 : 11; }  @@ -94,16 +94,16 @@ static inline void Bm_array_init( Bit_model bm[], const int size )   { int i; for( i = 0; i < size; ++i ) Bm_init( &bm[i] ); } -struct Len_model+typedef struct Len_model   {   Bit_model choice1;   Bit_model choice2;   Bit_model bm_low[pos_states][len_low_symbols];   Bit_model bm_mid[pos_states][len_mid_symbols];   Bit_model bm_high[len_high_symbols];-  };+  } Len_model; -static inline void Lm_init( struct Len_model * const lm )+static inline void Lm_init( Len_model * const lm )   {   Bm_init( &lm->choice1 );   Bm_init( &lm->choice2 );
cbits/lzlib.c view
@@ -1,5 +1,5 @@ /* Lzlib - Compression library for the lzip format-   Copyright (C) 2009-2024 Antonio Diaz Diaz.+   Copyright (C) 2009-2025 Antonio Diaz Diaz.     This library is free software. Redistribution and use in source and    binary forms, with or without modification, are permitted provided@@ -39,14 +39,14 @@   {   unsigned long long partial_in_size;   unsigned long long partial_out_size;-  struct LZ_encoder_base * lz_encoder_base;	/* these 3 pointers make a */-  struct LZ_encoder * lz_encoder;		/* polymorphic encoder */-  struct FLZ_encoder * flz_encoder;-  enum LZ_Errno lz_errno;+  LZ_encoder_base * lz_encoder_base;		/* these 3 pointers make a */+  LZ_encoder * lz_encoder;			/* polymorphic encoder */+  FLZ_encoder * flz_encoder;+  LZ_Errno lz_errno;   bool fatal;   }; -static void LZ_Encoder_init( struct LZ_Encoder * const e )+static void LZ_Encoder_init( LZ_Encoder * const e )   {   e->partial_in_size = 0;   e->partial_out_size = 0;@@ -62,16 +62,16 @@   {   unsigned long long partial_in_size;   unsigned long long partial_out_size;-  struct Range_decoder * rdec;-  struct LZ_decoder * lz_decoder;-  enum LZ_Errno lz_errno;+  Range_decoder * rdec;+  LZ_decoder * lz_decoder;+  LZ_Errno lz_errno;   Lzip_header member_header;		/* header of current member */   bool fatal;   bool first_header;			/* true until first header is read */   bool seeking;   }; -static void LZ_Decoder_init( struct LZ_Decoder * const d )+static void LZ_Decoder_init( LZ_Decoder * const d )   {   int i;   d->partial_in_size = 0;@@ -86,7 +86,7 @@   }  -static bool check_encoder( struct LZ_Encoder * const e )+static bool check_encoder( LZ_Encoder * const e )   {   if( !e ) return false;   if( !e->lz_encoder_base || ( !e->lz_encoder && !e->flz_encoder ) ||@@ -96,7 +96,7 @@   }  -static bool check_decoder( struct LZ_Decoder * const d )+static bool check_decoder( LZ_Decoder * const d )   {   if( !d ) return false;   if( !d->rdec )@@ -111,7 +111,7 @@  const char * LZ_version( void ) { return LZ_version_string; } -const char * LZ_strerror( const enum LZ_Errno lz_errno )+const char * LZ_strerror( const LZ_Errno lz_errno )   {   switch( lz_errno )     {@@ -138,13 +138,12 @@  /* --------------------- Compression Functions --------------------- */ -struct LZ_Encoder * LZ_compress_open( const int dictionary_size,-                                      const int match_len_limit,-                                      const unsigned long long member_size )+LZ_Encoder * LZ_compress_open( const int dictionary_size,+                               const int match_len_limit,+                               const unsigned long long member_size )   {   Lzip_header header;-  struct LZ_Encoder * const e =-    (struct LZ_Encoder *)malloc( sizeof (struct LZ_Encoder) );+  LZ_Encoder * const e = (LZ_Encoder *)malloc( sizeof (LZ_Encoder) );   if( !e ) return 0;   LZ_Encoder_init( e );   if( !Lh_set_dictionary_size( header, dictionary_size ) ||@@ -156,14 +155,14 @@     {     if( dictionary_size == 65535 && match_len_limit == 16 )       {-      e->flz_encoder = (struct FLZ_encoder *)malloc( sizeof (struct FLZ_encoder) );+      e->flz_encoder = (FLZ_encoder *)malloc( sizeof (FLZ_encoder) );       if( e->flz_encoder && FLZe_init( e->flz_encoder, member_size ) )         { e->lz_encoder_base = &e->flz_encoder->eb; return e; }       free( e->flz_encoder ); e->flz_encoder = 0;       }     else       {-      e->lz_encoder = (struct LZ_encoder *)malloc( sizeof (struct LZ_encoder) );+      e->lz_encoder = (LZ_encoder *)malloc( sizeof (LZ_encoder) );       if( e->lz_encoder && LZe_init( e->lz_encoder, Lh_get_dictionary_size( header ),                                      match_len_limit, member_size ) )         { e->lz_encoder_base = &e->lz_encoder->eb; return e; }@@ -176,7 +175,7 @@   }  -int LZ_compress_close( struct LZ_Encoder * const e )+int LZ_compress_close( LZ_Encoder * const e )   {   if( !e ) return -1;   if( e->lz_encoder_base )@@ -187,7 +186,7 @@   }  -int LZ_compress_finish( struct LZ_Encoder * const e )+int LZ_compress_finish( LZ_Encoder * const e )   {   if( !check_encoder( e ) || e->fatal ) return -1;   Mb_finish( &e->lz_encoder_base->mb );@@ -205,7 +204,7 @@   }  -int LZ_compress_restart_member( struct LZ_Encoder * const e,+int LZ_compress_restart_member( LZ_Encoder * const e,                                 const unsigned long long member_size )   {   if( !check_encoder( e ) || e->fatal ) return -1;@@ -224,7 +223,7 @@   }  -int LZ_compress_sync_flush( struct LZ_Encoder * const e )+int LZ_compress_sync_flush( LZ_Encoder * const e )   {   if( !check_encoder( e ) || e->fatal ) return -1;   if( !e->lz_encoder_base->mb.at_stream_end )@@ -233,13 +232,13 @@   }  -int LZ_compress_read( struct LZ_Encoder * const e,+int LZ_compress_read( LZ_Encoder * const e,                       uint8_t * const buffer, const int size )   {   if( !check_encoder( e ) || e->fatal ) return -1;   if( size < 0 ) return 0; -  { struct LZ_encoder_base * const eb = e->lz_encoder_base;+  { LZ_encoder_base * const eb = e->lz_encoder_base;   int out_size = Re_read_data( &eb->renc, buffer, size );   /* minimize number of calls to encode_member */   if( out_size < size || size == 0 )@@ -255,7 +254,7 @@   }  -int LZ_compress_write( struct LZ_Encoder * const e,+int LZ_compress_write( LZ_Encoder * const e,                        const uint8_t * const buffer, const int size )   {   if( !check_encoder( e ) || e->fatal ) return -1;@@ -263,21 +262,21 @@   }  -int LZ_compress_write_size( struct LZ_Encoder * const e )+int LZ_compress_write_size( LZ_Encoder * const e )   {   if( !check_encoder( e ) || e->fatal ) return -1;   return Mb_free_bytes( &e->lz_encoder_base->mb );   }  -enum LZ_Errno LZ_compress_errno( struct LZ_Encoder * const e )+LZ_Errno LZ_compress_errno( LZ_Encoder * const e )   {   if( !e ) return LZ_bad_argument;   return e->lz_errno;   }  -int LZ_compress_finished( struct LZ_Encoder * const e )+int LZ_compress_finished( LZ_Encoder * const e )   {   if( !check_encoder( e ) ) return -1;   return Mb_data_finished( &e->lz_encoder_base->mb ) &&@@ -285,35 +284,35 @@   }  -int LZ_compress_member_finished( struct LZ_Encoder * const e )+int LZ_compress_member_finished( LZ_Encoder * const e )   {   if( !check_encoder( e ) ) return -1;   return LZeb_member_finished( e->lz_encoder_base );   }  -unsigned long long LZ_compress_data_position( struct LZ_Encoder * const e )+unsigned long long LZ_compress_data_position( LZ_Encoder * const e )   {   if( !check_encoder( e ) ) return 0;   return Mb_data_position( &e->lz_encoder_base->mb );   }  -unsigned long long LZ_compress_member_position( struct LZ_Encoder * const e )+unsigned long long LZ_compress_member_position( LZ_Encoder * const e )   {   if( !check_encoder( e ) ) return 0;   return Re_member_position( &e->lz_encoder_base->renc );   }  -unsigned long long LZ_compress_total_in_size( struct LZ_Encoder * const e )+unsigned long long LZ_compress_total_in_size( LZ_Encoder * const e )   {   if( !check_encoder( e ) ) return 0;   return e->partial_in_size + Mb_data_position( &e->lz_encoder_base->mb );   }  -unsigned long long LZ_compress_total_out_size( struct LZ_Encoder * const e )+unsigned long long LZ_compress_total_out_size( LZ_Encoder * const e )   {   if( !check_encoder( e ) ) return 0;   return e->partial_out_size + Re_member_position( &e->lz_encoder_base->renc );@@ -322,14 +321,13 @@  /* -------------------- Decompression Functions -------------------- */ -struct LZ_Decoder * LZ_decompress_open( void )+LZ_Decoder * LZ_decompress_open( void )   {-  struct LZ_Decoder * const d =-    (struct LZ_Decoder *)malloc( sizeof (struct LZ_Decoder) );+  LZ_Decoder * const d = (LZ_Decoder *)malloc( sizeof (LZ_Decoder) );   if( !d ) return 0;   LZ_Decoder_init( d ); -  d->rdec = (struct Range_decoder *)malloc( sizeof (struct Range_decoder) );+  d->rdec = (Range_decoder *)malloc( sizeof (Range_decoder) );   if( !d->rdec || !Rd_init( d->rdec ) )     {     if( d->rdec ) { Rd_free( d->rdec ); free( d->rdec ); d->rdec = 0; }@@ -339,7 +337,7 @@   }  -int LZ_decompress_close( struct LZ_Decoder * const d )+int LZ_decompress_close( LZ_Decoder * const d )   {   if( !d ) return -1;   if( d->lz_decoder )@@ -350,7 +348,7 @@   }  -int LZ_decompress_finish( struct LZ_Decoder * const d )+int LZ_decompress_finish( LZ_Decoder * const d )   {   if( !check_decoder( d ) || d->fatal ) return -1;   if( d->seeking )@@ -360,7 +358,7 @@   }  -int LZ_decompress_reset( struct LZ_Decoder * const d )+int LZ_decompress_reset( LZ_Decoder * const d )   {   if( !check_decoder( d ) ) return -1;   if( d->lz_decoder )@@ -376,7 +374,7 @@   }  -int LZ_decompress_sync_to_member( struct LZ_Decoder * const d )+int LZ_decompress_sync_to_member( LZ_Decoder * const d )   {   unsigned skipped = 0;   if( !check_decoder( d ) ) return -1;@@ -395,7 +393,7 @@   }  -int LZ_decompress_read( struct LZ_Decoder * const d,+int LZ_decompress_read( LZ_Decoder * const d,                         uint8_t * const buffer, const int size )   {   int result;@@ -467,7 +465,7 @@       d->fatal = true;       return -1;       }-    d->lz_decoder = (struct LZ_decoder *)malloc( sizeof (struct LZ_decoder) );+    d->lz_decoder = (LZ_decoder *)malloc( sizeof (LZ_decoder) );     if( !d->lz_decoder || !LZd_init( d->lz_decoder, d->rdec,                              Lh_get_dictionary_size( d->member_header ) ) )       {					/* not enough free memory */@@ -486,7 +484,7 @@       { d->rdec->member_position += Cb_used_bytes( &d->rdec->cb );         Cb_reset( &d->rdec->cb );         d->lz_errno = LZ_unexpected_eof; }-    else if( result == 5 ) d->lz_errno = LZ_library_error;+    else if( result == 6 ) d->lz_errno = LZ_library_error;     else d->lz_errno = LZ_data_error;     d->fatal = true;     if( Cb_empty( &d->lz_decoder->cb ) ) return -1;@@ -496,7 +494,7 @@   }  -int LZ_decompress_write( struct LZ_Decoder * const d,+int LZ_decompress_write( LZ_Decoder * const d,                          const uint8_t * const buffer, const int size )   {   int result;@@ -519,21 +517,21 @@   }  -int LZ_decompress_write_size( struct LZ_Decoder * const d )+int LZ_decompress_write_size( LZ_Decoder * const d )   {   if( !check_decoder( d ) || d->fatal ) return -1;   return Rd_free_bytes( d->rdec );   }  -enum LZ_Errno LZ_decompress_errno( struct LZ_Decoder * const d )+LZ_Errno LZ_decompress_errno( LZ_Decoder * const d )   {   if( !d ) return LZ_bad_argument;   return d->lz_errno;   }  -int LZ_decompress_finished( struct LZ_Decoder * const d )+int LZ_decompress_finished( LZ_Decoder * const d )   {   if( !check_decoder( d ) || d->fatal ) return -1;   return Rd_finished( d->rdec ) &&@@ -541,28 +539,28 @@   }  -int LZ_decompress_member_finished( struct LZ_Decoder * const d )+int LZ_decompress_member_finished( LZ_Decoder * const d )   {   if( !check_decoder( d ) || d->fatal ) return -1;   return d->lz_decoder && LZd_member_finished( d->lz_decoder );   }  -int LZ_decompress_member_version( struct LZ_Decoder * const d )+int LZ_decompress_member_version( LZ_Decoder * const d )   {   if( !check_decoder( d ) ) return -1;   return Lh_version( d->member_header );   }  -int LZ_decompress_dictionary_size( struct LZ_Decoder * const d )+int LZ_decompress_dictionary_size( LZ_Decoder * const d )   {   if( !check_decoder( d ) ) return -1;   return Lh_get_dictionary_size( d->member_header );   }  -unsigned LZ_decompress_data_crc( struct LZ_Decoder * const d )+unsigned LZ_decompress_data_crc( LZ_Decoder * const d )   {   if( check_decoder( d ) && d->lz_decoder )     return LZd_crc( d->lz_decoder );@@ -570,7 +568,7 @@   }  -unsigned long long LZ_decompress_data_position( struct LZ_Decoder * const d )+unsigned long long LZ_decompress_data_position( LZ_Decoder * const d )   {   if( check_decoder( d ) && d->lz_decoder )     return LZd_data_position( d->lz_decoder );@@ -578,21 +576,21 @@   }  -unsigned long long LZ_decompress_member_position( struct LZ_Decoder * const d )+unsigned long long LZ_decompress_member_position( LZ_Decoder * const d )   {   if( !check_decoder( d ) ) return 0;   return d->rdec->member_position;   }  -unsigned long long LZ_decompress_total_in_size( struct LZ_Decoder * const d )+unsigned long long LZ_decompress_total_in_size( LZ_Decoder * const d )   {   if( !check_decoder( d ) ) return 0;   return d->partial_in_size + d->rdec->member_position;   }  -unsigned long long LZ_decompress_total_out_size( struct LZ_Decoder * const d )+unsigned long long LZ_decompress_total_out_size( LZ_Decoder * const d )   {   if( !check_decoder( d ) ) return 0;   if( d->lz_decoder )
cbits/lzlib.h view
@@ -1,5 +1,5 @@ /* Lzlib - Compression library for the lzip format-   Copyright (C) 2009-2024 Antonio Diaz Diaz.+   Copyright (C) 2009-2025 Antonio Diaz Diaz.     This library is free software. Redistribution and use in source and    binary forms, with or without modification, are permitted provided@@ -24,18 +24,19 @@ /* LZ_API_VERSION was first defined in lzlib 1.8 to 1.    Since lzlib 1.12, LZ_API_VERSION is defined as (major * 1000 + minor). */ -#define LZ_API_VERSION 1014+#define LZ_API_VERSION 1015 -static const char * const LZ_version_string = "1.14";+static const char * const LZ_version_string = "1.15"; -enum LZ_Errno { LZ_ok = 0,         LZ_bad_argument, LZ_mem_error,-                LZ_sequence_error, LZ_header_error, LZ_unexpected_eof,-                LZ_data_error,     LZ_library_error };+typedef enum LZ_Errno+  { LZ_ok = 0,         LZ_bad_argument, LZ_mem_error,+    LZ_sequence_error, LZ_header_error, LZ_unexpected_eof,+    LZ_data_error,     LZ_library_error } LZ_Errno;   int LZ_api_version( void );				/* new in 1.12 */ const char * LZ_version( void );-const char * LZ_strerror( const enum LZ_Errno lz_errno );+const char * LZ_strerror( const LZ_Errno lz_errno );  int LZ_min_dictionary_bits( void ); int LZ_min_dictionary_size( void );@@ -47,63 +48,63 @@  /* --------------------- Compression Functions --------------------- */ -struct LZ_Encoder;+typedef struct LZ_Encoder LZ_Encoder; -struct LZ_Encoder * LZ_compress_open( const int dictionary_size,-                                      const int match_len_limit,-                                      const unsigned long long member_size );-int LZ_compress_close( struct LZ_Encoder * const encoder );+LZ_Encoder * LZ_compress_open( const int dictionary_size,+                               const int match_len_limit,+                               const unsigned long long member_size );+int LZ_compress_close( LZ_Encoder * const encoder ); -int LZ_compress_finish( struct LZ_Encoder * const encoder );-int LZ_compress_restart_member( struct LZ_Encoder * const encoder,+int LZ_compress_finish( LZ_Encoder * const encoder );+int LZ_compress_restart_member( LZ_Encoder * const encoder,                                 const unsigned long long member_size );-int LZ_compress_sync_flush( struct LZ_Encoder * const encoder );+int LZ_compress_sync_flush( LZ_Encoder * const encoder ); -int LZ_compress_read( struct LZ_Encoder * const encoder,+int LZ_compress_read( LZ_Encoder * const encoder,                       uint8_t * const buffer, const int size );-int LZ_compress_write( struct LZ_Encoder * const encoder,+int LZ_compress_write( LZ_Encoder * const encoder,                        const uint8_t * const buffer, const int size );-int LZ_compress_write_size( struct LZ_Encoder * const encoder );+int LZ_compress_write_size( LZ_Encoder * const encoder ); -enum LZ_Errno LZ_compress_errno( struct LZ_Encoder * const encoder );-int LZ_compress_finished( struct LZ_Encoder * const encoder );-int LZ_compress_member_finished( struct LZ_Encoder * const encoder );+LZ_Errno LZ_compress_errno( LZ_Encoder * const encoder );+int LZ_compress_finished( LZ_Encoder * const encoder );+int LZ_compress_member_finished( LZ_Encoder * const encoder ); -unsigned long long LZ_compress_data_position( struct LZ_Encoder * const encoder );-unsigned long long LZ_compress_member_position( struct LZ_Encoder * const encoder );-unsigned long long LZ_compress_total_in_size( struct LZ_Encoder * const encoder );-unsigned long long LZ_compress_total_out_size( struct LZ_Encoder * const encoder );+unsigned long long LZ_compress_data_position( LZ_Encoder * const encoder );+unsigned long long LZ_compress_member_position( LZ_Encoder * const encoder );+unsigned long long LZ_compress_total_in_size( LZ_Encoder * const encoder );+unsigned long long LZ_compress_total_out_size( LZ_Encoder * const encoder );   /* -------------------- Decompression Functions -------------------- */ -struct LZ_Decoder;+typedef struct LZ_Decoder LZ_Decoder; -struct LZ_Decoder * LZ_decompress_open( void );-int LZ_decompress_close( struct LZ_Decoder * const decoder );+LZ_Decoder * LZ_decompress_open( void );+int LZ_decompress_close( LZ_Decoder * const decoder ); -int LZ_decompress_finish( struct LZ_Decoder * const decoder );-int LZ_decompress_reset( struct LZ_Decoder * const decoder );-int LZ_decompress_sync_to_member( struct LZ_Decoder * const decoder );+int LZ_decompress_finish( LZ_Decoder * const decoder );+int LZ_decompress_reset( LZ_Decoder * const decoder );+int LZ_decompress_sync_to_member( LZ_Decoder * const decoder ); -int LZ_decompress_read( struct LZ_Decoder * const decoder,+int LZ_decompress_read( LZ_Decoder * const decoder,                         uint8_t * const buffer, const int size );-int LZ_decompress_write( struct LZ_Decoder * const decoder,+int LZ_decompress_write( LZ_Decoder * const decoder,                          const uint8_t * const buffer, const int size );-int LZ_decompress_write_size( struct LZ_Decoder * const decoder );+int LZ_decompress_write_size( LZ_Decoder * const decoder ); -enum LZ_Errno LZ_decompress_errno( struct LZ_Decoder * const decoder );-int LZ_decompress_finished( struct LZ_Decoder * const decoder );-int LZ_decompress_member_finished( struct LZ_Decoder * const decoder );+LZ_Errno LZ_decompress_errno( LZ_Decoder * const decoder );+int LZ_decompress_finished( LZ_Decoder * const decoder );+int LZ_decompress_member_finished( LZ_Decoder * const decoder ); -int LZ_decompress_member_version( struct LZ_Decoder * const decoder );-int LZ_decompress_dictionary_size( struct LZ_Decoder * const decoder );-unsigned LZ_decompress_data_crc( struct LZ_Decoder * const decoder );+int LZ_decompress_member_version( LZ_Decoder * const decoder );+int LZ_decompress_dictionary_size( LZ_Decoder * const decoder );+unsigned LZ_decompress_data_crc( LZ_Decoder * const decoder ); -unsigned long long LZ_decompress_data_position( struct LZ_Decoder * const decoder );-unsigned long long LZ_decompress_member_position( struct LZ_Decoder * const decoder );-unsigned long long LZ_decompress_total_in_size( struct LZ_Decoder * const decoder );-unsigned long long LZ_decompress_total_out_size( struct LZ_Decoder * const decoder );+unsigned long long LZ_decompress_data_position( LZ_Decoder * const decoder );+unsigned long long LZ_decompress_member_position( LZ_Decoder * const decoder );+unsigned long long LZ_decompress_total_in_size( LZ_Decoder * const decoder );+unsigned long long LZ_decompress_total_out_size( LZ_Decoder * const decoder );  #ifdef __cplusplus }
lzlib.cabal view
@@ -1,6 +1,6 @@ cabal-version:      1.18 name:               lzlib-version:            1.0.7.3+version:            1.0.7.4 license:            BSD3 license-file:       LICENSE copyright:          Copyright: (c) 2019-2021 Vanessa McHale