summaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFWriter.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2011-08-11 21:22:59 +0200
committerJay Berkenbilt <ejb@ql.org>2011-08-11 21:22:59 +0200
commit788f6f7769c9f0b4b439079d87bbc180860fa14c (patch)
treeae24f4ce1ec33dffc3a16f6aa93eebf5c88a54cd /libqpdf/QPDFWriter.cc
parentee93b24d6713f3e665bb926689f1ff196794e6c7 (diff)
downloadqpdf-788f6f7769c9f0b4b439079d87bbc180860fa14c.tar.zst
fix small logic error surrounding adding newlines; in practice, the logic error would probably never manifest itself without other code changes
Diffstat (limited to 'libqpdf/QPDFWriter.cc')
-rw-r--r--libqpdf/QPDFWriter.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc
index 566a250b..3dcd7b82 100644
--- a/libqpdf/QPDFWriter.cc
+++ b/libqpdf/QPDFWriter.cc
@@ -1102,11 +1102,12 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level,
writeString("\nstream\n");
pushEncryptionFilter();
writeBuffer(stream_data);
+ char last_char = this->pipeline->getLastChar();
popPipelineStack();
if (this->qdf_mode)
{
- if (this->pipeline->getLastChar() != '\n')
+ if (last_char != '\n')
{
writeString("\n");
this->added_newline = true;
@@ -1776,9 +1777,7 @@ QPDFWriter::writeHintStream(int hint_id)
openObject(hint_id);
setDataKey(hint_id);
- unsigned char* hs = hint_buffer->getBuffer();
unsigned long hlen = hint_buffer->getSize();
- char last_char = hs[hlen - 1];
writeString("<< /Filter /FlateDecode /S ");
writeString(QUtil::int_to_string(S));
@@ -1798,6 +1797,7 @@ QPDFWriter::writeHintStream(int hint_id)
}
pushEncryptionFilter();
writeBuffer(hint_buffer);
+ char last_char = this->pipeline->getLastChar();
popPipelineStack();
if (last_char != '\n')