Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolves several compile warnings when comparing different int signedness #1755

Open
wants to merge 12 commits into
base: dev
Choose a base branch
from
10 changes: 5 additions & 5 deletions src/Layers/xrRender/AnimationKeyCalculate.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ IC void Dequantize(CKey& K, const CBlend& BD, const CMotion& M)
}
}

IC void MixInterlerp(CKey& Result, const CKey* R, const CBlend* const BA[MAX_BLENDED], int b_count)
IC void MixInterlerp(CKey& Result, const CKey* R, const CBlend* const BA[MAX_BLENDED], u32 b_count)
{
VERIFY(MAX_BLENDED >= b_count);
switch (b_count)
Expand Down Expand Up @@ -237,14 +237,14 @@ IC void MixInterlerp(CKey& Result, const CKey* R, const CBlend* const BA[MAX_BLE
//int count = Blend.size();
float total = 0;
ConsistantKey S[MAX_BLENDED];
for (int i = 0; i < b_count; i++)
for (u32 i = 0; i < b_count; i++)
S[i].set(R + i, BA[i]->blendAmount);

std::sort(S, S + b_count);
CKey tmp;
total = S[0].w;
tmp = *S[0].K;
for (int cnt = 1; cnt < b_count; cnt++)
for (u32 cnt = 1; cnt < b_count; cnt++)
{
total += S[cnt].w;
float d;
Expand Down Expand Up @@ -400,14 +400,14 @@ IC void process_single_channel(
VERIFY(_valid(Result.T));
VERIFY(_valid(Result.Q));
}
IC void MixChannels(CKey& Result, const CKey* R, const animation::channel_def* BA, int b_count)
IC void MixChannels(CKey& Result, const CKey* R, const animation::channel_def* BA, u32 b_count)
{
VERIFY(b_count > 0);
Result = R[0];

// MixinAdd(Result,R,BA,b_count);
float lerp_factor_sum = 0.f;
for (int i = 1; i < b_count; i++)
for (u32 i = 1; i < b_count; i++)
switch (BA[i].rule.extern_)
{
case animation::add: key_mad(Result, CKey(Result), R[i], BA[i].factor); break;
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRender/DetailManager_CACHE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ void CDetailManager::cache_Initialize()
CDetailManager::Slot* CDetailManager::cache_Query(int r_x, int r_z)
{
int gx = w2cg_X(r_x + cache_cx);
VERIFY(gx >= 0 && gx < dm_cache_line);
VERIFY(gx >= 0 && gx < static_cast<int>(dm_cache_line));
int gz = w2cg_Z(r_z + cache_cz);
VERIFY(gz >= 0 && gz < dm_cache_line);
VERIFY(gz >= 0 && gz < static_cast<int>(dm_cache_line));
return cache[gz][gx];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/R_Backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ class ECORE_API CBackend
void dbg_SetRS(D3DRENDERSTATETYPE p1, u32 p2);
void dbg_SetSS(u32 sampler, D3DSAMPLERSTATETYPE type, u32 value);
#ifdef DEBUG
void dbg_Draw(D3DPRIMITIVETYPE T, FVF::L* pVerts, int vcnt, u16* pIdx, int pcnt);
void dbg_Draw(D3DPRIMITIVETYPE T, FVF::L* pVerts, u32 vcnt, u16* pIdx, int pcnt);
void dbg_Draw(D3DPRIMITIVETYPE T, FVF::L* pVerts, int pcnt);

void dbg_DrawAABB(Fvector& T, float sx, float sy, float sz, u32 C)
Expand Down
8 changes: 4 additions & 4 deletions src/Layers/xrRender/R_Backend_DBG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void CBackend::dbg_DIP(D3DPRIMITIVETYPE pt, ref_geom geom, u32 baseV, u32 startV

#ifdef DEBUG

void CBackend::dbg_Draw(D3DPRIMITIVETYPE T, FVF::L* pVerts, int vcnt, u16* pIdx, int pcnt)
void CBackend::dbg_Draw(D3DPRIMITIVETYPE T, FVF::L* pVerts, u32 vcnt, u16* pIdx, int pcnt)
{
u32 vBase;
{
Expand Down Expand Up @@ -191,11 +191,11 @@ void CBackend::dbg_DrawEllipse(Fmatrix& T, u32 C)
102, 113, 104, 103, 113, 105, 104, 113, 106, 105, 113, 107, 106, 113, 108, 107, 113, 109, 108, 113, 110, 109,
113, 111, 110, 113, 112, 111, 113, 97, 112};

const int vcnt = sizeof(gVertices) / (sizeof(float) * 3);
const u32 vcnt = sizeof(gVertices) / (sizeof(float) * 3);
FVF::L verts[vcnt];
for (int i = 0; i < vcnt; i++)
for (u32 i = 0; i < vcnt; i++)
{
int k = i * 3;
u32 k = i * 3;
verts[i].set(gVertices[k], gVertices[k + 1], gVertices[k + 2], C);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRender/light.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ light::light() : SpatialBase(g_pGamePersistent->SpatialSpace)
vis.query_order = 0;
vis.visible = true;
vis.pending = false;
for (int id = 0; id < R__NUM_CONTEXTS; ++id)
for (u32 id = 0; id < R__NUM_CONTEXTS; ++id)
svis[id].id = id;
#endif // (RENDER==R_R2) || (RENDER==R_R3) || (RENDER==R_R4) || (RENDER==R_GL)
}
Expand Down Expand Up @@ -212,7 +212,7 @@ void light::spatial_move()
#if (RENDER == R_R2) || (RENDER == R_R3) || (RENDER == R_R4) || (RENDER == R_GL)
if (flags.bActive)
gi_generate();
for (int id = 0; id < R__NUM_CONTEXTS; ++id)
for (u32 id = 0; id < R__NUM_CONTEXTS; ++id)
svis[id].invalidate();
#endif // (RENDER==R_R2) || (RENDER==R_R3) || (RENDER==R_R4) || (RENDER == R_GL)
}
Expand Down
6 changes: 3 additions & 3 deletions src/Layers/xrRender/r__dsgraph_build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,13 +675,13 @@ void R_dsgraph_structure::load(const xr_vector<CSector::level_sector_data_t>& se
Sectors.resize(sectors_count);
Portals.resize(portals_count);

for (int idx = 0; idx < portals_count; ++idx)
for (u32 idx = 0; idx < portals_count; ++idx)
{
auto* portal = xr_new<CPortal>();
Portals[idx] = portal;
}

for (int idx = 0; idx < sectors_count; ++idx)
for (u32 idx = 0; idx < sectors_count; ++idx)
{
auto* sector = xr_new<CSector>();

Expand All @@ -690,7 +690,7 @@ void R_dsgraph_structure::load(const xr_vector<CSector::level_sector_data_t>& se
Sectors[idx] = sector;
}

for (int idx = 0; idx < portals_count; ++idx)
for (u32 idx = 0; idx < portals_count; ++idx)
{
auto* portal = static_cast<CPortal*>(Portals[idx]);

Expand Down
6 changes: 3 additions & 3 deletions src/Layers/xrRender/r__sector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void CPortal::setup(const level_portal_data_t& data, const xr_vector<CSector*>&
// calc sphere
Fbox BB;
BB.invalidate();
for (int v = 0; v < vcnt; v++)
for (u32 v = 0; v < vcnt; v++)
BB.modify(V[v]);
BB.getsphere(S.P, S.R);

Expand All @@ -111,7 +111,7 @@ void CPortal::setup(const level_portal_data_t& data, const xr_vector<CSector*>&
N.set(0, 0, 0);

u32 _cnt = 0;
for (int i = 2; i < vcnt; i++)
for (u32 i = 2; i < vcnt; i++)
{
T.mknormal_non_normalized(poly[0], poly[i - 1], poly[i]);
float m = T.magnitude();
Expand All @@ -136,7 +136,7 @@ void CSector::setup(const level_sector_data_t& data, const xr_vector<CPortal*> &
// Assign portal polygons
const auto num_portals = data.portals_id.size();
m_portals.resize(num_portals);
for (int idx = 0; idx < num_portals; ++idx)
for (u32 idx = 0; idx < num_portals; ++idx)
{
const auto ID = data.portals_id[idx];
m_portals[idx] = portals[ID];
Expand Down
11 changes: 5 additions & 6 deletions src/Layers/xrRenderGL/glTextureUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,11 @@ TextureFormatPairs TextureFormatList[] =

GLenum ConvertTextureFormat(D3DFORMAT dx9FMT)
{
constexpr size_t arrayLength = sizeof(TextureFormatList) / sizeof(TextureFormatList[0]);
for (int i = 0; i < arrayLength; ++i)
{
if (TextureFormatList[i].m_dx9FMT == dx9FMT)
return TextureFormatList[i].m_glFMT;
}
for (const auto& textureFormat : TextureFormatList)
{
if (textureFormat.m_dx9FMT == dx9FMT)
return textureFormat.m_glFMT;
}

VERIFY(!"ConvertTextureFormat didn't find appropriate gl texture format!");
return GL_NONE;
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender_R2/r2_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ void CRender::LoadSectors(IReader* fs)
rmPortals = nullptr;
}

for (int id = 0; id < R__NUM_PARALLEL_CONTEXTS; ++id)
for (u32 id = 0; id < R__NUM_PARALLEL_CONTEXTS; ++id)
{
auto& dsgraph = contexts_pool[id];
dsgraph.reset();
Expand Down
6 changes: 3 additions & 3 deletions src/Layers/xrRender_R2/render_phase_sun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void render_sun::init()
return;

// pre-allocate contexts
for (int i = 0; i < R__NUM_SUN_CASCADES; ++i)
for (u32 i = 0; i < R__NUM_SUN_CASCADES; ++i)
{
contexts_ids[i] = RImplementation.alloc_context();
VERIFY(contexts_ids[i] != R_dsgraph_structure::INVALID_CONTEXT_ID);
Expand Down Expand Up @@ -114,7 +114,7 @@ void render_sun::calculate()
Fvector3 cull_COP[R__NUM_SUN_CASCADES];
Fmatrix cull_xform[R__NUM_SUN_CASCADES];

for (int cascade_ind = 0; cascade_ind < R__NUM_SUN_CASCADES; ++cascade_ind)
for (u32 cascade_ind = 0; cascade_ind < R__NUM_SUN_CASCADES; ++cascade_ind)
{
cull_planes.clear();

Expand Down Expand Up @@ -378,7 +378,7 @@ void render_sun::flush()

if (RImplementation.o.support_rt_arrays)
{
for (int cascade_ind = 0; cascade_ind < R__NUM_SUN_CASCADES; ++cascade_ind)
for (u32 cascade_ind = 0; cascade_ind < R__NUM_SUN_CASCADES; ++cascade_ind)
{
accumulate_cascade(cascade_ind);
}
Expand Down
2 changes: 1 addition & 1 deletion src/xrAICore/Navigation/level_graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class XRAICORE_API CLevelGraph
template <class _predicate>
IC float vertex_low_cover_angle(u32 vertex_id, float inc_angle, _predicate compare_predicate) const;
IC void set_invalid_vertex(u32& vertex_id, CLevelVertex** vertex = NULL) const;
IC const u32 vertex_id(const CLevelGraph::CLevelVertex* vertex) const;
IC u32 vertex_id(const CLevelGraph::CLevelVertex* vertex) const;
u32 vertex_id(const Fvector& position) const;

private:
Expand Down
2 changes: 1 addition & 1 deletion src/xrAICore/Navigation/level_graph_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ IC void CLevelGraph::set_invalid_vertex(u32& vertex_id, CLevelVertex** vertex) c
*vertex = NULL;
}

IC const u32 CLevelGraph::vertex_id(const CLevelGraph::CLevelVertex* vertex) const
IC u32 CLevelGraph::vertex_id(const CLevelGraph::CLevelVertex* vertex) const
{
VERIFY(valid_vertex_id(u32(vertex - m_nodes->begin())));
return (u32(vertex - m_nodes->begin()));
Expand Down
12 changes: 6 additions & 6 deletions src/xrCDB/Frustum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ u32 frustum_aabb_remap[8][6] =
EFC_Visible CFrustum::testSphere(Fvector& c, float r, u32& test_mask) const
{
u32 bit = 1;
for (int i = 0; i < p_count; i++, bit <<= 1)
for (u32 i = 0; i < p_count; i++, bit <<= 1)
{
if (test_mask & bit)
{
Expand Down Expand Up @@ -162,7 +162,7 @@ EFC_Visible CFrustum::testAABB(const float* mM, u32& test_mask) const
// go for trivial rejection or acceptance using "faster overlap test"
u32 bit = 1;

for (int i = 0; i < p_count; i++, bit <<= 1)
for (u32 i = 0; i < p_count; i++, bit <<= 1)
{
if (test_mask & bit)
{
Expand All @@ -182,7 +182,7 @@ EFC_Visible CFrustum::testAABB(const float* mM, u32& test_mask) const
EFC_Visible CFrustum::testSAABB(Fvector& c, float r, const float* mM, u32& test_mask) const
{
u32 bit = 1;
for (int i = 0; i < p_count; i++, bit <<= 1)
for (u32 i = 0; i < p_count; i++, bit <<= 1)
{
if (test_mask & bit)
{
Expand Down Expand Up @@ -213,7 +213,7 @@ EFC_Visible CFrustum::testSAABB(Fvector& c, float r, const float* mM, u32& test_
bool CFrustum::testPolyInside_dirty(Fvector* p, size_t count) const
{
Fvector* e = p + count;
for (int i = 0; i < p_count; i++)
for (u32 i = 0; i < p_count; i++)
{
const fplane& P = planes[i];
for (Fvector* I = p; I != e; I++)
Expand Down Expand Up @@ -384,7 +384,7 @@ sPoly* CFrustum::ClipPoly(sPoly& S, sPoly& D) const
{
sPoly* src = &D;
sPoly* dest = &S;
for (int i = 0; i < p_count; i++)
for (u32 i = 0; i < p_count; i++)
{
// cache plane and swap lists
const fplane& P = planes[i];
Expand Down Expand Up @@ -530,7 +530,7 @@ void CFrustum::CreateFromMatrix(Fmatrix& M, u32 mask)
p_count++;
}

for (int i = 0; i < p_count; i++)
for (u32 i = 0; i < p_count; i++)
{
float denom = 1.0f / planes[i].n.magnitude(); // Get magnitude of Vector
planes[i].n.x *= denom;
Expand Down
6 changes: 3 additions & 3 deletions src/xrCDB/xrCDB_Collector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,9 @@ CollectorPacked::CollectorPacked(const Fbox& bb, int apx_vertices, int apx_faces
flags.reserve(apx_faces);
int _size = (clpMX + 1) * (clpMY + 1) * (clpMZ + 1);
int _average = (apx_vertices / _size) / 2;
for (int ix = 0; ix < clpMX + 1; ix++)
for (int iy = 0; iy < clpMY + 1; iy++)
for (int iz = 0; iz < clpMZ + 1; iz++)
for (u32 ix = 0; ix < clpMX + 1; ix++)
for (u32 iy = 0; iy < clpMY + 1; iy++)
for (u32 iz = 0; iz < clpMZ + 1; iz++)
VM[ix][iy][iz].reserve(_average);
}

Expand Down
8 changes: 4 additions & 4 deletions src/xrCore/FixedVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class svector

public:
svector() : count(0) {}
svector(iterator p, int c) { assign(p, c); }
svector(iterator p, size_t c) { assign(p, c); }
IC iterator begin() { return array; }
IC iterator end() { return array + count; }
IC const_iterator begin() const { return array; }
Expand All @@ -30,13 +30,13 @@ class svector
IC u32 size() const { return count; }
IC void clear() { count = 0; }

IC void resize(int c)
IC void resize(size_t c)
{
VERIFY(c <= dim);
count = c;
}

IC void reserve(int c) {}
IC void reserve(size_t c) {}

IC void push_back(value_type e)
{
Expand Down Expand Up @@ -98,7 +98,7 @@ class svector
count++;
array[id] = V;
}
IC void assign(const_iterator p, int c)
IC void assign(const_iterator p, size_t c)
{
VERIFY(c > 0 && c <= dim);
CopyMemory(array, p, c * sizeof(value_type));
Expand Down
8 changes: 4 additions & 4 deletions src/xrCore/Media/Image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ void Image::SaveTGA(TWriter& writerFunc, ImageDataFormat format, bool align)
writerFunc(&hdr, sizeof(hdr));
int paddingBuf = 0;
int paddingSize = align ? 4 - (width * 3 & 3) : 0;
for (int j = 0; j < height; j++)
for (u32 j = 0; j < height; j++)
{
u8* p = (u8*)data + scanLength * j;
for (int i = 0; i < width; i++)
for (u32 i = 0; i < width; i++)
{
u8 buffer[3] = {p[0], p[1], p[2]};
writerFunc(buffer, sizeof(buffer));
Expand All @@ -76,10 +76,10 @@ void Image::SaveTGA(TWriter& writerFunc, ImageDataFormat format, bool align)
writerFunc(data, width * height * channelCount);
else
{
for (int j = 0; j < height; j++)
for (u32 j = 0; j < height; j++)
{
u8* p = (u8*)data + scanLength * j;
for (int i = 0; i < width; i++)
for (u32 i = 0; i < width; i++)
{
u8 buffer[4] = {p[0], p[1], p[2], 0xff};
writerFunc(buffer, sizeof(buffer));
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/xrServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ void xrServer::Server_Client_Check(IClient* CL)
return;
};

if (CL->process_id == GetCurrentProcessId())
if (static_cast<int>(CL->process_id) == GetCurrentProcessId())
{
CL->flags.bLocal = 1;
SV_Client = (xrClientData*)CL;
Expand Down
Loading
Loading