zstd/lib/common
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
..
bitstream.h fix confusion between unsigned <-> U32 2018-12-21 18:09:41 -08:00
compiler.h Add Option to Not Request Inlining with ZSTD_NO_INLINE 2018-12-18 13:36:39 -08:00
cpu.h Fix i386 build failure "Junk character 13" 2018-11-16 02:16:21 -06:00
debug.c grouped debug functions into debug.h 2018-06-13 15:43:09 -04:00
debug.h play around with rescale weights 2018-12-17 15:48:34 -08:00
entropy_common.c zeroise freq table with memset() 2018-06-26 17:24:41 -07:00
error_private.c Use Unused Variable in ERR_getErrorString() 2018-12-19 12:36:10 -08:00
error_private.h updated license header 2017-09-08 00:09:23 -07:00
fse_decompress.c grouped debug functions into debug.h 2018-06-13 15:43:09 -04:00
fse.h fix confusion between unsigned <-> U32 2018-12-21 18:09:41 -08:00
huf.h fix confusion between unsigned <-> U32 2018-12-21 18:09:41 -08:00
mem.h Enable use of bswap intrinsics in clang 2018-10-11 15:01:09 -04:00
pool.c Signal before unlocking in pool.c 2018-11-08 10:45:53 -08:00
pool.h changed POOL_resize() return type to int 2018-06-22 12:14:59 -07:00
threading.c [libzstd] pthread function prefixed with ZSTD_ 2017-09-27 11:48:48 -07:00
threading.h [threading] Cast unused arguments to void 2018-03-06 18:36:40 -08:00
xxhash.c Include stddef.h for size_t 2018-09-27 15:24:48 -07:00
xxhash.h xxhash can be included twice in any order 2017-03-01 13:29:29 -08:00
zstd_common.c separate DDict logic into its own module 2018-10-23 17:25:49 -07:00
zstd_errors.h fixed a second memset() on NULL 2018-10-29 15:03:57 -07:00
zstd_internal.h added constant ZSTD_WINDOWLOG_LIMIT_DEFAULT 2018-11-13 18:12:34 -08:00