~ubuntu-branches/ubuntu/precise/cups-filters/precise-security

« back to all changes in this revision

Viewing changes to pdftopdf/P2POutputStream.cxx

  • Committer: Package Import Robot
  • Author(s): Till Kamppeter, Till Kamppeter, Martin Pitt
  • Date: 2012-03-30 08:49:48 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20120330084948-7h3u3zfikkvuywmk
Tags: 1.0.11-1
[ Till Kamppeter ]
* New upstream release
   - Updated all code copied from Poppler to the current state of Poppler,
     to fix any bugs or security vulnerabilities which were in that
     Poppler code.
   - Made Poppler-based PDF filters building with various versions of
     Poppler.
   - Deactivated NIME conversion rules which are not used by the PDF-
     based printing workflow.
   - Added generic PPD for native PDF printers.
   - Cleaned up sample PPD file HP-Color_LaserJet_CM3530_MFP-PDF.ppd.
   - imagetopdf: Added support for native PDF printers.
   - imagetopdf, imagetoraster: Let image input "scale to fit"
     by default. This makes photo printing via AirPrint work,
     as the iOS devices send JPEG but do not allow setting options.
   - pdftops: Generally do not compress fonts and images, and
     also do not do CCITT compression for bitmap glyphs to make
     the PostScript output more compatible with buggy PostScript
     interpreters. The output gets 30-50% longer but will work on
     many more different printer models. Problems were also
     discovered on HP and not only on Brother (LP: #960666).

[ Martin Pitt ]
* Drop debian/patches/poppler-pre-0.18.patch and patch machinery around it.
  It's not necessary with the current upstream version any more.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
#include "P2POutputStream.h"
33
33
#include <stdarg.h>
34
34
#include <string.h>
35
 
#include <Error.h>
 
35
#include "P2PError.h"
36
36
 
37
37
#define LINEBUFSIZE 1024
38
38
 
95
95
      zstream.next_out = reinterpret_cast<Bytef *>(outputBuf);
96
96
      zstream.avail_out = LINEBUFSIZE*2;
97
97
      if ((r = deflate(&zstream,0)) != Z_OK) {
98
 
        error(-1,const_cast<char *>("ZLIB:deflate error"));
 
98
        p2pError(-1,const_cast<char *>("ZLIB:deflate error"));
99
99
        return r;
100
100
      }
101
101
      /* Z_OK */
102
102
      /* output data */
103
103
      outputLen = LINEBUFSIZE*2-zstream.avail_out;
104
104
      if ((r = fwrite(outputBuf,1,outputLen,fp)) != outputLen) {
105
 
        error(-1,const_cast<char *>("P2POutputStream: write  error"));
 
105
        p2pError(-1,const_cast<char *>("P2POutputStream: write  error"));
106
106
        break;
107
107
      }
108
108
      position += r;
111
111
  } else {
112
112
#endif
113
113
    if ((r = fwrite(buf,1,n,fp)) != n) {
114
 
      error(-1,const_cast<char *>("P2POutputStream: write  error"));
 
114
      p2pError(-1,const_cast<char *>("P2POutputStream: write  error"));
115
115
      return r;
116
116
    }
117
117
    position += r;
141
141
  zstream.opaque = 0;
142
142
 
143
143
  if (deflateInit(&zstream,Z_DEFAULT_COMPRESSION) != Z_OK) {
144
 
    error(-1,const_cast<char *>("ZLIB:deflateInit error"));
 
144
    p2pError(-1,const_cast<char *>("ZLIB:deflateInit error"));
145
145
    return;
146
146
  }
147
147
  deflating = gTrue;
164
164
    zstream.next_in = 0;
165
165
    zstream.avail_in = 0;
166
166
    if ((r = deflate(&zstream,Z_FINISH)) != Z_STREAM_END && r != Z_OK) {
167
 
      error(-1,const_cast<char *>("ZLIB:deflate error"));
 
167
      p2pError(-1,const_cast<char *>("ZLIB:deflate error"));
168
168
      break;
169
169
    }
170
170
    /* Z_OK or Z_STREAM_END */
171
171
    /* output data */
172
172
    outputLen = LINEBUFSIZE*2-zstream.avail_out;
173
173
    if ((n = fwrite(outputBuf,1,outputLen,fp)) != outputLen) {
174
 
      error(-1,const_cast<char *>("P2POutputStream: write  error"));
 
174
      p2pError(-1,const_cast<char *>("P2POutputStream: write  error"));
175
175
      break;
176
176
    }
177
177
    position += n;
178
178
  } while (r != Z_STREAM_END);
179
179
  if (deflateEnd(&zstream) != Z_OK) {
180
 
      error(-1,const_cast<char *>("ZLIB:deflateEnd error"));
 
180
      p2pError(-1,const_cast<char *>("ZLIB:deflateEnd error"));
181
181
  }
182
182
  deflating = gFalse;
183
183
#endif