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

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

Issue 2869016: Add an unpatched version of xz, XZ Utils, to /trunk/deps/third_party (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/
Patch Set: Created 10 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file stream_flags_common.c
4 /// \brief Common stuff for Stream flags coders
5 //
6 // Author: Lasse Collin
7 //
8 // This file has been put into the public domain.
9 // You can do whatever you want with this file.
10 //
11 ///////////////////////////////////////////////////////////////////////////////
12
13 #include "stream_flags_common.h"
14
15
16 const uint8_t lzma_header_magic[6] = { 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00 };
17 const uint8_t lzma_footer_magic[2] = { 0x59, 0x5A };
18
19
20 extern LZMA_API(lzma_ret)
21 lzma_stream_flags_compare(
22 const lzma_stream_flags *a, const lzma_stream_flags *b)
23 {
24 // We can compare only version 0 structures.
25 if (a->version != 0 || b->version != 0)
26 return LZMA_OPTIONS_ERROR;
27
28 // Check type
29 if ((unsigned int)(a->check) > LZMA_CHECK_ID_MAX
30 || (unsigned int)(b->check) > LZMA_CHECK_ID_MAX)
31 return LZMA_PROG_ERROR;
32
33 if (a->check != b->check)
34 return LZMA_DATA_ERROR;
35
36 // Backward Sizes are compared only if they are known in both.
37 if (a->backward_size != LZMA_VLI_UNKNOWN
38 && b->backward_size != LZMA_VLI_UNKNOWN) {
39 if (!is_backward_size_valid(a) || !is_backward_size_valid(b))
40 return LZMA_PROG_ERROR;
41
42 if (a->backward_size != b->backward_size)
43 return LZMA_DATA_ERROR;
44 }
45
46 return LZMA_OK;
47 }
OLDNEW
« no previous file with comments | « xz/src/liblzma/common/stream_flags_common.h ('k') | xz/src/liblzma/common/stream_flags_decoder.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698