Fix two MSVC compiler warnings
And quit using the ancient C time API for seeding the RNG.
This commit is contained in:
parent
e46fc2faa3
commit
8b5791c657
2 changed files with 5 additions and 3 deletions
|
@ -112,7 +112,7 @@ int SDL_SavePNG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst)
|
|||
colortype = PNG_COLOR_MASK_COLOR;
|
||||
if (surface->format->BytesPerPixel > 0
|
||||
&& surface->format->BytesPerPixel <= 8
|
||||
&& (pal = surface->format->palette))
|
||||
&& ((pal = surface->format->palette) != NULL))
|
||||
{
|
||||
colortype |= PNG_COLOR_MASK_PALETTE;
|
||||
pal_ptr = (png_colorp)(malloc(pal->ncolors * sizeof(png_color)));
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <cassert>
|
||||
#include <stdlib.h>
|
||||
#include <boost/random/mersenne_twister.hpp>
|
||||
#include <time.h>
|
||||
#include <random>
|
||||
|
||||
static lg::log_domain log_random("random");
|
||||
#define DBG_RND LOG_STREAM(debug, log_random)
|
||||
|
@ -33,8 +33,10 @@ namespace {
|
|||
{
|
||||
public:
|
||||
rng_default()
|
||||
: gen_(time(nullptr))
|
||||
: gen_()
|
||||
{
|
||||
std::random_device entropy_source;
|
||||
gen_.seed(entropy_source());
|
||||
}
|
||||
protected:
|
||||
virtual uint32_t next_random_impl()
|
||||
|
|
Loading…
Add table
Reference in a new issue