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

Side by Side Diff: third_party/lzma_sdk/C/Lzma86Dec.c

Issue 6730044: Upgrading lzma_sdk to version 9.20. Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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
« no previous file with comments | « third_party/lzma_sdk/C/Lzma86.h ('k') | third_party/lzma_sdk/C/Lzma86Enc.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:executable
+ *
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /* Lzma86Dec.c -- LZMA + x86 (BCJ) Filter Decoder
2 2009-08-14 : Igor Pavlov : Public domain */
3
4 #include "Lzma86.h"
5
6 #include "Alloc.h"
7 #include "Bra.h"
8 #include "LzmaDec.h"
9
10 static void *SzAlloc(void *p, size_t size) { p = p; return MyAlloc(size); }
11 static void SzFree(void *p, void *address) { p = p; MyFree(address); }
12
13 SRes Lzma86_GetUnpackSize(const Byte *src, SizeT srcLen, UInt64 *unpackSize)
14 {
15 unsigned i;
16 if (srcLen < LZMA86_HEADER_SIZE)
17 return SZ_ERROR_INPUT_EOF;
18 *unpackSize = 0;
19 for (i = 0; i < sizeof(UInt64); i++)
20 *unpackSize += ((UInt64)src[LZMA86_SIZE_OFFSET + i]) << (8 * i);
21 return SZ_OK;
22 }
23
24 SRes Lzma86_Decode(Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen)
25 {
26 ISzAlloc g_Alloc = { SzAlloc, SzFree };
27 SRes res;
28 int useFilter;
29 SizeT inSizePure;
30 ELzmaStatus status;
31
32 if (*srcLen < LZMA86_HEADER_SIZE)
33 return SZ_ERROR_INPUT_EOF;
34
35 useFilter = src[0];
36
37 if (useFilter > 1)
38 {
39 *destLen = 0;
40 return SZ_ERROR_UNSUPPORTED;
41 }
42
43 inSizePure = *srcLen - LZMA86_HEADER_SIZE;
44 res = LzmaDecode(dest, destLen, src + LZMA86_HEADER_SIZE, &inSizePure,
45 src + 1, LZMA_PROPS_SIZE, LZMA_FINISH_ANY, &status, &g_Alloc);
46 *srcLen = inSizePure + LZMA86_HEADER_SIZE;
47 if (res != SZ_OK)
48 return res;
49 if (useFilter == 1)
50 {
51 UInt32 x86State;
52 x86_Convert_Init(x86State);
53 x86_Convert(dest, *destLen, 0, &x86State, 0);
54 }
55 return SZ_OK;
56 }
OLDNEW
« no previous file with comments | « third_party/lzma_sdk/C/Lzma86.h ('k') | third_party/lzma_sdk/C/Lzma86Enc.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698