Renamed lzma_options_simple to lzma_options_bcj in the API.
authorLasse Collin <lasse.collin@tukaani.org>
Wed, 31 Dec 2008 14:29:39 +0000 (16:29 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Wed, 31 Dec 2008 14:29:39 +0000 (16:29 +0200)
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
src/liblzma/api/lzma.h
src/liblzma/api/lzma/bcj.h [moved from src/liblzma/api/lzma/simple.h with 83% similarity]
src/liblzma/simple/simple_coder.c
src/liblzma/simple/simple_decoder.c
src/liblzma/simple/simple_encoder.c
tests/test_filter_flags.c

index f5101f9..12953c4 100644 (file)
@@ -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 \
index ef7a108..dc90deb 100644 (file)
@@ -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"
 
similarity index 83%
rename from src/liblzma/api/lzma/simple.h
rename to src/liblzma/api/lzma/bcj.h
index 6969ffa..33bd7da 100644 (file)
@@ -1,6 +1,6 @@
 /**
- * \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
@@ -25,7 +25,7 @@
 
 #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.
@@ -76,7 +76,7 @@
  */
 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,
@@ -91,4 +91,4 @@ typedef struct {
         */
        uint32_t start_offset;
 
-} lzma_options_simple;
+} lzma_options_bcj;
index c3141b8..555fcce 100644 (file)
@@ -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;
index 30dc7c5..d7c17e2 100644 (file)
@@ -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;
 
index 15d888d..fe2f98d 100644 (file)
@@ -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.
index dd4f56a..37bb583 100644 (file)
@@ -100,7 +100,7 @@ test_subblock(void)
 
 #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;
@@ -111,7 +111,7 @@ test_simple(void)
        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));
@@ -125,7 +125,7 @@ test_simple(void)
        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);
@@ -273,7 +273,7 @@ main(void)
        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();