Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 238507 | Differences between
and this patch

Collapse All | Expand All

(-)library/grt/src/unserializer.cpp (-5 / +18 lines)
Lines 245-255 Link Here
245
  case DoubleType:
245
  case DoubleType:
246
  {
246
  {
247
    std::string tmp= get_content(node);
247
    std::string tmp= get_content(node);
248
    
248
    static char decimal_point= 0;
249
    if (tmp.find(',') != std::string::npos)
249
250
    {
250
    // now this is a hack for locales that treat . as a thousand separator instead of
251
      // hack in case the model was saved in a locale with , as decimal point
251
    // decimal. 1st find out what is used as decimal point, then hackup the string to parse if 
252
      tmp[tmp.find(',')]= '.';
252
    // needed
253
    if (decimal_point == 0)
254
    {
255
      char buf[4];
256
      sprintf(buf, "%.1f", 0.0); // 0.0
257
      decimal_point= buf[1];
258
    }
259
260
    if (decimal_point != '.')
261
    {
262
      // serializer always saves using . as decimal
263
      std::string::size_type dot= tmp.find('.');
264
      if (dot != std::string::npos)
265
        tmp[dot]= decimal_point;
253
    }
266
    }
254
    value= DoubleRef(strtod(tmp.c_str(), NULL));
267
    value= DoubleRef(strtod(tmp.c_str(), NULL));
255
    break;
268
    break;

Return to bug 238507