Fixed a typo and minor speedup in dtsc lib, fixed a bug when sending or receiving empty strings in socket lib.

This commit is contained in:
Thulinma 2012-11-13 23:20:17 +01:00
parent 2ad970f5df
commit 3ae5ac5be9
2 changed files with 4 additions and 4 deletions

View file

@ -442,7 +442,7 @@ void Socket::Connection::Send(std::string & data){
/// \param len Amount of bytes to write.
/// \returns The amount of bytes actually written.
int Socket::Connection::iwrite(const void * buffer, int len){
if (!connected()){return 0;}
if (!connected() || len < 1){return 0;}
int r;
if (sock >= 0){
r = send(sock, buffer, len, 0);
@ -479,7 +479,7 @@ int Socket::Connection::iwrite(const void * buffer, int len){
/// \param len Amount of bytes to read.
/// \returns The amount of bytes actually read.
int Socket::Connection::iread(void * buffer, int len){
if (!connected()){return 0;}
if (!connected() || len < 1){return 0;}
int r;
if (sock >= 0){
r = recv(sock, buffer, len, 0);