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 Jul 26, 2022
1 parent 1af06fd commit 8a6ce94
Show file tree
Hide file tree
Showing 350 changed files with 2,510 additions and 1,889 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
2 changes: 1 addition & 1 deletion src/utils/mp_gpprof_server/gamespy_sake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ void sake_processor::request_callback(
me->process_out_request(tmp_in, tmp_out);
me->m_current_offset += tmp_out->mNumRecords;
if ((tmp_out->mNumRecords == max_request_records) &&
(static_cast<std::size_t>(me->m_current_offset) < me->m_request_names.size()))
(static_cast<size_t>(me->m_current_offset) < me->m_request_names.size()))
{
me->fetch();
return;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/xrAI/ESceneAIMapTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

poolSS<SAINode, 1024> g_ainode_pool;

void* SAINode::operator new(std::size_t size) { return g_ainode_pool.create(); }
void* SAINode::operator new(std::size_t size, SAINode* src) { return src; }
void* SAINode::operator new(size_t size) { return g_ainode_pool.create(); }
void* SAINode::operator new(size_t size, SAINode* src) { return src; }
void SAINode::operator delete(void* ptr) { g_ainode_pool.destroy((SAINode*)ptr); }
void SAINode::PointLF(Fvector& D, float patch_size)
{
Expand Down
4 changes: 2 additions & 2 deletions src/utils/xrAI/ESceneAIMapTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ struct SAINode // definition of "patch" or "node"
void LoadLTX(CInifile& ini, LPCSTR sect_name, ESceneAIMapTool*);
void SaveLTX(CInifile& ini, LPCSTR sect_name, ESceneAIMapTool*);

void* operator new(std::size_t size);
void* operator new(std::size_t size, SAINode*);
void* operator new(size_t size);
void* operator new(size_t size, SAINode*);
void operator delete(void*);
};
#pragma pack(pop)
Expand Down
12 changes: 5 additions & 7 deletions src/utils/xrQSlim/MxPropSlim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@ Copyright (C) 1998 Michael Garland. See "COPYING.txt" for details.

typedef MxQuadric Quadric;

MxPropSlim::MxPropSlim(MxStdModel* m0) : MxStdSlim(m0), __quadrics(m0->vert_count()), edge_links(m0->vert_count())
MxPropSlim::MxPropSlim(MxStdModel* m0) : MxStdSlim(m0), edge_links(m0->vert_count()), __quadrics(m0->vert_count())
{
consider_color();
consider_texture();
consider_normals();

D = compute_dimension(m);

will_decouple_quadrics = false;
contraction_callback = NULL;
contraction_callback = nullptr;
}

void MxPropSlim::consider_color(bool will)
Expand Down Expand Up @@ -674,12 +672,11 @@ void MxPropSlim::finalize_edge_update(edge_info* info)
void MxPropSlim::update_pre_contract(const MxPairContraction& conx)
{
MxVertexID v1 = conx.v1, v2 = conx.v2;
unsigned int i, j;

star.reset();
m->collect_vertex_star(v1, star);

for (i = 0; i < (unsigned int)edge_links(v2).length(); i++)
for (int i = 0; i < edge_links(v2).length(); i++)
{
edge_info* e = edge_links(v2)(i);
MxVertexID u = (e->v1 == v2) ? e->v2 : e->v1;
Expand All @@ -689,7 +686,8 @@ void MxPropSlim::update_pre_contract(const MxPairContraction& conx)
if (u == v1 || varray_find(star, u))
{
// This is a useless link --- kill it
bool found = varray_find(edge_links(u), e, &j);
unsigned int j = 0;
[[maybe_unused]] bool found = varray_find(edge_links(u), e, &j);
VERIFY(found);
edge_links(u).remove(j);
heap.remove(e);
Expand Down
8 changes: 4 additions & 4 deletions src/utils/xrQSlim/MxPropSlim.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class MxPropSlim : public MxStdSlim
private:
unsigned int D;

bool use_color;
bool use_texture;
bool use_normals;
bool use_color{};
bool use_texture{};
bool use_normals{};

class edge_info : public MxHeapable
{
Expand Down Expand Up @@ -69,7 +69,7 @@ class MxPropSlim : public MxStdSlim
void update_pre_contract(const MxPairContraction&);

public:
bool will_decouple_quadrics;
bool will_decouple_quadrics{};

public:
MxPropSlim(MxStdModel*);
Expand Down
14 changes: 7 additions & 7 deletions src/utils/xrQSlim/MxQSlim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ void MxEdgeQSlim::apply_mesh_penalties(MxQSlimEdge* info)
if (nfailed)
bias += nfailed * meshing_penalty;

static u32 a = 0;
//static u32 a = 0;
// if (a)
{
double Nmin1 = check_local_inversion(info->v1, info->v2, info->vnew);
Expand Down Expand Up @@ -460,7 +460,6 @@ void MxEdgeQSlim::collect_edges(const MxEdge* edges, unsigned int count)
void MxEdgeQSlim::update_pre_contract(const MxPairContraction& conx)
{
MxVertexID v1 = conx.v1, v2 = conx.v2;
unsigned int i, j;

star.reset();
//
Expand All @@ -470,10 +469,10 @@ void MxEdgeQSlim::update_pre_contract(const MxPairContraction& conx)
// the total edges. Instead, we need to collect the "star"
// from the edge links maintained at v1.
//
for (i = 0; i < (unsigned int)edge_links(v1).length(); i++)
for (int i = 0; i < edge_links(v1).length(); i++)
star.add(edge_links(v1)[i]->opposite_vertex(v1));

for (i = 0; i < (unsigned int)edge_links(v2).length(); i++)
for (int i = 0; i < edge_links(v2).length(); i++)
{
MxQSlimEdge* e = edge_links(v2)(i);
MxVertexID u = (e->v1 == v2) ? e->v2 : e->v1;
Expand All @@ -483,7 +482,8 @@ void MxEdgeQSlim::update_pre_contract(const MxPairContraction& conx)
if (u == v1 || varray_find(star, u))
{
// This is a useless link --- kill it
bool found = varray_find(edge_links(u), e, &j);
unsigned int j = 0;
[[maybe_unused]] bool found = varray_find(edge_links(u), e, &j);
VERIFY(found);
edge_links(u).remove(j);
heap.remove(e);
Expand Down Expand Up @@ -526,8 +526,8 @@ void MxEdgeQSlim::apply_contraction(const MxPairContraction& conx)
star.add(conx.v1);

edges.clear();
for (unsigned int j = 0; j < (unsigned int)star.length(); j++)
for (unsigned int i = 0; i < (unsigned int)edge_links(star(j)).length(); i++)
for (int j = 0; j < star.length(); j++)
for (int i = 0; i < edge_links(star(j)).length(); i++)
edges.push_back(edge_links(star(j))[i]);

// u32 r=edges.size();
Expand Down
15 changes: 7 additions & 8 deletions src/utils/xrQSlim/MxStdModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ MxVertexID MxStdModel::alloc_vertex(float x, float y, float z)
vertex_mark_valid(id);

face_links.add(xr_new<MxFaceList>());
unsigned int l = face_links.last_id();
VERIFY(l == id);
VERIFY(face_links.last_id() == id);
VERIFY(neighbors(id).length() == 0);

return id;
Expand Down Expand Up @@ -545,8 +544,7 @@ void MxStdModel::apply_expansion(const MxPairExpansion& conx)
mxv_sub(vertex(v2), vertex(v1), conx.dv2, 3);
mxv_subfrom(vertex(v1), conx.dv1, 3);

unsigned int i, j;
for (i = 0; i < (unsigned int)conx.dead_faces.length(); i++)
for (int i = 0; i < conx.dead_faces.length(); i++)
{
MxFaceID fid = conx.dead_faces(i);
face_mark_valid(fid);
Expand All @@ -555,12 +553,13 @@ void MxStdModel::apply_expansion(const MxPairExpansion& conx)
neighbors(face(fid)(2)).add(fid);
}

for (i = conx.delta_pivot; i < (unsigned int)conx.delta_faces.length(); i++)
for (int i = conx.delta_pivot; i < conx.delta_faces.length(); i++)
{
MxFaceID fid = conx.delta_faces(i);
face(fid).remap_vertex(v1, v2);
neighbors(v2).add(fid);
bool found = varray_find(neighbors(v1), fid, &j);
unsigned int j = 0;
[[maybe_unused]] bool found = varray_find(neighbors(v1), fid, &j);
VERIFY(found);
neighbors(v1).remove(j);
}
Expand All @@ -570,13 +569,13 @@ void MxStdModel::apply_expansion(const MxPairExpansion& conx)
if (normal_binding() == MX_PERFACE)
{
float n[3];
for (i = 0; i < (unsigned int)conx.delta_faces.length(); i++)
for (int i = 0; i < conx.delta_faces.length(); i++)
{
compute_face_normal(conx.delta_faces[i], n);
normal(conx.delta_faces[i]) = MxNormal(n);
}

for (i = 0; i < (unsigned int)conx.dead_faces.length(); i++)
for (int i = 0; i < conx.dead_faces.length(); i++)
{
compute_face_normal(conx.dead_faces[i], n);
normal(conx.dead_faces[i]) = MxNormal(n);
Expand Down
4 changes: 2 additions & 2 deletions src/xrAICore/Components/problem_solver_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ IC typename CProblemSolverAbstract::edge_value_type CProblemSolverAbstract::get_
}

TEMPLATE_SPECIALIZATION
IC bool CProblemSolverAbstract::is_accessible(const _index_type& vertex_index) const { return (m_applied); }
IC bool CProblemSolverAbstract::is_accessible(const _index_type&) const { return (m_applied); }
TEMPLATE_SPECIALIZATION
IC const typename CProblemSolverAbstract::_index_type& CProblemSolverAbstract::value(
const _index_type& vertex_index, const_iterator& i, bool reverse_search) const
Expand Down Expand Up @@ -234,7 +234,7 @@ IC const typename CProblemSolverAbstract::_index_type& CProblemSolverAbstract::v
}

TEMPLATE_SPECIALIZATION
IC void CProblemSolverAbstract::begin(const _index_type& vertex_index, const_iterator& b, const_iterator& e) const
IC void CProblemSolverAbstract::begin(const _index_type&, const_iterator& b, const_iterator& e) const
{
b = m_operators.begin();
e = m_operators.end();
Expand Down
3 changes: 1 addition & 2 deletions src/xrAICore/Navigation/PatrolPath/patrol_path_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ void CPatrolPathStorage::load_raw(

shared_str patrol_name;
sub_chunk->r_stringZ(patrol_name);
const_iterator I = m_registry.find(patrol_name);
VERIFY3(I == m_registry.end(), "Duplicated patrol path found", *patrol_name);
VERIFY3(m_registry.find(patrol_name) == m_registry.end(), "Duplicated patrol path found", *patrol_name);
m_registry.emplace(
patrol_name, &(xr_new<CPatrolPath>(patrol_name))->load_raw(level_graph, cross, game_graph, *sub_chunk)
);
Expand Down
2 changes: 2 additions & 0 deletions src/xrAICore/Navigation/graph_engine_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
////////////////////////////////////////////////////////////////////////////

#pragma once

#include "xrCore/Threading/ScopeLock.hpp"
#include "xrEngine/profiler.h"

inline CGraphEngine::CGraphEngine(u32 max_vertex_count)
{
Expand Down
6 changes: 2 additions & 4 deletions src/xrAICore/Navigation/graph_vertex_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ IC typename _graph_type::CEdge* CSGraphVertex::edge(const _vertex_id_type& verte
TEMPLATE_SPECIALIZATION
IC void CSGraphVertex::add_edge(CGraphVertex* vertex, const typename _graph_type::CEdge::edge_weight_type& edge_weight)
{
typename EDGES::iterator I = std::find(m_edges.begin(), m_edges.end(), vertex->vertex_id());
VERIFY(m_edges.end() == I);
VERIFY(std::find(m_edges.begin(), m_edges.end(), vertex->vertex_id()) == m_edges.end());
vertex->on_edge_addition(this);
m_edges.push_back(typename _graph_type::CEdge(edge_weight, vertex));
++*m_edge_count;
Expand All @@ -86,8 +85,7 @@ IC void CSGraphVertex::remove_edge(const _vertex_id_type& vertex_id)
TEMPLATE_SPECIALIZATION
IC void CSGraphVertex::on_edge_addition(CGraphVertex* vertex)
{
typename VERTICES::const_iterator I = std::find(m_vertices.begin(), m_vertices.end(), vertex);
VERIFY(I == m_vertices.end());
VERIFY(std::find(m_vertices.begin(), m_vertices.end(), vertex) == m_vertices.end());
m_vertices.push_back(vertex);
}

Expand Down
9 changes: 5 additions & 4 deletions src/xrAICore/Navigation/level_graph_vertex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ float CLevelGraph::distance(const Fvector& position, const CLevelGraph::CLevelVe
void CLevelGraph::choose_point(const Fvector& start_point, const Fvector& finish_point, const SContour& _contour,
int node_id, Fvector& temp_point, int& saved_index) const
{
SContour tNextContour;
SSegment tNextSegment;
SContour tNextContour{};
SSegment tNextSegment{};
Fvector tCheckPoint1 = start_point, tCheckPoint2 = start_point, tIntersectPoint;
contour(tNextContour, node_id);
intersect(tNextSegment, tNextContour, _contour);
u32 dwIntersect = intersect(start_point.x, start_point.z, finish_point.x, finish_point.z, tNextSegment.v1.x,
tNextSegment.v1.z, tNextSegment.v2.x, tNextSegment.v2.z, &tIntersectPoint.x, &tIntersectPoint.z);
u32 dwIntersect = intersect(start_point.x, start_point.z, finish_point.x, finish_point.z,
tNextSegment.v1.x, tNextSegment.v1.z, tNextSegment.v2.x, tNextSegment.v2.z,
&tIntersectPoint.x, &tIntersectPoint.z);
if (!dwIntersect)
return;
for (int i = 0; i < 4; ++i)
Expand Down
Loading

0 comments on commit 8a6ce94

Please sign in to comment.