aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/lzma/liblzma/common/string_conversion.c
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.com>2024-05-31 19:32:06 +0300
committerthegeorg <thegeorg@yandex-team.com>2024-05-31 19:42:52 +0300
commit0d2f4a9edd041501cbbd09a76ade7a4b977e86af (patch)
treebfb9bf4e74848360f403ccd2d4f28431e020c1a9 /contrib/libs/lzma/liblzma/common/string_conversion.c
parent01178e24a1066fe3335a0b1442d1017ca82f1a0c (diff)
downloadydb-0d2f4a9edd041501cbbd09a76ade7a4b977e86af.tar.gz
Update contrib/libs/lzma to 5.6.2
Keep "Update contrib/libs/lzma to 5.6.1" as an independent commit. 0cb9e331dfdcd6329e9a8211b4b89e280df9aa03
Diffstat (limited to 'contrib/libs/lzma/liblzma/common/string_conversion.c')
-rw-r--r--contrib/libs/lzma/liblzma/common/string_conversion.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/contrib/libs/lzma/liblzma/common/string_conversion.c b/contrib/libs/lzma/liblzma/common/string_conversion.c
index d2c1e80936..c899783c64 100644
--- a/contrib/libs/lzma/liblzma/common/string_conversion.c
+++ b/contrib/libs/lzma/liblzma/common/string_conversion.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: 0BSD
+
///////////////////////////////////////////////////////////////////////////////
//
/// \file string_conversion.c
@@ -5,9 +7,6 @@
//
// Author: Lasse Collin
//
-// This file has been put into the public domain.
-// You can do whatever you want with this file.
-//
///////////////////////////////////////////////////////////////////////////////
#include "filter_common.h"
@@ -218,12 +217,14 @@ typedef struct {
uint16_t offset;
union {
+ // NVHPC has problems with unions that contain pointers that
+ // are not the first members, so keep "map" at the top.
+ const name_value_map *map;
+
struct {
uint32_t min;
uint32_t max;
} range;
-
- const name_value_map *map;
} u;
} option_map;
@@ -250,7 +251,9 @@ static const char *parse_options(const char **const str, const char *str_end,
|| defined(HAVE_ENCODER_IA64) \
|| defined(HAVE_DECODER_IA64) \
|| defined(HAVE_ENCODER_SPARC) \
- || defined(HAVE_DECODER_SPARC)
+ || defined(HAVE_DECODER_SPARC) \
+ || defined(HAVE_ENCODER_RISCV) \
+ || defined(HAVE_DECODER_RISCV)
static const option_map bcj_optmap[] = {
{
.name = "start",
@@ -509,6 +512,11 @@ static const struct {
&parse_bcj, bcj_optmap, 1, 1, true },
#endif
+#if defined(HAVE_ENCODER_RISCV) || defined(HAVE_DECODER_RISCV)
+ { "riscv", sizeof(lzma_options_bcj), LZMA_FILTER_RISCV,
+ &parse_bcj, bcj_optmap, 1, 1, true },
+#endif
+
#if defined(HAVE_ENCODER_POWERPC) || defined(HAVE_DECODER_POWERPC)
{ "powerpc", sizeof(lzma_options_bcj), LZMA_FILTER_POWERPC,
&parse_bcj, bcj_optmap, 1, 1, true },
@@ -994,6 +1002,12 @@ extern LZMA_API(const char *)
lzma_str_to_filters(const char *str, int *error_pos, lzma_filter *filters,
uint32_t flags, const lzma_allocator *allocator)
{
+ // If error_pos isn't NULL, *error_pos must always be set.
+ // liblzma <= 5.4.6 and <= 5.6.1 have a bug and don't do this
+ // when str == NULL or filters == NULL or flags are unsupported.
+ if (error_pos != NULL)
+ *error_pos = 0;
+
if (str == NULL || filters == NULL)
return "Unexpected NULL pointer argument(s) "
"to lzma_str_to_filters()";