aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-06-03 15:23:58 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-06-18 15:05:38 +0300
commita4b49e376b6ccac63c84ccb15530c13d3452fecd (patch)
treebcf2c9d58780c6a6f29e4faeac9f921a4d99b3fe
parent0ae43c45e0d4bb1c4aefb75967a020c84d62d4f5 (diff)
Fix bug in basic_path::sub(), sup()
-rw-r--r--butl/path.ixx9
1 files changed, 6 insertions, 3 deletions
diff --git a/butl/path.ixx b/butl/path.ixx
index f933bd3..c2047eb 100644
--- a/butl/path.ixx
+++ b/butl/path.ixx
@@ -87,7 +87,8 @@ namespace butl
// The second condition guards against the /foo-bar vs /foo case.
//
- return m >= n && this->path_.compare (0, n, p.path_) == 0 &&
+ return m >= n &&
+ traits::compare (this->path_.c_str (), n, p.path_.c_str (), n) == 0 &&
(traits::is_separator (p.path_.back ()) || // p ends with a separator
m == n || // *this == p
traits::is_separator (this->path_[n])); // next char is a separator
@@ -106,8 +107,10 @@ namespace butl
// The second condition guards against the /foo-bar vs bar case.
//
- return m >= n && this->path_.compare (m - n, n, p.path_) == 0 &&
- (m == n || // *this == p
+ return m >= n &&
+ traits::compare (
+ this->path_.c_str () + m - n, n, p.path_.c_str (), n) == 0 &&
+ (m == n || // *this == p
traits::is_separator (this->path_[m - n - 1])); // prev char separator
}