ofz#69246 Integer-overflow

WTMM takes/returns a double anyway, so just promote earlier

Change-Id: I055fa7e7b155abfd15ef51335b34c2e6cfa8a209
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168043
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Caolán McNamara 2024-05-26 12:35:19 +01:00
parent aa4188b8a6
commit fda349ab8e

View file

@ -2013,19 +2013,19 @@ void HwpReader::makeDrawStyle( HWPDrawingObject * hdo, FBoxStyle * fstyle)
OUString::createFromAscii(ArrowShape[hdo->property.line_tstyle].name) ); OUString::createFromAscii(ArrowShape[hdo->property.line_tstyle].name) );
if( hdo->property.line_width > 100 ) if( hdo->property.line_width > 100 )
mxList->addAttribute(u"draw:marker-start-width"_ustr, sXML_CDATA, mxList->addAttribute(u"draw:marker-start-width"_ustr, sXML_CDATA,
OUString::number( WTMM(hdo->property.line_width * 3)) + "mm"); OUString::number( WTMM(hdo->property.line_width * 3.0)) + "mm");
else if( hdo->property.line_width > 80 ) else if( hdo->property.line_width > 80 )
mxList->addAttribute(u"draw:marker-start-width"_ustr, sXML_CDATA, mxList->addAttribute(u"draw:marker-start-width"_ustr, sXML_CDATA,
OUString::number( WTMM(hdo->property.line_width * 4)) + "mm"); OUString::number( WTMM(hdo->property.line_width * 4.0)) + "mm");
else if( hdo->property.line_width > 60 ) else if( hdo->property.line_width > 60 )
mxList->addAttribute(u"draw:marker-start-width"_ustr, sXML_CDATA, mxList->addAttribute(u"draw:marker-start-width"_ustr, sXML_CDATA,
OUString::number( WTMM(hdo->property.line_width * 5)) + "mm"); OUString::number( WTMM(hdo->property.line_width * 5.0)) + "mm");
else if( hdo->property.line_width > 40 ) else if( hdo->property.line_width > 40 )
mxList->addAttribute(u"draw:marker-start-width"_ustr, sXML_CDATA, mxList->addAttribute(u"draw:marker-start-width"_ustr, sXML_CDATA,
OUString::number( WTMM(hdo->property.line_width * 6)) + "mm"); OUString::number( WTMM(hdo->property.line_width * 6.0)) + "mm");
else else
mxList->addAttribute(u"draw:marker-start-width"_ustr, sXML_CDATA, mxList->addAttribute(u"draw:marker-start-width"_ustr, sXML_CDATA,
OUString::number( WTMM(hdo->property.line_width * 7)) + "mm"); OUString::number( WTMM(hdo->property.line_width * 7.0)) + "mm");
} }
if( hdo->property.line_hstyle > 0 && if( hdo->property.line_hstyle > 0 &&
@ -2035,19 +2035,19 @@ void HwpReader::makeDrawStyle( HWPDrawingObject * hdo, FBoxStyle * fstyle)
OUString::createFromAscii(ArrowShape[hdo->property.line_hstyle].name) ); OUString::createFromAscii(ArrowShape[hdo->property.line_hstyle].name) );
if( hdo->property.line_width > 100 ) if( hdo->property.line_width > 100 )
mxList->addAttribute(u"draw:marker-end-width"_ustr, sXML_CDATA, mxList->addAttribute(u"draw:marker-end-width"_ustr, sXML_CDATA,
OUString::number( WTMM(hdo->property.line_width * 3)) + "mm"); OUString::number( WTMM(hdo->property.line_width * 3.0)) + "mm");
else if( hdo->property.line_width > 80 ) else if( hdo->property.line_width > 80 )
mxList->addAttribute(u"draw:marker-end-width"_ustr, sXML_CDATA, mxList->addAttribute(u"draw:marker-end-width"_ustr, sXML_CDATA,
OUString::number( WTMM(hdo->property.line_width * 4)) + "mm"); OUString::number( WTMM(hdo->property.line_width * 4.0)) + "mm");
else if( hdo->property.line_width > 60 ) else if( hdo->property.line_width > 60 )
mxList->addAttribute(u"draw:marker-end-width"_ustr, sXML_CDATA, mxList->addAttribute(u"draw:marker-end-width"_ustr, sXML_CDATA,
OUString::number( WTMM(hdo->property.line_width * 5)) + "mm"); OUString::number( WTMM(hdo->property.line_width * 5.0)) + "mm");
else if( hdo->property.line_width > 40 ) else if( hdo->property.line_width > 40 )
mxList->addAttribute(u"draw:marker-end-width"_ustr, sXML_CDATA, mxList->addAttribute(u"draw:marker-end-width"_ustr, sXML_CDATA,
OUString::number( WTMM(hdo->property.line_width * 6)) + "mm"); OUString::number( WTMM(hdo->property.line_width * 6.0)) + "mm");
else else
mxList->addAttribute(u"draw:marker-end-width"_ustr, sXML_CDATA, mxList->addAttribute(u"draw:marker-end-width"_ustr, sXML_CDATA,
OUString::number( WTMM(hdo->property.line_width * 7)) + "mm"); OUString::number( WTMM(hdo->property.line_width * 7.0)) + "mm");
} }
} }