Enumerations | Functions
Non destructive general purpose compression functions.

Function that allow the compression and expansion of Eina_Binbuf with non destructive algorithm. More...

Enumerations

enum  Emile_Compressor_Type {
  EMILE_ZLIB,
  EMILE_LZ4,
  EMILE_LZ4HC
}
 Supported type of compression algorithm. More...
 
enum  Emile_Compressor_Level {
  EMILE_COMPRESSOR_DEFAULT = -1,
  EMILE_COMPRESSOR_NONE = 0,
  EMILE_COMPRESSOR_FAST = 1,
  EMILE_COMPRESSOR_BEST = 9
}
 Compression level to apply. More...
 

Functions

Eina_Binbufemile_compress (const Eina_Binbuf *in, Emile_Compressor_Type t, Emile_Compressor_Level level)
 Compress an Eina_Binbuf into a new Eina_Binbuf. More...
 
Eina_Binbufemile_decompress (const Eina_Binbuf *in, Emile_Compressor_Type t, unsigned int dest_length)
 Uncompress a buffer into a newly allocated buffer. More...
 
Eina_Bool emile_expand (const Eina_Binbuf *in, Eina_Binbuf *out, Emile_Compressor_Type t)
 Uncompress a buffer into an existing buffer. More...
 

Detailed Description

Function that allow the compression and expansion of Eina_Binbuf with non destructive algorithm.

Enumeration Type Documentation

◆ Emile_Compressor_Type

Supported type of compression algorithm.

Since
1.14
See also
emile_binbuf_compress()
emile_binbuf_uncompress()
emile_binbuf_expand()

◆ Emile_Compressor_Level

Compression level to apply.

Since
1.14
See also
emile_binbuf_compress();

Function Documentation

◆ emile_compress()

Eina_Binbuf* emile_compress ( const Eina_Binbuf in,
Emile_Compressor_Type  t,
Emile_Compressor_Level  level 
)

Compress an Eina_Binbuf into a new Eina_Binbuf.

Parameters
inBuffer to compress.
tType of compression logic to use.
levelLevel of compression to apply.
Returns
On success it will return a buffer that contains the compressed data, NULL otherwise.
Since
1.14

References EINA_FALSE.

Referenced by eet_alias(), and eet_write_cipher().

◆ emile_decompress()

Eina_Binbuf* emile_decompress ( const Eina_Binbuf in,
Emile_Compressor_Type  t,
unsigned int  dest_length 
)

Uncompress a buffer into a newly allocated buffer.

Parameters
inBuffer to uncompress.
tType of compression logic to use.
dest_lengthExpected length of the decompressed data.
Returns
a newly allocated buffer with the uncompressed data, NULL if it failed.
Since
1.14
Note
That if dest_length doesn't match the expanded data, it will just fail and return NULL.

References eina_binbuf_free(), eina_binbuf_manage_new(), EINA_FALSE, and emile_expand().

Referenced by eet_alias_get(), and eet_read_direct().

◆ emile_expand()

Eina_Bool emile_expand ( const Eina_Binbuf in,
Eina_Binbuf out,
Emile_Compressor_Type  t 
)

Uncompress a buffer into an existing buffer.

Parameters
inBuffer to uncompress.
outBuffer to expand data into.
tType of compression logic to use.
Returns
EINA_TRUE if it succeed, EINA_FALSE if it failed.
Since
1.14
Note
The out buffer should have the necessary size to hold the expanded data or it will fail. In case of failure, random garbage could fill the out buffer.

References EINA_FALSE.

Referenced by emile_decompress().