diff options
author | joerg <joerg> | 2014-01-20 19:29:34 +0000 |
---|---|---|
committer | joerg <joerg> | 2014-01-20 19:29:34 +0000 |
commit | 8e34cd0d12cc839889b4ef95a78b5badd6c271fa (patch) | |
tree | e5149918f3a9427821dc63b831a082295271abb2 /archivers/dar/patches | |
parent | ff02f861ff09c351ab956d976e9a5023ad00e8dd (diff) | |
download | pkgsrc-8e34cd0d12cc839889b4ef95a78b5badd6c271fa.tar.gz |
Fix build with libc++ by doing the sorting explicitly. Bump revision.
Diffstat (limited to 'archivers/dar/patches')
-rw-r--r-- | archivers/dar/patches/patch-ad | 124 | ||||
-rw-r--r-- | archivers/dar/patches/patch-src_libdar_mask__list.hpp | 59 |
2 files changed, 169 insertions, 14 deletions
diff --git a/archivers/dar/patches/patch-ad b/archivers/dar/patches/patch-ad index f91ddffa574..bf5d1564af0 100644 --- a/archivers/dar/patches/patch-ad +++ b/archivers/dar/patches/patch-ad @@ -1,18 +1,134 @@ -$NetBSD: patch-ad,v 1.6 2011/08/20 16:02:23 cheusov Exp $ +$NetBSD: patch-ad,v 1.7 2014/01/20 19:29:34 joerg Exp $ On Solaris 10 with SunPro, vector<> does not have a method assign(). --- src/libdar/mask_list.cpp.orig 2011-02-11 20:23:42.000000000 +0000 +++ src/libdar/mask_list.cpp -@@ -200,7 +200,10 @@ namespace libdar - my_tmp.unique(); // remove duplicates +@@ -55,6 +55,21 @@ using namespace std; + namespace libdar + { + ++static bool cmp_strings(const std::string &x, const std::string &y) ++{ ++ size_t i; ++ for (i = 0; i < x.size(); ++i) { ++ if (x[i] == y[i]) ++ continue; ++ if(x[i] == '/') ++ return true; ++ if(y[i] == '/') ++ return false; ++ return x[i] < y[i]; ++ } ++ return false; ++} ++ + mask_list::mask_list(const string & filename_list_st, bool case_sensit, const path & prefix_t, bool include) + { + NLS_SWAP_IN; +@@ -194,12 +209,14 @@ namespace libdar + + // we use a temporary list of string of my_chart to use + // the lexicographic sorting with having the / as the lowest character +- list<basic_string<my_char> > my_tmp = convert_list_string_char(tmp); +- my_tmp.sort(); // sort the list ( using the string's < operator over "my_char" ) +- my_tmp.unique(); // remove duplicates ++ tmp.sort(cmp_strings); ++ tmp.unique(); // converting the sorted list to vector, to get the indexing feature of this type - contenu.assign(my_tmp.begin(), my_tmp.end()); + contenu.clear(); -+ for (list< basic_string<my_char> >::const_iterator it = my_tmp.begin(); it != my_tmp.end(); it++) ++ for (list< string >::const_iterator it = tmp.begin(); it != tmp.end(); it++) + contenu.push_back(*it); + taille = contenu.size(); if(taille < contenu.size()) throw Erange("mask_list::mask_list", tools_printf(gettext("Too much line in file %S (integer overflow)"), &filename_list_st)); +@@ -218,23 +235,23 @@ namespace libdar + return false; + + U_I min = 0, max = taille-1, tmp; +- basic_string<my_char> target; ++ string target; + bool ret; + + if(case_s) +- target = convert_string_char(expression); ++ target = expression; + else + { + string hidden = expression; + tools_to_upper(hidden); +- target = convert_string_char(hidden); ++ target = hidden; + } + + // divide & conquer algorithm on a sorted list (aka binary search) + while(max - min > 1) + { + tmp = (min + max)/2; +- if(contenu[tmp] < target) ++ if(cmp_strings(contenu[tmp], target)) + min = tmp; + else + if(contenu[tmp] == target) +@@ -246,57 +263,11 @@ namespace libdar + ret = contenu[max] == target || contenu[min] == target; + if(including && !ret) // if including files, we must also include directories leading to a listed file + { +- string c_max = convert_string_my_char(contenu[max]); ++ string c_max = contenu[max]; + ret = path(c_max).is_subdir_of(expression, case_s); + } + + return ret; + } + +- +- //////// private routines implementation +- +- +- list<basic_string<mask_list::my_char> > mask_list::convert_list_string_char(const list<string> & src) +- { +- list<basic_string<my_char> > ret; +- list<string>::const_iterator it = src.begin(); +- +- while(it != src.end()) +- { +- ret.push_back(convert_string_char(*it)); +- ++it; +- } +- return ret; +- } +- +- basic_string<mask_list::my_char> mask_list::convert_string_char(const string & src) +- { +- basic_string<my_char> ret; +- +- string::const_iterator ut = src.begin(); +- while(ut != src.end()) +- { +- ret += my_char(*ut); +- ++ut; +- } +- +- return ret; +- } +- +- string mask_list::convert_string_my_char(const basic_string<mask_list::my_char> & src) +- { +- string ret; +- +- basic_string<my_char>::const_iterator ut = src.begin(); +- while(ut != src.end()) +- { +- ret += char(*ut); +- ++ut; +- } +- +- return ret; +- } +- +- + } // end of namespace diff --git a/archivers/dar/patches/patch-src_libdar_mask__list.hpp b/archivers/dar/patches/patch-src_libdar_mask__list.hpp index 22b143b176f..eb04377e9a3 100644 --- a/archivers/dar/patches/patch-src_libdar_mask__list.hpp +++ b/archivers/dar/patches/patch-src_libdar_mask__list.hpp @@ -1,13 +1,52 @@ -$NetBSD: patch-src_libdar_mask__list.hpp,v 1.1 2013/06/26 15:49:31 joerg Exp $ +$NetBSD: patch-src_libdar_mask__list.hpp,v 1.2 2014/01/20 19:29:34 joerg Exp $ ---- src/libdar/mask_list.hpp.orig 2013-06-20 19:11:02.000000000 +0000 +--- src/libdar/mask_list.hpp.orig 2012-11-30 20:51:11.000000000 +0000 +++ src/libdar/mask_list.hpp -@@ -80,7 +80,7 @@ namespace libdar - class my_char - { - public: +@@ -70,46 +70,10 @@ namespace libdar + + private: + +- // we need to change to lexicographical order relationship for the '/' character be the most lower of all. This way +- // the first entry listed from a set a file sharing the same first characters will be the one corresponding +- // to the directory with this common prefix. +- +- class my_char +- { +- public: - my_char() { val = 0; }; -+ my_char() = default; - my_char(const char x) : val(x) {}; - bool operator < (const my_char & x) const - { +- my_char(const char x) : val(x) {}; +- bool operator < (const my_char & x) const +- { +- if(val == '/') +- if(x.val == '/') +- return false; +- else +- return true; +- else +- if(x.val == '/') +- return false; +- else +- return val < x.val; +- }; +- +- operator char() const +- { +- return val; +- }; +- +- private: +- char val; +- }; +- +- std::vector <std::basic_string<my_char> > contenu; ++ std::vector <std::string > contenu; + U_I taille; + bool case_s; + bool including; // mask is used for including files (not for excluding files) +- +- static std::list<std::basic_string<my_char> > convert_list_string_char(const std::list<std::string> & src); +- static std::basic_string<my_char> convert_string_char(const std::string & src); +- static std::string convert_string_my_char(const std::basic_string<my_char> & src); + }; + + /// @} |