diff --git a/lib/cppcheck.cpp b/lib/cppcheck.cpp index 8e8167242b49..3eda486dd96d 100644 --- a/lib/cppcheck.cpp +++ b/lib/cppcheck.cpp @@ -1422,11 +1422,11 @@ void CppCheck::executeAddons(const std::string& dumpFile, const FileWithDetails& // Split a string into a constant number of parts template static bool staticSplit(const std::string &str, char delim, std::array &substrs) { - std::size_t i, prev, pos = 0; + std::size_t i, pos = 0; for (i = 0; pos < str.length(); i++) { if (i == N) return false; - prev = pos; + std::size_t prev = pos; pos = str.find(delim, pos); if (pos == std::string::npos) pos = str.length();