Commit Graph

51 Commits

Author SHA1 Message Date
Yann Collet
ededcfca57 fix confusion between unsigned <-> U32
as suggested in #1441.

generally U32 and unsigned are the same thing,
except when they are not ...

case : 32-bit compilation for MIPS (uint32_t == unsigned long)

A vast majority of transformation consists in transforming U32 into unsigned.
In rare cases, it's the other way around (typically for internal code, such as seeds).

Among a few issues this patches solves :
- some parameters were declared with type `unsigned` in *.h,
  but with type `U32` in their implementation *.c .
- some parameters have type unsigned*,
  but the caller user a pointer to U32 instead.

These fixes are useful.

However, the bulk of changes is about %u formating,
which requires unsigned type,
but generally receives U32 values instead,
often just for brevity (U32 is shorter than unsigned).
These changes are generally minor, or even annoying.

As a consequence, the amount of code changed is larger than I would expect for such a patch.

Testing is also a pain :
it requires manually modifying `mem.h`,
in order to lie about `U32`
and force it to be an `unsigned long` typically.
On a 64-bit system, this will break the equivalence unsigned == U32.
Unfortunately, it will also break a few static_assert(), controlling structure sizes.
So it also requires modifying `debug.h` to make `static_assert()` a noop.
And then reverting these changes.

So it's inconvenient, and as a consequence,
this property is currently not checked during CI tests.
Therefore, these problems can emerge again in the future.

I wonder if it is worth ensuring proper distinction of U32 != unsigned in CI tests.
It's another restriction for coding, adding more frustration during merge tests,
since most platforms don't need this distinction (hence contributor will not see it),
and while this can matter in theory, the number of platforms impacted seems minimal.

Thoughts ?
2018-12-21 18:09:41 -08:00
Yann Collet
de4eb06a77 fixed 1 transitive include 2018-12-19 18:38:37 -08:00
Nick Terrell
5aa9a1dd2d Fix minigzip in std=c99 mode 2018-09-28 15:52:25 -07:00
Yann Collet
da55865e47 ensure dependency for zlib wrapper 2018-08-15 16:43:13 -07:00
Yann Collet
6873fec658 changed dictMore for dictContentType
which seems clearer to describe what the variable/argument is about.
2018-03-20 15:13:14 -07:00
Yann Collet
18b795374a UTIL_getFileSize() returns UTIL_FILESIZE_UNKNOWN on failure
UTIL_getFileSize() used to return zero on failure.
This made it impossible to distinguish a failure from a genuine empty file.
Both cases where coalesced.

Adding UTIL_FILESIZE_UNKNOWN constant has many consequences on user code,
since in many places, the `0` was assumed to mean "error".
This is no longer the case, and the error code must be actively checked.
2017-10-17 16:14:25 -07:00
Yann Collet
c95c0c9725 modified util::time API
for easier invocation.
- no longer expose frequency timer :
it's either useless, or stored internally in a static variable (init is only necessary once).
- UTIL_getTime() provides result by function return.
2017-09-12 18:12:46 -07:00
Yann Collet
d7ad99b2ab Merge branch 'longRangeMatcher' into dev 2017-08-31 18:08:37 -07:00
Stella Lau
c88fb9267f Replace 'byReference' with enum 2017-08-29 11:55:02 -07:00
Yann Collet
232d62b637 fixed a few headers that were too hastily copy/pasted during last license change 2017-08-21 11:24:32 -07:00
Yann Collet
32fb407c9d updated a bunch of headers
for the new license
2017-08-18 16:52:05 -07:00
Yann Collet
7bd1a2900e added ZSTD_dictMode_e to control dictionary loading mode 2017-06-21 11:50:33 -07:00
Yann Collet
31533bacce Changed ZSTD_createCDict_advanced()
It now only uses compressionParameters as argument.
It produces many changes throughout user code,
though hopefully they tend to be simple :
just provide the cParams part from existing ZSTD_parameters.

Some programs might depend on ZSTD_createCDict_advanced() to pass frame parameters.
This change will force them to revisit this strategy and fix it,
since frame parameters are effectively silently ignored in current version.
2017-04-27 00:29:04 -07:00
Yann Collet
4f818182b8 clarified frame parameters for ZSTD_compress*_usingCDict()
created ZSTD_compressBegin_usingCDict_internal(),
which gives direct control to frame Parameters.
ZSTD_resetCStream_internal() now points into it.
2017-04-17 18:29:06 -07:00
Sean Purcell
680e4e0953 Ignore symbolic links unless --force specified 2017-03-23 11:52:09 -07:00
Sean Purcell
042ba122ae Change g_displayLevel to int and fix DISPLAYUPDATE flush 2017-03-23 11:21:59 -07:00
Przemyslaw Skibinski
e052c60540 introduce UTIL_freq_t 2017-02-20 11:27:11 +01:00
Przemyslaw Skibinski
94abd6a26c SET_REALTIME_PRIORITY 2017-02-07 16:36:19 +01:00
Yann Collet
9ceb49e097 fixed zlib_wrapper conversion warnings 2016-12-22 15:26:33 +01:00
Yann Collet
1f57c2ed32 added : ZSTD_createCDict_byReference() 2016-12-21 16:20:11 +01:00
Przemyslaw Skibinski
622d741a67 updated zlib copyright notice 2016-12-13 19:44:07 +01:00
Przemyslaw Skibinski
eee427ee25 fixed fitblk 2016-12-13 19:14:04 +01:00
Przemyslaw Skibinski
0fa3447dee plainly marked altered files from zlib 2016-11-28 16:55:14 +01:00
Przemyslaw Skibinski
96fca2bd2d improved zwrapbench.c 2016-11-25 14:36:27 +01:00
Przemyslaw Skibinski
37a00f2ac7 turn on test_gzio 2016-11-25 14:09:29 +01:00
Przemyslaw Skibinski
6cecb35f98 zwrapbench uses z_const 2016-11-04 17:49:17 +01:00
Przemyslaw Skibinski
d007eb5f9f fixed clang warnings in zlibWrapper 2016-11-04 11:20:58 +01:00
inikep
20859afb4c renamed to ZWRAP_deflateReset_keepDict 2016-09-27 17:27:43 +02:00
inikep
706876f09a added ZWRAP_deflateResetWithoutDict and ZWRAP_inflateResetWithoutDict 2016-09-27 16:56:07 +02:00
inikep
a03b7a7f1b zwrapbench: improved tests with a dictionary 2016-09-26 22:11:55 +02:00
inikep
2bb83e8271 zlibWrapper\README.md: Reusing contexts 2016-09-23 18:59:53 +02:00
inikep
b88accfb5f use valgrind with a dynamic zstd library 2016-09-23 13:38:02 +02:00
inikep
68cd4766c9 initialization of strm->adler 2016-09-23 12:42:21 +02:00
inikep
cf3ec08840 ZWRAP_setPledgedSrcSize not required with Z_FINISH 2016-09-23 10:30:26 +02:00
inikep
252c20dd34 a new ZWRAP API 2016-09-23 09:08:40 +02:00
inikep
f7ab3adaaa zwrapbench: testing reusing of a context 2016-09-22 17:59:10 +02:00
inikep
f71828f2c4 zwrapbench: testing speed of ZSTD_decompressStream 2016-09-22 15:55:01 +02:00
inikep
8e8b046f64 zwrapbench benchmarks zlibWrapper 2016-09-22 14:42:32 +02:00
inikep
54320ce905 zwrapbench tests zlib 2016-09-22 11:52:53 +02:00
inikep
d755717941 added setZWRAPdecompressionType 2016-09-22 11:52:00 +02:00
inikep
3be5c6e6db improved zlibWrapper\Makefile 2016-09-22 10:23:58 +02:00
inikep
dfef5ddc9e added zwrapbench.c 2016-09-22 10:23:26 +02:00
inikep
61abecc417 added ZWRAP_initializeCStream 2016-09-21 19:30:29 +02:00
inikep
7e7925710d tests with ZSTD_setPledgedSrcSize 2016-09-21 17:17:29 +02:00
inikep
86fc8e0003 added ZWRAP_DCtx.decompState 2016-09-20 16:22:28 +02:00
inikep
554b3b935c improved logging 2016-09-20 15:18:00 +02:00
inikep
7b546e5da9 added fitblk.c 2016-09-20 12:49:39 +02:00
Yann Collet
5c33c32d55 copy zlib license into file header 2016-08-31 07:34:18 -07:00
inikep
614fddee6a zlibWrapper: support for stricter gcc warnings 2016-06-02 18:40:41 +02:00
inikep
ff9114aee3 zlibWrapper: added support for custom memory allocation functions 2016-06-02 16:52:36 +02:00