Revision 0b178e56 libavutil/lzo.c

View differences:

libavutil/lzo.c
41 41
static inline int get_byte(LZOContext *c) {
42 42
    if (c->in < c->in_end)
43 43
        return *c->in++;
44
    c->error |= LZO_INPUT_DEPLETED;
44
    c->error |= AV_LZO_INPUT_DEPLETED;
45 45
    return 1;
46 46
}
47 47

  
......
88 88
    register uint8_t *dst = c->out;
89 89
    if (cnt > c->in_end - src) {
90 90
        cnt = FFMAX(c->in_end - src, 0);
91
        c->error |= LZO_INPUT_DEPLETED;
91
        c->error |= AV_LZO_INPUT_DEPLETED;
92 92
    }
93 93
    if (cnt > c->out_end - dst) {
94 94
        cnt = FFMAX(c->out_end - dst, 0);
95
        c->error |= LZO_OUTPUT_FULL;
95
        c->error |= AV_LZO_OUTPUT_FULL;
96 96
    }
97 97
#if defined(INBUF_PADDED) && defined(OUTBUF_PADDED)
98 98
    COPY4(dst, src);
......
120 120
    register const uint8_t *src = &c->out[-back];
121 121
    register uint8_t *dst = c->out;
122 122
    if (src < c->out_start || src > dst) {
123
        c->error |= LZO_INVALID_BACKPTR;
123
        c->error |= AV_LZO_INVALID_BACKPTR;
124 124
        return;
125 125
    }
126 126
    if (cnt > c->out_end - dst) {
127 127
        cnt = FFMAX(c->out_end - dst, 0);
128
        c->error |= LZO_OUTPUT_FULL;
128
        c->error |= AV_LZO_OUTPUT_FULL;
129 129
    }
130 130
    memcpy_backptr(dst, back, cnt);
131 131
    c->out = dst + cnt;
......
187 187
 * \return 0 on success, otherwise error flags, see lzo.h
188 188
 *
189 189
 * Make sure all buffers are appropriately padded, in must provide
190
 * LZO_INPUT_PADDING, out must provide LZO_OUTPUT_PADDING additional bytes.
190
 * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes.
191 191
 */
192
int lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) {
192
int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) {
193 193
    int state= 0;
194 194
    int x;
195 195
    LZOContext c;
......
202 202
    if (x > 17) {
203 203
        copy(&c, x - 17);
204 204
        x = GETB(c);
205
        if (x < 16) c.error |= LZO_ERROR;
205
        if (x < 16) c.error |= AV_LZO_ERROR;
206 206
    }
207 207
    if (c.in > c.in_end)
208
        c.error |= LZO_INPUT_DEPLETED;
208
        c.error |= AV_LZO_INPUT_DEPLETED;
209 209
    while (!c.error) {
210 210
        int cnt, back;
211 211
        if (x > 15) {
......
223 223
                back += (GETB(c) << 6) + (x >> 2);
224 224
                if (back == (1 << 14)) {
225 225
                    if (cnt != 1)
226
                        c.error |= LZO_ERROR;
226
                        c.error |= AV_LZO_ERROR;
227 227
                    break;
228 228
                }
229 229
            }
......
252 252
    return c.error;
253 253
}
254 254

  
255
#if LIBAVUTIL_VERSION_MAJOR < 50
256
int lzo1x_decode(void *out, int *outlen, const void *in, int *inlen) {
257
    return av_lzo1x_decode(out, outlen, in, inlen);
258
}
259
#endif
260

  
255 261
#ifdef TEST
256 262
#include <stdio.h>
257 263
#include <lzo/lzo1x.h>
......
277 283
#elif defined(LIBLZO_UNSAFE)
278 284
        if (lzo1x_decompress(comp, inlen, decomp, &outlen, NULL))
279 285
#else
280
        if (lzo1x_decode(decomp, &outlen, comp, &inlen))
286
        if (av_lzo1x_decode(decomp, &outlen, comp, &inlen))
281 287
#endif
282 288
            av_log(NULL, AV_LOG_ERROR, "decompression error\n");
283 289
STOP_TIMER("lzod")

Also available in: Unified diff