summaryrefslogtreecommitdiffstats
path: root/libqpdf/BufferInputSource.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf/BufferInputSource.cc')
-rw-r--r--libqpdf/BufferInputSource.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/libqpdf/BufferInputSource.cc b/libqpdf/BufferInputSource.cc
index 6909dce2..03439955 100644
--- a/libqpdf/BufferInputSource.cc
+++ b/libqpdf/BufferInputSource.cc
@@ -11,6 +11,18 @@ BufferInputSource::BufferInputSource(std::string const& description,
{
}
+BufferInputSource::BufferInputSource(std::string const& description,
+ std::string const& contents) :
+ own_memory(true),
+ description(description),
+ buf(0),
+ cur_offset(0)
+{
+ this->buf = new Buffer(contents.length());
+ unsigned char* bp = buf->getBuffer();
+ memcpy(bp, (char*)contents.c_str(), contents.length());
+}
+
BufferInputSource::~BufferInputSource()
{
if (own_memory)