diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-10-28 04:12:59 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-10-28 10:12:39 +0100 |
commit | f5dd208719b6667394b2ab95d4a17296fb898224 (patch) | |
tree | 51fc7e3b45db3d01368b7f94f8092e67850cf230 /vcl/win/gdi/salfont.cxx | |
parent | 1132e59172f7beca5a39653cf9ee448f9f4577b1 (diff) |
tdf#120703 PVS: V547 Expression is always true/false
Change-Id: I2b2ea62ff4ed3e16cd4fa2a5e588d001d21121cb
Reviewed-on: https://gerrit.libreoffice.org/62465
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/win/gdi/salfont.cxx')
-rw-r--r-- | vcl/win/gdi/salfont.cxx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index 82c69c94a2c7..4409effd789f 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -765,8 +765,8 @@ void ImplGetLogFontFromFontSelect( HDC hDC, aName = rFont.GetFamilyName().getToken( 0, ';' ); UINT nNameLen = aName.getLength(); - if ( nNameLen > (sizeof( rLogFont.lfFaceName )/sizeof( wchar_t ))-1 ) - nNameLen = (sizeof( rLogFont.lfFaceName )/sizeof( wchar_t ))-1; + if (nNameLen >= LF_FACESIZE) + nNameLen = LF_FACESIZE - 1; memcpy( rLogFont.lfFaceName, aName.getStr(), nNameLen*sizeof( wchar_t ) ); rLogFont.lfFaceName[nNameLen] = 0; @@ -827,8 +827,7 @@ void ImplGetLogFontFromFontSelect( HDC hDC, { // restore non-vertical name if not vertical mode isn't available memcpy( &rLogFont.lfFaceName[0], aName.getStr(), nNameLen*sizeof(wchar_t) ); - if( nNameLen < LF_FACESIZE ) - rLogFont.lfFaceName[nNameLen] = '\0'; + rLogFont.lfFaceName[nNameLen] = '\0'; // keep it upright and create the font for sideway glyphs later. rLogFont.lfEscapement = rLogFont.lfEscapement - 2700; rLogFont.lfOrientation = rLogFont.lfEscapement; |