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