X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ffs%2Fstat.cpp;h=e296ead3816b9317ecd44f0bc82bf6fbd12cbbed;hb=991fabc1956b73a4007859058fb44171000b452e;hp=f4566ae8b6ef8363cd68f709f2d66924137a58a2;hpb=609c9a508cfdc7b42c46c4f21d17639204165a00;p=libs%2Fcore.git diff --git a/source/fs/stat.cpp b/source/fs/stat.cpp index f4566ae..e296ead 100644 --- a/source/fs/stat.cpp +++ b/source/fs/stat.cpp @@ -7,20 +7,6 @@ using namespace std; namespace Msp { namespace FS { -Stat::Private::Private(): - owner_id(0), - group_id(0) -{ } - - -Stat::Stat(): - exists(false), - type(UNKNOWN), - size(0), - alloc_size(0), - priv(0) -{ } - Stat::Stat(const Stat &other): exists(other.exists), type(other.type), @@ -28,11 +14,14 @@ Stat::Stat(const Stat &other): alloc_size(other.alloc_size), mtime(other.mtime), owner_info(other.owner_info), - priv(other.priv ? new Private(*other.priv) : 0) + priv(other.priv ? new Private(*other.priv) : nullptr) { } Stat &Stat::operator=(const Stat &other) { + if(&other==this) + return *this; + exists = other.exists; type = other.type; size = other.size; @@ -40,7 +29,7 @@ Stat &Stat::operator=(const Stat &other) mtime = other.mtime; owner_info = other.owner_info; delete priv; - priv = (other.priv ? new Private(*other.priv) : 0); + priv = (other.priv ? new Private(*other.priv) : nullptr); return *this; } @@ -50,14 +39,14 @@ Stat::~Stat() delete priv; } -const std::string &Stat::get_owner() const +const string &Stat::get_owner() const { if(priv && owner_info.owner.empty()) priv->fill_owner_info(owner_info); return owner_info.owner; } -const std::string &Stat::get_group() const +const string &Stat::get_group() const { if(priv && owner_info.group.empty()) priv->fill_owner_info(owner_info);