fix some cases of 'return false' in functions returning a pointer or integer

This commit is contained in:
rdb 2013-01-07 20:13:06 +00:00
parent 56f7c3edf2
commit 7a9e94cac9
2 changed files with 12 additions and 12 deletions

View File

@ -242,7 +242,7 @@ open_read_file(const Filename &file) const {
PT(FileBase) f = _root.do_find_file(file); PT(FileBase) f = _root.do_find_file(file);
((VirtualFileMountRamdisk *)this)->_lock.release(); ((VirtualFileMountRamdisk *)this)->_lock.release();
if (f == (FileBase *)NULL || f->is_directory()) { if (f == (FileBase *)NULL || f->is_directory()) {
return false; return NULL;
} }
File *f2 = DCAST(File, f); 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); PT(File) f = _root.do_create_file(file);
_lock.release(); _lock.release();
if (f == (File *)NULL) { if (f == (File *)NULL) {
return false; return NULL;
} }
if (truncate) { if (truncate) {
@ -288,7 +288,7 @@ open_append_file(const Filename &file) {
PT(File) f = _root.do_create_file(file); PT(File) f = _root.do_create_file(file);
_lock.release(); _lock.release();
if (f == (File *)NULL) { if (f == (File *)NULL) {
return false; return NULL;
} }
return new OSubStream(&f->_wrapper, 0, 0, true); 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); PT(File) f = _root.do_create_file(file);
_lock.release(); _lock.release();
if (f == (File *)NULL) { if (f == (File *)NULL) {
return false; return NULL;
} }
return new SubStream(&f->_wrapper, 0, 0); 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); PT(FileBase) f = _root.do_find_file(file);
_lock.release(); _lock.release();
if (f == (FileBase *)NULL || f->is_directory()) { if (f == (FileBase *)NULL || f->is_directory()) {
return false; return NULL;
} }
File *f2 = DCAST(File, f); 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); PT(FileBase) f = _root.do_find_file(file);
((VirtualFileMountRamdisk *)this)->_lock.release(); ((VirtualFileMountRamdisk *)this)->_lock.release();
if (f == (FileBase *)NULL || f->is_directory()) { if (f == (FileBase *)NULL || f->is_directory()) {
return false; return 0;
} }
File *f2 = DCAST(File, f); File *f2 = DCAST(File, f);
@ -369,7 +369,7 @@ get_file_size(const Filename &file) const {
PT(FileBase) f = _root.do_find_file(file); PT(FileBase) f = _root.do_find_file(file);
((VirtualFileMountRamdisk *)this)->_lock.release(); ((VirtualFileMountRamdisk *)this)->_lock.release();
if (f == (FileBase *)NULL || f->is_directory()) { if (f == (FileBase *)NULL || f->is_directory()) {
return false; return 0;
} }
File *f2 = DCAST(File, f); File *f2 = DCAST(File, f);

View File

@ -258,7 +258,7 @@ ns_load_texture(const Filename &orig_filename, int primary_file_num_channels,
// No such file. // No such file.
gobj_cat.error() gobj_cat.error()
<< "Could not find " << filename << "\n"; << "Could not find " << filename << "\n";
return false; return NULL;
} }
if (gobj_cat.is_debug()) { 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); vfs->close_read_file(in);
if (tex == (Texture *)NULL) { if (tex == (Texture *)NULL) {
return false; return NULL;
} }
tex->set_fullpath(filename); tex->set_fullpath(filename);
tex->clear_alpha_fullpath(); 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. // 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_filename(filename_pattern);
tex->set_fullpath(filename); tex->set_fullpath(filename);
tex->_texture_pool_key = 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. // 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_filename(filename_pattern);
tex->set_fullpath(filename); tex->set_fullpath(filename);
tex->_texture_pool_key = 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. // 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_filename(filename_pattern);
tex->set_fullpath(filename); tex->set_fullpath(filename);
tex->_texture_pool_key = filename; tex->_texture_pool_key = filename;