[poppler] poppler/poppler: DCTStream.cc, 1.2, 1.2.2.1 DCTStream.h,
1.3, 1.3.2.1 GfxFont.cc, 1.2, 1.2.2.1 PDFDoc.cc, 1.2, 1.2.2.1
Kristian Hogsberg
krh at freedesktop.org
Mon Aug 15 22:22:39 PDT 2005
Update of /cvs/poppler/poppler/poppler
In directory gabe:/tmp/cvs-serv29307/poppler
Modified Files:
Tag: POPPLER_0_4_X
DCTStream.cc DCTStream.h GfxFont.cc PDFDoc.cc
Log Message:
2005-08-16 Kristian Høgsberg <krh at redhat.com>
* configure.ac: Bump version to 0.4.0.
* NEWS: Sum up changes.
* poppler/PDFDoc.cc: Add extended check for %%EOF.
2005-08-15 Kristian Høgsberg <krh at redhat.com>
* poppler/GfxFont.cc: Add fix discussed in #3131 to only use the
MacRoman char map if the font has one or the font dicts specifies
/MacRoman.
Index: DCTStream.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/DCTStream.cc,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- DCTStream.cc 25 Jul 2005 20:40:37 -0000 1.2
+++ DCTStream.cc 16 Aug 2005 05:22:37 -0000 1.2.2.1
@@ -15,7 +15,17 @@
static boolean str_fill_input_buffer(j_decompress_ptr cinfo)
{
struct str_src_mgr * src = (struct str_src_mgr *)cinfo->src;
- src->buffer = src->str->getChar();
+ if (src->index == 0) {
+ src->buffer = 0xFF;
+ src->index++;
+ }
+ else if (src->index == 1) {
+ src->buffer = 0xD8;
+ src->index++;
+ }
+ else {
+ src->buffer = src->str->getChar();
+ }
src->pub.next_input_byte = &src->buffer;
src->pub.bytes_in_buffer = 1;
return TRUE;
@@ -50,6 +60,7 @@
src.pub.bytes_in_buffer = 0;
src.pub.next_input_byte = NULL;
src.str = str;
+ src.index = 0;
cinfo.src = (jpeg_source_mgr *)&src;
cinfo.err = jpeg_std_error(&jerr);
x = 0;
@@ -98,10 +109,6 @@
n++;
}
- // ...and this skips the garbage
- str->reset();
- for (n = n - 2; n > 0; n--) str->getChar();
-
jpeg_read_header(&cinfo, TRUE);
jpeg_start_decompress(&cinfo);
Index: DCTStream.h
===================================================================
RCS file: /cvs/poppler/poppler/poppler/DCTStream.h,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -d -r1.3 -r1.3.2.1
--- DCTStream.h 3 Apr 2005 18:17:55 -0000 1.3
+++ DCTStream.h 16 Aug 2005 05:22:37 -0000 1.3.2.1
@@ -45,6 +45,7 @@
struct jpeg_source_mgr pub;
JOCTET buffer;
Stream *str;
+ int index;
};
Index: GfxFont.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/GfxFont.cc,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- GfxFont.cc 6 Jul 2005 17:12:36 -0000 1.2
+++ GfxFont.cc 16 Aug 2005 05:22:37 -0000 1.2.2.1
@@ -996,7 +996,6 @@
cmap = msSymbolCmap;
} else if (macRomanCmap >= 0) {
cmap = macRomanCmap;
- useMacRoman = gTrue;
}
} else {
if (macRomanCmap >= 0) {
Index: PDFDoc.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/PDFDoc.cc,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- PDFDoc.cc 6 Jul 2005 13:29:00 -0000 1.2
+++ PDFDoc.cc 16 Aug 2005 05:22:37 -0000 1.2.2.1
@@ -176,26 +176,33 @@
// Check for a %%EOF at the end of this stream
GBool PDFDoc::checkFooter() {
- // we look in the last 7 chars because it can be %%EOF %%EOF\n %%EOF\n\r etc
- char eof[8];
+ // we look in the last 1024 chars because Adobe does the same
+ char *eof = new char[1025];
int pos = str->getPos();
- str->setPos(7, -1);
- eof[0] = str->getChar();
- eof[1] = str->getChar();
- eof[2] = str->getChar();
- eof[3] = str->getChar();
- eof[4] = str->getChar();
- eof[5] = str->getChar();
- eof[6] = str->getChar();
- eof[7] = '\0';
- if (strstr(eof, "%%EOF") == NULL)
- {
- error(-1, "Document has not the mandatory ending %%EOF");
+ str->setPos(1024, -1);
+ int i, ch;
+ for (i = 0; i < 1024; i++) {
+ ch = str->getChar();
+ if (ch == EOF)
+ break;
+ eof[i] = ch;
+ }
+ eof[i] = '\0';
+
+ bool found = false;
+ for (i = i - 5; i >= 0; i--) {
+ if (strncmp (&eof[i], "%%EOF", 5) == 0) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ error(-1, "Document does not have mandatory %%EOF ending");
errCode = errDamaged;
- return gFalse;
}
+ delete[] eof;
str->setPos(pos);
- return gTrue;
+ return found;
}
// Check for a PDF header on this stream. Skip past some garbage
More information about the poppler
mailing list