more warning fixes

This commit is contained in:
ZappoMan 2014-03-15 22:36:43 -07:00
parent adb6ffe7c4
commit 851764a705
2 changed files with 7 additions and 6 deletions

View file

@ -288,7 +288,7 @@ int AvatarData::parseData(const QByteArray& packet) {
// joint data
int jointCount = *sourceBuffer++;
_jointData.resize(jointCount);
unsigned char validity;
unsigned char validity = 0; // although always set below, this fixes a warning of potential uninitialized use
int validityBit = 0;
for (int i = 0; i < jointCount; i++) {
if (validityBit == 0) {

View file

@ -217,11 +217,12 @@ int HandData::decodeRemoteData(const QByteArray& dataByteArray) {
palm.setActive(false);
}
// One byte for error checking safety.
unsigned char requiredLength = (unsigned char)(sourceBuffer - startPosition);
unsigned char checkLength = *sourceBuffer++;
assert(checkLength == requiredLength);
// One byte for error checking safety. Last byte contains the expected length (less itself)
// actualLength less expected byte = (sourceBuffer - startPosition)
// expectedLength less expected byte = (*sourceBuffer)
assert((unsigned char)(sourceBuffer - startPosition) == (unsigned char)(*sourceBuffer));
sourceBuffer++; // skip the trailing byte which is expected length
return sourceBuffer - startPosition;
}