diff --git a/lib/analyzerinfo.cpp b/lib/analyzerinfo.cpp index 74522f4dd..e1d4539d1 100644 --- a/lib/analyzerinfo.cpp +++ b/lib/analyzerinfo.cpp @@ -79,7 +79,7 @@ std::string AnalyzerInformation::getAnalyzerInfoFile(const std::string &buildDir std::string filename = Path::fromNativeSeparators(buildDir); if (filename.back() != '/') filename += '/'; - const std::string::size_type pos = sourcefile.rfind("/"); + const std::string::size_type pos = sourcefile.rfind('/'); if (pos == std::string::npos) filename += sourcefile; else diff --git a/lib/importproject.cpp b/lib/importproject.cpp index 1196cc437..8ef21487d 100644 --- a/lib/importproject.cpp +++ b/lib/importproject.cpp @@ -66,7 +66,7 @@ void ImportProject::FileSettings::setDefines(std::string defs) { while (defs.find(";%(") != std::string::npos) { std::string::size_type pos1 = defs.find(";%("); - std::string::size_type pos2 = defs.find(";", pos1+1); + std::string::size_type pos2 = defs.find(';', pos1+1); defs.erase(pos1, pos2 == std::string::npos ? pos2 : (pos2-pos1)); } while (defs.find(";;") != std::string::npos) @@ -96,7 +96,7 @@ static bool simplifyPathWithVariables(std::string &s, const std::map expanded; std::string::size_type start = 0; while ((start = s.find("$(")) != std::string::npos) { - std::string::size_type end = s.find(")",start); + std::string::size_type end = s.find(')',start); if (end == std::string::npos) break; const std::string &var = s.substr(start+2,end-start-2); @@ -187,7 +187,7 @@ void ImportProject::importCompileCommands(std::istream &istr) const std::string command = values["command"]; const std::string directory = Path::fromNativeSeparators(values["directory"]); std::string::size_type pos = 0; - while (std::string::npos != (pos = command.find(" ",pos))) { + while (std::string::npos != (pos = command.find(' ',pos))) { pos++; if (pos >= command.size()) break; @@ -236,7 +236,7 @@ static void loadVisualStudioProperties(const std::string &props, std::mapFirstChildElement(); importGroup; importGroup = importGroup->NextSiblingElement()) { if (std::strcmp(importGroup->Name(), "Import") == 0 && importGroup->Attribute("Project")) { std::string loadprj = importGroup->Attribute("Project"); - if (loadprj.find("$") == std::string::npos) { + if (loadprj.find('$') == std::string::npos) { loadprj = Path::getPathFromFilename(filename) + loadprj; } loadVisualStudioProperties(loadprj, variables, includePath, additionalIncludeDirectories); @@ -294,7 +294,7 @@ void ImportProject::importSln(std::istream &istr, const std::string &path) const std::string::size_type pos = line.find(".vcxproj"); if (pos == std::string::npos) continue; - const std::string::size_type pos1 = line.rfind("\"",pos); + const std::string::size_type pos1 = line.rfind('\"',pos); if (pos == std::string::npos) continue; const std::string vcxproj(line.substr(pos1+1, pos-pos1+7)); @@ -383,7 +383,7 @@ static std::list toStringList(const std::string &s) std::list ret; std::string::size_type pos1 = 0; std::string::size_type pos2; - while ((pos2 = s.find(";",pos1)) != std::string::npos) { + while ((pos2 = s.find(';',pos1)) != std::string::npos) { ret.push_back(s.substr(pos1, pos2-pos1)); pos1 = pos2 + 1; if (pos1 >= s.size()) diff --git a/lib/path.cpp b/lib/path.cpp index bddf1eed3..98bc83769 100644 --- a/lib/path.cpp +++ b/lib/path.cpp @@ -69,7 +69,7 @@ std::string Path::simplifyPath(std::string originalPath) // Remove ./, .//, ./// etc. at the beginning while (originalPath.compare(0,2,"./") == 0) { // remove "./././" - size_t toErase = originalPath.find_first_not_of("/",2); + const size_t toErase = originalPath.find_first_not_of('/', 2); originalPath = originalPath.erase(0, toErase); } diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index 15dc68944..e0b9e95b6 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -257,10 +257,10 @@ static std::string cfg(const std::vector &configs, const std::strin static bool isUndefined(const std::string &cfg, const std::set &undefined) { for (std::string::size_type pos1 = 0U; pos1 < cfg.size();) { - const std::string::size_type pos2 = cfg.find(";",pos1); + const std::string::size_type pos2 = cfg.find(';',pos1); const std::string def = (pos2 == std::string::npos) ? cfg.substr(pos1) : cfg.substr(pos1, pos2 - pos1); - std::string::size_type eq = def.find("="); + std::string::size_type eq = def.find('='); if (eq == std::string::npos && undefined.find(def) != undefined.end()) return true; if (eq != std::string::npos && undefined.find(def.substr(0,eq)) != undefined.end() && def.substr(eq) != "=0") @@ -449,9 +449,9 @@ void Preprocessor::preprocess(std::istream &srcCodeStream, std::string &processe static void splitcfg(const std::string &cfg, std::list &defines, const std::string &defaultValue) { for (std::string::size_type defineStartPos = 0U; defineStartPos < cfg.size();) { - const std::string::size_type defineEndPos = cfg.find(";", defineStartPos); + const std::string::size_type defineEndPos = cfg.find(';', defineStartPos); std::string def = (defineEndPos == std::string::npos) ? cfg.substr(defineStartPos) : cfg.substr(defineStartPos, defineEndPos - defineStartPos); - if (!defaultValue.empty() && def.find("=") == std::string::npos) + if (!defaultValue.empty() && def.find('=') == std::string::npos) def += '=' + defaultValue; defines.push_back(def); if (defineEndPos == std::string::npos) @@ -480,7 +480,7 @@ static simplecpp::DUI createDUI(const Settings &_settings, const std::string &cf if (s[pos] == ' ') { s[pos] = '='; } else { - s[s.find(")")+1] = '='; + s[s.find(')')+1] = '='; } dui.defines.push_back(s); }