Skip to content

Commit

Permalink
refactor: remove most -Wconversion-null warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleivg committed Nov 6, 2018
1 parent cdfd42f commit aad51bf
Show file tree
Hide file tree
Showing 21 changed files with 50 additions and 50 deletions.
4 changes: 2 additions & 2 deletions src/Layers/xrRender/ShaderResourceTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ inline T* CResourceManager::CreateShader(const char* name, const char* filename
sh_map.insert(std::make_pair(sh->set_name(name), sh));
if (0 == xr_stricmp(name, "null"))
{
sh->sh = NULL;
sh->sh = 0;
return sh;
}

Expand Down Expand Up @@ -408,7 +408,7 @@ inline T* CResourceManager::CreateShader(const char* name, const char* filename
ShaderTypeTraits<T>::GetCompilationTarget(c_target, c_entry, data);

#ifdef USE_OGL
DWORD flags = NULL;
DWORD flags = 0;
#elif defined(USE_DX10) || defined(USE_DX11)
DWORD flags = D3D10_SHADER_PACK_MATRIX_ROW_MAJOR;
#else
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRenderGL/glSH_Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ void resptrcode_texture::create(LPCSTR _name)
//////////////////////////////////////////////////////////////////////
CTexture::CTexture()
{
pSurface = NULL;
pBuffer = NULL;
pSurface = 0;
pBuffer = 0;
pAVI = nullptr;
pTheora = nullptr;
desc = GL_TEXTURE_2D;
Expand Down
6 changes: 3 additions & 3 deletions src/Layers/xrRenderPC_GL/glResourceManager_Resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ SVS* CResourceManager::_CreateVS(LPCSTR _name)
// Select target
_vs->sh = glCreateShader(GL_VERTEX_SHADER);
void* _result = &_vs->sh;
HRESULT const _hr = GEnv.Render->shader_compile(name, file, nullptr, nullptr, NULL, _result);
HRESULT const _hr = GEnv.Render->shader_compile(name, file, nullptr, nullptr, 0, _result);

FS.r_close(file);

Expand Down Expand Up @@ -292,7 +292,7 @@ SPS* CResourceManager::_CreatePS(LPCSTR _name)
// Select target
_ps->sh = glCreateShader(GL_FRAGMENT_SHADER);
void* _result = &_ps->sh;
HRESULT const _hr = GEnv.Render->shader_compile(name, file, nullptr, nullptr, NULL, _result);
HRESULT const _hr = GEnv.Render->shader_compile(name, file, nullptr, nullptr, 0, _result);

FS.r_close(file);

Expand Down Expand Up @@ -362,7 +362,7 @@ SGS* CResourceManager::_CreateGS(LPCSTR name)
_gs->sh = glCreateShader(GL_GEOMETRY_SHADER);
void* _result = &_gs->sh;
HRESULT const _hr = GEnv.Render->shader_compile(name, file, nullptr,
nullptr, NULL, _result);
nullptr, 0, _result);

VERIFY(SUCCEEDED(_hr));

Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRenderPC_GL/gl_R_render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void CRender::render_menu()
}

// Actual Display
Target->u_setrt(Device.dwWidth, Device.dwHeight, HW.pBaseRT,NULL,NULL, HW.pBaseZB);
Target->u_setrt(Device.dwWidth, Device.dwHeight, HW.pBaseRT, 0, 0, HW.pBaseZB);
RCache.set_Shader(Target->s_menu);
RCache.set_Geometry(Target->g_menu);

Expand Down Expand Up @@ -228,7 +228,7 @@ void CRender::Render()
if (!(g_pGameLevel && g_hud)
|| bMenu)
{
Target->u_setrt(Device.dwWidth, Device.dwHeight, HW.pBaseRT,NULL,NULL, HW.pBaseZB);
Target->u_setrt(Device.dwWidth, Device.dwHeight, HW.pBaseRT, 0, 0, HW.pBaseZB);
return;
}

Expand Down
16 changes: 8 additions & 8 deletions src/Layers/xrRenderPC_GL/gl_rendertarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ CRenderTarget::CRenderTarget()
FLOAT ColorRGBA[4] = {127.0f / 255.0f, 127.0f / 255.0f, 127.0f / 255.0f, 127.0f / 255.0f};
HW.pDevice->ClearRenderTargetView(rt_LUM_pool[it]->pRT, ColorRGBA);
}
u_setrt(Device.dwWidth, Device.dwHeight, HW.pBaseRT,NULL,NULL, HW.pBaseZB);
u_setrt(Device.dwWidth, Device.dwHeight, HW.pBaseRT, 0, 0, HW.pBaseZB);
}

// HBAO
Expand Down Expand Up @@ -911,11 +911,11 @@ CRenderTarget::~CRenderTarget()
glDeleteTextures(1, &t_ss_async);

// Textures
t_material->surface_set(GL_TEXTURE_2D, NULL);
t_material->surface_set(GL_TEXTURE_2D, 0);
glDeleteTextures(1, &t_material_surf);

t_LUM_src->surface_set(GL_TEXTURE_2D, NULL);
t_LUM_dest->surface_set(GL_TEXTURE_2D, NULL);
t_LUM_src->surface_set(GL_TEXTURE_2D, 0);
t_LUM_dest->surface_set(GL_TEXTURE_2D, 0);

#ifdef DEBUG
GLuint pSurf = 0;
Expand All @@ -926,8 +926,8 @@ CRenderTarget::~CRenderTarget()
pSurf = t_envmap_1->surface_get();
glDeleteTextures(1, &pSurf);
#endif // DEBUG
t_envmap_0->surface_set(GL_TEXTURE_CUBE_MAP, NULL);
t_envmap_1->surface_set(GL_TEXTURE_CUBE_MAP, NULL);
t_envmap_0->surface_set(GL_TEXTURE_CUBE_MAP, 0);
t_envmap_1->surface_set(GL_TEXTURE_CUBE_MAP, 0);
t_envmap_0.destroy();
t_envmap_1.destroy();

Expand All @@ -937,11 +937,11 @@ CRenderTarget::~CRenderTarget()
// Jitter
for (int it = 0; it < TEX_jitter_count; it++)
{
t_noise [it]->surface_set(GL_TEXTURE_2D, NULL);
t_noise [it]->surface_set(GL_TEXTURE_2D, 0);
}
glDeleteTextures(TEX_jitter_count, t_noise_surf);

t_noise_mipped->surface_set(GL_TEXTURE_2D, NULL);
t_noise_mipped->surface_set(GL_TEXTURE_2D, 0);
glDeleteTextures(1, &t_noise_surf_mipped);

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void CRenderTarget::create_minmax_SM()
pv++;
RCache.Vertex.Unlock(4, g_combine_2UV->vb_stride);
//u_setrt (rt_smap_depth_minmax_temp,NULL,NULL,NULL);
u_setrt(rt_smap_depth_minmax,NULL,NULL,NULL);
u_setrt(rt_smap_depth_minmax, 0, 0, 0);
RCache.set_Element(s_create_minmax_sm->E[0]);
RCache.set_Geometry(g_combine_2UV);
RCache.set_Stencil(FALSE, D3DCMP_ALWAYS, 0x80, 0xFF, 0x80, D3DSTENCILOP_KEEP, D3DSTENCILOP_REPLACE,
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRenderPC_GL/gl_rendertarget_phase_PP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ struct TL_2c3uv
void CRenderTarget::phase_pp()
{
// combination/postprocess
u_setrt(Device.dwWidth, Device.dwHeight, HW.pBaseRT,NULL,NULL, HW.pBaseZB);
u_setrt(Device.dwWidth, Device.dwHeight, HW.pBaseRT, 0, 0, HW.pBaseZB);
// Element 0 for for normal post-process
// Element 4 for color map post-process
bool bCMap = u_need_CM();
Expand Down
10 changes: 5 additions & 5 deletions src/Layers/xrRenderPC_GL/gl_rendertarget_phase_bloom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void CRenderTarget::phase_bloom()
u32 Offset;

// Targets
u_setrt(rt_Bloom_1,NULL,NULL,NULL); // No need for ZBuffer at all
u_setrt(rt_Bloom_1, 0, 0, 0); // No need for ZBuffer at all
//RImplementation.rmNormal();

// Clear - don't clear - it's stupid here :)
Expand Down Expand Up @@ -187,12 +187,12 @@ void CRenderTarget::phase_bloom()
RCache.set_Geometry(g_bloom_build);

// P0
u_setrt(rt_Bloom_2,NULL,NULL,NULL); // No need for ZBuffer at all
u_setrt(rt_Bloom_2, 0, 0, 0); // No need for ZBuffer at all
RCache.set_Element(s_bloom->E[3]);
RCache.Render(D3DPT_TRIANGLELIST, Offset, 0, 4, 0, 2);

// P1
u_setrt(rt_Bloom_1,NULL,NULL,NULL); // No need for ZBuffer at all
u_setrt(rt_Bloom_1, 0, 0, 0); // No need for ZBuffer at all
RCache.set_Element(s_bloom->E[4]);
RCache.Render(D3DPT_TRIANGLELIST, Offset, 0, 4, 0, 2);
}
Expand Down Expand Up @@ -271,7 +271,7 @@ void CRenderTarget::phase_bloom()
Fvector4 w0, w1;
float kernel = ps_r2_ls_bloom_kernel_g;
CalcGauss_wave(w0, w1, kernel, kernel / 3.f, ps_r2_ls_bloom_kernel_scale);
u_setrt(rt_Bloom_2,NULL,NULL,NULL); // No need for ZBuffer at all
u_setrt(rt_Bloom_2, 0, 0, 0); // No need for ZBuffer at all
RCache.set_Element(s_bloom->E[1]);
RCache.set_ca("weight", 0, w0);
RCache.set_ca("weight", 1, w1);
Expand Down Expand Up @@ -351,7 +351,7 @@ void CRenderTarget::phase_bloom()
Fvector4 w0, w1;
float kernel = ps_r2_ls_bloom_kernel_g * float(Device.dwHeight) / float(Device.dwWidth);
CalcGauss_wave(w0, w1, kernel, kernel / 3.f, ps_r2_ls_bloom_kernel_scale);
u_setrt(rt_Bloom_1,NULL,NULL,NULL); // No need for ZBuffer at all
u_setrt(rt_Bloom_1, 0, 0, 0); // No need for ZBuffer at all
RCache.set_Element(s_bloom->E[2]);
RCache.set_ca("weight", 0, w0);
RCache.set_ca("weight", 1, w1);
Expand Down
14 changes: 7 additions & 7 deletions src/Layers/xrRenderPC_GL/gl_rendertarget_phase_combine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,14 +355,14 @@ void CRenderTarget::phase_combine()
if (RImplementation.o.dx10_msaa)
{
if (PP_Complex) u_setrt(rt_Generic, 0, 0, HW.pBaseZB); // LDR RT
else u_setrt(Device.dwWidth, Device.dwHeight, HW.pBaseRT,NULL,NULL, HW.pBaseZB);
else u_setrt(Device.dwWidth, Device.dwHeight, HW.pBaseRT, 0, 0, HW.pBaseZB);
}
else
{
if (PP_Complex) u_setrt(rt_Color, 0, 0, HW.pBaseZB); // LDR RT
else u_setrt(Device.dwWidth, Device.dwHeight, HW.pBaseRT,NULL,NULL, HW.pBaseZB);
else u_setrt(Device.dwWidth, Device.dwHeight, HW.pBaseRT, 0, 0, HW.pBaseZB);
}
//. u_setrt ( Device.dwWidth,Device.dwHeight,HW.pBaseRT,NULL,NULL,HW.pBaseZB);
//. u_setrt ( Device.dwWidth,Device.dwHeight,HW.pBaseRT, 0, 0,HW.pBaseZB);
RCache.set_CullMode(CULL_NONE);
RCache.set_Stencil(FALSE);

Expand Down Expand Up @@ -483,8 +483,8 @@ void CRenderTarget::phase_combine()
//*** exposure-pipeline-clear
{
std::swap(rt_LUM_pool[gpu_id * 2 + 0], rt_LUM_pool[gpu_id * 2 + 1]);
t_LUM_src->surface_set(GL_TEXTURE_2D, NULL);
t_LUM_dest->surface_set(GL_TEXTURE_2D, NULL);
t_LUM_src->surface_set(GL_TEXTURE_2D, 0);
t_LUM_dest->surface_set(GL_TEXTURE_2D, 0);
}

#ifdef DEBUG
Expand Down Expand Up @@ -595,8 +595,8 @@ void CRenderTarget::phase_combine()
void CRenderTarget::phase_wallmarks()
{
// Targets
RCache.set_RT(NULL, 2);
RCache.set_RT(NULL, 1);
RCache.set_RT(0, 2);
RCache.set_RT(0, 1);
if (!RImplementation.o.dx10_msaa)
u_setrt(rt_Color,NULL,NULL, HW.pBaseZB);
else
Expand Down
6 changes: 3 additions & 3 deletions src/Layers/xrRenderPC_GL/gl_rendertarget_phase_luminance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void CRenderTarget::phase_luminance()
//CHK_DX (HW.pDevice->SetRenderState (D3DRS_ZENABLE,FALSE));

// 000: Perform LUM-SAT, pass 0, 256x256 => 64x64
u_setrt(rt_LUM_64,NULL,NULL,NULL);
u_setrt(rt_LUM_64, 0, 0, 0);
//RImplementation.rmNormal();
{
float ts = 64;
Expand Down Expand Up @@ -81,7 +81,7 @@ void CRenderTarget::phase_luminance()
}

// 111: Perform LUM-SAT, pass 1, 64x64 => 8x8
u_setrt(rt_LUM_8,NULL,NULL,NULL);
u_setrt(rt_LUM_8, 0, 0, 0);
//RImplementation.rmNormal();
{
// Build filter-kernel
Expand Down Expand Up @@ -118,7 +118,7 @@ void CRenderTarget::phase_luminance()

// 222: Perform LUM-SAT, pass 2, 8x8 => 1x1
u32 gpu_id = Device.dwFrame % HW.Caps.iGPUNum;
u_setrt(rt_LUM_pool[gpu_id * 2 + 1],NULL,NULL,NULL);
u_setrt(rt_LUM_pool[gpu_id * 2 + 1], 0, 0, 0);
//RImplementation.rmNormal();
{
// Build filter-kernel
Expand Down
4 changes: 2 additions & 2 deletions src/Layers/xrRenderPC_GL/gl_rendertarget_phase_occq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
void CRenderTarget::phase_occq()
{
if (!RImplementation.o.dx10_msaa)
u_setrt(Device.dwWidth, Device.dwHeight, HW.pBaseRT,NULL,NULL, HW.pBaseZB);
u_setrt(Device.dwWidth, Device.dwHeight, HW.pBaseRT, 0, 0, HW.pBaseZB);
else
u_setrt(Device.dwWidth, Device.dwHeight,NULL,NULL,NULL, rt_MSAADepth->pZRT);
u_setrt(Device.dwWidth, Device.dwHeight, 0, 0, 0, rt_MSAADepth->pZRT);
RCache.set_Shader(s_occq);
RCache.set_CullMode(CULL_CCW);
RCache.set_Stencil(TRUE, D3DCMP_LESSEQUAL, 0x01, 0xff, 0x00);
Expand Down
8 changes: 4 additions & 4 deletions src/Layers/xrRenderPC_GL/gl_rendertarget_phase_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ void CRenderTarget::phase_scene_prepare()
{
// TODO: DX10: Check if we need to set RT here.
if (!RImplementation.o.dx10_msaa)
u_setrt(Device.dwWidth, Device.dwHeight, rt_Position->pRT,NULL,NULL, HW.pBaseZB);
u_setrt(Device.dwWidth, Device.dwHeight, rt_Position->pRT, 0, 0, HW.pBaseZB);
else
u_setrt(Device.dwWidth, Device.dwHeight, rt_Position->pRT,NULL,NULL, rt_MSAADepth->pZRT);
u_setrt(Device.dwWidth, Device.dwHeight, rt_Position->pRT, 0, 0, rt_MSAADepth->pZRT);

//CHK_DX ( HW.pDevice->Clear ( 0L, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER|D3DCLEAR_STENCIL, 0x0, 1.0f, 0L) );
FLOAT ColorRGBA[4] = {0.0f, 0.0f, 0.0f, 0.0f};
Expand All @@ -50,13 +50,13 @@ void CRenderTarget::phase_scene_prepare()
// TODO: DX10: Check if we need to set RT here.
if (!RImplementation.o.dx10_msaa)
{
u_setrt(Device.dwWidth, Device.dwHeight, HW.pBaseRT,NULL,NULL, HW.pBaseZB);
u_setrt(Device.dwWidth, Device.dwHeight, HW.pBaseRT, 0, 0, HW.pBaseZB);
//CHK_DX ( HW.pDevice->Clear ( 0L, NULL, D3DCLEAR_ZBUFFER|D3DCLEAR_STENCIL, 0x0, 1.0f, 0L) );
HW.pDevice->ClearDepthStencilView(HW.pBaseZB, D3D_CLEAR_DEPTH | D3D_CLEAR_STENCIL, 1.0f, 0);
}
else
{
u_setrt(Device.dwWidth, Device.dwHeight, HW.pBaseRT,NULL,NULL, rt_MSAADepth->pZRT);
u_setrt(Device.dwWidth, Device.dwHeight, HW.pBaseRT, 0, 0, rt_MSAADepth->pZRT);
//CHK_DX ( HW.pDevice->Clear ( 0L, NULL, D3DCLEAR_ZBUFFER|D3DCLEAR_STENCIL, 0x0, 1.0f, 0L) );
HW.pDevice->ClearDepthStencilView(rt_MSAADepth->pZRT, D3D_CLEAR_DEPTH | D3D_CLEAR_STENCIL, 1.0f, 0);
}
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/xr_ioc_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ void CCC_LoadCFG::Execute(LPCSTR args)
IReader* F = FS.r_open(cfg_full_name);

string1024 str;
if (F != NULL)
if (F != nullptr)
{
while (!F->eof())
{
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/EntityCondition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void CEntityCondition::reinit()

m_fHealthLost = 0.f;
m_pWho = NULL;
m_iWhoID = NULL;
m_iWhoID = 0;

ClearWounds();
}
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/Weapon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ CWeapon::CWeapon()
m_set_next_ammoType_on_reload = undefined_ammo_type;
m_crosshair_inertion = 0.f;
m_activation_speed_is_overriden = false;
m_cur_scope = NULL;
m_cur_scope = 0;
m_bRememberActorNVisnStatus = false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/WeaponMagazined.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ bool CWeaponMagazined::DetachScope(const char* item_section_name, bool b_spawn_i
LPCSTR iter_scope_name = pSettings->r_string((*it), "scope_name");
if (!xr_strcmp(iter_scope_name, item_section_name))
{
m_cur_scope = NULL;
m_cur_scope = 0;
detached = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ai/monsters/control_manager_custom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ bool CControlManagerCustom::jump_if_possible(Fvector const& target, CEntityAlive
if (!m_object->check_start_conditions(ControlCom::eControlJump))
return false;

bool const aggressive_jump = target_object ? m_object->can_use_agressive_jump(target_object) : NULL;
bool const aggressive_jump = target_object ? m_object->can_use_agressive_jump(target_object) : false;
if (check_possibility && !m_jump->can_jump(target, aggressive_jump))
return false;

Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ai/monsters/pseudodog/psy_dog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
CPsyDog::CPsyDog()
{
m_aura = new CPsyDogAura(this);
m_max_phantoms_count = NULL;
m_max_phantoms_count = 0;
m_phantoms_die_time = NULL;
}
CPsyDog::~CPsyDog()
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/inventory_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ bool CInventoryItem::Detach(const char* item_section_name, bool b_spawn_item)
if (object().H_Parent())
D->ID_Parent = u16(object().H_Parent()->ID());
else
D->ID_Parent = NULL;
D->ID_Parent = 0;
}
D->ID_Phantom = 0xffff;
D->o_Position = object().Position();
Expand Down
4 changes: 2 additions & 2 deletions src/xrSound/SoundRender_TargetA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void CSoundRender_TargetA::stop()
if (rendering)
{
A_CHK(alSourceStop(pSource));
A_CHK(alSourcei(pSource, AL_BUFFER, NULL));
A_CHK(alSourcei(pSource, AL_BUFFER, 0));
A_CHK(alSourcei(pSource, AL_SOURCE_RELATIVE, TRUE));
}
inherited::stop();
Expand All @@ -86,7 +86,7 @@ void CSoundRender_TargetA::rewind()
inherited::rewind();

A_CHK(alSourceStop(pSource));
A_CHK(alSourcei(pSource, AL_BUFFER, NULL));
A_CHK(alSourcei(pSource, AL_BUFFER, 0));
for (u32 buf_idx = 0; buf_idx < sdef_target_count; buf_idx++)
fill_block(pBuffers[buf_idx]);
A_CHK(alSourceQueueBuffers(pSource, sdef_target_count, pBuffers));
Expand Down
2 changes: 1 addition & 1 deletion src/xrUICore/ui_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ shared_str UICore::get_xml_name(LPCSTR fn)
if (NULL == FS.exist(str_, "$game_config$", UI_PATH_WITH_DELIMITER, str))
{
xr_sprintf(str, "%s", fn);
if (NULL == strext(fn))
if (nullptr == strext(fn))
xr_strcat(str, ".xml");
}
}
Expand Down

0 comments on commit aad51bf

Please sign in to comment.