comments + really compute md5 on uncompressed data

This commit is contained in:
Jean-Francois Dockes 2018-12-28 10:32:01 +01:00
parent 6ad80f0b30
commit f6f4d8426a
3 changed files with 18 additions and 14 deletions

View File

@ -32,6 +32,12 @@
using namespace std;
// Do we need this? It would need to be called from recollinit
// Call once, not reentrant
// xmlInitParser();
// LIBXML_TEST_VERSION;
// Probably not: xmlCleanupParser();
class FileScanXML : public FileScanDo {
public:

View File

@ -511,14 +511,6 @@ bool file_scan(const string& fn, FileScanDo* doer, int64_t startoffs,
FileScanSourceFile source(doer, fn, startoffs, cnttoread, reason);
FileScanUpstream *up = &source;
// We compute the MD5 on the uncompressed data, so insert this
// right at the source.
string digest;
FileScanMd5 md5filter(digest);
if (md5p) {
md5filter.insertAtSink(doer, up);
up = &md5filter;
}
#if defined(READFILE_ENABLE_ZLIB)
GzFilter gzfilter;
@ -528,6 +520,15 @@ bool file_scan(const string& fn, FileScanDo* doer, int64_t startoffs,
}
#endif
// We compute the MD5 on the uncompressed data, so insert this
// right at the source (after the decompressor).
string digest;
FileScanMd5 md5filter(digest);
if (md5p) {
md5filter.insertAtSink(doer, up);
up = &md5filter;
}
bool ret = source.scan();
if (md5p) {
@ -572,8 +573,6 @@ bool string_scan(const char *data, size_t cnt, FileScanDo* doer,
FileScanSourceBuffer source(doer, data, cnt, reason);
FileScanUpstream *up = &source;
// We compute the MD5 on the uncompressed data, so insert this
// right at the source.
string digest;
FileScanMd5 md5filter(digest);
if (md5p) {

View File

@ -65,14 +65,13 @@ public:
bool file_scan(const std::string& fn, FileScanDo* doer, int64_t startoffs,
int64_t cnttoread, std::string *reason, std::string *md5p);
/** Same as file_scan, from a memory buffer */
bool string_scan(const char *data, size_t cnt, FileScanDo* doer,
std::string *reason, std::string *md5p);
/** Same as above, not offset/cnt/md5 */
bool file_scan(const std::string& filename, FileScanDo* doer,
std::string *reason);
/** Same as file_scan, from a memory buffer. No libz processing */
bool string_scan(const char *data, size_t cnt, FileScanDo* doer,
std::string *reason, std::string *md5p);
#if defined(READFILE_ENABLE_MINIZ)
/* Process a zip archive member */