Non destructive general purpose compression functions.

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

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_Binbuf * | emile_compress (const Eina_Binbuf *in, Emile_Compressor_Type t, Emile_Compressor_Level level)
| Compress an Eina_Binbuf into a new Eina_Binbuf.
Eina_Binbuf * | emile_decompress (const Eina_Binbuf *in, Emile_Compressor_Type t, unsigned int dest_length)
| Uncompress a buffer into a newly allocated buffer.
Eina_Bool | emile_expand (const Eina_Binbuf *in, Eina_Binbuf *out, Emile_Compressor_Type t)
| Uncompress a buffer into an existing buffer.

## Detailed Description

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

## Enumeration Type Documentation

## ◆ Emile_Compressor_Type

enum 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

enum 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

  in | Buffer to compress.
  t | Type of compression logic to use.
  level | Level of compression to apply.

Returns
  On success it will return a buffer that contains the compressed data, `NULL` otherwise.

Since
  1.14

References eina_binbuf_length_get(), eina_binbuf_manage_new(), eina_binbuf_string_get(), EINA_FALSE, and EINA_TRUE.

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

  in | Buffer to uncompress.
  t | Type of compression logic to use.
  dest_length | Expected 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(), eet_read_cipher(), 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

  in | Buffer to uncompress.
  out | Buffer to expand data into.
  t | Type 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_binbuf_length_get(), eina_binbuf_string_get(), EINA_FALSE, and EINA_TRUE.

Referenced by emile_decompress().