Commit 298b43a8 authored by Chen Bill's avatar Chen Bill Committed by GitHub

update BufferIO::GetVal (#2623)

parent c1cd59c4
...@@ -256,14 +256,18 @@ public: ...@@ -256,14 +256,18 @@ public:
str[N - 1] = 0; str[N - 1] = 0;
} }
static int GetVal(const wchar_t* pstr) { static int GetVal(const wchar_t* pstr) {
unsigned int ret = 0; if (*pstr >= L'0' && *pstr <= L'9') {
while(*pstr >= L'0' && *pstr <= L'9') { int ret{};
ret = ret * 10 + (*pstr - L'0'); wchar_t* str_end{};
pstr++; ret = std::wcstol(pstr, &str_end, 10);
if (*str_end == 0)
return ret;
else
return 0;
} }
if (*pstr == 0) else
return (int)ret;
return 0; return 0;
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment