Martin Storsjö <[email protected]> writes:

> From: Michael Niedermayer <[email protected]>
>
> The new code is faster and reuses the previous state in case of
> multiple calls.
>
> The previous code could easily end up in near-infinite loops,
> if the difference between two clock() calls never was larger than
> 1.
>
> This makes fate-parseutils built with MSVC finish in finite time
> when run in wine. (The one built with mingw actually manages to find
> /dev/urandom so it doesn't do the generic code, but the MSVC build
> doesn't try to do this.) On real windows, it seems to finish pretty
> quickly.

So he finally admits the code is crap...

> ---
>  libavutil/random_seed.c |   50 
> +++++++++++++++++++++++++++--------------------
>  1 file changed, 29 insertions(+), 21 deletions(-)

[...]

> +#ifdef AV_READ_TIME
> +    buffer[13] ^= AV_READ_TIME();
> +    buffer[41] ^= AV_READ_TIME() >> 32;
> +#endif

Using AV_READ_TIME is a Very Bad Idea.  Only a few systems support it at
all, and some of those require special configuration, which is
acceptable for something only used during development, but not for code
like this which will be used in production.  For example, calling
AV_READ_TIME on iPhone will crash instantly.

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to