Remove method GooList::getLength
Use method 'size' (from std::vector) instead.
diff --git a/cpp/poppler-font.cpp b/cpp/poppler-font.cpp
index edbc9ed..d6daf39 100644
--- a/cpp/poppler-font.cpp
+++ b/cpp/poppler-font.cpp
@@ -221,8 +221,8 @@
if (!items) {
return std::vector<font_info>();
}
- std::vector<font_info> fonts(items->getLength());
- for (int i = 0; i < items->getLength(); ++i) {
+ std::vector<font_info> fonts(items->size());
+ for (std::size_t i = 0; i < items->size(); ++i) {
fonts[i] = font_info(*new font_info_private((FontInfo *)items->get(i)));
}
deleteGooList<FontInfo>(items);
diff --git a/cpp/poppler-toc.cpp b/cpp/poppler-toc.cpp
index 571bad2..666c650 100644
--- a/cpp/poppler-toc.cpp
+++ b/cpp/poppler-toc.cpp
@@ -1,4 +1,4 @@
-/*
+ /*
* Copyright (C) 2009-2010, Pino Toscano <pino@kde.org>
* Copyright (C) 2018, Albert Astals Cid <aacid@kde.org>
*
@@ -45,7 +45,7 @@
}
const GooList *items = outline->getItems();
- if (!items || items->getLength() < 1) {
+ if (!items || items->size() < 1) {
return nullptr;
}
@@ -76,7 +76,7 @@
void toc_item_private::load_children(const GooList *items)
{
- const int num_items = items->getLength();
+ const int num_items = items->size();
children.resize(num_items);
for (int i = 0; i < num_items; ++i) {
OutlineItem *item = (OutlineItem *)items->get(i);
diff --git a/glib/poppler-action.cc b/glib/poppler-action.cc
index 1aa56a7..fffe588 100644
--- a/glib/poppler-action.cc
+++ b/glib/poppler-action.cc
@@ -582,7 +582,6 @@
{
const GooList *st_list = ocg_state->getStateList();
bool preserve_rb = ocg_state->getPreserveRB();
- gint i, j;
GList *layer_state = nullptr;
if (!document->layers) {
@@ -590,7 +589,7 @@
return;
}
- for (i = 0; i < st_list->getLength(); ++i) {
+ for (std::size_t i = 0; i < st_list->size(); ++i) {
LinkOCGState::StateList *list = (LinkOCGState::StateList *)st_list->get(i);
PopplerActionLayer *action_layer = g_slice_new0 (PopplerActionLayer);
@@ -606,7 +605,7 @@
break;
}
- for (j = 0; j < list->list->getLength(); ++j) {
+ for (std::size_t j = 0; j < list->list->size(); ++j) {
Ref *ref = (Ref *)list->list->get(j);
PopplerLayer *layer = get_layer_for_ref (document, document->layers, ref, preserve_rb);
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 38699e2..5e0cc08 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -2377,7 +2377,7 @@
g_return_val_if_fail (iter != nullptr, FALSE);
iter->index++;
- if (iter->index >= iter->items->getLength())
+ if (iter->index >= (int)iter->items->size())
return FALSE;
return TRUE;
@@ -2609,7 +2609,7 @@
g_return_val_if_fail (iter != nullptr, FALSE);
iter->index++;
- if (iter->index >= iter->items->getLength())
+ if (iter->index >= (int)iter->items->size())
return FALSE;
return TRUE;
@@ -2633,7 +2633,7 @@
new_iter = g_slice_dup (PopplerFontsIter, iter);
new_iter->items = new GooList ();
- for (int i = 0; i < iter->items->getLength(); i++) {
+ for (std::size_t i = 0; i < iter->items->size(); i++) {
FontInfo *info = (FontInfo *)iter->items->get(i);
new_iter->items->push_back (new FontInfo (*info));
}
@@ -2771,7 +2771,7 @@
if (items == nullptr) {
*iter = nullptr;
- } else if (items->getLength() == 0) {
+ } else if (items->empty()) {
*iter = nullptr;
delete items;
} else {
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index a635f39..a36d3bc 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -638,7 +638,6 @@
SelectionStyle selection_style = selectionStyleGlyph;
GooList *list;
GList *region = nullptr;
- int i;
poppler_selection.x1 = selection->x1;
poppler_selection.y1 = selection->y1;
@@ -662,7 +661,7 @@
list = text->getSelectionRegion(&poppler_selection,
selection_style, scale);
- for (i = 0; i < list->getLength(); i++) {
+ for (std::size_t i = 0; i < list->size(); i++) {
PDFRectangle *selection_rect = (PDFRectangle *) list->get(i);
PopplerRectangle *rect;
@@ -728,7 +727,6 @@
SelectionStyle selection_style = selectionStyleGlyph;
GooList *list;
cairo_region_t *region;
- int i;
poppler_selection.x1 = selection->x1;
poppler_selection.y1 = selection->y1;
@@ -754,7 +752,7 @@
region = cairo_region_create ();
- for (i = 0; i < list->getLength(); i++) {
+ for (std::size_t i = 0; i < list->size(); i++) {
PDFRectangle *selection_rect = (PDFRectangle *) list->get(i);
cairo_rectangle_int_t rect;
@@ -2193,8 +2191,8 @@
for (i = 0; i < n_lines; i++)
{
GooList *line_words = word_list[i];
- n_rects += line_words->getLength() - 1;
- for (j = 0; j < line_words->getLength(); j++)
+ n_rects += line_words->size() - 1;
+ for (std::size_t j = 0; j < line_words->size(); j++)
{
TextWordSelection *word_sel = (TextWordSelection *)line_words->get(j);
n_rects += word_sel->getEnd() - word_sel->getBegin();
@@ -2207,7 +2205,7 @@
for (i = 0; i < n_lines; i++)
{
GooList *line_words = word_list[i];
- for (j = 0; j < line_words->getLength(); j++)
+ for (std::size_t j = 0; j < line_words->size(); j++)
{
TextWordSelection *word_sel = (TextWordSelection *)line_words->get(j);
TextWord *word = word_sel->getWord();
@@ -2227,7 +2225,7 @@
rect = *rectangles + offset;
word->getBBox (&x1, &y1, &x2, &y2);
- if (j < line_words->getLength() - 1)
+ if (j < line_words->size() - 1)
{
TextWordSelection *word_sel = (TextWordSelection *)line_words->get(j + 1);
@@ -2357,7 +2355,7 @@
PopplerTextAttributes *attrs = nullptr;
TextWord *word, *prev_word = nullptr;
gint word_i, prev_word_i;
- gint i, j;
+ gint i;
gint offset = 0;
GList *attributes = nullptr;
@@ -2377,7 +2375,7 @@
for (i = 0; i < n_lines; i++)
{
GooList *line_words = word_list[i];
- for (j = 0; j < line_words->getLength(); j++)
+ for (std::size_t j = 0; j < line_words->size(); j++)
{
TextWordSelection *word_sel = (TextWordSelection *)line_words->get(j);
int end = word_sel->getEnd();
@@ -2398,7 +2396,7 @@
prev_word_i = word_i;
}
- if (j < line_words->getLength() - 1)
+ if (j < line_words->size() - 1)
{
attrs->end_index = offset;
offset++;
diff --git a/goo/GooList.h b/goo/GooList.h
index 3e05270..78685fe 100644
--- a/goo/GooList.h
+++ b/goo/GooList.h
@@ -48,9 +48,6 @@
explicit GooList(const std::vector<void *>& vec) : std::vector<void *>(vec) {}
explicit GooList(std::vector<void *>&& vec) : std::vector<void *>(std::move(vec)) {}
- // Get the number of elements.
- int getLength() const { return size(); }
-
// Return the <i>th element.
// Assumes 0 <= i < length.
void *get(int i) const { return (*this)[i]; }
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 2f69507..c17992f 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -770,7 +770,7 @@
}
}
// Scan backwards: we are looking for the last set value
- for (i = daToks->getLength()-1; i >= 0; --i) {
+ for (i = daToks->size()-1; i >= 0; --i) {
if (!fontColor) {
if (!((GooString *)daToks->get(i))->cmp("g") && i >= 1) {
fontColor = std::make_unique<AnnotColor>(gatof(( (GooString *)daToks->get(i-1) )->c_str()));
@@ -4060,7 +4060,7 @@
i = j;
}
}
- for (i = 2; i < daToks->getLength(); ++i) {
+ for (i = 2; i < (int)daToks->size(); ++i) {
if (i >= 2 && !((GooString *)daToks->get(i))->cmp("Tf")) {
tfPos = i - 2;
} else if (i >= 6 && !((GooString *)daToks->get(i))->cmp("Tm")) {
@@ -4214,7 +4214,7 @@
// write the DA string
if (daToks) {
- for (i = 0; i < daToks->getLength(); ++i) {
+ for (i = 0; i < (int)daToks->size(); ++i) {
appearBuf->append((GooString *)daToks->get(i))->append(' ');
}
}
@@ -4313,7 +4313,7 @@
// write the DA string
if (daToks) {
- for (i = 0; i < daToks->getLength(); ++i) {
+ for (i = 0; i < (int)daToks->size(); ++i) {
appearBuf->append((GooString *)daToks->get(i))->append(' ');
}
}
@@ -4403,7 +4403,7 @@
// write the DA string
if (daToks) {
- for (i = 0; i < daToks->getLength(); ++i) {
+ for (std::size_t i = 0; i < daToks->size(); ++i) {
appearBuf->append((GooString *)daToks->get(i))->append(' ');
}
}
@@ -4468,7 +4468,7 @@
i = j;
}
}
- for (i = 2; i < daToks->getLength(); ++i) {
+ for (std::size_t i = 2; i < daToks->size(); ++i) {
if (i >= 2 && !((GooString *)daToks->get(i))->cmp("Tf")) {
tfPos = i - 2;
} else if (i >= 6 && !((GooString *)daToks->get(i))->cmp("Tm")) {
@@ -4583,7 +4583,7 @@
// write the DA string
if (daToks) {
- for (j = 0; j < daToks->getLength(); ++j) {
+ for (std::size_t j = 0; j < daToks->size(); ++j) {
appearBuf->append((GooString *)daToks->get(j))->append(' ');
}
}
diff --git a/poppler/Form.cc b/poppler/Form.cc
index 6d167c6..71b4d4a 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -1239,10 +1239,10 @@
if (defaultAppearance)
delete defaultAppearance;
defaultAppearance = new GooString;
- for (int i = 0; i < daToks->getLength(); ++i) {
+ for (std::size_t i = 0; i < daToks->size(); ++i) {
if (i > 0)
defaultAppearance->append(' ');
- if (i == idx) {
+ if (i == (std::size_t)idx) {
defaultAppearance->appendf("{0:d}", fontSize);
} else {
defaultAppearance->append(static_cast<GooString*>(daToks->get(i)));
@@ -1270,8 +1270,8 @@
}
GooString* tok = new GooString(da, i, j - i);
if (searchTok && !tok->cmp(searchTok))
- idx = daToks->getLength();
- daToks->push_back(tok);
+ idx = daToks->size();
+ daToks->push_back(tok);
i = j;
}
}
diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index 300f1f2..0d013ca 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -2876,7 +2876,7 @@
break;
default:
unsigned int newOverprintMask = 0x10;
- for (int i = 0; i < separationList->getLength(); i++) {
+ for (std::size_t i = 0; i < separationList->size(); i++) {
GfxSeparationColorSpace *sepCS = (GfxSeparationColorSpace *)separationList->get(i);
if (!sepCS->getName()->cmp(name)) {
if (sepCS->getFunc()->hasDifferentResultSet(func)) {
@@ -2892,14 +2892,14 @@
}
newOverprintMask <<=1;
}
- if (separationList->getLength() == maxSepComps) {
+ if ((int)separationList->size() == maxSepComps) {
error(errSyntaxWarning, -1,
"Too many ({0:d}) spots, convert '{1:t}' immediately", maxSepComps, name);
gfree(mapping);
mapping = nullptr;
return;
}
- *mapping = separationList->getLength() + 4;
+ *mapping = separationList->size() + 4;
separationList->push_back(copy());
overprintMask = newOverprintMask;
break;
@@ -2985,8 +2985,8 @@
int *mappingA = nullptr;
GooList *sepsCSA = new GooList();
- sepsCSA->reserve(sepsCS->getLength());
- for (i = 0; i < sepsCS->getLength(); i++) {
+ sepsCSA->reserve(sepsCS->size());
+ for (std::size_t i = 0; i < sepsCS->size(); i++) {
GfxSeparationColorSpace *scs = (GfxSeparationColorSpace *) sepsCS->get(i);
if (likely(scs != nullptr)) {
sepsCSA->push_back(scs->copy());
@@ -3178,7 +3178,7 @@
if (nComps == 1)
sepFunc = func;
else {
- for (int k = 0; k < sepsCS->getLength(); k++) {
+ for (std::size_t k = 0; k < sepsCS->size(); k++) {
GfxSeparationColorSpace *sepCS = (GfxSeparationColorSpace *)sepsCS->get(k);
if (!sepCS->getName()->cmp(names[i])) {
sepFunc = sepCS->getFunc();
@@ -3186,7 +3186,7 @@
}
}
}
- for (int j = 0; j < separationList->getLength(); j++) {
+ for (std::size_t j = 0; j < separationList->size(); j++) {
GfxSeparationColorSpace *sepCS = (GfxSeparationColorSpace *)separationList->get(j);
if (!sepCS->getName()->cmp(names[i])) {
if (sepFunc != nullptr && sepCS->getFunc()->hasDifferentResultSet(sepFunc)) {
@@ -3205,7 +3205,7 @@
startOverprintMask <<=1;
}
if (!found) {
- if (separationList->getLength() == maxSepComps) {
+ if ((int)separationList->size() == maxSepComps) {
error(errSyntaxWarning, -1,
"Too many ({0:d}) spots, convert '{1:t}' immediately", maxSepComps, names[i]);
gfree(mapping);
@@ -3213,12 +3213,12 @@
overprintMask = 0xffffffff;
return;
}
- mapping[i] = separationList->getLength() + 4;
+ mapping[i] = separationList->size() + 4;
newOverprintMask |= startOverprintMask;
if (nComps == 1)
separationList->push_back(new GfxSeparationColorSpace(names[i]->copy(),alt->copy(), func->copy()));
else {
- for (int k = 0; k < sepsCS->getLength(); k++) {
+ for (std::size_t k = 0; k < sepsCS->size(); k++) {
GfxSeparationColorSpace *sepCS = (GfxSeparationColorSpace *)sepsCS->get(k);
if (!sepCS->getName()->cmp(names[i])) {
found = true;
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 60d3ca9..d20c7fe 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -337,7 +337,7 @@
// search for the font
fi = nullptr;
- for (i = 0; i < fonts->getLength(); ++i) {
+ for (std::size_t i = 0; i < fonts->size(); ++i) {
fi = (SysFontInfo *)fonts->get(i);
if (fi->match(name2, bold, italic, oblique, fixedWidth)) {
break;
@@ -346,7 +346,7 @@
}
if (!fi && !exact && bold) {
// try ignoring the bold flag
- for (i = 0; i < fonts->getLength(); ++i) {
+ for (std::size_t i = 0; i < fonts->size(); ++i) {
fi = (SysFontInfo *)fonts->get(i);
if (fi->match(name2, false, italic)) {
break;
@@ -356,7 +356,7 @@
}
if (!fi && !exact && (bold || italic)) {
// try ignoring the bold and italic flags
- for (i = 0; i < fonts->getLength(); ++i) {
+ for (std::size_t i = 0; i < fonts->size(); ++i) {
fi = (SysFontInfo *)fonts->get(i);
if (fi->match(name2, false, false)) {
break;
@@ -631,10 +631,9 @@
FILE *GlobalParams::findToUnicodeFile(const GooString *name) {
GooString *dir, *fileName;
FILE *f;
- int i;
globalParamsLocker();
- for (i = 0; i < toUnicodeDirs->getLength(); ++i) {
+ for (std::size_t i = 0; i < toUnicodeDirs->size(); ++i) {
dir = (GooString *)toUnicodeDirs->get(i);
fileName = appendToPath(dir->copy(), name->c_str());
f = openFile(fileName->c_str(), "r");
diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index 1795f14..2b9d2ac 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -1704,7 +1704,7 @@
} else if (huffDH == 1) {
huffDHTable = huffTableE;
} else {
- if (i >= (unsigned int)codeTables->getLength()) {
+ if (i >= codeTables->size()) {
goto codeTableError;
}
huffDHTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
@@ -1714,7 +1714,7 @@
} else if (huffDW == 1) {
huffDWTable = huffTableC;
} else {
- if (i >= (unsigned int)codeTables->getLength()) {
+ if (i >= codeTables->size()) {
goto codeTableError;
}
huffDWTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
@@ -1722,7 +1722,7 @@
if (huffBMSize == 0) {
huffBMSizeTable = huffTableA;
} else {
- if (i >= (unsigned int)codeTables->getLength()) {
+ if (i >= codeTables->size()) {
goto codeTableError;
}
huffBMSizeTable =
@@ -1731,7 +1731,7 @@
if (huffAggInst == 0) {
huffAggInstTable = huffTableA;
} else {
- if (i >= (unsigned int)codeTables->getLength()) {
+ if (i >= codeTables->size()) {
goto codeTableError;
}
huffAggInstTable =
@@ -2136,7 +2136,7 @@
} else if (huffFS == 1) {
huffFSTable = huffTableG;
} else {
- if (i >= (unsigned int)codeTables->getLength()) {
+ if (i >= codeTables->size()) {
goto codeTableError;
}
huffFSTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
@@ -2148,7 +2148,7 @@
} else if (huffDS == 2) {
huffDSTable = huffTableJ;
} else {
- if (i >= (unsigned int)codeTables->getLength()) {
+ if (i >= codeTables->size()) {
goto codeTableError;
}
huffDSTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
@@ -2160,7 +2160,7 @@
} else if (huffDT == 2) {
huffDTTable = huffTableM;
} else {
- if (i >= (unsigned int)codeTables->getLength()) {
+ if (i >= codeTables->size()) {
goto codeTableError;
}
huffDTTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
@@ -2170,7 +2170,7 @@
} else if (huffRDW == 1) {
huffRDWTable = huffTableO;
} else {
- if (i >= (unsigned int)codeTables->getLength()) {
+ if (i >= codeTables->size()) {
goto codeTableError;
}
huffRDWTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
@@ -2180,7 +2180,7 @@
} else if (huffRDH == 1) {
huffRDHTable = huffTableO;
} else {
- if (i >= (unsigned int)codeTables->getLength()) {
+ if (i >= codeTables->size()) {
goto codeTableError;
}
huffRDHTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
@@ -2190,7 +2190,7 @@
} else if (huffRDX == 1) {
huffRDXTable = huffTableO;
} else {
- if (i >= (unsigned int)codeTables->getLength()) {
+ if (i >= codeTables->size()) {
goto codeTableError;
}
huffRDXTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
@@ -2200,7 +2200,7 @@
} else if (huffRDY == 1) {
huffRDYTable = huffTableO;
} else {
- if (i >= (unsigned int)codeTables->getLength()) {
+ if (i >= codeTables->size()) {
goto codeTableError;
}
huffRDYTable = ((JBIG2CodeTable *)codeTables->get(i++))->getHuffTable();
@@ -2208,7 +2208,7 @@
if (huffRSize == 0) {
huffRSizeTable = huffTableA;
} else {
- if (i >= (unsigned int)codeTables->getLength()) {
+ if (i >= codeTables->size()) {
goto codeTableError;
}
huffRSizeTable =
@@ -4175,15 +4175,14 @@
JBIG2Segment *JBIG2Stream::findSegment(unsigned int segNum) {
JBIG2Segment *seg;
- int i;
- for (i = 0; i < globalSegments->getLength(); ++i) {
+ for (std::size_t i = 0; i < globalSegments->size(); ++i) {
seg = (JBIG2Segment *)globalSegments->get(i);
if (seg->getSegNum() == segNum) {
return seg;
}
}
- for (i = 0; i < segments->getLength(); ++i) {
+ for (std::size_t i = 0; i < segments->size(); ++i) {
seg = (JBIG2Segment *)segments->get(i);
if (seg->getSegNum() == segNum) {
return seg;
diff --git a/poppler/OptionalContent.cc b/poppler/OptionalContent.cc
index 3b77a9a..76832e3 100644
--- a/poppler/OptionalContent.cc
+++ b/poppler/OptionalContent.cc
@@ -465,7 +465,7 @@
if (!children) {
return 0;
}
- return children->getLength();
+ return children->size();
}
OCDisplayNode *OCDisplayNode::getChild(int idx) const {
diff --git a/poppler/Outline.cc b/poppler/Outline.cc
index 1b7fb8d..cf61fed 100644
--- a/poppler/Outline.cc
+++ b/poppler/Outline.cc
@@ -137,7 +137,7 @@
gfree(alreadyRead);
- if (!items->getLength()) {
+ if (items->empty()) {
delete items;
items = nullptr;
}
diff --git a/poppler/PDFDocFactory.cc b/poppler/PDFDocFactory.cc
index 874ae50..b34ab3b 100644
--- a/poppler/PDFDocFactory.cc
+++ b/poppler/PDFDocFactory.cc
@@ -54,7 +54,7 @@
PDFDocFactory::createPDFDoc(const GooString &uri, GooString *ownerPassword,
GooString *userPassword, void *guiDataA)
{
- for (int i = builders->getLength() - 1; i >= 0 ; i--) {
+ for (int i = builders->size() - 1; i >= 0 ; i--) {
PDFDocBuilder *builder = (PDFDocBuilder *) builders->get(i);
if (builder->supports(uri)) {
return builder->buildPDFDoc(uri, ownerPassword, userPassword, guiDataA);
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index ee07a6f..6a4713b 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1357,12 +1357,12 @@
paperWidth = w;
if (h > paperHeight)
paperHeight = h;
- for (i = 0; i < paperSizes->getLength(); ++i) {
+ for (i = 0; i < (int)paperSizes->size(); ++i) {
size = (PSOutPaperSize *)paperSizes->get(i);
if (pageDimensionEqual(w, size->w) && pageDimensionEqual(h, size->h))
break;
}
- if (i == paperSizes->getLength()) {
+ if (i == (int)paperSizes->size()) {
const StandardMedia *media = standardMedia;
GooString *name = nullptr;
while (media->name) {
@@ -1566,7 +1566,7 @@
switch (mode) {
case psModePS:
- for (int i = 0; i < paperSizes->getLength(); ++i) {
+ for (std::size_t i = 0; i < paperSizes->size(); ++i) {
size = (PSOutPaperSize *)paperSizes->get(i);
writePSFmt("%%{0:s} {1:t} {2:d} {3:d} 0 () ()\n",
i==0 ? "DocumentMedia:" : "+", size->name, size->w, size->h);
diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index dcb6ccb..39bd920 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -2336,11 +2336,11 @@
}
int TextWordList::getLength() {
- return words->getLength();
+ return words->size();
}
TextWord *TextWordList::get(int idx) {
- if (idx < 0 || idx >= words->getLength()) {
+ if (idx < 0 || idx >= (int)words->size()) {
return nullptr;
}
return (TextWord *)words->get(idx);
@@ -2476,11 +2476,10 @@
const char *name;
int code, mCode, letterCode, anyCode;
double w;
- int i;
// get the font info object
curFont = nullptr;
- for (i = 0; i < fonts->getLength(); ++i) {
+ for (std::size_t i = 0; i < fonts->size(); ++i) {
curFont = (TextFontInfo *)fonts->get(i);
if (curFont->matches(state)) {
break;
@@ -2834,7 +2833,7 @@
if (doHTML) {
//----- handle underlining
- for (i = 0; i < underlines->getLength(); ++i) {
+ for (std::size_t i = 0; i < underlines->size(); ++i) {
underline = (TextUnderline *)underlines->get(i);
if (underline->horiz) {
// rot = 0
@@ -2897,7 +2896,7 @@
}
//----- handle links
- for (i = 0; i < links->getLength(); ++i) {
+ for (std::size_t i = 0; i < links->size(); ++i) {
link = (TextLink *)links->get(i);
// rot = 0
@@ -4459,7 +4458,7 @@
lines = (GooList **)grealloc(lines, linesSize * sizeof(GooList *));
}
- if (words && words->getLength() > 0)
+ if (words && words->size() > 0)
lines[nLines++] = words;
else if (words)
delete words;
@@ -4517,7 +4516,7 @@
GooString *TextSelectionDumper::getText (void)
{
GooString *text;
- int i, j;
+ int i;
UnicodeMap *uMap;
char space[8], eol[16];
int spaceLen, eolLen;
@@ -4532,11 +4531,11 @@
for (i = 0; i < nLines; i++) {
GooList *lineWords = lines[i];
- for (j = 0; j < lineWords->getLength(); j++) {
+ for (std::size_t j = 0; j < lineWords->size(); j++) {
TextWordSelection *sel = (TextWordSelection *)lineWords->get(j);
page->dumpFragment (sel->word->text + sel->begin, sel->end - sel->begin, uMap, text);
- if (j < lineWords->getLength() - 1)
+ if (j < lineWords->size() - 1)
text->append(space, spaceLen);
}
if (i < nLines - 1)
@@ -4733,7 +4732,7 @@
state->setFillColor(glyph_color);
out->updateFillColor(state);
- for (int i = 0; i < selectionList->getLength(); i++) {
+ for (std::size_t i = 0; i < selectionList->size(); i++) {
TextWordSelection *sel = (TextWordSelection *) selectionList->get(i);
int begin = sel->begin;
diff --git a/qt5/src/poppler-document.cc b/qt5/src/poppler-document.cc
index c0def75..92b01a5 100644
--- a/qt5/src/poppler-document.cc
+++ b/qt5/src/poppler-document.cc
@@ -591,11 +591,11 @@
return nullptr;
const GooList * items = outline->getItems();
- if ( !items || items->getLength() < 1 )
+ if ( !items || items->size() < 1 )
return nullptr;
QDomDocument *toc = new QDomDocument();
- if ( items->getLength() > 0 )
+ if ( items->size() > 0 )
m_doc->addTocChildren( toc, toc, items );
return toc;
diff --git a/qt5/src/poppler-fontinfo.cc b/qt5/src/poppler-fontinfo.cc
index 80519dd..783d6da 100644
--- a/qt5/src/poppler-fontinfo.cc
+++ b/qt5/src/poppler-fontinfo.cc
@@ -130,8 +130,8 @@
GooList *items = d->fontInfoScanner.scan( 1 );
if ( !items )
return fonts;
- fonts.reserve( items->getLength() );
- for ( int i = 0; i < items->getLength(); ++i ) {
+ fonts.reserve( items->size() );
+ for ( std::size_t i = 0; i < items->size(); ++i ) {
fonts.append( FontInfo( FontInfoData( ( ::FontInfo* )items->get( i ) ) ) );
}
deleteGooList<::FontInfo>( items );
diff --git a/qt5/src/poppler-optcontent.cc b/qt5/src/poppler-optcontent.cc
index ac1c61f..f542d25 100644
--- a/qt5/src/poppler-optcontent.cc
+++ b/qt5/src/poppler-optcontent.cc
@@ -399,11 +399,11 @@
QSet<OptContentItem *> changedItems;
const GooList *statesList = popplerLinkOCGState->getStateList();
- for (int i = 0; i < statesList->getLength(); ++i) {
+ for (std::size_t i = 0; i < statesList->size(); ++i) {
::LinkOCGState::StateList *stateList = (::LinkOCGState::StateList*)statesList->get(i);
GooList *refsList = stateList->list;
- for (int j = 0; j < refsList->getLength(); ++j) {
+ for (std::size_t j = 0; j < refsList->size(); ++j) {
Ref *ref = (Ref *)refsList->get(j);
OptContentItem *item = d->itemFromRef(QString::number(ref->num));
diff --git a/qt5/src/poppler-page.cc b/qt5/src/poppler-page.cc
index 1e5e1ae..d6f4ec3 100644
--- a/qt5/src/poppler-page.cc
+++ b/qt5/src/poppler-page.cc
@@ -366,7 +366,7 @@
if ( nextActions )
{
QVector<Link *> links;
- for ( int i = 0; i < nextActions->getLength(); ++i )
+ for ( std::size_t i = 0; i < nextActions->size(); ++i )
{
links << convertLinkActionToLink( static_cast< ::LinkAction * >( nextActions->get( i ) ), parentDoc, linkArea );
}
diff --git a/qt5/src/poppler-private.cc b/qt5/src/poppler-private.cc
index 0c178a5..5e8939b 100644
--- a/qt5/src/poppler-private.cc
+++ b/qt5/src/poppler-private.cc
@@ -284,8 +284,7 @@
void DocumentData::addTocChildren( QDomDocument * docSyn, QDomNode * parent, const GooList * items )
{
- int numItems = items->getLength();
- for ( int i = 0; i < numItems; ++i )
+ for ( std::size_t i = 0; i < items->size(); ++i )
{
// iterate over every object in 'items'
::OutlineItem * outlineItem = (::OutlineItem *)items->get( i );
diff --git a/splash/Splash.cc b/splash/Splash.cc
index bcacb5f..bc71819 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -5283,8 +5283,8 @@
return splashErrZeroImage;
}
- if(src->getSeparationList()->getLength() > bitmap->getSeparationList()->getLength()) {
- for (x = bitmap->getSeparationList()->getLength(); x < src->getSeparationList()->getLength(); x++)
+ if(src->getSeparationList()->size() > bitmap->getSeparationList()->size()) {
+ for (x = bitmap->getSeparationList()->size(); x < (int)src->getSeparationList()->size(); x++)
bitmap->getSeparationList()->push_back(((GfxSeparationColorSpace *)src->getSeparationList()->get(x))->copy());
}
if (src->alpha) {
diff --git a/splash/SplashBitmap.cc b/splash/SplashBitmap.cc
index 5690950..ada3272 100644
--- a/splash/SplashBitmap.cc
+++ b/splash/SplashBitmap.cc
@@ -126,7 +126,7 @@
}
separationList = new GooList();
if (separationListA != nullptr)
- for (int i = 0; i < separationListA->getLength(); i++)
+ for (std::size_t i = 0; i < separationListA->size(); i++)
separationList->push_back(((GfxSeparationColorSpace *) separationListA->get(i))->copy());
}
diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index 1b07800..b9f7ad0 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -1666,7 +1666,7 @@
{
GooString *var;
- for(int i = 0; i < glMetaVars->getLength(); i++)
+ for(std::size_t i = 0; i < glMetaVars->size(); i++)
{
HtmlMetaVar *t = (HtmlMetaVar*)glMetaVars->get(i);
var = t->toString();
@@ -1755,7 +1755,7 @@
}
fputs("<ul>\n",output);
- for (int i = 0; i < outlines->getLength(); i++)
+ for (std::size_t i = 0; i < outlines->size(); i++)
{
OutlineItem *item = (OutlineItem*)outlines->get(i);
GooString *titleStr = HtmlFont::HtmlFilter(item->getTitle(),
@@ -1816,7 +1816,7 @@
{
fputs("<outline>\n", output);
- for (int i = 0; i < outlines->getLength(); i++)
+ for (std::size_t i = 0; i < outlines->size(); i++)
{
OutlineItem *item = (OutlineItem*)outlines->get(i);
GooString *titleStr = HtmlFont::HtmlFilter(item->getTitle(),
diff --git a/utils/HtmlOutputDev.h b/utils/HtmlOutputDev.h
index 7f09c05..c097091 100644
--- a/utils/HtmlOutputDev.h
+++ b/utils/HtmlOutputDev.h
@@ -157,7 +157,7 @@
void addImage(GooString *fname, GfxState *state);
// number of images on the current page
- int getNumImages() { return imgList->getLength(); }
+ int getNumImages() { return imgList->size(); }
void dump(FILE *f, int pageNum, const std::vector<std::string>& backgroundImages);
diff --git a/utils/pdfdetach.cc b/utils/pdfdetach.cc
index faa1e04..802632a 100644
--- a/utils/pdfdetach.cc
+++ b/utils/pdfdetach.cc
@@ -181,7 +181,7 @@
}
}
- nFiles = embeddedFiles->getLength();
+ nFiles = embeddedFiles->size();
// list embedded files
if (doList) {
diff --git a/utils/pdffonts.cc b/utils/pdffonts.cc
index ecb94a0..f0fcf5b 100644
--- a/utils/pdffonts.cc
+++ b/utils/pdffonts.cc
@@ -171,7 +171,7 @@
printf("name object ID substitute font substitute font file\n");
printf("------------------------------------ --------- ------------------------------------ ------------------------------------\n");
if (fonts) {
- for (int i = 0; i < fonts->getLength(); ++i) {
+ for (std::size_t i = 0; i < fonts->size(); ++i) {
FontInfo *font = (FontInfo *)fonts->get(i);
if (font->getFile()) {
printf("%-36s",
@@ -195,7 +195,7 @@
printf("name type encoding emb sub uni object ID\n");
printf("------------------------------------ ----------------- ---------------- --- --- --- ---------\n");
if (fonts) {
- for (int i = 0; i < fonts->getLength(); ++i) {
+ for (std::size_t i = 0; i < fonts->size(); ++i) {
FontInfo *font = (FontInfo *)fonts->get(i);
printf("%-36s %-17s %-16s %-3s %-3s %-3s",
font->getName() ? font->getName()->c_str() : "[none]",
diff --git a/utils/printencodings.cc b/utils/printencodings.cc
index fa8e20d..1a6d5e2 100644
--- a/utils/printencodings.cc
+++ b/utils/printencodings.cc
@@ -33,7 +33,7 @@
});
printf("Available encodings are:\n");
- for (int i = 0; i < encNames->getLength(); ++i) {
+ for (std::size_t i = 0; i < encNames->size(); ++i) {
GooString *enc = (GooString*)encNames->get(i);
printf("%s\n", enc->c_str());
}