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. > --- > Removed the use of AV_READ_TIME, did some extra cosmetic cleanup > I missed in the previous round. > --- > libavutil/random_seed.c | 45 ++++++++++++++++++++++++--------------------- > 1 file changed, 24 insertions(+), 21 deletions(-) > > diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c > index 8ee4cb7..3eed303 100644 > --- a/libavutil/random_seed.c > +++ b/libavutil/random_seed.c > @@ -26,8 +26,12 @@ > #include <fcntl.h> > #include <math.h> > #include <time.h> > +#include <string.h> > #include "timer.h" > #include "random_seed.h" > +#include "sha.h" > +#include "intreadwrite.h" > +#include <assert.h> > > static int read_random(uint32_t *dst, const char *file) > { > @@ -48,34 +52,33 @@ static int read_random(uint32_t *dst, const char *file) > > static uint32_t get_generic_seed(void) > { > + uint8_t tmp[120]; > + struct AVSHA *sha = (void*) tmp;
This doesn't even begin to guarantee proper alignment. Can we please fix the context allocation madness for this and others like it? That is, we should add proper allocation functions and deprecate/drop the size variables. -- Måns Rullgård [email protected] _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
