From 7a9e94cac9734cc476366b164a8b4c21d354a8b0 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 7 Jan 2013 20:13:06 +0000 Subject: [PATCH] fix some cases of 'return false' in functions returning a pointer or integer --- panda/src/express/virtualFileMountRamdisk.cxx | 14 +++++++------- panda/src/gobj/texturePool.cxx | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/panda/src/express/virtualFileMountRamdisk.cxx b/panda/src/express/virtualFileMountRamdisk.cxx index 2564b7bc77..88d08dcd01 100644 --- a/panda/src/express/virtualFileMountRamdisk.cxx +++ b/panda/src/express/virtualFileMountRamdisk.cxx @@ -242,7 +242,7 @@ open_read_file(const Filename &file) const { PT(FileBase) f = _root.do_find_file(file); ((VirtualFileMountRamdisk *)this)->_lock.release(); if (f == (FileBase *)NULL || f->is_directory()) { - return false; + return NULL; } File *f2 = DCAST(File, f); @@ -263,7 +263,7 @@ open_write_file(const Filename &file, bool truncate) { PT(File) f = _root.do_create_file(file); _lock.release(); if (f == (File *)NULL) { - return false; + return NULL; } if (truncate) { @@ -288,7 +288,7 @@ open_append_file(const Filename &file) { PT(File) f = _root.do_create_file(file); _lock.release(); if (f == (File *)NULL) { - return false; + return NULL; } return new OSubStream(&f->_wrapper, 0, 0, true); @@ -308,7 +308,7 @@ open_read_write_file(const Filename &file, bool truncate) { PT(File) f = _root.do_create_file(file); _lock.release(); if (f == (File *)NULL) { - return false; + return NULL; } return new SubStream(&f->_wrapper, 0, 0); @@ -328,7 +328,7 @@ open_read_append_file(const Filename &file) { PT(FileBase) f = _root.do_find_file(file); _lock.release(); if (f == (FileBase *)NULL || f->is_directory()) { - return false; + return NULL; } File *f2 = DCAST(File, f); @@ -350,7 +350,7 @@ get_file_size(const Filename &file, istream *stream) const { PT(FileBase) f = _root.do_find_file(file); ((VirtualFileMountRamdisk *)this)->_lock.release(); if (f == (FileBase *)NULL || f->is_directory()) { - return false; + return 0; } File *f2 = DCAST(File, f); @@ -369,7 +369,7 @@ get_file_size(const Filename &file) const { PT(FileBase) f = _root.do_find_file(file); ((VirtualFileMountRamdisk *)this)->_lock.release(); if (f == (FileBase *)NULL || f->is_directory()) { - return false; + return 0; } File *f2 = DCAST(File, f); diff --git a/panda/src/gobj/texturePool.cxx b/panda/src/gobj/texturePool.cxx index 3a65c02fa4..ae313ebe01 100644 --- a/panda/src/gobj/texturePool.cxx +++ b/panda/src/gobj/texturePool.cxx @@ -258,7 +258,7 @@ ns_load_texture(const Filename &orig_filename, int primary_file_num_channels, // No such file. gobj_cat.error() << "Could not find " << filename << "\n"; - return false; + return NULL; } if (gobj_cat.is_debug()) { @@ -271,7 +271,7 @@ ns_load_texture(const Filename &orig_filename, int primary_file_num_channels, vfs->close_read_file(in); if (tex == (Texture *)NULL) { - return false; + return NULL; } tex->set_fullpath(filename); tex->clear_alpha_fullpath(); @@ -561,7 +561,7 @@ ns_load_3d_texture(const Filename &filename_pattern, } // Set the original filename, before we searched along the path. - nassertr(tex != (Texture *)NULL, false); + nassertr(tex != (Texture *)NULL, NULL); tex->set_filename(filename_pattern); tex->set_fullpath(filename); tex->_texture_pool_key = filename; @@ -667,7 +667,7 @@ ns_load_2d_texture_array(const Filename &filename_pattern, } // Set the original filename, before we searched along the path. - nassertr(tex != (Texture *)NULL, false); + nassertr(tex != (Texture *)NULL, NULL); tex->set_filename(filename_pattern); tex->set_fullpath(filename); tex->_texture_pool_key = filename; @@ -768,7 +768,7 @@ ns_load_cube_map(const Filename &filename_pattern, bool read_mipmaps, } // Set the original filename, before we searched along the path. - nassertr(tex != (Texture *)NULL, false); + nassertr(tex != (Texture *)NULL, NULL); tex->set_filename(filename_pattern); tex->set_fullpath(filename); tex->_texture_pool_key = filename;