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

Side by Side Diff: src/liblzma/common/common.c

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/common/common.h ('k') | src/liblzma/common/filter_common.c » ('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 // 2 //
3 /// \file common.h 3 /// \file common.h
4 /// \brief Common functions needed in many places in liblzma 4 /// \brief Common functions needed in many places in liblzma
5 // 5 //
6 // Author: Lasse Collin 6 // Author: Lasse Collin
7 // 7 //
8 // This file has been put into the public domain. 8 // This file has been put into the public domain.
9 // You can do whatever you want with this file. 9 // You can do whatever you want with this file.
10 // 10 //
(...skipping 17 matching lines...) Expand all
28 lzma_version_string(void) 28 lzma_version_string(void)
29 { 29 {
30 return LZMA_VERSION_STRING; 30 return LZMA_VERSION_STRING;
31 } 31 }
32 32
33 33
34 /////////////////////// 34 ///////////////////////
35 // Memory allocation // 35 // Memory allocation //
36 /////////////////////// 36 ///////////////////////
37 37
38 extern void * lzma_attribute((malloc)) 38 extern void * lzma_attribute((__malloc__)) lzma_attr_alloc_size(1)
39 lzma_alloc(size_t size, lzma_allocator *allocator) 39 lzma_alloc(size_t size, lzma_allocator *allocator)
40 { 40 {
41 // Some malloc() variants return NULL if called with size == 0. 41 // Some malloc() variants return NULL if called with size == 0.
42 if (size == 0) 42 if (size == 0)
43 size = 1; 43 size = 1;
44 44
45 void *ptr; 45 void *ptr;
46 46
47 if (allocator != NULL && allocator->alloc != NULL) 47 if (allocator != NULL && allocator->alloc != NULL)
48 ptr = allocator->alloc(allocator->opaque, 1, size); 48 ptr = allocator->alloc(allocator->opaque, 1, size);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 { 175 {
176 // Sanity checks 176 // Sanity checks
177 if ((strm->next_in == NULL && strm->avail_in != 0) 177 if ((strm->next_in == NULL && strm->avail_in != 0)
178 || (strm->next_out == NULL && strm->avail_out != 0) 178 || (strm->next_out == NULL && strm->avail_out != 0)
179 || strm->internal == NULL 179 || strm->internal == NULL
180 || strm->internal->next.code == NULL 180 || strm->internal->next.code == NULL
181 || (unsigned int)(action) > LZMA_FINISH 181 || (unsigned int)(action) > LZMA_FINISH
182 || !strm->internal->supported_actions[action]) 182 || !strm->internal->supported_actions[action])
183 return LZMA_PROG_ERROR; 183 return LZMA_PROG_ERROR;
184 184
185 // Check if unsupported members have been set to non-zero or non-NULL,
186 // which would indicate that some new feature is wanted.
187 if (strm->reserved_ptr1 != NULL
188 || strm->reserved_ptr2 != NULL
189 || strm->reserved_ptr3 != NULL
190 || strm->reserved_ptr4 != NULL
191 || strm->reserved_int1 != 0
192 || strm->reserved_int2 != 0
193 || strm->reserved_int3 != 0
194 || strm->reserved_int4 != 0
195 || strm->reserved_enum1 != LZMA_RESERVED_ENUM
196 || strm->reserved_enum2 != LZMA_RESERVED_ENUM)
197 return LZMA_OPTIONS_ERROR;
198
185 switch (strm->internal->sequence) { 199 switch (strm->internal->sequence) {
186 case ISEQ_RUN: 200 case ISEQ_RUN:
187 switch (action) { 201 switch (action) {
188 case LZMA_RUN: 202 case LZMA_RUN:
189 break; 203 break;
190 204
191 case LZMA_SYNC_FLUSH: 205 case LZMA_SYNC_FLUSH:
192 strm->internal->sequence = ISEQ_SYNC_FLUSH; 206 strm->internal->sequence = ISEQ_SYNC_FLUSH;
193 break; 207 break;
194 208
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 if (strm == NULL || strm->internal == NULL 379 if (strm == NULL || strm->internal == NULL
366 || strm->internal->next.memconfig == NULL) 380 || strm->internal->next.memconfig == NULL)
367 return LZMA_PROG_ERROR; 381 return LZMA_PROG_ERROR;
368 382
369 if (new_memlimit != 0 && new_memlimit < LZMA_MEMUSAGE_BASE) 383 if (new_memlimit != 0 && new_memlimit < LZMA_MEMUSAGE_BASE)
370 return LZMA_MEMLIMIT_ERROR; 384 return LZMA_MEMLIMIT_ERROR;
371 385
372 return strm->internal->next.memconfig(strm->internal->next.coder, 386 return strm->internal->next.memconfig(strm->internal->next.coder,
373 &memusage, &old_memlimit, new_memlimit); 387 &memusage, &old_memlimit, new_memlimit);
374 } 388 }
OLDNEW
« no previous file with comments | « src/liblzma/common/common.h ('k') | src/liblzma/common/filter_common.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698