Code

clean up tabs and DOS-ishness
[inkscape.git] / src / svg / stringstream.cpp
index 3cbfcd86b38f7ff64901b3097f5cfeb1d532f9e5..65c01e7b687b3332f138f5ee9f941643687b663c 100644 (file)
@@ -1,5 +1,6 @@
 #include "svg/stringstream.h"
 #include "svg/strip-trailing-zeros.h"
+#include "prefs-utils.h"
 
 Inkscape::SVGOStringStream::SVGOStringStream()
 {
@@ -11,7 +12,7 @@ Inkscape::SVGOStringStream::SVGOStringStream()
     /* This one is (currently) needed though, as we currently use ostr.precision as a sort of
        variable for storing the desired precision: see our two precision methods and our operator<<
        methods for float and double. */
-    ostr.precision(8);
+    ostr.precision(prefs_get_int_attribute("options.svgoutput", "numericprecision", 8));
 }
 
 Inkscape::SVGOStringStream &
@@ -19,7 +20,7 @@ operator<<(Inkscape::SVGOStringStream &os, float d)
 {
     /* Try as integer first. */
     {
-        long const n = long(d);
+        int const n = int(d);
         if (d == n) {
             os << n;
             return os;
@@ -28,7 +29,7 @@ operator<<(Inkscape::SVGOStringStream &os, float d)
 
     std::ostringstream s;
     s.imbue(std::locale::classic());
-    s.setf(std::ios::showpoint);
+    s.flags(os.setf(std::ios::showpoint));
     s.precision(os.precision());
     s << d;
     os << strip_trailing_zeros(s.str());
@@ -40,7 +41,7 @@ operator<<(Inkscape::SVGOStringStream &os, double d)
 {
     /* Try as integer first. */
     {
-        long const n = long(d);
+        int const n = int(d);
         if (d == n) {
             os << n;
             return os;
@@ -49,7 +50,7 @@ operator<<(Inkscape::SVGOStringStream &os, double d)
 
     std::ostringstream s;
     s.imbue(std::locale::classic());
-    s.setf(std::ios::showpoint);
+    s.flags(os.setf(std::ios::showpoint));
     s.precision(os.precision());
     s << d;
     os << strip_trailing_zeros(s.str());