summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
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,