[zipios] remove superfluous nullptr checks
This commit is contained in:
@@ -31,7 +31,7 @@ bool CollectionCollection::addCollection( const FileCollection &collection ) {
|
||||
bool CollectionCollection::addCollection( FileCollection *collection ) {
|
||||
if ( ! _valid )
|
||||
throw InvalidStateException( "Attempt to add a FileCollection to an invalid CollectionCollection" ) ;
|
||||
if ( collection == nullptr || this == collection || ! collection->isValid() )
|
||||
if ( !collection || this == collection || ! collection->isValid() )
|
||||
return false ;
|
||||
_collections.push_back( collection ) ;
|
||||
return true ;
|
||||
@@ -87,7 +87,7 @@ istream *CollectionCollection::getInputStream( const string &entry_name,
|
||||
|
||||
getEntry( entry_name, cep, it, matchpath ) ;
|
||||
|
||||
if ( cep == nullptr )
|
||||
if ( !cep )
|
||||
return nullptr ;
|
||||
else
|
||||
return (*it)->getInputStream( entry_name ) ;
|
||||
|
||||
@@ -81,7 +81,7 @@ std::istream *DirectoryCollection::getInputStream( const string &entry_name,
|
||||
|
||||
ConstEntryPointer ent = getEntry( entry_name, matchpath ) ;
|
||||
|
||||
if ( ent == nullptr )
|
||||
if ( !ent )
|
||||
return nullptr ;
|
||||
else {
|
||||
string real_path( _filepath + entry_name ) ;
|
||||
|
||||
@@ -85,7 +85,7 @@ struct boost::filesystem::dir_it::representation
|
||||
{
|
||||
m_stat_p = false;
|
||||
dirent *rc = readdir(m_handle);
|
||||
if (rc != nullptr)
|
||||
if (rc)
|
||||
m_current = rc->d_name;
|
||||
else
|
||||
{
|
||||
@@ -183,14 +183,14 @@ namespace boost
|
||||
template <> std::string get<uname>(dir_it const &it)
|
||||
{
|
||||
struct passwd *pw = getpwuid(it.rep->get_stat().st_uid);
|
||||
if (pw == nullptr)
|
||||
if (!pw)
|
||||
throw unknown_uid(it.rep->get_stat().st_uid);
|
||||
return pw->pw_name;
|
||||
}
|
||||
template <> void set<uname>(dir_it const &it, std::string name)
|
||||
{
|
||||
struct passwd *pw = getpwnam(name.c_str());
|
||||
if (pw != nullptr)
|
||||
if (pw)
|
||||
it.rep->change_owner(pw->pw_uid);
|
||||
else
|
||||
throw unknown_uname(name);
|
||||
@@ -201,14 +201,14 @@ namespace boost
|
||||
template <> std::string get<gname>(dir_it const &it)
|
||||
{
|
||||
struct group *grp = getgrgid(it.rep->get_stat().st_gid);
|
||||
if (grp == nullptr)
|
||||
if (!grp)
|
||||
throw unknown_gid(it.rep->get_stat().st_gid);
|
||||
return grp->gr_name;
|
||||
}
|
||||
template <> void set<gname>(dir_it const &it, std::string name)
|
||||
{
|
||||
struct group *grp = getgrnam(name.c_str());
|
||||
if (grp != nullptr)
|
||||
if (grp)
|
||||
it.rep->change_group(grp->gr_gid);
|
||||
else
|
||||
throw unknown_gname(name);
|
||||
|
||||
@@ -10,14 +10,14 @@ FilterInputStreambuf::FilterInputStreambuf( streambuf *inbuf, bool del_inbuf )
|
||||
_del_inbuf( del_inbuf )
|
||||
{
|
||||
_s_pos = 0;
|
||||
if ( _inbuf == nullptr ) {
|
||||
if (!_inbuf) {
|
||||
// throw an exception
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FilterInputStreambuf::~FilterInputStreambuf() {
|
||||
if ( _del_inbuf )
|
||||
if (_del_inbuf)
|
||||
delete _inbuf ;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ FilterOutputStreambuf::FilterOutputStreambuf( streambuf *outbuf, bool del_outbuf
|
||||
: _outbuf( outbuf),
|
||||
_del_outbuf( del_outbuf )
|
||||
{
|
||||
if ( _outbuf == nullptr ) {
|
||||
if (!_outbuf) {
|
||||
// throw an exception
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FilterOutputStreambuf::~FilterOutputStreambuf() {
|
||||
if ( _del_outbuf )
|
||||
if (_del_outbuf)
|
||||
delete _outbuf ;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ istream *ZipFile::getInputStream( const string &entry_name,
|
||||
|
||||
ConstEntryPointer ent = getEntry( entry_name, matchpath ) ;
|
||||
|
||||
if ( ent == nullptr )
|
||||
if ( !ent )
|
||||
return nullptr ;
|
||||
else
|
||||
return new ZipInputStream( _filename,
|
||||
|
||||
Reference in New Issue
Block a user