summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2017-06-27 16:13:17 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-06-27 20:59:17 +0000
commitd39443e8a5ae8e189e272accc23c5e66d9f0bd8d (patch)
tree1935b54935b6ab0983c186ea3fd1c86a6103833e /core/fpdfapi
parent6fac27d038697806aacdf1960e5a99eceda5ce31 (diff)
downloadpdfium-d39443e8a5ae8e189e272accc23c5e66d9f0bd8d.tar.xz
Add overload for CPDF_Stream.SetData() that takes an ostringstream.
Bug: pdfium:731 Change-Id: Ie65bafc644cff076b0d7aadcc5d0b0e33e2c199b Reviewed-on: https://pdfium-review.googlesource.com/7035 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/parser/cpdf_stream.cpp5
-rw-r--r--core/fpdfapi/parser/cpdf_stream.h4
2 files changed, 8 insertions, 1 deletions
diff --git a/core/fpdfapi/parser/cpdf_stream.cpp b/core/fpdfapi/parser/cpdf_stream.cpp
index 69a87e6d2e..ec12ac5080 100644
--- a/core/fpdfapi/parser/cpdf_stream.cpp
+++ b/core/fpdfapi/parser/cpdf_stream.cpp
@@ -110,6 +110,11 @@ void CPDF_Stream::SetData(const uint8_t* pData, uint32_t size) {
m_pDict->RemoveFor("DecodeParms");
}
+void CPDF_Stream::SetData(std::ostringstream* stream) {
+ SetData(reinterpret_cast<const uint8_t*>(stream->str().c_str()),
+ stream->tellp());
+}
+
bool CPDF_Stream::ReadRawData(FX_FILESIZE offset,
uint8_t* buf,
uint32_t size) const {
diff --git a/core/fpdfapi/parser/cpdf_stream.h b/core/fpdfapi/parser/cpdf_stream.h
index 82cc01aef3..d58f608f72 100644
--- a/core/fpdfapi/parser/cpdf_stream.h
+++ b/core/fpdfapi/parser/cpdf_stream.h
@@ -9,6 +9,7 @@
#include <memory>
#include <set>
+#include <sstream>
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_object.h"
@@ -38,8 +39,9 @@ class CPDF_Stream : public CPDF_Object {
uint32_t GetRawSize() const { return m_dwSize; }
uint8_t* GetRawData() const { return m_pDataBuf.get(); }
- // Does not takes onwership of |pData|, copies into internally-owned buffer.
+ // Does not takes ownership of |pData|, copies into internally-owned buffer.
void SetData(const uint8_t* pData, uint32_t size);
+ void SetData(std::ostringstream* stream);
void InitStream(const uint8_t* pData,
uint32_t size,