[gdal-dev] Problems building gdal for win ce
Even Rouault
even.rouault at mines-paris.org
Wed Jul 2 17:10:26 EDT 2008
Try the attached patch. Please confirm if it works (I've no WINCE available)
and I'll commit that
Index: port/cpl_strtod.cpp
===================================================================
--- port/cpl_strtod.cpp (révision 14798)
+++ port/cpl_strtod.cpp (copie de travail)
@@ -145,6 +145,56 @@
/* CPLStrtodDelim() */
/************************************************************************/
+static void CPLReplacePointByLocalePoint(char* pszNumber, char point)
+{
+#if defined(WIN32CE)
+ static char byPoint = 0;
+ if (byPoint == 0)
+ {
+ char szBuf[16];
+ sprintf(szBuf, "%.1f", 1.0);
+ byPoint = szBuf[1];
+ }
+ if (point != byPoint)
+ {
+ int i = 0;
+
+ while ( pszNumber[i] )
+ {
+ if ( pszNumber[i] == point )
+ {
+ pszNumber[i] = byPoint;
+ break;
+ }
+ i++;
+ }
+ }
+#else
+ struct lconv *poLconv = localeconv();
+ if ( poLconv
+ && poLconv->decimal_point
+ && strlen(poLconv->decimal_point) > 0 )
+ {
+ int i = 0;
+ char byPoint = poLconv->decimal_point[0];
+
+ if (point != byPoint)
+ {
+ while ( pszNumber[i] )
+ {
+ if ( pszNumber[i] == point )
+ {
+ pszNumber[i] = byPoint;
+ break;
+ }
+ i++;
+ }
+ }
+ }
+#endif
+}
+
+
/**
* Converts ASCII string to floating point number using specified delimiter.
*
@@ -170,30 +220,12 @@
/* with the one, taken from locale settings and use standard strtod() */
/* on that buffer. */
/* -------------------------------------------------------------------- */
-
- struct lconv *poLconv = localeconv();
char *pszNumber = CPLStrdup( nptr );
double dfValue;
int nError;
- if ( poLconv
- && poLconv->decimal_point
- && strlen(poLconv->decimal_point) > 0 )
- {
- int i = 0;
- char byPoint = poLconv->decimal_point[0];
+ CPLReplacePointByLocalePoint(pszNumber, point);
- while ( pszNumber[i] )
- {
- if ( pszNumber[i] == point )
- {
- pszNumber[i] = byPoint;
- break;
- }
- i++;
- }
- }
-
dfValue = strtod( pszNumber, endptr );
nError = errno;
@@ -263,29 +295,12 @@
/* on that buffer. */
/* -------------------------------------------------------------------- */
- struct lconv *poLconv = localeconv();
char *pszNumber = CPLStrdup( nptr );
double dfValue;
int nError;
- if ( poLconv
- && poLconv->decimal_point
- && strlen(poLconv->decimal_point) > 0 )
- {
- int i = 0;
- char byPoint = poLconv->decimal_point[0];
+ CPLReplacePointByLocalePoint(pszNumber, point);
- while ( pszNumber[i] )
- {
- if ( pszNumber[i] == point )
- {
- pszNumber[i] = byPoint;
- break;
- }
- i++;
- }
- }
-
dfValue = strtof( pszNumber, endptr );
nError = errno;
Le Wednesday 02 July 2008 22:27:31 godofredo contreras, vous avez écrit :
> Hi:
>
> I´m trying to compile gdal for windows mobile, using windows mobile 5 sdk
> and visual studio 2005 but I´m getting an undefined reference to
> localeconv in method CPLStrtodDelim and undefined reference to
> GDALWarpCutlineMasker in method GDALWarpOperation::WarpRegionToBuffer.
>
> Have someone had this problems, any idea to solve them?
>
> Thanks in advance
> Godofredo Contreras
>
> _________________________________________________________________
> Don't get caught with egg on your face. Play chicktionary!
> http://club.live.com/chicktionary.aspx?icid=chick_wlhmtextlink1_feb
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cpl_strtod.cpp.patch
Type: text/x-diff
Size: 3310 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080702/75aff618/cpl_strtod.cpp.bin
More information about the gdal-dev
mailing list