diff options
author | Marius Kintel <marius@kintel.net> | 2013-03-28 03:55:51 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-03-28 03:55:51 (GMT) |
commit | eefcd6d0b271642d470cd55bc47d1579d943938e (patch) | |
tree | 48f9e4db455879025adb9317b740bfa4b72c2d66 /src/value.cc | |
parent | f70578f362c8c2c78036c9de846c20802ac7aa81 (diff) | |
parent | beff2b1f4811b7f9d2b58bfc6a469a363bc9bfd0 (diff) |
Merge branch 'master' into epec-kernel
Conflicts:
src/PolySetCGALEvaluator.cc
Diffstat (limited to 'src/value.cc')
-rw-r--r-- | src/value.cc | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/value.cc b/src/value.cc index 7744a18..f14f826 100644 --- a/src/value.cc +++ b/src/value.cc @@ -25,6 +25,7 @@ */ #include "value.h" +#include "printutils.h" #include <stdio.h> #include <math.h> #include <assert.h> @@ -38,7 +39,7 @@ std::ostream &operator<<(std::ostream &stream, const Filename &filename) { - stream << QuotedString(QDir::current().relativeFilePath(QString::fromStdString(filename)).toStdString()); + stream << QuotedString(QDir::current().relativeFilePath(QString::fromLocal8Bit(filename.c_str())).toLocal8Bit().constData()); return stream; } @@ -196,15 +197,18 @@ public: size_t dotpos = tmpstr.find('.'); if (dotpos != std::string::npos) { if (tmpstr.size() - dotpos > 12) tmpstr.erase(dotpos + 12); + while (tmpstr[tmpstr.size()-1] == '0') tmpstr.erase(tmpstr.size()-1); } + if ( tmpstr.compare("-0") == 0 ) tmpstr = "0"; + tmpstr = two_digit_exp_format( tmpstr ); return tmpstr; #else - // attempt to emulate Qt's QString.sprintf("%g"); from old OpenSCAD. - // see https://github.com/openscad/openscad/issues/158 - std::stringstream tmp; - tmp.unsetf(std::ios::floatfield); - tmp << op1; - return tmp.str(); + // attempt to emulate Qt's QString.sprintf("%g"); from old OpenSCAD. + // see https://github.com/openscad/openscad/issues/158 + std::stringstream tmp; + tmp.unsetf(std::ios::floatfield); + tmp << op1; + return tmp.str(); #endif } |