diff options
| author | Manolo Gouy <Manolo> | 2017-09-07 20:16:08 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2017-09-07 20:16:08 +0000 |
| commit | 0bf5f9809a0c5c15cfc486e215f30a2a539e088e (patch) | |
| tree | 5ba5f7d8e0b79bf834411ccf1908de9bca4c5f4d /nanosvg/fl_nanosvg.diff | |
| parent | a222837123345072d8c38c2d599b492b3c4311bd (diff) | |
Modify nanosvg.h to support compilation by Visual Studio 7.
This is a new implementation that does not tamper with the program's locale.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12431 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'nanosvg/fl_nanosvg.diff')
| -rw-r--r-- | nanosvg/fl_nanosvg.diff | 74 |
1 files changed, 8 insertions, 66 deletions
diff --git a/nanosvg/fl_nanosvg.diff b/nanosvg/fl_nanosvg.diff index 891379a1d..ffafb7d4d 100644 --- a/nanosvg/fl_nanosvg.diff +++ b/nanosvg/fl_nanosvg.diff @@ -1,76 +1,18 @@ -1,10d0 +1,9d0 < // < // "$Id$" < // < -< /* Modified by FLTK from original source file "nanosvg.h" to support compilation -< with Visual Studio 7: -< remove the implementation of function nsvg__atof() that uses -< unsupported "long long" type and strtoll() function. +< /* Modified for the FLTK library from original source file "nanosvg.h" to +< support compilation with Visual Studio 7: +< replace in function nsvg__atof() the "long long" type by "fl_nsvg_int". < */ < -1087a1078,1137 -> // We roll our own string to float because the std library one uses locale and messes things up. -> static double nsvg__atof(const char* s) -> { -> char* cur = (char*)s; -> char* end = NULL; -> double res = 0.0, sign = 1.0; +1093c1084 +< fl_nsvg_int intPart = 0, fracPart = 0; +--- > long long intPart = 0, fracPart = 0; -> char hasIntPart = 0, hasFracPart = 0; -> -> // Parse optional sign -> if (*cur == '+') { -> cur++; -> } else if (*cur == '-') { -> sign = -1; -> cur++; -> } -> -> // Parse integer part -> if (nsvg__isdigit(*cur)) { -> // Parse digit sequence -> intPart = (double)strtoll(cur, &end, 10); -> if (cur != end) { -> res = (double)intPart; -> hasIntPart = 1; -> cur = end; -> } -> } -> -> // Parse fractional part. -> if (*cur == '.') { -> cur++; // Skip '.' -> if (nsvg__isdigit(*cur)) { -> // Parse digit sequence -> fracPart = strtoll(cur, &end, 10); -> if (cur != end) { -> res += (double)fracPart / pow(10.0, (double)(end - cur)); -> hasFracPart = 1; -> cur = end; -> } -> } -> } -> -> // A valid number should have integer or fractional part. -> if (!hasIntPart && !hasFracPart) -> return 0.0; -> -> // Parse optional exponent -> if (*cur == 'e' || *cur == 'E') { -> int expPart = 0; -> cur++; // skip 'E' -> expPart = strtol(cur, &end, 10); // Parse digit sequence with sign -> if (cur != end) { -> res *= pow(10.0, (double)expPart); -> } -> } -> -> return res * sign; -> } -> -> -2876,2879d2925 +2935,2938d2925 < < // < // End of "$Id$". |
