diff --git a/Source/Common/StdString.cpp b/Source/Common/StdString.cpp index b9cd48f86..20d800c42 100644 --- a/Source/Common/StdString.cpp +++ b/Source/Common/StdString.cpp @@ -30,11 +30,10 @@ strvector stdstr::Tokenize(const char * delimiter) const stdstr::size_type lastPos = find_first_not_of(delimiter, 0); stdstr::size_type pos = find_first_of(delimiter, lastPos); - size_t delimiter_len = strlen(delimiter); while (stdstr::npos != pos) { tokens.push_back(substr(lastPos, pos - lastPos)); - lastPos = pos + delimiter_len; + lastPos = pos + 1; pos = find_first_of(delimiter, lastPos); } if (stdstr::npos != lastPos) diff --git a/Source/UpdateVersion/UpdateVersion.cpp b/Source/UpdateVersion/UpdateVersion.cpp index 20fb32617..a27a6ae7e 100644 --- a/Source/UpdateVersion/UpdateVersion.cpp +++ b/Source/UpdateVersion/UpdateVersion.cpp @@ -34,7 +34,7 @@ int main() uint32_t FileLen = InFile.GetLength(); std::auto_ptr InputData(new uint8_t[FileLen]); InFile.Read(InputData.get(), FileLen); - strvector VersionData = stdstr(std::string((char *)InputData.get(), FileLen)).Tokenize("\r\n"); + strvector VersionData = stdstr(std::string((char *)InputData.get(), FileLen)).Tokenize("\n"); strvector verinfo = stdstr(__argv[3]).Tokenize('-'); if (verinfo.size() < 3 || verinfo.size() > 4) @@ -55,16 +55,16 @@ int main() for (size_t i = 0, n = VersionData.size() - 1; i < n; i++) { stdstr &line = VersionData[i]; - line += "\r\n"; + line += "\n"; if (_strnicmp(line.c_str(), "#define VERSION_BUILD", 21) == 0) { - line = "#define VERSION_BUILD " + verinfo[1] + "\r\n"; + line = "#define VERSION_BUILD " + verinfo[1] + "\n"; } if (_strnicmp(line.c_str(), "#define GIT_VERSION", 18) == 0) { - line = "#define GIT_VERSION \"" + verinfo[2] + "\"\r\n"; + line = "#define GIT_VERSION \"" + verinfo[2] + "\"\n"; } - if (!OutFile.Write(line.c_str(), line.length())) + if (!OutFile.Write(line.c_str(), (uint32_t)line.length())) { return 0; }