liblzma/api/lzma/container.h
author Ryan C. Gordon <icculus@icculus.org>
Thu, 18 Jun 2015 12:18:57 -0400
changeset 879 c2afc800b743
parent 844 f2f159d0867d
permissions -rw-r--r--
Assorted spelling fixes (thanks, Francois!).
icculus@798
     1
/**
icculus@798
     2
 * \file        lzma/container.h
icculus@798
     3
 * \brief       File formats
icculus@798
     4
 */
icculus@798
     5
icculus@798
     6
/*
icculus@798
     7
 * Author: Lasse Collin
icculus@798
     8
 *
icculus@798
     9
 * This file has been put into the public domain.
icculus@798
    10
 * You can do whatever you want with this file.
icculus@798
    11
 *
icculus@798
    12
 * See ../lzma.h for information about liblzma as a whole.
icculus@798
    13
 */
icculus@798
    14
icculus@798
    15
#ifndef LZMA_H_INTERNAL
icculus@798
    16
#	error Never include this file directly. Use <lzma.h> instead.
icculus@798
    17
#endif
icculus@798
    18
icculus@798
    19
icculus@798
    20
/************
icculus@798
    21
 * Encoding *
icculus@798
    22
 ************/
icculus@798
    23
icculus@798
    24
/**
icculus@798
    25
 * \brief       Default compression preset
icculus@798
    26
 *
icculus@798
    27
 * It's not straightforward to recommend a default preset, because in some
icculus@798
    28
 * cases keeping the resource usage relatively low is more important that
icculus@798
    29
 * getting the maximum compression ratio.
icculus@798
    30
 */
icculus@798
    31
#define LZMA_PRESET_DEFAULT     UINT32_C(6)
icculus@798
    32
icculus@798
    33
icculus@798
    34
/**
icculus@798
    35
 * \brief       Mask for preset level
icculus@798
    36
 *
icculus@798
    37
 * This is useful only if you need to extract the level from the preset
icculus@798
    38
 * variable. That should be rare.
icculus@798
    39
 */
icculus@798
    40
#define LZMA_PRESET_LEVEL_MASK  UINT32_C(0x1F)
icculus@798
    41
icculus@798
    42
icculus@798
    43
/*
icculus@798
    44
 * Preset flags
icculus@798
    45
 *
icculus@798
    46
 * Currently only one flag is defined.
icculus@798
    47
 */
icculus@798
    48
icculus@798
    49
/**
icculus@798
    50
 * \brief       Extreme compression preset
icculus@798
    51
 *
icculus@798
    52
 * This flag modifies the preset to make the encoding significantly slower
icculus@798
    53
 * while improving the compression ratio only marginally. This is useful
icculus@798
    54
 * when you don't mind wasting time to get as small result as possible.
icculus@798
    55
 *
icculus@798
    56
 * This flag doesn't affect the memory usage requirements of the decoder (at
icculus@798
    57
 * least not significantly). The memory usage of the encoder may be increased
icculus@798
    58
 * a little but only at the lowest preset levels (0-3).
icculus@798
    59
 */
icculus@798
    60
#define LZMA_PRESET_EXTREME       (UINT32_C(1) << 31)
icculus@798
    61
icculus@798
    62
icculus@798
    63
/**
icculus@798
    64
 * \brief       Calculate approximate memory usage of easy encoder
icculus@798
    65
 *
icculus@798
    66
 * This function is a wrapper for lzma_raw_encoder_memusage().
icculus@798
    67
 *
icculus@798
    68
 * \param       preset  Compression preset (level and possible flags)
kratz00@844
    69
 *
kratz00@844
    70
 * \return      Number of bytes of memory required for the given
kratz00@844
    71
 *              preset when encoding. If an error occurs, for example
kratz00@844
    72
 *              due to unsupported preset, UINT64_MAX is returned.
icculus@798
    73
 */
icculus@798
    74
extern LZMA_API(uint64_t) lzma_easy_encoder_memusage(uint32_t preset)
icculus@798
    75
		lzma_nothrow lzma_attr_pure;
icculus@798
    76
icculus@798
    77
icculus@798
    78
/**
icculus@798
    79
 * \brief       Calculate approximate decoder memory usage of a preset
icculus@798
    80
 *
icculus@798
    81
 * This function is a wrapper for lzma_raw_decoder_memusage().
icculus@798
    82
 *
icculus@798
    83
 * \param       preset  Compression preset (level and possible flags)
kratz00@844
    84
 *
kratz00@844
    85
 * \return      Number of bytes of memory required to decompress a file
kratz00@844
    86
 *              that was compressed using the given preset. If an error
kratz00@844
    87
 *              occurs, for example due to unsupported preset, UINT64_MAX
kratz00@844
    88
 *              is returned.
icculus@798
    89
 */
icculus@798
    90
extern LZMA_API(uint64_t) lzma_easy_decoder_memusage(uint32_t preset)
icculus@798
    91
		lzma_nothrow lzma_attr_pure;
icculus@798
    92
icculus@798
    93
icculus@798
    94
/**
icculus@798
    95
 * \brief       Initialize .xz Stream encoder using a preset number
icculus@798
    96
 *
icculus@798
    97
 * This function is intended for those who just want to use the basic features
icculus@798
    98
 * if liblzma (that is, most developers out there).
icculus@798
    99
 *
icculus@798
   100
 * \param       strm    Pointer to lzma_stream that is at least initialized
icculus@798
   101
 *                      with LZMA_STREAM_INIT.
icculus@798
   102
 * \param       preset  Compression preset to use. A preset consist of level
icculus@798
   103
 *                      number and zero or more flags. Usually flags aren't
icculus@798
   104
 *                      used, so preset is simply a number [0, 9] which match
icculus@798
   105
 *                      the options -0 ... -9 of the xz command line tool.
icculus@879
   106
 *                      Additional flags can be set using bitwise-or with
icculus@798
   107
 *                      the preset level number, e.g. 6 | LZMA_PRESET_EXTREME.
icculus@798
   108
 * \param       check   Integrity check type to use. See check.h for available
icculus@798
   109
 *                      checks. The xz command line tool defaults to
icculus@798
   110
 *                      LZMA_CHECK_CRC64, which is a good choice if you are
icculus@798
   111
 *                      unsure. LZMA_CHECK_CRC32 is good too as long as the
icculus@798
   112
 *                      uncompressed file is not many gigabytes.
icculus@798
   113
 *
icculus@798
   114
 * \return      - LZMA_OK: Initialization succeeded. Use lzma_code() to
icculus@798
   115
 *                encode your data.
icculus@798
   116
 *              - LZMA_MEM_ERROR: Memory allocation failed.
icculus@798
   117
 *              - LZMA_OPTIONS_ERROR: The given compression preset is not
icculus@798
   118
 *                supported by this build of liblzma.
icculus@798
   119
 *              - LZMA_UNSUPPORTED_CHECK: The given check type is not
icculus@798
   120
 *                supported by this liblzma build.
icculus@798
   121
 *              - LZMA_PROG_ERROR: One or more of the parameters have values
icculus@798
   122
 *                that will never be valid. For example, strm == NULL.
icculus@798
   123
 *
icculus@798
   124
 * If initialization fails (return value is not LZMA_OK), all the memory
icculus@798
   125
 * allocated for *strm by liblzma is always freed. Thus, there is no need
icculus@798
   126
 * to call lzma_end() after failed initialization.
icculus@798
   127
 *
icculus@798
   128
 * If initialization succeeds, use lzma_code() to do the actual encoding.
icculus@798
   129
 * Valid values for `action' (the second argument of lzma_code()) are
icculus@798
   130
 * LZMA_RUN, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, and LZMA_FINISH. In future,
icculus@798
   131
 * there may be compression levels or flags that don't support LZMA_SYNC_FLUSH.
icculus@798
   132
 */
icculus@798
   133
extern LZMA_API(lzma_ret) lzma_easy_encoder(
icculus@798
   134
		lzma_stream *strm, uint32_t preset, lzma_check check)
icculus@798
   135
		lzma_nothrow lzma_attr_warn_unused_result;
icculus@798
   136
icculus@798
   137
icculus@798
   138
/**
icculus@798
   139
 * \brief       Single-call .xz Stream encoding using a preset number
icculus@798
   140
 *
icculus@798
   141
 * The maximum required output buffer size can be calculated with
icculus@798
   142
 * lzma_stream_buffer_bound().
icculus@798
   143
 *
icculus@798
   144
 * \param       preset      Compression preset to use. See the description
icculus@798
   145
 *                          in lzma_easy_encoder().
icculus@798
   146
 * \param       check       Type of the integrity check to calculate from
icculus@798
   147
 *                          uncompressed data.
icculus@798
   148
 * \param       allocator   lzma_allocator for custom allocator functions.
icculus@798
   149
 *                          Set to NULL to use malloc() and free().
icculus@798
   150
 * \param       in          Beginning of the input buffer
icculus@798
   151
 * \param       in_size     Size of the input buffer
icculus@798
   152
 * \param       out         Beginning of the output buffer
icculus@798
   153
 * \param       out_pos     The next byte will be written to out[*out_pos].
icculus@798
   154
 *                          *out_pos is updated only if encoding succeeds.
icculus@798
   155
 * \param       out_size    Size of the out buffer; the first byte into
icculus@798
   156
 *                          which no data is written to is out[out_size].
icculus@798
   157
 *
icculus@798
   158
 * \return      - LZMA_OK: Encoding was successful.
icculus@798
   159
 *              - LZMA_BUF_ERROR: Not enough output buffer space.
kratz00@844
   160
 *              - LZMA_UNSUPPORTED_CHECK
icculus@798
   161
 *              - LZMA_OPTIONS_ERROR
icculus@798
   162
 *              - LZMA_MEM_ERROR
icculus@798
   163
 *              - LZMA_DATA_ERROR
icculus@798
   164
 *              - LZMA_PROG_ERROR
icculus@798
   165
 */
icculus@798
   166
extern LZMA_API(lzma_ret) lzma_easy_buffer_encode(
icculus@798
   167
		uint32_t preset, lzma_check check,
icculus@798
   168
		lzma_allocator *allocator, const uint8_t *in, size_t in_size,
icculus@798
   169
		uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
icculus@798
   170
icculus@798
   171
icculus@798
   172
/**
icculus@798
   173
 * \brief       Initialize .xz Stream encoder using a custom filter chain
icculus@798
   174
 *
icculus@798
   175
 * \param       strm    Pointer to properly prepared lzma_stream
icculus@798
   176
 * \param       filters Array of filters. This must be terminated with
icculus@798
   177
 *                      filters[n].id = LZMA_VLI_UNKNOWN. See filter.h for
icculus@798
   178
 *                      more information.
icculus@798
   179
 * \param       check   Type of the integrity check to calculate from
icculus@798
   180
 *                      uncompressed data.
icculus@798
   181
 *
icculus@798
   182
 * \return      - LZMA_OK: Initialization was successful.
icculus@798
   183
 *              - LZMA_MEM_ERROR
kratz00@844
   184
 *              - LZMA_UNSUPPORTED_CHECK
icculus@798
   185
 *              - LZMA_OPTIONS_ERROR
icculus@798
   186
 *              - LZMA_PROG_ERROR
icculus@798
   187
 */
icculus@798
   188
extern LZMA_API(lzma_ret) lzma_stream_encoder(lzma_stream *strm,
icculus@798
   189
		const lzma_filter *filters, lzma_check check)
icculus@798
   190
		lzma_nothrow lzma_attr_warn_unused_result;
icculus@798
   191
icculus@798
   192
icculus@798
   193
/**
icculus@798
   194
 * \brief       Initialize .lzma encoder (legacy file format)
icculus@798
   195
 *
icculus@798
   196
 * The .lzma format is sometimes called the LZMA_Alone format, which is the
icculus@798
   197
 * reason for the name of this function. The .lzma format supports only the
icculus@798
   198
 * LZMA1 filter. There is no support for integrity checks like CRC32.
icculus@798
   199
 *
icculus@798
   200
 * Use this function if and only if you need to create files readable by
icculus@798
   201
 * legacy LZMA tools such as LZMA Utils 4.32.x. Moving to the .xz format
icculus@798
   202
 * is strongly recommended.
icculus@798
   203
 *
icculus@798
   204
 * The valid action values for lzma_code() are LZMA_RUN and LZMA_FINISH.
icculus@798
   205
 * No kind of flushing is supported, because the file format doesn't make
icculus@798
   206
 * it possible.
icculus@798
   207
 *
icculus@798
   208
 * \return      - LZMA_OK
icculus@798
   209
 *              - LZMA_MEM_ERROR
icculus@798
   210
 *              - LZMA_OPTIONS_ERROR
icculus@798
   211
 *              - LZMA_PROG_ERROR
icculus@798
   212
 */
icculus@798
   213
extern LZMA_API(lzma_ret) lzma_alone_encoder(
icculus@798
   214
		lzma_stream *strm, const lzma_options_lzma *options)
icculus@798
   215
		lzma_nothrow lzma_attr_warn_unused_result;
icculus@798
   216
icculus@798
   217
icculus@798
   218
/**
icculus@798
   219
 * \brief       Calculate output buffer size for single-call Stream encoder
icculus@798
   220
 *
icculus@798
   221
 * When trying to compress uncompressible data, the encoded size will be
icculus@798
   222
 * slightly bigger than the input data. This function calculates how much
icculus@798
   223
 * output buffer space is required to be sure that lzma_stream_buffer_encode()
icculus@798
   224
 * doesn't return LZMA_BUF_ERROR.
icculus@798
   225
 *
icculus@798
   226
 * The calculated value is not exact, but it is guaranteed to be big enough.
icculus@798
   227
 * The actual maximum output space required may be slightly smaller (up to
icculus@798
   228
 * about 100 bytes). This should not be a problem in practice.
icculus@798
   229
 *
icculus@798
   230
 * If the calculated maximum size doesn't fit into size_t or would make the
icculus@798
   231
 * Stream grow past LZMA_VLI_MAX (which should never happen in practice),
icculus@798
   232
 * zero is returned to indicate the error.
icculus@798
   233
 *
icculus@798
   234
 * \note        The limit calculated by this function applies only to
icculus@798
   235
 *              single-call encoding. Multi-call encoding may (and probably
icculus@798
   236
 *              will) have larger maximum expansion when encoding
icculus@798
   237
 *              uncompressible data. Currently there is no function to
icculus@798
   238
 *              calculate the maximum expansion of multi-call encoding.
icculus@798
   239
 */
icculus@798
   240
extern LZMA_API(size_t) lzma_stream_buffer_bound(size_t uncompressed_size)
icculus@798
   241
		lzma_nothrow;
icculus@798
   242
icculus@798
   243
icculus@798
   244
/**
icculus@798
   245
 * \brief       Single-call .xz Stream encoder
icculus@798
   246
 *
icculus@798
   247
 * \param       filters     Array of filters. This must be terminated with
icculus@798
   248
 *                          filters[n].id = LZMA_VLI_UNKNOWN. See filter.h
icculus@798
   249
 *                          for more information.
icculus@798
   250
 * \param       check       Type of the integrity check to calculate from
icculus@798
   251
 *                          uncompressed data.
icculus@798
   252
 * \param       allocator   lzma_allocator for custom allocator functions.
icculus@798
   253
 *                          Set to NULL to use malloc() and free().
icculus@798
   254
 * \param       in          Beginning of the input buffer
icculus@798
   255
 * \param       in_size     Size of the input buffer
icculus@798
   256
 * \param       out         Beginning of the output buffer
icculus@798
   257
 * \param       out_pos     The next byte will be written to out[*out_pos].
icculus@798
   258
 *                          *out_pos is updated only if encoding succeeds.
icculus@798
   259
 * \param       out_size    Size of the out buffer; the first byte into
icculus@798
   260
 *                          which no data is written to is out[out_size].
icculus@798
   261
 *
icculus@798
   262
 * \return      - LZMA_OK: Encoding was successful.
icculus@798
   263
 *              - LZMA_BUF_ERROR: Not enough output buffer space.
kratz00@844
   264
 *              - LZMA_UNSUPPORTED_CHECK
icculus@798
   265
 *              - LZMA_OPTIONS_ERROR
icculus@798
   266
 *              - LZMA_MEM_ERROR
icculus@798
   267
 *              - LZMA_DATA_ERROR
icculus@798
   268
 *              - LZMA_PROG_ERROR
icculus@798
   269
 */
icculus@798
   270
extern LZMA_API(lzma_ret) lzma_stream_buffer_encode(
icculus@798
   271
		lzma_filter *filters, lzma_check check,
icculus@798
   272
		lzma_allocator *allocator, const uint8_t *in, size_t in_size,
icculus@798
   273
		uint8_t *out, size_t *out_pos, size_t out_size)
icculus@798
   274
		lzma_nothrow lzma_attr_warn_unused_result;
icculus@798
   275
icculus@798
   276
icculus@798
   277
/************
icculus@798
   278
 * Decoding *
icculus@798
   279
 ************/
icculus@798
   280
icculus@798
   281
/**
icculus@798
   282
 * This flag makes lzma_code() return LZMA_NO_CHECK if the input stream
icculus@798
   283
 * being decoded has no integrity check. Note that when used with
icculus@798
   284
 * lzma_auto_decoder(), all .lzma files will trigger LZMA_NO_CHECK
icculus@798
   285
 * if LZMA_TELL_NO_CHECK is used.
icculus@798
   286
 */
icculus@798
   287
#define LZMA_TELL_NO_CHECK              UINT32_C(0x01)
icculus@798
   288
icculus@798
   289
icculus@798
   290
/**
icculus@798
   291
 * This flag makes lzma_code() return LZMA_UNSUPPORTED_CHECK if the input
icculus@798
   292
 * stream has an integrity check, but the type of the integrity check is not
icculus@798
   293
 * supported by this liblzma version or build. Such files can still be
icculus@798
   294
 * decoded, but the integrity check cannot be verified.
icculus@798
   295
 */
icculus@798
   296
#define LZMA_TELL_UNSUPPORTED_CHECK     UINT32_C(0x02)
icculus@798
   297
icculus@798
   298
icculus@798
   299
/**
icculus@798
   300
 * This flag makes lzma_code() return LZMA_GET_CHECK as soon as the type
icculus@798
   301
 * of the integrity check is known. The type can then be got with
icculus@798
   302
 * lzma_get_check().
icculus@798
   303
 */
icculus@798
   304
#define LZMA_TELL_ANY_CHECK             UINT32_C(0x04)
icculus@798
   305
icculus@798
   306
icculus@798
   307
/**
icculus@798
   308
 * This flag enables decoding of concatenated files with file formats that
icculus@798
   309
 * allow concatenating compressed files as is. From the formats currently
icculus@798
   310
 * supported by liblzma, only the .xz format allows concatenated files.
icculus@798
   311
 * Concatenated files are not allowed with the legacy .lzma format.
icculus@798
   312
 *
icculus@798
   313
 * This flag also affects the usage of the `action' argument for lzma_code().
icculus@798
   314
 * When LZMA_CONCATENATED is used, lzma_code() won't return LZMA_STREAM_END
icculus@798
   315
 * unless LZMA_FINISH is used as `action'. Thus, the application has to set
icculus@798
   316
 * LZMA_FINISH in the same way as it does when encoding.
icculus@798
   317
 *
icculus@798
   318
 * If LZMA_CONCATENATED is not used, the decoders still accept LZMA_FINISH
icculus@798
   319
 * as `action' for lzma_code(), but the usage of LZMA_FINISH isn't required.
icculus@798
   320
 */
icculus@798
   321
#define LZMA_CONCATENATED               UINT32_C(0x08)
icculus@798
   322
icculus@798
   323
icculus@798
   324
/**
icculus@798
   325
 * \brief       Initialize .xz Stream decoder
icculus@798
   326
 *
icculus@798
   327
 * \param       strm        Pointer to properly prepared lzma_stream
icculus@798
   328
 * \param       memlimit    Memory usage limit as bytes. Use UINT64_MAX
icculus@798
   329
 *                          to effectively disable the limiter.
icculus@798
   330
 * \param       flags       Bitwise-or of zero or more of the decoder flags:
icculus@798
   331
 *                          LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK,
icculus@798
   332
 *                          LZMA_TELL_ANY_CHECK, LZMA_CONCATENATED
icculus@798
   333
 *
icculus@798
   334
 * \return      - LZMA_OK: Initialization was successful.
icculus@798
   335
 *              - LZMA_MEM_ERROR: Cannot allocate memory.
icculus@798
   336
 *              - LZMA_OPTIONS_ERROR: Unsupported flags
icculus@798
   337
 *              - LZMA_PROG_ERROR
icculus@798
   338
 */
icculus@798
   339
extern LZMA_API(lzma_ret) lzma_stream_decoder(
icculus@798
   340
		lzma_stream *strm, uint64_t memlimit, uint32_t flags)
icculus@798
   341
		lzma_nothrow lzma_attr_warn_unused_result;
icculus@798
   342
icculus@798
   343
icculus@798
   344
/**
icculus@798
   345
 * \brief       Decode .xz Streams and .lzma files with autodetection
icculus@798
   346
 *
icculus@798
   347
 * This decoder autodetects between the .xz and .lzma file formats, and
icculus@798
   348
 * calls lzma_stream_decoder() or lzma_alone_decoder() once the type
icculus@798
   349
 * of the input file has been detected.
icculus@798
   350
 *
icculus@798
   351
 * \param       strm        Pointer to properly prepared lzma_stream
icculus@798
   352
 * \param       memlimit    Memory usage limit as bytes. Use UINT64_MAX
icculus@798
   353
 *                          to effectively disable the limiter.
icculus@798
   354
 * \param       flags       Bitwise-or of flags, or zero for no flags.
icculus@798
   355
 *
icculus@798
   356
 * \return      - LZMA_OK: Initialization was successful.
icculus@798
   357
 *              - LZMA_MEM_ERROR: Cannot allocate memory.
icculus@798
   358
 *              - LZMA_OPTIONS_ERROR: Unsupported flags
icculus@798
   359
 *              - LZMA_PROG_ERROR
icculus@798
   360
 */
icculus@798
   361
extern LZMA_API(lzma_ret) lzma_auto_decoder(
icculus@798
   362
		lzma_stream *strm, uint64_t memlimit, uint32_t flags)
icculus@798
   363
		lzma_nothrow lzma_attr_warn_unused_result;
icculus@798
   364
icculus@798
   365
icculus@798
   366
/**
icculus@798
   367
 * \brief       Initialize .lzma decoder (legacy file format)
icculus@798
   368
 *
icculus@798
   369
 * Valid `action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH.
icculus@798
   370
 * There is no need to use LZMA_FINISH, but allowing it may simplify
icculus@798
   371
 * certain types of applications.
icculus@798
   372
 *
icculus@798
   373
 * \return      - LZMA_OK
icculus@798
   374
 *              - LZMA_MEM_ERROR
icculus@798
   375
 *              - LZMA_PROG_ERROR
icculus@798
   376
 */
icculus@798
   377
extern LZMA_API(lzma_ret) lzma_alone_decoder(
icculus@798
   378
		lzma_stream *strm, uint64_t memlimit)
icculus@798
   379
		lzma_nothrow lzma_attr_warn_unused_result;
icculus@798
   380
icculus@798
   381
icculus@798
   382
/**
icculus@798
   383
 * \brief       Single-call .xz Stream decoder
icculus@798
   384
 *
icculus@798
   385
 * \param       memlimit    Pointer to how much memory the decoder is allowed
icculus@798
   386
 *                          to allocate. The value pointed by this pointer is
icculus@798
   387
 *                          modified if and only if LZMA_MEMLIMIT_ERROR is
icculus@798
   388
 *                          returned.
icculus@798
   389
 * \param       flags       Bitwise-or of zero or more of the decoder flags:
icculus@798
   390
 *                          LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK,
icculus@798
   391
 *                          LZMA_CONCATENATED. Note that LZMA_TELL_ANY_CHECK
icculus@798
   392
 *                          is not allowed and will return LZMA_PROG_ERROR.
icculus@798
   393
 * \param       allocator   lzma_allocator for custom allocator functions.
icculus@798
   394
 *                          Set to NULL to use malloc() and free().
icculus@798
   395
 * \param       in          Beginning of the input buffer
icculus@798
   396
 * \param       in_pos      The next byte will be read from in[*in_pos].
icculus@798
   397
 *                          *in_pos is updated only if decoding succeeds.
icculus@798
   398
 * \param       in_size     Size of the input buffer; the first byte that
icculus@798
   399
 *                          won't be read is in[in_size].
icculus@798
   400
 * \param       out         Beginning of the output buffer
icculus@798
   401
 * \param       out_pos     The next byte will be written to out[*out_pos].
icculus@798
   402
 *                          *out_pos is updated only if decoding succeeds.
icculus@798
   403
 * \param       out_size    Size of the out buffer; the first byte into
icculus@798
   404
 *                          which no data is written to is out[out_size].
icculus@798
   405
 *
icculus@798
   406
 * \return      - LZMA_OK: Decoding was successful.
icculus@798
   407
 *              - LZMA_FORMAT_ERROR
icculus@798
   408
 *              - LZMA_OPTIONS_ERROR
icculus@798
   409
 *              - LZMA_DATA_ERROR
icculus@798
   410
 *              - LZMA_NO_CHECK: This can be returned only if using
icculus@798
   411
 *                the LZMA_TELL_NO_CHECK flag.
icculus@798
   412
 *              - LZMA_UNSUPPORTED_CHECK: This can be returned only if using
icculus@798
   413
 *                the LZMA_TELL_UNSUPPORTED_CHECK flag.
icculus@798
   414
 *              - LZMA_MEM_ERROR
icculus@798
   415
 *              - LZMA_MEMLIMIT_ERROR: Memory usage limit was reached.
icculus@798
   416
 *                The minimum required memlimit value was stored to *memlimit.
icculus@798
   417
 *              - LZMA_BUF_ERROR: Output buffer was too small.
icculus@798
   418
 *              - LZMA_PROG_ERROR
icculus@798
   419
 */
icculus@798
   420
extern LZMA_API(lzma_ret) lzma_stream_buffer_decode(
icculus@798
   421
		uint64_t *memlimit, uint32_t flags, lzma_allocator *allocator,
icculus@798
   422
		const uint8_t *in, size_t *in_pos, size_t in_size,
icculus@798
   423
		uint8_t *out, size_t *out_pos, size_t out_size)
icculus@798
   424
		lzma_nothrow lzma_attr_warn_unused_result;