From 781115968f21fac47d78e22489a7e78c12ce9473 Mon Sep 17 00:00:00 2001 From: "art1@andreas-romeyke.de" Date: Sun, 3 Jun 2018 14:52:47 +0200 Subject: [PATCH] - added check if some files in payload missed a checksum --- src/lib/validate_bag.cpp | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/lib/validate_bag.cpp b/src/lib/validate_bag.cpp index 4c83779..3463250 100644 --- a/src/lib/validate_bag.cpp +++ b/src/lib/validate_bag.cpp @@ -1,6 +1,6 @@ #include "bag.hpp" - +#include bool Bag::validate( list & log ) { @@ -35,6 +35,42 @@ bool Bag::validate( list & log ) { if (ret == false) { is_valid = false; } + if (NULL != this->payload_p) { + // check if payload checksums missed for payload files + // HINT: not requested by draft, therefore only a warning + list payload_files = this->payload_p->get_all_relative_paths(); + list payload_manifest_files = this->payloadmanifest_p->get_checksummed_files(); + list missed_files; + payload_files.sort(); + payload_manifest_files.sort(); + //cout << "PAYLOAD_FILES:" << endl; + //auto it = payload_files.begin(); + //while( it != payload_files.end()) { + // cout << "\t"<<(*it++) << endl; + //} + + + //cout << "PAYLOADMANIFEST_FILES:" << endl; + //it = payload_manifest_files.begin(); + //while( it != payload_manifest_files.end()) { + // cout << "\t"<<(*it++) << endl; + //} + auto it1 = payload_files.begin(); + auto it2 = payload_manifest_files.begin(); + while( it1 != payload_files.end() && it2 != payload_manifest_files.end() ) { + int cmp_res = (*it1).compare( *it2); + //cout << "COMP: "< 0) { + it2++; + } else { + it1++; + it2++; + } + } + } } // next elements are optional if (NULL == this->tagmanifest_p) {