1
0
mirror of https://github.com/facebook/zstd.git synced 2025-08-01 09:47:01 +03:00

fileio_types.h : avoid dependency on mem.h

fileio_types.h cannot be parsed by itself
because it relies on basic types defined in `lib/common/mem.h`.
As for #3231, it likely wasn't detected because `mem.h` was probably included before within target files.
But this is not proper.

A "easy" solution would be to add the missing include,
but each dependency should be considered "bad" by default,
and only allowed if it brings some tangible value.

In this case, since these types are only used to declare internal structure variables
which are effectively only flags,
I believe it's really not valuable to add a dependency on `mem.h` for this purpose
while the standard `int` type can do the same job.

I was expecting some compiler warnings following this change,
but it turns out we don't use `-Wconversion` by default on `zstd` source code,
so there is none.

Nevertheless, I enabled `-Wconversion` locally and proceeded to fix a few conversion warnings in the process.

Adding `-Wconversion` to the list of flags used for `zstd` is something I would be favorable over the long term,
but it cannot be done overnight,
because the nb of places where this warning is triggered is daunting.
Better progressively reduce the nb of triggered `-Wconversion` warnings before enabling this flag by default.
This commit is contained in:
Yann Collet
2022-08-03 21:39:35 +02:00
parent 7e6278a706
commit 3dfcafacd7
4 changed files with 23 additions and 22 deletions

View File

@ -34,13 +34,13 @@ typedef struct FIO_prefs_s {
/* Algorithm preferences */
FIO_compressionType_t compressionType;
U32 sparseFileSupport; /* 0: no sparse allowed; 1: auto (file yes, stdout no); 2: force sparse */
int sparseFileSupport; /* 0: no sparse allowed; 1: auto (file yes, stdout no); 2: force sparse */
int dictIDFlag;
int checksumFlag;
int blockSize;
int overlapLog;
U32 adaptiveMode;
U32 useRowMatchFinder;
int adaptiveMode;
int useRowMatchFinder;
int rsyncable;
int minAdaptLevel;
int maxAdaptLevel;
@ -56,9 +56,9 @@ typedef struct FIO_prefs_s {
ZSTD_paramSwitch_e literalCompressionMode;
/* IO preferences */
U32 removeSrcFile;
U32 overwrite;
U32 asyncIO;
int removeSrcFile;
int overwrite;
int asyncIO;
/* Computation resources preferences */
unsigned memLimit;