File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -268,14 +268,7 @@ static std::string msbuildUnescape(const std::string &s)
268268 if (s[i] == ' %' && i + 2 < s.size () &&
269269 std::isxdigit (static_cast <unsigned char >(s[i + 1 ])) &&
270270 std::isxdigit (static_cast <unsigned char >(s[i + 2 ]))) {
271- const auto hexVal = [](char c) -> unsigned char {
272- if (c >= ' 0' && c <= ' 9' )
273- return static_cast <unsigned char >(c - ' 0' );
274- if (c >= ' a' && c <= ' f' )
275- return static_cast <unsigned char >(c - ' a' + 10 );
276- return static_cast <unsigned char >(c - ' A' + 10 );
277- };
278- result += static_cast <char >((hexVal (s[i + 1 ]) << 4 ) | hexVal (s[i + 2 ]));
271+ result += static_cast <char >(std::stoi (s.substr (i + 1 , 2 ), nullptr , 16 ));
279272 i += 2 ;
280273 } else {
281274 result += s[i];
@@ -865,9 +858,14 @@ std::string ImportProject::applyMSBuildStaticFunction(const std::string &classNa
865858 const auto toInt = [](const std::string &s, long long &out) -> bool {
866859 if (s.empty ())
867860 return false ;
868- char *end = nullptr ;
869- out = std::strtoll (s.c_str (), &end, 10 );
870- return end != s.c_str () && *end == ' \0 ' ;
861+ try {
862+ size_t idx = 0 ;
863+ out = std::stoll (s, &idx);
864+ return idx == s.length ();
865+ }
866+ catch (...) {
867+ return false ;
868+ }
871869 };
872870
873871 if (caseInsensitiveStringCompare (className, " MSBuild" ) == 0 ) {
You can’t perform that action at this time.
0 commit comments