On Sat 21 Dec 2013 at 01:33:27 +0100, Rhialto wrote: > Thanks, that compiles and runs (I did a quick check). > I'll pass on your changes to the pkgsrc folk after I check if they need > to be adjusted to version 0.139.
And now they are pestering me again with more similar patches :-) Apparently the same thing occurs a few more times in the current git version. Here are patches they prepared. They look similar in approach as your previous fix. Fix build with libc++. From joerg@ --- pan/data-impl/article-filter.cc.orig 2013-12-21 12:38:33.000000000 +0000 +++ pan/data-impl/article-filter.cc @@ -62,10 +62,10 @@ ArticleFilter :: test_article (const Dat { case FilterInfo::AGGREGATE_AND: pass = true; - foreach_const (FilterInfo::aggregates_t, criteria._aggregates, it) { + foreach_const (FilterInfo::aggregatesp_t, criteria._aggregates, it) { // assume test passes if test needs body but article not cached - if (!it->_needs_body || cache.contains(article.message_id) ) - if (!test_article (data, *it, group, article)) { + if (!(*it)->_needs_body || cache.contains(article.message_id) ) + if (!test_article (data, **it, group, article)) { pass = false; break; } @@ -77,10 +77,10 @@ ArticleFilter :: test_article (const Dat pass = true; else { pass = false; - foreach_const (FilterInfo::aggregates_t, criteria._aggregates, it) { + foreach_const (FilterInfo::aggregatesp_t, criteria._aggregates, it) { // assume test fails if test needs body but article not cached - if (!it->_needs_body || cache.contains(article.message_id) ) - if (test_article (data, *it, group, article)) { + if (!(*it)->_needs_body || cache.contains(article.message_id) ) + if (test_article (data, **it, group, article)) { pass = true; break; } $NetBSD$ Fix build with libc++. From joerg@ --- pan/data-impl/groups.cc.orig 2013-12-21 12:39:52.000000000 +0000 +++ pan/data-impl/groups.cc @@ -81,7 +81,7 @@ namespace } } -#include <ext/algorithm> +#include <algorithm> void DataImpl :: load_newsrc (const Quark & server, $NetBSD$ Fix build with libc++. From joerg@ --- pan/data-impl/rules-filter.cc.orig 2013-12-21 12:39:24.000000000 +0000 +++ pan/data-impl/rules-filter.cc @@ -62,8 +62,8 @@ RulesFilter :: test_article ( Data { case RulesInfo::AGGREGATE__AND: pass = true; - foreach (RulesInfo::aggregates_t, rules._aggregates, it) - test_article (data, *it, group, article); + foreach (RulesInfo::aggregatesp_t, rules._aggregates, it) + test_article (data, **it, group, article); break; case RulesInfo::AGGREGATE__OR: @@ -71,8 +71,8 @@ RulesFilter :: test_article ( Data pass = true; else { pass = false; - foreach (RulesInfo::aggregates_t, rules._aggregates, it) { - if (test_article (data, *it, group, article)) { + foreach (RulesInfo::aggregatesp_t, rules._aggregates, it) { + if (test_article (data, **it, group, article)) { pass = true; break; } $NetBSD$ Fix build with libc++. From joerg@ --- pan/gui/header-pane.cc.orig 2013-12-25 11:05:22.000000000 +0000 +++ pan/gui/header-pane.cc @@ -1353,26 +1353,29 @@ HeaderPane :: rebuild_rules (bool enable RulesInfo &r (_rules); r.set_type_aggregate_and (); - RulesInfo tmp; + RulesInfo *tmp; std::pair<int,int> res; + tmp = new RulesInfo; res = get_int_from_rules_str(_prefs.get_string("rules-delete-value", "never")); - tmp.set_type_delete_b (res.first, res.second); + tmp->set_type_delete_b (res.first, res.second); r._aggregates.push_back (tmp); + tmp = new RulesInfo; res = get_int_from_rules_str(_prefs.get_string("rules-mark-read-value", "never")); - tmp.set_type_mark_read_b (res.first, res.second); + tmp->set_type_mark_read_b (res.first, res.second); r._aggregates.push_back (tmp); + tmp = new RulesInfo; res = get_int_from_rules_str(_prefs.get_string("rules-autocache-value", "never")); - tmp.set_type_autocache_b (res.first, res.second); + tmp->set_type_autocache_b (res.first, res.second); r._aggregates.push_back (tmp); + tmp = new RulesInfo; res = get_int_from_rules_str(_prefs.get_string("rules-auto-dl-value", "never")); - tmp.set_type_dl_b (res.first, res.second); - r._aggregates.push_back (tmp); - + tmp->set_type_dl_b (res.first, res.second); + r._aggregates.push_back (tmp); } void @@ -1390,62 +1393,62 @@ HeaderPane :: rebuild_filter (const std: f.set_type_aggregate_and (); // entry field filter... - FilterInfo entry_filter; if (!text.empty()) { + FilterInfo *entry_filter = new FilterInfo; if (mode == SUBJECT) - entry_filter.set_type_text ("Subject", d); + entry_filter->set_type_text ("Subject", d); else if (mode == AUTHOR) - entry_filter.set_type_text ("From", d); + entry_filter->set_type_text ("From", d); else if (mode == MESSAGE_ID) - entry_filter.set_type_text ("Message-ID", d); + entry_filter->set_type_text ("Message-ID", d); else if (mode == SUBJECT_OR_AUTHOR) { - FilterInfo f1, f2; - entry_filter.set_type_aggregate_or (); - f1.set_type_text ("Subject", d); - f2.set_type_text ("From", d); - entry_filter._aggregates.push_back (f1); - entry_filter._aggregates.push_back (f2); + FilterInfo *f1 = new FilterInfo, *f2 = new FilterInfo; + entry_filter->set_type_aggregate_or (); + f1->set_type_text ("Subject", d); + f2->set_type_text ("From", d); + entry_filter->_aggregates.push_back (f1); + entry_filter->_aggregates.push_back (f2); } else if (mode == SUBJECT_OR_AUTHOR_REGEX) { - FilterInfo f1, f2; - entry_filter.set_type_aggregate_or (); + FilterInfo *f1 = new FilterInfo, *f2 = new FilterInfo; + entry_filter->set_type_aggregate_or (); d.type = TextMatch::REGEX; - f1.set_type_text ("Subject", d); - f2.set_type_text ("From", d); - entry_filter._aggregates.push_back (f1); - entry_filter._aggregates.push_back (f2); + f1->set_type_text ("Subject", d); + f2->set_type_text ("From", d); + entry_filter->_aggregates.push_back (f1); + entry_filter->_aggregates.push_back (f2); } f._aggregates.push_back (entry_filter); } if (_action_manager.is_action_active("match-only-read-articles")) { //std::cerr << LINE_ID << " AND is read" << std::endl; - FilterInfo tmp; - tmp.set_type_is_read (); + FilterInfo *tmp = new FilterInfo; + tmp->set_type_is_read (); f._aggregates.push_back (tmp); } if (_action_manager.is_action_active("match-only-unread-articles")) { //std::cerr << LINE_ID << " AND is unread" << std::endl; - FilterInfo tmp; - tmp.set_type_is_unread (); + FilterInfo *tmp = new FilterInfo; + tmp->set_type_is_unread (); f._aggregates.push_back (tmp); } if (_action_manager.is_action_active("match-only-cached-articles")) { //std::cerr << LINE_ID << " AND is cached" << std::endl; - FilterInfo tmp; - tmp.set_type_cached (); + FilterInfo *tmp = new FilterInfo; + tmp->set_type_cached (); f._aggregates.push_back (tmp); } if (_action_manager.is_action_active("match-only-binary-articles")) { //std::cerr << LINE_ID << " AND has an attachment" << std::endl; - FilterInfo tmp; - tmp.set_type_binary (); + FilterInfo *tmp = new FilterInfo; + tmp->set_type_binary (); f._aggregates.push_back (tmp); } if (_action_manager.is_action_active("match-only-my-articles")) { //std::cerr << LINE_ID << " AND was posted by me" << std::endl; - FilterInfo tmp; - tmp.set_type_posted_by_me (); + FilterInfo *tmp = new FilterInfo; + tmp->set_type_posted_by_me (); f._aggregates.push_back (tmp); } @@ -1474,7 +1477,7 @@ HeaderPane :: rebuild_filter (const std: //for (size_t i=0; i<ranges.size(); ++i) std::cerr << LINE_ID << " range [" << ranges[i].first << "..." << ranges[i].second << "]" << std::endl; - std::deque<FilterInfo> filters; + FilterInfo::aggregatesp_t filters; for (size_t i=0; i<ranges.size(); ++i) { const range_t& range (ranges[i]); const bool low_bound (range.first == INT_MIN); @@ -1482,22 +1485,24 @@ HeaderPane :: rebuild_filter (const std: if (low_bound && hi_bound) { // everything matches -- do nothing } else if (hi_bound) { - FilterInfo tmp; - tmp.set_type_score_ge (range.first); + FilterInfo *tmp = new FilterInfo; + tmp->set_type_score_ge (range.first); //std::cerr << LINE_ID << " AND has a score >= " << range.first << std::endl; filters.push_back (tmp); } else if (low_bound) { - FilterInfo tmp; - tmp.set_type_score_le (range.second); + FilterInfo *tmp = new FilterInfo; + tmp->set_type_score_le (range.second); //std::cerr << LINE_ID << " AND has a score <= " << range.second << std::endl; filters.push_back (tmp); } else { // not bound on either side; need an aggregate - FilterInfo s, tmp; - s.set_type_aggregate_and (); - tmp.set_type_score_ge (range.first); - s._aggregates.push_back (tmp); - tmp.set_type_score_le (range.second); - s._aggregates.push_back (tmp); + FilterInfo *tmp, *s = new FilterInfo; + s->set_type_aggregate_and (); + tmp = new FilterInfo; + tmp->set_type_score_ge (range.first); + s->_aggregates.push_back (tmp); + tmp = new FilterInfo; + tmp->set_type_score_le (range.second); + s->_aggregates.push_back (tmp); //std::cerr << LINE_ID << " AND has a in [" << range.first << "..." << range.second << ']' << std::endl; filters.push_back (s); } @@ -1505,9 +1510,9 @@ HeaderPane :: rebuild_filter (const std: if (filters.size()==1) // can fit in an `and' parent f._aggregates.push_back (filters[0]); else if (!filters.empty()) { // needs an `or' parent - FilterInfo s; - s.set_type_aggregate_or (); - s._aggregates.swap (filters); + FilterInfo *s = new FilterInfo; + s->set_type_aggregate_or (); + s->_aggregates.swap (filters); f._aggregates.push_back (s); } //std::cerr << LINE_ID << " number of filters: " << f._aggregates.size() << std::endl; $NetBSD$ Fix build with libc++. From joerg@ --- pan/usenet-utils/filter-info.cc.orig 2013-12-21 12:32:25.000000000 +0000 +++ pan/usenet-utils/filter-info.cc @@ -38,6 +38,8 @@ FilterInfo :: clear () _ge = 0; _header.clear (); _text.clear (); + foreach (aggregatesp_t, _aggregates, it) + delete *it; _aggregates.clear (); _negate = false; _needs_body = false; @@ -284,29 +286,29 @@ FilterInfo :: describe () const { ret = _("Any of these tests fail:"); ret += "\n"; - foreach_const (aggregates_t, _aggregates, it) - ret += " " + it->describe() + "\n"; + foreach_const (aggregatesp_t, _aggregates, it) + ret += " " + (*it)->describe() + "\n"; } else if (_type==AGGREGATE_AND) { ret = _("All of these tests pass:"); ret += "\n"; - foreach_const (aggregates_t, _aggregates, it) - ret += " " + it->describe() + "\n"; + foreach_const (aggregatesp_t, _aggregates, it) + ret += " " + (*it)->describe() + "\n"; } else if (_type==AGGREGATE_OR && _negate) { ret = _("None of these tests pass:"); ret += "\n"; - foreach_const (aggregates_t, _aggregates, it) - ret += " " + it->describe() + "\n"; + foreach_const (aggregatesp_t, _aggregates, it) + ret += " " + (*it)->describe() + "\n"; } else if (_type==AGGREGATE_OR) { ret = _("Any of these tests pass:"); ret += "\n"; - foreach_const (aggregates_t, _aggregates, it) - ret += " " + it->describe() + "\n"; + foreach_const (aggregatesp_t, _aggregates, it) + ret += " " + (*it)->describe() + "\n"; } return ret; $NetBSD$ Fix build with libc++. From joerg@ --- pan/usenet-utils/filter-info.h.orig 2013-12-21 12:30:49.000000000 +0000 +++ pan/usenet-utils/filter-info.h @@ -55,7 +55,10 @@ namespace pan public: bool empty() const { return _type == TYPE_ERR; } FilterInfo () { clear(); } - virtual ~FilterInfo () { } + virtual ~FilterInfo () { + foreach (aggregatesp_t, _aggregates, it) + delete *it; + } public: @@ -73,11 +76,11 @@ namespace pan TextMatch _text; /** Convenience typedef. */ - typedef std::deque<FilterInfo> aggregates_t; + typedef std::deque<FilterInfo *> aggregatesp_t; /** When `_type' is AGGREGATE_OR or AGGREGATE_AND, these are the filters being or'ed or and'ed together. */ - aggregates_t _aggregates; + aggregatesp_t _aggregates; /** When this is true, the results of the test should be negated. */ bool _negate; $NetBSD$ Fix build with libc++. From joerg@ --- pan/usenet-utils/rules-info.h.orig 2013-12-21 12:31:57.000000000 +0000 +++ pan/usenet-utils/rules-info.h @@ -54,11 +54,11 @@ namespace pan virtual ~RulesInfo () { } /** Convenience typedef. */ - typedef std::deque<RulesInfo> aggregates_t; + typedef std::deque<RulesInfo *> aggregatesp_t; /** When `_type' is AGGREGATE_OR or AGGREGATE_AND, these are the filters being or'ed or and'ed together. */ - aggregates_t _aggregates; + aggregatesp_t _aggregates; /** When this is true, the results of the test should be negated. */ bool _negate; $NetBSD$ Fix build with libc++. From joerg@ --- pan/usenet-utils/scorefile.cc.orig 2013-12-21 12:33:23.000000000 +0000 +++ pan/usenet-utils/scorefile.cc @@ -103,7 +103,7 @@ struct pan::Scorefile::ParseContext test = &item->test; if (test) foreach_const (std::vector<int>, test_offsets, it) - test = &test->_aggregates[*it]; + test = test->_aggregates[*it]; return test; } @@ -258,11 +258,11 @@ Scorefile :: parse_file (ParseContext& c line.eat_chars (1); // skip past the '{' const bool only_one_test_must_pass (line.len>=2 && !memcmp(line.str,"::",2)); - FilterInfo test; + FilterInfo *test = new FilterInfo; if (only_one_test_must_pass) - test.set_type_aggregate_or (); + test->set_type_aggregate_or (); else - test.set_type_aggregate_and (); + test->set_type_aggregate_and (); FilterInfo * parent (context.get_current_test ()); context.test_offsets.push_back (parent->_aggregates.size()); @@ -331,9 +331,9 @@ Scorefile :: parse_file (ParseContext& c StringView val (line.substr (delimiter+1, 0)); val.trim (); - FilterInfo::aggregates_t& aggregates (context.get_current_test()->_aggregates); + FilterInfo::aggregatesp_t& aggregates (context.get_current_test()->_aggregates); aggregates.resize (aggregates.size() + 1); - FilterInfo& test (aggregates.back()); + FilterInfo* test (aggregates.back()); if (!key.strncasecmp ("Lines", 5)) { @@ -341,26 +341,26 @@ Scorefile :: parse_file (ParseContext& c // "~Lines: 5" matches articles with <= 5 lines. const unsigned long gt = strtoul (val.str, NULL, 10); const unsigned long ge = gt + 1; - test.set_type_line_count_ge (ge); + test->set_type_line_count_ge (ge); } else if (!key.strncasecmp("Bytes", 5)) { // bytes works the same way as lines. const unsigned long gt = strtoul (val.str, NULL, 10); const unsigned long ge = gt + 1; - test.set_type_byte_count_ge (ge); + test->set_type_byte_count_ge (ge); } else if (!key.strncasecmp ("Age", 3)) { // age works differently from Lines and Bytes: // "Age: 7" matches articles <= 7 days old. const unsigned long le = strtoul (val.str, NULL, 10); - test.set_type_days_old_le (le); + test->set_type_days_old_le (le); negate = !negate; // double negative: le is a negate state } else if (!key.strncasecmp ("Has-Body", 8)) { - test.set_type_cached (); + test->set_type_cached (); if (val == "0") negate = !negate; } @@ -370,9 +370,9 @@ Scorefile :: parse_file (ParseContext& c d.type = TextMatch::REGEX; d.case_sensitive = case_sensitive; d.text.assign (val.str, val.len); - test.set_type_text (key, d); + test->set_type_text (key, d); } - test._negate = negate; + test->_negate = negate; } // error @@ -396,9 +396,9 @@ namespace return; if (test._aggregates.size() == 1) - test = test._aggregates[0]; - else foreach (FilterInfo::aggregates_t, test._aggregates, it) - normalize_test (*it); + test = *test._aggregates[0]; + else foreach (FilterInfo::aggregatesp_t, test._aggregates, it) + normalize_test (**it); } } -Olaf. -- ___ Olaf 'Rhialto' Seibert -- The Doctor: No, 'eureka' is Greek for \X/ rhialto/at/xs4all.nl -- 'this bath is too hot.'
pgpN03pNiKuKb.pgp
Description: PGP signature
_______________________________________________ Pan-users mailing list Pan-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/pan-users