]> granicus.if.org Git - xz/commitdiff
Fix a couple of warnings.
authorLasse Collin <lasse.collin@tukaani.org>
Fri, 11 Sep 2009 06:25:09 +0000 (09:25 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Fri, 11 Sep 2009 06:25:09 +0000 (09:25 +0300)
src/liblzma/common/stream_decoder.c
src/liblzma/lz/lz_encoder.c
src/liblzma/lzma/lzma_encoder.c
src/liblzma/lzma/lzma_encoder_optimum_normal.c
tests/tests.h

index dcc047d9673b64e71b4b33cfa2350f63895c6f34..680fc53e252c672f420fae47c3d168ef52ca9db2 100644 (file)
@@ -358,7 +358,7 @@ stream_decode(lzma_coder *coder, lzma_allocator *allocator,
                return LZMA_PROG_ERROR;
        }
 
-       return LZMA_OK;
+       // Never reached
 }
 
 
index 5437546dd2b7d1fdfd942ea53c7e32db1a7ad7b3..5fd03e8422aa2e0f7bdb10888e6222fbeabba8f5 100644 (file)
@@ -84,23 +84,20 @@ fill_window(lzma_coder *coder, lzma_allocator *allocator, const uint8_t *in,
        // (which I find cleanest), but we need size_t here when filling
        // the history window.
        size_t write_pos = coder->mf.write_pos;
-       size_t in_used;
        lzma_ret ret;
        if (coder->next.code == NULL) {
                // Not using a filter, simply memcpy() as much as possible.
-               in_used = lzma_bufcpy(in, in_pos, in_size, coder->mf.buffer,
+               lzma_bufcpy(in, in_pos, in_size, coder->mf.buffer,
                                &write_pos, coder->mf.size);
 
                ret = action != LZMA_RUN && *in_pos == in_size
                                ? LZMA_STREAM_END : LZMA_OK;
 
        } else {
-               const size_t in_start = *in_pos;
                ret = coder->next.code(coder->next.coder, allocator,
                                in, in_pos, in_size,
                                coder->mf.buffer, &write_pos,
                                coder->mf.size, action);
-               in_used = *in_pos - in_start;
        }
 
        coder->mf.write_pos = write_pos;
index bda194cddf220bdc7ffca2248c77cc86881f1039..e9836978f1871bd8053e84c88fd37795c03354e0 100644 (file)
@@ -486,7 +486,7 @@ lzma_lzma_encoder_reset(lzma_coder *coder, const lzma_options_lzma *options)
        rc_reset(&coder->rc);
 
        // State
-       coder->state = 0;
+       coder->state = STATE_LIT_LIT;
        for (size_t i = 0; i < REP_DISTANCES; ++i)
                coder->reps[i] = 0;
 
index cb9a1b9dbc46c309cac2b2af2bbd1ac648153e50..4e3754b0dce59b0fee1bb5e8267841374245da77 100644 (file)
@@ -455,7 +455,7 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
        uint32_t matches_count = coder->matches_count;
        uint32_t new_len = coder->longest_match_length;
        uint32_t pos_prev = coder->opts[cur].pos_prev;
-       uint32_t state;
+       lzma_lzma_state state;
 
        if (coder->opts[cur].prev_1_is_literal) {
                --pos_prev;
@@ -579,7 +579,7 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
                --len_test;
 
                if (len_test >= 2) {
-                       uint32_t state_2 = state;
+                       lzma_lzma_state state_2 = state;
                        update_literal(state_2);
 
                        const uint32_t pos_state_next = (position + 1) & coder->pos_mask;
@@ -657,7 +657,7 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
                len_test_2 -= len_test + 1;
 
                if (len_test_2 >= 2) {
-                       uint32_t state_2 = state;
+                       lzma_lzma_state state_2 = state;
                        update_long_rep(state_2);
 
                        uint32_t pos_state_next = (position + len_test) & coder->pos_mask;
@@ -753,7 +753,7 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
                                len_test_2 -= len_test + 1;
 
                                if (len_test_2 >= 2) {
-                                       uint32_t state_2 = state;
+                                       lzma_lzma_state state_2 = state;
                                        update_match(state_2);
                                        uint32_t pos_state_next
                                                        = (position + len_test) & coder->pos_mask;
index 185a68200585f487aa195a2f4a81b183dba2f087..60a7276c01bcd9b60cde7ea7f7e2f749cd1bbe17 100644 (file)
@@ -21,7 +21,7 @@
 
 #define memcrap(buf, size) memset(buf, 0xFD, size)
 
-#define expect(test) ((test) ? 0 : (fprintf(stderr, "%s:%u: %s\n", \
+#define expect(test) ((test) ? 0 : (fprintf(stderr, "%s:%d: %s\n", \
        __FILE__, __LINE__, #test), abort(), 0))
 
 #define succeed(test) expect(!(test))