fixes for Issue 56: Fairly minor bugs picked up by static analysis tool

This commit is contained in:
Mikko Mononen 2010-03-18 08:53:45 +00:00
parent 8291ceace2
commit 9cd943264e
5 changed files with 68 additions and 22 deletions

View File

@ -137,7 +137,7 @@ bool duDumpCompactHeightfield(struct rcCompactHeightfield& chf, const char* file
fwrite(&chf.cs, sizeof(chf.cs), 1, fp);
fwrite(&chf.ch, sizeof(chf.ch), 1, fp);
int tmp;
int tmp = 0;
if (chf.cells) tmp |= 1;
if (chf.spans) tmp |= 2;
if (chf.dist) tmp |= 4;

View File

@ -348,7 +348,10 @@ bool dtCreateNavMeshData(dtNavMeshCreateParams* params, unsigned char** outData,
unsigned char* data = new unsigned char[dataSize];
if (!data)
{
delete [] offMeshConClass;
return false;
}
memset(data, 0, dataSize);
unsigned char* d = data;

View File

@ -31,7 +31,7 @@ static const unsigned RC_UNSET_HEIGHT = 0xffff;
struct rcHeightPatch
{
inline rcHeightPatch() : data(0) {}
inline rcHeightPatch() : data(0), xmin(0), ymin(0), width(0), height(0) {}
inline ~rcHeightPatch() { delete [] data; }
unsigned short* data;
int xmin, ymin, width, height;
@ -770,15 +770,13 @@ static void getHeightData(const rcCompactHeightfield& chf,
}
// Find center of the polygon using flood fill.
int pcx = 0, pcy = 0, pcz = 0;
int pcx = 0, pcz = 0;
for (int j = 0; j < npoly; ++j)
{
pcx += (int)verts[poly[j]*3+0];
pcy += (int)verts[poly[j]*3+1];
pcz += (int)verts[poly[j]*3+2];
}
pcx /= npoly;
pcy /= npoly;
pcz /= npoly;
for (int i = 0; i < stack.size(); i += 3)

View File

@ -316,6 +316,10 @@
6B904C72115218D800A12E63 /* PBXTextBookmark */ = 6B904C72115218D800A12E63 /* PBXTextBookmark */;
6B904C7411521CEA00A12E63 /* PBXTextBookmark */ = 6B904C7411521CEA00A12E63 /* PBXTextBookmark */;
6B904C7611521D4400A12E63 /* PBXTextBookmark */ = 6B904C7611521D4400A12E63 /* PBXTextBookmark */;
6B904C78115220CA00A12E63 /* PBXTextBookmark */ = 6B904C78115220CA00A12E63 /* PBXTextBookmark */;
6B904C79115220CA00A12E63 /* PBXTextBookmark */ = 6B904C79115220CA00A12E63 /* PBXTextBookmark */;
6B904C7A115220CA00A12E63 /* PBXTextBookmark */ = 6B904C7A115220CA00A12E63 /* PBXTextBookmark */;
6B904C7B115220CA00A12E63 /* PBXTextBookmark */ = 6B904C7B115220CA00A12E63 /* PBXTextBookmark */;
6B92D9121140F58200E82EC3 = 6B92D9121140F58200E82EC3 /* PBXTextBookmark */;
6B92D91C1140F5F800E82EC3 = 6B92D91C1140F5F800E82EC3 /* PBXTextBookmark */;
6B92D9411140F84100E82EC3 = 6B92D9411140F84100E82EC3 /* PBXTextBookmark */;
@ -529,8 +533,8 @@
6B137C870F7FCC1100459200 /* RecastMesh.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {815, 20224}}";
sepNavSelRange = "{13330, 0}";
sepNavVisRange = "{12592, 895}";
sepNavSelRange = "{13018, 15}";
sepNavVisRange = "{12592, 1011}";
};
};
6B137C880F7FCC1100459200 /* RecastRasterization.cpp */ = {
@ -646,7 +650,7 @@
fRef = 6B8DE88810B69E3E00DF20FB /* DetourNavMeshBuilder.cpp */;
name = "DetourNavMeshBuilder.cpp: 662";
rLen = 0;
rLoc = 19262;
rLoc = 19297;
rType = 0;
vrLen = 586;
vrLoc = 18880;
@ -1188,9 +1192,9 @@
};
6B8DE88810B69E3E00DF20FB /* DetourNavMeshBuilder.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {845, 10816}}";
sepNavSelRange = "{5578, 0}";
sepNavVisRange = "{5022, 813}";
sepNavIntBoundsRect = "{{0, 0}, {845, 11056}}";
sepNavSelRange = "{9737, 0}";
sepNavVisRange = "{14436, 1054}";
};
};
6B8DE88B10B69E4C00DF20FB /* DetourNavMesh.h */ = {
@ -2036,7 +2040,7 @@
fRef = 6B8DE88810B69E3E00DF20FB /* DetourNavMeshBuilder.cpp */;
name = "DetourNavMeshBuilder.cpp: 662";
rLen = 0;
rLoc = 19262;
rLoc = 19297;
rType = 0;
vrLen = 646;
vrLoc = 18878;
@ -2076,7 +2080,7 @@
fRef = 6B8DE88810B69E3E00DF20FB /* DetourNavMeshBuilder.cpp */;
name = "DetourNavMeshBuilder.cpp: 662";
rLen = 0;
rLoc = 19262;
rLoc = 19297;
rType = 0;
vrLen = 646;
vrLoc = 18878;
@ -2708,6 +2712,46 @@
vrLen = 895;
vrLoc = 12592;
};
6B904C78115220CA00A12E63 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 6B137C870F7FCC1100459200 /* RecastMesh.cpp */;
name = "RecastMesh.cpp: 503";
rLen = 15;
rLoc = 13018;
rType = 0;
vrLen = 1011;
vrLoc = 12592;
};
6B904C79115220CA00A12E63 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 6B8DE88810B69E3E00DF20FB /* DetourNavMeshBuilder.cpp */;
name = "DetourNavMeshBuilder.cpp: 218";
rLen = 0;
rLoc = 5578;
rType = 0;
vrLen = 899;
vrLoc = 4979;
};
6B904C7A115220CA00A12E63 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 6B137C870F7FCC1100459200 /* RecastMesh.cpp */;
name = "RecastMesh.cpp: 503";
rLen = 15;
rLoc = 13018;
rType = 0;
vrLen = 1011;
vrLoc = 12592;
};
6B904C7B115220CA00A12E63 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 6B8DE88810B69E3E00DF20FB /* DetourNavMeshBuilder.cpp */;
name = "DetourNavMeshBuilder.cpp: 352";
rLen = 0;
rLoc = 9737;
rType = 0;
vrLen = 1054;
vrLoc = 14436;
};
6B92D9121140F58200E82EC3 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 6B137C830F7FCC1100459200 /* RecastContour.cpp */;
@ -3441,7 +3485,7 @@
fRef = 6B8DE88810B69E3E00DF20FB /* DetourNavMeshBuilder.cpp */;
name = "DetourNavMeshBuilder.cpp: 575";
rLen = 0;
rLoc = 16574;
rLoc = 16609;
rType = 0;
vrLen = 803;
vrLoc = 15718;

View File

@ -281,14 +281,14 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
<integer>33</integer>
<integer>21</integer>
<integer>16</integer>
<integer>12</integer>
<integer>1</integer>
<integer>0</integer>
</array>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
<string>{{0, 347}, {358, 643}}</string>
<string>{{0, 178}, {358, 643}}</string>
</dict>
<key>PBXTopSmartGroupGIDs</key>
<array/>
@ -323,7 +323,7 @@
<key>PBXProjectModuleGUID</key>
<string>6B8632A30F78115100E2684A</string>
<key>PBXProjectModuleLabel</key>
<string>RecastMesh.cpp</string>
<string>DetourNavMeshBuilder.cpp</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
@ -331,11 +331,11 @@
<key>PBXProjectModuleGUID</key>
<string>6B8632A40F78115100E2684A</string>
<key>PBXProjectModuleLabel</key>
<string>RecastMesh.cpp</string>
<string>DetourNavMeshBuilder.cpp</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>6B904C7611521D4400A12E63</string>
<string>6B904C7B115220CA00A12E63</string>
<key>history</key>
<array>
<string>6B8DE70D10B01BBF00DF20FB</string>
@ -392,7 +392,6 @@
<string>6B904BB61144F49D00A12E63</string>
<string>6B904BBE1144F50500A12E63</string>
<string>6B904BD01144FCF000A12E63</string>
<string>6B904BE91144FDC900A12E63</string>
<string>6B904C091145340E00A12E63</string>
<string>6B904C40115211FB00A12E63</string>
<string>6B904C41115211FB00A12E63</string>
@ -401,7 +400,8 @@
<string>6B904C631152164400A12E63</string>
<string>6B904C641152164400A12E63</string>
<string>6B904C6F115218D800A12E63</string>
<string>6B904C70115218D800A12E63</string>
<string>6B904C78115220CA00A12E63</string>
<string>6B904C79115220CA00A12E63</string>
</array>
<key>prevStack</key>
<array>
@ -488,6 +488,7 @@
<string>6B904C6B1152164400A12E63</string>
<string>6B904C6C1152164400A12E63</string>
<string>6B904C71115218D800A12E63</string>
<string>6B904C7A115220CA00A12E63</string>
</array>
</dict>
<key>SplitCount</key>