diff options
| author | Pierre Bourdon <delroth@gmail.com> | 2014-05-17 17:42:08 +0200 |
|---|---|---|
| committer | Pierre Bourdon <delroth@gmail.com> | 2014-05-17 17:42:08 +0200 |
| commit | 396e13de8997da5ed3da4057f55cf55133aaf8fc (patch) | |
| tree | 1bda630718ed63838379cfe66f35e935e07bb517 /Source/Core/Common/IniFile.cpp | |
| parent | 0fac17da336faf81a69842ad0b3641cdad692262 (diff) | |
| parent | d0bd4119d1806aec36a3aee723f1fdfa2fad2557 (diff) | |
Merge pull request #369 from lioncash/ini
Use size_t in std::string operations in IniFile.cpp, not int
Diffstat (limited to 'Source/Core/Common/IniFile.cpp')
| -rw-r--r-- | Source/Core/Common/IniFile.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Source/Core/Common/IniFile.cpp b/Source/Core/Common/IniFile.cpp index f830fd6b45..fc90b3500e 100644 --- a/Source/Core/Common/IniFile.cpp +++ b/Source/Core/Common/IniFile.cpp @@ -26,13 +26,17 @@ void ParseLine(const std::string& line, std::string* keyOut, std::string* valueO if (line[0] == '#') return; - int FirstEquals = (int)line.find("=", 0); + size_t firstEquals = line.find("=", 0); - if (FirstEquals >= 0) + if (firstEquals != std::string::npos) { // Yes, a valid line! - *keyOut = StripSpaces(line.substr(0, FirstEquals)); - if (valueOut) *valueOut = StripQuotes(StripSpaces(line.substr(FirstEquals + 1, std::string::npos))); + *keyOut = StripSpaces(line.substr(0, firstEquals)); + + if (valueOut) + { + *valueOut = StripQuotes(StripSpaces(line.substr(firstEquals + 1, std::string::npos))); + } } } @@ -298,13 +302,13 @@ bool IniFile::GetLines(const std::string& sectionName, std::vector<std::string>* if (remove_comments) { - int commentPos = (int)line.find('#'); + size_t commentPos = line.find('#'); if (commentPos == 0) { continue; } - if (commentPos != (int)std::string::npos) + if (commentPos != std::string::npos) { line = StripSpaces(line.substr(0, commentPos)); } |
