Fix parsing of numbers with units ex and em
Unrelated: kill precision warning in nsvg__atof, make expPart long.
This commit is contained in:
parent
c1f6e209c1
commit
dc46f954b6
@ -1130,7 +1130,7 @@ static double nsvg__atof(const char* s)
|
|||||||
|
|
||||||
// Parse optional exponent
|
// Parse optional exponent
|
||||||
if (*cur == 'e' || *cur == 'E') {
|
if (*cur == 'e' || *cur == 'E') {
|
||||||
int expPart = 0;
|
long expPart = 0;
|
||||||
cur++; // skip 'E'
|
cur++; // skip 'E'
|
||||||
expPart = strtol(cur, &end, 10); // Parse digit sequence with sign
|
expPart = strtol(cur, &end, 10); // Parse digit sequence with sign
|
||||||
if (cur != end) {
|
if (cur != end) {
|
||||||
@ -1168,7 +1168,7 @@ static const char* nsvg__parseNumber(const char* s, char* it, const int size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// exponent
|
// exponent
|
||||||
if (*s == 'e' || *s == 'E') {
|
if ((*s == 'e' || *s == 'E') && (s[1] != 'm' && s[1] != 'x')) {
|
||||||
if (i < last) it[i++] = *s;
|
if (i < last) it[i++] = *s;
|
||||||
s++;
|
s++;
|
||||||
if (*s == '-' || *s == '+') {
|
if (*s == '-' || *s == '+') {
|
||||||
|
Loading…
Reference in New Issue
Block a user