diff --git a/src/Makefile.am b/src/Makefile.am
index d9566b30..cf84533b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -34,7 +34,7 @@ AM_CPPFLAGS = -Wall -Wno-unused -std=c++11 \
$(XSLT_CFLAGS) \
$(X_CFLAGS) \
-DRECOLL_DATADIR=\"${pkgdatadir}\" \
- -DREADFILE_ENABLE_ZLIB -DREADFILE_ENABLE_MINIZ \
+ -DREADFILE_ENABLE_ZLIB -DREADFILE_ENABLE_MINIZ -DREADFILE_ENABLE_MD5 \
-D_GNU_SOURCE \
$(DEFS)
diff --git a/src/utils/conftree.cpp b/src/utils/conftree.cpp
index 1928c4d7..21391bb5 100644
--- a/src/utils/conftree.cpp
+++ b/src/utils/conftree.cpp
@@ -507,6 +507,13 @@ int ConfSimple::eraseKey(const string& sk)
return write();
}
+int ConfSimple::clear()
+{
+ m_submaps.clear();
+ m_order.clear();
+ return write();
+}
+
// Walk the tree, calling user function at each node
ConfSimple::WalkerCode
ConfSimple::sortwalk(WalkerCode(*walker)(void *, const string&, const string&),
@@ -692,6 +699,13 @@ bool ConfSimple::commentsAsXML(ostream& out)
}
break;
}
+ case ConfLine::CFL_SK:
+ out << "" << it->m_data << "" << endl;
+ break;
+ case ConfLine::CFL_VAR:
+ out << "" << it->m_data << " = " <<
+ it->m_value << "" << endl;
+ break;
default:
break;
}
diff --git a/src/utils/conftree.h b/src/utils/conftree.h
index 6da1ff50..cc53d237 100644
--- a/src/utils/conftree.h
+++ b/src/utils/conftree.h
@@ -159,10 +159,7 @@ public:
void reparse(const std::string& in);
/** Clear all content */
- void clear() {
- m_submaps.clear();
- m_order.clear();
- }
+ int clear();
/**
* Get string value for named parameter, from specified subsection (looks
diff --git a/src/utils/miniz.cpp b/src/utils/miniz.cpp
index d4006ea6..a187fe46 100644
--- a/src/utils/miniz.cpp
+++ b/src/utils/miniz.cpp
@@ -2955,6 +2955,7 @@ static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream)
#ifndef MINIZ_NO_TIME
#include
#endif
+#define MZ_FOPENREAD mz_fopen
#define MZ_FOPEN mz_fopen
#define MZ_FCLOSE fclose
#define MZ_FREAD fread
@@ -2986,6 +2987,7 @@ static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream)
#ifndef MINIZ_NO_TIME
#include
#endif
+#define MZ_FOPENREAD(f, m) fopen(f, m)
#define MZ_FOPEN(f, m) fopen(f, m)
#define MZ_FCLOSE fclose
#define MZ_FREAD fread
@@ -3002,6 +3004,7 @@ static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream)
#include
#endif
#define MZ_FOPEN(f, m) fopen64(f, m)
+#define MZ_FOPENREAD(f, m) fopen64(f, m)
#define MZ_FCLOSE fclose
#define MZ_FREAD fread
#define MZ_FWRITE fwrite
@@ -3017,6 +3020,7 @@ static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream)
#include
#endif
#define MZ_FOPEN(f, m) fopen(f, m)
+#define MZ_FOPENREAD(f, m) fopen(f, m)
#define MZ_FCLOSE fclose
#define MZ_FREAD fread
#define MZ_FWRITE fwrite
@@ -3033,6 +3037,7 @@ static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream)
#ifndef MINIZ_NO_TIME
#include
#endif
+#define MZ_FOPENREAD(f, m) fopen(f, m)
#define MZ_FOPEN(f, m) fopen(f, m)
#define MZ_FCLOSE fclose
#define MZ_FREAD fread
diff --git a/src/utils/pathut.cpp b/src/utils/pathut.cpp
index 2715b4d1..a21eafc0 100644
--- a/src/utils/pathut.cpp
+++ b/src/utils/pathut.cpp
@@ -65,7 +65,6 @@
#include "pathut.h"
#include "smallut.h"
-#include "log.h"
using namespace std;
diff --git a/src/utils/readfile.cpp b/src/utils/readfile.cpp
index 64e08639..43129e3d 100644
--- a/src/utils/readfile.cpp
+++ b/src/utils/readfile.cpp
@@ -45,7 +45,10 @@
#include "smallut.h"
#include "pathut.h"
+
+#ifdef READFILE_ENABLE_MD5
#include "md5.h"
+#endif
#ifdef MDU_INCLUDE_LOG
#include MDU_INCLUDE_LOG
@@ -88,7 +91,11 @@ bool file_to_string(const string& fn, string& data, int64_t offs, size_t cnt,
string *reason)
{
FileToString accum(data);
- return file_scan(fn, &accum, offs, cnt, reason, nullptr);
+ return file_scan(fn, &accum, offs, cnt, reason
+#ifdef READFILE_ENABLE_MD5
+ , nullptr
+#endif
+ );
}
bool file_to_string(const string& fn, string& data, string *reason)
@@ -254,6 +261,8 @@ public:
};
#endif // GZ
+#ifdef READFILE_ENABLE_MD5
+
class FileScanMd5 : public FileScanFilter {
public:
FileScanMd5(string& d) : digest(d) {}
@@ -281,7 +290,7 @@ public:
string &digest;
MD5_CTX ctx;
};
-
+#endif // MD5
// Source taking data from a regular file
class FileScanSourceFile : public FileScanSource {
@@ -488,7 +497,11 @@ bool file_scan(const std::string& filename, const std::string& membername,
FileScanDo* doer, std::string *reason)
{
if (membername.empty()) {
- return file_scan(filename, doer, 0, -1, reason, nullptr);
+ return file_scan(filename, doer, 0, -1, reason
+#ifdef READFILE_ENABLE_MD5
+, nullptr
+#endif
+ );
} else {
FileScanSourceZip source(doer, filename, membername, reason);
return source.scan();
@@ -499,7 +512,11 @@ bool string_scan(const char *data, size_t cnt, const std::string& membername,
FileScanDo* doer, std::string *reason)
{
if (membername.empty()) {
- return string_scan(data, cnt, doer, reason, nullptr);
+ return string_scan(data, cnt, doer, reason
+#ifdef READFILE_ENABLE_MD5
+, nullptr
+#endif
+ );
} else {
FileScanSourceZip source(data, cnt, doer, membername, reason);
return source.scan();
@@ -509,9 +526,13 @@ bool string_scan(const char *data, size_t cnt, const std::string& membername,
#endif // READFILE_ENABLE_ZIP
bool file_scan(const string& fn, FileScanDo* doer, int64_t startoffs,
- int64_t cnttoread, string *reason, string *md5p)
+ int64_t cnttoread, string *reason
+#ifdef READFILE_ENABLE_MD5
+ , string *md5p
+#endif
+ )
{
- LOGDEB("file_scan: doer " << doer << endl);
+ LOGDEB1("file_scan: doer " << doer << endl);
#if defined(READFILE_ENABLE_ZLIB)
bool nodecomp = startoffs != 0;
#endif
@@ -521,7 +542,7 @@ bool file_scan(const string& fn, FileScanDo* doer, int64_t startoffs,
FileScanSourceFile source(doer, fn, startoffs, cnttoread, reason);
FileScanUpstream *up = &source;
-
+ up = up;
#if defined(READFILE_ENABLE_ZLIB)
GzFilter gzfilter;
@@ -531,6 +552,7 @@ bool file_scan(const string& fn, FileScanDo* doer, int64_t startoffs,
}
#endif
+#ifdef READFILE_ENABLE_MD5
// We compute the MD5 on the uncompressed data, so insert this
// right at the source (after the decompressor).
string digest;
@@ -539,19 +561,26 @@ bool file_scan(const string& fn, FileScanDo* doer, int64_t startoffs,
md5filter.insertAtSink(doer, up);
up = &md5filter;
}
+#endif
bool ret = source.scan();
+#ifdef READFILE_ENABLE_MD5
if (md5p) {
md5filter.finish();
MD5HexPrint(digest, *md5p);
}
+#endif
return ret;
}
bool file_scan(const string& fn, FileScanDo* doer, string *reason)
{
- return file_scan(fn, doer, 0, -1, reason, nullptr);
+ return file_scan(fn, doer, 0, -1, reason
+#ifdef READFILE_ENABLE_MD5
+, nullptr
+#endif
+ );
}
@@ -579,24 +608,33 @@ protected:
};
bool string_scan(const char *data, size_t cnt, FileScanDo* doer,
- std::string *reason, std::string *md5p)
+ std::string *reason
+#ifdef READFILE_ENABLE_MD5
+ , std::string *md5p
+#endif
+ )
{
FileScanSourceBuffer source(doer, data, cnt, reason);
FileScanUpstream *up = &source;
-
+ up = up;
+
+#ifdef READFILE_ENABLE_MD5
string digest;
FileScanMd5 md5filter(digest);
if (md5p) {
md5filter.insertAtSink(doer, up);
up = &md5filter;
}
+#endif
bool ret = source.scan();
+#ifdef READFILE_ENABLE_MD5
if (md5p) {
md5filter.finish();
MD5HexPrint(digest, *md5p);
}
+#endif
return ret;
}
diff --git a/src/utils/readfile.h b/src/utils/readfile.h
index 854fcec1..74d26acc 100644
--- a/src/utils/readfile.h
+++ b/src/utils/readfile.h
@@ -63,7 +63,11 @@ public:
* @return true if the operation ended normally, else false.
*/
bool file_scan(const std::string& fn, FileScanDo* doer, int64_t startoffs,
- int64_t cnttoread, std::string *reason, std::string *md5p);
+ int64_t cnttoread, std::string *reason
+#ifdef READFILE_ENABLE_MD5
+ , std::string *md5p
+#endif
+ );
/** Same as above, not offset/cnt/md5 */
bool file_scan(const std::string& filename, FileScanDo* doer,
@@ -71,7 +75,11 @@ bool file_scan(const std::string& filename, FileScanDo* doer,
/** 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);
+ std::string *reason
+#ifdef READFILE_ENABLE_MD5
+ , std::string *md5p
+#endif
+ );
#if defined(READFILE_ENABLE_MINIZ)
/* Process a zip archive member */