Show
Ignore:
Timestamp:
06/25/09 18:07:49 (5 years ago)
Author:
robert
Message:

From Mathias Froehlich, "We are currently getting issues with locale settings and some osg plugins.
Therefore I have changed all the occurances of atof by asciiToFloat or
asciiToDouble.

I believe that it is safe to do so at least for all the plugins.
Included here are also asciiToFloat conversion of environment variables. One
might argue that these should be locale dependent. But IMO these should be
set and interpreted by osg independent of the current locale.
"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgPlugins/dw/ReaderWriterDW.cpp

    r9527 r10415  
    859859                    } else if (strncmp(buff, "numPhases:",10)==0) { 
    860860                    } else if (strncmp(buff, "Opacity:",8)==0) { 
    861                         float opacity=atof(buff+8); 
     861                        float opacity=osg::asciiToFloat(buff+8); 
    862862                        matpalet[nmat].setopacity(opacity); 
    863863                    } else if (strncmp(buff, "FallOff:",8)==0) { 
    864                         float fo=atof(buff+8); 
     864                        float fo=osg::asciiToFloat(buff+8); 
    865865                        matpalet[nmat].setFallOff(fo); 
    866866                    } else if (strncmp(buff, "InnerHalfAngle:",15)==0) { 
    867                         float ha=atof(buff+15); 
     867                        float ha=osg::asciiToFloat(buff+15); 
    868868                        matpalet[nmat].setHalfAngleIn(ha); 
    869869                    } else if (strncmp(buff, "OuterHalfAngle:",15)==0) { 
    870                         float ha=atof(buff+15); 
     870                        float ha=osg::asciiToFloat(buff+15); 
    871871                        matpalet[nmat].setHalfAngleOut(ha); 
    872872                    } else if (strncmp(buff, "Brightness:",11)==0) { 
    873                         float br=atof(buff+11); 
     873                        float br=osg::asciiToFloat(buff+11); 
    874874                        matpalet[nmat].setBright(br); 
    875875                    } else if (strncmp(buff, "Attentuation:",13)==0) { // oops - they can't spell 
     
    878878                        matpalet[nmat].setType(buff+14); 
    879879                    } else if (strncmp(buff, "SpecularReflectivity:",21)==0) { 
    880                         float spec=atof(buff+21); 
     880                        float spec=osg::asciiToFloat(buff+21); 
    881881                        matpalet[nmat].setspecular(spec); 
    882882                    } else if (strncmp(buff, "SmoothnessExponent:",19)==0) { 
    883                         float spec=atof(buff+19); 
     883                        float spec=osg::asciiToFloat(buff+19); 
    884884                        matpalet[nmat].setspecexp(spec*128.0f/100.0f); // convert to 0-128 range from percent 
    885885                    } else if (strncmp(buff, "TextureWidthAndHeight:",22)==0) { 
    886886                        char *ct=strchr(buff+22,','); 
    887                         float repx=atof(buff+23), repy=atof(ct+1); 
     887                        float repx=osg::asciiToFloat(buff+23), repy=osg::asciiToFloat(ct+1); 
    888888                        matpalet[nmat].settxrep(repx, repy); 
    889889                    } else if (strncmp(buff, "PictureFile:",12)==0) {