diff options
author | Oliver Sander <oliver.sander@tu-dresden.de> | 2020-01-29 09:41:35 +0100 |
---|---|---|
committer | Albert Astals Cid <tsdgeos@yahoo.es> | 2020-02-23 16:47:00 +0000 |
commit | 3355e20b2849fc1be131095bc2fe5b0a02d41d5a (patch) | |
tree | a6fe0becfb729ca6e8a2510ee2d78b43f6a47891 | |
parent | 5804f51c7cf439432082b668ba8df3b0a6048caf (diff) |
Implement fillGooString in terms of fillString
This requires to add a method to GooString that allows access
as a mutable std::string&.
-rw-r--r-- | goo/GooString.h | 1 | ||||
-rw-r--r-- | poppler/Stream.h | 7 |
2 files changed, 2 insertions, 6 deletions
diff --git a/goo/GooString.h b/goo/GooString.h index 11baa8ae..78824455 100644 --- a/goo/GooString.h +++ b/goo/GooString.h @@ -68,6 +68,7 @@ public: explicit GooString(std::string&& str) : std::string(std::move(str)) {} const std::string& toStr() const { return *this; } + std::string& toNonConstStr() { return *this; } // Create a string from <lengthA> chars at <sA>. This string // can contain null characters. diff --git a/poppler/Stream.h b/poppler/Stream.h index e19790e5..04dfd053 100644 --- a/poppler/Stream.h +++ b/poppler/Stream.h @@ -142,12 +142,7 @@ public: inline void fillGooString(GooString *s) { - unsigned char readBuf[4096]; - int readChars; - reset(); - while ((readChars = doGetChars(4096, readBuf)) != 0) { - s->append((const char *)readBuf, readChars); - } + fillString(s->toNonConstStr()); } inline unsigned char *toUnsignedChars(int *length, int initialSize = 4096, int sizeIncrement = 4096) |