Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: src/liblzma/api/lzma/filter.h

Issue 7109015: Update XZ Utils to 5.0.3 (in deps) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/xz/
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/liblzma/api/lzma/container.h ('k') | src/liblzma/api/lzma/hardware.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /** 1 /**
2 * \file lzma/filter.h 2 * \file lzma/filter.h
3 * \brief Common filter related types 3 * \brief Common filter related types and functions
4 */ 4 */
5 5
6 /* 6 /*
7 * Author: Lasse Collin 7 * Author: Lasse Collin
8 * 8 *
9 * This file has been put into the public domain. 9 * This file has been put into the public domain.
10 * You can do whatever you want with this file. 10 * You can do whatever you want with this file.
11 * 11 *
12 * See ../lzma.h for information about liblzma as a whole. 12 * See ../lzma.h for information about liblzma as a whole.
13 */ 13 */
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 * cannot be 64-bit. 52 * cannot be 64-bit.
53 */ 53 */
54 lzma_vli id; 54 lzma_vli id;
55 55
56 /** 56 /**
57 * \brief Pointer to filter-specific options structure 57 * \brief Pointer to filter-specific options structure
58 * 58 *
59 * If the filter doesn't need options, set this to NULL. If id is 59 * If the filter doesn't need options, set this to NULL. If id is
60 * set to LZMA_VLI_UNKNOWN, options is ignored, and thus 60 * set to LZMA_VLI_UNKNOWN, options is ignored, and thus
61 * doesn't need be initialized. 61 * doesn't need be initialized.
62 *
63 * Some filters support changing the options in the middle of
64 * the encoding process. These filters store the pointer of the
65 * options structure and communicate with the application via
66 * modifications of the options structure.
67 */ 62 */
68 void *options; 63 void *options;
69 64
70 } lzma_filter; 65 } lzma_filter;
71 66
72 67
73 /** 68 /**
74 * \brief Test if the given Filter ID is supported for encoding 69 * \brief Test if the given Filter ID is supported for encoding
75 * 70 *
76 * Return true if the give Filter ID is supported for encoding by this 71 * Return true if the give Filter ID is supported for encoding by this
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 * - LZMA_MEM_ERROR 114 * - LZMA_MEM_ERROR
120 * - LZMA_OPTIONS_ERROR: Unsupported Filter ID and its options 115 * - LZMA_OPTIONS_ERROR: Unsupported Filter ID and its options
121 * is not NULL. 116 * is not NULL.
122 * - LZMA_PROG_ERROR: src or dest is NULL. 117 * - LZMA_PROG_ERROR: src or dest is NULL.
123 */ 118 */
124 extern LZMA_API(lzma_ret) lzma_filters_copy(const lzma_filter *src, 119 extern LZMA_API(lzma_ret) lzma_filters_copy(const lzma_filter *src,
125 lzma_filter *dest, lzma_allocator *allocator) lzma_nothrow; 120 lzma_filter *dest, lzma_allocator *allocator) lzma_nothrow;
126 121
127 122
128 /** 123 /**
129 * \brief Calculate rough memory requirements for raw encoder 124 * \brief Calculate approximate memory requirements for raw encoder
130 * 125 *
131 * Because the calculation is rough, this function can be used to calculate 126 * This function can be used to calculate the memory requirements for
132 * the memory requirements for Block and Stream encoders too. 127 * Block and Stream encoders too because Block and Stream encoders don't
128 * need significantly more memory than raw encoder.
133 * 129 *
134 * \param filters Array of filters terminated with 130 * \param filters Array of filters terminated with
135 * .id == LZMA_VLI_UNKNOWN. 131 * .id == LZMA_VLI_UNKNOWN.
136 * 132 *
137 * \return Rough number of bytes of memory required for the given 133 * \return Number of bytes of memory required for the given
138 * filter chain when encoding. 134 * filter chain when encoding. If an error occurs,
135 * for example due to unsupported filter chain,
136 * UINT64_MAX is returned.
139 */ 137 */
140 extern LZMA_API(uint64_t) lzma_raw_encoder_memusage(const lzma_filter *filters) 138 extern LZMA_API(uint64_t) lzma_raw_encoder_memusage(const lzma_filter *filters)
141 lzma_nothrow lzma_attr_pure; 139 lzma_nothrow lzma_attr_pure;
142 140
143 141
144 /** 142 /**
145 * \brief Calculate rough memory requirements for raw decoder 143 * \brief Calculate approximate memory requirements for raw decoder
146 * 144 *
147 * Because the calculation is rough, this function can be used to calculate 145 * This function can be used to calculate the memory requirements for
148 * the memory requirements for Block and Stream decoders too. 146 * Block and Stream decoders too because Block and Stream decoders don't
147 * need significantly more memory than raw decoder.
149 * 148 *
150 * \param filters Array of filters terminated with 149 * \param filters Array of filters terminated with
151 * .id == LZMA_VLI_UNKNOWN. 150 * .id == LZMA_VLI_UNKNOWN.
152 * 151 *
153 * \return Rough number of bytes of memory required for the given 152 * \return Number of bytes of memory required for the given
154 * filter chain when decoding. 153 * filter chain when decoding. If an error occurs,
154 * for example due to unsupported filter chain,
155 * UINT64_MAX is returned.
155 */ 156 */
156 extern LZMA_API(uint64_t) lzma_raw_decoder_memusage(const lzma_filter *filters) 157 extern LZMA_API(uint64_t) lzma_raw_decoder_memusage(const lzma_filter *filters)
157 lzma_nothrow lzma_attr_pure; 158 lzma_nothrow lzma_attr_pure;
158 159
159 160
160 /** 161 /**
161 * \brief Initialize raw encoder 162 * \brief Initialize raw encoder
162 * 163 *
163 * This function may be useful when implementing custom file formats. 164 * This function may be useful when implementing custom file formats.
164 * 165 *
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 * 245 *
245 * \return - LZMA_OK: Encoding was successful. 246 * \return - LZMA_OK: Encoding was successful.
246 * - LZMA_BUF_ERROR: Not enough output buffer space. 247 * - LZMA_BUF_ERROR: Not enough output buffer space.
247 * - LZMA_OPTIONS_ERROR 248 * - LZMA_OPTIONS_ERROR
248 * - LZMA_MEM_ERROR 249 * - LZMA_MEM_ERROR
249 * - LZMA_DATA_ERROR 250 * - LZMA_DATA_ERROR
250 * - LZMA_PROG_ERROR 251 * - LZMA_PROG_ERROR
251 * 252 *
252 * \note There is no function to calculate how big output buffer 253 * \note There is no function to calculate how big output buffer
253 * would surely be big enough. (lzma_stream_buffer_bound() 254 * would surely be big enough. (lzma_stream_buffer_bound()
254 * works only for lzma_stream_buffer_encode().) 255 * works only for lzma_stream_buffer_encode(); raw encoder
256 * won't necessarily meet that bound.)
255 */ 257 */
256 extern LZMA_API(lzma_ret) lzma_raw_buffer_encode( 258 extern LZMA_API(lzma_ret) lzma_raw_buffer_encode(
257 const lzma_filter *filters, lzma_allocator *allocator, 259 const lzma_filter *filters, lzma_allocator *allocator,
258 const uint8_t *in, size_t in_size, uint8_t *out, 260 const uint8_t *in, size_t in_size, uint8_t *out,
259 size_t *out_pos, size_t out_size) lzma_nothrow; 261 size_t *out_pos, size_t out_size) lzma_nothrow;
260 262
261 263
262 /** 264 /**
263 * \brief Single-call raw decoder 265 * \brief Single-call raw decoder
264 * 266 *
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 * 318 *
317 * \return - LZMA_OK 319 * \return - LZMA_OK
318 * - LZMA_OPTIONS_ERROR 320 * - LZMA_OPTIONS_ERROR
319 * - LZMA_PROG_ERROR 321 * - LZMA_PROG_ERROR
320 * 322 *
321 * \note Even this function won't validate more options than actually 323 * \note Even this function won't validate more options than actually
322 * necessary. Thus, it is possible that encoding the properties 324 * necessary. Thus, it is possible that encoding the properties
323 * succeeds but using the same options to initialize the encoder 325 * succeeds but using the same options to initialize the encoder
324 * will fail. 326 * will fail.
325 * 327 *
326 * \note It is OK to skip calling this function if 328 * \note If lzma_properties_size() indicated that the size
327 * lzma_properties_size() indicated that the size 329 * of the Filter Properties field is zero, calling
328 * of the Filter Properties field is zero. 330 * lzma_properties_encode() is not required, but it
331 * won't do any harm either.
329 */ 332 */
330 extern LZMA_API(lzma_ret) lzma_properties_encode( 333 extern LZMA_API(lzma_ret) lzma_properties_encode(
331 const lzma_filter *filter, uint8_t *props) lzma_nothrow; 334 const lzma_filter *filter, uint8_t *props) lzma_nothrow;
332 335
333 336
334 /** 337 /**
335 * \brief Decode the Filter Properties field 338 * \brief Decode the Filter Properties field
336 * 339 *
337 * \param filter filter->id must have been set to the correct 340 * \param filter filter->id must have been set to the correct
338 * Filter ID. filter->options doesn't need to be 341 * Filter ID. filter->options doesn't need to be
(...skipping 18 matching lines...) Expand all
357 const uint8_t *props, size_t props_size) lzma_nothrow; 360 const uint8_t *props, size_t props_size) lzma_nothrow;
358 361
359 362
360 /** 363 /**
361 * \brief Calculate encoded size of a Filter Flags field 364 * \brief Calculate encoded size of a Filter Flags field
362 * 365 *
363 * Knowing the size of Filter Flags is useful to know when allocating 366 * Knowing the size of Filter Flags is useful to know when allocating
364 * memory to hold the encoded Filter Flags. 367 * memory to hold the encoded Filter Flags.
365 * 368 *
366 * \param size Pointer to integer to hold the calculated size 369 * \param size Pointer to integer to hold the calculated size
367 * \param filters Filter ID and associated options whose encoded 370 * \param filter Filter ID and associated options whose encoded
368 * size is to be calculated 371 * size is to be calculated
369 * 372 *
370 * \return - LZMA_OK: *size set successfully. Note that this doesn't 373 * \return - LZMA_OK: *size set successfully. Note that this doesn't
371 * guarantee that filters->options is valid, thus 374 * guarantee that filter->options is valid, thus
372 * lzma_filter_flags_encode() may still fail. 375 * lzma_filter_flags_encode() may still fail.
373 * - LZMA_OPTIONS_ERROR: Unknown Filter ID or unsupported options. 376 * - LZMA_OPTIONS_ERROR: Unknown Filter ID or unsupported options.
374 * - LZMA_PROG_ERROR: Invalid options 377 * - LZMA_PROG_ERROR: Invalid options
375 * 378 *
376 * \note If you need to calculate size of List of Filter Flags, 379 * \note If you need to calculate size of List of Filter Flags,
377 * you need to loop over every lzma_filter entry. 380 * you need to loop over every lzma_filter entry.
378 */ 381 */
379 extern LZMA_API(lzma_ret) lzma_filter_flags_size( 382 extern LZMA_API(lzma_ret) lzma_filter_flags_size(
380 » » uint32_t *size, const lzma_filter *filters) 383 » » uint32_t *size, const lzma_filter *filter)
381 lzma_nothrow lzma_attr_warn_unused_result; 384 lzma_nothrow lzma_attr_warn_unused_result;
382 385
383 386
384 /** 387 /**
385 * \brief Encode Filter Flags into given buffer 388 * \brief Encode Filter Flags into given buffer
386 * 389 *
387 * In contrast to some functions, this doesn't allocate the needed buffer. 390 * In contrast to some functions, this doesn't allocate the needed buffer.
388 * This is due to how this function is used internally by liblzma. 391 * This is due to how this function is used internally by liblzma.
389 * 392 *
390 * \param filters Filter ID and options to be encoded 393 * \param filter Filter ID and options to be encoded
391 * \param out Beginning of the output buffer 394 * \param out Beginning of the output buffer
392 * \param out_pos out[*out_pos] is the next write position. This 395 * \param out_pos out[*out_pos] is the next write position. This
393 * is updated by the encoder. 396 * is updated by the encoder.
394 * \param out_size out[out_size] is the first byte to not write. 397 * \param out_size out[out_size] is the first byte to not write.
395 * 398 *
396 * \return - LZMA_OK: Encoding was successful. 399 * \return - LZMA_OK: Encoding was successful.
397 * - LZMA_OPTIONS_ERROR: Invalid or unsupported options. 400 * - LZMA_OPTIONS_ERROR: Invalid or unsupported options.
398 * - LZMA_PROG_ERROR: Invalid options or not enough output 401 * - LZMA_PROG_ERROR: Invalid options or not enough output
399 * buffer space (you should have checked it with 402 * buffer space (you should have checked it with
400 * lzma_filter_flags_size()). 403 * lzma_filter_flags_size()).
401 */ 404 */
402 extern LZMA_API(lzma_ret) lzma_filter_flags_encode(const lzma_filter *filters, 405 extern LZMA_API(lzma_ret) lzma_filter_flags_encode(const lzma_filter *filter,
403 uint8_t *out, size_t *out_pos, size_t out_size) 406 uint8_t *out, size_t *out_pos, size_t out_size)
404 lzma_nothrow lzma_attr_warn_unused_result; 407 lzma_nothrow lzma_attr_warn_unused_result;
405 408
406 409
407 /** 410 /**
408 * \brief Decode Filter Flags from given buffer 411 * \brief Decode Filter Flags from given buffer
409 * 412 *
410 * The decoded result is stored into *filters. filters->options is 413 * The decoded result is stored into *filter. The old value of
411 * initialized but the old value is NOT free()d. 414 * filter->options is not free()d.
412 * 415 *
413 * \return - LZMA_OK 416 * \return - LZMA_OK
414 * - LZMA_OPTIONS_ERROR 417 * - LZMA_OPTIONS_ERROR
415 * - LZMA_MEM_ERROR 418 * - LZMA_MEM_ERROR
416 * - LZMA_PROG_ERROR 419 * - LZMA_PROG_ERROR
417 */ 420 */
418 extern LZMA_API(lzma_ret) lzma_filter_flags_decode( 421 extern LZMA_API(lzma_ret) lzma_filter_flags_decode(
419 » » lzma_filter *filters, lzma_allocator *allocator, 422 » » lzma_filter *filter, lzma_allocator *allocator,
420 const uint8_t *in, size_t *in_pos, size_t in_size) 423 const uint8_t *in, size_t *in_pos, size_t in_size)
421 lzma_nothrow lzma_attr_warn_unused_result; 424 lzma_nothrow lzma_attr_warn_unused_result;
OLDNEW
« no previous file with comments | « src/liblzma/api/lzma/container.h ('k') | src/liblzma/api/lzma/hardware.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698