From b9bac79a8c7b3efb4828df476a813c9390dc7012 Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Fri, 12 May 2017 16:20:47 +0200 Subject: [PATCH] Improved const correctness, there are no functional changes. --- lib/path.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/path.cpp b/lib/path.cpp index d299182e9..a6a4cef15 100644 --- a/lib/path.cpp +++ b/lib/path.cpp @@ -46,11 +46,11 @@ static bool caseInsensitiveFilesystem() std::string Path::toNativeSeparators(std::string path) { #if defined(_WIN32) - char separ = '/'; - char native = '\\'; + const char separ = '/'; + const char native = '\\'; #else - char separ = '\\'; - char native = '/'; + const char separ = '\\'; + const char native = '/'; #endif std::replace(path.begin(), path.end(), separ, native); return path; @@ -58,8 +58,8 @@ std::string Path::toNativeSeparators(std::string path) std::string Path::fromNativeSeparators(std::string path) { - char nonnative = '\\'; - char newsepar = '/'; + const char nonnative = '\\'; + const char newsepar = '/'; std::replace(path.begin(), path.end(), nonnative, newsepar); return path; } @@ -130,7 +130,7 @@ std::string Path::simplifyPath(std::string originalPath) std::string Path::getPathFromFilename(const std::string &filename) { - std::size_t pos = filename.find_last_of("\\/"); + const std::size_t pos = filename.find_last_of("\\/"); if (pos != std::string::npos) return filename.substr(0, 1 + pos);