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; continue;
} }
if (spec._suffix != 0) { if (spec._suffix != nullptr) {
// The suffix feature is inefficient. It is a temporary hack. // The suffix feature is inefficient. It is a temporary hack.
tex = tex->load_related(spec._suffix); tex = tex->load_related(spec._suffix);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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