cleanup: Fix comparison between pointer and 0 (instead of nullptr)

This commit is contained in:
rdb 2022-03-09 10:46:02 +01:00
parent 657a8f890c
commit 6b9dea3e30
8 changed files with 19 additions and 19 deletions

View File

@ -693,7 +693,7 @@ update_shader_texture_bindings(DXShaderContext9 *prev, GSG *gsg) {
continue;
}
if (spec._suffix != 0) {
if (spec._suffix != nullptr) {
// The suffix feature is inefficient. It is a temporary hack.
tex = tex->load_related(spec._suffix);
}

View File

@ -266,7 +266,7 @@ rebuild_bitplanes() {
// Decide how big the bitplanes should be.
if ((_host != 0)&&(_creation_flags & GraphicsPipe::BF_size_track_host)) {
if (_host != nullptr && (_creation_flags & GraphicsPipe::BF_size_track_host) != 0) {
if (_host->get_size() != _size) {
set_size_and_recalc(_host->get_x_size(),
_host->get_y_size());
@ -739,7 +739,7 @@ bool wdxGraphicsBuffer9::
open_buffer() {
// GSG creationinitialization.
if (_gsg == 0) {
if (_gsg == nullptr) {
// The code below doesn't support creating a GSG on the fly. Just error
// out for now. _dxgsg = new DXGraphicsStateGuardian9(_engine, _pipe);
// _gsg = _dxgsg;

View File

@ -261,7 +261,7 @@ open_window() {
static ConfigVariableBool always_discard_device("always-discard-device", true);
bool discard_device = always_discard_device;
if (_gsg == 0) {
if (_gsg == nullptr) {
_dxgsg = new DXGraphicsStateGuardian9(_engine, _pipe);
_gsg = _dxgsg;
} else {

View File

@ -1113,14 +1113,14 @@ update_shader_texture_bindings(ShaderContext *prev) {
continue;
}
if (spec._suffix != 0) {
if (spec._suffix != nullptr) {
// The suffix feature is inefficient. It is a temporary hack.
if (tex == 0) {
if (tex == nullptr) {
continue;
}
tex = tex->load_related(spec._suffix);
}
if ((tex == 0) || (tex->get_texture_type() != spec._desired_type)) {
if (tex == nullptr || tex->get_texture_type() != spec._desired_type) {
continue;
}

View File

@ -360,7 +360,7 @@ check_fbo() {
void CLP(GraphicsBuffer)::
rebuild_bitplanes() {
check_host_valid();
if (_gsg == 0) {
if (_gsg == nullptr) {
return;
}
@ -1661,7 +1661,7 @@ close_buffer() {
check_host_valid();
if (_gsg == 0) {
if (_gsg == nullptr) {
return;
}
@ -1824,7 +1824,7 @@ unregister_shared_depth_buffer(GraphicsOutput *graphics_output) {
*/
void CLP(GraphicsBuffer)::
report_my_errors(int line, const char *file) {
if (_gsg == 0) {
if (_gsg == nullptr) {
GLenum error_code = glGetError();
if (error_code != GL_NO_ERROR) {
GLCAT.error() << file << ", line " << line << ": GL error " << (int)error_code << "\n";

View File

@ -58,7 +58,7 @@ INLINE Material::
*/
INLINE Material *Material::
get_default() {
if (_default == 0) {
if (_default == nullptr) {
_default = new Material("default");
}
return _default;

View File

@ -157,7 +157,7 @@ bind_texture_to_pbuffer() {
if (tex_index >= 0) {
const RenderTexture &rt = cdata->_textures[tex_index];
Texture *tex = rt._texture;
if ((_pbuffer_bound != 0)&&(_pbuffer_bound != tex)) {
if (_pbuffer_bound != nullptr && _pbuffer_bound != tex) {
_pbuffer_bound->release(wglgsg->get_prepared_objects());
_pbuffer_bound = 0;
}
@ -188,7 +188,7 @@ bind_texture_to_pbuffer() {
}
_pbuffer_bound = tex;
} else {
if (_pbuffer_bound != 0) {
if (_pbuffer_bound != nullptr) {
_pbuffer_bound->release(wglgsg->get_prepared_objects());
_pbuffer_bound = 0;
}
@ -292,7 +292,7 @@ open_buffer() {
// GSG creationinitialization.
wglGraphicsStateGuardian *wglgsg;
if (_gsg == 0) {
if (_gsg == nullptr) {
// There is no old gsg. Create a new one.
wglgsg = new wglGraphicsStateGuardian(_engine, _pipe, nullptr);
wglgsg->choose_pixel_format(_fb_properties, true);
@ -355,16 +355,16 @@ open_buffer() {
*/
void wglGraphicsBuffer::
release_pbuffer() {
if (_gsg == 0) {
if (_gsg == nullptr) {
return;
}
wglGraphicsStateGuardian *wglgsg;
DCAST_INTO_V(wglgsg, _gsg);
if (_pbuffer_bound != 0) {
if (_pbuffer_bound != nullptr) {
_pbuffer_bound->release(wglgsg->get_prepared_objects());
_pbuffer_bound = 0;
_pbuffer_bound.clear();
}
wglGraphicsPipe::wgl_make_current(0, 0, nullptr);
if (_pbuffer_dc) {
@ -420,7 +420,7 @@ rebuild_bitplanes() {
// Determine what pbuffer attributes are needed for currently-applicable
// textures.
if ((_host != 0)&&(_creation_flags & GraphicsPipe::BF_size_track_host)) {
if (_host != nullptr && (_creation_flags & GraphicsPipe::BF_size_track_host) != 0) {
if (_host->get_size() != _size) {
set_size_and_recalc(_host->get_x_size(),
_host->get_y_size());

View File

@ -200,7 +200,7 @@ open_window() {
// GSG creationinitialization.
wglGraphicsStateGuardian *wglgsg;
if (_gsg == 0) {
if (_gsg == nullptr) {
// There is no old gsg. Create a new one.
wglgsg = new wglGraphicsStateGuardian(_engine, _pipe, nullptr);
wglgsg->choose_pixel_format(_fb_properties, false);