From fb1876dfd09ba606a74f236f21eea1f1bb01e142 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Thu, 25 Nov 2021 09:26:11 +0100 Subject: [PATCH] fix jessie mbox patch for 1.31.4 --- .../mbox-use-streamptr-for-jessie.diff | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/packaging/debian/debian/patches/mbox-use-streamptr-for-jessie.diff b/packaging/debian/debian/patches/mbox-use-streamptr-for-jessie.diff index f5791008..5969f5b9 100644 --- a/packaging/debian/debian/patches/mbox-use-streamptr-for-jessie.diff +++ b/packaging/debian/debian/patches/mbox-use-streamptr-for-jessie.diff @@ -1,5 +1,5 @@ -diff --git a/internfile/mh_mbox.cpp b/srcinternfile/mh_mbox.cpp -index 2a0918cf..92ad7e23 100644 +diff --git a/src/internfile/mh_mbox.cpp b/src/internfile/mh_mbox.cpp +index c77d42c8..bdebbac6 100644 --- a/internfile/mh_mbox.cpp +++ b/internfile/mh_mbox.cpp @@ -27,6 +27,7 @@ @@ -19,27 +19,32 @@ index 2a0918cf..92ad7e23 100644 int msgnum{0}; // Current message number in folder. Starts at 1 int64_t lineno{0}; // debug int64_t fsize{0}; -@@ -321,7 +322,6 @@ void MimeHandlerMbox::clear_impl() - { - m->fn.erase(); - m->ipath.erase(); -- m->instream = ifstream(); +@@ -324,10 +325,10 @@ void MimeHandlerMbox::clear_impl() + + // We used to use m->instream = ifstream() which fails with some compilers, as the copy + // constructor is marked deleted in standard c++ (works with many compilers though). +- 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->lineno = 0; - m->fsize = 0; -@@ -339,8 +339,9 @@ bool MimeHandlerMbox::set_document_file_impl(const string&, const string &fn) +@@ -346,8 +347,8 @@ bool MimeHandlerMbox::set_document_file_impl(const string&, const string &fn) LOGDEB("MimeHandlerMbox::set_document_file(" << fn << ")\n"); clear_impl(); 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()) { -+ m->instream = std::unique_ptr( -+ new ifstream(fn.c_str(), std::ifstream::binary)); ++ m->instream->open(fn.c_str(), std::ifstream::binary); + if (!m->instream->good()) { LOGSYSERR("MimeHandlerMail::set_document_file", "ifstream", fn); return false; } -@@ -389,13 +390,13 @@ bool MimeHandlerMbox::Internal::tryUseCache(int mtarg) +@@ -396,13 +397,13 @@ bool MimeHandlerMbox::Internal::tryUseCache(int mtarg) fsize)) < 0) { goto out; } @@ -57,7 +62,7 @@ index 2a0918cf..92ad7e23 100644 LOGSYSERR("tryUseCache", "getline", ""); 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) || ((quirks & MBOXQUIRK_TBIRD) && minifromregex(line))) ) { LOGDEB0("MimeHandlerMbox: Cache: From_ Ok\n"); @@ -66,7 +71,7 @@ index 2a0918cf..92ad7e23 100644 msgnum = mtarg -1; cachefound = true; } else { -@@ -414,7 +415,7 @@ bool MimeHandlerMbox::Internal::tryUseCache(int mtarg) +@@ -421,7 +422,7 @@ bool MimeHandlerMbox::Internal::tryUseCache(int mtarg) out: if (!cachefound) { // No cached result: scan. @@ -75,7 +80,7 @@ index 2a0918cf..92ad7e23 100644 msgnum = 0; } return cachefound; -@@ -422,7 +423,7 @@ out: +@@ -429,7 +430,7 @@ out: bool MimeHandlerMbox::next_document() { @@ -84,7 +89,7 @@ index 2a0918cf..92ad7e23 100644 LOGERR("MimeHandlerMbox::next_document: not open\n"); return false; } -@@ -458,10 +459,10 @@ bool MimeHandlerMbox::next_document() +@@ -465,10 +466,10 @@ bool MimeHandlerMbox::next_document() msgtxt.erase(); string line; for (;;) {