diff --git dataobj/loadsave.cc dataobj/loadsave.cc index 4911d757d..2bac5479e 100644 --- dataobj/loadsave.cc +++ dataobj/loadsave.cc @@ -193,6 +193,7 @@ loadsave_t::mode_t loadsave_t::autosave_mode = zipped; // default to use for aut loadsave_t::loadsave_t() : filename() { + last_error = FILE_ERROR_OK; mode = 0; saving = false; buffered = false; @@ -318,8 +319,8 @@ bool loadsave_t::rd_open(const char *filename_utf8 ) // and now with zlib ... fd->gzfp = dr_gzopen(filename_utf8, "rb"); if(fd->gzfp==NULL) { - return false; last_error = FILE_ERROR_GZ_CORRUPT; + return false; } gzgets(fd->gzfp, buf, 80); } diff --git tpl/binary_heap_tpl.h tpl/binary_heap_tpl.h index ed40ed3f6..e0c5792ce 100644 --- tpl/binary_heap_tpl.h +++ tpl/binary_heap_tpl.h @@ -37,7 +37,10 @@ public: binary_heap_tpl() { - DBG_MESSAGE("binary_heap_tpl()","initialized"); + if( dbg ) { + DBG_MESSAGE("binary_heap_tpl()","initialized"); + } + nodes = MALLOCN(T, 4096); node_size = 4096; node_count = 0; diff --git utils/simrandom.cc utils/simrandom.cc index f9163d623..8626678d3 100644 --- utils/simrandom.cc +++ utils/simrandom.cc @@ -156,10 +156,10 @@ uint32 setsimrand(uint32 seed,uint32 ns) static double int_noise(const sint32 x, const sint32 y) { - sint32 n = x + y*101 + noise_seed; + uint32 n = (uint32)x + (uint32)y*101U + noise_seed; n = (n<<13) ^ n; - return ( 1.0 - (double)((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0); + return 1.0 - (double)((n * (n * n * 15731U + 789221U) + 1376312589U) & 0x7fffffff) / 1073741824.0; }