diff options
| author | Manolo Gouy <Manolo> | 2017-09-09 15:47:04 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2017-09-09 15:47:04 +0000 |
| commit | a0e7cbfa576ffaf92a45848f279b8ca74f4dd4f4 (patch) | |
| tree | 1ceccfc8c6b51a37a6eda340dc0535efd569f27f /nanosvg/nanosvg.h | |
| parent | a03f8490e68326796868b0ceb9e62c534ec80c67 (diff) | |
Fix nanosvg implementation of nsvg__atof() to allow compilation with Visual Studio 7.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12435 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'nanosvg/nanosvg.h')
| -rw-r--r-- | nanosvg/nanosvg.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/nanosvg/nanosvg.h b/nanosvg/nanosvg.h index 2321c56fd..bd5b722f4 100644 --- a/nanosvg/nanosvg.h +++ b/nanosvg/nanosvg.h @@ -1081,7 +1081,7 @@ static double nsvg__atof(const char* s) char* cur = (char*)s; char* end = NULL; double res = 0.0, sign = 1.0; - long long intPart = 0, fracPart = 0; + double intPart = 0, fracPart = 0; char hasIntPart = 0, hasFracPart = 0; // Parse optional sign @@ -1095,7 +1095,11 @@ static double nsvg__atof(const char* s) // Parse integer part if (nsvg__isdigit(*cur)) { // Parse digit sequence - intPart = (double)strtoll(cur, &end, 10); +#ifdef _MSC_VER + intPart = (double)_strtoi64(cur, &end, 10); +#else + intPart = (double)strtoll(cur, &end, 10); +#endif if (cur != end) { res = (double)intPart; hasIntPart = 1; @@ -1108,7 +1112,11 @@ static double nsvg__atof(const char* s) cur++; // Skip '.' if (nsvg__isdigit(*cur)) { // Parse digit sequence - fracPart = strtoll(cur, &end, 10); +#ifdef _MSC_VER + fracPart = (double)_strtoi64(cur, &end, 10); +#else + fracPart = (double)strtoll(cur, &end, 10); +#endif if (cur != end) { res += (double)fracPart / pow(10.0, (double)(end - cur)); hasFracPart = 1; @@ -1123,11 +1131,11 @@ static double nsvg__atof(const char* s) // Parse optional exponent if (*cur == 'e' || *cur == 'E') { - int expPart = 0; + double expPart = 0; cur++; // skip 'E' - expPart = strtol(cur, &end, 10); // Parse digit sequence with sign + expPart = (double)strtol(cur, &end, 10); // Parse digit sequence with sign if (cur != end) { - res *= pow(10.0, (double)expPart); + res *= pow(10.0, expPart); } } |
