From a2cd243580a2c5c5c547b5fe0822cf3706f812fa Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Mon, 4 Nov 2013 21:06:09 +1030 Subject: [PATCH 8/8] PDFDoc: use only \n for line ending PDFDoc was using a mixture of '\n' and '\r\n' for line endings in the PDF output. Be consistent, and reduce the output size, by only using '\n'. --- poppler/PDFDoc.cc | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index 0eca6fc..3962319 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -923,7 +923,7 @@ void PDFDoc::saveCompleteRewrite (OutStream* outStr) int keyLength; xref->getEncryptionParameters(&fileKey, &encAlgorithm, &keyLength); - outStr->printf("%%PDF-%d.%d\r\n",pdfMajorVersion,pdfMinorVersion); + outStr->printf("%%PDF-%d.%d\n",pdfMajorVersion,pdfMinorVersion); XRef *uxref = new XRef(); uxref->add(0, 65535, 0, gFalse); xref->lock(); @@ -1012,7 +1012,7 @@ void PDFDoc::writeFlateStream (Stream* str, OutStream* outStr) { int n; Guchar buf[4096]; - outStr->printf("stream\r\n"); + outStr->printf("stream\n"); DeflateStream deflateStr(outStr); str->reset(); do { @@ -1020,7 +1020,7 @@ void PDFDoc::writeFlateStream (Stream* str, OutStream* outStr) deflateStr.write(buf, n); } while (n); deflateStr.close(); - outStr->printf("\r\nendstream\r\n"); + outStr->printf("\nendstream\n"); } void PDFDoc::writeRawStream (Stream* str, OutStream* outStr) @@ -1039,14 +1039,14 @@ void PDFDoc::writeRawStream (Stream* str, OutStream* outStr) length = obj1.getInt64(); obj1.free(); - outStr->printf("stream\r\n"); + outStr->printf("stream\n"); str->unfilteredReset(); for (Goffset i = 0; i < length; i++) { int c = str->getUnfilteredChar(); outStr->printf("%c", c); } str->reset(); - outStr->printf("\r\nendstream\r\n"); + outStr->printf("\nendstream\n"); } void PDFDoc::writeString (GooString* s, OutStream* outStr, Guchar *fileKey, @@ -1259,23 +1259,23 @@ void PDFDoc::writeObject (Object* obj, OutStream* outStr, XRef *xRef, Guint numO outStr->printf("%s\n", obj->getCmd()); break; case objError: - outStr->printf("error\r\n"); + outStr->printf("error\n"); break; case objEOF: - outStr->printf("eof\r\n"); + outStr->printf("eof\n"); break; case objNone: - outStr->printf("none\r\n"); + outStr->printf("none\n"); break; default: - error(errUnimplemented, -1,"Unhandled objType : {0:d}, please report a bug with a testcase\r\n", obj->getType()); + error(errUnimplemented, -1,"Unhandled objType : {0:d}, please report a bug with a testcase\n", obj->getType()); break; } } void PDFDoc::writeObjectFooter (OutStream* outStr) { - outStr->printf("endobj\r\n"); + outStr->printf("endobj\n"); } Dict *PDFDoc::createTrailerDict(int uxrefSize, GBool incrUpdate, Goffset startxRef, @@ -1381,11 +1381,11 @@ Dict *PDFDoc::createTrailerDict(int uxrefSize, GBool incrUpdate, Goffset startxR void PDFDoc::writeXRefTableTrailer(Dict *trailerDict, XRef *uxref, GBool writeAllEntries, Goffset uxrefOffset, OutStream* outStr, XRef *xRef) { uxref->writeTableToFile( outStr, writeAllEntries ); - outStr->printf( "trailer\r\n"); + outStr->printf( "trailer\n"); writeDictionary(trailerDict, outStr, xRef, 0, NULL, cryptRC4, 0, 0, 0); - outStr->printf( "\r\nstartxref\r\n"); - outStr->printf( "%lli\r\n", uxrefOffset); - outStr->printf( "%%%%EOF\r\n"); + outStr->printf( "\nstartxref\n"); + outStr->printf( "%lli\n", uxrefOffset); + outStr->printf( "%%%%EOF\n"); } void PDFDoc::writeXRefStreamTrailer (Dict *trailerDict, XRef *uxref, Ref *uxrefStreamRef, Goffset uxrefOffset, OutStream* outStr, XRef *xRef) @@ -1404,9 +1404,9 @@ void PDFDoc::writeXRefStreamTrailer (Dict *trailerDict, XRef *uxref, Ref *uxrefS writeObjectFooter(outStr); obj1.free(); - outStr->printf( "startxref\r\n"); - outStr->printf( "%lli\r\n", uxrefOffset); - outStr->printf( "%%%%EOF\r\n"); + outStr->printf( "startxref\n"); + outStr->printf( "%lli\n", uxrefOffset); + outStr->printf( "%%%%EOF\n"); } void PDFDoc::writeXRefTableTrailer(Goffset uxrefOffset, XRef *uxref, GBool writeAllEntries, -- 1.8.3.2