Opened 10 years ago

Closed 10 years ago

#3775 closed defect (fixed)

mitab_spatialref.cpp - default GEOCS uses atof and has locale problems, fix proposed

Reported by: nicolaslelong Owned by: aboudreault
Priority: normal Milestone:
Component: OGR_SRS Version: 1.7.2
Severity: normal Keywords: mitab
Cc: Daniel Morissette, aboudreault, warmerdam

Description (last modified by nicolaslelong)

In method TABFile::GetSpatialRef, on line 1037, the following statement uses atof to convert the SRS_UA_DEGREE_CONV string to double.

    m_poSpatialRef->SetGeogCS( "unnamed",
                               dfSemiMajor, dfInvFlattening,
                               pszPMName, dfPMOffset,
                               SRS_UA_DEGREE, atof(SRS_UA_DEGREE_CONV));

This causes problems when the current locale has not "." as the decimal separator (results in 0 instead of 0.0174532925199433)

Fix ::

Simply replacing atof with CPLAtof solves the problem.

Change History (4)

comment:1 Changed 10 years ago by nicolaslelong

Description: modified (diff)

comment:2 Changed 10 years ago by warmerdam

Cc: Daniel Morissette aboudreault added
Keywords: mitab added

The proposal seems reasonable to me. Daniel, who should do this?

comment:3 Changed 10 years ago by aboudreault

Cc: warmerdam added
Owner: changed from warmerdam to aboudreault

I can take care of this one. There are many uses of atof in the code... but I don't think we have to convert everything to CPLAtof

comment:4 Changed 10 years ago by aboudreault

Resolution: fixed
Status: newclosed

Fixed in mitab CVS (will be in mitab 2.0). The fix is in gdal svn trunk, synchronized with mitab CVS head in r20796.

Note: See TracTickets for help on using tickets.