From: Lasse Collin Date: Mon, 21 Jan 2008 22:15:11 +0000 (+0200) Subject: Made lzma_extra pointers const in lzma_options_stream. X-Git-Tag: upstream/5.1.3~813 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0ed6f1adcea540fb9593ca115d36de537f7f0dc6;p=platform%2Fupstream%2Fxz.git Made lzma_extra pointers const in lzma_options_stream. --- diff --git a/src/liblzma/api/lzma/stream.h b/src/liblzma/api/lzma/stream.h index be86075..d111be3 100644 --- a/src/liblzma/api/lzma/stream.h +++ b/src/liblzma/api/lzma/stream.h @@ -111,7 +111,7 @@ typedef struct { /** * \brief Extra information in the Header Metadata Block */ - lzma_extra *header; + const lzma_extra *header; /** * \brief Extra information in the Footer Metadata Block @@ -119,7 +119,7 @@ typedef struct { * It is enough to set this pointer any time before calling * lzma_code() with LZMA_FINISH as the second argument. */ - lzma_extra *footer; + const lzma_extra *footer; } lzma_options_stream; diff --git a/src/liblzma/common/stream_encoder_multi.c b/src/liblzma/common/stream_encoder_multi.c index 16c9842..5a517ff 100644 --- a/src/liblzma/common/stream_encoder_multi.c +++ b/src/liblzma/common/stream_encoder_multi.c @@ -220,7 +220,11 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator, .uncompressed_size = coder->stream_options ->uncompressed_size, .index = NULL, - .extra = coder->stream_options->header, + // Metadata encoder doesn't modify this, but since + // the lzma_extra structure is used also when decoding + // Metadata, the pointer is not const, and we need + // to cast the constness away in the encoder. + .extra = (lzma_extra *)(coder->stream_options->header), }; return_if_error(metadata_encoder_init(coder, allocator, @@ -238,7 +242,7 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator, .total_size = LZMA_VLI_VALUE_UNKNOWN, .uncompressed_size = LZMA_VLI_VALUE_UNKNOWN, .index = lzma_info_index_get(coder->info, false), - .extra = coder->stream_options->footer, + .extra = (lzma_extra *)(coder->stream_options->footer), }; return_if_error(metadata_encoder_init(coder, allocator,