This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

Changeset 9639 for ps


Ignore:
Timestamp:
06/19/11 21:51:53 (14 years ago)
Author:
philip
Message:

Avoid potentially dangerous locale-dependent atof functions

Location:
ps/trunk/source/tools/atlas
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/source/tools/atlas/AtlasObject/AtlasObject.h

    r9617 r9639  
    137137    operator const wchar_t* () const;
    138138
     139    // Return the floating point value of this object
     140    double getDouble() const;
     141
    139142    // Check whether the object contains anything (even if those things are empty)
    140143    bool defined() const { return (bool)p; }
  • ps/trunk/source/tools/atlas/AtlasObject/AtlasObjectImpl.cpp

    r9617 r9639  
    129129}
    130130
     131double AtObj::getDouble() const
     132{
     133    double val = 0;
     134    if (p)
     135    {
     136        std::wstringstream s;
     137        s << p->value;
     138        s >> val;
     139    }
     140    return val;
     141}
     142
    131143void AtObj::add(const char* key, AtObj& data)
    132144{
  • ps/trunk/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Player/Player.cpp

    r9623 r9639  
    626626            sCameraInfo info;
    627627            AtObj camPos = *player["StartingCamera"]["Position"];
    628             info.pX = wxAtof(*camPos["x"]);
    629             info.pY = wxAtof(*camPos["y"]);
    630             info.pZ = wxAtof(*camPos["z"]);
     628            info.pX = (float)(*camPos["x"]).getDouble();
     629            info.pY = (float)(*camPos["y"]).getDouble();
     630            info.pZ = (float)(*camPos["z"]).getDouble();
    631631            AtObj camRot = *player["StartingCamera"]["Rotation"];
    632             info.rX = wxAtof(*camRot["x"]);
    633             info.rY = wxAtof(*camRot["y"]);
    634             info.rZ = wxAtof(*camRot["z"]);
     632            info.rX = (float)(*camRot["x"]).getDouble();
     633            info.rY = (float)(*camRot["y"]).getDouble();
     634            info.rZ = (float)(*camRot["z"]).getDouble();
    635635           
    636636            controls.page->SetCamera(info, true);
Note: See TracChangeset for help on using the changeset viewer.