VirtualBox

source: vbox/trunk/src/libs/liblzma-5.8.1/common/stream_flags_common.c@ 108911

Last change on this file since 108911 was 108911, checked in by vboxsync, 4 weeks ago

libs/liblzma: Applied and adjusted our liblzma changes to 5.8.1 and export to OSE. jiraref:VBP-1635

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
  • Property sync-process set to export
File size: 1.2 KB
Line 
1// SPDX-License-Identifier: 0BSD
2
3///////////////////////////////////////////////////////////////////////////////
4//
5/// \file stream_flags_common.c
6/// \brief Common stuff for Stream flags coders
7//
8// Author: Lasse Collin
9//
10///////////////////////////////////////////////////////////////////////////////
11
12#include "stream_flags_common.h"
13
14
15const uint8_t lzma_header_magic[6] = { 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00 };
16const uint8_t lzma_footer_magic[2] = { 0x59, 0x5A };
17
18
19extern LZMA_API(lzma_ret)
20lzma_stream_flags_compare(
21 const lzma_stream_flags *a, const lzma_stream_flags *b)
22{
23 // We can compare only version 0 structures.
24 if (a->version != 0 || b->version != 0)
25 return LZMA_OPTIONS_ERROR;
26
27 // Check type
28 if ((unsigned int)(a->check) > LZMA_CHECK_ID_MAX
29 || (unsigned int)(b->check) > LZMA_CHECK_ID_MAX)
30 return LZMA_PROG_ERROR;
31
32 if (a->check != b->check)
33 return LZMA_DATA_ERROR;
34
35 // Backward Sizes are compared only if they are known in both.
36 if (a->backward_size != LZMA_VLI_UNKNOWN
37 && b->backward_size != LZMA_VLI_UNKNOWN) {
38 if (!is_backward_size_valid(a) || !is_backward_size_valid(b))
39 return LZMA_PROG_ERROR;
40
41 if (a->backward_size != b->backward_size)
42 return LZMA_DATA_ERROR;
43 }
44
45 return LZMA_OK;
46}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette