From 05d53f0355e9889c43bfa436e985d5643f249d99 Mon Sep 17 00:00:00 2001 From: Wei Li Date: Tue, 29 Mar 2016 16:42:53 -0700 Subject: Code change to avoid signed/unsigned mismatch warnings. This makes pdfium code on Linux and Mac sign-compare warning free. The warning flag will be re-enabled after checking on windows clang build. BUG=pdfium:29 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1841643002 . --- core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'core/fpdfapi/fpdf_render') diff --git a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index 9c1fa36b28..d3081da26f 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -58,15 +58,13 @@ static void DrawAxialShading(CFX_DIBitmap* pBitmap, FX_FLOAT axis_len_square = (x_span * x_span) + (y_span * y_span); CFX_Matrix matrix; matrix.SetReverse(*pObject2Bitmap); - int total_results = 0; + uint32_t total_results = 0; for (int j = 0; j < nFuncs; j++) { - if (pFuncs[j]) { + if (pFuncs[j]) total_results += pFuncs[j]->CountOutputs(); - } } - if (pCS->CountComponents() > total_results) { + if (pCS->CountComponents() > total_results) total_results = pCS->CountComponents(); - } CFX_FixedBufGrow result_array(total_results); FX_FLOAT* pResults = result_array; FXSYS_memset(pResults, 0, total_results * sizeof(FX_FLOAT)); @@ -144,7 +142,7 @@ static void DrawRadialShading(CFX_DIBitmap* pBitmap, bStartExtend = pArray->GetIntegerAt(0); bEndExtend = pArray->GetIntegerAt(1); } - int total_results = 0; + uint32_t total_results = 0; for (int j = 0; j < nFuncs; j++) { if (pFuncs[j]) { total_results += pFuncs[j]->CountOutputs(); @@ -273,15 +271,13 @@ static void DrawFuncShading(CFX_DIBitmap* pBitmap, int width = pBitmap->GetWidth(); int height = pBitmap->GetHeight(); int pitch = pBitmap->GetPitch(); - int total_results = 0; + uint32_t total_results = 0; for (int j = 0; j < nFuncs; j++) { - if (pFuncs[j]) { + if (pFuncs[j]) total_results += pFuncs[j]->CountOutputs(); - } } - if (pCS->CountComponents() > total_results) { + if (pCS->CountComponents() > total_results) total_results = pCS->CountComponents(); - } CFX_FixedBufGrow result_array(total_results); FX_FLOAT* pResults = result_array; FXSYS_memset(pResults, 0, total_results * sizeof(FX_FLOAT)); @@ -845,9 +841,8 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern, if (pBackColor && pBackColor->GetCount() >= pColorSpace->CountComponents()) { CFX_FixedBufGrow comps(pColorSpace->CountComponents()); - for (int i = 0; i < pColorSpace->CountComponents(); i++) { + for (uint32_t i = 0; i < pColorSpace->CountComponents(); i++) comps[i] = pBackColor->GetNumberAt(i); - } FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f; pColorSpace->GetRGB(comps, R, G, B); background = ArgbEncode(255, (int32_t)(R * 255), (int32_t)(G * 255), -- cgit v1.2.3