Skip to content

Commit

Permalink
Replace POSIX function names with ISO C++ conformant underscore-prepe…
Browse files Browse the repository at this point in the history
…nded names (strupr, strlwr, stricmp, strcmpi, unlink, itoa).
  • Loading branch information
tamlin-mike authored and Xottab-DUTY committed Aug 5, 2017
1 parent 3ea5183 commit 82bfa36
Show file tree
Hide file tree
Showing 132 changed files with 297 additions and 297 deletions.
2 changes: 1 addition & 1 deletion src/Layers/xrRender/Blender_Recorder_R2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void CBlender_Compile::r_Pass(LPCSTR _vs, LPCSTR _ps, bool bFog, BOOL bZtest, BO
ctable.merge(&vs->constants);

// Last Stage - disable
if (0 == stricmp(_ps, "null"))
if (0 == _stricmp(_ps, "null"))
{
RS.SetTSS(0, D3DTSS_COLOROP, D3DTOP_DISABLE);
RS.SetTSS(0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/FHierrarhyVisual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void FHierrarhyVisual::Load(const char* N, IReader* data, u32 dwFlags)
xr_strcpy(short_name, N);
if (strext(short_name))
*strext(short_name) = 0;
strconcat(sizeof(name_load), name_load, short_name, ":", itoa(count, num, 10));
strconcat(sizeof(name_load), name_load, short_name, ":", _itoa(count, num, 10));
children.push_back((dxRender_Visual*)GlobalEnv.Render->model_CreateChild(name_load, O));
O->close();
O = OBJ->open_chunk(count);
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/HW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ struct _uniq_mode
{
_uniq_mode(LPCSTR v) : _val(v) {}
LPCSTR _val;
bool operator()(LPCSTR _other) { return !stricmp(_val, _other); }
bool operator()(LPCSTR _other) { return !_stricmp(_val, _other); }
};

#ifndef _EDITOR
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRender/ModelPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ dxRender_Visual* CModelPool::Create(const char* name, IReader* data)
string_path low_name;
VERIFY(xr_strlen(name) < sizeof(low_name));
xr_strcpy(low_name, name);
strlwr(low_name);
_strlwr(low_name);
if (strext(low_name))
*strext(low_name) = 0;
// Msg ("-CREATE %s",low_name);
Expand Down Expand Up @@ -266,7 +266,7 @@ dxRender_Visual* CModelPool::CreateChild(LPCSTR name, IReader* data)
string256 low_name;
VERIFY(xr_strlen(name) < 256);
xr_strcpy(low_name, name);
strlwr(low_name);
_strlwr(low_name);
if (strext(low_name))
*strext(low_name) = 0;

Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRender/PSLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ bool CPSLibrary::Load2()
#endif

xr_sprintf(_path, sizeof(_path), "%s%s", p_path, p_name);
if (0 == stricmp(p_ext, ".pe"))
if (0 == _stricmp(p_ext, ".pe"))
{
PS::CPEDef* def = new PS::CPEDef();
def->m_Name = _path;
Expand All @@ -164,7 +164,7 @@ bool CPSLibrary::Load2()
else
xr_delete(def);
}
else if (0 == stricmp(p_ext, ".pg"))
else if (0 == _stricmp(p_ext, ".pg"))
{
PS::CPGDef* def = new PS::CPGDef();
def->m_Name = _path;
Expand Down
14 changes: 7 additions & 7 deletions src/Layers/xrRender/ResourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ void fix_texture_name(LPSTR fn);
void fix_texture_name(LPSTR fn)
{
LPSTR _ext = strext(fn);
if( _ext &&
(0==stricmp(_ext,".tga") ||
0==stricmp(_ext,".dds") ||
0==stricmp(_ext,".bmp") ||
0==stricmp(_ext,".ogm") ) )
if (_ext &&
(0==_stricmp(_ext, ".tga") ||
0==_stricmp(_ext, ".dds") ||
0==_stricmp(_ext, ".bmp") ||
0==_stricmp(_ext, ".ogm")))
*_ext = 0;
}
*/
Expand Down Expand Up @@ -120,7 +120,7 @@ void CResourceManager::_ParseList(sh_list& dest, LPCSTR names)
{
// flush
N.push_back(0);
strlwr(N.begin());
_strlwr(N.begin());

fix_texture_name(N.begin());
//. andy if (strext(N.begin())) *strext(N.begin())=0;
Expand All @@ -137,7 +137,7 @@ void CResourceManager::_ParseList(sh_list& dest, LPCSTR names)
{
// flush
N.push_back(0);
strlwr(N.begin());
_strlwr(N.begin());

fix_texture_name(N.begin());
//. andy if (strext(N.begin())) *strext(N.begin())=0;
Expand Down
12 changes: 6 additions & 6 deletions src/Layers/xrRender/ResourceManager_Resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ SVS* CResourceManager::_CreateVS(LPCSTR _name)
SVS* _vs = new SVS();
_vs->dwFlags |= xr_resource_flagged::RF_REGISTERED;
m_vs.insert(std::make_pair(_vs->set_name(name), _vs));
if (0 == stricmp(_name, "null"))
if (0 == _stricmp(_name, "null"))
{
_vs->vs = NULL;
return _vs;
Expand Down Expand Up @@ -266,7 +266,7 @@ SPS* CResourceManager::_CreatePS(LPCSTR name)
SPS* _ps = new SPS();
_ps->dwFlags |= xr_resource_flagged::RF_REGISTERED;
m_ps.insert(std::make_pair(_ps->set_name(name), _ps));
if (0 == stricmp(name, "null"))
if (0 == _stricmp(name, "null"))
{
_ps->ps = NULL;
return _ps;
Expand Down Expand Up @@ -558,7 +558,7 @@ void CResourceManager::DBG_VerifyTextures()
CMatrix* CResourceManager::_CreateMatrix(LPCSTR Name)
{
R_ASSERT(Name && Name[0]);
if (0 == stricmp(Name, "$null"))
if (0 == _stricmp(Name, "$null"))
return NULL;

LPSTR N = LPSTR(Name);
Expand Down Expand Up @@ -596,7 +596,7 @@ void CResourceManager::ED_UpdateMatrix(LPCSTR Name, CMatrix* data)
CConstant* CResourceManager::_CreateConstant(LPCSTR Name)
{
R_ASSERT(Name && Name[0]);
if (0 == stricmp(Name, "$null"))
if (0 == _stricmp(Name, "$null"))
return NULL;

LPSTR N = LPSTR(Name);
Expand Down Expand Up @@ -784,7 +784,7 @@ SVS* CResourceManager::_CreateVS(LPCSTR _name)
SVS* _vs = new SVS();
_vs->dwFlags |= xr_resource_flagged::RF_REGISTERED;
m_vs.insert(mk_pair(_vs->set_name(name), _vs));
if (0 == stricmp(_name, "null"))
if (0 == _stricmp(_name, "null"))
{
_vs->vs = NULL;
return _vs;
Expand Down Expand Up @@ -906,7 +906,7 @@ SPS* CResourceManager::_CreatePS(LPCSTR name)
SPS* _ps = new SPS();
_ps->dwFlags |= xr_resource_flagged::RF_REGISTERED;
m_ps.insert(mk_pair(_ps->set_name(name), _ps));
if (0 == stricmp(name, "null"))
if (0 == _stricmp(name, "null"))
{
_ps->ps = NULL;
return _ps;
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRender/SH_Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void CTexture::Load()

flags.bUser = false;
flags.MemoryUsage = 0;
if (0 == stricmp(*cName, "$null"))
if (0 == _stricmp(*cName, "$null"))
return;
if (0 != strstr(*cName, "$user$"))
{
Expand Down Expand Up @@ -245,7 +245,7 @@ void CTexture::Load()

flags.seqCycles = FALSE;
_fs->r_string(buffer, sizeof(buffer));
if (0 == stricmp(buffer, "cycled"))
if (0 == _stricmp(buffer, "cycled"))
{
flags.seqCycles = TRUE;
_fs->r_string(buffer, sizeof(buffer));
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/ShaderResourceTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ inline T* CResourceManager::CreateShader(const char* name)

sh->dwFlags |= xr_resource_flagged::RF_REGISTERED;
sh_map.insert(std::make_pair(sh->set_name(name), sh));
if (0 == stricmp(name, "null"))
if (0 == _stricmp(name, "null"))
{
sh->sh = NULL;
return sh;
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/SkeletonAnimated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ u16 CKinematicsAnimated::LL_PartID(LPCSTR B)
CPartDef& P = (*m_Partition)[id];
if (0 == P.Name)
continue;
if (0 == stricmp(B, *P.Name))
if (0 == _stricmp(B, *P.Name))
return id;
}
return BI_NONE;
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRender/SkeletonCustom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ void CKinematics::Load(const char* N, IReader* data, u32 dwFlags)
// Bone
u16 ID = u16(bones->size());
data->r_stringZ(buf, sizeof(buf));
strlwr(buf);
_strlwr(buf);
CBoneData* pBone = CreateBoneData(ID);
pBone->name = shared_str(buf);
pBone->child_faces.resize(children.size());
Expand All @@ -247,7 +247,7 @@ void CKinematics::Load(const char* N, IReader* data, u32 dwFlags)

// It's parent
data->r_stringZ(buf, sizeof(buf));
strlwr(buf);
_strlwr(buf);
L_parents.push_back(buf);

data->r(&pBone->obb, sizeof(Fobb));
Expand Down
8 changes: 4 additions & 4 deletions src/Layers/xrRender/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
void fix_texture_name(LPSTR fn)
{
LPSTR _ext = strext(fn);
if (_ext && (!stricmp(_ext, ".tga") || !stricmp(_ext, ".dds") ||
!stricmp(_ext, ".bmp") || !stricmp(_ext, ".ogm")))
if (_ext && (!_stricmp(_ext, ".tga") || !_stricmp(_ext, ".dds") ||
!_stricmp(_ext, ".bmp") || !_stricmp(_ext, ".ogm")))
{
*_ext = 0;
}
Expand Down Expand Up @@ -367,7 +367,7 @@ ID3DBaseTexture* CRender::texture_load(LPCSTR fRName, u32& ret_msize)
}
_DDS_2D:
{
strlwr(fn);
_strlwr(fn);
// Load SYS-MEM-surface, bound to device restrictions
ID3DTexture2D* T_sysmem;
HRESULT const result =
Expand All @@ -380,7 +380,7 @@ ID3DBaseTexture* CRender::texture_load(LPCSTR fRName, u32& ret_msize)
Msg("! Can't load texture '%s'", fn);
string_path temp;
R_ASSERT(FS.exist(temp, "$game_textures$", "ed\\ed_not_existing_texture", ".dds"));
strlwr(temp);
_strlwr(temp);
R_ASSERT(xr_strcmp(temp, fn));
xr_strcpy(fn, temp);
goto _DDS;
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRender/TextureDescrManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class cl_dt_scaler : public R_constant_setup
void fix_texture_thm_name(LPSTR fn)
{
LPSTR _ext = strext(fn);
if (_ext && (!stricmp(_ext, ".tga") || !stricmp(_ext, ".thm") || !stricmp(_ext, ".dds") ||
!stricmp(_ext, ".bmp") || !stricmp(_ext, ".ogm")))
if (_ext && (!_stricmp(_ext, ".tga") || !_stricmp(_ext, ".thm") || !_stricmp(_ext, ".dds") ||
!_stricmp(_ext, ".bmp") || !_stricmp(_ext, ".ogm")))
{
*_ext = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/blenders/Blender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void CBlender_DESC::Setup(LPCSTR N)
VERIFY(xr_strlen(N) < 128);
VERIFY(0 == strchr(N, '.'));
xr_strcpy(cName, N);
strlwr(cName);
_strlwr(cName);

xr_strcpy(cComputer, Core.CompName); // Computer
#ifndef _EDITOR
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/blenders/Blender_Palette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

//////////////////////////////////////////////////////////////////////
#include "blender_clsid.h"
IC bool p_sort(IBlender* A, IBlender* B) { return stricmp(A->getComment(), B->getComment()) < 0; }
IC bool p_sort(IBlender* A, IBlender* B) { return _stricmp(A->getComment(), B->getComment()) < 0; }
#ifdef __BORLANDC__
#define TYPES_EQUAL(A, B) (typeid(A) == typeid(B))
#else
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRender/blenders/Blender_Recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@ void CBlender_Compile::PassEnd()
void CBlender_Compile::PassSET_PS(LPCSTR name)
{
xr_strcpy(pass_ps, name);
strlwr(pass_ps);
_strlwr(pass_ps);
}

void CBlender_Compile::PassSET_VS(LPCSTR name)
{
xr_strcpy(pass_vs, name);
strlwr(pass_vs);
_strlwr(pass_vs);
}

void CBlender_Compile::PassSET_ZB(BOOL bZTest, BOOL bZWrite, BOOL bInvertZTest)
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRenderDX10/Blender_Recorder_R3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void CBlender_Compile::r_Pass(LPCSTR _vs, LPCSTR _gs, LPCSTR _ps, bool bFog, BOO
ctable.merge(&gs->constants);

// Last Stage - disable
if (0 == stricmp(_ps, "null"))
if (0 == _stricmp(_ps, "null"))
{
RS.SetTSS(0, D3DTSS_COLOROP, D3DTOP_DISABLE);
RS.SetTSS(0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRenderDX10/dx10HW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ struct _uniq_mode
{
_uniq_mode(LPCSTR v) : _val(v) {}
LPCSTR _val;
bool operator()(LPCSTR _other) { return !stricmp(_val, _other); }
bool operator()(LPCSTR _other) { return !_stricmp(_val, _other); }
};

#ifndef _EDITOR
Expand Down
10 changes: 5 additions & 5 deletions src/Layers/xrRenderDX10/dx10ResourceManager_Resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ SVS* CResourceManager::_CreateVS(LPCSTR _name)
m_vs.insert(std::make_pair(_vs->set_name(name), _vs));
//_vs->vs = NULL;
//_vs->signature = NULL;
if (0 == stricmp(_name, "null"))
if (0 == _stricmp(_name, "null"))
{
return _vs;
}
Expand Down Expand Up @@ -265,7 +265,7 @@ SPS* CResourceManager::_CreatePS(LPCSTR _name)
SPS* _ps = new SPS();
_ps->dwFlags |= xr_resource_flagged::RF_REGISTERED;
m_ps.insert(std::make_pair(_ps->set_name(name), _ps));
if (0 == stricmp(_name, "null"))
if (0 == _stricmp(_name, "null"))
{
_ps->ps = NULL;
return _ps;
Expand Down Expand Up @@ -370,7 +370,7 @@ SGS* CResourceManager::_CreateGS(LPCSTR name)
SGS* _gs = new SGS();
_gs->dwFlags |= xr_resource_flagged::RF_REGISTERED;
m_gs.insert(std::make_pair(_gs->set_name(name), _gs));
if (0 == stricmp(name, "null"))
if (0 == _stricmp(name, "null"))
{
_gs->gs = NULL;
return _gs;
Expand Down Expand Up @@ -687,7 +687,7 @@ void CResourceManager::DBG_VerifyTextures()
CMatrix* CResourceManager::_CreateMatrix(LPCSTR Name)
{
R_ASSERT(Name && Name[0]);
if (0 == stricmp(Name, "$null"))
if (0 == _stricmp(Name, "$null"))
return NULL;

LPSTR N = LPSTR(Name);
Expand Down Expand Up @@ -725,7 +725,7 @@ void CResourceManager::ED_UpdateMatrix(LPCSTR Name, CMatrix* data)
CConstant* CResourceManager::_CreateConstant(LPCSTR Name)
{
R_ASSERT(Name && Name[0]);
if (0 == stricmp(Name, "$null"))
if (0 == _stricmp(Name, "$null"))
return NULL;

LPSTR N = LPSTR(Name);
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRenderDX10/dx10SH_Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ void CTexture::Load()

flags.bUser = false;
flags.MemoryUsage = 0;
if (0 == stricmp(*cName, "$null"))
if (0 == _stricmp(*cName, "$null"))
return;
if (0 != strstr(*cName, "$user$"))
{
Expand Down Expand Up @@ -498,7 +498,7 @@ void CTexture::Load()

flags.seqCycles = FALSE;
_fs->r_string(buffer, sizeof(buffer));
if (0 == stricmp(buffer, "cycled"))
if (0 == _stricmp(buffer, "cycled"))
{
flags.seqCycles = TRUE;
_fs->r_string(buffer, sizeof(buffer));
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRenderDX10/dx10Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
void fix_texture_name(LPSTR fn)
{
LPSTR _ext = strext(fn);
if (_ext && (!stricmp(_ext, ".tga") || !stricmp(_ext, ".dds") || !stricmp(_ext, ".bmp") ||
!stricmp(_ext, ".ogm")))
if (_ext && (!_stricmp(_ext, ".tga") || !_stricmp(_ext, ".dds") || !_stricmp(_ext, ".bmp") ||
!_stricmp(_ext, ".ogm")))
{
*_ext = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRenderPC_R1/Blender_LaEmB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void CBlender_LaEmB::Compile(CBlender_Compile& C)
{
IBlender::Compile(C);

BOOL bConstant = (0 != stricmp(oT2_const, "$null"));
BOOL bConstant = (0 != _stricmp(oT2_const, "$null"));
if (C.bEditor)
{
if (bConstant)
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRenderPC_R4/CSCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void CSCompiler::end()

void CSCompiler::compile(const char* name)
{
if (0 == stricmp(name, "null"))
if (0 == _stricmp(name, "null"))
{
m_cs = 0;
return;
Expand Down
2 changes: 1 addition & 1 deletion src/editors/ActorEditor/BonePart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ void __fastcall TfrmBonePart::ebLoadFromClick(TObject* Sender)
CInifile::SectCIt e = S.Data.end();
for (; it != e; ++it)
{
if (0 != stricmp(it->first.c_str(), "partition_name"))
if (0 != _stricmp(it->first.c_str(), "partition_name"))
{
FHelper.AppendObject(T[i], it->first.c_str(), false, true);
}
Expand Down
Loading

0 comments on commit 82bfa36

Please sign in to comment.