[Libreoffice-commits] core.git: vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Mar 4 10:42:27 UTC 2019


 vcl/source/font/fontmetric.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit e457b1de6b28e53b900d559d6f2f1ac6a489a9c4
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Mar 4 09:02:41 2019 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Mar 4 11:42:05 2019 +0100

    Avoid unnecessary truncation to sal_uInt16
    
    At least during CppunitTest_sw_odfimport, Clang's
    -fsanitize=implicit-signed-integer-truncation warns (for nB) that an "implicit
    conversion from type 'long' of value -181 (64-bit, signed) to type 'const
    sal_uInt16' (aka 'const unsigned short') changed the value to 65355 (16-bit,
    unsigned)".
    
    Change-Id: I91bd1413fca248f5f05331980d8ac92753d366ab
    Reviewed-on: https://gerrit.libreoffice.org/68665
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index 36d9f7d727eb..4e6c648be3c7 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -386,8 +386,8 @@ void ImplFontMetricData::ImplInitFlags( const OutputDevice* pDev )
         const OUString sFullstop( u'\x3001' ); // Fullwidth fullstop
         tools::Rectangle aRect;
         pDev->GetTextBoundRect( aRect, sFullstop );
-        const sal_uInt16 nH = rFont.GetFontSize().Height();
-        const sal_uInt16 nB = aRect.Left();
+        const auto nH = rFont.GetFontSize().Height();
+        const auto nB = aRect.Left();
         // Use 18.75% as a threshold to define a centered fullwidth fullstop.
         // In general, nB/nH < 5% for most Japanese fonts.
         bCentered = nB > (((nH >> 1)+nH)>>3);


More information about the Libreoffice-commits mailing list