]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/hashes.cc
rework hashsum verification in the acquire system
[apt.git] / apt-pkg / contrib / hashes.cc
index 0fa443b4abed2f43391e4e4a6e05246246b42e47..11a7e479b9ac7ddce55de262f805ee9e018556b6 100644 (file)
@@ -23,6 +23,7 @@
 #include <stddef.h>
 #include <algorithm>
 #include <unistd.h>
+#include <stdlib.h>
 #include <string>
 #include <iostream>
                                                                        /*}}}*/
@@ -178,6 +179,15 @@ HashString const * HashStringList::find(char const * const type) const /*{{{*/
    return NULL;
 }
                                                                        /*}}}*/
+unsigned long long HashStringList::FileSize() const                    /*{{{*/
+{
+   HashString const * const hsf = find("Checksum-FileSize");
+   if (hsf == NULL)
+      return 0;
+   std::string const hv = hsf->HashValue();
+   return strtoull(hv.c_str(), NULL, 10);
+}
+                                                                       /*}}}*/
 bool HashStringList::supported(char const * const type)                        /*{{{*/
 {
    for (char const * const * t = HashString::SupportedHashes(); *t != NULL; ++t)