From e5695ad6c41d4deb79504998b2bc5caeb1e61285 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 28 Jan 2012 20:59:11 +0300 Subject: Fix ReadBytes possible issues. --- src/net/messagein.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/net/messagein.cpp') diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index 8a51667db..6efc3ddfe 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -241,7 +241,7 @@ std::string MessageIn::readRawString(int length) return str; } -char *MessageIn::readBytes(int length) +unsigned char *MessageIn::readBytes(int length) { // Get string length if (length < 0) @@ -255,7 +255,7 @@ char *MessageIn::readBytes(int length) return nullptr; } - char *buf = new char[length + 2]; + unsigned char *buf = new unsigned char[length + 2]; memcpy (buf, mData + mPos, length); buf[length] = 0; @@ -265,7 +265,7 @@ char *MessageIn::readBytes(int length) #ifdef ENABLEDEBUGLOG std::string str; for (int f = 0;f < length; f ++) - str += strprintf ("%02x", buf[f]); + str += strprintf ("%02x", (unsigned)buf[f]); str += " "; for (int f = 0;f < length; f ++) { -- cgit v1.2.3-70-g09d2