From 78f100802e74febd76d7ad2cbbb06b377795470d Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Mon, 4 Nov 2013 21:06:09 +1030 Subject: [PATCH 08/11] 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 89bbd53..4fbbfe7 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(); @@ -1004,11 +1004,11 @@ Goffset PDFDoc::getFlateStreamLength (Stream* str) // Write stream using Deflate compression void PDFDoc::writeFlateStream (Stream* str, OutStream* outStr) { - outStr->printf("stream\r\n"); + outStr->printf("stream\n"); DeflateStream deflateStr(outStr); deflateStr.copyStream(str); deflateStr.close(); - outStr->printf("\r\nendstream\r\n"); + outStr->printf("\nendstream\n"); } void PDFDoc::writeRawStream (Stream* str, OutStream* outStr) @@ -1027,14 +1027,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, @@ -1249,23 +1249,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, @@ -1371,11 +1371,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) @@ -1394,9 +1394,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