emile: remove binbuf from emile compression functions.

This commit is contained in:
Cedric BAIL 2015-03-17 08:50:50 +01:00
parent 75cd6d3628
commit 90d8932a03
5 changed files with 37 additions and 37 deletions

View File

@ -721,7 +721,7 @@ eet_data_image_lossless_compressed_convert(int *size,
return NULL; return NULL;
} }
out = emile_binbuf_compress(in, eet_2_emile_compressor(compression), compression); out = emile_compress(in, eet_2_emile_compressor(compression), compression);
if (!out || (eina_binbuf_length_get(out) > eina_binbuf_length_get(in))) if (!out || (eina_binbuf_length_get(out) > eina_binbuf_length_get(in)))
{ {
@ -1039,7 +1039,7 @@ eet_data_image_etc1_compressed_convert(int *size,
{ {
Eina_Binbuf *out; Eina_Binbuf *out;
out = emile_binbuf_compress(in, EMILE_LZ4HC, EMILE_COMPRESSOR_BEST); out = emile_compress(in, EMILE_LZ4HC, EMILE_COMPRESSOR_BEST);
eina_binbuf_free(in); eina_binbuf_free(in);
in = out; in = out;
} }
@ -1984,7 +1984,7 @@ _eet_data_image_decode_inside(const void *data,
{ {
out = eina_binbuf_manage_read_only_new_length((void*) d, out = eina_binbuf_manage_read_only_new_length((void*) d,
w * h * 4); w * h * 4);
if (!emile_binbuf_expand(in, out, if (!emile_expand(in, out,
eet_2_emile_compressor(comp))) eet_2_emile_compressor(comp)))
{ {
eina_binbuf_free(in); eina_binbuf_free(in);
@ -1996,7 +1996,7 @@ _eet_data_image_decode_inside(const void *data,
{ {
/* FIXME: This could create a huge alloc. So /* FIXME: This could create a huge alloc. So
compressed data and tile could not always work.*/ compressed data and tile could not always work.*/
out = emile_binbuf_uncompress(in, out = emile_decompress(in,
eet_2_emile_compressor(comp), eet_2_emile_compressor(comp),
w * h * 4); w * h * 4);
eina_binbuf_free(in); eina_binbuf_free(in);

View File

@ -1886,7 +1886,7 @@ eet_read_cipher(Eet_File *ef,
{ {
Eina_Binbuf *out; Eina_Binbuf *out;
out = emile_binbuf_uncompress(in, out = emile_decompress(in,
eet_2_emile_compressor(efn->compression_type), eet_2_emile_compressor(efn->compression_type),
efn->data_size); efn->data_size);
@ -1987,7 +1987,7 @@ eet_read_direct(Eet_File *ef,
in = read_binbuf_from_disk(ef, efn); in = read_binbuf_from_disk(ef, efn);
if (!in) goto on_error; if (!in) goto on_error;
out = emile_binbuf_uncompress(in, out = emile_decompress(in,
eet_2_emile_compressor(efn->compression_type), eet_2_emile_compressor(efn->compression_type),
efn->data_size); efn->data_size);
eina_binbuf_free(in); eina_binbuf_free(in);
@ -2089,7 +2089,7 @@ eet_alias_get(Eet_File *ef,
in = read_binbuf_from_disk(ef, efn); in = read_binbuf_from_disk(ef, efn);
if (!in) goto on_error; if (!in) goto on_error;
out = emile_binbuf_uncompress(in, out = emile_decompress(in,
eet_2_emile_compressor(efn->compression_type), eet_2_emile_compressor(efn->compression_type),
efn->data_size); efn->data_size);
eina_binbuf_free(in); eina_binbuf_free(in);
@ -2207,7 +2207,7 @@ eet_alias(Eet_File *ef,
{ {
Eina_Binbuf *out; Eina_Binbuf *out;
out = emile_binbuf_compress(in, out = emile_compress(in,
eet_2_emile_compressor(comp), eet_2_emile_compressor(comp),
EMILE_COMPRESSOR_BEST); EMILE_COMPRESSOR_BEST);
eina_binbuf_free(in); eina_binbuf_free(in);
@ -2327,7 +2327,7 @@ eet_write_cipher(Eet_File *ef,
{ {
Eina_Binbuf *out; Eina_Binbuf *out;
out = emile_binbuf_compress(in, eet_2_emile_compressor(comp), EMILE_COMPRESSOR_BEST); out = emile_compress(in, eet_2_emile_compressor(comp), EMILE_COMPRESSOR_BEST);
if (out) if (out)
{ {
if (eina_binbuf_length_get(out) < eina_binbuf_length_get(in)) if (eina_binbuf_length_get(out) < eina_binbuf_length_get(in))

View File

@ -32,7 +32,7 @@ _emile_compress_buffer_size(const Eina_Binbuf *data, Emile_Compressor_Type t)
} }
EAPI Eina_Binbuf * EAPI Eina_Binbuf *
emile_binbuf_compress(const Eina_Binbuf *data, emile_compress(const Eina_Binbuf *data,
Emile_Compressor_Type t, Emile_Compressor_Type t,
Emile_Compressor_Level l) Emile_Compressor_Level l)
{ {
@ -79,7 +79,7 @@ emile_binbuf_compress(const Eina_Binbuf *data,
} }
EAPI Eina_Bool EAPI Eina_Bool
emile_binbuf_expand(const Eina_Binbuf *in, emile_expand(const Eina_Binbuf *in,
Eina_Binbuf *out, Eina_Binbuf *out,
Emile_Compressor_Type t) Emile_Compressor_Type t)
{ {
@ -117,7 +117,7 @@ emile_binbuf_expand(const Eina_Binbuf *in,
} }
EAPI Eina_Binbuf * EAPI Eina_Binbuf *
emile_binbuf_uncompress(const Eina_Binbuf *data, Emile_Compressor_Type t, unsigned int dest_length) emile_decompress(const Eina_Binbuf *data, Emile_Compressor_Type t, unsigned int dest_length)
{ {
Eina_Binbuf *out; Eina_Binbuf *out;
void *expanded; void *expanded;
@ -128,7 +128,7 @@ emile_binbuf_uncompress(const Eina_Binbuf *data, Emile_Compressor_Type t, unsign
out = eina_binbuf_manage_new_length(expanded, dest_length); out = eina_binbuf_manage_new_length(expanded, dest_length);
if (!out) goto on_error; if (!out) goto on_error;
if (!emile_binbuf_expand(data, out, t)) if (!emile_expand(data, out, t))
goto on_error; goto on_error;
return out; return out;

View File

@ -51,7 +51,7 @@ typedef enum
* *
* @since 1.14 * @since 1.14
*/ */
EAPI Eina_Binbuf *emile_binbuf_compress(const Eina_Binbuf *in, EAPI Eina_Binbuf *emile_compress(const Eina_Binbuf *in,
Emile_Compressor_Type t, Emile_Compressor_Type t,
Emile_Compressor_Level level); Emile_Compressor_Level level);
/** /**
@ -69,7 +69,7 @@ EAPI Eina_Binbuf *emile_binbuf_compress(const Eina_Binbuf *in,
* @note That if dest_length doesn't match the expanded data, it will * @note That if dest_length doesn't match the expanded data, it will
* just fail and return @c NULL. * just fail and return @c NULL.
*/ */
EAPI Eina_Binbuf *emile_binbuf_uncompress(const Eina_Binbuf *in, EAPI Eina_Binbuf *emile_decompress(const Eina_Binbuf *in,
Emile_Compressor_Type t, Emile_Compressor_Type t,
unsigned int dest_length); unsigned int dest_length);
@ -87,7 +87,7 @@ EAPI Eina_Binbuf *emile_binbuf_uncompress(const Eina_Binbuf *in,
* expanded data or it will fail. In case of failure, random garbage * expanded data or it will fail. In case of failure, random garbage
* could fill the out buffer. * could fill the out buffer.
*/ */
EAPI Eina_Bool emile_binbuf_expand(const Eina_Binbuf *in, EAPI Eina_Bool emile_expand(const Eina_Binbuf *in,
Eina_Binbuf *out, Eina_Binbuf *out,
Emile_Compressor_Type t); Emile_Compressor_Type t);
/** /**

View File

@ -499,7 +499,7 @@ _emile_tgv_data(Emile_Image *image,
if (image->compress) if (image->compress)
{ {
if (!emile_binbuf_expand(data_start, buffer, EMILE_LZ4HC)) if (!emile_expand(data_start, buffer, EMILE_LZ4HC))
goto on_error; goto on_error;
} }
else else