mirror of
https://github.com/facebook/zstd.git
synced 2025-08-05 19:15:58 +03:00
Restrict dictmode regression tests only to advanced API, fix some compiler warnings
This commit is contained in:
@@ -983,7 +983,7 @@ void UTIL_mirrorSourceFilesDirectories(const char** inFileNames, unsigned int nb
|
||||
}
|
||||
|
||||
FileNamesTable*
|
||||
UTIL_createExpandedFNT(const char** inputNames, size_t nbIfns, int followLinks)
|
||||
UTIL_createExpandedFNT(const char* const* inputNames, size_t nbIfns, int followLinks)
|
||||
{
|
||||
unsigned nbFiles;
|
||||
char* buf = (char*)malloc(LIST_SIZE_INCREASE);
|
||||
|
@@ -277,7 +277,7 @@ void UTIL_refFilename(FileNamesTable* fnt, const char* filename);
|
||||
* or NULL in case of error
|
||||
*/
|
||||
FileNamesTable*
|
||||
UTIL_createExpandedFNT(const char** filenames, size_t nbFilenames, int followLinks);
|
||||
UTIL_createExpandedFNT(const char* const* filenames, size_t nbFilenames, int followLinks);
|
||||
|
||||
|
||||
/*-****************************************
|
||||
|
@@ -40,12 +40,18 @@
|
||||
param_value_t const level_##x##_param_values_dds[] = { \
|
||||
{.param = ZSTD_c_compressionLevel, .value = x}, \
|
||||
{.param = ZSTD_c_enableDedicatedDictSearch, .value = 1}, \
|
||||
{.param = ZSTD_c_forceAttachDict, .value = ZSTD_dictForceAttach}, \
|
||||
}; \
|
||||
param_value_t const level_##x##_param_values_dictcopy[] = { \
|
||||
{.param = ZSTD_c_compressionLevel, .value = x}, \
|
||||
{.param = ZSTD_c_enableDedicatedDictSearch, .value = 0}, \
|
||||
{.param = ZSTD_c_forceAttachDict, .value = ZSTD_dictForceCopy}, \
|
||||
}; \
|
||||
param_value_t const level_##x##_param_values_dictload[] = { \
|
||||
{.param = ZSTD_c_compressionLevel, .value = x}, \
|
||||
{.param = ZSTD_c_enableDedicatedDictSearch, .value = 0}, \
|
||||
{.param = ZSTD_c_forceAttachDict, .value = ZSTD_dictForceLoad}, \
|
||||
}; \
|
||||
config_t const level_##x = { \
|
||||
.name = "level " #x, \
|
||||
.cli_args = "-" #x, \
|
||||
@@ -62,18 +68,28 @@
|
||||
.cli_args = "-" #x, \
|
||||
.param_values = PARAM_VALUES(level_##x##_param_values_dms), \
|
||||
.use_dictionary = 1, \
|
||||
.advanced_api_only = 1, \
|
||||
}; \
|
||||
config_t const level_##x##_dict_dds = { \
|
||||
.name = "level " #x " with dict dds", \
|
||||
.cli_args = "-" #x, \
|
||||
.param_values = PARAM_VALUES(level_##x##_param_values_dds), \
|
||||
.use_dictionary = 1, \
|
||||
.advanced_api_only = 1, \
|
||||
}; \
|
||||
config_t const level_##x##_dict_copy = { \
|
||||
.name = "level " #x " with dict copy", \
|
||||
.cli_args = "-" #x, \
|
||||
.param_values = PARAM_VALUES(level_##x##_param_values_dictcopy), \
|
||||
.use_dictionary = 1, \
|
||||
.advanced_api_only = 1, \
|
||||
}; \
|
||||
config_t const level_##x##_dict_load = { \
|
||||
.name = "level " #x " with dict load", \
|
||||
.cli_args = "-" #x, \
|
||||
.param_values = PARAM_VALUES(level_##x##_param_values_dictload), \
|
||||
.use_dictionary = 1, \
|
||||
.advanced_api_only = 1, \
|
||||
};
|
||||
|
||||
#define PARAM_VALUES(pv) \
|
||||
@@ -236,7 +252,7 @@ static config_t explicit_params = {
|
||||
static config_t const* g_configs[] = {
|
||||
|
||||
#define FAST_LEVEL(x) &level_fast##x, &level_fast##x##_dict,
|
||||
#define LEVEL(x) &level_##x, &level_##x##_dict, &level_##x##_dict_dms, &level_##x##_dict_dds, &level_##x##_dict_copy,
|
||||
#define LEVEL(x) &level_##x, &level_##x##_dict, &level_##x##_dict_dms, &level_##x##_dict_dds, &level_##x##_dict_copy, &level_##x##_dict_load,
|
||||
#include "levels.h"
|
||||
#undef LEVEL
|
||||
#undef FAST_LEVEL
|
||||
|
@@ -53,6 +53,11 @@ typedef struct {
|
||||
* when the method allows it. Defaults to yes.
|
||||
*/
|
||||
int no_pledged_src_size;
|
||||
/**
|
||||
* Boolean parameter that says that this config should only be used
|
||||
* for methods that use the advanced compression API
|
||||
*/
|
||||
int advanced_api_only;
|
||||
} config_t;
|
||||
|
||||
/**
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
@@ -103,6 +103,9 @@ static result_t simple_compress(method_state_t* base, config_t const* config) {
|
||||
if (base->data->type != data_type_file)
|
||||
return result_error(result_error_skip);
|
||||
|
||||
if (config->advanced_api_only)
|
||||
return result_error(result_error_skip);
|
||||
|
||||
if (config->use_dictionary || config->no_pledged_src_size)
|
||||
return result_error(result_error_skip);
|
||||
|
||||
@@ -152,6 +155,9 @@ static result_t compress_cctx_compress(
|
||||
if (base->data->type != data_type_dir)
|
||||
return result_error(result_error_skip);
|
||||
|
||||
if (config->advanced_api_only)
|
||||
return result_error(result_error_skip);
|
||||
|
||||
int const level = config_get_level(config);
|
||||
|
||||
ZSTD_CCtx* cctx = ZSTD_createCCtx();
|
||||
@@ -254,6 +260,9 @@ static result_t cli_compress(method_state_t* state, config_t const* config) {
|
||||
if (config->cli_args == NULL)
|
||||
return result_error(result_error_skip);
|
||||
|
||||
if (config->advanced_api_only)
|
||||
return result_error(result_error_skip);
|
||||
|
||||
/* We don't support no pledged source size with directories. Too slow. */
|
||||
if (state->data->type == data_type_dir && config->no_pledged_src_size)
|
||||
return result_error(result_error_skip);
|
||||
@@ -523,6 +532,10 @@ static result_t old_streaming_compress_internal(
|
||||
result = result_error(result_error_skip);
|
||||
goto out;
|
||||
}
|
||||
if (config->advanced_api_only) {
|
||||
result = result_error(result_error_skip);
|
||||
goto out;
|
||||
}
|
||||
if (init_cstream(state, zcs, config, advanced, cdict ? &cd : NULL)) {
|
||||
result = result_error(result_error_compression_error);
|
||||
goto out;
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user