fix jessie mbox patch for 1.31.4

This commit is contained in:
Jean-Francois Dockes 2021-11-25 09:26:11 +01:00
parent 5ea81045ef
commit fb1876dfd0

View File

@ -1,5 +1,5 @@
diff --git a/internfile/mh_mbox.cpp b/srcinternfile/mh_mbox.cpp diff --git a/src/internfile/mh_mbox.cpp b/src/internfile/mh_mbox.cpp
index 2a0918cf..92ad7e23 100644 index c77d42c8..bdebbac6 100644
--- a/internfile/mh_mbox.cpp --- a/internfile/mh_mbox.cpp
+++ b/internfile/mh_mbox.cpp +++ b/internfile/mh_mbox.cpp
@@ -27,6 +27,7 @@ @@ -27,6 +27,7 @@
@ -19,27 +19,32 @@ index 2a0918cf..92ad7e23 100644
int msgnum{0}; // Current message number in folder. Starts at 1 int msgnum{0}; // Current message number in folder. Starts at 1
int64_t lineno{0}; // debug int64_t lineno{0}; // debug
int64_t fsize{0}; int64_t fsize{0};
@@ -321,7 +322,6 @@ void MimeHandlerMbox::clear_impl() @@ -324,10 +325,10 @@ void MimeHandlerMbox::clear_impl()
{
m->fn.erase(); // We used to use m->instream = ifstream() which fails with some compilers, as the copy
m->ipath.erase(); // constructor is marked deleted in standard c++ (works with many compilers though).
- m->instream = ifstream(); - if (m->instream.is_open()) {
- m->instream.close();
+ if (m->instream->is_open()) {
+ m->instream->close();
}
- m->instream.clear();
+ m->instream->clear();
m->msgnum = 0; m->msgnum = 0;
m->lineno = 0; m->lineno = 0;
m->fsize = 0; @@ -346,8 +347,8 @@ bool MimeHandlerMbox::set_document_file_impl(const string&, const string &fn)
@@ -339,8 +339,9 @@ bool MimeHandlerMbox::set_document_file_impl(const string&, const string &fn)
LOGDEB("MimeHandlerMbox::set_document_file(" << fn << ")\n"); LOGDEB("MimeHandlerMbox::set_document_file(" << fn << ")\n");
clear_impl(); clear_impl();
m->fn = fn; m->fn = fn;
- m->instream = ifstream(fn.c_str(), std::ifstream::binary); - m->instream.open(fn.c_str(), std::ifstream::binary);
- if (!m->instream.good()) { - if (!m->instream.good()) {
+ m->instream = std::unique_ptr<ifstream>( + m->instream->open(fn.c_str(), std::ifstream::binary);
+ new ifstream(fn.c_str(), std::ifstream::binary));
+ if (!m->instream->good()) { + if (!m->instream->good()) {
LOGSYSERR("MimeHandlerMail::set_document_file", "ifstream", fn); LOGSYSERR("MimeHandlerMail::set_document_file", "ifstream", fn);
return false; return false;
} }
@@ -389,13 +390,13 @@ bool MimeHandlerMbox::Internal::tryUseCache(int mtarg) @@ -396,13 +397,13 @@ bool MimeHandlerMbox::Internal::tryUseCache(int mtarg)
fsize)) < 0) { fsize)) < 0) {
goto out; goto out;
} }
@ -57,7 +62,7 @@ index 2a0918cf..92ad7e23 100644
LOGSYSERR("tryUseCache", "getline", ""); LOGSYSERR("tryUseCache", "getline", "");
goto out; goto out;
} }
@@ -404,7 +405,7 @@ bool MimeHandlerMbox::Internal::tryUseCache(int mtarg) @@ -411,7 +412,7 @@ bool MimeHandlerMbox::Internal::tryUseCache(int mtarg)
if ((fromregex(line) || if ((fromregex(line) ||
((quirks & MBOXQUIRK_TBIRD) && minifromregex(line))) ) { ((quirks & MBOXQUIRK_TBIRD) && minifromregex(line))) ) {
LOGDEB0("MimeHandlerMbox: Cache: From_ Ok\n"); LOGDEB0("MimeHandlerMbox: Cache: From_ Ok\n");
@ -66,7 +71,7 @@ index 2a0918cf..92ad7e23 100644
msgnum = mtarg -1; msgnum = mtarg -1;
cachefound = true; cachefound = true;
} else { } else {
@@ -414,7 +415,7 @@ bool MimeHandlerMbox::Internal::tryUseCache(int mtarg) @@ -421,7 +422,7 @@ bool MimeHandlerMbox::Internal::tryUseCache(int mtarg)
out: out:
if (!cachefound) { if (!cachefound) {
// No cached result: scan. // No cached result: scan.
@ -75,7 +80,7 @@ index 2a0918cf..92ad7e23 100644
msgnum = 0; msgnum = 0;
} }
return cachefound; return cachefound;
@@ -422,7 +423,7 @@ out: @@ -429,7 +430,7 @@ out:
bool MimeHandlerMbox::next_document() bool MimeHandlerMbox::next_document()
{ {
@ -84,7 +89,7 @@ index 2a0918cf..92ad7e23 100644
LOGERR("MimeHandlerMbox::next_document: not open\n"); LOGERR("MimeHandlerMbox::next_document: not open\n");
return false; return false;
} }
@@ -458,10 +459,10 @@ bool MimeHandlerMbox::next_document() @@ -465,10 +466,10 @@ bool MimeHandlerMbox::next_document()
msgtxt.erase(); msgtxt.erase();
string line; string line;
for (;;) { for (;;) {