On Tue, 9 Oct 2012, Måns Rullgård wrote:

Martin Storsjö <mar...@martin.st> writes:

From: Michael Niedermayer <michae...@gmx.at>

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...

Well, most of the words above were mine actually, I think only the first paragraph was kept from the original commit.

---
 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.

Oh, that's a good catch, thanks for pointing it out!

// Martin
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to