1
0
镜像自地址 https://git.tukaani.org/xz.git 已同步 2026-10-31 03:14:56 +00:00

Made lzma_extra pointers const in lzma_options_stream.

这个提交包含在:
Lasse Collin 2008-01-22 00:15:11 +02:00
父节点 305afa38f6
当前提交 0ed6f1adce
共有 2 个文件被更改,包括 8 次插入 和 4 次删除

查看文件

@ -111,7 +111,7 @@ typedef struct {
/** /**
* \brief Extra information in the Header Metadata Block * \brief Extra information in the Header Metadata Block
*/ */
lzma_extra *header; const lzma_extra *header;
/** /**
* \brief Extra information in the Footer Metadata Block * \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 * It is enough to set this pointer any time before calling
* lzma_code() with LZMA_FINISH as the second argument. * lzma_code() with LZMA_FINISH as the second argument.
*/ */
lzma_extra *footer; const lzma_extra *footer;
} lzma_options_stream; } lzma_options_stream;

查看文件

@ -220,7 +220,11 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator,
.uncompressed_size = coder->stream_options .uncompressed_size = coder->stream_options
->uncompressed_size, ->uncompressed_size,
.index = NULL, .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, 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, .total_size = LZMA_VLI_VALUE_UNKNOWN,
.uncompressed_size = LZMA_VLI_VALUE_UNKNOWN, .uncompressed_size = LZMA_VLI_VALUE_UNKNOWN,
.index = lzma_info_index_get(coder->info, false), .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, return_if_error(metadata_encoder_init(coder, allocator,