From a4a9782459903dd701b18dfbdd53bfc3290392e9 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 7 Dec 2015 02:39:20 -0500 Subject: [PATCH] Remove unneeded |charBuffer| variable from -[MessageQueue readMessageFromStream]. --- Source/MessageQueue.m | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/MessageQueue.m b/Source/MessageQueue.m index 4b922dc..d5d99c9 100644 --- a/Source/MessageQueue.m +++ b/Source/MessageQueue.m @@ -265,19 +265,18 @@ [self disconnectClient]; return; } - const char* charBuffer = (const char*)buffer; // The read loop works by going through the buffer until all the bytes have // been processed. while (bufferOffset < bytesRead) { // Find the NUL separator, or the end of the string. NSUInteger partLength = 0; - for (ssize_t i = bufferOffset; i < bytesRead && charBuffer[i] != '\0'; ++i, ++partLength) ; + for (ssize_t i = bufferOffset; i < bytesRead && buffer[i] != '\0'; ++i, ++partLength) ; // If there is not a current packet, set some state. if (!_message) { // Read the message header: the size. This will be |partLength| bytes. - _totalMessageSize = atoi(charBuffer + bufferOffset); + _totalMessageSize = atoi(buffer + bufferOffset); _messageSize = 0; _message = [[NSMutableString alloc] initWithCapacity:_totalMessageSize]; bufferOffset += partLength + 1; // Pass over the NUL byte. -- 2.43.5