diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/messagein.cpp | 5 |
2 files changed, 8 insertions, 2 deletions
@@ -1,3 +1,8 @@ +2006-05-14 Guillaume Melquiond <guillaume.melquiond@gmail.com> + + * src/messagein.cpp: Replaced strnlen by memchr to avoid GNU + extensions. + 2006-05-14 Bjørn Lindeijer <bjorn@lindeijer.nl> * src/messageout.cpp, src/messagein.h, src/messagein.cpp: Applied diff --git a/src/messagein.cpp b/src/messagein.cpp index 2559f7fb..f5ae44db 100644 --- a/src/messagein.cpp +++ b/src/messagein.cpp @@ -104,8 +104,9 @@ std::string MessageIn::readString(int length) } // Read the string - int stringLength = strnlen(mPacket->data + mPos, length); - std::string readString(mPacket->data + mPos, stringLength); + char const *stringBeg = mPacket->data + mPos, + *stringEnd = (char const *)memchr(stringBeg, '\0', length); + std::string readString(stringBeg, stringEnd ? stringEnd - stringBeg : length); mPos += length; return readString; } |