]> git.lyx.org Git - lyx.git/blobdiff - src/Length.cpp
Customization.lyx: use change tracking for the changes made in 0eb651a2
[lyx.git] / src / Length.cpp
index 44c3c8137161d1ace6f0c31c316ad8fa46f979f8..a55d2ef8becf6a56b80e54be503db652188ed57d 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "support/docstream.h"
 #include "support/lstrings.h"
+#include "support/lyxlib.h"
 
 #include <sstream>
 #include <iomanip>
@@ -215,7 +216,7 @@ int Length::inPixels(int text_width, int em_width_base) const
 
        double const text_width_in = text_width / (zoom * dpi);
        double const result = zoom * dpi * inInch(text_width_in, em_width_in);
-       return static_cast<int>(result + ((result >= 0) ? 0.5 : -0.5));
+       return support::iround(result);
 }
 
 
@@ -311,7 +312,7 @@ int Length::inBP() const
        double const text_width_in = 210.0 / 2.54; // assume A4
        double const em_width_in = 10.0 / 72.27;
        double result = 72.0 * inInch(text_width_in, em_width_in);
-       return static_cast<int>(result + 0.5);
+       return support::iround(result);
 }
 
 
@@ -354,6 +355,8 @@ GlueLength::GlueLength(Length const & len, Length const & plus,
 
 GlueLength::GlueLength(string const & data)
 {
+       // false positive from coverity
+       // coverity[CHECKED_RETURN]
        isValidGlueLength(data, this);
 }