aboutsummaryrefslogtreecommitdiff
path: root/src/dmstor.c
diff options
context:
space:
mode:
authorFrank Warmerdam <warmerdam@pobox.com>2002-06-20 16:09:31 +0000
committerFrank Warmerdam <warmerdam@pobox.com>2002-06-20 16:09:31 +0000
commitd26cb6597ecd1c6b612d0159651cd607f9003a09 (patch)
treef020f619a7025f007bb716175723b31a7f6283c6 /src/dmstor.c
parent5e2f130a7693ad7f607a8d0cfc47965ba214837f (diff)
downloadPROJ-d26cb6597ecd1c6b612d0159651cd607f9003a09.tar.gz
PROJ-d26cb6597ecd1c6b612d0159651cd607f9003a09.zip
removed strtod, reimplement non-GPL strtod cover within dmstor.c
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1024 4e78687f-474d-0410-85f9-8d5e500ac6b2
Diffstat (limited to 'src/dmstor.c')
-rw-r--r--src/dmstor.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/dmstor.c b/src/dmstor.c
index 44ce5e37..e4b6064a 100644
--- a/src/dmstor.c
+++ b/src/dmstor.c
@@ -6,6 +6,8 @@ static const char SCCSID[]="@(#)dmstor.c 4.4 93/06/16 GIE REL";
#include <string.h>
#include <ctype.h>
+static double proj_strtod(const char *nptr, char **endptr);
+
/* following should be sufficient for all but the rediculous */
#define MAX_WORK 64
static const char
@@ -76,3 +78,34 @@ dmstor(const char *is, char **rs) {
*rs = (char *)is + (s - work);
return v;
}
+
+static double
+proj_strtod(const char *nptr, char **endptr)
+
+{
+ char c, *cp = nptr;
+ double result;
+
+ /*
+ * Scan for characters which cause problems with VC++ strtod()
+ */
+ while ((c = *cp) != '\0') {
+ if (c == 'd' || c == 'D') {
+
+ /*
+ * Found one, so NUL it out, call strtod(),
+ * then restore it and return
+ */
+ *cp = '\0';
+ result = strtod(nptr, endptr);
+ *cp = c;
+ return result;
+ }
+ ++cp;
+ }
+
+ /* no offending characters, just handle normally */
+
+ return strtod(nptr, endptr);
+}
+