Kaydet (Commit) 3863005b authored tarafından Matteo Casalin's avatar Matteo Casalin

Fix some downcast warnings and reduce scope of variables

Change-Id: Ica5f5947f37207c9dd2e51b7903fad52dd4836fd
üst 9f7dad6b
...@@ -613,31 +613,30 @@ void WMFWriter::WMFRecord_Pie(const Rectangle & rRect, const Point & rStartPt, c ...@@ -613,31 +613,30 @@ void WMFWriter::WMFRecord_Pie(const Rectangle & rRect, const Point & rStartPt, c
void WMFWriter::WMFRecord_Polygon(const Polygon & rPoly) void WMFWriter::WMFRecord_Polygon(const Polygon & rPoly)
{ {
sal_uInt16 nSize,i;
Polygon aSimplePoly; Polygon aSimplePoly;
if ( rPoly.HasFlags() ) if ( rPoly.HasFlags() )
rPoly.AdaptiveSubdivide( aSimplePoly ); rPoly.AdaptiveSubdivide( aSimplePoly );
else else
aSimplePoly = rPoly; aSimplePoly = rPoly;
nSize = aSimplePoly.GetSize(); const sal_uInt16 nSize = aSimplePoly.GetSize();
WriteRecordHeader(((sal_uLong)nSize)*2+4,W_META_POLYGON); WriteRecordHeader(static_cast<sal_uInt32>(nSize)*2+4,W_META_POLYGON);
pWMF->WriteUInt16( nSize ); pWMF->WriteUInt16( nSize );
for (i=0; i<nSize; i++) WritePointXY(aSimplePoly.GetPoint(i)); for (sal_uInt16 i=0; i<nSize; ++i)
WritePointXY(aSimplePoly.GetPoint(i));
} }
void WMFWriter::WMFRecord_PolyLine(const Polygon & rPoly) void WMFWriter::WMFRecord_PolyLine(const Polygon & rPoly)
{ {
sal_uInt16 nSize,i;
Polygon aSimplePoly; Polygon aSimplePoly;
if ( rPoly.HasFlags() ) if ( rPoly.HasFlags() )
rPoly.AdaptiveSubdivide( aSimplePoly ); rPoly.AdaptiveSubdivide( aSimplePoly );
else else
aSimplePoly = rPoly; aSimplePoly = rPoly;
nSize=aSimplePoly.GetSize(); const sal_uInt16 nSize = aSimplePoly.GetSize();
WriteRecordHeader(((sal_uLong)nSize)*2+4,W_META_POLYLINE); WriteRecordHeader(static_cast<sal_uInt32>(nSize)*2+4,W_META_POLYLINE);
pWMF->WriteUInt16( nSize ); pWMF->WriteUInt16( nSize );
for (i=0; i<nSize; i++) WritePointXY(aSimplePoly.GetPoint(i)); for (sal_uInt16 i=0; i<nSize; ++i)
WritePointXY(aSimplePoly.GetPoint(i));
} }
void WMFWriter::WMFRecord_PolyPolygon(const tools::PolyPolygon & rPolyPoly) void WMFWriter::WMFRecord_PolyPolygon(const tools::PolyPolygon & rPolyPoly)
...@@ -1198,20 +1197,17 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF ) ...@@ -1198,20 +1197,17 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
const MetaStretchTextAction* pA = static_cast<const MetaStretchTextAction *>(pMA); const MetaStretchTextAction* pA = static_cast<const MetaStretchTextAction *>(pMA);
OUString aTemp = pA->GetText().copy( pA->GetIndex(), std::min<sal_Int32>(pA->GetText().getLength() - pA->GetIndex(), pA->GetLen()) ); OUString aTemp = pA->GetText().copy( pA->GetIndex(), std::min<sal_Int32>(pA->GetText().getLength() - pA->GetIndex(), pA->GetLen()) );
sal_uInt16 nLen,i;
sal_Int32 nNormSize;
pVirDev->SetFont( aSrcFont ); pVirDev->SetFont( aSrcFont );
nLen = aTemp.getLength(); const sal_Int32 nLen = aTemp.getLength();
std::unique_ptr<long[]> pDXAry(nLen ? new long[ nLen ] : NULL); std::unique_ptr<long[]> pDXAry(nLen ? new long[ nLen ] : NULL);
nNormSize = pVirDev->GetTextArray( aTemp, pDXAry.get() ); const sal_Int32 nNormSize = pVirDev->GetTextArray( aTemp, pDXAry.get() );
if (nLen && nNormSize == 0) if (nLen && nNormSize == 0)
{ {
OSL_FAIL("Impossible div by 0 action: MetaStretchTextAction!"); OSL_FAIL("Impossible div by 0 action: MetaStretchTextAction!");
} }
else else
{ {
for ( i = 0; i < ( nLen - 1 ); i++ ) for ( sal_Int32 i = 0; i < ( nLen - 1 ); i++ )
pDXAry[ i ] = pDXAry[ i ] * (sal_Int32)pA->GetWidth() / nNormSize; pDXAry[ i ] = pDXAry[ i ] * (sal_Int32)pA->GetWidth() / nNormSize;
if ( ( nLen <= 1 ) || ( (sal_Int32)pA->GetWidth() == nNormSize ) ) if ( ( nLen <= 1 ) || ( (sal_Int32)pA->GetWidth() == nNormSize ) )
pDXAry.reset(); pDXAry.reset();
......
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