Commit a8489fda authored by shibakaneki's avatar shibakaneki

Merge remote-tracking branch 'origin/master'

parents 18a0e706 ff7ebdd2
...@@ -7,8 +7,9 @@ instructions for version 3.02 ...@@ -7,8 +7,9 @@ instructions for version 3.02
- Decompress xpdf-3.02.xx.tar.gz - Decompress xpdf-3.02.xx.tar.gz
Windows: Windows:
- Copy aconf-win32.h to aconf.h - using cywin run ./configure
- undefine unicode API support by adding '#undef UNICODE' aconf.h - run qmake xpdf.pro -r -spec win32-g++
- run make
OSX: OSX:
- run ./configure (may need extrea options ?) - 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() { ...@@ -224,7 +224,7 @@ void FoFiType1::parse() {
code = code * 8 + (*p2 - '0'); code = code * 8 + (*p2 - '0');
} }
} }
if (code >= 0 && code < 256) { if (code < 256) {
for (p = p2; *p == ' ' || *p == '\t'; ++p) ; for (p = p2; *p == ' ' || *p == '\t'; ++p) ;
if (*p == '/') { if (*p == '/') {
++p; ++p;
......
...@@ -55,15 +55,7 @@ void *gmalloc(int size) GMEM_EXCEP { ...@@ -55,15 +55,7 @@ void *gmalloc(int size) GMEM_EXCEP {
void *data; void *data;
unsigned long *trl, *p; unsigned long *trl, *p;
if (size < 0) { if (size <= 0) {
#if USE_EXCEPTIONS
throw GMemException();
#else
fprintf(stderr, "Invalid memory allocation size\n");
exit(1);
#endif
}
if (size == 0) {
return NULL; return NULL;
} }
size1 = gMemDataSize(size); size1 = gMemDataSize(size);
...@@ -99,15 +91,7 @@ void *gmalloc(int size) GMEM_EXCEP { ...@@ -99,15 +91,7 @@ void *gmalloc(int size) GMEM_EXCEP {
#else #else
void *p; void *p;
if (size < 0) { if (size <= 0) {
#if USE_EXCEPTIONS
throw GMemException();
#else
fprintf(stderr, "Invalid memory allocation size\n");
exit(1);
#endif
}
if (size == 0) {
return NULL; return NULL;
} }
if (!(p = malloc(size))) { if (!(p = malloc(size))) {
...@@ -128,15 +112,7 @@ void *grealloc(void *p, int size) GMEM_EXCEP { ...@@ -128,15 +112,7 @@ void *grealloc(void *p, int size) GMEM_EXCEP {
void *q; void *q;
int oldSize; int oldSize;
if (size < 0) { if (size <= 0) {
#if USE_EXCEPTIONS
throw GMemException();
#else
fprintf(stderr, "Invalid memory allocation size\n");
exit(1);
#endif
}
if (size == 0) {
if (p) { if (p) {
gfree(p); gfree(p);
} }
...@@ -155,15 +131,7 @@ void *grealloc(void *p, int size) GMEM_EXCEP { ...@@ -155,15 +131,7 @@ void *grealloc(void *p, int size) GMEM_EXCEP {
#else #else
void *q; void *q;
if (size < 0) { if (size <= 0) {
#if USE_EXCEPTIONS
throw GMemException();
#else
fprintf(stderr, "Invalid memory allocation size\n");
exit(1);
#endif
}
if (size == 0) {
if (p) { if (p) {
free(p); free(p);
} }
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <limits.h>
#include "gmem.h" #include "gmem.h"
#include "SplashErrorCodes.h" #include "SplashErrorCodes.h"
#include "SplashMath.h" #include "SplashMath.h"
...@@ -1913,10 +1912,7 @@ SplashError Splash::fillImageMask(SplashImageMaskSource src, void *srcData, ...@@ -1913,10 +1912,7 @@ SplashError Splash::fillImageMask(SplashImageMaskSource src, void *srcData,
xq = w % scaledWidth; xq = w % scaledWidth;
// allocate pixel buffer // allocate pixel buffer
if (yp < 0 || yp > INT_MAX - 1) { pixBuf = (SplashColorPtr)gmalloc((yp + 1) * w);
return splashErrBadArg;
}
pixBuf = (SplashColorPtr)gmallocn(yp + 1, w);
// initialize the pixel pipe // initialize the pixel pipe
pipeInit(&pipe, 0, 0, state->fillPattern, NULL, state->fillAlpha, pipeInit(&pipe, 0, 0, state->fillPattern, NULL, state->fillAlpha,
...@@ -2212,12 +2208,9 @@ SplashError Splash::drawImage(SplashImageSource src, void *srcData, ...@@ -2212,12 +2208,9 @@ SplashError Splash::drawImage(SplashImageSource src, void *srcData,
xq = w % scaledWidth; xq = w % scaledWidth;
// allocate pixel buffers // allocate pixel buffers
if (yp < 0 || yp > INT_MAX - 1 || w > INT_MAX / nComps) { colorBuf = (SplashColorPtr)gmalloc((yp + 1) * w * nComps);
return splashErrBadArg;
}
colorBuf = (SplashColorPtr)gmallocn(yp + 1, w * nComps);
if (srcAlpha) { if (srcAlpha) {
alphaBuf = (Guchar *)gmallocn(yp + 1, w); alphaBuf = (Guchar *)gmalloc((yp + 1) * w);
} else { } else {
alphaBuf = NULL; alphaBuf = NULL;
} }
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <limits.h>
#include "gmem.h" #include "gmem.h"
#include "SplashErrorCodes.h" #include "SplashErrorCodes.h"
#include "SplashBitmap.h" #include "SplashBitmap.h"
...@@ -28,48 +27,30 @@ SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPad, ...@@ -28,48 +27,30 @@ SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPad,
mode = modeA; mode = modeA;
switch (mode) { switch (mode) {
case splashModeMono1: case splashModeMono1:
if (width > 0) {
rowSize = (width + 7) >> 3; rowSize = (width + 7) >> 3;
} else {
rowSize = -1;
}
break; break;
case splashModeMono8: case splashModeMono8:
if (width > 0) {
rowSize = width; rowSize = width;
} else {
rowSize = -1;
}
break; break;
case splashModeRGB8: case splashModeRGB8:
case splashModeBGR8: case splashModeBGR8:
if (width > 0 && width <= INT_MAX / 3) {
rowSize = width * 3; rowSize = width * 3;
} else {
rowSize = -1;
}
break; break;
#if SPLASH_CMYK #if SPLASH_CMYK
case splashModeCMYK8: case splashModeCMYK8:
if (width > 0 && width <= INT_MAX / 4) {
rowSize = width * 4; rowSize = width * 4;
} else {
rowSize = -1;
}
break; break;
#endif #endif
} }
if (rowSize > 0) {
rowSize += rowPad - 1; rowSize += rowPad - 1;
rowSize -= rowSize % rowPad; rowSize -= rowSize % rowPad;
} data = (SplashColorPtr)gmalloc(rowSize * height);
data = (SplashColorPtr)gmallocn(height, rowSize);
if (!topDown) { if (!topDown) {
data += (height - 1) * rowSize; data += (height - 1) * rowSize;
rowSize = -rowSize; rowSize = -rowSize;
} }
if (alphaA) { if (alphaA) {
alpha = (Guchar *)gmallocn(width, height); alpha = (Guchar *)gmalloc(width * height);
} else { } else {
alpha = NULL; alpha = NULL;
} }
......
...@@ -29,6 +29,4 @@ ...@@ -29,6 +29,4 @@
#define splashErrSingularMatrix 8 // matrix is singular #define splashErrSingularMatrix 8 // matrix is singular
#define splashErrBadArg 9 // bad argument
#endif #endif
...@@ -461,7 +461,6 @@ Gfx::Gfx(XRef *xrefA, OutputDev *outA, int pageNum, Dict *resDict, ...@@ -461,7 +461,6 @@ Gfx::Gfx(XRef *xrefA, OutputDev *outA, int pageNum, Dict *resDict,
baseMatrix[i] = state->getCTM()[i]; baseMatrix[i] = state->getCTM()[i];
} }
formDepth = 0; formDepth = 0;
parser = NULL;
abortCheckCbk = abortCheckCbkA; abortCheckCbk = abortCheckCbkA;
abortCheckCbkData = abortCheckCbkDataA; abortCheckCbkData = abortCheckCbkDataA;
...@@ -501,7 +500,6 @@ Gfx::Gfx(XRef *xrefA, OutputDev *outA, Dict *resDict, ...@@ -501,7 +500,6 @@ Gfx::Gfx(XRef *xrefA, OutputDev *outA, Dict *resDict,
baseMatrix[i] = state->getCTM()[i]; baseMatrix[i] = state->getCTM()[i];
} }
formDepth = 0; formDepth = 0;
parser = NULL;
abortCheckCbk = abortCheckCbkA; abortCheckCbk = abortCheckCbkA;
abortCheckCbkData = abortCheckCbkDataA; abortCheckCbkData = abortCheckCbkDataA;
......
...@@ -78,10 +78,6 @@ private: ...@@ -78,10 +78,6 @@ private:
Guint *refSegs, Guint nRefSegs); Guint *refSegs, Guint nRefSegs);
void readGenericRegionSeg(Guint segNum, GBool imm, void readGenericRegionSeg(Guint segNum, GBool imm,
GBool lossless, Guint length); 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, JBIG2Bitmap *readGenericBitmap(GBool mmr, int w, int h,
int templ, GBool tpgdOn, int templ, GBool tpgdOn,
GBool useSkip, JBIG2Bitmap *skip, GBool useSkip, JBIG2Bitmap *skip,
......
...@@ -4301,7 +4301,7 @@ void PSOutputDev::doImageL1Sep(GfxImageColorMap *colorMap, ...@@ -4301,7 +4301,7 @@ void PSOutputDev::doImageL1Sep(GfxImageColorMap *colorMap,
width, -height, height); width, -height, height);
// allocate a line buffer // allocate a line buffer
lineBuf = (Guchar *)gmallocn(width, 4); lineBuf = (Guchar *)gmalloc(4 * width);
// set up to process the data stream // set up to process the data stream
imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(),
......
This diff is collapsed.
...@@ -528,15 +528,13 @@ private: ...@@ -528,15 +528,13 @@ private:
int row; // current row int row; // current row
int inputBuf; // input buffer int inputBuf; // input buffer
int inputBits; // number of bits in input buffer int inputBits; // number of bits in input buffer
int *codingLine; // coding line changing elements short *refLine; // reference line changing elements
int *refLine; // reference line changing elements int b1; // index into refLine
int a0i; // index into codingLine short *codingLine; // coding line changing elements
GBool err; // error on current line int a0; // index into codingLine
int outputBits; // remaining ouput bits int outputBits; // remaining ouput bits
int buf; // character buffer int buf; // character buffer
void addPixels(int a1, int black);
void addPixelsNeg(int a1, int black);
short getTwoDimCode(); short getTwoDimCode();
short getWhiteCode(); short getWhiteCode();
short getBlackCode(); short getBlackCode();
......
...@@ -52,8 +52,6 @@ public: ...@@ -52,8 +52,6 @@ public:
// generation 0. // generation 0.
ObjectStream(XRef *xref, int objStrNumA); ObjectStream(XRef *xref, int objStrNumA);
GBool isOk() { return ok; }
~ObjectStream(); ~ObjectStream();
// Return the object number of this object stream. // Return the object number of this object stream.
...@@ -69,7 +67,6 @@ private: ...@@ -69,7 +67,6 @@ private:
int nObjects; // number of objects in the stream int nObjects; // number of objects in the stream
Object *objs; // the objects (length = nObjects) Object *objs; // the objects (length = nObjects)
int *objNums; // the object numbers (length = nObjects) int *objNums; // the object numbers (length = nObjects)
GBool ok;
}; };
ObjectStream::ObjectStream(XRef *xref, int objStrNumA) { ObjectStream::ObjectStream(XRef *xref, int objStrNumA) {
...@@ -83,7 +80,6 @@ ObjectStream::ObjectStream(XRef *xref, int objStrNumA) { ...@@ -83,7 +80,6 @@ ObjectStream::ObjectStream(XRef *xref, int objStrNumA) {
nObjects = 0; nObjects = 0;
objs = NULL; objs = NULL;
objNums = NULL; objNums = NULL;
ok = gFalse;
if (!xref->fetch(objStrNum, 0, &objStr)->isStream()) { if (!xref->fetch(objStrNum, 0, &objStr)->isStream()) {
goto err1; goto err1;
...@@ -109,13 +105,6 @@ ObjectStream::ObjectStream(XRef *xref, int objStrNumA) { ...@@ -109,13 +105,6 @@ ObjectStream::ObjectStream(XRef *xref, int objStrNumA) {
goto err1; 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]; objs = new Object[nObjects];
objNums = (int *)gmallocn(nObjects, sizeof(int)); objNums = (int *)gmallocn(nObjects, sizeof(int));
offsets = (int *)gmallocn(nObjects, sizeof(int)); offsets = (int *)gmallocn(nObjects, sizeof(int));
...@@ -172,10 +161,10 @@ ObjectStream::ObjectStream(XRef *xref, int objStrNumA) { ...@@ -172,10 +161,10 @@ ObjectStream::ObjectStream(XRef *xref, int objStrNumA) {
} }
gfree(offsets); gfree(offsets);
ok = gTrue;
err1: err1:
objStr.free(); objStr.free();
return;
} }
ObjectStream::~ObjectStream() { ObjectStream::~ObjectStream() {
...@@ -848,11 +837,6 @@ Object *XRef::fetch(int num, int gen, Object *obj) { ...@@ -848,11 +837,6 @@ Object *XRef::fetch(int num, int gen, Object *obj) {
delete objStr; delete objStr;
} }
objStr = new ObjectStream(this, e->offset); objStr = new ObjectStream(this, e->offset);
if (!objStr->isOk()) {
delete objStr;
objStr = NULL;
goto err;
}
} }
objStr->getObject(e->gen, num, obj); objStr->getObject(e->gen, num, obj);
break; 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