/**
- * \file lzma/simple.h
- * \brief So called "simple" filters
+ * \file lzma/bcj.h
+ * \brief Branch/Call/Jump conversion filters
*
* \author Copyright (C) 1999-2006 Igor Pavlov
* \author Copyright (C) 2007 Lasse Collin
#define LZMA_FILTER_X86 LZMA_VLI_C(0x04)
/**<
- * BCJ (Branch, Call, Jump) filter for x86 binaries
+ * Filter for x86 binaries
*/
#define LZMA_FILTER_POWERPC LZMA_VLI_C(0x05)
/**
- * \brief Options for so called "simple" filters
+ * \brief Options for BCJ 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.
+ * 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 simple filters support
+ * \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.
*/
typedef struct {
/**
- * \brief Start offset for branch conversions
+ * \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,
*/
uint32_t start_offset;
-} lzma_options_simple;
+} lzma_options_bcj;
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;
}
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.
#if defined(HAVE_ENCODER_X86) && defined(HAVE_DECODER_X86)
static void
-test_simple(void)
+test_bcj(void)
{
// Test 1
known_flags.id = LZMA_FILTER_X86;
expect(decoded_flags.options == NULL);
// Test 2
- lzma_options_simple options;
+ lzma_options_bcj options;
options.start_offset = 0;
known_flags.options = &options;
expect(!encode(2));
expect(!decode(6));
expect(decoded_flags.options != NULL);
- lzma_options_simple *decoded = decoded_flags.options;
+ lzma_options_bcj *decoded = decoded_flags.options;
expect(decoded->start_offset == options.start_offset);
free(decoded);
test_subblock();
#endif
#if defined(HAVE_ENCODER_X86) && defined(HAVE_DECODER_X86)
- test_simple();
+ test_bcj();
#endif
#if defined(HAVE_ENCODER_DELTA) && defined(HAVE_DECODER_DELTA)
test_delta();