~ubuntu-branches/debian/stretch/silversearcher-ag/stretch

« back to all changes in this revision

Viewing changes to src/decompress.c

  • Committer: Package Import Robot
  • Author(s): Hajime Mizuno
  • Date: 2014-01-29 23:23:00 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20140129232300-um66iqygxjyuy980
Tags: 0.19.2-1
* new upstream release
* debian/control
  - set Standards-Version: 3.9.5.
* debian/rules
  - add empty "override_dh_auto_test" to skip the test.
    because cram is required for testing, but package does not exist.
* debian/copyright
  - update copyright year to 2013-2014.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include <string.h>
 
2
#include <unistd.h>
2
3
#include <zlib.h>
3
4
 
4
5
#include "decompress.h"
5
6
 
6
7
#ifdef HAVE_LZMA_H
7
8
#include <lzma.h>
8
 
#endif
9
 
 
10
9
 
11
10
/*  http://tukaani.org/xz/xz-file-format.txt */
12
11
const uint8_t XZ_HEADER_MAGIC[6] = { 0xFD, '7', 'z', 'X', 'Z', 0x00 };
13
12
const uint8_t LZMA_HEADER_SOMETIMES[3] = { 0x5D, 0x00, 0x00 };
 
13
#endif
 
14
 
 
15
 
14
16
 
15
17
/* Code in decompress_zlib from
16
18
 *
94
96
    return NULL;
95
97
}
96
98
 
 
99
 
97
100
static void* decompress_lzw(const void* buf, const int buf_len,
98
101
                            const char* dir_full_path, int* new_buf_len) {
99
102
    (void)buf; (void)buf_len;
102
105
    return NULL;
103
106
}
104
107
 
 
108
 
105
109
static void* decompress_zip(const void* buf, const int buf_len,
106
110
                            const char* dir_full_path, int* new_buf_len) {
107
111
    (void)buf; (void)buf_len;
110
114
    return NULL;
111
115
}
112
116
 
 
117
 
 
118
#ifdef HAVE_LZMA_H
113
119
static void* decompress_lzma(const void* buf, const int buf_len,
114
120
                             const char* dir_full_path, int* new_buf_len) {
115
121
    lzma_stream stream = LZMA_STREAM_INIT;
173
179
    }
174
180
    return NULL;
175
181
}
176
 
 
 
182
#endif
177
183
 
178
184
 
179
185
/* This function is very hot. It's called on every file when zip is enabled. */
187
193
             return decompress_lzw(buf, buf_len, dir_full_path, new_buf_len);
188
194
        case AG_ZIP:
189
195
             return decompress_zip(buf, buf_len, dir_full_path, new_buf_len);
 
196
#ifdef HAVE_LZMA_H
190
197
        case AG_XZ:
191
198
             return decompress_lzma(buf, buf_len, dir_full_path, new_buf_len);
 
199
#endif
192
200
        case AG_NO_COMPRESSION:
193
201
            log_err("File %s is not compressed", dir_full_path);
194
202
            break;
260
268
 
261
269
    return AG_NO_COMPRESSION;
262
270
}
263