255 |
static char * pszStringField = NULL; |
static char * pszStringField = NULL; |
256 |
|
|
257 |
/************************************************************************/ |
/************************************************************************/ |
258 |
|
/* DBFSet_atof_function() */ |
259 |
|
/* */ |
260 |
|
/* This makes it possible to initialise a different atof() function */ |
261 |
|
/* which might be necessary because the standard atof() might be */ |
262 |
|
/* sensitive to locale settings. */ |
263 |
|
/* */ |
264 |
|
/* If the calling application uses a locale with different decimal_point*/ |
265 |
|
/* it should better also give us a locale agnostic atof() function. */ |
266 |
|
/* */ |
267 |
|
/* As far as I can see from Python PEP331 and GNU libc documentation */ |
268 |
|
/* there is no standard for such a function yet. */ |
269 |
|
/* */ |
270 |
|
/* [email protected] 20060924 */ |
271 |
|
/************************************************************************/ |
272 |
|
|
273 |
|
static double (* atof_function)(const char *nptr) = &atof; |
274 |
|
|
275 |
|
void SHPAPI_CALL |
276 |
|
DBFSetatof_function( double (* new_atof_function)(const char *nptr)) |
277 |
|
{ |
278 |
|
atof_function = new_atof_function; |
279 |
|
} |
280 |
|
|
281 |
|
/************************************************************************/ |
282 |
/* SfRealloc() */ |
/* SfRealloc() */ |
283 |
/* */ |
/* */ |
284 |
/* A realloc cover function that will access a NULL pointer as */ |
/* A realloc cover function that will access a NULL pointer as */ |
553 |
void SHPAPI_CALL |
void SHPAPI_CALL |
554 |
DBFClose(DBFHandle psDBF) |
DBFClose(DBFHandle psDBF) |
555 |
{ |
{ |
556 |
|
if( psSHP == NULL ) |
557 |
|
return; |
558 |
|
|
559 |
/* -------------------------------------------------------------------- */ |
/* -------------------------------------------------------------------- */ |
560 |
/* Write out header if not already written. */ |
/* Write out header if not already written. */ |
561 |
/* -------------------------------------------------------------------- */ |
/* -------------------------------------------------------------------- */ |
853 |
/* -------------------------------------------------------------------- */ |
/* -------------------------------------------------------------------- */ |
854 |
if( chReqType == 'N' ) |
if( chReqType == 'N' ) |
855 |
{ |
{ |
856 |
dDoubleField = atof(pszStringField); |
dDoubleField = (*atof_function)(pszStringField); |
857 |
|
|
858 |
pReturnField = &dDoubleField; |
pReturnField = &dDoubleField; |
859 |
} |
} |