From: Perttu Ahola Date: Mon, 22 Aug 2011 19:17:26 +0000 (+0300) Subject: Fix byte count in serialization of "F1000" X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=996c653490e75091a26c29fac159a7fcd13459c9;p=zefram%2Fminetest%2Fminetest_engine.git Fix byte count in serialization of "F1000" Some access violations and segfaults and strange behaviour might have been caused by this. --- diff --git a/src/utility.h b/src/utility.h index 5950d7df..ea7c1184 100644 --- a/src/utility.h +++ b/src/utility.h @@ -236,17 +236,14 @@ inline u16 readU32(std::istream &is) inline void writeF1000(std::ostream &os, f32 p) { - char buf[2]; + char buf[4]; writeF1000((u8*)buf, p); - os.write(buf, 2); + os.write(buf, 4); } inline f32 readF1000(std::istream &is) { - char buf[2]; - is.read(buf, 2); - // TODO: verify if this gets rid of the valgrind warning - //if(is.gcount() != 2) - // return 0; + char buf[4]; + is.read(buf, 4); return readF1000((u8*)buf); }