Commit 57f43804 authored by Calvin Buckley's avatar Calvin Buckley 🤔 Committed by Albert Astals Cid
Browse files

Parse negative signed integers

parent 9f2e3072
......@@ -278,6 +278,17 @@ bool FixString::stripInt64(int64& v, bool stripSpaces)
}
char c = *_str;
bool negative = false;
if (c == '-') {
negative = true;
_str++;
_len--;
}
if (_len==0) {
v = 0;
return false;
}
c = *_str;
if (c<'0' || c>'9') {
v = 0;
return false;
......@@ -320,6 +331,9 @@ bool FixString::stripInt64(int64& v, bool stripSpaces)
}
}
if (negative)
v = -v;
if (stripSpaces)
while(l>0) {
if (c != ' ') break;
......
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