Fixed read_raw buffer issues (properly this time).

Also added '<<' overload on Packet for char*
This commit is contained in:
Cloaked9000 2016-12-21 17:57:39 +00:00
parent f74f1f1a94
commit 8a54e8994a
2 changed files with 11 additions and 1 deletions

View File

@ -187,6 +187,15 @@ namespace fr
return *this;
}
/*
* Adds a char array
*/
inline Packet &operator<<(const char *var)
{
*this << std::string(var);
return *this;
}
/*
* Removes a string variable from the packet
*/

View File

@ -82,7 +82,8 @@ namespace fr
while(bytes_remaining > 0)
{
size_t received = 0;
Status status = receive_raw((uintptr_t*)dest + bytes_read, (size_t)bytes_remaining, received);
char *arr = (char*)dest;
Status status = receive_raw(&arr[bytes_read], (size_t)bytes_remaining, received);
if(status != fr::Socket::Success)
return status;
bytes_remaining -= received;