Kaydet (Commit) 149bb368 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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/48957Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst f941cd78
...@@ -104,7 +104,7 @@ void SwHTMLParser::NewNumBulList( HtmlTokenId nToken ) ...@@ -104,7 +104,7 @@ void SwHTMLParser::NewNumBulList( HtmlTokenId nToken )
nChrFormatPoolId = RES_POOLCHR_BUL_LEVEL; nChrFormatPoolId = RES_POOLCHR_BUL_LEVEL;
} }
sal_uInt16 nAbsLSpace = HTML_NUMBUL_MARGINLEFT; short nAbsLSpace = HTML_NUMBUL_MARGINLEFT;
short nFirstLineIndent = HTML_NUMBUL_INDENT; short nFirstLineIndent = HTML_NUMBUL_INDENT;
if( nLevel > 0 ) if( nLevel > 0 )
...@@ -265,17 +265,16 @@ void SwHTMLParser::NewNumBulList( HtmlTokenId nToken ) ...@@ -265,17 +265,16 @@ void SwHTMLParser::NewNumBulList( HtmlTokenId nToken )
if( aPropInfo.m_bLeftMargin ) if( aPropInfo.m_bLeftMargin )
{ {
// Default indent has already been added // Default indent has already been added
sal_uInt16 nAbsLSpace = long nAbsLSpace =
aNumFormat.GetAbsLSpace() - HTML_NUMBUL_MARGINLEFT; aNumFormat.GetAbsLSpace() - HTML_NUMBUL_MARGINLEFT;
if( aPropInfo.m_nLeftMargin < 0 && if( aPropInfo.m_nLeftMargin < 0 &&
nAbsLSpace < -aPropInfo.m_nLeftMargin ) nAbsLSpace < -aPropInfo.m_nLeftMargin )
nAbsLSpace = 0U; nAbsLSpace = 0U;
else if( aPropInfo.m_nLeftMargin > USHRT_MAX || else if( aPropInfo.m_nLeftMargin > SHRT_MAX ||
static_cast<long>(nAbsLSpace) + nAbsLSpace + aPropInfo.m_nLeftMargin > SHRT_MAX )
aPropInfo.m_nLeftMargin > USHRT_MAX ) nAbsLSpace = SHRT_MAX;
nAbsLSpace = USHRT_MAX;
else else
nAbsLSpace = nAbsLSpace + static_cast<sal_uInt16>(aPropInfo.m_nLeftMargin); nAbsLSpace = nAbsLSpace + aPropInfo.m_nLeftMargin;
aNumFormat.SetAbsLSpace( nAbsLSpace ); aNumFormat.SetAbsLSpace( nAbsLSpace );
bChangeNumFormat = true; bChangeNumFormat = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment