[OSRS-PROJ] On Proj4...
Paul Selormey
paul at toolscenter.org
Thu May 30 20:41:55 EDT 2002
Hello Karl,
There could be much to the problem. So, please let us examine
it more carefully. I will scan for the uses of the custom function in
the sources and then report on this.
Best regards,
Paul.
----- Original Message -----
From: "Karl Swartz" <karl at kls2.com>
To: <osrs-proj at remotesensing.org>
Sent: Friday, May 31, 2002 4:22 AM
Subject: Re: [OSRS-PROJ] On Proj4...
> > The problem was that strtod("15d10") on VC++ treated the value as 15
times
> > 10 to the exponent 10 (scientific notation). The values like "15d10"
are
> > common in DMS specific inputs. The problem with replacing it with my
> > own implementation is I don't know how widely the custom strtod() is
used,
> > and hence how much of the full strtod() functionality needs to be
> > replicated.
>
> If that's the issue, and if callers don't require the const storage
> class on the first argument (which is unlikely to be an issue), why
> not put a wrapper around the library one which just masks that issue?
> I haven't looked at the PROJ.4 code in ages, but something like this
> in a .h file used by everyone
>
> #define strtod(nptr, endptr) strtod_wrapper((nptr)), ((endptr))
>
> double
> strtod_wrapper(/* const */ char *nptr, char **endptr)
>
> and then wherever the current GPV-infested strtod() is located
>
> #undef strtod(nptr, endptr)
>
> double
> strtod_wrapper(/* 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;
> }
>
> /*
> /* Nothing troublesome found, so just call the library function
> */
> return strtod(nptr, endptr);
> }
>
> --
> Karl Swartz |Home karl at kls2.com http://www.kls2.com/~karl/
> |Work karl at quartetns.com http://www.quartetns.com/
> "The average dog is a nicer person than the average person."
> - Andrew A. Rooney
> ----------------------------------------
> PROJ.4 Discussion List
> See http://www.remotesensing.org/proj for subscription, unsubscription
> and other information.
>
----------------------------------------
PROJ.4 Discussion List
See http://www.remotesensing.org/proj for subscription, unsubscription
and other information.
More information about the Proj
mailing list