From e9fefcac46d94f31542dd2d83bcdac483dbc779a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 30 Mar 2018 21:04:32 +0200 Subject: [PATCH] gcc 4.5 compatibility --- cli/cmdlineparser.cpp | 6 +++--- cli/filelister.cpp | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index 96a5dc736..94571984d 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -77,7 +77,7 @@ static void AddInclPathsToList(const std::string& FileList, std::listpush_back(PathName); @@ -426,7 +426,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) path = Path::fromNativeSeparators(path); // If path doesn't end with / or \, add it - if (path.back() != '/') + if (!endsWith(path,'/')) path += '/'; _settings->includePaths.push_back(path); @@ -480,7 +480,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) if (FileLister::isDirectory(path)) { // If directory name doesn't end with / or \, add it - if (path.back() != '/') + if (!endsWith(path, '/')) path += '/'; } _ignoredPaths.push_back(path); diff --git a/cli/filelister.cpp b/cli/filelister.cpp index 5eb9fb8d7..fe5a45317 100644 --- a/cli/filelister.cpp +++ b/cli/filelister.cpp @@ -20,6 +20,7 @@ #include "path.h" #include "pathmatch.h" +#include "utils.h" #include #include @@ -228,7 +229,7 @@ void FileLister::addFiles(std::map &files, const std:: { if (!path.empty()) { std::string corrected_path = path; - if (corrected_path.back() == '/') + if (endsWith(corrected_path, '/')) corrected_path.erase(corrected_path.end() - 1); addFiles2(files, corrected_path, extra, recursive, ignored);