Skip to content

Commit

Permalink
Fix almost all -Wall warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Masterkatze committed May 21, 2022
1 parent 32ebf81 commit d97af3e
Show file tree
Hide file tree
Showing 382 changed files with 2,685 additions and 2,053 deletions.
2 changes: 1 addition & 1 deletion Externals/ode/include/ode/collision.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ enum {
};

/* class numbers - each geometry object needs a unique number */
enum {
enum dClassNumber {
dSphereClass = 0,
dBoxClass,
dCapsuleClass,
Expand Down
20 changes: 7 additions & 13 deletions Externals/ode/include/ode/geom.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ void dCloseODE();
/* standard classes */

/* class numbers */
extern GLOBAL_SHAREDLIB_SPEC int dSphereClass;
extern GLOBAL_SHAREDLIB_SPEC int dBoxClass;
extern GLOBAL_SHAREDLIB_SPEC int dCapsuleClass;
extern GLOBAL_SHAREDLIB_SPEC int dPlaneClass;
extern GLOBAL_SHAREDLIB_SPEC int dGeomGroupClass;
extern GLOBAL_SHAREDLIB_SPEC int dGeomTransformClass;
//extern GLOBAL_SHAREDLIB_SPEC int dSphereClassVariable;
//extern GLOBAL_SHAREDLIB_SPEC int dBoxClassVariable;
//extern GLOBAL_SHAREDLIB_SPEC int dCapsuleClassVariable;
//extern GLOBAL_SHAREDLIB_SPEC int dPlaneClassVariable;
//extern GLOBAL_SHAREDLIB_SPEC int dGeomGroupClassVariable;
//extern GLOBAL_SHAREDLIB_SPEC int dGeomTransformClassVariable;

/* constructors */
dGeomID dCreateSphere (dSpaceID space, dReal radius);
Expand Down Expand Up @@ -138,13 +138,7 @@ typedef dColliderFn * dGetColliderFnFn (int num);
typedef void dGeomDtorFn (dGeomID o);
typedef int dAABBTestFn (dGeomID o1, dGeomID o2, dReal aabb[6]);

typedef struct dGeomClass {
int bytes;
dGetColliderFnFn *collider;
dGetAABBFn *aabb;
dAABBTestFn *aabb_test;
dGeomDtorFn *dtor;
} dGeomClass;
struct dGeomClass;

int dCreateGeomClass (const dGeomClass *classptr);
void * dGeomGetClassData (dGeomID);
Expand Down
6 changes: 3 additions & 3 deletions Externals/ode/include/ode/space.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ typedef struct dGeomSpaceData {
} dGeomSpaceData;


dSpaceID dSimpleSpaceCreate (int dummy);
dSpaceID dHashSpaceCreate (int dummy);
dSpaceID dQuadTreeSpaceCreate (int dummy, dVector3 Center, dVector3 Extents, int Depth);
//dSpaceID dSimpleSpaceCreate (int dummy);
//dSpaceID dHashSpaceCreate (int dummy);
//dSpaceID dQuadTreeSpaceCreate (int dummy, dVector3 Center, dVector3 Extents, int Depth);

void dSpaceDestroy (dSpaceID);
void dSpaceAdd (dSpaceID, dGeomID);
Expand Down
2 changes: 1 addition & 1 deletion Externals/ode/ode/src/collision_quadtreespace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ struct dxQuadTreeSpace : public dxSpace{
};

dxQuadTreeSpace::dxQuadTreeSpace(dSpaceID _space, dVector3 Center, dVector3 Extents, int Depth) : dxSpace(_space){
type = dQuadTreeSpaceClass;
type = dClassNumber::dQuadTreeSpaceClass;

int BlockCount = 0;
for (int i = 0; i <= Depth; i++){
Expand Down
4 changes: 2 additions & 2 deletions Externals/ode/ode/src/collision_space.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ struct dxSimpleSpace : public dxSpace {

dxSimpleSpace::dxSimpleSpace (dSpaceID _space) : dxSpace (_space)
{
type = dSimpleSpaceClass;
type = dClassNumber::dSimpleSpaceClass;
}


Expand Down Expand Up @@ -398,7 +398,7 @@ struct dxHashSpace : public dxSpace {

dxHashSpace::dxHashSpace (dSpaceID _space) : dxSpace (_space)
{
type = dHashSpaceClass;
type = dClassNumber::dHashSpaceClass;
global_minlevel = -3;
global_maxlevel = 10;
}
Expand Down
2 changes: 1 addition & 1 deletion Externals/ode/ode/src/collision_transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct dxGeomTransform : public dxGeom {

dxGeomTransform::dxGeomTransform (dSpaceID space) : dxGeom (space,1)
{
type = dGeomTransformClass;
type = dClassNumber::dGeomTransformClass;
obj = 0;
cleanup = 0;
infomode = 0;
Expand Down
2 changes: 1 addition & 1 deletion Externals/ode/ode/src/timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ void dTimerReport (FILE *fout, int average)
t = total;
p = 100.0;
}
fprintf (fout,"%-*s %7.2fms %6.2f%%",maxl,event[i].description,
fprintf (fout,"%-*s %7.2fms %6.2f%%", static_cast<int>(maxl), event[i].description,
t*ccunit * 1000.0, p);
if (average && i < (num-1)) {
fprintf (fout," (avg %7.2fms %6.2f%%)",
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRender/D3DUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct SPrimitiveBuffer
{
IndexStagingBuffer pIB;
VertexStagingBuffer pVB;
ref_geom pGeom;
ref_geom pGeom{nullptr};
u32 v_cnt;
u32 i_cnt;
D3DPRIMITIVETYPE p_type;
Expand All @@ -29,7 +29,7 @@ struct SPrimitiveBuffer
void RenderDIP() { DU_DRAW_DIP(p_type, pGeom, 0, 0, v_cnt, 0, p_cnt); }
void RenderDP() { DU_DRAW_DP(p_type, pGeom, 0, p_cnt); }

SPrimitiveBuffer() : OnRender(nullptr), pGeom(nullptr) {}
SPrimitiveBuffer() = default;
void CreateFromData(
D3DPRIMITIVETYPE _pt, u32 _p_cnt, u32 FVF, LPVOID vertices, u32 _v_cnt, u16* indices = nullptr, u32 _i_cnt = 0);
void Destroy();
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRender/DetailManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ void CDetailManager::UpdateVisibleM()
// Initialize 'vis' and 'cache'
// Collect objects for rendering
RImplementation.BasicStats.DetailVisibility.Begin();
for (int _mz = 0; _mz < dm_cache1_line; _mz++)
for (u32 _mz = 0; _mz < dm_cache1_line; _mz++)
{
for (int _mx = 0; _mx < dm_cache1_line; _mx++)
for (u32 _mx = 0; _mx < dm_cache1_line; _mx++)
{
CacheSlot1& MS = cache_level1[_mz][_mx];
if (MS.empty)
Expand Down
34 changes: 17 additions & 17 deletions src/Layers/xrRender/DetailManager_CACHE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ void CDetailManager::cache_Initialize()
}
VERIFY(cache_Validate());

for (int _mz1 = 0; _mz1 < dm_cache1_line; _mz1++)
for (u32 _mz1 = 0; _mz1 < dm_cache1_line; _mz1++)
{
for (int _mx1 = 0; _mx1 < dm_cache1_line; _mx1++)
for (u32 _mx1 = 0; _mx1 < dm_cache1_line; _mx1++)
{
CacheSlot1& MS = cache_level1[_mz1][_mx1];
for (int _z = 0; _z < dm_cache1_count; _z++)
for (u32 _z = 0; _z < dm_cache1_count; _z++)
{
for (int _x = 0; _x < dm_cache1_count; _x++)
for (u32 _x = 0; _x < dm_cache1_count; _x++)
{
MS.slots[_z * dm_cache1_count + _x] =
&cache[_mz1 * dm_cache1_count + _z][_mx1 * dm_cache1_count + _x];
Expand Down Expand Up @@ -79,9 +79,9 @@ void CDetailManager::cache_Task(int gx, int gz, Slot* D)

BOOL CDetailManager::cache_Validate()
{
for (int z = 0; z < dm_cache_line; z++)
for (u32 z = 0; z < dm_cache_line; z++)
{
for (int x = 0; x < dm_cache_line; x++)
for (u32 x = 0; x < dm_cache_line; x++)
{
int w_x = cg2w_X(x);
int w_z = cg2w_Z(z);
Expand All @@ -106,10 +106,10 @@ void CDetailManager::cache_Update(int v_x, int v_z, Fvector& view, int limit)
{
// shift matrix to left
cache_cx++;
for (int z = 0; z < dm_cache_line; z++)
for (u32 z = 0; z < dm_cache_line; z++)
{
Slot* S = cache[z][0];
for (int x = 1; x < dm_cache_line; x++)
for (u32 x = 1; x < dm_cache_line; x++)
cache[z][x - 1] = cache[z][x];
cache[z][dm_cache_line - 1] = S;
cache_Task(dm_cache_line - 1, z, S);
Expand All @@ -120,10 +120,10 @@ void CDetailManager::cache_Update(int v_x, int v_z, Fvector& view, int limit)
{
// shift matrix to right
cache_cx--;
for (int z = 0; z < dm_cache_line; z++)
for (u32 z = 0; z < dm_cache_line; z++)
{
Slot* S = cache[z][dm_cache_line - 1];
for (int x = dm_cache_line - 1; x > 0; x--)
for (u32 x = dm_cache_line - 1; x > 0; x--)
cache[z][x] = cache[z][x - 1];
cache[z][0] = S;
cache_Task(0, z, S);
Expand All @@ -137,10 +137,10 @@ void CDetailManager::cache_Update(int v_x, int v_z, Fvector& view, int limit)
{
// shift matrix down a bit
cache_cz++;
for (int x = 0; x < dm_cache_line; x++)
for (u32 x = 0; x < dm_cache_line; x++)
{
Slot* S = cache[dm_cache_line - 1][x];
for (int z = dm_cache_line - 1; z > 0; z--)
for (u32 z = dm_cache_line - 1; z > 0; z--)
cache[z][x] = cache[z - 1][x];
cache[0][x] = S;
cache_Task(x, 0, S);
Expand All @@ -151,10 +151,10 @@ void CDetailManager::cache_Update(int v_x, int v_z, Fvector& view, int limit)
{
// shift matrix up
cache_cz--;
for (int x = 0; x < dm_cache_line; x++)
for (u32 x = 0; x < dm_cache_line; x++)
{
Slot* S = cache[0][x];
for (int z = 1; z < dm_cache_line; z++)
for (u32 z = 1; z < dm_cache_line; z++)
cache[z - 1][x] = cache[z][x];
cache[dm_cache_line - 1][x] = S;
cache_Task(x, dm_cache_line - 1, S);
Expand Down Expand Up @@ -209,14 +209,14 @@ void CDetailManager::cache_Update(int v_x, int v_z, Fvector& view, int limit)

if (bNeedMegaUpdate)
{
for (int _mz1 = 0; _mz1 < dm_cache1_line; _mz1++)
for (u32 _mz1 = 0; _mz1 < dm_cache1_line; _mz1++)
{
for (int _mx1 = 0; _mx1 < dm_cache1_line; _mx1++)
for (u32 _mx1 = 0; _mx1 < dm_cache1_line; _mx1++)
{
CacheSlot1& MS = cache_level1[_mz1][_mx1];
MS.empty = TRUE;
MS.vis.clear();
for (int _i = 0; _i < dm_cache1_count * dm_cache1_count; _i++)
for (u32 _i = 0; _i < dm_cache1_count * dm_cache1_count; _i++)
{
Slot* PS = *MS.slots[_i];
Slot& S = *PS;
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/Light_DB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void CLight_DB::Load(IReader* fs)
for (size_t i = 0; i < count; ++i)
{
Flight Ldata;
u32 controller = F->r_u32();
F->advance(sizeof(u32)); //controller
F->r(&Ldata, sizeof(Flight));

light* L = Create();
Expand Down
37 changes: 18 additions & 19 deletions src/Layers/xrRender/NvTriStrip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ void GenerateStrips(const u16* in_indices, const s32 in_numIndices, xr_vector<Pr

// count the total number of indices
unsigned int numIndices = 0;
for (int i = 0; i < tempStrips.size(); i++)
for (const auto& tempStrip : tempStrips)
{
numIndices += tempStrips[i]->m_faces.size() * 3;
numIndices += tempStrip->m_faces.size() * 3;
}

// add in the list
Expand All @@ -100,22 +100,22 @@ void GenerateStrips(const u16* in_indices, const s32 in_numIndices, xr_vector<Pr

// do strips
unsigned int indexCtr = 0;
for (u32 i = 0; i < tempStrips.size(); i++)
for (const auto& tempStrip : tempStrips)
{
for (int j = 0; j < tempStrips[i]->m_faces.size(); j++)
for (const auto& tempStripFace : tempStrip->m_faces)
{
primGroups[0].indices[indexCtr++] = u16(tempStrips[i]->m_faces[j]->m_v0);
primGroups[0].indices[indexCtr++] = u16(tempStrips[i]->m_faces[j]->m_v1);
primGroups[0].indices[indexCtr++] = u16(tempStrips[i]->m_faces[j]->m_v2);
primGroups[0].indices[indexCtr++] = u16(tempStripFace->m_v0);
primGroups[0].indices[indexCtr++] = u16(tempStripFace->m_v1);
primGroups[0].indices[indexCtr++] = u16(tempStripFace->m_v2);
}
}

// do lists
for (u32 i = 0; i < tempFaces.size(); i++)
for (const auto& tempFace : tempFaces)
{
primGroups[0].indices[indexCtr++] = u16(tempFaces[i]->m_v0);
primGroups[0].indices[indexCtr++] = u16(tempFaces[i]->m_v1);
primGroups[0].indices[indexCtr++] = u16(tempFaces[i]->m_v2);
primGroups[0].indices[indexCtr++] = u16(tempFace->m_v0);
primGroups[0].indices[indexCtr++] = u16(tempFace->m_v1);
primGroups[0].indices[indexCtr++] = u16(tempFace->m_v2);
}
}
else
Expand All @@ -133,14 +133,13 @@ void GenerateStrips(const u16* in_indices, const s32 in_numIndices, xr_vector<Pr

// first, the strips
int startingLoc = 0;
int stripCtr;
for (stripCtr = 0; stripCtr < numSeparateStrips; stripCtr++)
for (unsigned int stripCtr = 0; stripCtr < numSeparateStrips; stripCtr++)
{
int stripLength = 0;
if (numSeparateStrips != 1)
{
// if we've got multiple strips, we need to figure out the correct length
int i;
unsigned int i;
for (i = startingLoc; i < stripIndices.size(); i++)
{
if (stripIndices[i] == -1)
Expand Down Expand Up @@ -171,7 +170,7 @@ void GenerateStrips(const u16* in_indices, const s32 in_numIndices, xr_vector<Pr
primGroups[faceGroupLoc].indices = xr_alloc<u16>(tempFaces.size() * 3);
primGroups[faceGroupLoc].numIndices = tempFaces.size() * 3;
int indexCtr = 0;
for (int i = 0; i < tempFaces.size(); i++)
for (size_t i = 0; i < tempFaces.size(); i++)
{
primGroups[faceGroupLoc].indices[indexCtr++] = u16(tempFaces[i]->m_v0);
primGroups[faceGroupLoc].indices[indexCtr++] = u16(tempFaces[i]->m_v1);
Expand All @@ -183,17 +182,17 @@ void GenerateStrips(const u16* in_indices, const s32 in_numIndices, xr_vector<Pr
// clean up everything

//_delete strips
for (u32 i = 0; i < tempStrips.size(); i++)
for (size_t i = 0; i < tempStrips.size(); i++)
{
for (int j = 0; j < tempStrips[i]->m_faces.size(); j++)
for (size_t j = 0; j < tempStrips[i]->m_faces.size(); j++)
{
xr_delete(tempStrips[i]->m_faces[j]);
}
xr_delete(tempStrips[i]);
}

//_delete faces
for (u32 i = 0; i < tempFaces.size(); i++)
for (size_t i = 0; i < tempFaces.size(); i++)
{
xr_delete(tempFaces[i]);
}
Expand Down Expand Up @@ -235,7 +234,7 @@ void RemapIndices(
remappedGroups[i].numIndices = numIndices;
remappedGroups[i].indices = xr_alloc<u16>(numIndices);

for (int j = 0; j < numIndices; j++)
for (unsigned int j = 0; j < numIndices; j++)
{
int cachedIndex = indexCache[in_primGroups[i].indices[j]];
if (cachedIndex == -1) // we haven't seen this index before
Expand Down
Loading

0 comments on commit d97af3e

Please sign in to comment.