summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp9
-rw-r--r--core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp4
-rw-r--r--core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp3
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_cidfont.cpp6
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_simplefont.cpp17
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_type3font.cpp10
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_allstates.cpp5
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp8
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_shadingpattern.h2
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_parser.cpp14
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_array.cpp93
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp17
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_document.cpp13
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_parser.cpp5
-rw-r--r--core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp2
-rw-r--r--core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp2
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_array.h32
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_image.cpp6
-rw-r--r--core/fpdfdoc/cpvt_generateap.cpp4
-rw-r--r--core/fpdfdoc/doc_action.cpp11
-rw-r--r--core/fpdfdoc/doc_annot.cpp10
-rw-r--r--core/fpdfdoc/doc_basic.cpp51
-rw-r--r--core/fpdfdoc/doc_form.cpp25
-rw-r--r--core/fpdfdoc/doc_formcontrol.cpp4
-rw-r--r--core/fpdfdoc/doc_formfield.cpp19
-rw-r--r--core/fpdfdoc/doc_link.cpp2
-rw-r--r--core/fpdfdoc/doc_ocg.cpp18
-rw-r--r--core/fpdfdoc/doc_tagged.cpp2
-rw-r--r--core/fpdfdoc/doc_utils.cpp5
-rw-r--r--core/fpdfdoc/include/fpdf_doc.h10
-rw-r--r--fpdfsdk/fpdf_ext.cpp3
-rw-r--r--fpdfsdk/fpdfdoc.cpp13
-rw-r--r--fpdfsdk/fpdfppo.cpp3
-rw-r--r--fpdfsdk/fsdk_actionhandler.cpp2
-rw-r--r--fpdfsdk/fsdk_baseannot.cpp8
-rw-r--r--fpdfsdk/pdfwindow/PWL_Icon.cpp2
-rw-r--r--xfa/fxfa/app/xfa_ffdoc.cpp6
37 files changed, 214 insertions, 232 deletions
diff --git a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
index a484edd6b9..28cbdfc02e 100644
--- a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
@@ -129,11 +129,10 @@ void CPDF_PageContentGenerator::TransformContent(CFX_Matrix& matrix) {
CFX_ByteTextBuf buf;
if (CPDF_Array* pArray = pContent->AsArray()) {
- int iCount = pArray->GetCount();
+ size_t iCount = pArray->GetCount();
CPDF_StreamAcc** pContentArray = FX_Alloc(CPDF_StreamAcc*, iCount);
- int size = 0;
- int i = 0;
- for (i = 0; i < iCount; ++i) {
+ size_t size = 0;
+ for (size_t i = 0; i < iCount; ++i) {
pContent = pArray->GetObjectAt(i);
CPDF_Stream* pStream = ToStream(pContent);
if (!pStream)
@@ -146,7 +145,7 @@ void CPDF_PageContentGenerator::TransformContent(CFX_Matrix& matrix) {
}
int pos = 0;
uint8_t* pBuf = FX_Alloc(uint8_t, size);
- for (i = 0; i < iCount; ++i) {
+ for (size_t i = 0; i < iCount; ++i) {
FXSYS_memcpy(pBuf + pos, pContentArray[i]->GetData(),
pContentArray[i]->GetSize());
pos += pContentArray[i]->GetSize() + 1;
diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index a337cf59ff..c2e556c3a7 100644
--- a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -96,7 +96,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
}
offset += 1;
const CPDF_Array* p = pObj->AsArray();
- for (uint32_t i = 0; i < p->GetCount(); i++) {
+ for (size_t i = 0; i < p->GetCount(); i++) {
CPDF_Object* pElement = p->GetObjectAt(i);
if (pElement->GetObjNum()) {
if (pFile->AppendString(" ") < 0) {
@@ -1199,7 +1199,7 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
}
m_Offset += 1;
const CPDF_Array* p = pObj->AsArray();
- for (uint32_t i = 0; i < p->GetCount(); i++) {
+ for (size_t i = 0; i < p->GetCount(); i++) {
CPDF_Object* pElement = p->GetObjectAt(i);
if (pElement->GetObjNum()) {
if (m_File.AppendString(" ") < 0) {
diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
index 04ab9ea863..379e75938e 100644
--- a/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
+++ b/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
@@ -1033,8 +1033,7 @@ static int InsertDeletePDFPage(CPDF_Document* pDoc,
if (!pKidList) {
return -1;
}
- int nKids = pKidList->GetCount();
- for (int i = 0; i < nKids; i++) {
+ for (size_t i = 0; i < pKidList->GetCount(); i++) {
CPDF_Dictionary* pKid = pKidList->GetDictAt(i);
if (pKid->GetStringBy("Type") == "Page") {
if (nPagesToGo == 0) {
diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
index 3329f5c577..034f6f6ece 100644
--- a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
@@ -817,8 +817,7 @@ void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray,
int iCurElement = 0;
int first_code = 0;
int last_code = 0;
- uint32_t count = pArray->GetCount();
- for (uint32_t i = 0; i < count; i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Object* pObj = pArray->GetDirectObjectAt(i);
if (!pObj)
continue;
@@ -827,8 +826,7 @@ void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray,
if (width_status != 1)
return;
- uint32_t count = pArray->GetCount();
- for (uint32_t j = 0; j < count; j += nElements) {
+ for (size_t j = 0; j < pArray->GetCount(); j += nElements) {
result.Add(first_code);
result.Add(first_code);
for (int k = 0; k < nElements; k++) {
diff --git a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
index 0b4199aac0..b367184e2e 100644
--- a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
@@ -111,7 +111,6 @@ FX_BOOL CPDF_SimpleFont::LoadCommon() {
LoadFontDescriptor(pFontDesc);
}
CPDF_Array* pWidthArray = m_pFontDict->GetArrayBy("Widths");
- int width_start = 0, width_end = -1;
m_bUseFontWidth = TRUE;
if (pWidthArray) {
m_bUseFontWidth = FALSE;
@@ -121,19 +120,15 @@ FX_BOOL CPDF_SimpleFont::LoadCommon() {
m_CharWidth[i] = MissingWidth;
}
}
- width_start = m_pFontDict->GetIntegerBy("FirstChar", 0);
- width_end = m_pFontDict->GetIntegerBy("LastChar", 0);
- if (width_start >= 0 && width_start <= 255) {
- if (width_end <= 0 ||
- width_end >= width_start + (int)pWidthArray->GetCount()) {
+ size_t width_start = m_pFontDict->GetIntegerBy("FirstChar", 0);
+ size_t width_end = m_pFontDict->GetIntegerBy("LastChar", 0);
+ if (width_start <= 255) {
+ if (width_end == 0 || width_end >= width_start + pWidthArray->GetCount())
width_end = width_start + pWidthArray->GetCount() - 1;
- }
- if (width_end > 255) {
+ if (width_end > 255)
width_end = 255;
- }
- for (int i = width_start; i <= width_end; i++) {
+ for (size_t i = width_start; i <= width_end; i++)
m_CharWidth[i] = pWidthArray->GetIntegerAt(i - width_start);
- }
}
}
if (m_pFontFile) {
diff --git a/core/fpdfapi/fpdf_font/cpdf_type3font.cpp b/core/fpdfapi/fpdf_font/cpdf_type3font.cpp
index 9f37d4adee..92f5102cdb 100644
--- a/core/fpdfapi/fpdf_font/cpdf_type3font.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_type3font.cpp
@@ -57,14 +57,12 @@ FX_BOOL CPDF_Type3Font::Load() {
int StartChar = m_pFontDict->GetIntegerBy("FirstChar");
CPDF_Array* pWidthArray = m_pFontDict->GetArrayBy("Widths");
if (pWidthArray && (StartChar >= 0 && StartChar < 256)) {
- uint32_t count = pWidthArray->GetCount();
- if (count > 256) {
+ size_t count = pWidthArray->GetCount();
+ if (count > 256)
count = 256;
- }
- if (StartChar + count > 256) {
+ if (StartChar + count > 256)
count = 256 - StartChar;
- }
- for (uint32_t i = 0; i < count; i++) {
+ for (size_t i = 0; i < count; i++) {
m_CharWidthL[StartChar + i] =
FXSYS_round(pWidthArray->GetNumberAt(i) * xscale * 1000);
}
diff --git a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp
index f2d637f888..4fe5283251 100644
--- a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp
@@ -46,10 +46,9 @@ void CPDF_AllStates::SetLineDash(CPDF_Array* pArray,
FX_FLOAT scale) {
CFX_GraphStateData* pData = m_GraphState.GetModify();
pData->m_DashPhase = phase * scale;
- pData->SetDashCount(pArray->GetCount());
- for (uint32_t i = 0; i < pArray->GetCount(); i++) {
+ pData->SetDashCount(static_cast<int>(pArray->GetCount()));
+ for (size_t i = 0; i < pArray->GetCount(); i++)
pData->m_DashArray[i] = pArray->GetNumberAt(i) * scale;
- }
}
void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
diff --git a/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp b/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp
index f637a4463c..457de9667a 100644
--- a/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp
@@ -48,7 +48,7 @@ CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc,
}
CPDF_ShadingPattern::~CPDF_ShadingPattern() {
- for (int i = 0; i < m_nFuncs; ++i)
+ for (size_t i = 0; i < m_nFuncs; ++i)
delete m_pFunctions[i];
CPDF_ColorSpace* pCS = m_pCountedCS ? m_pCountedCS->get() : nullptr;
@@ -66,16 +66,16 @@ FX_BOOL CPDF_ShadingPattern::Load() {
return FALSE;
if (m_nFuncs) {
- for (int i = 0; i < m_nFuncs; i++)
+ for (size_t i = 0; i < m_nFuncs; i++)
delete m_pFunctions[i];
m_nFuncs = 0;
}
CPDF_Object* pFunc = pShadingDict->GetDirectObjectBy("Function");
if (pFunc) {
if (CPDF_Array* pArray = pFunc->AsArray()) {
- m_nFuncs = std::min<int>(pArray->GetCount(), 4);
+ m_nFuncs = std::min<size_t>(pArray->GetCount(), 4);
- for (int i = 0; i < m_nFuncs; i++)
+ for (size_t i = 0; i < m_nFuncs; i++)
m_pFunctions[i] = CPDF_Function::Load(pArray->GetDirectObjectAt(i));
} else {
m_pFunctions[0] = CPDF_Function::Load(pFunc);
diff --git a/core/fpdfapi/fpdf_page/cpdf_shadingpattern.h b/core/fpdfapi/fpdf_page/cpdf_shadingpattern.h
index 55a249a1bc..c9bbd07d2e 100644
--- a/core/fpdfapi/fpdf_page/cpdf_shadingpattern.h
+++ b/core/fpdfapi/fpdf_page/cpdf_shadingpattern.h
@@ -56,7 +56,7 @@ class CPDF_ShadingPattern : public CPDF_Pattern {
CPDF_CountedColorSpace* m_pCountedCS;
CPDF_Function* m_pFunctions[4];
- int m_nFuncs;
+ size_t m_nFuncs;
};
#endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_SHADINGPATTERN_H_
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 21edc9e0cd..ba2901df24 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -1418,14 +1418,14 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() {
if (!pArray) {
return;
}
- int n = pArray->GetCount();
- int nsegs = 0;
- for (int i = 0; i < n; i++) {
+ size_t n = pArray->GetCount();
+ size_t nsegs = 0;
+ for (size_t i = 0; i < n; i++) {
if (pArray->GetDirectObjectAt(i)->IsString())
nsegs++;
}
if (nsegs == 0) {
- for (int i = 0; i < n; i++) {
+ for (size_t i = 0; i < n; i++) {
m_pCurStates->m_TextX -=
(pArray->GetNumberAt(i) * m_pCurStates->m_TextState.GetFontSize()) /
1000;
@@ -1434,9 +1434,9 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() {
}
CFX_ByteString* pStrs = new CFX_ByteString[nsegs];
FX_FLOAT* pKerning = FX_Alloc(FX_FLOAT, nsegs);
- int iSegment = 0;
+ size_t iSegment = 0;
FX_FLOAT fInitKerning = 0;
- for (int i = 0; i < n; i++) {
+ for (size_t i = 0; i < n; i++) {
CPDF_Object* pObj = pArray->GetDirectObjectAt(i);
if (pObj->IsString()) {
CFX_ByteString str = pObj->GetString();
@@ -1801,7 +1801,7 @@ void PDF_ReplaceAbbr(CPDF_Object* pObj) {
}
case CPDF_Object::ARRAY: {
CPDF_Array* pArray = pObj->AsArray();
- for (uint32_t i = 0; i < pArray->GetCount(); i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Object* pElement = pArray->GetObjectAt(i);
if (pElement->IsName()) {
CFX_ByteString name = pElement->GetString();
diff --git a/core/fpdfapi/fpdf_parser/cpdf_array.cpp b/core/fpdfapi/fpdf_parser/cpdf_array.cpp
index 964ba64236..e2279c8e1d 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_array.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_array.cpp
@@ -15,11 +15,9 @@
CPDF_Array::CPDF_Array() {}
CPDF_Array::~CPDF_Array() {
- int size = m_Objects.GetSize();
- CPDF_Object** pList = m_Objects.GetData();
- for (int i = 0; i < size; i++) {
- if (pList[i])
- pList[i]->Release();
+ for (auto& it : m_Objects) {
+ if (it)
+ it->Release();
}
}
@@ -48,15 +46,15 @@ const CPDF_Array* CPDF_Array::AsArray() const {
CPDF_Object* CPDF_Array::Clone(FX_BOOL bDirect) const {
CPDF_Array* pCopy = new CPDF_Array();
for (size_t i = 0; i < GetCount(); i++) {
- CPDF_Object* value = m_Objects.GetAt(i);
- pCopy->m_Objects.Add(value->Clone(bDirect));
+ CPDF_Object* value = m_Objects.at(i);
+ pCopy->m_Objects.push_back(value->Clone(bDirect));
}
return pCopy;
}
CFX_FloatRect CPDF_Array::GetRect() {
CFX_FloatRect rect;
- if (!IsArray() || m_Objects.GetSize() != 4)
+ if (!IsArray() || m_Objects.size() != 4)
return rect;
rect.left = GetNumberAt(0);
@@ -68,7 +66,7 @@ CFX_FloatRect CPDF_Array::GetRect() {
CFX_Matrix CPDF_Array::GetMatrix() {
CFX_Matrix matrix;
- if (!IsArray() || m_Objects.GetSize() != 6)
+ if (!IsArray() || m_Objects.size() != 6)
return matrix;
matrix.Set(GetNumberAt(0), GetNumberAt(1), GetNumberAt(2), GetNumberAt(3),
@@ -76,43 +74,43 @@ CFX_Matrix CPDF_Array::GetMatrix() {
return matrix;
}
-CPDF_Object* CPDF_Array::GetObjectAt(uint32_t i) const {
- if (i >= (uint32_t)m_Objects.GetSize())
+CPDF_Object* CPDF_Array::GetObjectAt(size_t i) const {
+ if (i >= m_Objects.size())
return nullptr;
- return m_Objects.GetAt(i);
+ return m_Objects.at(i);
}
-CPDF_Object* CPDF_Array::GetDirectObjectAt(uint32_t i) const {
- if (i >= (uint32_t)m_Objects.GetSize())
+CPDF_Object* CPDF_Array::GetDirectObjectAt(size_t i) const {
+ if (i >= m_Objects.size())
return nullptr;
- return m_Objects.GetAt(i)->GetDirect();
+ return m_Objects.at(i)->GetDirect();
}
-CFX_ByteString CPDF_Array::GetStringAt(uint32_t i) const {
- if (i >= (uint32_t)m_Objects.GetSize())
+CFX_ByteString CPDF_Array::GetStringAt(size_t i) const {
+ if (i >= m_Objects.size())
return CFX_ByteString();
- return m_Objects.GetAt(i)->GetString();
+ return m_Objects.at(i)->GetString();
}
-CFX_ByteStringC CPDF_Array::GetConstStringAt(uint32_t i) const {
- if (i >= (uint32_t)m_Objects.GetSize())
+CFX_ByteStringC CPDF_Array::GetConstStringAt(size_t i) const {
+ if (i >= m_Objects.size())
return CFX_ByteStringC();
- return m_Objects.GetAt(i)->GetConstString();
+ return m_Objects.at(i)->GetConstString();
}
-int CPDF_Array::GetIntegerAt(uint32_t i) const {
- if (i >= (uint32_t)m_Objects.GetSize())
+int CPDF_Array::GetIntegerAt(size_t i) const {
+ if (i >= m_Objects.size())
return 0;
- return m_Objects.GetAt(i)->GetInteger();
+ return m_Objects.at(i)->GetInteger();
}
-FX_FLOAT CPDF_Array::GetNumberAt(uint32_t i) const {
- if (i >= (uint32_t)m_Objects.GetSize())
+FX_FLOAT CPDF_Array::GetNumberAt(size_t i) const {
+ if (i >= m_Objects.size())
return 0;
- return m_Objects.GetAt(i)->GetNumber();
+ return m_Objects.at(i)->GetNumber();
}
-CPDF_Dictionary* CPDF_Array::GetDictAt(uint32_t i) const {
+CPDF_Dictionary* CPDF_Array::GetDictAt(size_t i) const {
CPDF_Object* p = GetDirectObjectAt(i);
if (!p)
return NULL;
@@ -123,52 +121,59 @@ CPDF_Dictionary* CPDF_Array::GetDictAt(uint32_t i) const {
return NULL;
}
-CPDF_Stream* CPDF_Array::GetStreamAt(uint32_t i) const {
+CPDF_Stream* CPDF_Array::GetStreamAt(size_t i) const {
return ToStream(GetDirectObjectAt(i));
}
-CPDF_Array* CPDF_Array::GetArrayAt(uint32_t i) const {
+CPDF_Array* CPDF_Array::GetArrayAt(size_t i) const {
return ToArray(GetDirectObjectAt(i));
}
-void CPDF_Array::RemoveAt(uint32_t i, uint32_t nCount) {
- if (i >= (uint32_t)m_Objects.GetSize())
+void CPDF_Array::RemoveAt(size_t i, size_t nCount) {
+ if (i >= m_Objects.size())
return;
- if (nCount <= 0 || nCount > m_Objects.GetSize() - i)
+ if (nCount <= 0 || nCount > m_Objects.size() - i)
return;
- for (uint32_t j = 0; j < nCount; ++j) {
- if (CPDF_Object* p = m_Objects.GetAt(i + j))
+ for (size_t j = 0; j < nCount; ++j) {
+ if (CPDF_Object* p = m_Objects.at(i + j))
p->Release();
}
- m_Objects.RemoveAt(i, nCount);
+ m_Objects.erase(m_Objects.begin() + i, m_Objects.begin() + i + nCount);
}
-void CPDF_Array::SetAt(uint32_t i,
+void CPDF_Array::SetAt(size_t i,
CPDF_Object* pObj,
CPDF_IndirectObjectHolder* pObjs) {
ASSERT(IsArray());
- ASSERT(i < (uint32_t)m_Objects.GetSize());
- if (i >= (uint32_t)m_Objects.GetSize())
+ ASSERT(i < m_Objects.size());
+ if (i >= m_Objects.size())
return;
- if (CPDF_Object* pOld = m_Objects.GetAt(i))
+ if (CPDF_Object* pOld = m_Objects.at(i))
pOld->Release();
if (pObj->GetObjNum()) {
ASSERT(pObjs);
pObj = new CPDF_Reference(pObjs, pObj->GetObjNum());
}
- m_Objects.SetAt(i, pObj);
+ m_Objects[i] = pObj;
}
-void CPDF_Array::InsertAt(uint32_t index,
+void CPDF_Array::InsertAt(size_t index,
CPDF_Object* pObj,
CPDF_IndirectObjectHolder* pObjs) {
if (pObj->GetObjNum()) {
ASSERT(pObjs);
pObj = new CPDF_Reference(pObjs, pObj->GetObjNum());
}
- m_Objects.InsertAt(index, pObj);
+ if (index >= m_Objects.size()) {
+ // Allocate space first.
+ m_Objects.resize(index + 1, nullptr);
+ m_Objects[index] = pObj;
+ } else {
+ // Directly insert.
+ m_Objects.insert(m_Objects.begin() + index, pObj);
+ }
}
void CPDF_Array::Add(CPDF_Object* pObj, CPDF_IndirectObjectHolder* pObjs) {
@@ -176,7 +181,7 @@ void CPDF_Array::Add(CPDF_Object* pObj, CPDF_IndirectObjectHolder* pObjs) {
ASSERT(pObjs);
pObj = new CPDF_Reference(pObjs, pObj->GetObjNum());
}
- m_Objects.Add(pObj);
+ m_Objects.push_back(pObj);
}
void CPDF_Array::AddName(const CFX_ByteString& str) {
diff --git a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp
index 68f8b88557..e08e913f74 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp
@@ -142,8 +142,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(
uint32_t count = 0;
CFX_ArrayTemplate<CPDF_Object*> new_obj_array;
- int32_t i = 0;
- for (i = 0; i < obj_array.GetSize(); i++) {
+ for (int i = 0; i < obj_array.GetSize(); i++) {
CPDF_Object* pObj = obj_array[i];
if (!pObj)
continue;
@@ -152,7 +151,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(
switch (type) {
case CPDF_Object::ARRAY: {
CPDF_Array* pArray = pObj->GetArray();
- for (uint32_t k = 0; k < pArray->GetCount(); ++k)
+ for (size_t k = 0; k < pArray->GetCount(); ++k)
new_obj_array.Add(pArray->GetObjectAt(k));
} break;
case CPDF_Object::STREAM:
@@ -193,8 +192,7 @@ FX_BOOL CPDF_DataAvail::IsObjectsAvail(
}
if (count > 0) {
- int32_t iSize = new_obj_array.GetSize();
- for (i = 0; i < iSize; ++i) {
+ for (int i = 0; i < new_obj_array.GetSize(); ++i) {
CPDF_Object* pObj = new_obj_array[i];
if (CPDF_Reference* pRef = pObj->AsReference()) {
uint32_t dwNum = pRef->GetRefObjNum();
@@ -513,8 +511,7 @@ FX_BOOL CPDF_DataAvail::CheckPage(IPDF_DataAvail::DownloadHints* pHints) {
if (pObj->IsArray()) {
CPDF_Array* pArray = pObj->GetArray();
if (pArray) {
- int32_t iSize = pArray->GetCount();
- for (int32_t j = 0; j < iSize; ++j) {
+ for (size_t j = 0; j < pArray->GetCount(); ++j) {
if (CPDF_Reference* pRef = ToReference(pArray->GetObjectAt(j)))
UnavailObjList.Add(pRef->GetRefObjNum());
}
@@ -583,7 +580,7 @@ FX_BOOL CPDF_DataAvail::GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages) {
break;
case CPDF_Object::ARRAY: {
CPDF_Array* pKidsArray = pKids->AsArray();
- for (uint32_t i = 0; i < pKidsArray->GetCount(); ++i) {
+ for (size_t i = 0; i < pKidsArray->GetCount(); ++i) {
if (CPDF_Reference* pRef = ToReference(pKidsArray->GetObjectAt(i)))
m_PageObjList.Add(pRef->GetRefObjNum());
}
@@ -1285,7 +1282,7 @@ FX_BOOL CPDF_DataAvail::CheckArrayPageNode(
}
pPageNode->m_type = PDF_PAGENODE_PAGES;
- for (uint32_t i = 0; i < pArray->GetCount(); ++i) {
+ for (size_t i = 0; i < pArray->GetCount(); ++i) {
CPDF_Reference* pKid = ToReference(pArray->GetObjectAt(i));
if (!pKid)
continue;
@@ -1348,7 +1345,7 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(
} break;
case CPDF_Object::ARRAY: {
CPDF_Array* pKidsArray = pKids->AsArray();
- for (uint32_t i = 0; i < pKidsArray->GetCount(); ++i) {
+ for (size_t i = 0; i < pKidsArray->GetCount(); ++i) {
CPDF_Reference* pKid = ToReference(pKidsArray->GetObjectAt(i));
if (!pKid)
continue;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
index d48edd056b..808a468016 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
@@ -32,7 +32,7 @@ int CountPages(CPDF_Dictionary* pPages,
return 0;
}
count = 0;
- for (uint32_t i = 0; i < pKidList->GetCount(); i++) {
+ for (size_t i = 0; i < pKidList->GetCount(); i++) {
CPDF_Dictionary* pKid = pKidList->GetDictAt(i);
if (!pKid || pdfium::ContainsKey(*visited_pages, pKid)) {
continue;
@@ -155,8 +155,7 @@ CPDF_Dictionary* CPDF_Document::_FindPDFPage(CPDF_Dictionary* pPages,
if (level >= FX_MAX_PAGE_LEVEL) {
return NULL;
}
- int nKids = pKidList->GetCount();
- for (int i = 0; i < nKids; i++) {
+ for (size_t i = 0; i < pKidList->GetCount(); i++) {
CPDF_Dictionary* pKid = pKidList->GetDictAt(i);
if (!pKid) {
nPagesToGo--;
@@ -228,23 +227,23 @@ int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode,
if (level >= FX_MAX_PAGE_LEVEL) {
return -1;
}
- uint32_t count = pNode->GetIntegerBy("Count");
+ size_t count = pNode->GetIntegerBy("Count");
if (count <= skip_count) {
skip_count -= count;
index += count;
return -1;
}
if (count && count == pKidList->GetCount()) {
- for (uint32_t i = 0; i < count; i++) {
+ for (size_t i = 0; i < count; i++) {
if (CPDF_Reference* pKid = ToReference(pKidList->GetObjectAt(i))) {
if (pKid->GetRefObjNum() == objnum) {
m_PageList.SetAt(index + i, objnum);
- return index + i;
+ return static_cast<int>(index + i);
}
}
}
}
- for (uint32_t i = 0; i < pKidList->GetCount(); i++) {
+ for (size_t i = 0; i < pKidList->GetCount(); i++) {
CPDF_Dictionary* pKid = pKidList->GetDictAt(i);
if (!pKid) {
continue;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
index 4ba43678b8..97b03f046c 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
@@ -988,8 +988,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
std::vector<std::pair<int32_t, int32_t>> arrIndex;
CPDF_Array* pArray = pStream->GetDict()->GetArrayBy("Index");
if (pArray) {
- uint32_t nPairSize = pArray->GetCount() / 2;
- for (uint32_t i = 0; i < nPairSize; i++) {
+ for (size_t i = 0; i < pArray->GetCount() / 2; i++) {
CPDF_Object* pStartNumObj = pArray->GetObjectAt(i * 2);
CPDF_Object* pCountObj = pArray->GetObjectAt(i * 2 + 1);
@@ -1013,7 +1012,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
CFX_ArrayTemplate<uint32_t> WidthArray;
FX_SAFE_UINT32 dwAccWidth = 0;
- for (uint32_t i = 0; i < pArray->GetCount(); i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
WidthArray.Add(pArray->GetIntegerAt(i));
dwAccWidth += WidthArray[i];
}
diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index 0a7729fe4b..11d9e524ee 100644
--- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -349,7 +349,7 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
if (!pParamsArray)
pParams = nullptr;
- for (uint32_t i = 0; i < pDecoders->GetCount(); i++) {
+ for (size_t i = 0; i < pDecoders->GetCount(); i++) {
DecoderList.push_back(pDecoders->GetConstStringAt(i));
ParamList.Add(pParams ? pParamsArray->GetDictAt(i) : nullptr);
}
diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
index 31e7388bd7..bfd0de44b6 100644
--- a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
+++ b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
@@ -179,7 +179,7 @@ CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj) {
case CPDF_Object::ARRAY: {
const CPDF_Array* p = pObj->AsArray();
buf << "[";
- for (uint32_t i = 0; i < p->GetCount(); i++) {
+ for (size_t i = 0; i < p->GetCount(); i++) {
CPDF_Object* pElement = p->GetObjectAt(i);
if (pElement->GetObjNum()) {
buf << " " << pElement->GetObjNum() << " 0 R";
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_array.h b/core/fpdfapi/fpdf_parser/include/cpdf_array.h
index b964f4955b..506a6bc338 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_array.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_array.h
@@ -7,6 +7,8 @@
#ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_ARRAY_H_
#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_ARRAY_H_
+#include <vector>
+
#include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h"
#include "core/fxcrt/include/fx_basic.h"
@@ -24,27 +26,27 @@ class CPDF_Array : public CPDF_Object {
CPDF_Array* AsArray() override;
const CPDF_Array* AsArray() const override;
- uint32_t GetCount() const { return m_Objects.GetSize(); }
- CPDF_Object* GetObjectAt(uint32_t index) const;
- CPDF_Object* GetDirectObjectAt(uint32_t index) const;
- CFX_ByteString GetStringAt(uint32_t index) const;
- CFX_ByteStringC GetConstStringAt(uint32_t index) const;
- int GetIntegerAt(uint32_t index) const;
- FX_FLOAT GetNumberAt(uint32_t index) const;
- CPDF_Dictionary* GetDictAt(uint32_t index) const;
- CPDF_Stream* GetStreamAt(uint32_t index) const;
- CPDF_Array* GetArrayAt(uint32_t index) const;
- FX_FLOAT GetFloatAt(uint32_t index) const { return GetNumberAt(index); }
+ size_t GetCount() const { return m_Objects.size(); }
+ CPDF_Object* GetObjectAt(size_t index) const;
+ CPDF_Object* GetDirectObjectAt(size_t index) const;
+ CFX_ByteString GetStringAt(size_t index) const;
+ CFX_ByteStringC GetConstStringAt(size_t index) const;
+ int GetIntegerAt(size_t index) const;
+ FX_FLOAT GetNumberAt(size_t index) const;
+ CPDF_Dictionary* GetDictAt(size_t index) const;
+ CPDF_Stream* GetStreamAt(size_t index) const;
+ CPDF_Array* GetArrayAt(size_t index) const;
+ FX_FLOAT GetFloatAt(size_t index) const { return GetNumberAt(index); }
CFX_Matrix GetMatrix();
CFX_FloatRect GetRect();
- void SetAt(uint32_t index,
+ void SetAt(size_t index,
CPDF_Object* pObj,
CPDF_IndirectObjectHolder* pObjs = nullptr);
- void InsertAt(uint32_t index,
+ void InsertAt(size_t index,
CPDF_Object* pObj,
CPDF_IndirectObjectHolder* pObjs = nullptr);
- void RemoveAt(uint32_t index, uint32_t nCount = 1);
+ void RemoveAt(size_t index, size_t nCount = 1);
void Add(CPDF_Object* pObj, CPDF_IndirectObjectHolder* pObjs = nullptr);
void AddNumber(FX_FLOAT f);
@@ -59,7 +61,7 @@ class CPDF_Array : public CPDF_Object {
protected:
~CPDF_Array() override;
- CFX_ArrayTemplate<CPDF_Object*> m_Objects;
+ std::vector<CPDF_Object*> m_Objects;
};
#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_ARRAY_H_
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
index efb55d928f..6aee8e75b6 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
@@ -417,7 +417,7 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() {
m_Flags |= FXRENDER_IMAGE_LOSSY;
}
} else if (CPDF_Array* pArray = pFilters->AsArray()) {
- for (uint32_t i = 0; i < pArray->GetCount(); i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
CFX_ByteStringC bsDecodeType = pArray->GetConstStringAt(i);
if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode") {
m_Flags |= FXRENDER_IMAGE_LOSSY;
@@ -937,8 +937,8 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict,
return NULL;
}
FXSYS_memset(pFloats, 0, num_floats.ValueOrDie());
- int count = pBC->GetCount() > 8 ? 8 : pBC->GetCount();
- for (int i = 0; i < count; i++) {
+ size_t count = pBC->GetCount() > 8 ? 8 : pBC->GetCount();
+ for (size_t i = 0; i < count; i++) {
pFloats[i] = pBC->GetNumberAt(i);
}
pCS->GetRGB(pFloats, R, G, B);
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index 19b171a896..a837c35801 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -356,7 +356,7 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
CFX_ByteTextBuf sBody;
if (pOpts) {
FX_FLOAT fy = rcBody.top;
- for (int32_t i = nTop, sz = pOpts->GetCount(); i < sz; i++) {
+ for (size_t i = nTop, sz = pOpts->GetCount(); i < sz; i++) {
if (IsFloatSmaller(fy, rcBody.bottom))
break;
@@ -369,7 +369,7 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
FX_BOOL bSelected = FALSE;
if (pSels) {
- for (uint32_t s = 0, ssz = pSels->GetCount(); s < ssz; s++) {
+ for (size_t s = 0, ssz = pSels->GetCount(); s < ssz; s++) {
if (i == pSels->GetIntegerAt(s)) {
bSelected = TRUE;
break;
diff --git a/core/fpdfdoc/doc_action.cpp b/core/fpdfdoc/doc_action.cpp
index 3036d61ab0..c478bbe1f4 100644
--- a/core/fpdfdoc/doc_action.cpp
+++ b/core/fpdfdoc/doc_action.cpp
@@ -101,7 +101,7 @@ CFX_ByteString CPDF_Action::GetURI(CPDF_Document* pDoc) const {
}
return csURI;
}
-uint32_t CPDF_ActionFields::GetFieldsCount() const {
+size_t CPDF_ActionFields::GetFieldsCount() const {
if (!m_pAction) {
return 0;
}
@@ -148,8 +148,7 @@ std::vector<CPDF_Object*> CPDF_ActionFields::GetAllFields() const {
if (pFields->IsDictionary() || pFields->IsString()) {
fields.push_back(pFields);
} else if (CPDF_Array* pArray = pFields->AsArray()) {
- uint32_t iCount = pArray->GetCount();
- for (uint32_t i = 0; i < iCount; ++i) {
+ for (size_t i = 0; i < pArray->GetCount(); ++i) {
CPDF_Object* pObj = pArray->GetDirectObjectAt(i);
if (pObj) {
fields.push_back(pObj);
@@ -159,7 +158,7 @@ std::vector<CPDF_Object*> CPDF_ActionFields::GetAllFields() const {
return fields;
}
-CPDF_Object* CPDF_ActionFields::GetField(uint32_t iIndex) const {
+CPDF_Object* CPDF_ActionFields::GetField(size_t iIndex) const {
if (!m_pAction) {
return NULL;
}
@@ -233,7 +232,7 @@ int32_t CPDF_Action::GetOperationType() const {
}
return 0;
}
-uint32_t CPDF_Action::GetSubActionsCount() const {
+size_t CPDF_Action::GetSubActionsCount() const {
if (!m_pDict || !m_pDict->KeyExist("Next"))
return 0;
@@ -246,7 +245,7 @@ uint32_t CPDF_Action::GetSubActionsCount() const {
return pArray->GetCount();
return 0;
}
-CPDF_Action CPDF_Action::GetSubAction(uint32_t iIndex) const {
+CPDF_Action CPDF_Action::GetSubAction(size_t iIndex) const {
if (!m_pDict || !m_pDict->KeyExist("Next")) {
return CPDF_Action();
}
diff --git a/core/fpdfdoc/doc_annot.cpp b/core/fpdfdoc/doc_annot.cpp
index 1db37ccdb3..8650fbd23d 100644
--- a/core/fpdfdoc/doc_annot.cpp
+++ b/core/fpdfdoc/doc_annot.cpp
@@ -29,7 +29,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm");
FX_BOOL bRegenerateAP =
pAcroForm && pAcroForm->GetBooleanBy("NeedAppearances");
- for (uint32_t i = 0; i < pAnnots->GetCount(); ++i) {
+ for (size_t i = 0; i < pAnnots->GetCount(); ++i) {
CPDF_Dictionary* pDict = ToDictionary(pAnnots->GetDirectObjectAt(i));
if (!pDict)
continue;
@@ -286,8 +286,8 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice,
if (!pDashArray) {
return;
}
- int nLen = pDashArray->GetCount();
- int i = 0;
+ size_t nLen = pDashArray->GetCount();
+ size_t i = 0;
for (; i < nLen; ++i) {
CPDF_Object* pObj = pDashArray->GetDirectObjectAt(i);
if (pObj && pObj->GetInteger()) {
@@ -323,13 +323,13 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice,
graph_state.m_LineWidth = width;
if (style_char == 'D') {
if (pDashArray) {
- uint32_t dash_count = pDashArray->GetCount();
+ size_t dash_count = pDashArray->GetCount();
if (dash_count % 2) {
dash_count++;
}
graph_state.m_DashArray = FX_Alloc(FX_FLOAT, dash_count);
graph_state.m_DashCount = dash_count;
- uint32_t i;
+ size_t i;
for (i = 0; i < pDashArray->GetCount(); ++i) {
graph_state.m_DashArray[i] = pDashArray->GetNumberAt(i);
}
diff --git a/core/fpdfdoc/doc_basic.cpp b/core/fpdfdoc/doc_basic.cpp
index bdb3f8cb0a..1cfca7e8ee 100644
--- a/core/fpdfdoc/doc_basic.cpp
+++ b/core/fpdfdoc/doc_basic.cpp
@@ -78,9 +78,10 @@ CPDF_NameTree::CPDF_NameTree(CPDF_Document* pDoc,
else
m_pRoot = NULL;
}
+
static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
const CFX_ByteString& csName,
- int& nIndex,
+ size_t& nIndex,
CPDF_Array** ppFind,
int nLevel = 0) {
if (nLevel > nMaxRecursion) {
@@ -102,8 +103,8 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
}
CPDF_Array* pNames = pNode->GetArrayBy("Names");
if (pNames) {
- uint32_t dwCount = pNames->GetCount() / 2;
- for (uint32_t i = 0; i < dwCount; i++) {
+ size_t dwCount = pNames->GetCount() / 2;
+ for (size_t i = 0; i < dwCount; i++) {
CFX_ByteString csValue = pNames->GetStringAt(i * 2);
int32_t iCompare = csValue.Compare(csName.AsStringC());
if (iCompare <= 0) {
@@ -126,7 +127,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
if (!pKids) {
return NULL;
}
- for (uint32_t i = 0; i < pKids->GetCount(); i++) {
+ for (size_t i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
if (!pKid) {
continue;
@@ -139,46 +140,44 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
}
return NULL;
}
+
static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
- int nIndex,
- int& nCurIndex,
+ size_t nIndex,
+ size_t& nCurIndex,
CFX_ByteString& csName,
CPDF_Array** ppFind,
int nLevel = 0) {
- if (nLevel > nMaxRecursion) {
+ if (nLevel > nMaxRecursion)
return NULL;
- }
+
CPDF_Array* pNames = pNode->GetArrayBy("Names");
if (pNames) {
- int nCount = pNames->GetCount() / 2;
+ size_t nCount = pNames->GetCount() / 2;
if (nIndex >= nCurIndex + nCount) {
nCurIndex += nCount;
return NULL;
}
- if (ppFind) {
+ if (ppFind)
*ppFind = pNames;
- }
csName = pNames->GetStringAt((nIndex - nCurIndex) * 2);
return pNames->GetDirectObjectAt((nIndex - nCurIndex) * 2 + 1);
}
CPDF_Array* pKids = pNode->GetArrayBy("Kids");
- if (!pKids) {
+ if (!pKids)
return NULL;
- }
- for (uint32_t i = 0; i < pKids->GetCount(); i++) {
+ for (size_t i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
- if (!pKid) {
+ if (!pKid)
continue;
- }
CPDF_Object* pFound =
SearchNameNode(pKid, nIndex, nCurIndex, csName, ppFind, nLevel + 1);
- if (pFound) {
+ if (pFound)
return pFound;
- }
}
return NULL;
}
-static int CountNames(CPDF_Dictionary* pNode, int nLevel = 0) {
+
+static size_t CountNames(CPDF_Dictionary* pNode, int nLevel = 0) {
if (nLevel > nMaxRecursion) {
return 0;
}
@@ -190,8 +189,8 @@ static int CountNames(CPDF_Dictionary* pNode, int nLevel = 0) {
if (!pKids) {
return 0;
}
- int nCount = 0;
- for (uint32_t i = 0; i < pKids->GetCount(); i++) {
+ size_t nCount = 0;
+ for (size_t i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
if (!pKid) {
continue;
@@ -200,17 +199,19 @@ static int CountNames(CPDF_Dictionary* pNode, int nLevel = 0) {
}
return nCount;
}
-int CPDF_NameTree::GetCount() const {
+
+size_t CPDF_NameTree::GetCount() const {
if (!m_pRoot) {
return 0;
}
return ::CountNames(m_pRoot);
}
+
int CPDF_NameTree::GetIndex(const CFX_ByteString& csName) const {
if (!m_pRoot) {
return -1;
}
- int nIndex = 0;
+ size_t nIndex = 0;
if (!SearchNameNode(m_pRoot, csName, nIndex, NULL)) {
return -1;
}
@@ -221,14 +222,14 @@ CPDF_Object* CPDF_NameTree::LookupValue(int nIndex,
if (!m_pRoot) {
return NULL;
}
- int nCurIndex = 0;
+ size_t nCurIndex = 0;
return SearchNameNode(m_pRoot, nIndex, nCurIndex, csName, NULL);
}
CPDF_Object* CPDF_NameTree::LookupValue(const CFX_ByteString& csName) const {
if (!m_pRoot) {
return NULL;
}
- int nIndex = 0;
+ size_t nIndex = 0;
return SearchNameNode(m_pRoot, csName, nIndex, NULL);
}
CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc,
diff --git a/core/fpdfdoc/doc_form.cpp b/core/fpdfdoc/doc_form.cpp
index e1f5f30856..207b824545 100644
--- a/core/fpdfdoc/doc_form.cpp
+++ b/core/fpdfdoc/doc_form.cpp
@@ -278,10 +278,8 @@ CPDF_InterForm::CPDF_InterForm(CPDF_Document* pDocument, FX_BOOL bGenerateAP)
if (!pFields)
return;
- int count = pFields->GetCount();
- for (int i = 0; i < count; i++) {
+ for (size_t i = 0; i < pFields->GetCount(); i++)
LoadField(pFields->GetDictAt(i));
- }
}
CPDF_InterForm::~CPDF_InterForm() {
@@ -704,8 +702,8 @@ CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage,
if (!pAnnotList)
return nullptr;
- for (uint32_t i = pAnnotList->GetCount(); i > 0; --i) {
- uint32_t annot_index = i - 1;
+ for (size_t i = pAnnotList->GetCount(); i > 0; --i) {
+ size_t annot_index = i - 1;
CPDF_Dictionary* pAnnot = pAnnotList->GetDictAt(annot_index);
if (!pAnnot)
continue;
@@ -720,7 +718,7 @@ CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage,
continue;
if (z_order)
- *z_order = annot_index;
+ *z_order = static_cast<int>(annot_index);
return pControl;
}
return nullptr;
@@ -742,6 +740,7 @@ void CPDF_InterForm::NeedConstructAP(FX_BOOL bNeedAP) {
m_pFormDict->SetAtBoolean("NeedAppearances", bNeedAP);
m_bGenerateAP = bNeedAP;
}
+
int CPDF_InterForm::CountFieldsInCalculationOrder() {
if (!m_pFormDict) {
return 0;
@@ -749,6 +748,7 @@ int CPDF_InterForm::CountFieldsInCalculationOrder() {
CPDF_Array* pArray = m_pFormDict->GetArrayBy("CO");
return pArray ? pArray->GetCount() : 0;
}
+
CPDF_FormField* CPDF_InterForm::GetFieldInCalculationOrder(int index) {
if (!m_pFormDict || index < 0) {
return NULL;
@@ -771,7 +771,7 @@ int CPDF_InterForm::FindFieldInCalculationOrder(const CPDF_FormField* pField) {
if (!pArray) {
return -1;
}
- for (uint32_t i = 0; i < pArray->GetCount(); i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Object* pElement = pArray->GetDirectObjectAt(i);
if (pElement == pField->m_pDict) {
return i;
@@ -901,7 +901,7 @@ void CPDF_InterForm::LoadField(CPDF_Dictionary* pFieldDict, int nLevel) {
return;
}
if (pFirstKid->KeyExist("T") || pFirstKid->KeyExist("Kids")) {
- for (uint32_t i = 0; i < pKids->GetCount(); i++) {
+ for (size_t i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pChildDict = pKids->GetDictAt(i);
if (pChildDict) {
if (pChildDict->GetObjNum() != dwParentObjNum) {
@@ -925,8 +925,7 @@ void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) {
if (!pAnnots) {
return;
}
- int iAnnotCount = pAnnots->GetCount();
- for (int i = 0; i < iAnnotCount; i++) {
+ for (size_t i = 0; i < pAnnots->GetCount(); i++) {
CPDF_Dictionary* pAnnot = pAnnots->GetDictAt(i);
if (pAnnot && pAnnot->GetStringBy("Subtype") == "Widget") {
LoadField(pAnnot);
@@ -984,7 +983,7 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) {
AddControl(pField, pFieldDict);
}
} else {
- for (uint32_t i = 0; i < pKids->GetCount(); i++) {
+ for (size_t i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
if (!pKid) {
continue;
@@ -1122,7 +1121,7 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict,
name += pFieldDict->GetUnicodeTextBy("T");
CPDF_Array* pKids = pFieldDict->GetArrayBy("Kids");
if (pKids) {
- for (uint32_t i = 0; i < pKids->GetCount(); i++) {
+ for (size_t i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
if (!pKid) {
continue;
@@ -1194,7 +1193,7 @@ FX_BOOL CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF,
return FALSE;
}
}
- for (uint32_t i = 0; i < pFields->GetCount(); i++) {
+ for (size_t i = 0; i < pFields->GetCount(); i++) {
CPDF_Dictionary* pField = pFields->GetDictAt(i);
if (!pField) {
continue;
diff --git a/core/fpdfdoc/doc_formcontrol.cpp b/core/fpdfdoc/doc_formcontrol.cpp
index 1fef183d80..b187ea7999 100644
--- a/core/fpdfdoc/doc_formcontrol.cpp
+++ b/core/fpdfdoc/doc_formcontrol.cpp
@@ -349,7 +349,7 @@ FX_ARGB CPDF_ApSettings::GetColor(int& iColorType,
return 0;
FX_ARGB color = 0;
- uint32_t dwCount = pEntry->GetCount();
+ size_t dwCount = pEntry->GetCount();
if (dwCount == 1) {
iColorType = COLORTYPE_GRAY;
FX_FLOAT g = pEntry->GetNumberAt(0) * 255;
@@ -398,7 +398,7 @@ void CPDF_ApSettings::GetOriginalColor(int& iColorType,
if (!pEntry) {
return;
}
- uint32_t dwCount = pEntry->GetCount();
+ size_t dwCount = pEntry->GetCount();
if (dwCount == 1) {
iColorType = COLORTYPE_GRAY;
fc[0] = pEntry->GetNumberAt(0);
diff --git a/core/fpdfdoc/doc_formfield.cpp b/core/fpdfdoc/doc_formfield.cpp
index 103465a8e5..957352ecef 100644
--- a/core/fpdfdoc/doc_formfield.cpp
+++ b/core/fpdfdoc/doc_formfield.cpp
@@ -414,6 +414,7 @@ int CPDF_FormField::GetMaxLen() {
}
return 0;
}
+
int CPDF_FormField::CountSelectedItems() {
CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
if (!pValue) {
@@ -428,6 +429,7 @@ int CPDF_FormField::CountSelectedItems() {
return pArray->GetCount();
return 0;
}
+
int CPDF_FormField::GetSelectedIndex(int index) {
CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
if (!pValue) {
@@ -537,9 +539,9 @@ FX_BOOL CPDF_FormField::IsItemSelected(int index) {
break;
}
}
- for (uint32_t i = 0; i < pArray->GetCount(); i++)
+ for (int i = 0; i < static_cast<int>(pArray->GetCount()); i++)
if (pArray->GetDirectObjectAt(i)->GetUnicodeText() == opt_value &&
- (int)i == iPos) {
+ i == iPos) {
return TRUE;
}
return FALSE;
@@ -887,6 +889,7 @@ FX_BOOL CPDF_FormField::SetCheckValue(const CFX_WideString& value,
m_pForm->m_bUpdated = TRUE;
return TRUE;
}
+
int CPDF_FormField::GetTopVisibleIndex() {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "TI");
if (!pObj) {
@@ -894,6 +897,7 @@ int CPDF_FormField::GetTopVisibleIndex() {
}
return pObj->GetInteger();
}
+
int CPDF_FormField::CountSelectedOptions() {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "I");
if (!pObj) {
@@ -903,8 +907,9 @@ int CPDF_FormField::CountSelectedOptions() {
if (!pArray) {
return 0;
}
- return (int)pArray->GetCount();
+ return static_cast<int>(pArray->GetCount());
}
+
int CPDF_FormField::GetSelectedOptionIndex(int index) {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "I");
if (!pObj) {
@@ -914,7 +919,7 @@ int CPDF_FormField::GetSelectedOptionIndex(int index) {
if (!pArray) {
return -1;
}
- int iCount = (int)pArray->GetCount();
+ int iCount = static_cast<int>(pArray->GetCount());
if (iCount > 0 && index < iCount) {
return pArray->GetIntegerAt(index);
}
@@ -929,8 +934,8 @@ FX_BOOL CPDF_FormField::IsOptionSelected(int iOptIndex) {
if (!pArray) {
return FALSE;
}
- int iCount = (int)pArray->GetCount();
- for (int i = 0; i < iCount; i++) {
+ size_t iCount = pArray->GetCount();
+ for (size_t i = 0; i < iCount; i++) {
if (pArray->GetIntegerAt(i) == iOptIndex) {
return TRUE;
}
@@ -949,7 +954,7 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex,
m_pDict->SetAt("I", pArray);
}
FX_BOOL bReturn = FALSE;
- for (int i = 0; i < (int)pArray->GetCount(); i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
int iFind = pArray->GetIntegerAt(i);
if (iFind == iOptIndex) {
if (bSelected) {
diff --git a/core/fpdfdoc/doc_link.cpp b/core/fpdfdoc/doc_link.cpp
index 07cc9f26ff..995290b9fb 100644
--- a/core/fpdfdoc/doc_link.cpp
+++ b/core/fpdfdoc/doc_link.cpp
@@ -63,7 +63,7 @@ void CPDF_LinkList::LoadPageLinks(CPDF_Page* pPage,
if (!pAnnotList)
return;
- for (uint32_t i = 0; i < pAnnotList->GetCount(); ++i) {
+ for (size_t i = 0; i < pAnnotList->GetCount(); ++i) {
CPDF_Dictionary* pAnnot = pAnnotList->GetDictAt(i);
bool add_link = (pAnnot && pAnnot->GetStringBy("Subtype") == "Link");
// Add non-links as nullptrs to preserve z-order.
diff --git a/core/fpdfdoc/doc_ocg.cpp b/core/fpdfdoc/doc_ocg.cpp
index 9b57509e56..b4fb3e1c01 100644
--- a/core/fpdfdoc/doc_ocg.cpp
+++ b/core/fpdfdoc/doc_ocg.cpp
@@ -14,8 +14,7 @@ static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object* pObject,
return -1;
if (const CPDF_Array* pArray = pObject->AsArray()) {
- uint32_t dwCount = pArray->GetCount();
- for (uint32_t i = 0; i < dwCount; i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
if (pArray->GetDictAt(i) == pGroupDict)
return i;
}
@@ -32,8 +31,7 @@ static FX_BOOL FPDFDOC_OCG_HasIntent(const CPDF_Dictionary* pDict,
}
CFX_ByteString bsIntent;
if (CPDF_Array* pArray = pIntent->AsArray()) {
- uint32_t dwCount = pArray->GetCount();
- for (uint32_t i = 0; i < dwCount; i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
bsIntent = pArray->GetStringAt(i);
if (bsIntent == "All" || bsIntent == csElement)
return TRUE;
@@ -62,8 +60,7 @@ static CPDF_Dictionary* FPDFDOC_OCG_GetConfig(CPDF_Document* pDoc,
CPDF_Array* pConfigs = pOCProperties->GetArrayBy("Configs");
if (pConfigs) {
CPDF_Dictionary* pFind;
- int32_t iCount = pConfigs->GetCount();
- for (int32_t i = 0; i < iCount; i++) {
+ for (size_t i = 0; i < pConfigs->GetCount(); i++) {
pFind = pConfigs->GetDictAt(i);
if (!pFind) {
continue;
@@ -122,8 +119,7 @@ FX_BOOL CPDF_OCContext::LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig,
pArray = pConfig->GetArrayBy("AS");
if (pArray) {
CFX_ByteString csFind = csConfig + "State";
- int32_t iCount = pArray->GetCount();
- for (int32_t i = 0; i < iCount; i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Dictionary* pUsage = pArray->GetDictAt(i);
if (!pUsage) {
continue;
@@ -194,7 +190,6 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression,
if (!pExpression) {
return FALSE;
}
- int32_t iCount = pExpression->GetCount();
CPDF_Object* pOCGObj;
CFX_ByteString csOperator = pExpression->GetStringAt(0);
if (csOperator == "Not") {
@@ -209,7 +204,7 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression,
}
if (csOperator == "Or" || csOperator == "And") {
FX_BOOL bValue = FALSE;
- for (int32_t i = 1; i < iCount; i++) {
+ for (size_t i = 1; i < pExpression->GetCount(); i++) {
pOCGObj = pExpression->GetDirectObjectAt(1);
if (!pOCGObj) {
continue;
@@ -255,8 +250,7 @@ FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary* pOCMDDict,
if (csP == "AllOn" || csP == "AllOff") {
bState = TRUE;
}
- int32_t iCount = pArray->GetCount();
- for (int32_t i = 0; i < iCount; i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
FX_BOOL bItem = TRUE;
CPDF_Dictionary* pItemDict = pArray->GetDictAt(i);
if (pItemDict)
diff --git a/core/fpdfdoc/doc_tagged.cpp b/core/fpdfdoc/doc_tagged.cpp
index a86514059c..b60c83932e 100644
--- a/core/fpdfdoc/doc_tagged.cpp
+++ b/core/fpdfdoc/doc_tagged.cpp
@@ -70,7 +70,7 @@ void CPDF_StructTreeImpl::LoadDocTree() {
if (!pArray)
return;
- for (uint32_t i = 0; i < pArray->GetCount(); i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Dictionary* pKid = pArray->GetDictAt(i);
CPDF_StructElementImpl* pStructElementImpl =
new CPDF_StructElementImpl(this, nullptr, pKid);
diff --git a/core/fpdfdoc/doc_utils.cpp b/core/fpdfdoc/doc_utils.cpp
index 7c66b879cb..404353847f 100644
--- a/core/fpdfdoc/doc_utils.cpp
+++ b/core/fpdfdoc/doc_utils.cpp
@@ -27,8 +27,7 @@ CPDF_Object* SearchNumberNode(const CPDF_Dictionary* pNode, int num) {
}
CPDF_Array* pNumbers = pNode->GetArrayBy("Nums");
if (pNumbers) {
- uint32_t dwCount = pNumbers->GetCount() / 2;
- for (uint32_t i = 0; i < dwCount; i++) {
+ for (size_t i = 0; i < pNumbers->GetCount() / 2; i++) {
int index = pNumbers->GetIntegerAt(i * 2);
if (num == index) {
return pNumbers->GetDirectObjectAt(i * 2 + 1);
@@ -43,7 +42,7 @@ CPDF_Object* SearchNumberNode(const CPDF_Dictionary* pNode, int num) {
if (!pKids) {
return NULL;
}
- for (uint32_t i = 0; i < pKids->GetCount(); i++) {
+ for (size_t i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
if (!pKid) {
continue;
diff --git a/core/fpdfdoc/include/fpdf_doc.h b/core/fpdfdoc/include/fpdf_doc.h
index e33b60165b..bcbfcf33ba 100644
--- a/core/fpdfdoc/include/fpdf_doc.h
+++ b/core/fpdfdoc/include/fpdf_doc.h
@@ -58,7 +58,7 @@ class CPDF_NameTree {
CPDF_Array* LookupNamedDest(CPDF_Document* pDoc,
const CFX_ByteStringC& sName);
int GetIndex(const CFX_ByteString& csName) const;
- int GetCount() const;
+ size_t GetCount() const;
CPDF_Dictionary* GetRoot() const { return m_pRoot; }
protected:
@@ -154,9 +154,9 @@ class CPDF_ActionFields {
public:
explicit CPDF_ActionFields(const CPDF_Action* pAction) : m_pAction(pAction) {}
- uint32_t GetFieldsCount() const;
+ size_t GetFieldsCount() const;
std::vector<CPDF_Object*> GetAllFields() const;
- CPDF_Object* GetField(uint32_t iIndex) const;
+ CPDF_Object* GetField(size_t iIndex) const;
protected:
const CPDF_Action* const m_pAction;
@@ -213,8 +213,8 @@ class CPDF_Action {
FX_BOOL IsSynchronous() const { return m_pDict->GetBooleanBy("Synchronous"); }
FX_BOOL IsRepeat() const { return m_pDict->GetBooleanBy("Repeat"); }
FX_BOOL IsMixPlay() const { return m_pDict->GetBooleanBy("Mix"); }
- uint32_t GetSubActionsCount() const;
- CPDF_Action GetSubAction(uint32_t iIndex) const;
+ size_t GetSubActionsCount() const;
+ CPDF_Action GetSubAction(size_t iIndex) const;
protected:
CPDF_Dictionary* const m_pDict;
diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp
index 3ac1262fc1..8a45a13e12 100644
--- a/fpdfsdk/fpdf_ext.cpp
+++ b/fpdfsdk/fpdf_ext.cpp
@@ -163,8 +163,7 @@ void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code) {
CPDF_Dictionary* pJSDict = pNameDict->GetDictBy("JavaScript");
CPDF_Array* pArray = pJSDict ? pJSDict->GetArrayBy("Names") : NULL;
if (pArray) {
- int nCount = pArray->GetCount();
- for (int i = 0; i < nCount; i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
CFX_ByteString cbStr = pArray->GetStringAt(i);
if (cbStr.Compare("com.adobe.acrobat.SharedReview.Register") == 0) {
FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDREVIEW);
diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp
index c9030e5035..7473cb0671 100644
--- a/fpdfsdk/fpdfdoc.cpp
+++ b/fpdfsdk/fpdfdoc.cpp
@@ -286,14 +286,14 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page,
CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayBy("Annots");
if (!pAnnots)
return FALSE;
- for (int i = *startPos; i < (int)pAnnots->GetCount(); i++) {
+ for (size_t i = *startPos; i < pAnnots->GetCount(); i++) {
CPDF_Dictionary* pDict =
ToDictionary(static_cast<CPDF_Object*>(pAnnots->GetDirectObjectAt(i)));
if (!pDict)
continue;
if (pDict->GetStringBy("Subtype") == "Link") {
- *startPos = i + 1;
- *linkAnnot = (FPDF_LINK)pDict;
+ *startPos = static_cast<int>(i + 1);
+ *linkAnnot = static_cast<FPDF_LINK>(pDict);
return TRUE;
}
}
@@ -322,7 +322,7 @@ DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot) {
CPDF_Array* pArray = pAnnotDict->GetArrayBy("QuadPoints");
if (!pArray)
return 0;
- return pArray->GetCount() / 8;
+ return static_cast<int>(pArray->GetCount() / 8);
}
DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot,
@@ -334,8 +334,9 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot,
ToDictionary(static_cast<CPDF_Object*>(linkAnnot));
CPDF_Array* pArray = pAnnotDict->GetArrayBy("QuadPoints");
if (pArray) {
- if (quadIndex < 0 || quadIndex >= (int)pArray->GetCount() / 8 ||
- ((quadIndex * 8 + 7) >= (int)pArray->GetCount()))
+ if (quadIndex < 0 ||
+ static_cast<size_t>(quadIndex) >= pArray->GetCount() / 8 ||
+ (static_cast<size_t>(quadIndex * 8 + 7) >= pArray->GetCount()))
return FALSE;
quadPoints->x1 = pArray->GetNumberAt(quadIndex * 8);
quadPoints->y1 = pArray->GetNumberAt(quadIndex * 8 + 1);
diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp
index 1dbd10c1f7..777310bb2b 100644
--- a/fpdfsdk/fpdfppo.cpp
+++ b/fpdfsdk/fpdfppo.cpp
@@ -238,8 +238,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
}
case CPDF_Object::ARRAY: {
CPDF_Array* pArray = pObj->AsArray();
- uint32_t count = pArray->GetCount();
- for (uint32_t i = 0; i < count; ++i) {
+ for (size_t i = 0; i < pArray->GetCount(); ++i) {
CPDF_Object* pNextObj = pArray->GetObjectAt(i);
if (!pNextObj)
return FALSE;
diff --git a/fpdfsdk/fsdk_actionhandler.cpp b/fpdfsdk/fsdk_actionhandler.cpp
index ebcaf354ad..0bbdbab137 100644
--- a/fpdfsdk/fsdk_actionhandler.cpp
+++ b/fpdfsdk/fsdk_actionhandler.cpp
@@ -439,7 +439,7 @@ void CPDFSDK_ActionHandler::DoAction_GoTo(CPDFSDK_Document* pDocument,
if (pMyArray) {
pPosAry = new float[pMyArray->GetCount()];
int j = 0;
- for (int i = 2; i < (int)pMyArray->GetCount(); i++) {
+ for (size_t i = 2; i < pMyArray->GetCount(); i++) {
pPosAry[j++] = pMyArray->GetFloatAt(i);
}
sizeOfAry = j;
diff --git a/fpdfsdk/fsdk_baseannot.cpp b/fpdfsdk/fsdk_baseannot.cpp
index 68d99e8ae5..51f87d8c4e 100644
--- a/fpdfsdk/fsdk_baseannot.cpp
+++ b/fpdfsdk/fsdk_baseannot.cpp
@@ -739,9 +739,8 @@ void CPDFSDK_BAAnnot::SetBorderDash(const CFX_IntArray& array) {
}
CPDF_Array* pArray = new CPDF_Array;
- for (int i = 0, sz = array.GetSize(); i < sz; i++) {
+ for (size_t i = 0, sz = array.GetSize(); i < sz; i++)
pArray->AddInteger(array[i]);
- }
pBSDict->SetAt("D", pArray);
}
@@ -760,9 +759,8 @@ void CPDFSDK_BAAnnot::GetBorderDash(CFX_IntArray& array) const {
}
if (pDash) {
- for (int i = 0, sz = pDash->GetCount(); i < sz; i++) {
+ for (size_t i = 0, sz = pDash->GetCount(); i < sz; i++)
array.Add(pDash->GetIntegerAt(i));
- }
}
}
@@ -780,7 +778,7 @@ void CPDFSDK_BAAnnot::RemoveColor() {
FX_BOOL CPDFSDK_BAAnnot::GetColor(FX_COLORREF& color) const {
if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArrayBy("C")) {
- int nCount = pEntry->GetCount();
+ size_t nCount = pEntry->GetCount();
if (nCount == 1) {
FX_FLOAT g = pEntry->GetNumberAt(0) * 255;
diff --git a/fpdfsdk/pdfwindow/PWL_Icon.cpp b/fpdfsdk/pdfwindow/PWL_Icon.cpp
index bae5dc8a56..d4635f6ecd 100644
--- a/fpdfsdk/pdfwindow/PWL_Icon.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Icon.cpp
@@ -133,7 +133,7 @@ void CPWL_Icon::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) {
CPDF_Array* pA =
m_pIconFit->GetDict() ? m_pIconFit->GetDict()->GetArrayBy("A") : NULL;
if (pA) {
- uint32_t dwCount = pA->GetCount();
+ size_t dwCount = pA->GetCount();
if (dwCount > 0)
fLeft = pA->GetNumberAt(0);
if (dwCount > 1)
diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp
index 37bafca77a..04fe075d2c 100644
--- a/xfa/fxfa/app/xfa_ffdoc.cpp
+++ b/xfa/fxfa/app/xfa_ffdoc.cpp
@@ -242,8 +242,7 @@ FX_BOOL CXFA_FFDoc::OpenDoc(CPDF_Document* pPDFDoc) {
CFX_ArrayTemplate<CPDF_Stream*> xfaStreams;
if (pElementXFA->IsArray()) {
CPDF_Array* pXFAArray = (CPDF_Array*)pElementXFA;
- uint32_t count = pXFAArray->GetCount() / 2;
- for (uint32_t i = 0; i < count; i++) {
+ for (size_t i = 0; i < pXFAArray->GetCount() / 2; i++) {
if (CPDF_Stream* pStream = pXFAArray->GetStreamAt(i * 2 + 1))
xfaStreams.Add(pStream);
}
@@ -351,8 +350,7 @@ CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName,
CFX_ByteString bsName = PDF_EncodeText(wsName.c_str(), wsName.GetLength());
CPDF_Object* pObject = nametree.LookupValue(bsName);
if (!pObject) {
- int32_t iCount = nametree.GetCount();
- for (int32_t i = 0; i < iCount; i++) {
+ for (size_t i = 0; i < nametree.GetCount(); i++) {
CFX_ByteString bsTemp;
CPDF_Object* pTempObject = nametree.LookupValue(i, bsTemp);
if (bsTemp == bsName) {