From 87c90cec38c43efbbd9cbfad1f0f607f428043d4 Mon Sep 17 00:00:00 2001 From: Noel Date: Thu, 15 Oct 2020 14:26:35 +0200 Subject: fix some *printf which are using "%l" ie. long specifiers which are not portable between Linux and Windows because long is not portable. In preparation for converting long -> tools::Long Change-Id: I8bf1aa1570946ca887a6c83dd5f99c024d437336 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104374 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/qa/cppunit/complextext.cxx | 6 ++--- vcl/qa/cppunit/graphicfilter/filters-test.cxx | 2 +- vcl/unx/generic/print/common_gfx.cxx | 39 ++++++++++++++------------- 3 files changed, 25 insertions(+), 22 deletions(-) (limited to 'vcl') diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx index 85a5b3991167..8cbe9b6c748e 100644 --- a/vcl/qa/cppunit/complextext.cxx +++ b/vcl/qa/cppunit/complextext.cxx @@ -109,9 +109,9 @@ void VclComplexTextTest::testArabic() tools::Rectangle aRectRot = pOutDev->GetTextRect( aInput, aOneTwoThree ); // Check that we did do the rotation... - fprintf( stderr, "%ld %ld %ld %ld\n", - aRect.GetWidth(), aRect.GetHeight(), - aRectRot.GetWidth(), aRectRot.GetHeight() ); + fprintf( stderr, "%" SAL_PRIdINT64 " %" SAL_PRIdINT64 " %" SAL_PRIdINT64 " %" SAL_PRIdINT64 "\n", + sal_Int64(aRect.GetWidth()), sal_Int64(aRect.GetHeight()), + sal-Int64(aRectRot.GetWidth()), sal_Int64(aRectRot.GetHeight()) ); CPPUNIT_ASSERT( aRectRot.GetWidth() == aRect.GetHeight() ); CPPUNIT_ASSERT( aRectRot.GetHeight() == aRect.GetWidth() ); #endif diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx index bc745fc530f8..b8d150b72d31 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx @@ -94,7 +94,7 @@ void VclFiltersTest::testScaling() fprintf( stderr, "scale with type %d\n", int( i ) ); CPPUNIT_ASSERT( aBitmapEx.Scale( 0.1937046, 0.193154, i ) ); Size aAfter( aBitmapEx.GetSizePixel() ); - fprintf( stderr, "size %ld, %ld\n", aAfter.Width(), aAfter.Height() ); + fprintf( stderr, "size %" SAL_PRIdINT64 ", %" SAL_PRIdINT64 "\n", sal_Int64(aAfter.Width()), sal_Int64(aAfter.Height()) ); CPPUNIT_ASSERT( labs (aAfter.Height() - aAfter.Width()) <= 1 ); } } diff --git a/vcl/unx/generic/print/common_gfx.cxx b/vcl/unx/generic/print/common_gfx.cxx index 3938dfdebbea..f43d38a76dbd 100644 --- a/vcl/unx/generic/print/common_gfx.cxx +++ b/vcl/unx/generic/print/common_gfx.cxx @@ -483,7 +483,7 @@ PrinterGfx::DrawPolyLineBezier (sal_uInt32 nPoints, const Point* pPath, const Po PSSetColor (); PSSetLineWidth (); - snprintf(pString, nBezString, "%li %li moveto\n", pPath[0].X(), pPath[0].Y()); + snprintf(pString, nBezString, "%" SAL_PRIdINT64 " %" SAL_PRIdINT64 " moveto\n", sal_Int64(pPath[0].X()), sal_Int64(pPath[0].Y())); WritePS(mpPageBody, pString); // Handle the drawing of mixed lines mixed with curves @@ -493,7 +493,7 @@ PrinterGfx::DrawPolyLineBezier (sal_uInt32 nPoints, const Point* pPath, const Po { if (pFlgAry[i] != PolyFlags::Control) //If the next point is a PolyFlags::Normal, we're drawing a line { - snprintf(pString, nBezString, "%li %li lineto\n", pPath[i].X(), pPath[i].Y()); + snprintf(pString, nBezString, "%" SAL_PRIdINT64 " %" SAL_PRIdINT64 " lineto\n", sal_Int64(pPath[i].X()), sal_Int64(pPath[i].Y())); i++; } else //Otherwise we're drawing a spline @@ -503,10 +503,10 @@ PrinterGfx::DrawPolyLineBezier (sal_uInt32 nPoints, const Point* pPath, const Po if ((pFlgAry[i] == PolyFlags::Control) && (pFlgAry[i+1] == PolyFlags::Control) && (pFlgAry[i+2] != PolyFlags::Control)) { - snprintf(pString, nBezString, "%li %li %li %li %li %li curveto\n", - pPath[i].X(), pPath[i].Y(), - pPath[i+1].X(), pPath[i+1].Y(), - pPath[i+2].X(), pPath[i+2].Y()); + snprintf(pString, nBezString, "%" SAL_PRIdINT64 " %" SAL_PRIdINT64 " %" SAL_PRIdINT64 " %" SAL_PRIdINT64 " %" SAL_PRIdINT64 " %" SAL_PRIdINT64 " curveto\n", + sal_Int64(pPath[i].X()), sal_Int64(pPath[i].Y()), + sal_Int64(pPath[i+1].X()), sal_Int64(pPath[i+1].Y()), + sal_Int64(pPath[i+2].X()), sal_Int64(pPath[i+2].Y())); } else { @@ -530,13 +530,14 @@ PrinterGfx::DrawPolygonBezier (sal_uInt32 nPoints, const Point* pPath, const Pol if (nPoints <= 0 || (pPath == nullptr) || !(maFillColor.Is() || maLineColor.Is())) return; - snprintf(pString, nBezString, "%li %li moveto\n", pPath[0].X(), pPath[0].Y()); + snprintf(pString, nBezString, "%" SAL_PRIdINT64 " %" SAL_PRIdINT64 " moveto\n", sal_Int64(pPath[0].X()), sal_Int64(pPath[0].Y())); WritePS(mpPageBody, pString); //Move to the starting point for the PolyPolygon for (unsigned int i=1; i < nPoints;) { if (pFlgAry[i] != PolyFlags::Control) { - snprintf(pString, nBezString, "%li %li lineto\n", pPath[i].X(), pPath[i].Y()); + snprintf(pString, nBezString, "%" SAL_PRIdINT64 " %" SAL_PRIdINT64 " lineto\n", + sal_Int64(pPath[i].X()), sal_Int64(pPath[i].Y())); WritePS(mpPageBody, pString); i++; } @@ -547,10 +548,10 @@ PrinterGfx::DrawPolygonBezier (sal_uInt32 nPoints, const Point* pPath, const Pol if ((pFlgAry[i] == PolyFlags::Control) && (pFlgAry[i+1] == PolyFlags::Control) && (pFlgAry[i+2] != PolyFlags::Control)) { - snprintf(pString, nBezString, "%li %li %li %li %li %li curveto\n", - pPath[i].X(), pPath[i].Y(), - pPath[i+1].X(), pPath[i+1].Y(), - pPath[i+2].X(), pPath[i+2].Y()); + snprintf(pString, nBezString, "%" SAL_PRIdINT64 " %" SAL_PRIdINT64 " %" SAL_PRIdINT64 " %" SAL_PRIdINT64 " %" SAL_PRIdINT64 " %" SAL_PRIdINT64 " curveto\n", + sal_Int64(pPath[i].X()), sal_Int64(pPath[i].Y()), + sal_Int64(pPath[i+1].X()), sal_Int64(pPath[i+1].Y()), + sal_Int64(pPath[i+2].X()), sal_Int64(pPath[i+2].Y())); WritePS(mpPageBody, pString); } else @@ -592,7 +593,8 @@ PrinterGfx::DrawPolyPolygonBezier (sal_uInt32 nPoly, const sal_uInt32 * pPoints, if( nPoints == 0 || pPtAry[i] == nullptr ) continue; - snprintf(pString, nBezString, "%li %li moveto\n", pPtAry[i][0].X(), pPtAry[i][0].Y()); //Move to the starting point + snprintf(pString, nBezString, "%" SAL_PRIdINT64 " %" SAL_PRIdINT64 " moveto\n", + sal_Int64(pPtAry[i][0].X()), sal_Int64(pPtAry[i][0].Y())); //Move to the starting point WritePS(mpPageBody, pString); for (unsigned int j=1; j < nPoints;) { @@ -600,7 +602,8 @@ PrinterGfx::DrawPolyPolygonBezier (sal_uInt32 nPoly, const sal_uInt32 * pPoints, // polygon without beziers if ( ! pFlgAry[i] || pFlgAry[i][j] != PolyFlags::Control) { - snprintf(pString, nBezString, "%li %li lineto\n", pPtAry[i][j].X(), pPtAry[i][j].Y()); + snprintf(pString, nBezString, "%" SAL_PRIdINT64 " %" SAL_PRIdINT64 " lineto\n", + sal_Int64(pPtAry[i][j].X()), sal_Int64(pPtAry[i][j].Y())); WritePS(mpPageBody, pString); j++; } @@ -610,10 +613,10 @@ PrinterGfx::DrawPolyPolygonBezier (sal_uInt32 nPoly, const sal_uInt32 * pPoints, break; //Error: wrong sequence of control/normal points somehow if ((pFlgAry[i][j] == PolyFlags::Control) && (pFlgAry[i][j+1] == PolyFlags::Control) && (pFlgAry[i][j+2] != PolyFlags::Control)) { - snprintf(pString, nBezString, "%li %li %li %li %li %li curveto\n", - pPtAry[i][j].X(), pPtAry[i][j].Y(), - pPtAry[i][j+1].X(), pPtAry[i][j+1].Y(), - pPtAry[i][j+2].X(), pPtAry[i][j+2].Y()); + snprintf(pString, nBezString, "%" SAL_PRIdINT64 " %" SAL_PRIdINT64 " %" SAL_PRIdINT64 " %" SAL_PRIdINT64 " %" SAL_PRIdINT64 " %" SAL_PRIdINT64 " curveto\n", + sal_Int64(pPtAry[i][j].X()), sal_Int64(pPtAry[i][j].Y()), + sal_Int64(pPtAry[i][j+1].X()), sal_Int64(pPtAry[i][j+1].Y()), + sal_Int64(pPtAry[i][j+2].X()), sal_Int64(pPtAry[i][j+2].Y())); WritePS(mpPageBody, pString); } else -- cgit v1.2.3