https://bugs.documentfoundation.org/show_bug.cgi?id=96892
--- Comment #5 from Martin <[email protected]> --- Thank you for the files, Julien. Long story short (see the next post for details), your files eventually led me to what I think is a bug in appendFixedInt() in core/vcl/source/gdi/pdfwriter_impl.cxx : sal_Int32 nFactor = 1, nDiv = nPrecision; while( nDiv-- ) nFactor *= 10; sal_Int32 nInt = nValue / nFactor; rBuffer.append( nInt ); if( nFactor > 1 ) { sal_Int32 nDecimal = nValue % nFactor; if( nDecimal ) { rBuffer.append( '.' ); // omit trailing zeros while( (nDecimal % 10) == 0 ) nDecimal /= 10; rBuffer.append( nDecimal ); } } The problem with this code is that e.g. for nValue = 105, nPrecision = 2 it gives nDecimal = 5, so it outputs "1.5" rather than the correct "1.05"! The next function, appendDouble(), does essentially the same thing, but does it correctly (as far as I can see!). This looks like very old code, the bulk of it is from 2004 with some changes from 2005. As far as I can see, the buggy appendFixedInt() is then used by PDFWriterImpl::PDFPage::appendPoint(), which in turn is used by just about everything - drawLine, drawRectangle, drawJPGBitmap etc. I think they hit the bug early on and kept fDivisor at 10.0 ever since, because nPrecision = 1 is the only case where the code works correctly. More details to follow in the next post. -- You are receiving this mail because: You are the assignee for the bug.
_______________________________________________ Libreoffice-bugs mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs
