Skip to content

Commit

Permalink
Fix bad iterator logic in aliSync
Browse files Browse the repository at this point in the history
  • Loading branch information
ktf committed Dec 7, 2016
1 parent 10b3083 commit 6712a5a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion STEER/Utilities/alisync.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@ struct NotMatchPathSeparator
};

static std::string trimTrailingSlashes(const std::string &s) {
if (s == "/")
return s;

std::string o = s;
// Find the last slash on the right boundary of the string
// - if found trim all the trailing slashes
// - if not found contribute to memory churn.
std::string::reverse_iterator lsi = std::find_if(o.rbegin(),
o.rend(),
NotMatchPathSeparator());
if (lsi != o.rend())
if (lsi != o.rbegin())
o.erase(lsi.base());
return o;
}
Expand Down

0 comments on commit 6712a5a

Please sign in to comment.