Update JsonClientConnection.cpp

small code cleanup

Former-commit-id: 82029cd23f77b393b2e6688ed6e65424cb676452
This commit is contained in:
Gamadril 2014-10-26 10:55:40 +01:00
parent bbc6fe389d
commit 6a9e75243d

View File

@ -65,7 +65,7 @@ void JsonClientConnection::readData()
break; break;
case 127: { case 127: {
payloadLength = 0; payloadLength = 0;
for (int i=0; i < 8; i++) { for (uint i=0; i < 8; i++) {
payloadLength |= ((quint64)(_receiveBuffer.at(index+i) & 0xFF)) << (8*(7-i)); payloadLength |= ((quint64)(_receiveBuffer.at(index+i) & 0xFF)) << (8*(7-i));
} }
index += 8; index += 8;
@ -76,7 +76,7 @@ void JsonClientConnection::readData()
} }
if (isMasked) { // if the data is masked we need to get the key for unmasking if (isMasked) { // if the data is masked we need to get the key for unmasking
for (int i=0; i < 4; i++) { for (uint i=0; i < 4; i++) {
maskKey[i] = _receiveBuffer.at(index + i); maskKey[i] = _receiveBuffer.at(index + i);
} }
index += 4; index += 4;
@ -162,24 +162,6 @@ void JsonClientConnection::readData()
} }
} }
} }
/*
int bytes = _receiveBuffer.indexOf('\n') + 1;
while(bytes > 0)
{
// create message string
std::string message(_receiveBuffer.data(), bytes);
// remove message data from buffer
_receiveBuffer = _receiveBuffer.mid(bytes);
// handle message
handleMessage(message);
// try too look up '\n' again
bytes = _receiveBuffer.indexOf('\n') + 1;
}
*/
} }
void JsonClientConnection::socketClosed() void JsonClientConnection::socketClosed()