Author: mlandres Date: Wed Sep 12 17:24:20 2007 New Revision: 7216 URL: http://svn.opensuse.org/viewcvs/zypp?rev=7216&view=rev Log: - Assert assert leading and trailing '/' on pathnames in ctor. - Remove empty dummy operator= causing data loss Modified: trunk/libzypp/zypp/DiskUsage.cc trunk/libzypp/zypp/DiskUsage.h Modified: trunk/libzypp/zypp/DiskUsage.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/DiskUsage.cc?rev=7216&r1=7215&r2=7216&view=diff ============================================================================== --- trunk/libzypp/zypp/DiskUsage.cc (original) +++ trunk/libzypp/zypp/DiskUsage.cc Wed Sep 12 17:24:20 2007 @@ -29,8 +29,8 @@ iterator fst = begin(); for ( ; fst != end() && !fst->isBelow( ret ); ++fst ) ; // seek 1st equal or below - - bool found = false; + + bool found = false; if ( fst != end() ) { iterator lst = fst; found = true; @@ -50,7 +50,7 @@ { dname.insert(dname.begin(), '/'); } - + Entry tmp( dname ); tmp._size = ret._size; @@ -73,7 +73,7 @@ } } } - + return ret; } Modified: trunk/libzypp/zypp/DiskUsage.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/DiskUsage.h?rev=7216&r1=7215&r2=7216&view=diff ============================================================================== --- trunk/libzypp/zypp/DiskUsage.h (original) +++ trunk/libzypp/zypp/DiskUsage.h Wed Sep 12 17:24:20 2007 @@ -22,7 +22,7 @@ class DiskUsage { public: /** - * @short Holds data about how much space will be needed per directory + * @short Holds data about how much space will be needed per directory. **/ struct Entry { Entry() : _size(0), _files(0) {}; @@ -30,8 +30,15 @@ const unsigned size_r = 0, const unsigned files_r = 0) : path(path_r), _size(size_r), _files(files_r) - {} - const std::string path; + { + // assert leading and trailing '/' + if ( ! path.empty() ) + { + if ( *path.begin() != '/' ) path.insert( path.begin(), '/' ); + if ( *path.rbegin() != '/' ) path.insert( path.end(), '/' ); + } + } + std::string path; mutable unsigned _size; mutable unsigned _files; friend std::ostream & operator<<( std::ostream & str, const Entry & obj ); @@ -62,12 +69,6 @@ } /** - * - **/ - const Entry & operator=( const Entry & rhs ) const { - return rhs; - } - /** * Numerical operation based on size and files values. **/ const Entry & operator+=( const Entry & rhs ) const { -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org