Commit 791faac4da44cc615407e384c0faf333f403adcd
1 parent
5dcf3ba9
Use new read method in QPDF::isLinearized
Showing
1 changed file
with
4 additions
and
7 deletions
libqpdf/QPDF_linearization.cc
| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | |
| 5 | 5 | #include <qpdf/BitStream.hh> |
| 6 | 6 | #include <qpdf/BitWriter.hh> |
| 7 | +#include <qpdf/InputSource_private.hh> | |
| 7 | 8 | #include <qpdf/Pl_Buffer.hh> |
| 8 | 9 | #include <qpdf/Pl_Count.hh> |
| 9 | 10 | #include <qpdf/Pl_Flate.hh> |
| ... | ... | @@ -96,14 +97,10 @@ QPDF::isLinearized() |
| 96 | 97 | |
| 97 | 98 | // The PDF spec says the linearization dictionary must be completely contained within the first |
| 98 | 99 | // 1024 bytes of the file. Add a byte for a null terminator. |
| 99 | - static int const tbuf_size = 1025; | |
| 100 | - | |
| 101 | - auto b = std::make_unique<char[]>(tbuf_size); | |
| 102 | - char* buf = b.get(); | |
| 103 | - m->file->seek(0, SEEK_SET); | |
| 104 | - memset(buf, '\0', tbuf_size); | |
| 105 | - m->file->read(buf, tbuf_size - 1); | |
| 100 | + auto buffer = m->file->read(1024, 0); | |
| 106 | 101 | |
| 102 | + auto buf = buffer.data(); | |
| 103 | + auto tbuf_size = buffer.size(); | |
| 107 | 104 | int lindict_obj = -1; |
| 108 | 105 | char* p = buf; |
| 109 | 106 | while (lindict_obj == -1) { | ... | ... |