updated config.h patch
[swftools.git] / lib / pdf / xpdf-changes.patch
1 Index: Gfx.cc
2 ===================================================================
3 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/Gfx.cc,v
4 retrieving revision 1.9
5 retrieving revision 1.10
6 diff -u -r1.9 -r1.10
7 --- Gfx.cc      3 Dec 2005 10:11:33 -0000       1.9
8 +++ Gfx.cc      3 Dec 2005 10:30:41 -0000       1.10
9 @@ -439,7 +439,11 @@
10    fontChanged = gFalse;
11    clip = clipNone;
12    ignoreUndef = 0;
13 -  out->startPage(pageNum, state);
14 +  if(cropBox) {
15 +      out->startPage(pageNum, state, cropBox->x1,cropBox->y1,cropBox->x2,cropBox->y2);
16 +  } else {
17 +      out->startPage(pageNum, state, 0,0,0,0);
18 +  }
19    out->setDefaultCTM(state->getCTM());
20    out->updateAll(state);
21    for (i = 0; i < 6; ++i) {
22 @@ -450,7 +450,8 @@
23    abortCheckCbkData = abortCheckCbkDataA;
24  
25    // set crop box
26 -  if (cropBox) {
27 +#ifdef XPDFEXE
28 +  if (cropBox) {
29      state->moveTo(cropBox->x1, cropBox->y1);
30      state->lineTo(cropBox->x2, cropBox->y1);
31      state->lineTo(cropBox->x2, cropBox->y2);
32 @@ -459,7 +460,8 @@
33      state->clip();
34      out->clip(state);
35      state->clearPath();
36 -  }
37 +  }
38 +#endif
39  }
40  
41  Gfx::Gfx(XRef *xrefA, OutputDev *outA, Dict *resDict,
42 Index: GfxFont.h
43 ===================================================================
44 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/GfxFont.h,v
45 retrieving revision 1.6
46 retrieving revision 1.7
47 diff -u -r1.6 -r1.7
48 --- GfxFont.h   3 Dec 2005 10:11:33 -0000       1.6
49 +++ GfxFont.h   3 Dec 2005 10:30:41 -0000       1.7
50 @@ -207,7 +207,7 @@
51    CharCodeToUnicode *getToUnicode();
52  
53    // Return the character name associated with <code>.
54 -  char *getCharName(int code) { return enc[code]; }
55 +  char *getCharName(int code) { return code>=256?0:enc[code]; }
56  
57    // Returns true if the PDF font specified an encoding.
58    GBool getHasEncoding() { return hasEncoding; }
59 Index: GfxState.cc
60 ===================================================================
61 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/GfxState.cc,v
62 retrieving revision 1.10
63 retrieving revision 1.12
64 diff -u -r1.10 -r1.12
65 --- GfxState.cc 3 Dec 2005 10:11:33 -0000       1.10
66 +++ GfxState.cc 3 Dec 2005 12:41:32 -0000       1.12
67 @@ -21,6 +21,7 @@
68  #include "Array.h"
69  #include "Page.h"
70  #include "GfxState.h"
71 +#include "cmyk.h"
72  
73  //------------------------------------------------------------------------
74  
75 @@ -468,6 +469,18 @@
76                                 - 0.11 * color->c[2] + 0.5));
77  }
78  
79 +/*void GfxDeviceCMYKColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
80 +    unsigned char r,g,b;
81 +    float c = color->c[0];
82 +    float m = color->c[1];
83 +    float y = color->c[2];
84 +    float k = color->c[3];
85 +    convert_cmyk2rgb(c,m,y,k, &r,&g,&b);
86 +    rgb->r = r/255.0;
87 +    rgb->g = g/255.0;
88 +    rgb->b = b/255.0;
89 +}*/
90 +
91  void GfxDeviceCMYKColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
92    double c, m, y, k, c1, m1, y1, k1, r, g, b, x;
93  
94 @@ -3099,6 +3112,7 @@
95    GfxIndexedColorSpace *indexedCS;
96    GfxSeparationColorSpace *sepCS;
97    int maxPixel, indexHigh;
98 +  int maxPixelForAlloc;
99    Guchar *lookup2;
100    Function *sepFunc;
101    Object obj;
102 @@ -3111,6 +3125,7 @@
103    // bits per component and color space
104    bits = bitsA;
105    maxPixel = (1 << bits) - 1;
106 +  maxPixelForAlloc = (1 << (bits>8?bits:8));
107    colorSpace = colorSpaceA;
108  
109    // get decode map
110 @@ -3163,7 +3178,7 @@
111      lookup2 = indexedCS->getLookup();
112      colorSpace2->getDefaultRanges(x, y, indexHigh);
113      for (k = 0; k < nComps2; ++k) {
114 -      lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
115 +      lookup[k] = (GfxColorComp *)gmallocn(maxPixelForAlloc + 1,
116                                            sizeof(GfxColorComp));
117        for (i = 0; i <= maxPixel; ++i) {
118         j = (int)(decodeLow[0] + (i * decodeRange[0]) / maxPixel + 0.5);
119 @@ -3182,7 +3197,7 @@
120      nComps2 = colorSpace2->getNComps();
121      sepFunc = sepCS->getFunc();
122      for (k = 0; k < nComps2; ++k) {
123 -      lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
124 +      lookup[k] = (GfxColorComp *)gmallocn(maxPixelForAlloc + 1,
125                                            sizeof(GfxColorComp));
126        for (i = 0; i <= maxPixel; ++i) {
127         x[0] = decodeLow[0] + (i * decodeRange[0]) / maxPixel;
128 @@ -3192,7 +3207,7 @@
129      }
130    } else {
131      for (k = 0; k < nComps; ++k) {
132 -      lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
133 +      lookup[k] = (GfxColorComp *)gmallocn(maxPixelForAlloc + 1,
134                                            sizeof(GfxColorComp));
135        for (i = 0; i <= maxPixel; ++i) {
136         lookup[k][i] = dblToCol(decodeLow[k] +
137 Index: GlobalParams.cc
138 ===================================================================
139 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/GlobalParams.cc,v
140 retrieving revision 1.4
141 retrieving revision 1.7
142 diff -u -r1.4 -r1.7
143 --- GlobalParams.cc     3 Dec 2005 10:11:33 -0000       1.4
144 +++ GlobalParams.cc     18 Dec 2005 08:31:22 -0000      1.7
145 @@ -498,6 +498,29 @@
146    char buf[512];
147    FILE *f2;
148  
149 +  /* extract path */
150 +  if(fileName) {
151 +    char* cfgFileName = fileName->getCString();
152 +    char* pos1 = strrchr(cfgFileName, '/');
153 +    char* pos2 = strrchr(cfgFileName, '\\');
154 +    char* p = pos1>pos2?pos1:pos2;
155 +    int pos = p ? p-cfgFileName : -1;
156 +    GString*path = new GString(new GString(cfgFileName), 0, (pos < 0 ? strlen(cfgFileName): pos));
157 +    if(pos1>=0)
158 +       path->append('/');
159 +    else if(pos2>=0)
160 +       path->append('\\');
161 +    else
162 +#ifdef WIN32
163 +       path->append('\\');
164 +#else
165 +       path->append('/');
166 +#endif
167 +    this->path = path;
168 +  } else {
169 +    this->path = new GString();
170 +  }
171 +  
172    line = 1;
173    while (getLine(buf, sizeof(buf) - 1, f)) {
174  
175 @@ -659,6 +682,32 @@
176    }
177  }
178  
179 +static GString* qualify_filename(GString*path, GString*filename)
180 +{
181 +  GString*fullpath = 0;
182 +  char*prefix = "/usr/local/share/xpdf/";
183 +
184 +  if (filename->getChar(0) != '\\' && filename->getChar(0) != '/') {
185 +    /* relative path */
186 +    fullpath = path->copy();
187 +    fullpath->append(filename);
188 +  } else if (!strncmp(filename->getCString(), prefix, strlen(prefix))) {
189 +    /* xpdf default path */
190 +    char*s = strchr(filename->getCString()+strlen(prefix), '/');
191 +    if(s) {
192 +       fullpath = path->copy();
193 +       fullpath->append(s+1);
194 +    } else {
195 +       fullpath = filename->copy();
196 +    }
197 +  } else {
198 +    /* absolute path */
199 +    fullpath = filename->copy();
200 +  }
201 +  //printf("%s -%s-> %s\n", filename->getCString(), path->getCString(), fullpath->getCString());
202 +  return fullpath;
203 +}
204 +
205  void GlobalParams::parseNameToUnicode(GList *tokens, GString *fileName,
206                                          int line) {
207    GString *name;
208 @@ -673,7 +722,7 @@
209           fileName->getCString(), line);
210      return;
211    }
212 -  name = (GString *)tokens->get(1);
213 +  name = qualify_filename(this->path, (GString *)tokens->get(1));
214    if (!(f = fopen(name->getCString(), "r"))) {
215      error(-1, "Couldn't open 'nameToUnicode' file '%s'",
216           name->getCString());
217 @@ -705,10 +754,12 @@
218    }
219    collection = (GString *)tokens->get(1);
220    name = (GString *)tokens->get(2);
221 +
222    if ((old = (GString *)cidToUnicodes->remove(collection))) {
223      delete old;
224    }
225 -  cidToUnicodes->add(collection->copy(), name->copy());
226 +
227 +  cidToUnicodes->add(collection->copy(), qualify_filename(this->path, name));
228  }
229  
230  void GlobalParams::parseUnicodeToUnicode(GList *tokens, GString *fileName,
231 @@ -725,7 +776,8 @@
232    if ((old = (GString *)unicodeToUnicodes->remove(font))) {
233      delete old;
234    }
235 -  unicodeToUnicodes->add(font->copy(), file->copy());
236 +
237 +  unicodeToUnicodes->add(font->copy(), qualify_filename(this->path, file));
238  }
239  
240  void GlobalParams::parseUnicodeMap(GList *tokens, GString *fileName,
241 @@ -742,7 +794,8 @@
242    if ((old = (GString *)unicodeMaps->remove(encodingName))) {
243      delete old;
244    }
245 -  unicodeMaps->add(encodingName->copy(), name->copy());
246 +
247 +  unicodeMaps->add(encodingName->copy(), qualify_filename(this->path, name));
248  }
249  
250  void GlobalParams::parseCMapDir(GList *tokens, GString *fileName, int line) {
251 @@ -760,23 +813,30 @@
252      list = new GList();
253      cMapDirs->add(collection->copy(), list);
254    }
255 -  list->append(dir->copy());
256 +
257 +  list->append(qualify_filename(this->path, dir));
258  }
259  
260  void GlobalParams::parseToUnicodeDir(GList *tokens, GString *fileName,
261                                      int line) {
262 +  GString *dir;
263 +
264    if (tokens->getLength() != 2) {
265      error(-1, "Bad 'toUnicodeDir' config file command (%s:%d)",
266           fileName->getCString(), line);
267      return;
268    }
269 -  toUnicodeDirs->append(((GString *)tokens->get(1))->copy());
270 +
271 +  dir = (GString *)tokens->get(1);
272 +
273 +  toUnicodeDirs->append(qualify_filename(this->path, dir));
274  }
275  
276  void GlobalParams::parseDisplayFont(GList *tokens, GHash *fontHash,
277                                     DisplayFontParamKind kind,
278                                     GString *fileName, int line) {
279    DisplayFontParam *param, *old;
280 +  GString *file;
281  
282    if (tokens->getLength() < 2) {
283      goto err1;
284 @@ -788,13 +848,15 @@
285      if (tokens->getLength() != 3) {
286        goto err2;
287      }
288 -    param->t1.fileName = ((GString *)tokens->get(2))->copy();
289 +    file = (GString *)tokens->get(2);
290 +    param->t1.fileName = qualify_filename(this->path, file);
291      break;
292    case displayFontTT:
293      if (tokens->getLength() != 3) {
294        goto err2;
295      }
296 -    param->tt.fileName = ((GString *)tokens->get(2))->copy();
297 +    file = (GString *)tokens->get(2);
298 +    param->tt.fileName = qualify_filename(this->path, file);
299      break;
300    }
301  
302 Index: Lexer.cc
303 ===================================================================
304 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/Lexer.cc,v
305 retrieving revision 1.4
306 retrieving revision 1.5
307 diff -u -r1.4 -r1.5
308 --- Lexer.cc    3 Dec 2005 10:11:33 -0000       1.4
309 +++ Lexer.cc    14 Mar 2006 12:43:23 -0000      1.5
310 @@ -74,6 +74,7 @@
311      curStr.streamReset();
312    }
313  }
314 +static int illegalChars = 0;
315  
316  Lexer::~Lexer() {
317    if (!curStr.isNone()) {
318 @@ -83,6 +84,9 @@
319    if (freeArray) {
320      delete streams;
321    }
322 +  if(illegalChars)
323 +      error(0, "Illegal characters in hex string (%d)", illegalChars);
324 +  illegalChars = 0;
325  }
326  
327  int Lexer::getChar() {
328 @@ -330,7 +334,8 @@
329         } else if (c2 >= 'a' && c2 <= 'f') {
330           c += c2 - 'a' + 10;
331         } else {
332 -         error(getPos(), "Illegal digit in hex char in name");
333 +         illegalChars++;
334 +         //error(getPos(), "Illegal digit in hex char in name");
335         }
336        }
337       notEscChar:
338 @@ -384,8 +389,10 @@
339             c2 += c - 'A' + 10;
340           else if (c >= 'a' && c <= 'f')
341             c2 += c - 'a' + 10;
342 -         else
343 -           error(getPos(), "Illegal character <%02x> in hex string", c);
344 +         else {
345 +           illegalChars++;
346 +           //error(getPos(), "Illegal character <%02x> in hex string", c);
347 +         }
348           if (++m == 2) {
349             if (n == tokBufSize) {
350               if (!s)
351 @@ -421,7 +428,8 @@
352        tokBuf[2] = '\0';
353        obj->initCmd(tokBuf);
354      } else {
355 -      error(getPos(), "Illegal character '>'");
356 +      illegalChars++;
357 +      //error(getPos(), "Illegal character '>'");
358        obj->initError();
359      }
360      break;
361 @@ -430,7 +438,8 @@
362    case ')':
363    case '{':
364    case '}':
365 -    error(getPos(), "Illegal character '%c'", c);
366 +    //error(getPos(), "Illegal character '%c'", c);
367 +    illegalChars++;
368      obj->initError();
369      break;
370  
371 @@ -459,7 +468,6 @@
372      }
373      break;
374    }
375 -
376    return obj;
377  }
378  
379 Index: Link.cc
380 ===================================================================
381 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/Link.cc,v
382 retrieving revision 1.5
383 retrieving revision 1.6
384 diff -u -r1.5 -r1.6
385 --- Link.cc     3 Dec 2005 10:11:33 -0000       1.5
386 +++ Link.cc     26 Mar 2006 08:26:59 -0000      1.6
387 @@ -430,10 +430,9 @@
388        delete dest;
389        dest = NULL;
390      }
391 -
392    // error
393    } else {
394 -    error(-1, "Illegal annotation destination");
395 +    error(-1, "Illegal annotation destination %d", destObj->getType());
396    }
397  }
398  
399 @@ -468,10 +467,9 @@
400        delete dest;
401        dest = NULL;
402      }
403 -
404    // error
405    } else {
406 -    error(-1, "Illegal annotation destination");
407 +    error(-1, "Illegal annotation destination %d", destObj->getType());
408    }
409  }
410  
411 Index: OutputDev.h
412 ===================================================================
413 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/OutputDev.h,v
414 retrieving revision 1.7
415 retrieving revision 1.9
416 diff -u -r1.7 -r1.9
417 --- OutputDev.h 3 Dec 2005 10:11:33 -0000       1.7
418 +++ OutputDev.h 3 Dec 2005 10:31:47 -0000       1.9
419 @@ -74,7 +74,7 @@
420    virtual void setDefaultCTM(double *ctm);
421  
422    // Start a page.
423 -  virtual void startPage(int pageNum, GfxState *state) {}
424 +  virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) {}
425  
426    // End a page.
427    virtual void endPage() {}
428 Index: Stream.cc
429 ===================================================================
430 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/Stream.cc,v
431 retrieving revision 1.7
432 retrieving revision 1.8
433 diff -u -r1.7 -r1.8
434 --- Stream.cc   3 Dec 2005 10:11:33 -0000       1.7
435 +++ Stream.cc   3 Dec 2005 10:30:41 -0000       1.8
436 @@ -17,6 +17,8 @@
437  #include <stddef.h>
438  #ifndef WIN32
439  #include <unistd.h>
440 +#else
441 +extern "C" int unlink(char *filename);
442  #endif
443  #include <string.h>
444  #include <ctype.h>
445 Index: config.h
446 --- config.h.orig       2007-09-09 12:11:20.000000000 +0200
447 +++ config.h    2007-09-09 12:11:40.000000000 +0200
448 @@ -53,9 +53,9 @@
449  
450  // user config file name, relative to the user's home directory
451  #if defined(VMS) || defined(WIN32)
452 -#define xpdfUserConfigFile "xpdfrc"
453 +#define xpdfUserConfigFile "pdf2swf.conf"
454  #else
455 -#define xpdfUserConfigFile ".xpdfrc"
456 +#define xpdfUserConfigFile ".pdf2swf.conf"
457  #endif
458  
459  // system config file name (set via the configure script)
460 @@ -64,7 +64,7 @@
461  #else
462  // under Windows, we get the directory with the executable and then
463  // append this file name
464 -#define xpdfSysConfigFile "xpdfrc"
465 +#define xpdfSysConfigFile "pdf2swf.conf"
466  #endif
467  
468  //------------------------------------------------------------------------
469 Index: gfile.cc
470 ===================================================================
471 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/gfile.cc,v
472 retrieving revision 1.12
473 retrieving revision 1.13
474 diff -u -r1.12 -r1.13
475 --- gfile.cc    3 Dec 2005 10:11:33 -0000       1.12
476 +++ gfile.cc    3 Dec 2005 10:30:41 -0000       1.13
477 @@ -437,6 +437,52 @@
478  #endif
479  }
480  
481 +static char* getTempDir()
482 +{
483 +#ifdef WIN32
484 +    char*dir = getenv("TMP");
485 +    if(!dir) dir = getenv("TEMP");
486 +    if(!dir) dir = getenv("tmp");
487 +    if(!dir) dir = getenv("temp");
488 +    if(!dir) dir = "C:\\";
489 +#else
490 +    char* dir = "/tmp/";
491 +#endif
492 +    return dir;
493 +}
494 +
495 +char* mktmpname(char*ptr) {
496 +    static char tmpbuf[128];
497 +    char*dir = getTempDir();
498 +    int l = strlen(dir);
499 +    char*sep = "";
500 +    if(!ptr)
501 +       ptr = tmpbuf;
502 +    if(l && dir[l-1]!='/' && dir[l-1]!='\\') {
503 +#ifdef WIN32
504 +       sep = "\\";
505 +#else
506 +       sep = "/";
507 +#endif
508 +    }
509 +
510 + //   used to be mktemp. This does remove the warnings, but
511 + //   It's not exactly an improvement.
512 +#ifdef HAVE_LRAND48
513 +    sprintf(ptr, "%s%s%08x%08x",dir,sep,lrand48(),lrand48());
514 +#else
515 +#   ifdef HAVE_RAND
516 +       sprintf(ptr, "%s%s%08x%08x",dir,sep,rand(),rand());
517 +#   else
518 +       static int count = 1;
519 +       sprintf(ptr, "%s%s%08x%04x%04x",dir,sep,time(0),(unsigned int)tmpbuf^((unsigned int)tmpbuf)>>16,count);
520 +       count ++;
521 +#   endif
522 +#endif
523 +     return ptr;
524 +}
525 +
526 +
527  GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) {
528  #if defined(WIN32)
529    //---------- Win32 ----------
530 @@ -463,7 +509,7 @@
531    // with this file name after the tmpnam call and before the fopen
532    // call.  I will happily accept fixes to this function for non-Unix
533    // OSs.
534 -  if (!(s = tmpnam(NULL))) {
535 +  if (!(s = mktmpname(NULL))) {
536      return gFalse;
537    }
538    *name = new GString(s);
539 @@ -490,7 +536,7 @@
540      (*name)->append("/XXXXXX")->append(ext);
541      fd = mkstemps((*name)->getCString(), strlen(ext));
542  #else
543 -    if (!(s = tmpnam(NULL))) {
544 +    if (!(s = mktmpname(NULL))) {
545        return gFalse;
546      }
547      *name = new GString(s);
548 @@ -507,7 +553,7 @@
549      (*name)->append("/XXXXXX");
550      fd = mkstemp((*name)->getCString());
551  #else // HAVE_MKSTEMP
552 -    if (!(s = tmpnam(NULL))) {
553 +    if (!(s = mktmpname(NULL))) {
554        return gFalse;
555      }
556      *name = new GString(s);
557 Index: gfile.h
558 ===================================================================
559 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/gfile.h,v
560 retrieving revision 1.9
561 retrieving revision 1.10
562 diff -u -r1.9 -r1.10
563 --- gfile.h     3 Dec 2005 10:11:33 -0000       1.9
564 +++ gfile.h     3 Dec 2005 10:30:41 -0000       1.10
565 @@ -58,6 +58,9 @@
566  // Get current directory.
567  extern GString *getCurrentDir();
568  
569 +/* create a temporary filename */
570 +char* mktmpname(char*ptr);
571 +
572  // Append a file name to a path string.  <path> may be an empty
573  // string, denoting the current directory).  Returns <path>.
574  extern GString *appendToPath(GString *path, char *fileName);
575 Index: GlobalParams.h
576 ===================================================================
577 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/GlobalParams.h,v
578 retrieving revision 1.5
579 retrieving revision 1.6
580 diff -u -r1.5 -r1.6
581 --- GlobalParams.h      2006-10-10 19:54:29.000000000 +0200
582 +++ GlobalParams.h      2006-11-12 11:19:40.000000000 +0100
583 @@ -218,1 +218,1 @@
584 -  void parseFile(GString *fileName, FILE *f);
585 +public: void parseFile(GString *fileName, FILE *f); private:
586 @@ -246,6 +246,10 @@
587    GBool loadPlugin(char *type, char *name);
588  #endif
589  
590 +  //----- config file base path
591 +
592 +  GString*path;
593 +
594    //----- static tables
595  
596    NameToCharCode *             // mapping from char name to
597 --- SplashOutputDev.h.orig      2006-11-12 12:07:22.000000000 +0100
598 +++ SplashOutputDev.h   2006-11-12 12:08:48.000000000 +0100
599 @@ -70,7 +70,7 @@
600    //----- initialization and control
601  
602    // Start a page.
603 -  virtual void startPage(int pageNum, GfxState *state);
604 +  virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2);
605  
606    // End a page.
607    virtual void endPage();
608 --- SplashOutputDev.cc.orig     2006-11-12 12:07:06.000000000 +0100
609 +++ SplashOutputDev.cc  2006-11-12 12:09:36.000000000 +0100
610 @@ -696,7 +696,7 @@
611    nT3Fonts = 0;
612  }
613  
614 -void SplashOutputDev::startPage(int pageNum, GfxState *state) {
615 +void SplashOutputDev::startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) {
616    int w, h;
617    double *ctm;
618    SplashCoord mat[6];
619 --- TextOutputDev.h.orig        2006-11-12 12:23:01.000000000 +0100
620 +++ TextOutputDev.h     2006-11-12 12:25:31.000000000 +0100
621 @@ -578,7 +578,7 @@
622    //----- initialization and control
623  
624    // Start a page.
625 -  virtual void startPage(int pageNum, GfxState *state);
626 +  virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2);
627  
628    // End a page.
629    virtual void endPage();
630 --- TextOutputDev.cc.orig       2006-11-12 12:22:53.000000000 +0100
631 +++ TextOutputDev.cc    2006-11-12 12:25:03.000000000 +0100
632 @@ -3805,7 +3805,7 @@
633    }
634  }
635  
636 -void TextOutputDev::startPage(int pageNum, GfxState *state) {
637 +void TextOutputDev::startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) {
638    text->startPage(state);
639  }
640  
641 --- CoreOutputDev.cc.orig       2006-11-12 12:21:59.000000000 +0100
642 +++ CoreOutputDev.cc    2006-11-12 12:23:29.000000000 +0100
643 @@ -57,5 +57,5 @@
644  
645  void CoreOutputDev::clear() {
646    startDoc(NULL);
647 -  startPage(0, NULL);
648 +  startPage(0, NULL, 0,0,0,0);
649  }
650 --- SplashFTFontEngine.cc       2006-11-19 22:30:44.000000000 +0100
651 +++ SplashFTFontEngine.cc       2006-11-19 22:30:56.000000000 +0100
652 @@ -13,9 +13,7 @@
653  #endif
654  
655  #include <stdio.h>
656 -#ifndef WIN32
657  #  include <unistd.h>
658 -#endif
659  #include "gmem.h"
660  #include "GString.h"
661  #include "gfile.h"