[Libreoffice-commits] core.git: sw/source
Stephan Bergmann
sbergman at redhat.com
Wed Jan 31 12:14:54 UTC 2018
sw/source/filter/html/htmlnumreader.cxx | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
New commits:
commit 149bb368fc4911d3303095c7e06d87f564942783
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Wed Jan 31 09:03:33 2018 +0100
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 <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
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<long>(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<sal_uInt16>(aPropInfo.m_nLeftMargin);
+ nAbsLSpace = nAbsLSpace + aPropInfo.m_nLeftMargin;
aNumFormat.SetAbsLSpace( nAbsLSpace );
bChangeNumFormat = true;
More information about the Libreoffice-commits
mailing list