2 /* Reported by Jan Engelhardt <jengelh@inai.de> */
4 /* { dg-do compile { target fpic } } */
5 /* { dg-options "-std=gnu99 -O -fPIC -fprofile-generate" } */
7 typedef __SIZE_TYPE__ size_t;
8 typedef unsigned char uint8_t;
10 extern void *memcpy (void *__restrict __dest,
11 __const void *__restrict __src, size_t __n)
12 __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1, 2)));
18 LZMA_UNSUPPORTED_CHECK = 3,
21 LZMA_MEMLIMIT_ERROR = 6,
22 LZMA_FORMAT_ERROR = 7,
23 LZMA_OPTIONS_ERROR = 8,
37 void *( *alloc)(void *opaque, size_t nmemb, size_t size);
38 void ( *free)(void *opaque, void *ptr);
42 typedef struct lzma_coder_s lzma_coder;
44 typedef struct lzma_next_coder_s lzma_next_coder;
46 typedef struct lzma_filter_info_s lzma_filter_info;
48 typedef lzma_ret (*lzma_init_function)(
49 lzma_next_coder *next, lzma_allocator *allocator,
50 const lzma_filter_info *filters);
52 typedef lzma_ret (*lzma_code_function)(
53 lzma_coder *coder, lzma_allocator *allocator,
54 const uint8_t *restrict in, size_t *restrict in_pos,
55 size_t in_size, uint8_t *restrict out,
56 size_t *restrict out_pos, size_t out_size,
59 typedef void (*lzma_end_function)(
60 lzma_coder *coder, lzma_allocator *allocator);
70 lzma_ret (*code)(lzma_coder *restrict coder,
71 lzma_dict *restrict dict, const uint8_t *restrict in,
72 size_t *restrict in_pos, size_t in_size);
81 decode_buffer(lzma_coder *coder,
82 const uint8_t *restrict in, size_t *restrict in_pos,
83 size_t in_size, uint8_t *restrict out, size_t *restrict out_pos)
86 const size_t dict_start = coder->dict.pos;
88 = coder->lz.code( coder->lz.coder, &coder->dict, in, in_pos, in_size);
89 const size_t copy_size = coder->dict.pos - dict_start;
90 memcpy(out + *out_pos, coder->dict.buf + dict_start, copy_size);
91 if (ret != LZMA_OK || coder->dict.pos < coder->dict.size)