Support reading strings more that 2048 bytes

fixes #95
This commit is contained in:
Maxime Coste 2014-04-23 22:21:04 +01:00
parent 389308dfd8
commit 418a04f49d

View File

@ -158,12 +158,13 @@ template<>
String read<String>(int socket)
{
ByteCount length = read<ByteCount>(socket);
if (length == 0)
return String{};
char buffer[2048];
kak_assert(length < 2048);
read(socket, buffer, (int)length);
return String(buffer, buffer+(int)length);
String res;
if (length > 0)
{
res.resize((int)length);
read(socket, &res[0], (int)length);
}
return res;
}
template<typename T>