From 322ecf93c961e45a1da8c4a794a7fdacefcd7f40 Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Wed, 31 Dec 2008 16:29:39 +0200 Subject: Renamed lzma_options_simple to lzma_options_bcj in the API. The internal implementation is still using the name "simple". It may need some cleanups, so I look at it later. --- src/liblzma/api/Makefile.am | 2 +- src/liblzma/api/lzma.h | 2 +- src/liblzma/api/lzma/bcj.h | 94 +++++++++++++++++++++++++++++++++++++ src/liblzma/api/lzma/simple.h | 94 ------------------------------------- src/liblzma/simple/simple_coder.c | 2 +- src/liblzma/simple/simple_decoder.c | 4 +- src/liblzma/simple/simple_encoder.c | 4 +- 7 files changed, 101 insertions(+), 101 deletions(-) create mode 100644 src/liblzma/api/lzma/bcj.h delete mode 100644 src/liblzma/api/lzma/simple.h (limited to 'src') diff --git a/src/liblzma/api/Makefile.am b/src/liblzma/api/Makefile.am index f5101f96..12953c41 100644 --- a/src/liblzma/api/Makefile.am +++ b/src/liblzma/api/Makefile.am @@ -15,6 +15,7 @@ nobase_include_HEADERS = \ lzma.h \ lzma/base.h \ + lzma/bcj.h \ lzma/block.h \ lzma/check.h \ lzma/container.h \ @@ -23,7 +24,6 @@ nobase_include_HEADERS = \ lzma/index.h \ lzma/index_hash.h \ lzma/lzma.h \ - lzma/simple.h \ lzma/stream_flags.h \ lzma/subblock.h \ lzma/version.h \ diff --git a/src/liblzma/api/lzma.h b/src/liblzma/api/lzma.h index ef7a1086..dc90deb1 100644 --- a/src/liblzma/api/lzma.h +++ b/src/liblzma/api/lzma.h @@ -204,7 +204,7 @@ extern "C" { /* Filters */ #include "lzma/filter.h" #include "lzma/subblock.h" -#include "lzma/simple.h" +#include "lzma/bcj.h" #include "lzma/delta.h" #include "lzma/lzma.h" diff --git a/src/liblzma/api/lzma/bcj.h b/src/liblzma/api/lzma/bcj.h new file mode 100644 index 00000000..33bd7da9 --- /dev/null +++ b/src/liblzma/api/lzma/bcj.h @@ -0,0 +1,94 @@ +/** + * \file lzma/bcj.h + * \brief Branch/Call/Jump conversion filters + * + * \author Copyright (C) 1999-2006 Igor Pavlov + * \author Copyright (C) 2007 Lasse Collin + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + */ + +#ifndef LZMA_H_INTERNAL +# error Never include this file directly. Use instead. +#endif + + +/* Filter IDs for lzma_filter.id */ + +#define LZMA_FILTER_X86 LZMA_VLI_C(0x04) + /**< + * Filter for x86 binaries + */ + +#define LZMA_FILTER_POWERPC LZMA_VLI_C(0x05) + /**< + * Filter for Big endian PowerPC binaries + */ + +#define LZMA_FILTER_IA64 LZMA_VLI_C(0x06) + /**< + * Filter for IA64 (Itanium) binaries. + */ + +#define LZMA_FILTER_ARM LZMA_VLI_C(0x07) + /**< + * Filter for ARM binaries. + */ + +#define LZMA_FILTER_ARMTHUMB LZMA_VLI_C(0x08) + /**< + * Filter for ARMThumb binaries. + */ + +#define LZMA_FILTER_SPARC LZMA_VLI_C(0x09) + /**< + * Filter for SPARC binaries. + */ + + +/** + * \brief Options for BCJ filters + * + * The BCJ filters never change the size of the data. Specifying options + * for them is optional: if pointer to options is NULL, default value is + * used. You probably never need to specify options to BCJ filters, so just + * set the options pointer to NULL and be happy. + * + * If options with non-default values have been specified when encoding, + * the same options must also be specified when decoding. + * + * \note At the moment, none of the BCJ filters support + * LZMA_SYNC_FLUSH. If LZMA_SYNC_FLUSH is specified, + * LZMA_OPTIONS_ERROR will be returned. If there is need, + * partial support for LZMA_SYNC_FLUSH can be added in future. + * Partial means that flushing would be possible only at + * offsets that are multiple of 2, 4, or 16 depending on + * the filter, except x86 which cannot be made to support + * LZMA_SYNC_FLUSH predictably. + */ +typedef struct { + /** + * \brief Start offset for conversions + * + * This setting is useful only when the same filter is used + * _separately_ for multiple sections of the same executable file, + * and the sections contain cross-section branch/call/jump + * instructions. In that case it is benefical to set the start + * offset of the non-first sections so that the relative addresses + * of the cross-section branch/call/jump instructions will use the + * same absolute addresses as in the first section. + * + * When the pointer to options is NULL, the default value (zero) + * is used. + */ + uint32_t start_offset; + +} lzma_options_bcj; diff --git a/src/liblzma/api/lzma/simple.h b/src/liblzma/api/lzma/simple.h deleted file mode 100644 index 6969ffa9..00000000 --- a/src/liblzma/api/lzma/simple.h +++ /dev/null @@ -1,94 +0,0 @@ -/** - * \file lzma/simple.h - * \brief So called "simple" filters - * - * \author Copyright (C) 1999-2006 Igor Pavlov - * \author Copyright (C) 2007 Lasse Collin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - */ - -#ifndef LZMA_H_INTERNAL -# error Never include this file directly. Use instead. -#endif - - -/* Filter IDs for lzma_filter.id */ - -#define LZMA_FILTER_X86 LZMA_VLI_C(0x04) - /**< - * BCJ (Branch, Call, Jump) filter for x86 binaries - */ - -#define LZMA_FILTER_POWERPC LZMA_VLI_C(0x05) - /**< - * Filter for Big endian PowerPC binaries - */ - -#define LZMA_FILTER_IA64 LZMA_VLI_C(0x06) - /**< - * Filter for IA64 (Itanium) binaries. - */ - -#define LZMA_FILTER_ARM LZMA_VLI_C(0x07) - /**< - * Filter for ARM binaries. - */ - -#define LZMA_FILTER_ARMTHUMB LZMA_VLI_C(0x08) - /**< - * Filter for ARMThumb binaries. - */ - -#define LZMA_FILTER_SPARC LZMA_VLI_C(0x09) - /**< - * Filter for SPARC binaries. - */ - - -/** - * \brief Options for so called "simple" filters - * - * The simple filters never change the size of the data. Specifying options - * for them is optional: if pointer to options is NULL, default values are - * used. You probably never need to specify these options, so just set the - * options pointer to NULL and be happy. - * - * If options with non-default values have been specified when encoding, - * the same options must also be specified when decoding. - * - * \note At the moment, none of the simple filters support - * LZMA_SYNC_FLUSH. If LZMA_SYNC_FLUSH is specified, - * LZMA_OPTIONS_ERROR will be returned. If there is need, - * partial support for LZMA_SYNC_FLUSH can be added in future. - * Partial means that flushing would be possible only at - * offsets that are multiple of 2, 4, or 16 depending on - * the filter, except x86 which cannot be made to support - * LZMA_SYNC_FLUSH predictably. - */ -typedef struct { - /** - * \brief Start offset for branch conversions - * - * This setting is useful only when the same filter is used - * _separately_ for multiple sections of the same executable file, - * and the sections contain cross-section branch/call/jump - * instructions. In that case it is benefical to set the start - * offset of the non-first sections so that the relative addresses - * of the cross-section branch/call/jump instructions will use the - * same absolute addresses as in the first section. - * - * When the pointer to options is NULL, the default value (zero) - * is used. - */ - uint32_t start_offset; - -} lzma_options_simple; diff --git a/src/liblzma/simple/simple_coder.c b/src/liblzma/simple/simple_coder.c index c3141b8f..555fcce8 100644 --- a/src/liblzma/simple/simple_coder.c +++ b/src/liblzma/simple/simple_coder.c @@ -254,7 +254,7 @@ lzma_simple_coder_init(lzma_next_coder *next, lzma_allocator *allocator, } if (filters[0].options != NULL) { - const lzma_options_simple *simple = filters[0].options; + const lzma_options_bcj *simple = filters[0].options; next->coder->now_pos = simple->start_offset; } else { next->coder->now_pos = 0; diff --git a/src/liblzma/simple/simple_decoder.c b/src/liblzma/simple/simple_decoder.c index 30dc7c57..d7c17e2f 100644 --- a/src/liblzma/simple/simple_decoder.c +++ b/src/liblzma/simple/simple_decoder.c @@ -30,8 +30,8 @@ lzma_simple_props_decode(void **options, lzma_allocator *allocator, if (props_size != 4) return LZMA_OPTIONS_ERROR; - lzma_options_simple *opt = lzma_alloc( - sizeof(lzma_options_simple), allocator); + lzma_options_bcj *opt = lzma_alloc( + sizeof(lzma_options_bcj), allocator); if (opt == NULL) return LZMA_MEM_ERROR; diff --git a/src/liblzma/simple/simple_encoder.c b/src/liblzma/simple/simple_encoder.c index 15d888d9..fe2f98d6 100644 --- a/src/liblzma/simple/simple_encoder.c +++ b/src/liblzma/simple/simple_encoder.c @@ -23,7 +23,7 @@ extern lzma_ret lzma_simple_props_size(uint32_t *size, const void *options) { - const lzma_options_simple *const opt = options; + const lzma_options_bcj *const opt = options; *size = (opt == NULL || opt->start_offset == 0) ? 0 : 4; return LZMA_OK; } @@ -32,7 +32,7 @@ lzma_simple_props_size(uint32_t *size, const void *options) extern lzma_ret lzma_simple_props_encode(const void *options, uint8_t *out) { - const lzma_options_simple *const opt = options; + const lzma_options_bcj *const opt = options; // The default start offset is zero, so we don't need to store any // options unless the start offset is non-zero. -- cgit v1.2.3