diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-08-22 22:17:26 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-08-22 22:17:26 +0300 |
commit | 996c653490e75091a26c29fac159a7fcd13459c9 (patch) | |
tree | 05581b96aa21852d8ab3f6f305e51c9acf5e62a6 /src | |
parent | 4acad897cf895e7ddf0810c35e4054588453f913 (diff) | |
download | minetest-996c653490e75091a26c29fac159a7fcd13459c9.tar.gz minetest-996c653490e75091a26c29fac159a7fcd13459c9.tar.bz2 minetest-996c653490e75091a26c29fac159a7fcd13459c9.zip |
Fix byte count in serialization of "F1000"
Some access violations and segfaults and strange behaviour might have
been caused by this.
Diffstat (limited to 'src')
-rw-r--r-- | src/utility.h | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/utility.h b/src/utility.h index 5950d7dfd..ea7c11846 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); } |