forked from Mirrorlandia_minetest/minetest
Fix byte count in serialization of "F1000"
Some access violations and segfaults and strange behaviour might have been caused by this.
This commit is contained in:
parent
4acad897cf
commit
996c653490
@ -236,17 +236,14 @@ inline u16 readU32(std::istream &is)
|
|||||||
|
|
||||||
inline void writeF1000(std::ostream &os, f32 p)
|
inline void writeF1000(std::ostream &os, f32 p)
|
||||||
{
|
{
|
||||||
char buf[2];
|
char buf[4];
|
||||||
writeF1000((u8*)buf, p);
|
writeF1000((u8*)buf, p);
|
||||||
os.write(buf, 2);
|
os.write(buf, 4);
|
||||||
}
|
}
|
||||||
inline f32 readF1000(std::istream &is)
|
inline f32 readF1000(std::istream &is)
|
||||||
{
|
{
|
||||||
char buf[2];
|
char buf[4];
|
||||||
is.read(buf, 2);
|
is.read(buf, 4);
|
||||||
// TODO: verify if this gets rid of the valgrind warning
|
|
||||||
//if(is.gcount() != 2)
|
|
||||||
// return 0;
|
|
||||||
return readF1000((u8*)buf);
|
return readF1000((u8*)buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user