summaryrefslogtreecommitdiff
path: root/extra/strigi/libstreamanalyzer_pdf.patch
blob: 6871d67fa3fd0d00d710153af3b26d4d4ad74707 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
commit 23d5ce636b7897dc3f233a5293f3164dac50566d
Author: Jos van den Oever <jos@vandenoever.info>
Date:   Sun Jul 31 12:32:44 2011 +0200

    Revert patch that breaks parsing of PDF files.
    The offending patch was 672c8b7b3cb4400bc505421f4cc70cf742ed9df0.

diff --git a/lib/pdf/pdfparser.cpp b/lib/pdf/pdfparser.cpp
index c27f691..df2f7e5 100644
--- a/lib/pdf/pdfparser.cpp
+++ b/lib/pdf/pdfparser.cpp
@@ -34,12 +34,13 @@ StreamStatus
 PdfParser::read(int32_t min, int32_t max) {
     int32_t off = (int32_t)(pos-start);
     int32_t d = (int32_t)(stream->position() - bufferStart);
-    bufferStart += off;
+    min += d;
+    if (max > 0) max += d;
     stream->reset(bufferStart);
     int32_t n = stream->read(start, min, max);
 //    printf("objstart %i %i\n", d, n);
     if (n < min) return stream->status();
-    pos = start;
+    pos = start + off;
     end = start + n;
     return Ok;
 }