mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 04:43:31 +02:00
Merge pull request #1121 from ZappoMan/bugfixes
one memory leak fix and several compiler warnings/analysis errors
This commit is contained in:
commit
968544152f
5 changed files with 18 additions and 8 deletions
|
@ -531,7 +531,10 @@ void NodeList::sendDomainServerCheckIn() {
|
||||||
packetPosition += numBytesNodesOfInterest;
|
packetPosition += numBytesNodesOfInterest;
|
||||||
}
|
}
|
||||||
|
|
||||||
_nodeSocket.send(_domainIP.toString().toLocal8Bit().constData(), _domainPort, checkInPacket, packetPosition - checkInPacket);
|
_nodeSocket.send(_domainIP.toString().toLocal8Bit().constData(), _domainPort, checkInPacket,
|
||||||
|
packetPosition - checkInPacket);
|
||||||
|
|
||||||
|
delete[] checkInPacket; // clean up
|
||||||
|
|
||||||
const int NUM_DOMAIN_SERVER_CHECKINS_PER_STUN_REQUEST = 5;
|
const int NUM_DOMAIN_SERVER_CHECKINS_PER_STUN_REQUEST = 5;
|
||||||
static unsigned int numDomainCheckins = 0;
|
static unsigned int numDomainCheckins = 0;
|
||||||
|
|
|
@ -333,7 +333,7 @@ unsigned char* hexStringToOctalCode(const QString& input) {
|
||||||
|
|
||||||
// loop through the string - 2 bytes at a time converting
|
// loop through the string - 2 bytes at a time converting
|
||||||
// it to decimal equivalent and store in byte array
|
// it to decimal equivalent and store in byte array
|
||||||
bool ok;
|
bool ok = false;
|
||||||
while (stringIndex < input.length()) {
|
while (stringIndex < input.length()) {
|
||||||
uint value = input.mid(stringIndex, HEX_BYTE_SIZE).toUInt(&ok, HEX_NUMBER_BASE);
|
uint value = input.mid(stringIndex, HEX_BYTE_SIZE).toUInt(&ok, HEX_NUMBER_BASE);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
|
|
|
@ -205,7 +205,6 @@ CoverageMapStorageResult CoverageMap::checkMap(VoxelProjectedPolygon* polygon, b
|
||||||
|
|
||||||
CoverageMapStorageResult result = NOT_STORED;
|
CoverageMapStorageResult result = NOT_STORED;
|
||||||
CoverageRegion* storeIn = &_remainder;
|
CoverageRegion* storeIn = &_remainder;
|
||||||
bool fitsInAHalf = false;
|
|
||||||
|
|
||||||
// Check each half of the box independently
|
// Check each half of the box independently
|
||||||
const bool useRegions = true; // for now we will continue to use regions
|
const bool useRegions = true; // for now we will continue to use regions
|
||||||
|
@ -213,19 +212,15 @@ CoverageMapStorageResult CoverageMap::checkMap(VoxelProjectedPolygon* polygon, b
|
||||||
if (_topHalf.contains(polygonBox)) {
|
if (_topHalf.contains(polygonBox)) {
|
||||||
result = _topHalf.checkRegion(polygon, polygonBox, storeIt);
|
result = _topHalf.checkRegion(polygon, polygonBox, storeIt);
|
||||||
storeIn = &_topHalf;
|
storeIn = &_topHalf;
|
||||||
fitsInAHalf = true;
|
|
||||||
} else if (_bottomHalf.contains(polygonBox)) {
|
} else if (_bottomHalf.contains(polygonBox)) {
|
||||||
result = _bottomHalf.checkRegion(polygon, polygonBox, storeIt);
|
result = _bottomHalf.checkRegion(polygon, polygonBox, storeIt);
|
||||||
storeIn = &_bottomHalf;
|
storeIn = &_bottomHalf;
|
||||||
fitsInAHalf = true;
|
|
||||||
} else if (_leftHalf.contains(polygonBox)) {
|
} else if (_leftHalf.contains(polygonBox)) {
|
||||||
result = _leftHalf.checkRegion(polygon, polygonBox, storeIt);
|
result = _leftHalf.checkRegion(polygon, polygonBox, storeIt);
|
||||||
storeIn = &_leftHalf;
|
storeIn = &_leftHalf;
|
||||||
fitsInAHalf = true;
|
|
||||||
} else if (_rightHalf.contains(polygonBox)) {
|
} else if (_rightHalf.contains(polygonBox)) {
|
||||||
result = _rightHalf.checkRegion(polygon, polygonBox, storeIt);
|
result = _rightHalf.checkRegion(polygon, polygonBox, storeIt);
|
||||||
storeIn = &_rightHalf;
|
storeIn = &_rightHalf;
|
||||||
fitsInAHalf = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -324,20 +324,29 @@ VoxelNode* VoxelNode::getChildAtIndex(int childIndex) const {
|
||||||
VoxelNode* result = NULL;
|
VoxelNode* result = NULL;
|
||||||
int childCount = getChildCount();
|
int childCount = getChildCount();
|
||||||
|
|
||||||
|
#ifdef HAS_AUDIT_CHILDREN
|
||||||
const char* caseStr = NULL;
|
const char* caseStr = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (childCount) {
|
switch (childCount) {
|
||||||
case 0:
|
case 0:
|
||||||
|
#ifdef HAS_AUDIT_CHILDREN
|
||||||
caseStr = "0 child case";
|
caseStr = "0 child case";
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case 1: {
|
case 1: {
|
||||||
|
#ifdef HAS_AUDIT_CHILDREN
|
||||||
caseStr = "1 child case";
|
caseStr = "1 child case";
|
||||||
|
#endif
|
||||||
int indexOne = getNthBit(_childBitmask, 1);
|
int indexOne = getNthBit(_childBitmask, 1);
|
||||||
if (indexOne == childIndex) {
|
if (indexOne == childIndex) {
|
||||||
result = _children.single;
|
result = _children.single;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case 2: {
|
case 2: {
|
||||||
|
#ifdef HAS_AUDIT_CHILDREN
|
||||||
caseStr = "2 child case";
|
caseStr = "2 child case";
|
||||||
|
#endif
|
||||||
int indexOne = getNthBit(_childBitmask, 1);
|
int indexOne = getNthBit(_childBitmask, 1);
|
||||||
int indexTwo = getNthBit(_childBitmask, 2);
|
int indexTwo = getNthBit(_childBitmask, 2);
|
||||||
|
|
||||||
|
@ -358,7 +367,9 @@ VoxelNode* VoxelNode::getChildAtIndex(int childIndex) const {
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case 3: {
|
case 3: {
|
||||||
|
#ifdef HAS_AUDIT_CHILDREN
|
||||||
caseStr = "3 child case";
|
caseStr = "3 child case";
|
||||||
|
#endif
|
||||||
int indexOne = getNthBit(_childBitmask, 1);
|
int indexOne = getNthBit(_childBitmask, 1);
|
||||||
int indexTwo = getNthBit(_childBitmask, 2);
|
int indexTwo = getNthBit(_childBitmask, 2);
|
||||||
int indexThree = getNthBit(_childBitmask, 3);
|
int indexThree = getNthBit(_childBitmask, 3);
|
||||||
|
@ -386,7 +397,9 @@ VoxelNode* VoxelNode::getChildAtIndex(int childIndex) const {
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
default: {
|
default: {
|
||||||
|
#ifdef HAS_AUDIT_CHILDREN
|
||||||
caseStr = "default";
|
caseStr = "default";
|
||||||
|
#endif
|
||||||
// if we have 4 or more, we know we're in external mode, so we just need to figure out which
|
// if we have 4 or more, we know we're in external mode, so we just need to figure out which
|
||||||
// slot in our external array this child is.
|
// slot in our external array this child is.
|
||||||
if (oneAtBit(_childBitmask, childIndex)) {
|
if (oneAtBit(_childBitmask, childIndex)) {
|
||||||
|
|
|
@ -1432,7 +1432,6 @@ int VoxelTree::encodeTreeBitstreamRecursion(VoxelNode* node, unsigned char* outp
|
||||||
|
|
||||||
// write the child exist bits
|
// write the child exist bits
|
||||||
*writeToThisLevelBuffer = childrenExistInPacketBits;
|
*writeToThisLevelBuffer = childrenExistInPacketBits;
|
||||||
writeToThisLevelBuffer += sizeof(childrenExistInPacketBits); // move the pointer
|
|
||||||
bytesAtThisLevel += sizeof(childrenExistInPacketBits); // keep track of byte count
|
bytesAtThisLevel += sizeof(childrenExistInPacketBits); // keep track of byte count
|
||||||
if (params.stats) {
|
if (params.stats) {
|
||||||
params.stats->existsInPacketBitsWritten();
|
params.stats->existsInPacketBitsWritten();
|
||||||
|
|
Loading…
Reference in a new issue