Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: core/fpdfapi/fpdf_page/cpdf_colorspace.cpp

Issue 1840483003: Reduce signed/unsigned comparison warnings (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
diff --git a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
index b1b464471d3fb82d58023284981280e2bec64830..0e67a3bdea60ff9375f2ff292a410944b85c7047 100644
--- a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
@@ -467,7 +467,7 @@ void CPDF_ColorSpace::GetDefaultColor(FX_FLOAT* buf) const {
return;
}
FX_FLOAT min, max;
- for (int i = 0; i < m_nComponents; i++) {
+ for (size_t i = 0; i < m_nComponents; i++) {
GetDefaultValue(i, buf[i], min, max);
}
}
@@ -490,7 +490,7 @@ void CPDF_ColorSpace::TranslateImageLine(uint8_t* dest_buf,
FX_FLOAT* src = srcbuf;
FX_FLOAT R, G, B;
for (int i = 0; i < pixels; i++) {
- for (int j = 0; j < m_nComponents; j++)
+ for (size_t j = 0; j < m_nComponents; j++)
Tom Sepez 2016/03/25 22:31:40 nit: probaby should be uint32_t to match m_nCompon
Wei Li 2016/03/26 01:04:10 I feel fixed width integers may not be needed in t
if (m_Family == PDFCS_INDEXED) {
src[j] = (FX_FLOAT)(*src_buf++);
} else {
@@ -842,7 +842,7 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
}
CPDF_Array* pRanges = pDict->GetArrayBy("Range");
m_pRanges = FX_Alloc2D(FX_FLOAT, m_nComponents, 2);
- for (int i = 0; i < m_nComponents * 2; i++) {
+ for (size_t i = 0; i < m_nComponents * 2; i++) {
if (pRanges)
m_pRanges[i] = pRanges->GetNumberAt(i);
else if (i % 2)
@@ -918,7 +918,7 @@ void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf,
ReverseRGB(pDestBuf, pSrcBuf, pixels);
} else if (m_pProfile->m_pTransform) {
int nMaxColors = 1;
- for (int i = 0; i < m_nComponents; i++) {
+ for (size_t i = 0; i < m_nComponents; i++) {
nMaxColors *= 52;
}
if (m_nComponents > 3 || image_width * image_height < nMaxColors * 3 / 2) {
@@ -932,7 +932,7 @@ void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf,
for (int i = 0; i < nMaxColors; i++) {
FX_DWORD color = i;
FX_DWORD order = nMaxColors / 52;
- for (int c = 0; c < m_nComponents; c++) {
+ for (size_t c = 0; c < m_nComponents; c++) {
*pSrc++ = (uint8_t)(color / order * 5);
color %= order;
order /= 52;
@@ -944,7 +944,7 @@ void CPDF_ICCBasedCS::TranslateImageLine(uint8_t* pDestBuf,
}
for (int i = 0; i < pixels; i++) {
int index = 0;
- for (int c = 0; c < m_nComponents; c++) {
+ for (size_t c = 0; c < m_nComponents; c++) {
index = index * 52 + (*pSrcBuf) / 5;
pSrcBuf++;
}
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_page/cpdf_textobject.cpp » ('j') | core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698