X-Git-Url: http://git.vrable.net/?p=cumulus.git;a=blobdiff_plain;f=main.cc;fp=main.cc;h=d25788de8086ca82791ec27c68eb6c7d27b75692;hp=297e805367601f072e552231d32306886bab1f12;hb=15f090d3b2f0bf3994aacd00ab07da3b1f65ea00;hpb=76ce8210bee6f9c2dbefab56873a9b2847d92a13 diff --git a/main.cc b/main.cc index 297e805..d25788d 100644 --- a/main.cc +++ b/main.cc @@ -49,6 +49,7 @@ #include #include "exclude.h" +#include "hash.h" #include "localdb.h" #include "metadata.h" #include "remote.h" @@ -244,7 +245,7 @@ int64_t dumpfile(int fd, dictionary &file_info, const string &path, /* If the file is new or changed, we must read in the contents a block at a * time. */ if (!cached) { - SHA1Checksum hash; + Hash *hash = Hash::New(); Subfile subfile(db); subfile.load_old_blocks(old_blocks); @@ -258,7 +259,7 @@ int64_t dumpfile(int fd, dictionary &file_info, const string &path, break; } - hash.process(block_buf, bytes); + hash->update(block_buf, bytes); // Sparse file processing: if we read a block of all zeroes, encode // that explicitly. @@ -343,7 +344,8 @@ int64_t dumpfile(int fd, dictionary &file_info, const string &path, status = "old"; } - file_info["checksum"] = hash.checksum_str(); + file_info["checksum"] = hash->digest_str(); + delete hash; } // Sanity check: if we are rebuilding the statcache, but the file looks @@ -683,6 +685,8 @@ void usage(const char *program) int main(int argc, char *argv[]) { + hash_init(); + string backup_dest = "", backup_script = ""; string localdb_dir = ""; string backup_scheme = "";