diff options
Diffstat (limited to 'inode.h')
-rw-r--r-- | inode.h | 27 |
1 files changed, 2 insertions, 25 deletions
@@ -25,39 +25,16 @@ #include <sys/stat.h> #include <sys/types.h> -#include <zlib.h> - -class inode { -public: +struct inode { std::string const filename; struct stat const stat; -protected: - uLong mutable adler; - -public: inode (std::string const &, struct stat const); - uLong get_adler () const; - friend bool compare (inode const &, inode const &); friend std::ostream& operator<< (std::ostream&, inode const &); }; -inline inode::inode (std::string const & __filename, struct stat const __stat) : filename(__filename), stat(__stat), adler(-1) { -} - -inline uLong inode::get_adler () const { - if (adler == uLong(-1)) { - char buffer[1 << 14]; - std::ifstream f(filename.c_str()); - - adler = adler32(0L, Z_NULL, 0); - while (not f.eof()) { - f.read(buffer, sizeof(buffer)); - adler = adler32(adler, (Bytef *) buffer, f.gcount()); - } - } - return adler; +inline inode::inode (std::string const & __filename, struct stat const __stat) : filename(__filename), stat(__stat) { } inline bool compare (inode const & l, inode const & r) { |