Commit ff7ebdd2 authored by Claudio Valerio's avatar Claudio Valerio

Works on windows

parent d39e0098
......@@ -7,8 +7,9 @@ instructions for version 3.02
- Decompress xpdf-3.02.xx.tar.gz
Windows:
- Copy aconf-win32.h to aconf.h
- undefine unicode API support by adding '#undef UNICODE' aconf.h
- using cywin run ./configure
- run qmake xpdf.pro -r -spec win32-g++
- run make
OSX:
- run ./configure (may need extrea options ?)
......
/* aconf.h. Generated by configure. */
/*
* aconf.h
*
* Copyright 2002-2003 Glyph & Cog, LLC
*/
#ifndef ACONF_H
#define ACONF_H
#include <aconf2.h>
/*
* Use A4 paper size instead of Letter for PostScript output.
*/
/* #undef A4_PAPER */
/*
* Do not allow text selection.
*/
/* #undef NO_TEXT_SELECT */
/*
* Include support for OPI comments.
*/
/* #undef OPI_SUPPORT */
/*
* Enable multithreading support.
*/
/* #undef MULTITHREADED */
/*
* Enable C++ exceptions.
*/
/* #undef USE_EXCEPTIONS */
/*
* Enable word list support.
*/
/* #undef TEXTOUT_WORD_LIST */
/*
* Use fixed point (instead of floating point) arithmetic.
*/
/* #undef USE_FIXEDPOINT */
/*
* Directory with the Xpdf app-defaults file.
*/
/* #undef APPDEFDIR */
/*
* Full path for the system-wide xpdfrc file.
*/
#define SYSTEM_XPDFRC "/usr/local/etc/xpdfrc"
/*
* Various include files and functions.
*/
#define HAVE_DIRENT_H 1
/* #undef HAVE_SYS_NDIR_H */
/* #undef HAVE_SYS_DIR_H */
/* #undef HAVE_NDIR_H */
/* #undef HAVE_SYS_SELECT_H */
/* #undef HAVE_SYS_BSDTYPES_H */
#define HAVE_STRINGS_H 1
/* #undef HAVE_BSTRING_H */
#define HAVE_POPEN 1
#define HAVE_MKSTEMP 1
#define HAVE_MKSTEMPS 1
/* #undef SELECT_TAKES_INT */
#define HAVE_FSEEKO 1
/* #undef HAVE_FSEEK64 */
#define _FILE_OFFSET_BITS 64
/* #undef _LARGE_FILES */
/* #undef _LARGEFILE_SOURCE */
#define HAVE_XTAPPSETEXITFLAG 1
/*
* This is defined if using libXpm.
*/
#define HAVE_X11_XPM_H 1
/*
* This is defined if using t1lib.
*/
/* #undef HAVE_T1LIB_H */
/*
* One of these is defined if using FreeType 2.
*/
/* #undef HAVE_FREETYPE_H */
/* #undef HAVE_FREETYPE_FREETYPE_H */
/*
* This is defined if using libpaper.
*/
/* #undef HAVE_PAPER_H */
/*
* Enable support for loading plugins.
*/
/* #undef ENABLE_PLUGINS */
/*
* Defined if the Splash library is avaiable.
*/
/* #undef HAVE_SPLASH */
/*
* Enable support for CMYK output.
*/
/* #undef SPLASH_CMYK */
#endif
This diff is collapsed.
......@@ -224,7 +224,7 @@ void FoFiType1::parse() {
code = code * 8 + (*p2 - '0');
}
}
if (code >= 0 && code < 256) {
if (code < 256) {
for (p = p2; *p == ' ' || *p == '\t'; ++p) ;
if (*p == '/') {
++p;
......
......@@ -118,7 +118,7 @@ GString *appendToPath(GString *path, char *fileName) {
if (*p1 == ']') {
for (p2 = p1; p2 > p0 && *p2 != '.' && *p2 != '['; --p2) ;
if (*p2 == '[')
++p2;
++p2;
path->del(p2 - p0, p1 - p2);
} else if (*p1 == ':') {
path->append("[-]");
......@@ -206,21 +206,21 @@ GString *appendToPath(GString *path, char *fileName) {
if (!strcmp(fileName, "..")) {
for (i = path->getLength() - 2; i >= 0; --i) {
if (path->getChar(i) == '/' || path->getChar(i) == '\\' ||
path->getChar(i) == ':')
break;
path->getChar(i) == ':')
break;
}
if (i <= 0) {
if (path->getChar(0) == '/' || path->getChar(0) == '\\') {
path->del(1, path->getLength() - 1);
path->del(1, path->getLength() - 1);
} else if (path->getLength() >= 2 && path->getChar(1) == ':') {
path->del(2, path->getLength() - 2);
path->del(2, path->getLength() - 2);
} else {
path->clear();
path->append("..");
path->clear();
path->append("..");
}
} else {
if (path->getChar(i-1) == ':')
++i;
++i;
path->del(i, path->getLength() - i);
}
return path;
......@@ -246,14 +246,14 @@ GString *appendToPath(GString *path, char *fileName) {
if (!strcmp(fileName, "..")) {
for (i = path->getLength() - 2; i >= 0; --i) {
if (path->getChar(i) == '/')
break;
break;
}
if (i <= 0) {
if (path->getChar(0) == '/') {
path->del(1, path->getLength() - 1);
path->del(1, path->getLength() - 1);
} else {
path->clear();
path->append("..");
path->clear();
path->append("..");
}
} else {
path->del(i, path->getLength() - i);
......@@ -323,7 +323,7 @@ GBool isAbsolutePath(char *path) {
#ifdef VMS
//---------- VMS ----------
return strchr(path, ':') ||
(path[0] == '[' && path[1] != '.' && path[1] != '-');
(path[0] == '[' && path[1] != '.' && path[1] != '-');
#elif defined(__EMX__) || defined(WIN32)
//---------- OS/2+EMX and Win32 ----------
......@@ -390,9 +390,9 @@ GString *makePathAbsolute(GString *path) {
if (path->getChar(0) == '~') {
if (path->getChar(1) == '/' ||
#ifdef __EMX__
path->getChar(1) == '\\' ||
path->getChar(1) == '\\' ||
#endif
path->getLength() == 1) {
path->getLength() == 1) {
path->del(0, 1);
s = getHomeDir();
path->insert(0, s);
......@@ -405,12 +405,12 @@ GString *makePathAbsolute(GString *path) {
for (p2 = p1; *p2 && *p2 != '/'; ++p2) ;
#endif
if ((n = p2 - p1) > PATH_MAX)
n = PATH_MAX;
n = PATH_MAX;
strncpy(buf, p1, n);
buf[n] = '\0';
if ((pw = getpwnam(buf))) {
path->del(0, p2 - p1 + 1);
path->insert(0, pw->pw_dir);
path->del(0, p2 - p1 + 1);
path->insert(0, pw->pw_dir);
}
}
} else if (!isAbsolutePath(path->getCString())) {
......@@ -467,9 +467,9 @@ GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) {
}
if (!(f2 = fopen(s2->getCString(), "r"))) {
if (!(f2 = fopen(s2->getCString(), mode))) {
delete s2;
delete s;
return gFalse;
delete s2;
delete s;
return gFalse;
}
*name = s2;
*f = f2;
......@@ -571,9 +571,9 @@ char *getLine(char *buf, int size, FILE *f) {
if (c == '\x0d') {
c = fgetc(f);
if (c == '\x0a' && i < size - 1) {
buf[i++] = (char)c;
buf[i++] = (char)c;
} else if (c != EOF) {
ungetc(c, f);
ungetc(c, f);
}
break;
}
......@@ -606,7 +606,7 @@ GDirEntry::GDirEntry(char *dirPath, char *nameA, GBool doStat) {
if (doStat) {
#ifdef VMS
if (!strcmp(nameA, "-") ||
((p = strrchr(nameA, '.')) && !strncmp(p, ".DIR;", 5)))
((p = strrchr(nameA, '.')) && !strncmp(p, ".DIR;", 5)))
dir = gTrue;
#elif defined(ACORN)
#else
......
......@@ -55,15 +55,7 @@ void *gmalloc(int size) GMEM_EXCEP {
void *data;
unsigned long *trl, *p;
if (size < 0) {
#if USE_EXCEPTIONS
throw GMemException();
#else
fprintf(stderr, "Invalid memory allocation size\n");
exit(1);
#endif
}
if (size == 0) {
if (size <= 0) {
return NULL;
}
size1 = gMemDataSize(size);
......@@ -99,15 +91,7 @@ void *gmalloc(int size) GMEM_EXCEP {
#else
void *p;
if (size < 0) {
#if USE_EXCEPTIONS
throw GMemException();
#else
fprintf(stderr, "Invalid memory allocation size\n");
exit(1);
#endif
}
if (size == 0) {
if (size <= 0) {
return NULL;
}
if (!(p = malloc(size))) {
......@@ -128,15 +112,7 @@ void *grealloc(void *p, int size) GMEM_EXCEP {
void *q;
int oldSize;
if (size < 0) {
#if USE_EXCEPTIONS
throw GMemException();
#else
fprintf(stderr, "Invalid memory allocation size\n");
exit(1);
#endif
}
if (size == 0) {
if (size <= 0) {
if (p) {
gfree(p);
}
......@@ -155,15 +131,7 @@ void *grealloc(void *p, int size) GMEM_EXCEP {
#else
void *q;
if (size < 0) {
#if USE_EXCEPTIONS
throw GMemException();
#else
fprintf(stderr, "Invalid memory allocation size\n");
exit(1);
#endif
}
if (size == 0) {
if (size <= 0) {
if (p) {
free(p);
}
......
......@@ -12,7 +12,6 @@
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include "gmem.h"
#include "SplashErrorCodes.h"
#include "SplashMath.h"
......@@ -1913,10 +1912,7 @@ SplashError Splash::fillImageMask(SplashImageMaskSource src, void *srcData,
xq = w % scaledWidth;
// allocate pixel buffer
if (yp < 0 || yp > INT_MAX - 1) {
return splashErrBadArg;
}
pixBuf = (SplashColorPtr)gmallocn(yp + 1, w);
pixBuf = (SplashColorPtr)gmalloc((yp + 1) * w);
// initialize the pixel pipe
pipeInit(&pipe, 0, 0, state->fillPattern, NULL, state->fillAlpha,
......@@ -2212,12 +2208,9 @@ SplashError Splash::drawImage(SplashImageSource src, void *srcData,
xq = w % scaledWidth;
// allocate pixel buffers
if (yp < 0 || yp > INT_MAX - 1 || w > INT_MAX / nComps) {
return splashErrBadArg;
}
colorBuf = (SplashColorPtr)gmallocn(yp + 1, w * nComps);
colorBuf = (SplashColorPtr)gmalloc((yp + 1) * w * nComps);
if (srcAlpha) {
alphaBuf = (Guchar *)gmallocn(yp + 1, w);
alphaBuf = (Guchar *)gmalloc((yp + 1) * w);
} else {
alphaBuf = NULL;
}
......
......@@ -11,7 +11,6 @@
#endif
#include <stdio.h>
#include <limits.h>
#include "gmem.h"
#include "SplashErrorCodes.h"
#include "SplashBitmap.h"
......@@ -28,48 +27,30 @@ SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPad,
mode = modeA;
switch (mode) {
case splashModeMono1:
if (width > 0) {
rowSize = (width + 7) >> 3;
} else {
rowSize = -1;
}
rowSize = (width + 7) >> 3;
break;
case splashModeMono8:
if (width > 0) {
rowSize = width;
} else {
rowSize = -1;
}
rowSize = width;
break;
case splashModeRGB8:
case splashModeBGR8:
if (width > 0 && width <= INT_MAX / 3) {
rowSize = width * 3;
} else {
rowSize = -1;
}
rowSize = width * 3;
break;
#if SPLASH_CMYK
case splashModeCMYK8:
if (width > 0 && width <= INT_MAX / 4) {
rowSize = width * 4;
} else {
rowSize = -1;
}
rowSize = width * 4;
break;
#endif
}
if (rowSize > 0) {
rowSize += rowPad - 1;
rowSize -= rowSize % rowPad;
}
data = (SplashColorPtr)gmallocn(height, rowSize);
rowSize += rowPad - 1;
rowSize -= rowSize % rowPad;
data = (SplashColorPtr)gmalloc(rowSize * height);
if (!topDown) {
data += (height - 1) * rowSize;
rowSize = -rowSize;
}
if (alphaA) {
alpha = (Guchar *)gmallocn(width, height);
alpha = (Guchar *)gmalloc(width * height);
} else {
alpha = NULL;
}
......
......@@ -29,6 +29,4 @@
#define splashErrSingularMatrix 8 // matrix is singular
#define splashErrBadArg 9 // bad argument
#endif
......@@ -461,7 +461,6 @@ Gfx::Gfx(XRef *xrefA, OutputDev *outA, int pageNum, Dict *resDict,
baseMatrix[i] = state->getCTM()[i];
}
formDepth = 0;
parser = NULL;
abortCheckCbk = abortCheckCbkA;
abortCheckCbkData = abortCheckCbkDataA;
......@@ -501,7 +500,6 @@ Gfx::Gfx(XRef *xrefA, OutputDev *outA, Dict *resDict,
baseMatrix[i] = state->getCTM()[i];
}
formDepth = 0;
parser = NULL;
abortCheckCbk = abortCheckCbkA;
abortCheckCbkData = abortCheckCbkDataA;
......
......@@ -78,10 +78,6 @@ private:
Guint *refSegs, Guint nRefSegs);
void readGenericRegionSeg(Guint segNum, GBool imm,
GBool lossless, Guint length);
void mmrAddPixels(int a1, int blackPixels,
int *codingLine, int *a0i, int w);
void mmrAddPixelsNeg(int a1, int blackPixels,
int *codingLine, int *a0i, int w);
JBIG2Bitmap *readGenericBitmap(GBool mmr, int w, int h,
int templ, GBool tpgdOn,
GBool useSkip, JBIG2Bitmap *skip,
......
......@@ -4301,7 +4301,7 @@ void PSOutputDev::doImageL1Sep(GfxImageColorMap *colorMap,
width, -height, height);
// allocate a line buffer
lineBuf = (Guchar *)gmallocn(width, 4);
lineBuf = (Guchar *)gmalloc(4 * width);
// set up to process the data stream
imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(),
......
This diff is collapsed.
......@@ -528,15 +528,13 @@ private:
int row; // current row
int inputBuf; // input buffer
int inputBits; // number of bits in input buffer
int *codingLine; // coding line changing elements
int *refLine; // reference line changing elements
int a0i; // index into codingLine
GBool err; // error on current line
short *refLine; // reference line changing elements
int b1; // index into refLine
short *codingLine; // coding line changing elements
int a0; // index into codingLine
int outputBits; // remaining ouput bits
int buf; // character buffer
void addPixels(int a1, int black);
void addPixelsNeg(int a1, int black);
short getTwoDimCode();
short getWhiteCode();
short getBlackCode();
......
......@@ -52,8 +52,6 @@ public:
// generation 0.
ObjectStream(XRef *xref, int objStrNumA);
GBool isOk() { return ok; }
~ObjectStream();
// Return the object number of this object stream.
......@@ -69,7 +67,6 @@ private:
int nObjects; // number of objects in the stream
Object *objs; // the objects (length = nObjects)
int *objNums; // the object numbers (length = nObjects)
GBool ok;
};
ObjectStream::ObjectStream(XRef *xref, int objStrNumA) {
......@@ -83,7 +80,6 @@ ObjectStream::ObjectStream(XRef *xref, int objStrNumA) {
nObjects = 0;
objs = NULL;
objNums = NULL;
ok = gFalse;
if (!xref->fetch(objStrNum, 0, &objStr)->isStream()) {
goto err1;
......@@ -109,13 +105,6 @@ ObjectStream::ObjectStream(XRef *xref, int objStrNumA) {
goto err1;
}
// this is an arbitrary limit to avoid integer overflow problems
// in the 'new Object[nObjects]' call (Acrobat apparently limits
// object streams to 100-200 objects)
if (nObjects > 1000000) {
error(-1, "Too many objects in an object stream");
goto err1;
}
objs = new Object[nObjects];
objNums = (int *)gmallocn(nObjects, sizeof(int));
offsets = (int *)gmallocn(nObjects, sizeof(int));
......@@ -172,10 +161,10 @@ ObjectStream::ObjectStream(XRef *xref, int objStrNumA) {
}
gfree(offsets);
ok = gTrue;
err1:
objStr.free();
return;
}
ObjectStream::~ObjectStream() {
......@@ -848,11 +837,6 @@ Object *XRef::fetch(int num, int gen, Object *obj) {
delete objStr;
}
objStr = new ObjectStream(this, e->offset);
if (!objStr->isOk()) {
delete objStr;
objStr = NULL;
goto err;
}
}
objStr->getObject(e->gen, num, obj);
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment