summaryrefslogtreecommitdiff
path: root/poppler
diff options
context:
space:
mode:
authorOliver Sander <oliver.sander@tu-dresden.de>2019-10-14 20:08:33 +0200
committerOliver Sander <oliver.sander@tu-dresden.de>2019-10-23 08:51:46 +0000
commite076a478e4d2f7d6445215814c86e6ac4654f575 (patch)
treeea6c1545e0c8366877ef0f6bd7a924056e629c99 /poppler
parent8911527dc38908ee56626fc55d09041475cc5145 (diff)
Make FontInfo::scan return a std::vector object
... rather than a pointer to a std::vector. Given that a std::vector is little more than a pointer and some size information, there is no need to create std::vector objects on the heap. Returning them by value is just as fast (the vector content is not copied), and makes the code more readable, too.
Diffstat (limited to 'poppler')
-rw-r--r--poppler/FontInfo.cc8
-rw-r--r--poppler/FontInfo.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/poppler/FontInfo.cc b/poppler/FontInfo.cc
index 7dc62769..87c212ee 100644
--- a/poppler/FontInfo.cc
+++ b/poppler/FontInfo.cc
@@ -52,17 +52,17 @@ FontInfoScanner::FontInfoScanner(PDFDoc *docA, int firstPage) {
FontInfoScanner::~FontInfoScanner() {
}
-std::vector<FontInfo*> *FontInfoScanner::scan(int nPages) {
+std::vector<FontInfo*> FontInfoScanner::scan(int nPages) {
Page *page;
Dict *resDict;
Annots *annots;
int lastPage;
+ std::vector<FontInfo*> result;
+
if (currentPage > doc->getNumPages()) {
- return nullptr;
+ return result;
}
-
- auto result = new std::vector<FontInfo*>();
lastPage = currentPage + nPages;
if (lastPage > doc->getNumPages() + 1) {
diff --git a/poppler/FontInfo.h b/poppler/FontInfo.h
index 6ed6fb2f..0ecef820 100644
--- a/poppler/FontInfo.h
+++ b/poppler/FontInfo.h
@@ -92,7 +92,7 @@ public:
// Destructor.
~FontInfoScanner();
- std::vector<FontInfo*> *scan(int nPages);
+ std::vector<FontInfo*> scan(int nPages);
private: