vlc/compat
Romain Vimont a632b0dfe2 compat: fix jrand48()
According to the manpage, jrand48() must return a signed long integer
uniformly distributed over the interval [-2^31, 2^31).

The old implementation first computed iterate48(), which returns a
positive 48-bit integer (as 'uint64_t', then cast to 'int64_t'). Once
right-shifted by 16 bits, the result is guaranteed to be a 32-bit
positive integer as 'int64_t'.

It is then (implicitly) cast to 'long' to match the return type.

When the 32th bit is 0 (i.e. the value fits in 31-bit), then everything
is ok. However, when the 32nd bit is 1, then there are two cases (which
are both incorrect):
 - if the 'long' type is 32-bit on the platform, then conversion from
   'int64_t' to 'long' is undefined;
 - if the 'long' type is more than 32-bit, then the resulting value will
   be a positive integer in the interval [0, 2^32), whereas jrand48()
   must return a value in the interval [-2^31, 2^31).
2023-01-23 15:01:48 +00:00
..
test compat: add test for clock_nanosleep on darwin 2020-03-24 20:08:48 +01:00
windows win32: provide a dirent.h when compiling with the Windows SDK 2023-01-11 07:57:22 +00:00
.gitignore compat: gitignore test binaries 2020-10-06 14:21:51 +02:00
aligned_alloc.c compat: fix default aligned_alloc() 2019-07-26 21:31:19 +03:00
asprintf.c LGPL 2011-11-27 22:54:33 +01:00
atof.c LGPL 2011-11-27 22:54:33 +01:00
atoll.c LGPL 2011-11-27 22:54:33 +01:00
clock_getres.c compat: add clock_getres for darwin 2020-03-24 20:08:48 +01:00
clock_gettime.c compat: add clock_gettime for darwin 2020-03-24 19:56:36 +01:00
clock_nanosleep.c compat: make clock_nanosleep usable by other OSes 2021-09-05 14:58:30 +00:00
dirfd.c Remove dirfd() hacks 2012-01-03 18:35:02 +02:00
dummy.c compat: provide dummy.c, simplify Makefile 2019-07-26 21:31:19 +03:00
fdopendir.c Remove inconsistently used HAVE_UNISTD_H 2013-12-29 16:15:46 +02:00
flockfile.c compat: remove deprecated platform 2021-09-16 16:46:02 +00:00
freeaddrinfo.c Remove old mail address from sources 2019-09-04 22:11:04 +03:00
fsync.c Use _WIN32 rather than WIN32 (same for WIN64) 2013-06-05 16:06:10 +02:00
gai_strerror.c Remove old mail address from sources 2019-09-04 22:11:04 +03:00
getauxval.c compat: Linux getauxval() replacement 2022-02-23 21:10:16 +00:00
getdelim.c LGPL 2011-11-27 22:54:33 +01:00
getpid.c compat: remove deprecated platform 2021-09-16 16:46:02 +00:00
gettimeofday.c compat: gettimeofday: unused variable 2016-06-10 14:15:28 +02:00
gmtime_r.c compat: implement windows specific gmtime_r 2023-01-20 07:17:07 +00:00
inet_pton.c inet_pton: don't redefine EAFNOSUPPORT for Win32 2022-06-30 12:58:50 +00:00
lfind.c compat: lfind: fix warnings 2020-02-20 10:02:47 +01:00
lldiv.c LGPL 2011-11-27 22:54:33 +01:00
localtime_r.c localtime_r: don't set errno on success 2023-01-20 07:17:07 +00:00
Makefile.am compat: add test for clock_nanosleep on darwin 2020-03-24 20:08:48 +01:00
memrchr.c memrchr: fix compilation 2016-07-17 22:40:28 +03:00
meson.build meson: add initial meson build system 2023-01-04 14:48:39 +00:00
nrand48.c compat: fix jrand48() 2023-01-23 15:01:48 +00:00
poll.c compat: poll: work around event loss on WIN32 2018-02-22 11:59:01 +01:00
posix_memalign.c compat: restore posix_memalign() 2019-07-26 21:31:19 +03:00
readv.c compat: add readv() replacement 2022-07-03 17:31:24 +00:00
realpath.c compat: remove shadowing variable 2018-02-22 21:50:09 +02:00
recvmsg.c compat: add missing errno on Winsock errors 2022-06-28 17:24:51 +00:00
rewind.c LGPL 2011-11-27 22:54:33 +01:00
sendmsg.c compat: add missing errno on Winsock errors 2022-06-28 17:24:51 +00:00
setenv.c LGPL 2011-11-27 22:54:33 +01:00
sincos.c compat: add sincos() and sincosf() replacements 2016-11-13 13:58:56 +02:00
strcasecmp.c LGPL 2011-11-27 22:54:33 +01:00
strcasestr.c LGPL 2011-11-27 22:54:33 +01:00
strdup.c LGPL 2011-11-27 22:54:33 +01:00
strlcpy.c strlcpy: simplify 2018-06-17 11:23:11 +03:00
strndup.c LGPL 2011-11-27 22:54:33 +01:00
strnlen.c LGPL 2011-11-27 22:54:33 +01:00
strnstr.c Compat: remove trailing spaces 2016-01-23 14:47:51 +01:00
strsep.c LGPL 2011-11-27 22:54:33 +01:00
strtof.c LGPL 2011-11-27 22:54:33 +01:00
strtok_r.c LGPL 2011-11-27 22:54:33 +01:00
strtoll.c LGPL 2011-11-27 22:54:33 +01:00
strverscmp.c compat: missing #include, fix warning 2019-04-14 10:04:37 +03:00
swab.c LGPL 2011-11-27 22:54:33 +01:00
tdestroy.c compat: add tdestroy() 2018-02-20 21:42:43 +02:00
tfind.c compat: define tfind family of functions regardless of the search.h status 2023-01-06 14:46:46 +00:00
timegm.c compat: remove 'const' from the prototype of timegm(). 2015-12-13 20:34:39 +02:00
timespec_get.c compat: provide a win32 specific version of timespec_get 2018-05-15 18:34:30 +02:00
vasprintf.c vasprintf: missing #include 2015-07-06 22:50:25 +03:00
writev.c compat: add writev() replacement 2022-07-03 17:31:24 +00:00