Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
string_conversion.c File Reference

Conversion of strings to filter chain and vice versa. More...

#include "filter_common.h"

Data Structures

struct  lzma_str
 
struct  name_value_map
 
struct  option_map
 

Macros

#define STR_ALLOC_SIZE   800
 
#define NAME_LEN_MAX   11
 
#define OPTMAP_USE_NAME_VALUE_MAP   0x01
 
#define OPTMAP_USE_BYTE_SUFFIX   0x02
 
#define OPTMAP_NO_STRFY_ZERO   0x04
 
#define LZMA12_PRESET_STR   "0-9[e]"
 Help string for presets.
 
#define MY_IS_DIGIT(c)
 

Enumerations

enum  { OPTMAP_TYPE_UINT32 , OPTMAP_TYPE_LZMA_MODE , OPTMAP_TYPE_LZMA_MATCH_FINDER , OPTMAP_TYPE_LZMA_PRESET }
 

Functions

 LZMA_API (const char *)
 Run-time version as a string.
 
 LZMA_API (lzma_ret)
 

Detailed Description

Conversion of strings to filter chain and vice versa.

Macro Definition Documentation

◆ LZMA12_PRESET_STR

#define LZMA12_PRESET_STR   "0-9[e]"

Help string for presets.

◆ MY_IS_DIGIT

#define MY_IS_DIGIT ( c)
Value:
((c) >= '0' && (c) <= '9')
#define c(i)
Definition sha256.c:43

◆ NAME_LEN_MAX

#define NAME_LEN_MAX   11

Maximum length for filter and option names. 11 chars + terminating '\0' + sizeof(uint32_t) = 16 bytes

◆ OPTMAP_NO_STRFY_ZERO

#define OPTMAP_NO_STRFY_ZERO   0x04

For option_map.flags: If the integer value is zero then this option won't be included in the stringified output. It's used e.g. for BCJ filter start offset which usually is zero.

◆ OPTMAP_USE_BYTE_SUFFIX

#define OPTMAP_USE_BYTE_SUFFIX   0x02

For option_map.flags: Allow KiB/MiB/GiB in input string and use them in the stringified output if the value is an exact multiple of these. This is used e.g. for LZMA1/2 dictionary size.

◆ OPTMAP_USE_NAME_VALUE_MAP

#define OPTMAP_USE_NAME_VALUE_MAP   0x01

For option_map.flags: Use .u.map to do convert the input value to an integer. Without this flag, .u.range.{min,max} are used as the allowed range for the integer.

◆ STR_ALLOC_SIZE

#define STR_ALLOC_SIZE   800

How much memory to allocate for strings. For now, no realloc is used so this needs to be big enough even though there of course is an overflow check still.

FIXME? Using a fixed size is wasteful if the application doesn't free the string fairly quickly but this can be improved later if needed.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Possible values for option_map.type. Since OPTMAP_TYPE_UINT32 is 0, it doesn't need to be specified in the initializers as it is the implicit value.

Enumerator
OPTMAP_TYPE_UINT32 
OPTMAP_TYPE_LZMA_MODE 
OPTMAP_TYPE_LZMA_MATCH_FINDER 
OPTMAP_TYPE_LZMA_PRESET 

Function Documentation

◆ LZMA_API() [1/2]

LZMA_API ( const char * ) const
extern

Run-time version as a string.

This function may be useful if you want to display which version of liblzma your application is currently using.

◆ LZMA_API() [2/2]

LZMA_API ( lzma_ret )
extern

Variable Documentation

◆ allow_null

bool allow_null

For lzma_str_from_filters: If true, lzma_filter.options is allowed to be NULL. In that case, only the filter name is printed without any options.

◆ id

Filter ID.

◆ name

char name[NAME_LEN_MAX+1]

Name of the filter.

◆ optmap

const option_map* optmap

For lzma_str_from_filters: If the flag LZMA_STR_ENCODER is used then the first strfy_encoder elements of optmap are stringified. With LZMA_STR_DECODER strfy_decoder is used. Currently encoders use all flags that decoders do but if that changes then this needs to be changed too, for example, add a new OPTMAP flag to skip printing some decoder-only flags.

◆ opts_size

uint32_t opts_size

For lzma_str_to_filters: Size of the filter-specific options structure.

◆ parse

const char *(* parse) (const char **str, const char *str_end, void *filter_options) ( const char ** str,
const char * str_end,
void * filter_options )

For lzma_str_to_filters: Function to parse the filter-specific options. The filter_options will already have been allocated using lzma_alloc_zero().

◆ strfy_decoder

uint8_t strfy_decoder

◆ strfy_encoder

uint8_t strfy_encoder