From 149bb368fc4911d3303095c7e06d87f564942783 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 31 Jan 2018 09:03:33 +0100 Subject: SvxNumberFormat::SetAbsLSpace takes a short ...and none of the places that call SvxNumberFormat::GetAbsLSpace (also returning short) look like they deliberately cast back to sal_uInt16 (i.e., to tunnel a genuinely unsigned value through SvxNumberFormat), so it looks more plausible to restrict values here to short and SHRT_MAX, instead of sal_uInt16 and USHRT_MAX. Change-Id: I6807c1b29d30c3f9bfe1ad8b98d0b3ef64dd6a5a Reviewed-on: https://gerrit.libreoffice.org/48957 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- sw/source/filter/html/htmlnumreader.cxx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sw/source/filter/html/htmlnumreader.cxx b/sw/source/filter/html/htmlnumreader.cxx index 27045823103b..c6585fd2d434 100644 --- a/sw/source/filter/html/htmlnumreader.cxx +++ b/sw/source/filter/html/htmlnumreader.cxx @@ -104,7 +104,7 @@ void SwHTMLParser::NewNumBulList( HtmlTokenId nToken ) nChrFormatPoolId = RES_POOLCHR_BUL_LEVEL; } - sal_uInt16 nAbsLSpace = HTML_NUMBUL_MARGINLEFT; + short nAbsLSpace = HTML_NUMBUL_MARGINLEFT; short nFirstLineIndent = HTML_NUMBUL_INDENT; if( nLevel > 0 ) @@ -265,17 +265,16 @@ void SwHTMLParser::NewNumBulList( HtmlTokenId nToken ) if( aPropInfo.m_bLeftMargin ) { // Default indent has already been added - sal_uInt16 nAbsLSpace = + long nAbsLSpace = aNumFormat.GetAbsLSpace() - HTML_NUMBUL_MARGINLEFT; if( aPropInfo.m_nLeftMargin < 0 && nAbsLSpace < -aPropInfo.m_nLeftMargin ) nAbsLSpace = 0U; - else if( aPropInfo.m_nLeftMargin > USHRT_MAX || - static_cast(nAbsLSpace) + - aPropInfo.m_nLeftMargin > USHRT_MAX ) - nAbsLSpace = USHRT_MAX; + else if( aPropInfo.m_nLeftMargin > SHRT_MAX || + nAbsLSpace + aPropInfo.m_nLeftMargin > SHRT_MAX ) + nAbsLSpace = SHRT_MAX; else - nAbsLSpace = nAbsLSpace + static_cast(aPropInfo.m_nLeftMargin); + nAbsLSpace = nAbsLSpace + aPropInfo.m_nLeftMargin; aNumFormat.SetAbsLSpace( nAbsLSpace ); bChangeNumFormat = true; -- cgit