Commit fda9a2a2 authored by Oliver Sander's avatar Oliver Sander Committed by Albert Astals Cid

Remove method GooList::getLength

Use method 'size' (from std::vector) instead.
parent f4e90212
......@@ -221,8 +221,8 @@ std::vector<font_info> font_iterator::next()
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);
......
/*
/*
* Copyright (C) 2009-2010, Pino Toscano <pino@kde.org>
* Copyright (C) 2018, Albert Astals Cid <aacid@kde.org>
*
......@@ -45,7 +45,7 @@ toc* toc_private::load_from_outline(Outline *outline)
}
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(const OutlineItem *item)
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);
......
......@@ -582,7 +582,6 @@ build_ocg_state (PopplerDocument *document,
{
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 @@ build_ocg_state (PopplerDocument *document,
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 @@ build_ocg_state (PopplerDocument *document,
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);
......
......@@ -2377,7 +2377,7 @@ poppler_index_iter_next (PopplerIndexIter *iter)
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 @@ poppler_fonts_iter_next (PopplerFontsIter *iter)
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 @@ poppler_fonts_iter_copy (PopplerFontsIter *iter)
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 @@ poppler_font_info_scan (PopplerFontInfo *font_info,
if (items == nullptr) {
*iter = nullptr;
} else if (items->getLength() == 0) {
} else if (items->empty()) {
*iter = nullptr;
delete items;
} else {
......
......@@ -638,7 +638,6 @@ poppler_page_get_selection_region (PopplerPage *page,
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 @@ poppler_page_get_selection_region (PopplerPage *page,
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 @@ poppler_page_get_selected_region (PopplerPage *page,
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 @@ poppler_page_get_selected_region (PopplerPage *page,
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 @@ poppler_page_get_text_layout_for_area (PopplerPage *page,
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 @@ poppler_page_get_text_layout_for_area (PopplerPage *page,
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 @@ poppler_page_get_text_layout_for_area (PopplerPage *page,
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 @@ poppler_page_get_text_attributes_for_area (PopplerPage *page,
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 @@ poppler_page_get_text_attributes_for_area (PopplerPage *page,
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 @@ poppler_page_get_text_attributes_for_area (PopplerPage *page,
prev_word_i = word_i;
}
if (j < line_words->getLength() - 1)
if (j < line_words->size() - 1)
{
attrs->end_index = offset;
offset++;
......
......@@ -48,9 +48,6 @@ public:
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]; }
......
......@@ -770,7 +770,7 @@ DefaultAppearance::DefaultAppearance(GooString *da) {
}
}
// 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 @@ bool AnnotAppearanceBuilder::drawText(const GooString *text, const GooString *da
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 @@ bool AnnotAppearanceBuilder::drawText(const GooString *text, const GooString *da
// 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 @@ bool AnnotAppearanceBuilder::drawText(const GooString *text, const GooString *da
// 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 @@ bool AnnotAppearanceBuilder::drawText(const GooString *text, const GooString *da
// 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 @@ bool AnnotAppearanceBuilder::drawListBox(const FormFieldChoice *fieldChoice, con
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 @@ bool AnnotAppearanceBuilder::drawListBox(const FormFieldChoice *fieldChoice, con
// 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(' ');
}
}
......
......@@ -1239,10 +1239,10 @@ void FormFieldText::setTextFontSize(int fontSize)
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 @@ int FormFieldText::tokenizeDA(const GooString* da, GooList* daToks, const char*
}
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;
}
}
......
......@@ -2876,7 +2876,7 @@ void GfxSeparationColorSpace::createMapping(GooList *separationList, int maxSepC
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 @@ void GfxSeparationColorSpace::createMapping(GooList *separationList, int maxSepC
}
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 @@ GfxColorSpace *GfxDeviceNColorSpace::copy() {
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 @@ void GfxDeviceNColorSpace::createMapping(GooList *separationList, int maxSepComp
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 @@ void GfxDeviceNColorSpace::createMapping(GooList *separationList, int maxSepComp
}
}
}
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 @@ void GfxDeviceNColorSpace::createMapping(GooList *separationList, int maxSepComp
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 @@ void GfxDeviceNColorSpace::createMapping(GooList *separationList, int maxSepComp
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;
......
......@@ -337,7 +337,7 @@ SysFontInfo *SysFontList::find(const GooString *name, bool fixedWidth, bool exac
// 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 @@ SysFontInfo *SysFontList::find(const GooString *name, bool fixedWidth, bool exac
}
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 @@ SysFontInfo *SysFontList::find(const GooString *name, bool fixedWidth, bool exac
}
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::findCMapFile(const GooString *collection, const GooString *c
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");
......
......@@ -1704,7 +1704,7 @@ bool JBIG2Stream::readSymbolDictSeg(unsigned int segNum, unsigned int length,
} 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 @@ bool JBIG2Stream::readSymbolDictSeg(unsigned int segNum, unsigned int length,
} 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 @@ bool JBIG2Stream::readSymbolDictSeg(unsigned int segNum, unsigned int length,
if (huffBMSize == 0) {
huffBMSizeTable = huffTableA;
} else {
if (i >= (unsigned int)codeTables->getLength()) {
if (i >= codeTables->size()) {
goto codeTableError;
}
huffBMSizeTable =
......@@ -1731,7 +1731,7 @@ bool JBIG2Stream::readSymbolDictSeg(unsigned int segNum, unsigned int length,
if (huffAggInst == 0) {
huffAggInstTable = huffTableA;
} else {
if (i >= (unsigned int)codeTables->getLength()) {
if (i >= codeTables->size()) {
goto codeTableError;
}
huffAggInstTable =
......@@ -2136,7 +2136,7 @@ void JBIG2Stream::readTextRegionSeg(unsigned int segNum, bool imm,
} 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 @@ void JBIG2Stream::readTextRegionSeg(unsigned int segNum, bool imm,
} 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 @@ void JBIG2Stream::readTextRegionSeg(unsigned int segNum, bool imm,
} 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 @@ void JBIG2Stream::readTextRegionSeg(unsigned int segNum, bool imm,
} 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 @@ void JBIG2Stream::readTextRegionSeg(unsigned int segNum, bool imm,
} 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 @@ void JBIG2Stream::readTextRegionSeg(unsigned int segNum, bool imm,
} 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 @@ void JBIG2Stream::readTextRegionSeg(unsigned int segNum, bool imm,
} 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 @@ void JBIG2Stream::readTextRegionSeg(unsigned int segNum, bool imm,
if (huffRSize == 0) {
huffRSizeTable = huffTableA;
} else {
if (i >= (unsigned int)codeTables->getLength()) {
if (i >= codeTables->size()) {
goto codeTableError;
}
huffRSizeTable =
......@@ -4175,15 +4175,14 @@ void JBIG2Stream::readExtensionSeg(unsigned int length) {
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;
......
......@@ -465,7 +465,7 @@ int OCDisplayNode::getNumChildren() const {
if (!children) {
return 0;
}
return children->getLength();
return children->size();
}
OCDisplayNode *OCDisplayNode::getChild(int idx) const {
......
......@@ -137,7 +137,7 @@ GooList *OutlineItem::readItemList(OutlineItem *parent, const Object *firstItemR
gfree(alreadyRead);
if (!items->getLength()) {
if (items->empty()) {
delete items;
items = nullptr;
}
......
......@@ -54,7 +54,7 @@ PDFDoc *
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);
......
......@@ -1357,12 +1357,12 @@ void PSOutputDev::postInit()
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 @@ void PSOutputDev::writeHeader(const std::vector<int> &pages,
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);
......
......@@ -2336,11 +2336,11 @@ TextWordList::~TextWordList() {
}
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 @@ void TextPage::updateFont(GfxState *state) {
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 @@ void TextPage::coalesce(bool physLayout, double fixedPitch, bool doHTML) {
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 @@ void TextPage::coalesce(bool physLayout, double fixedPitch, bool doHTML) {
}
//----- 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 @@ void TextSelectionDumper::finishLine()
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 @@ void TextSelectionDumper::endPage()
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 @@ GooString *TextSelectionDumper::getText (void)
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 @@ void TextSelectionPainter::endPage()
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;
......
......@@ -591,11 +591,11 @@ namespace Poppler {
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;
......
......@@ -130,8 +130,8 @@ QList<FontInfo> FontIterator::next()
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 );
......