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
7 --- Gfx.cc 3 Dec 2005 10:11:33 -0000 1.9
8 +++ Gfx.cc 3 Dec 2005 10:30:41 -0000 1.10
13 - out->startPage(pageNum, state);
15 + out->startPage(pageNum, state, cropBox->x1,cropBox->y1,cropBox->x2,cropBox->y2);
17 + out->startPage(pageNum, state, 0,0,0,0);
19 out->setDefaultCTM(state->getCTM());
20 out->updateAll(state);
21 for (i = 0; i < 6; ++i) {
23 abortCheckCbkData = abortCheckCbkDataA;
29 state->moveTo(cropBox->x1, cropBox->y1);
30 state->lineTo(cropBox->x2, cropBox->y1);
31 state->lineTo(cropBox->x2, cropBox->y2);
41 Gfx::Gfx(XRef *xrefA, OutputDev *outA, Dict *resDict,
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
48 --- GfxFont.h 3 Dec 2005 10:11:33 -0000 1.6
49 +++ GfxFont.h 3 Dec 2005 10:30:41 -0000 1.7
51 CharCodeToUnicode *getToUnicode();
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]; }
57 // Returns true if the PDF font specified an encoding.
58 GBool getHasEncoding() { return hasEncoding; }
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
65 --- GfxState.cc 3 Dec 2005 10:11:33 -0000 1.10
66 +++ GfxState.cc 3 Dec 2005 12:41:32 -0000 1.12
73 //------------------------------------------------------------------------
76 - 0.11 * color->c[2] + 0.5));
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);
91 void GfxDeviceCMYKColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) {
92 double c, m, y, k, c1, m1, y1, k1, r, g, b, x;
95 GfxIndexedColorSpace *indexedCS;
96 GfxSeparationColorSpace *sepCS;
97 int maxPixel, indexHigh;
98 + int maxPixelForAlloc;
102 @@ -3111,6 +3125,7 @@
103 // bits per component and color space
105 maxPixel = (1 << bits) - 1;
106 + maxPixelForAlloc = (1 << (bits>8?bits:8));
107 colorSpace = colorSpaceA;
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 @@
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
143 --- GlobalParams.cc 3 Dec 2005 10:11:33 -0000 1.4
144 +++ GlobalParams.cc 18 Dec 2005 08:31:22 -0000 1.7
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));
160 + path->append('\\');
163 + path->append('\\');
169 + this->path = new GString();
173 while (getLine(buf, sizeof(buf) - 1, f)) {
179 +static GString* qualify_filename(GString*path, GString*filename)
181 + GString*fullpath = 0;
182 + char*prefix = "/usr/local/share/xpdf/";
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), '/');
192 + fullpath = path->copy();
193 + fullpath->append(s+1);
195 + fullpath = filename->copy();
198 + /* absolute path */
199 + fullpath = filename->copy();
201 + //printf("%s -%s-> %s\n", filename->getCString(), path->getCString(), fullpath->getCString());
205 void GlobalParams::parseNameToUnicode(GList *tokens, GString *fileName,
209 fileName->getCString(), line);
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'",
217 @@ -705,10 +754,12 @@
219 collection = (GString *)tokens->get(1);
220 name = (GString *)tokens->get(2);
222 if ((old = (GString *)cidToUnicodes->remove(collection))) {
225 - cidToUnicodes->add(collection->copy(), name->copy());
227 + cidToUnicodes->add(collection->copy(), qualify_filename(this->path, name));
230 void GlobalParams::parseUnicodeToUnicode(GList *tokens, GString *fileName,
232 if ((old = (GString *)unicodeToUnicodes->remove(font))) {
235 - unicodeToUnicodes->add(font->copy(), file->copy());
237 + unicodeToUnicodes->add(font->copy(), qualify_filename(this->path, file));
240 void GlobalParams::parseUnicodeMap(GList *tokens, GString *fileName,
242 if ((old = (GString *)unicodeMaps->remove(encodingName))) {
245 - unicodeMaps->add(encodingName->copy(), name->copy());
247 + unicodeMaps->add(encodingName->copy(), qualify_filename(this->path, name));
250 void GlobalParams::parseCMapDir(GList *tokens, GString *fileName, int line) {
251 @@ -760,23 +813,30 @@
253 cMapDirs->add(collection->copy(), list);
255 - list->append(dir->copy());
257 + list->append(qualify_filename(this->path, dir));
260 void GlobalParams::parseToUnicodeDir(GList *tokens, GString *fileName,
264 if (tokens->getLength() != 2) {
265 error(-1, "Bad 'toUnicodeDir' config file command (%s:%d)",
266 fileName->getCString(), line);
269 - toUnicodeDirs->append(((GString *)tokens->get(1))->copy());
271 + dir = (GString *)tokens->get(1);
273 + toUnicodeDirs->append(qualify_filename(this->path, dir));
276 void GlobalParams::parseDisplayFont(GList *tokens, GHash *fontHash,
277 DisplayFontParamKind kind,
278 GString *fileName, int line) {
279 DisplayFontParam *param, *old;
282 if (tokens->getLength() < 2) {
284 @@ -788,13 +848,15 @@
285 if (tokens->getLength() != 3) {
288 - param->t1.fileName = ((GString *)tokens->get(2))->copy();
289 + file = (GString *)tokens->get(2);
290 + param->t1.fileName = qualify_filename(this->path, file);
293 if (tokens->getLength() != 3) {
296 - param->tt.fileName = ((GString *)tokens->get(2))->copy();
297 + file = (GString *)tokens->get(2);
298 + param->tt.fileName = qualify_filename(this->path, file);
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
308 --- Lexer.cc 3 Dec 2005 10:11:33 -0000 1.4
309 +++ Lexer.cc 14 Mar 2006 12:43:23 -0000 1.5
311 curStr.streamReset();
314 +static int illegalChars = 0;
317 if (!curStr.isNone()) {
323 + error(0, "Illegal characters in hex string (%d)", illegalChars);
327 int Lexer::getChar() {
329 } else if (c2 >= 'a' && c2 <= 'f') {
332 - error(getPos(), "Illegal digit in hex char in name");
334 + //error(getPos(), "Illegal digit in hex char in name");
340 else if (c >= 'a' && c <= 'f')
343 - error(getPos(), "Illegal character <%02x> in hex string", c);
346 + //error(getPos(), "Illegal character <%02x> in hex string", c);
349 if (n == tokBufSize) {
353 obj->initCmd(tokBuf);
355 - error(getPos(), "Illegal character '>'");
357 + //error(getPos(), "Illegal character '>'");
365 - error(getPos(), "Illegal character '%c'", c);
366 + //error(getPos(), "Illegal character '%c'", c);
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
385 --- Link.cc 3 Dec 2005 10:11:33 -0000 1.5
386 +++ Link.cc 26 Mar 2006 08:26:59 -0000 1.6
394 - error(-1, "Illegal annotation destination");
395 + error(-1, "Illegal annotation destination %d", destObj->getType());
406 - error(-1, "Illegal annotation destination");
407 + error(-1, "Illegal annotation destination %d", destObj->getType());
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
417 --- OutputDev.h 3 Dec 2005 10:11:33 -0000 1.7
418 +++ OutputDev.h 3 Dec 2005 10:31:47 -0000 1.9
420 virtual void setDefaultCTM(double *ctm);
423 - virtual void startPage(int pageNum, GfxState *state) {}
424 + virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) {}
427 virtual void endPage() {}
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
434 --- Stream.cc 3 Dec 2005 10:11:33 -0000 1.7
435 +++ Stream.cc 3 Dec 2005 10:30:41 -0000 1.8
441 +extern "C" int unlink(char *filename);
446 ===================================================================
447 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/config.h,v
448 retrieving revision 1.5
449 retrieving revision 1.6
451 --- config.h 3 Dec 2005 10:11:33 -0000 1.5
452 +++ config.h 3 Dec 2005 10:30:41 -0000 1.6
455 // user config file name, relative to the user's home directory
456 #if defined(VMS) || (defined(WIN32) && !defined(__CYGWIN32__))
457 -#define xpdfUserConfigFile "xpdfrc"
458 +#define xpdfUserConfigFile "pdf2swf.conf"
460 -#define xpdfUserConfigFile ".xpdfrc"
461 +#define xpdfUserConfigFile ".pdf2swf.conf"
464 // system config file name (set via the configure script)
465 -#ifdef SYSTEM_XPDFRC
466 -#define xpdfSysConfigFile SYSTEM_XPDFRC
468 +#define xpdfSysConfigFile "/etc/pdf2swf.conf"
470 // under Windows, we get the directory with the executable and then
471 // append this file name
472 -#define xpdfSysConfigFile "xpdfrc"
473 +#define xpdfSysConfigFile "pdf2swf.conf"
476 //------------------------------------------------------------------------
478 ===================================================================
479 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/gfile.cc,v
480 retrieving revision 1.12
481 retrieving revision 1.13
482 diff -u -r1.12 -r1.13
483 --- gfile.cc 3 Dec 2005 10:11:33 -0000 1.12
484 +++ gfile.cc 3 Dec 2005 10:30:41 -0000 1.13
489 +static char* getTempDir()
492 + char*dir = getenv("TMP");
493 + if(!dir) dir = getenv("TEMP");
494 + if(!dir) dir = getenv("tmp");
495 + if(!dir) dir = getenv("temp");
496 + if(!dir) dir = "C:\\";
498 + char* dir = "/tmp/";
503 +char* mktmpname(char*ptr) {
504 + static char tmpbuf[128];
505 + char*dir = getTempDir();
506 + int l = strlen(dir);
510 + if(l && dir[l-1]!='/' && dir[l-1]!='\\') {
518 + // used to be mktemp. This does remove the warnings, but
519 + // It's not exactly an improvement.
521 + sprintf(ptr, "%s%s%08x%08x",dir,sep,lrand48(),lrand48());
524 + sprintf(ptr, "%s%s%08x%08x",dir,sep,rand(),rand());
526 + static int count = 1;
527 + sprintf(ptr, "%s%s%08x%04x%04x",dir,sep,time(0),(unsigned int)tmpbuf^((unsigned int)tmpbuf)>>16,count);
535 GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) {
537 //---------- Win32 ----------
539 // with this file name after the tmpnam call and before the fopen
540 // call. I will happily accept fixes to this function for non-Unix
542 - if (!(s = tmpnam(NULL))) {
543 + if (!(s = mktmpname(NULL))) {
546 *name = new GString(s);
548 (*name)->append("/XXXXXX")->append(ext);
549 fd = mkstemps((*name)->getCString(), strlen(ext));
551 - if (!(s = tmpnam(NULL))) {
552 + if (!(s = mktmpname(NULL))) {
555 *name = new GString(s);
557 (*name)->append("/XXXXXX");
558 fd = mkstemp((*name)->getCString());
559 #else // HAVE_MKSTEMP
560 - if (!(s = tmpnam(NULL))) {
561 + if (!(s = mktmpname(NULL))) {
564 *name = new GString(s);
566 ===================================================================
567 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/gfile.h,v
568 retrieving revision 1.9
569 retrieving revision 1.10
571 --- gfile.h 3 Dec 2005 10:11:33 -0000 1.9
572 +++ gfile.h 3 Dec 2005 10:30:41 -0000 1.10
574 // Get current directory.
575 extern GString *getCurrentDir();
577 +/* create a temporary filename */
578 +char* mktmpname(char*ptr);
580 // Append a file name to a path string. <path> may be an empty
581 // string, denoting the current directory). Returns <path>.
582 extern GString *appendToPath(GString *path, char *fileName);
583 Index: GlobalParams.h
584 ===================================================================
585 RCS file: /home/kramm/cvs/swftools.cache.cvsroot/swftools.cache/pdf2swf/xpdf/GlobalParams.h,v
586 retrieving revision 1.5
587 retrieving revision 1.6
589 --- GlobalParams.h 2006-10-10 19:54:29.000000000 +0200
590 +++ GlobalParams.h 2006-11-12 11:19:40.000000000 +0100
592 - void parseFile(GString *fileName, FILE *f);
593 +public: void parseFile(GString *fileName, FILE *f); private:
595 GBool loadPlugin(char *type, char *name);
598 + //----- config file base path
602 //----- static tables
604 NameToCharCode * // mapping from char name to
605 --- SplashOutputDev.h.orig 2006-11-12 12:07:22.000000000 +0100
606 +++ SplashOutputDev.h 2006-11-12 12:08:48.000000000 +0100
608 //----- initialization and control
611 - virtual void startPage(int pageNum, GfxState *state);
612 + virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2);
615 virtual void endPage();
616 --- SplashOutputDev.cc.orig 2006-11-12 12:07:06.000000000 +0100
617 +++ SplashOutputDev.cc 2006-11-12 12:09:36.000000000 +0100
622 -void SplashOutputDev::startPage(int pageNum, GfxState *state) {
623 +void SplashOutputDev::startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) {
627 --- TextOutputDev.h.orig 2006-11-12 12:23:01.000000000 +0100
628 +++ TextOutputDev.h 2006-11-12 12:25:31.000000000 +0100
630 //----- initialization and control
633 - virtual void startPage(int pageNum, GfxState *state);
634 + virtual void startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2);
637 virtual void endPage();
638 --- TextOutputDev.cc.orig 2006-11-12 12:22:53.000000000 +0100
639 +++ TextOutputDev.cc 2006-11-12 12:25:03.000000000 +0100
640 @@ -3805,7 +3805,7 @@
644 -void TextOutputDev::startPage(int pageNum, GfxState *state) {
645 +void TextOutputDev::startPage(int pageNum, GfxState *state, double x1,double y1,double x2,double y2) {
646 text->startPage(state);
649 --- CoreOutputDev.cc.orig 2006-11-12 12:21:59.000000000 +0100
650 +++ CoreOutputDev.cc 2006-11-12 12:23:29.000000000 +0100
653 void CoreOutputDev::clear() {
655 - startPage(0, NULL);
656 + startPage(0, NULL, 0,0,0,0);
658 --- SplashFTFontEngine.cc 2006-11-19 22:30:44.000000000 +0100
659 +++ SplashFTFontEngine.cc 2006-11-19 22:30:56.000000000 +0100