Skip to content

Commit

Permalink
Code conformance improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Jan 28, 2018
1 parent c099b90 commit 7c99022
Show file tree
Hide file tree
Showing 226 changed files with 2,471 additions and 2,506 deletions.
2 changes: 1 addition & 1 deletion Externals/ode/include/ode/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dReal dRandReal();

/* print out a matrix */
#ifdef __cplusplus
void dPrintMatrix (const dReal *A, int n, int m, char *fmt = "%10.4f ",
void dPrintMatrix (const dReal *A, int n, int m, const char *fmt = "%10.4f ",
FILE *f=stdout);
#else
void dPrintMatrix (const dReal *A, int n, int m, char *fmt, FILE *f);
Expand Down
2 changes: 1 addition & 1 deletion Externals/ode/ode/src/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ dReal dRandReal()
//****************************************************************************
// matrix utility stuff

void dPrintMatrix (const dReal *A, int n, int m, char *fmt, FILE *f)
void dPrintMatrix (const dReal *A, int n, int m, const char *fmt, FILE *f)
{
int i,j;
int skip = dPAD(m);
Expand Down
4 changes: 2 additions & 2 deletions src/Common/object_comparer.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ struct CComparer
if (v1.size() != v2.size())
return p();

svector<T, size>::const_iterator I = v1.begin(), J = v2.begin();
svector<T, size>::const_iterator E = v1.end();
auto I = v1.cbegin(), J = v2.cbegin();
auto E = v1.end();
for (; I != E; ++I, ++J)
if (!compare(*I, *J, p))
return false;
Expand Down
16 changes: 8 additions & 8 deletions src/Common/object_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct CLoader
template <>
static void load_data<true>(T& data, M& stream, const P& p)
{
CLoader<M, P>::load_data(*(data = new object_type_traits::remove_pointer<T>::type()), stream, p);
CLoader<M, P>::load_data(*(data = new typename object_type_traits::remove_pointer<T>::type()), stream, p);
}
};

Expand Down Expand Up @@ -101,7 +101,7 @@ struct CLoader
const u32 count = stream.r_u32();
for (u32 i = 0; i < count; ++i)
{
T::value_type temp;
typename T::value_type temp;
CLoader<M, P>::load_data(temp, stream, p);
if (p(data, temp))
add(data, temp);
Expand Down Expand Up @@ -144,11 +144,11 @@ struct CLoader
template <typename T1, typename T2>
static void load_data(std::pair<T1, T2>& data, M& stream, const P& p)
{
if (p(data, const_cast<object_type_traits::remove_const<T1>::type&>(data.first), true))
if (p(data, const_cast<typename object_type_traits::remove_const<T1>::type&>(data.first), true))
{
const bool value = object_type_traits::is_same<T1, LPCSTR>::value;
VERIFY(!value);
load_data(const_cast<object_type_traits::remove_const<T1>::type&>(data.first), stream, p);
load_data(const_cast<typename object_type_traits::remove_const<T1>::type&>(data.first), stream, p);
}
if (p(data, data.second, false))
load_data(data.second, stream, p);
Expand Down Expand Up @@ -183,7 +183,7 @@ struct CLoader
const u32 count = stream.r_u32();
for (u32 i = 0; i < count; ++i)
{
svector<T, size>::value_type temp;
typename svector<T, size>::value_type temp;
CLoader<M, P>::load_data(temp, stream, p);
if (p(data, temp))
data.push_back(temp);
Expand All @@ -202,7 +202,7 @@ struct CLoader
const u32 count = stream.r_u32();
for (u32 i = 0; i < count; ++i)
{
std::queue<T1, T2>::value_type t;
typename std::queue<T1, T2>::value_type t;
CLoader<M, P>::load_data(t, stream, p);
if (p(temp, t))
temp.push(t);
Expand All @@ -223,7 +223,7 @@ struct CLoader
const u32 count = stream.r_u32();
for (u32 i = 0; i < count; ++i)
{
T1<T2, T3>::value_type t;
typename T1<T2, T3>::value_type t;
CLoader<M, P>::load_data(t, stream, p);
if (p(temp, t))
temp.push(t);
Expand All @@ -244,7 +244,7 @@ struct CLoader
u32 count = stream.r_u32();
for (u32 i = 0; i < count; ++i)
{
T1<T2, T3, T4>::value_type t;
typename T1<T2, T3, T4>::value_type t;
CLoader<M, P>::load_data(t, stream, p);
if (p(temp, t))
temp.push(t);
Expand Down
8 changes: 4 additions & 4 deletions src/Common/object_saver.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ struct CSaver
IC static void save_data(const xr_vector<bool>& data, M& stream, const P& /*p*/)
{
stream.w_u32((u32)data.size());
xr_vector<bool>::const_iterator I = data.begin();
xr_vector<bool>::const_iterator E = data.end();
auto I = data.cbegin();
auto E = data.cend();
u32 mask = 0;
if (I != E)
{
Expand All @@ -116,8 +116,8 @@ struct CSaver
IC static void save_data(const svector<T, size>& data, M& stream, const P& p)
{
stream.w_u32((u32)data.size());
svector<T, size>::const_iterator I = data.begin();
svector<T, size>::const_iterator E = data.end();
auto I = data.cbegin();
auto E = data.cend();
for (; I != E; ++I)
if (p(data, *I))
CSaver<M, P>::save_data(*I, stream, p);
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/ColorMapManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ColorMapManager
private:
void UpdateTexture(const shared_str& strTexName, int iTex);

struct str_pred : public std::binary_function<const shared_str&, const shared_str&, bool>
struct str_pred
{
bool operator()(const shared_str& x, const shared_str& y) const { return x < y; }
};
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/ModelPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ECORE_API CModelPool
{
friend class CRender;

struct str_pred : public std::binary_function<const shared_str&, const shared_str&, bool>
struct str_pred
{
bool operator()(const shared_str& x, const shared_str& y) const { return xr_strcmp(x, y) < 0; }
};
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/ParticleGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ void OnGroupParticleDead(void* owner, u32 param, PAPI::Particle& m, u32 idx)
PG->items[param].StartFreeChild(PE, *eff->m_OnDeadChildName, m);
}
//------------------------------------------------------------------------------
struct zero_vis_pred : public std::unary_function<dxRender_Visual*, bool>
struct zero_vis_pred
{
bool operator()(const dxRender_Visual* x) { return x == nullptr; }
};
Expand Down
6 changes: 3 additions & 3 deletions src/Layers/xrRender/ResourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ void fix_texture_name(LPSTR fn)
template <class T>
bool reclaim(xr_vector<T*>& vec, const T* ptr)
{
xr_vector<T*>::iterator it = vec.begin();
xr_vector<T*>::iterator end = vec.end();
for (; it != end; it++)
auto it = vec.begin();
auto end = vec.end();
for (; it != end; ++it)
if (*it == ptr)
{
vec.erase(it);
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/ResourceManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class dx10ConstantBuffer;
class ECORE_API CResourceManager
{
private:
struct str_pred : public std::binary_function<char*, char*, bool>
struct str_pred
{
bool operator()(LPCSTR x, LPCSTR y) const { return xr_strcmp(x, y) < 0; }
};
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/ResourceManager_Reset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void mdump(C c)
{
if (0 == c.size())
return;
for (C::iterator I = c.begin(); I != c.end(); I++)
for (auto I = c.begin(); I != c.end(); I++)
Msg("* : %3d: %s", I->second->dwReference, I->second->cName.c_str());
}

Expand Down
6 changes: 3 additions & 3 deletions src/Layers/xrRender/ResourceManager_Resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ void simplify_texture(string_path& fn)
template <class T>
BOOL reclaim(xr_vector<T*>& vec, const T* ptr)
{
xr_vector<T*>::iterator it = vec.begin();
xr_vector<T*>::iterator end = vec.end();
for (; it != end; it++)
auto it = vec.begin();
auto end = vec.end();
for (; it != end; ++it)
if (*it == ptr)
{
vec.erase(it);
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRender/ResourceManager_Scripting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@ ShaderElement* CBlender_Compile::_lua_Compile(LPCSTR namesp, LPCSTR name)
LPCSTR t_0 = *L_textures[0] ? *L_textures[0] : "null";
LPCSTR t_1 = (L_textures.size() > 1) ? *L_textures[1] : "null";
LPCSTR t_d = detail_texture ? detail_texture : "null";
object shader = RImplementation.Resources->ScriptEngine.name_space(namesp);
functor<void> element = shader[name];
const object shader = RImplementation.Resources->ScriptEngine.name_space(namesp);
const functor<void> element = (object)shader[name];
adopt_compiler ac = adopt_compiler(this);
element(ac, t_0, t_1, t_d);
r_End();
Expand Down
3 changes: 1 addition & 2 deletions src/Layers/xrRender/SkeletonAnimated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -837,10 +837,9 @@ void CKinematicsAnimated::LL_BuldBoneMatrixDequatize(const CBoneData* bd, u8 cha
{
u16 SelfID = bd->GetSelfID();
CBlendInstance& BLEND_INST = LL_GetBlendInstance(SelfID);
const CBlendInstance::BlendSVec& Blend = BLEND_INST.blend_vector();
CKey BK[MAX_CHANNELS][MAX_BLENDED]; // base keys

for (auto &it : Blend)
for (auto &it : BLEND_INST.blend_vector())
{
CBlend* B = it;
int& b_count = keys.chanel_blend_conts[B->channel];
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/SkeletonCustom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ void CKinematics::AddWallmark(
wallmarks.push_back(wm);
}

struct zero_wm_pred : public std::unary_function<intrusive_ptr<CSkeletonWallmark>, bool>
struct zero_wm_pred
{
bool operator()(const intrusive_ptr<CSkeletonWallmark> x) { return x == nullptr; }
};
Expand Down
5 changes: 3 additions & 2 deletions src/Layers/xrRender/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ IC u32 it_height_rev_base(u32 d, u32 s)

ID3DBaseTexture* CRender::texture_load(LPCSTR fRName, u32& ret_msize)
{
HRESULT result;
ID3DTexture2D* pTexture2D = nullptr;
IDirect3DCubeTexture9* pTextureCUBE = nullptr;
string_path fn;
Expand Down Expand Up @@ -323,7 +324,7 @@ ID3DBaseTexture* CRender::texture_load(LPCSTR fRName, u32& ret_msize)
#endif // DEBUG
img_size = S->length();
R_ASSERT(S);
HRESULT const result = D3DXGetImageInfoFromFileInMemory(S->pointer(), S->length(), &IMG);
result = D3DXGetImageInfoFromFileInMemory(S->pointer(), S->length(), &IMG);
if (FAILED(result))
{
Msg("! Can't get image info for texture '%s'", fn);
Expand All @@ -342,7 +343,7 @@ ID3DBaseTexture* CRender::texture_load(LPCSTR fRName, u32& ret_msize)

_DDS_CUBE:
{
HRESULT const result = D3DXCreateCubeTextureFromFileInMemoryEx(HW.pDevice, S->pointer(), S->length(), D3DX_DEFAULT,
result = D3DXCreateCubeTextureFromFileInMemoryEx(HW.pDevice, S->pointer(), S->length(), D3DX_DEFAULT,
IMG.MipLevels, 0, IMG.Format, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, &IMG, nullptr, &pTextureCUBE);
FS.r_close(S);

Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRenderDX10/dx10ResourceManager_Resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ void fix_texture_name(LPSTR fn);
template <class T>
BOOL reclaim(xr_vector<T*>& vec, const T* ptr)
{
xr_vector<T*>::iterator it = vec.begin();
xr_vector<T*>::iterator end = vec.end();
auto it = vec.begin();
auto end = vec.end();
for (; it != end; it++)
if (*it == ptr)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRenderDX10/dx10ResourceManager_Scripting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ ShaderElement* CBlender_Compile::_lua_Compile(LPCSTR namesp, LPCSTR name)
LPCSTR t_0 = *L_textures[0] ? *L_textures[0] : "null";
LPCSTR t_1 = (L_textures.size() > 1) ? *L_textures[1] : "null";
LPCSTR t_d = detail_texture ? detail_texture : "null";
object shader = RImplementation.Resources->ScriptEngine.name_space(namesp);
functor<void> element = shader[name];
const object shader = RImplementation.Resources->ScriptEngine.name_space(namesp);
const functor<void> element = (object)shader[name];
bool bFirstPass = false;
adopt_compiler ac = adopt_compiler(this, bFirstPass);
element(ac, t_0, t_1, t_d);
Expand Down
4 changes: 2 additions & 2 deletions src/utils/xrLC/xrFlex2OGF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ void Face2OGF_Vertices(const Face& FF, OGF_Vertex V[3])
}

// Normal order
svector<_TCF, 2>::const_iterator TC = FF.tc.begin();
for (; TC != FF.tc.end(); TC++)
svector<_TCF, 2>::const_iterator TC = FF.tc.cbegin();
for (; TC != FF.tc.cend(); TC++)
{
V[0].UV.push_back(TC->uv[0]);
V[1].UV.push_back(TC->uv[1]);
Expand Down
14 changes: 7 additions & 7 deletions src/utils/xrLC_Light/serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void r_vector(INetReader& r, xr_vector<T>& v)
{
u32 cnt = r.r_u32();
v.resize(cnt);
xr_vector<T>::iterator i = v.begin(), e = v.end();
typename xr_vector<T>::iterator i = v.begin(), e = v.end();
for (; i != e; ++i)
i->read(r);
}
Expand All @@ -46,7 +46,7 @@ void w_vector(IWriter& w, const xr_vector<T>& v)
{
u32 cnt = v.size();
w.w_u32(cnt);
xr_vector<T>::const_iterator i = v.begin(), e = v.end();
typename xr_vector<T>::const_iterator i = v.cbegin(), e = v.cend();
for (; i != e; ++i)
i->write(w);
}
Expand Down Expand Up @@ -76,7 +76,7 @@ void r_vector(INetReader& r, svector<T, dim>& v)
{
u32 cnt = r.r_u32();
v.resize(cnt);
svector<T, dim>::iterator i = v.begin(), e = v.end();
typename svector<T, dim>::iterator i = v.begin(), e = v.end();
for (; i != e; ++i)
i->read(r);
}
Expand All @@ -86,7 +86,7 @@ void w_vector(IWriter& w, const svector<T, dim>& v)
{
u32 cnt = v.size();
w.w_u32(cnt);
svector<T, dim>::const_iterator i = v.begin(), e = v.end();
typename svector<T, dim>::const_iterator i = v.cbegin(), e = v.cend();
for (; i != e; ++i)
i->write(w);
}
Expand All @@ -104,7 +104,7 @@ class get_id_standart
{
if (f == 0)
return id_none;
xr_vector<type*>::const_iterator F = std::find(vec.begin(), vec.end(), f);
const auto F = std::find(vec.cbegin(), vec.cend(), f);
VERIFY(F != vec.end());
return u32(F - vec.begin());
}
Expand Down Expand Up @@ -149,8 +149,8 @@ class t_write

void write(IWriter& w) const
{
xr_vector<T *>::const_iterator i = vec.begin(), e = vec.end();
w.w_u32(vec.size());
typename xr_vector<T *>::const_iterator i = vec.cbegin(), e = vec.cend();
for (; i != e; ++i)
(*i)->write(w);
}
Expand All @@ -165,7 +165,7 @@ class t_write
void write_ref(IWriter& w, const xr_vector<T*>& ref_vec) const
{
w.w_u32(ref_vec.size());
xr_vector<T *>::const_iterator i = ref_vec.begin(), e = ref_vec.end();
typename xr_vector<T *>::const_iterator i = ref_vec.cbegin(), e = ref_vec.cend();
for (; i != e; ++i)
write(w, *i);
}
Expand Down
14 changes: 7 additions & 7 deletions src/xrAICore/Navigation/PathManagers/path_manager_game_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,36 @@ IC void CGamePathManager::setup(const _Graph* _graph, _DataStorage* _data_storag
const _index_type& _start_node_index, const _index_type& _goal_node_index, const _Parameters& parameters)
{
inherited::setup(_graph, _data_storage, _path, _start_node_index, _goal_node_index, parameters);
goal_vertex = graph->vertex(goal_node_index);
goal_vertex = this->graph->vertex(this->goal_node_index);
}

TEMPLATE_SPECIALIZATION
IC _dist_type CGamePathManager::evaluate(const _index_type& /*node_index1*/, const _index_type& /*node_index2*/,
const _Graph::const_iterator& i) const
{
VERIFY(graph);
VERIFY(this->graph);
return (*i).distance();
}

TEMPLATE_SPECIALIZATION
IC _dist_type CGamePathManager::estimate(const _index_type& node_index) const
{
VERIFY(graph);
return goal_vertex->game_point().distance_to(graph->vertex(node_index)->game_point());
VERIFY(this->graph);
return goal_vertex->game_point().distance_to(this->graph->vertex(node_index)->game_point());
}

TEMPLATE_SPECIALIZATION
IC bool CGamePathManager::is_limit_reached(const _iteration_type /*iteration_count*/) const
{
VERIFY(data_storage);
VERIFY(this->data_storage);
return false;
}

TEMPLATE_SPECIALIZATION
IC bool CGamePathManager::is_accessible(const _index_type& vertex_id) const
{
VERIFY(graph);
return graph->accessible(vertex_id);
VERIFY(this->graph);
return this->graph->accessible(vertex_id);
}

#undef TEMPLATE_SPECIALIZATION
Expand Down
Loading

0 comments on commit 7c99022

Please sign in to comment.