vcl/source/gdi/pdfwriter_impl.cxx | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-)
New commits: commit 5f6065f980756fdb81c7018bedbb7f54e2b8214a Author: Caolán McNamara <caol...@redhat.com> Date: Thu Mar 3 20:44:47 2016 +0000 coverity#1355126 Logically dead code maybe we should be using more precision, but we haven't been in the past Change-Id: Icf1e1e95099c783435e04f60d8ade755a8d2d4d5 diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 746636a..0a4d595 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -845,17 +845,14 @@ static void appendFixedInt( sal_Int32 nValue, OStringBuffer& rBuffer ) rBuffer.append( '-' ); nValue = -nValue; } - sal_Int32 nFactor = 10; - sal_Int32 nInt = nValue / nFactor; + const sal_Int32 nFactor = 10; + const sal_Int32 nInt = nValue / nFactor; rBuffer.append( nInt ); sal_Int32 nDecimal = nValue % nFactor; - if( nDecimal ) + if (nDecimal) { - rBuffer.append( '.' ); - // omit trailing zeros - while( (nDecimal % 10) == 0 ) - nDecimal /= 10; - rBuffer.append( nDecimal ); + rBuffer.append('.'); + rBuffer.append(nDecimal); } } commit cd5cc12d4330d68d0a233a82eda30e983ce202a4 Author: Caolán McNamara <caol...@redhat.com> Date: Thu Mar 3 20:42:52 2016 +0000 nLog10Divisor is 1 Change-Id: I8820d435e2f26d04ac3eccb710383399d050e020 diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 6911134..746636a 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -845,23 +845,17 @@ static void appendFixedInt( sal_Int32 nValue, OStringBuffer& rBuffer ) rBuffer.append( '-' ); nValue = -nValue; } - sal_Int32 nFactor = 1, nDiv = nLog10Divisor; - while( nDiv-- ) - nFactor *= 10; - - sal_Int32 nInt = nValue / nFactor; + sal_Int32 nFactor = 10; + sal_Int32 nInt = nValue / nFactor; rBuffer.append( nInt ); - if( nFactor > 1 ) + sal_Int32 nDecimal = nValue % nFactor; + if( nDecimal ) { - sal_Int32 nDecimal = nValue % nFactor; - if( nDecimal ) - { - rBuffer.append( '.' ); - // omit trailing zeros - while( (nDecimal % 10) == 0 ) - nDecimal /= 10; - rBuffer.append( nDecimal ); - } + rBuffer.append( '.' ); + // omit trailing zeros + while( (nDecimal % 10) == 0 ) + nDecimal /= 10; + rBuffer.append( nDecimal ); } }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits