gcc 4.5 compatibility

This commit is contained in:
Daniel Marjamäki 2018-03-30 21:04:32 +02:00
parent 95ccd9483b
commit e9fefcac46
2 changed files with 5 additions and 4 deletions

View File

@ -77,7 +77,7 @@ static void AddInclPathsToList(const std::string& FileList, std::list<std::strin
PathName = Path::fromNativeSeparators(PathName);
// If path doesn't end with / or \, add it
if (PathName.back() != '/')
if (!endsWith(PathName, '/'))
PathName += '/';
PathNames->push_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);

View File

@ -20,6 +20,7 @@
#include "path.h"
#include "pathmatch.h"
#include "utils.h"
#include <cstddef>
#include <cstring>
@ -228,7 +229,7 @@ void FileLister::addFiles(std::map<std::string, std::size_t> &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);