diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-01-28 20:59:11 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-01-28 20:59:11 +0300 |
commit | e5695ad6c41d4deb79504998b2bc5caeb1e61285 (patch) | |
tree | c54fbb4c2590671d496d14f25cb2ce5d03cb69bc /src | |
parent | 40f34b7ba7317f5f5c3dfbed0b291be9555d3137 (diff) | |
download | manaplus-e5695ad6c41d4deb79504998b2bc5caeb1e61285.tar.gz manaplus-e5695ad6c41d4deb79504998b2bc5caeb1e61285.tar.bz2 manaplus-e5695ad6c41d4deb79504998b2bc5caeb1e61285.tar.xz manaplus-e5695ad6c41d4deb79504998b2bc5caeb1e61285.zip |
Fix ReadBytes possible issues.
Diffstat (limited to 'src')
-rw-r--r-- | src/net/messagein.cpp | 6 | ||||
-rw-r--r-- | src/net/messagein.h | 2 |
2 files changed, 4 insertions, 4 deletions
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 ++) { diff --git a/src/net/messagein.h b/src/net/messagein.h index 8dd43a1a0..1eb5bf232 100644 --- a/src/net/messagein.h +++ b/src/net/messagein.h @@ -95,7 +95,7 @@ class MessageIn virtual std::string readRawString(int length); - char *readBytes(int length); + unsigned char *readBytes(int length); virtual ~MessageIn() { } |