Fix build with libc++ by doing the sorting explicitly. Bump revision.

This commit is contained in:
joerg 2014-01-20 19:29:34 +00:00
parent c0806599cc
commit ed464822c2
4 changed files with 175 additions and 18 deletions

View file

@ -1,6 +1,7 @@
# $NetBSD: Makefile,v 1.43 2013/06/28 15:03:55 ryoon Exp $ # $NetBSD: Makefile,v 1.44 2014/01/20 19:29:34 joerg Exp $
DISTNAME= dar-2.4.10 DISTNAME= dar-2.4.10
PKGREVISION= 1
CATEGORIES= archivers sysutils CATEGORIES= archivers sysutils
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=dar/} MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=dar/}

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.28 2013/06/28 15:03:55 ryoon Exp $ $NetBSD: distinfo,v 1.29 2014/01/20 19:29:34 joerg Exp $
SHA1 (dar-2.4.10.tar.gz) = bf02ba10bfcd2ad959017706f167fc390aafe932 SHA1 (dar-2.4.10.tar.gz) = bf02ba10bfcd2ad959017706f167fc390aafe932
RMD160 (dar-2.4.10.tar.gz) = 26161a09a60e36a3094f94d8831a157b7c3e4d0a RMD160 (dar-2.4.10.tar.gz) = 26161a09a60e36a3094f94d8831a157b7c3e4d0a
@ -6,7 +6,7 @@ Size (dar-2.4.10.tar.gz) = 1760827 bytes
SHA1 (patch-aa) = 734ec162dbc339b2015a169bb9fe723e45d0a29b SHA1 (patch-aa) = 734ec162dbc339b2015a169bb9fe723e45d0a29b
SHA1 (patch-ab) = f07d55861f21545b0ae8ac6b187a94526e44e345 SHA1 (patch-ab) = f07d55861f21545b0ae8ac6b187a94526e44e345
SHA1 (patch-ac) = dcbf4e31071c83a167a60a20e4980b35f055a46e SHA1 (patch-ac) = dcbf4e31071c83a167a60a20e4980b35f055a46e
SHA1 (patch-ad) = df21f72b12ab19123f1c61e8e1645519c43d7f7b SHA1 (patch-ad) = e32c33d5670f39a04f8ceef94d6e9d5a6b524016
SHA1 (patch-ae) = 54220384bf2031df64c38f5abea038382ca37e8e SHA1 (patch-ae) = 54220384bf2031df64c38f5abea038382ca37e8e
SHA1 (patch-af) = 414e58277c946b59f57352e260ac5d49673ef008 SHA1 (patch-af) = 414e58277c946b59f57352e260ac5d49673ef008
SHA1 (patch-src_dar__suite_command__line.cpp) = 63d3004bf7d49277c1508fe5d9ac52ec0d5bf11f SHA1 (patch-src_dar__suite_command__line.cpp) = 63d3004bf7d49277c1508fe5d9ac52ec0d5bf11f
@ -17,8 +17,9 @@ SHA1 (patch-src_dar__suite_line__tools.cpp) = 076c5213aaa3e6dfa471322b6597c0ce8c
SHA1 (patch-src_examples_factoriel.cpp) = 6c9e038b7a3bbfdc96dbbdf1b7e100c159353f87 SHA1 (patch-src_examples_factoriel.cpp) = 6c9e038b7a3bbfdc96dbbdf1b7e100c159353f87
SHA1 (patch-src_examples_formula.cpp) = 583ceeba0a232e657ab0696711f630476ec2e495 SHA1 (patch-src_examples_formula.cpp) = 583ceeba0a232e657ab0696711f630476ec2e495
SHA1 (patch-src_examples_prime.cpp) = 09fc3b96642945042a2d13bb4c1995546cdb7607 SHA1 (patch-src_examples_prime.cpp) = 09fc3b96642945042a2d13bb4c1995546cdb7607
SHA1 (patch-src_libdar_mask__list.hpp) = b16686706cb7ad7065467decfd93271f01d9c663 SHA1 (patch-src_libdar_mask__list.hpp) = b3b6eaa36875784432e53d5dfbfb33d7623054a3
SHA1 (patch-src_libdar_secu__string.hpp) = 6793cb79bf5f8c4d3ac83ba4f2cd2fd9f452afb1 SHA1 (patch-src_libdar_secu__string.hpp) = 6793cb79bf5f8c4d3ac83ba4f2cd2fd9f452afb1
SHA1 (patch-src_testing_Makefile.in) = e8d48b5fa9fcdd2f5bef3fca240850c0787f6647
SHA1 (patch-src_testing_test__catalogue.cpp) = 2d1a8299f01776e3fa9996819aa8be523b73b4cc SHA1 (patch-src_testing_test__catalogue.cpp) = 2d1a8299f01776e3fa9996819aa8be523b73b4cc
SHA1 (patch-src_testing_test__deci.cpp) = 053e2123a5219dc0cb827743e348f9463ce84615 SHA1 (patch-src_testing_test__deci.cpp) = 053e2123a5219dc0cb827743e348f9463ce84615
SHA1 (patch-src_testing_test__escape.cpp) = b7959b2e5e3675d2e64f232face3b18384f8e3da SHA1 (patch-src_testing_test__escape.cpp) = b7959b2e5e3675d2e64f232face3b18384f8e3da

View file

@ -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(). 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.orig 2011-02-11 20:23:42.000000000 +0000
+++ src/libdar/mask_list.cpp +++ src/libdar/mask_list.cpp
@@ -200,7 +200,10 @@ namespace libdar @@ -55,6 +55,21 @@ using namespace std;
my_tmp.unique(); // remove duplicates 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 // converting the sorted list to vector, to get the indexing feature of this type
- contenu.assign(my_tmp.begin(), my_tmp.end()); - contenu.assign(my_tmp.begin(), my_tmp.end());
+ contenu.clear(); + 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); + contenu.push_back(*it);
+ +
taille = contenu.size(); taille = contenu.size();
if(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)); 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

View file

@ -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 +++ src/libdar/mask_list.hpp
@@ -80,7 +80,7 @@ namespace libdar @@ -70,46 +70,10 @@ namespace libdar
class my_char
{ private:
public:
- // 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() { val = 0; };
+ my_char() = default; - my_char(const char x) : val(x) {};
my_char(const char x) : val(x) {}; - bool operator < (const my_char & x) const
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);
};
/// @}