Remove GooList::del since its few users are easily converted.
diff --git a/goo/GooList.h b/goo/GooList.h
index 657839a..c0e7102 100644
--- a/goo/GooList.h
+++ b/goo/GooList.h
@@ -81,15 +81,6 @@
void insert(int i, void *p) {
static_cast<std::vector<void *>&>(*this).insert(begin() + i, p);
}
-
- // Deletes and returns the element at index <i>.
- // Assumes 0 <= i < length.
- void *del(int i) {
- auto iter = begin() + i;
- auto tmp = *iter;
- erase(iter);
- return tmp;
- }
};
#define deleteGooList(list, T) \
diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index 2acbc91..60c1c18 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -4177,20 +4177,17 @@
}
void JBIG2Stream::discardSegment(Guint segNum) {
- JBIG2Segment *seg;
- int i;
-
- for (i = 0; i < globalSegments->getLength(); ++i) {
- seg = (JBIG2Segment *)globalSegments->get(i);
+ for (auto it = globalSegments->begin(); it != globalSegments->end(); ++it) {
+ auto seg = static_cast<JBIG2Segment *>(*it);
if (seg->getSegNum() == segNum) {
- globalSegments->del(i);
+ globalSegments->erase(it);
return;
}
}
- for (i = 0; i < segments->getLength(); ++i) {
- seg = (JBIG2Segment *)segments->get(i);
+ for (auto it = segments->begin(); it != segments->end(); ++it) {
+ auto seg = static_cast<JBIG2Segment *>(*it);
if (seg->getSegNum() == segNum) {
- segments->del(i);
+ segments->erase(it);
return;
}
}
diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index bcef5f1..ef8c65d 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -757,10 +757,9 @@
fprintf(f,"\t%s\n",fontCSStyle->getCString());
delete fontCSStyle;
}
-
- int listlen=imgList->getLength();
- for (int i = 0; i < listlen; i++) {
- HtmlImage *img = (HtmlImage*)imgList->del(0);
+
+ for (auto ptr : *imgList) {
+ auto img = static_cast<HtmlImage *>(ptr);
if (!noRoundedCoordinates) {
fprintf(f, "<image top=\"%d\" left=\"%d\" ", xoutRound(img->yMin), xoutRound(img->xMin));
fprintf(f, "width=\"%d\" height=\"%d\" ", xoutRound(img->xMax - img->xMin), xoutRound(img->yMax - img->yMin));
@@ -772,6 +771,7 @@
fprintf(f,"src=\"%s\"/>\n",img->fName->getCString());
delete img;
}
+ imgList->clear();
for(HtmlString *tmp=yxStrings;tmp;tmp=tmp->yxNext){
if (tmp->htext){
@@ -952,9 +952,8 @@
{
fprintf(f,"<a name=%d></a>",pageNum);
// Loop over the list of image names on this page
- int listlen=imgList->getLength();
- for (int i = 0; i < listlen; i++) {
- HtmlImage *img = (HtmlImage*)imgList->del(0);
+ for (auto ptr : *imgList) {
+ auto img = static_cast<HtmlImage *>(ptr);
// see printCSS() for class names
const char *styles[4] = { "", " class=\"xflip\"", " class=\"yflip\"", " class=\"xyflip\"" };
@@ -965,6 +964,7 @@
fprintf(f,"<img%s src=\"%s\"/><br/>\n",styles[style_index],img->fName->getCString());
delete img;
}
+ imgList->clear();
GooString* str;
for(HtmlString *tmp=yxStrings;tmp;tmp=tmp->yxNext){