summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorsuzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>2020-05-05 10:11:49 +0000
committerAlbert Astals Cid <tsdgeos@yahoo.es>2020-05-19 21:06:58 +0000
commit507027de297f43146f5bbebe8d098dededffc577 (patch)
tree7c0b81d8f439da0fb1fb393843e168a71814cd70 /cpp
parent2cd79c7382888559d5d8dcc56a84572ac8a77086 (diff)
[cpp] introduce a boolean font_info_cache_initialized, to distinguish an initialized-but-empty cache from the uninitialized cache
Co-authored-by: Adam Reichold <adam.reichold@t-online.de>
Diffstat (limited to 'cpp')
-rw-r--r--cpp/poppler-page-private.h1
-rw-r--r--cpp/poppler-page.cpp4
2 files changed, 4 insertions, 1 deletions
diff --git a/cpp/poppler-page-private.h b/cpp/poppler-page-private.h
index 3e2ee914..d4954e9d 100644
--- a/cpp/poppler-page-private.h
+++ b/cpp/poppler-page-private.h
@@ -49,6 +49,7 @@ public:
{ return const_cast<poppler::page *>(p)->d; }
std::vector<font_info> font_info_cache;
+ bool font_info_cache_initialized;
size_t init_font_info_cache();
};
diff --git a/cpp/poppler-page.cpp b/cpp/poppler-page.cpp
index b0bf847e..e44ef26e 100644
--- a/cpp/poppler-page.cpp
+++ b/cpp/poppler-page.cpp
@@ -48,6 +48,7 @@ page_private::page_private(document_private *_doc, int _index)
, page(doc->doc->getCatalog()->getPage(_index + 1))
, index(_index)
, transition(nullptr)
+ , font_info_cache_initialized(false)
{
}
@@ -58,7 +59,7 @@ page_private::~page_private()
size_t page_private::init_font_info_cache()
{
- if (font_info_cache.size() > 0)
+ if (font_info_cache_initialized)
return font_info_cache.size();
poppler::font_iterator it(index, doc);
@@ -67,6 +68,7 @@ size_t page_private::init_font_info_cache()
font_info_cache = it.next();
}
+ font_info_cache_initialized = true;
return font_info_cache.size();
}