From 5213c53f6f126bf79ca2849d7d04a0e5141811ea Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Fri, 23 Oct 2015 17:38:40 -0500 Subject: cbfstool: have decompress functions provide ouput data size Currently cbfs stage files that are compressed do not have the decompressed size readily available. Therefore there's no good way to know actual size of data after it is decompressed. Optionally return the decompressed data size if requested. Change-Id: If371753d28d0ff512118d8bc06fdd48f4a0aeae7 Signed-off-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/12173 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- util/cbfstool/lzma/lzma.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'util/cbfstool/lzma/lzma.c') diff --git a/util/cbfstool/lzma/lzma.c b/util/cbfstool/lzma/lzma.c index 856932d22e..986ebfaa22 100644 --- a/util/cbfstool/lzma/lzma.c +++ b/util/cbfstool/lzma/lzma.c @@ -152,7 +152,8 @@ int do_lzma_compress(char *in, int in_len, char *out, int *out_len) return 0; } -int do_lzma_uncompress(char *dst, int dst_len, char *src, int src_len) +int do_lzma_uncompress(char *dst, int dst_len, char *src, int src_len, + size_t *actual_size) { if (src_len <= LZMA_PROPS_SIZE + 8) { ERROR("LZMA: Input length is too small.\n"); @@ -184,5 +185,8 @@ int do_lzma_uncompress(char *dst, int dst_len, char *src, int src_len) return -1; } + if (actual_size != NULL) + *actual_size = destlen; + return 0; } -- cgit v1.2.3