1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

mainly work on object scripting api

This commit is contained in:
Perttu Ahola 2011-02-23 02:49:57 +02:00
parent eef7bc3570
commit 9778347c7f
19 changed files with 962 additions and 430 deletions

View file

@ -1832,7 +1832,11 @@ inline std::string deSerializeString(std::istream &is)
{
char buf[2];
is.read(buf, 2);
if(is.gcount() != 2)
throw SerializationError("deSerializeString: size not read");
u16 s_size = readU16((u8*)buf);
if(s_size == 0)
return "";
Buffer<char> buf2(s_size);
is.read(&buf2[0], s_size);
std::string s;
@ -1867,7 +1871,11 @@ inline std::string deSerializeLongString(std::istream &is)
{
char buf[4];
is.read(buf, 4);
if(is.gcount() != 4)
throw SerializationError("deSerializeLongString: size not read");
u32 s_size = readU32((u8*)buf);
if(s_size == 0)
return "";
Buffer<char> buf2(s_size);
is.read(&buf2[0], s_size);
std::string s;