CHANGES-1.1.txt
---------------
+CHANGES IN CUPS V1.1.19
+
+ - Fixed compiler warnings in pdftops filter (STR #96)
+
+
CHANGES IN CUPS V1.1.19rc5
- Jobs with banner pages that were printed to implicit
gfree(tab);
}
-GBool BuiltinFontWidths::getWidth(char *name, Gushort *width) {
+GBool BuiltinFontWidths::getWidth(const char *name, Gushort *width) {
int h;
BuiltinFontWidth *p;
return gFalse;
}
-int BuiltinFontWidths::hash(char *name) {
- char *p;
+int BuiltinFontWidths::hash(const char *name) {
+ const char *p;
unsigned int h;
h = 0;
//------------------------------------------------------------------------
struct BuiltinFont {
- char *name;
- char **defaultBaseEnc;
+ const char *name;
+ const char **defaultBaseEnc;
short ascent;
short descent;
short bbox[4];
//------------------------------------------------------------------------
struct BuiltinFontWidth {
- char *name;
+ const char *name;
Gushort width;
BuiltinFontWidth *next;
};
BuiltinFontWidths(BuiltinFontWidth *widths, int sizeA);
~BuiltinFontWidths();
- GBool getWidth(char *name, Gushort *width);
+ GBool getWidth(const char *name, Gushort *width);
private:
- int hash(char *name);
+ int hash(const char *name);
BuiltinFontWidth **tab;
int size;
refCnt = 1;
}
-void CMap::useCMap(CMapCache *cache, char *useName) {
+void CMap::useCMap(CMapCache *cache, const char *useName) {
GString *useNameStr;
CMap *subCMap;
return !collection->cmp(collectionA) && !cMapName->cmp(cMapNameA);
}
-CID CMap::getCID(char *s, int len, int *nUsed) {
+CID CMap::getCID(const char *s, int len, int *nUsed) {
CMapVectorEntry *vec;
int n, i;
// Return the CID corresponding to the character code starting at
// <s>, which contains <len> bytes. Sets *<nUsed> to the number of
// bytes used by the char code.
- CID getCID(char *s, int len, int *nUsed);
+ CID getCID(const char *s, int len, int *nUsed);
// Return the writing mode (0=horizontal, 1=vertical).
int getWMode() { return wMode; }
CMap(GString *collectionA, GString *cMapNameA);
CMap(GString *collectionA, GString *cMapNameA, int wModeA);
- void useCMap(CMapCache *cache, char *useName);
+ void useCMap(CMapCache *cache, const char *useName);
void copyVector(CMapVectorEntry *dest, CMapVectorEntry *src);
void addCodeSpace(CMapVectorEntry *vec, Guint start, Guint end,
Guint nBytes);
#ifndef COMPACTFONTINFO_H
#define COMPACTFONTINFO_H
-static char *type1CStdStrings[391] = {
+static const char *type1CStdStrings[391] = {
".notdef",
"space",
"exclam",
int i;
for (i = 0; i < length; ++i) {
- gfree(entries[i].key);
+ gfree((void *)entries[i].key);
entries[i].val.free();
}
gfree(entries);
}
-void Dict::add(char *key, Object *val) {
+void Dict::add(const char *key, Object *val) {
if (length + 1 > size) {
size += 8;
entries = (DictEntry *)grealloc(entries, size * sizeof(DictEntry));
++length;
}
-inline DictEntry *Dict::find(char *key) {
+inline DictEntry *Dict::find(const char *key) {
int i;
for (i = 0; i < length; ++i) {
return NULL;
}
-GBool Dict::is(char *type) {
+GBool Dict::is(const char *type) {
DictEntry *e;
return (e = find("Type")) && e->val.isName(type);
}
-Object *Dict::lookup(char *key, Object *obj) {
+Object *Dict::lookup(const char *key, Object *obj) {
DictEntry *e;
return (e = find(key)) ? e->val.fetch(xref, obj) : obj->initNull();
}
-Object *Dict::lookupNF(char *key, Object *obj) {
+Object *Dict::lookupNF(const char *key, Object *obj) {
DictEntry *e;
return (e = find(key)) ? e->val.copy(obj) : obj->initNull();
}
-char *Dict::getKey(int i) {
+const char *Dict::getKey(int i) {
return entries[i].key;
}
//------------------------------------------------------------------------
struct DictEntry {
- char *key;
+ const char *key;
Object val;
};
int getLength() { return length; }
// Add an entry. NB: does not copy key.
- void add(char *key, Object *val);
+ void add(const char *key, Object *val);
// Check if dictionary is of specified type.
- GBool is(char *type);
+ GBool is(const char *type);
// Look up an entry and return the value. Returns a null object
// if <key> is not in the dictionary.
- Object *lookup(char *key, Object *obj);
- Object *lookupNF(char *key, Object *obj);
+ Object *lookup(const char *key, Object *obj);
+ Object *lookupNF(const char *key, Object *obj);
// Iterative accessors.
- char *getKey(int i);
+ const char *getKey(int i);
Object *getVal(int i, Object *obj);
Object *getValNF(int i, Object *obj);
int length; // number of entries in dictionary
int ref; // reference count
- DictEntry *find(char *key);
+ DictEntry *find(const char *key);
};
#endif
//========================================================================
static struct {
- char *name;
- char *xlfd;
- char *encoding;
+ const char *name;
+ const char *xlfd;
+ const char *encoding;
} displayFontTab[] = {
{"Courier", "-*-courier-medium-r-normal-*-%s-*-*-*-*-*-iso8859-1", "Latin1"},
{"Courier-Bold", "-*-courier-bold-r-normal-*-%s-*-*-*-*-*-iso8859-1", "Latin1"},
#include "GlobalParams.h"
#include "Error.h"
-void CDECL error(int pos, char *msg, ...) {
+void CDECL error(int pos, const char *msg, ...) {
va_list args;
// NB: this can be called before the globalParams object is created
#include <stdio.h>
#include "config.h"
-extern void CDECL error(int pos, char *msg, ...);
+extern void CDECL error(int pos, const char *msg, ...);
#endif
#include <stdlib.h>
#include "FontEncodingTables.h"
-char *macRomanEncoding[256] = {
+const char *macRomanEncoding[256] = {
NULL,
NULL,
NULL,
"caron"
};
-char *macExpertEncoding[256] = {
+const char *macExpertEncoding[256] = {
NULL,
NULL,
NULL,
NULL
};
-char *winAnsiEncoding[256] = {
+const char *winAnsiEncoding[256] = {
NULL,
NULL,
NULL,
"ydieresis"
};
-char *standardEncoding[256] = {
+const char *standardEncoding[256] = {
NULL,
NULL,
NULL,
NULL
};
-char *expertEncoding[256] = {
+const char *expertEncoding[256] = {
NULL,
NULL,
NULL,
"Ydieresissmall"
};
-char *symbolEncoding[256] = {
+const char *symbolEncoding[256] = {
NULL,
NULL,
NULL,
NULL
};
-char *zapfDingbatsEncoding[256] = {
+const char *zapfDingbatsEncoding[256] = {
NULL,
NULL,
NULL,
#ifndef FONTENCODINGTABLES_H
#define FONTENCODINGTABLES_H
-extern char *macRomanEncoding[];
-extern char *macExpertEncoding[];
-extern char *winAnsiEncoding[];
-extern char *standardEncoding[];
-extern char *expertEncoding[];
-extern char *symbolEncoding[];
-extern char *zapfDingbatsEncoding[];
+extern const char *macRomanEncoding[];
+extern const char *macExpertEncoding[];
+extern const char *winAnsiEncoding[];
+extern const char *standardEncoding[];
+extern const char *expertEncoding[];
+extern const char *symbolEncoding[];
+extern const char *zapfDingbatsEncoding[];
#endif
//------------------------------------------------------------------------
-static inline char *nextLine(char *line, char *end) {
+static inline const char *nextLine(const char *line, const char *end) {
while (line < end && *line != '\n' && *line != '\r')
++line;
while (line < end && *line == '\n' || *line == '\r')
return line;
}
-static char hexChars[17] = "0123456789ABCDEF";
+static const char hexChars[17] = "0123456789ABCDEF";
//------------------------------------------------------------------------
// FontFile
// Type1FontFile
//------------------------------------------------------------------------
-Type1FontFile::Type1FontFile(char *file, int len) {
- char *line, *line1, *p, *p2;
+Type1FontFile::Type1FontFile(const char *file, int len) {
+ const char *line, *line1;
+ char *p, *p2;
GBool haveEncoding;
char buf[256];
char c;
GBool nominalWidthXFP;
};
-Type1CFontFile::Type1CFontFile(char *fileA, int lenA) {
+Type1CFontFile::Type1CFontFile(const char *fileA, int lenA) {
Guchar *nameIdxPtr, *idxPtr0, *idxPtr1;
file = fileA;
}
}
-char *Type1CFontFile::getName() {
+const char *Type1CFontFile::getName() {
return name->getCString();
}
-char **Type1CFontFile::getEncoding() {
+const char **Type1CFontFile::getEncoding() {
if (!encoding) {
readNameAndEncoding();
}
- return encoding;
+ return (const char **)encoding;
}
void Type1CFontFile::readNameAndEncoding() {
}
}
-void Type1CFontFile::convertToCIDType0(char *psName,
+void Type1CFontFile::convertToCIDType0(const char *psName,
FontFileOutputFunc outputFuncA,
void *outputStreamA) {
Type1CTopDict dict;
gfree(fdSelect);
}
-void Type1CFontFile::convertToType0(char *psName,
+void Type1CFontFile::convertToType0(const char *psName,
FontFileOutputFunc outputFuncA,
void *outputStreamA) {
Type1CTopDict dict;
return glyphNames;
}
-void Type1CFontFile::eexecWrite(char *s) {
+void Type1CFontFile::eexecWrite(const char *s) {
Guchar *p;
Guchar x;
}
}
-void Type1CFontFile::eexecCvtGlyph(char *glyphName, Guchar *s, int n) {
+void Type1CFontFile::eexecCvtGlyph(const char *glyphName, Guchar *s, int n) {
char eBuf[256];
cvtGlyph(s, n);
}
}
-void Type1CFontFile::getDeltaInt(char *buf, char *key, double *opA,
+void Type1CFontFile::getDeltaInt(char *buf, const char *key, double *opA,
int n) {
int x, i;
sprintf(buf, "] def\n");
}
-void Type1CFontFile::getDeltaReal(char *buf, char *key, double *opA,
+void Type1CFontFile::getDeltaReal(char *buf, const char *key, double *opA,
int n) {
double x;
int i;
};
struct T42Table {
- char *tag; // 4-byte tag
+ const char *tag; // 4-byte tag
GBool required; // required by the TrueType spec?
};
// Glyph names in some arbitrary standard that Apple uses for their
// TrueType fonts.
-static char *macGlyphNames[258] = {
+static const char *macGlyphNames[258] = {
".notdef",
"null",
"CR",
int length;
};
-TrueTypeFontFile::TrueTypeFontFile(char *fileA, int lenA) {
+TrueTypeFontFile::TrueTypeFontFile(const char *fileA, int lenA) {
int pos, i, idx, n, length;
Guint size, startPos, endPos;
gfree(tableHdrs);
}
-char *TrueTypeFontFile::getName() {
+const char *TrueTypeFontFile::getName() {
return NULL;
}
-char **TrueTypeFontFile::getEncoding() {
+const char **TrueTypeFontFile::getEncoding() {
int cmap[256];
int nCmaps, cmapPlatform, cmapEncoding, cmapFmt;
int cmapLen, cmapOffset, cmapFirst;
int stringIdx, stringPos, n;
if (encoding) {
- return encoding;
+ return (const char **)encoding;
}
//----- construct the (char code) -> (glyph idx) mapping
}
}
- return encoding;
+ return (const char **)encoding;
}
-void TrueTypeFontFile::convertToType42(char *name, char **encodingA,
+void TrueTypeFontFile::convertToType42(const char *name, const char **encodingA,
CharCodeToUnicode *toUnicode,
GBool pdfFontHasEncoding,
FontFileOutputFunc outputFunc,
(*outputFunc)(outputStream, "FontName currentdict end definefont pop\n", 40);
}
-void TrueTypeFontFile::convertToCIDType2(char *name, Gushort *cidMap,
+void TrueTypeFontFile::convertToCIDType2(const char *name, Gushort *cidMap,
int nCIDs,
FontFileOutputFunc outputFunc,
void *outputStream) {
56);
}
-void TrueTypeFontFile::convertToType0(char *name, Gushort *cidMap,
+void TrueTypeFontFile::convertToType0(const char *name, Gushort *cidMap,
int nCIDs,
FontFileOutputFunc outputFunc,
void *outputStream) {
return (double)x + (double)y / 65536;
}
-int TrueTypeFontFile::seekTable(char *tag) {
+int TrueTypeFontFile::seekTable(const char *tag) {
int i;
for (i = 0; i < nTables; ++i) {
return -1;
}
-int TrueTypeFontFile::seekTableIdx(char *tag) {
+int TrueTypeFontFile::seekTableIdx(const char *tag) {
int i;
for (i = 0; i < nTables; ++i) {
return -1;
}
-void TrueTypeFontFile::cvtEncoding(char **encodingA, GBool pdfFontHasEncoding,
+void TrueTypeFontFile::cvtEncoding(const char **encodingA, GBool pdfFontHasEncoding,
FontFileOutputFunc outputFunc,
void *outputStream) {
- char *name;
+ const char *name;
char buf[64];
int i;
(*outputFunc)(outputStream, "readonly def\n", 13);
}
-void TrueTypeFontFile::cvtCharStrings(char **encodingA,
+void TrueTypeFontFile::cvtCharStrings(const char **encodingA,
CharCodeToUnicode *toUnicode,
GBool pdfFontHasEncoding,
FontFileOutputFunc outputFunc,
int unicodeCmap, macRomanCmap, msSymbolCmap;
int nCmaps, cmapPlatform, cmapEncoding, cmapFmt, cmapOffset;
T42FontIndexMode mode;
- char *name;
+ const char *name;
char buf[64], buf2[16];
Unicode u;
int pos, i, j, k;
gfree(locaTable);
}
-void TrueTypeFontFile::dumpString(char *s, int length,
+void TrueTypeFontFile::dumpString(const char *s, int length,
FontFileOutputFunc outputFunc,
void *outputStream) {
char buf[64];
(*outputFunc)(outputStream, "00>\n", 4);
}
-Guint TrueTypeFontFile::computeTableChecksum(char *data, int length) {
+Guint TrueTypeFontFile::computeTableChecksum(const char *data, int length) {
Guint checksum, word;
int i;
//------------------------------------------------------------------------
-typedef void (*FontFileOutputFunc)(void *stream, char *data, int len);
+typedef void (*FontFileOutputFunc)(void *stream, const char *data, int len);
//------------------------------------------------------------------------
// FontFile
// Returns the font name, as specified internally by the font file.
// Returns NULL if no name is available.
- virtual char *getName() = 0;
+ virtual const char *getName() = 0;
// Returns the custom font encoding, or NULL if the encoding is not
// available.
- virtual char **getEncoding() = 0;
+ virtual const char **getEncoding() = 0;
};
//------------------------------------------------------------------------
class Type1FontFile: public FontFile {
public:
- Type1FontFile(char *file, int len);
+ Type1FontFile(const char *file, int len);
virtual ~Type1FontFile();
- virtual char *getName() { return name; }
- virtual char **getEncoding() { return encoding; }
+ virtual const char *getName() { return name; }
+ virtual const char **getEncoding() { return (const char **)encoding; }
private:
class Type1CFontFile: public FontFile {
public:
- Type1CFontFile(char *fileA, int lenA);
+ Type1CFontFile(const char *fileA, int lenA);
virtual ~Type1CFontFile();
- virtual char *getName();
- virtual char **getEncoding();
+ virtual const char *getName();
+ virtual const char **getEncoding();
// Convert to a Type 1 font, suitable for embedding in a PostScript
// file. The name will be used as the PostScript font name.
// Convert to a Type 0 CIDFont, suitable for embedding in a
// PostScript file. The name will be used as the PostScript font
// name.
- void convertToCIDType0(char *psName,
+ void convertToCIDType0(const char *psName,
FontFileOutputFunc outputFuncA, void *outputStreamA);
// Convert to a Type 0 (but non-CID) composite font, suitable for
// embedding in a PostScript file. The name will be used as the
// PostScript font name.
- void convertToType0(char *psName,
+ void convertToType0(const char *psName,
FontFileOutputFunc outputFuncA, void *outputStreamA);
private:
void readPrivateDict(Type1CPrivateDict *privateDict,
int offset, int size);
Gushort *readCharset(int charset, int nGlyphs);
- void eexecWrite(char *s);
- void eexecCvtGlyph(char *glyphName, Guchar *s, int n);
+ void eexecWrite(const char *s);
+ void eexecCvtGlyph(const char *glyphName, Guchar *s, int n);
void cvtGlyph(Guchar *s, int n);
void cvtGlyphWidth(GBool useOp);
void eexecDumpNum(double x, GBool fpA);
void eexecDumpOp1(int opA);
void eexecDumpOp2(int opA);
void eexecWriteCharstring(Guchar *s, int n);
- void getDeltaInt(char *buf, char *key, double *opA, int n);
- void getDeltaReal(char *buf, char *key, double *opA, int n);
+ void getDeltaInt(char *buf, const char *key, double *opA, int n);
+ void getDeltaReal(char *buf, const char *key, double *opA, int n);
int getIndexLen(Guchar *indexPtr);
Guchar *getIndexValPtr(Guchar *indexPtr, int i);
Guchar *getIndexEnd(Guchar *indexPtr);
double getNum(Guchar **ptr, GBool *fp);
char *getString(int sid, char *buf);
- char *file;
+ const char *file;
int len;
GString *name;
class TrueTypeFontFile: public FontFile {
public:
- TrueTypeFontFile(char *fileA, int lenA);
+ TrueTypeFontFile(const char *fileA, int lenA);
~TrueTypeFontFile();
// This always returns NULL, since it's probably better to trust the
// font name in the PDF file rather than the one in the TrueType
// font file.
- virtual char *getName();
+ virtual const char *getName();
- virtual char **getEncoding();
+ virtual const char **getEncoding();
// Convert to a Type 42 font, suitable for embedding in a PostScript
// file. The name will be used as the PostScript font name (so we
// don't need to depend on the 'name' table in the font). The
// encoding is needed because the PDF Font object can modify the
// encoding.
- void convertToType42(char *name, char **encodingA,
+ void convertToType42(const char *name, const char **encodingA,
CharCodeToUnicode *toUnicode,
GBool pdfFontHasEncoding,
FontFileOutputFunc outputFunc, void *outputStream);
// PostScript file. The name will be used as the PostScript font
// name (so we don't need to depend on the 'name' table in the
// font).
- void convertToCIDType2(char *name, Gushort *cidMap, int nCIDs,
+ void convertToCIDType2(const char *name, Gushort *cidMap, int nCIDs,
FontFileOutputFunc outputFunc, void *outputStream);
// Convert to a Type 0 (but non-CID) composite font, suitable for
// embedding in a PostScript file. The name will be used as the
// PostScript font name (so we don't need to depend on the 'name'
// table in the font).
- void convertToType0(char *name, Gushort *cidMap, int nCIDs,
+ void convertToType0(const char *name, Gushort *cidMap, int nCIDs,
FontFileOutputFunc outputFunc, void *outputStream);
// Write a TTF file, filling in any missing tables that are required
private:
- char *file;
+ const char *file;
int len;
char **encoding;
int getShort(int pos);
Guint getULong(int pos);
double getFixed(int pos);
- int seekTable(char *tag);
- int seekTableIdx(char *tag);
- void cvtEncoding(char **encodingA, GBool pdfFontHasEncoding,
+ int seekTable(const char *tag);
+ int seekTableIdx(const char *tag);
+ void cvtEncoding(const char **encodingA, GBool pdfFontHasEncoding,
FontFileOutputFunc outputFunc, void *outputStream);
- void cvtCharStrings(char **encodingA, CharCodeToUnicode *toUnicode,
+ void cvtCharStrings(const char **encodingA, CharCodeToUnicode *toUnicode,
GBool pdfFontHasEncoding,
FontFileOutputFunc outputFunc, void *outputStream);
int getCmapEntry(int cmapFmt, int pos, int code);
void cvtSfnts(FontFileOutputFunc outputFunc, void *outputStream,
GString *name);
- void dumpString(char *s, int length,
+ void dumpString(const char *s, int length,
FontFileOutputFunc outputFunc, void *outputStream);
- Guint computeTableChecksum(char *data, int length);
+ Guint computeTableChecksum(const char *data, int length);
};
#endif
// Note: 'if' and 'ifelse' are parsed separately.
// The rest are listed here in alphabetical order.
// The index in this table is equivalent to the entry in PSOp.
-char *psOpNames[] = {
+const char *psOpNames[] = {
"abs",
"add",
"and",
//------------------------------------------------------------------------
struct StdFontMapEntry {
- char *altName;
- char *properName;
+ const char *altName;
+ const char *properName;
};
static StdFontMapEntry stdFontMap[] = {
// GfxFont
//------------------------------------------------------------------------
-GfxFont *GfxFont::makeFont(XRef *xref, char *tagA, Ref idA, Dict *fontDict) {
+GfxFont *GfxFont::makeFont(XRef *xref, const char *tagA, Ref idA, Dict *fontDict) {
GString *nameA;
GfxFont *font;
Object obj1;
return font;
}
-GfxFont::GfxFont(char *tagA, Ref idA, GString *nameA) {
+GfxFont::GfxFont(const char *tagA, Ref idA, GString *nameA) {
ok = gFalse;
tag = new GString(tagA);
id = idA;
// Gfx8BitFont
//------------------------------------------------------------------------
-Gfx8BitFont::Gfx8BitFont(XRef *xref, char *tagA, Ref idA, GString *nameA,
+Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GString *nameA,
GfxFontType typeA, Dict *fontDict):
GfxFont(tagA, idA, nameA)
{
BuiltinFont *builtinFont;
- char **baseEnc;
+ const char **baseEnc;
GBool baseEncFromFontFile;
char *buf;
int len;
FontFile *fontFile;
int code, code2;
- char *charName;
+ const char *charName;
GBool missing, hex;
Unicode toUnicode[256];
double mul;
} else if (obj3.isName()) {
if (code < 256) {
if (encFree[code]) {
- gfree(enc[code]);
+ gfree((void *)enc[code]);
}
enc[code] = copyString(obj3.getName());
encFree[code] = gTrue;
for (i = 0; i < 256; ++i) {
if (encFree[i] && enc[i]) {
- gfree(enc[i]);
+ gfree((void *)enc[i]);
}
}
ctu->decRefCnt();
}
}
-int Gfx8BitFont::getNextChar(char *s, int len, CharCode *code,
+int Gfx8BitFont::getNextChar(const char *s, int len, CharCode *code,
Unicode *u, int uSize, int *uLen,
double *dx, double *dy, double *ox, double *oy) {
CharCode c;
((GfxFontCIDWidthExcepV *)w2)->first;
}
-GfxCIDFont::GfxCIDFont(XRef *xref, char *tagA, Ref idA, GString *nameA,
+GfxCIDFont::GfxCIDFont(XRef *xref, const char *tagA, Ref idA, GString *nameA,
Dict *fontDict):
GfxFont(tagA, idA, nameA)
{
}
}
-int GfxCIDFont::getNextChar(char *s, int len, CharCode *code,
+int GfxCIDFont::getNextChar(const char *s, int len, CharCode *code,
Unicode *u, int uSize, int *uLen,
double *dx, double *dy, double *ox, double *oy) {
CID cid;
gfree(fonts);
}
-GfxFont *GfxFontDict::lookup(char *tag) {
+GfxFont *GfxFontDict::lookup(const char *tag) {
int i;
for (i = 0; i < numFonts; ++i) {
public:
// Build a GfxFont object.
- static GfxFont *makeFont(XRef *xref, char *tagA, Ref idA, Dict *fontDict);
+ static GfxFont *makeFont(XRef *xref, const char *tagA, Ref idA, Dict *fontDict);
- GfxFont(char *tagA, Ref idA, GString *nameA);
+ GfxFont(const char *tagA, Ref idA, GString *nameA);
virtual ~GfxFont();
Ref *getID() { return &id; }
// Does this font match the tag?
- GBool matches(char *tagA) { return !tag->cmp(tagA); }
+ GBool matches(const char *tagA) { return !tag->cmp(tagA); }
// Get base font name.
GString *getName() { return name; }
// is the number of entries available in <u>, and <uLen> is set to
// the number actually used. Returns the number of bytes used by
// the char code.
- virtual int getNextChar(char *s, int len, CharCode *code,
+ virtual int getNextChar(const char *s, int len, CharCode *code,
Unicode *u, int uSize, int *uLen,
double *dx, double *dy, double *ox, double *oy) = 0;
class Gfx8BitFont: public GfxFont {
public:
- Gfx8BitFont(XRef *xref, char *tagA, Ref idA, GString *nameA,
+ Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GString *nameA,
GfxFontType typeA, Dict *fontDict);
virtual ~Gfx8BitFont();
- virtual int getNextChar(char *s, int len, CharCode *code,
+ virtual int getNextChar(const char *s, int len, CharCode *code,
Unicode *u, int uSize, int *uLen,
double *dx, double *dy, double *ox, double *oy);
// Return the encoding.
- char **getEncoding() { return enc; }
+ const char **getEncoding() { return enc; }
// Return the Unicode map.
CharCodeToUnicode *getToUnicode();
// Return the character name associated with <code>.
- char *getCharName(int code) { return enc[code]; }
+ const char *getCharName(int code) { return enc[code]; }
// Returns true if the PDF font specified an encoding.
GBool getHasEncoding() { return hasEncoding; }
private:
- char *enc[256]; // char code --> char name
+ const char *enc[256]; // char code --> char name
char encFree[256]; // boolean for each char name: if set,
// the string is malloc'ed
CharCodeToUnicode *ctu; // char code --> Unicode
class GfxCIDFont: public GfxFont {
public:
- GfxCIDFont(XRef *xref, char *tagA, Ref idA, GString *nameA,
+ GfxCIDFont(XRef *xref, const char *tagA, Ref idA, GString *nameA,
Dict *fontDict);
virtual ~GfxCIDFont();
virtual GBool isCIDFont() { return gTrue; }
- virtual int getNextChar(char *s, int len, CharCode *code,
+ virtual int getNextChar(const char *s, int len, CharCode *code,
Unicode *u, int uSize, int *uLen,
double *dx, double *dy, double *ox, double *oy);
~GfxFontDict();
// Get the specified font.
- GfxFont *lookup(char *tag);
+ GfxFont *lookup(const char *tag);
// Iterative access.
int getNumFonts() { return numFonts; }
//------------------------------------------------------------------------
-static char *gfxColorSpaceModeNames[] = {
+static const char *gfxColorSpaceModeNames[] = {
"DeviceGray",
"CalGray",
"DeviceRGB",
return nGfxColorSpaceModes;
}
-char *GfxColorSpace::getColorSpaceModeName(int idx) {
+const char *GfxColorSpace::getColorSpaceModeName(int idx) {
return gfxColorSpaceModeNames[idx];
}
static int getNumColorSpaceModes();
// Return the name of the <idx>th color space mode.
- static char *getColorSpaceModeName(int idx);
+ static const char *getColorSpaceModeName(int idx);
private:
};
}
}
-DisplayFontParam::DisplayFontParam(char *nameA, char *xlfdA, char *encodingA) {
+DisplayFontParam::DisplayFontParam(const char *nameA, const char *xlfdA, const char *encodingA) {
name = new GString(nameA);
kind = displayFontX;
x.xlfd = new GString(xlfdA);
// parsing
//------------------------------------------------------------------------
-GlobalParams::GlobalParams(char *cfgFileName) {
+GlobalParams::GlobalParams(const char *cfgFileName) {
UnicodeMap *map;
DisplayFontParam *dfp;
GString *fileName;
displayCIDFonts = new GHash();
displayNamedCIDFonts = new GHash();
#if HAVE_PAPER_H
- char *paperName;
+ const char *paperName;
const struct paper *paperType;
paperinit();
if ((paperName = systempapername())) {
psFonts->add(param->pdfFontName, param);
}
-void GlobalParams::parsePSFont16(char *cmdName, GList *fontList,
+void GlobalParams::parsePSFont16(const char *cmdName, GList *fontList,
GList *tokens, GString *fileName, int line) {
PSFontParam *param;
int wMode;
initialZoom = ((GString *)tokens->get(1))->copy();
}
-void GlobalParams::parseFontRastControl(char *cmdName, FontRastControl *val,
+void GlobalParams::parseFontRastControl(const char *cmdName, FontRastControl *val,
GList *tokens, GString *fileName,
int line) {
GString *tok;
}
}
-void GlobalParams::parseCommand(char *cmdName, GString **val,
+void GlobalParams::parseCommand(const char *cmdName, GString **val,
GList *tokens, GString *fileName, int line) {
if (tokens->getLength() != 2) {
error(-1, "Bad '%s' config file command (%s:%d)",
*val = ((GString *)tokens->get(1))->copy();
}
-void GlobalParams::parseYesNo(char *cmdName, GBool *flag,
+void GlobalParams::parseYesNo(const char *cmdName, GBool *flag,
GList *tokens, GString *fileName, int line) {
GString *tok;
// accessors
//------------------------------------------------------------------------
-CharCode GlobalParams::getMacRomanCharCode(char *charName) {
+CharCode GlobalParams::getMacRomanCharCode(const char *charName) {
return macRomanReverseMap->lookup(charName);
}
-Unicode GlobalParams::mapNameToUnicode(char *charName) {
+Unicode GlobalParams::mapNameToUnicode(const char *charName) {
return nameToUnicode->lookup(charName);
}
}
GString *GlobalParams::findFontFile(GString *fontName,
- char *ext1, char *ext2) {
+ const char *ext1, const char *ext2) {
GString *dir, *fileName;
FILE *f;
int i;
globalParamsUnlock;
}
-void GlobalParams::setPSFile(char *file) {
+void GlobalParams::setPSFile(const char *file) {
globalParamsLock;
if (psFile) {
delete psFile;
globalParamsUnlock;
}
-GBool GlobalParams::setPSPaperSize(char *size) {
+GBool GlobalParams::setPSPaperSize(const char *size) {
globalParamsLock;
if (!strcmp(size, "letter")) {
psPaperWidth = 612;
globalParamsUnlock;
}
-void GlobalParams::setTextEncoding(char *encodingName) {
+void GlobalParams::setTextEncoding(const char *encodingName) {
globalParamsLock;
delete textEncoding;
textEncoding = new GString(encodingName);
globalParamsUnlock;
}
-GBool GlobalParams::setTextEOL(char *s) {
+GBool GlobalParams::setTextEOL(const char *s) {
globalParamsLock;
if (!strcmp(s, "unix")) {
textEOL = eolUnix;
globalParamsUnlock;
}
-void GlobalParams::setInitialZoom(char *s) {
+void GlobalParams::setInitialZoom(const char *s) {
globalParamsLock;
delete initialZoom;
initialZoom = new GString(s);
globalParamsUnlock;
}
-GBool GlobalParams::setT1libControl(char *s) {
+GBool GlobalParams::setT1libControl(const char *s) {
GBool ok;
globalParamsLock;
return ok;
}
-GBool GlobalParams::setFreeTypeControl(char *s) {
+GBool GlobalParams::setFreeTypeControl(const char *s) {
GBool ok;
globalParamsLock;
return ok;
}
-GBool GlobalParams::setFontRastControl(FontRastControl *val, char *s) {
+GBool GlobalParams::setFontRastControl(FontRastControl *val, const char *s) {
if (!strcmp(s, "none")) {
*val = fontRastNone;
} else if (!strcmp(s, "plain")) {
};
DisplayFontParam(GString *nameA, DisplayFontParamKind kindA);
- DisplayFontParam(char *nameA, char *xlfdA, char *encodingA);
+ DisplayFontParam(const char *nameA, const char *xlfdA, const char *encodingA);
~DisplayFontParam();
};
// Initialize the global parameters by attempting to read a config
// file.
- GlobalParams(char *cfgFileName);
+ GlobalParams(const char *cfgFileName);
~GlobalParams();
//----- accessors
- CharCode getMacRomanCharCode(char *charName);
+ CharCode getMacRomanCharCode(const char *charName);
- Unicode mapNameToUnicode(char *charName);
+ Unicode mapNameToUnicode(const char *charName);
FILE *getCIDToUnicodeFile(GString *collection);
UnicodeMap *getResidentUnicodeMap(GString *encodingName);
FILE *getUnicodeMapFile(GString *encodingName);
GBool getPSASCIIHex();
EndOfLineKind getTextEOL();
GBool getTextKeepTinyChars();
- GString *findFontFile(GString *fontName, char *ext1, char *ext2);
+ GString *findFontFile(GString *fontName, const char *ext1, const char *ext2);
GString *getInitialZoom();
FontRastControl getT1libControl();
FontRastControl getFreeTypeControl();
//----- functions to set parameters
void addDisplayFont(DisplayFontParam *param);
- void setPSFile(char *file);
- GBool setPSPaperSize(char *size);
+ void setPSFile(const char *file);
+ GBool setPSPaperSize(const char *size);
void setPSImageableArea(int left, int bottom, int right, int top);
void setPSPaperWidth(int width);
void setPSPaperHeight(int height);
void setPSEmbedCIDTrueType(GBool embed);
void setPSOPI(GBool opi);
void setPSASCIIHex(GBool hex);
- void setTextEncoding(char *encodingName);
- GBool setTextEOL(char *s);
+ void setTextEncoding(const char *encodingName);
+ GBool setTextEOL(const char *s);
void setTextKeepTinyChars(GBool keep);
- void setInitialZoom(char *s);
- GBool setT1libControl(char *s);
- GBool setFreeTypeControl(char *s);
+ void setInitialZoom(const char *s);
+ GBool setT1libControl(const char *s);
+ GBool setFreeTypeControl(const char *s);
void setMapNumericCharNames(GBool map);
void setPrintCommands(GBool printCommandsA);
void setErrQuiet(GBool errQuietA);
void parsePSPaperSize(GList *tokens, GString *fileName, int line);
void parsePSLevel(GList *tokens, GString *fileName, int line);
void parsePSFont(GList *tokens, GString *fileName, int line);
- void parsePSFont16(char *cmdName, GList *fontList,
+ void parsePSFont16(const char *cmdName, GList *fontList,
GList *tokens, GString *fileName, int line);
void parseTextEncoding(GList *tokens, GString *fileName, int line);
void parseTextEOL(GList *tokens, GString *fileName, int line);
void parseFontDir(GList *tokens, GString *fileName, int line);
void parseInitialZoom(GList *tokens, GString *fileName, int line);
- void parseFontRastControl(char *cmdName, FontRastControl *val,
+ void parseFontRastControl(const char *cmdName, FontRastControl *val,
GList *tokens, GString *fileName, int line);
- void parseCommand(char *cmdName, GString **val,
+ void parseCommand(const char *cmdName, GString **val,
GList *tokens, GString *fileName, int line);
- void parseYesNo(char *cmdName, GBool *flag,
+ void parseYesNo(const char *cmdName, GBool *flag,
GList *tokens, GString *fileName, int line);
UnicodeMap *getUnicodeMap2(GString *encodingName);
- GBool setFontRastControl(FontRastControl *val, char *s);
+ GBool setFontRastControl(FontRastControl *val, const char *s);
//----- static tables
return EOF;
}
-GString *JBIG2Stream::getPSFilter(char *indent) {
+GString *JBIG2Stream::getPSFilter(const char *indent) {
return NULL;
}
virtual void reset();
virtual int getChar();
virtual int lookChar();
- virtual GString *getPSFilter(char *indent);
+ virtual GString *getPSFilter(const char *indent);
virtual GBool isBinary(GBool last = gTrue);
private:
#
-# "$Id: Makefile,v 1.6.2.8 2003/01/07 18:27:10 mike Exp $"
+# "$Id: Makefile,v 1.6.2.9 2003/05/14 18:22:50 mike Exp $"
#
# pdftops filter Makefile for the Common UNIX Printing System (CUPS).
#
include ../Makedefs
+OPTIONS = -Wwrite-strings
+
#
# Object files...
#
#
-# End of "$Id: Makefile,v 1.6.2.8 2003/01/07 18:27:10 mike Exp $".
+# End of "$Id: Makefile,v 1.6.2.9 2003/05/14 18:22:50 mike Exp $".
#
gfree(tab);
}
-void NameToCharCode::add(char *name, CharCode c) {
+void NameToCharCode::add(const char *name, CharCode c) {
NameToCharCodeEntry *oldTab;
int h, i, oldSize;
++len;
}
-CharCode NameToCharCode::lookup(char *name) {
+CharCode NameToCharCode::lookup(const char *name) {
int h;
h = hash(name);
return 0;
}
-int NameToCharCode::hash(char *name) {
- char *p;
+int NameToCharCode::hash(const char *name) {
+ const char *p;
unsigned int h;
h = 0;
NameToCharCode();
~NameToCharCode();
- void add(char *name, CharCode c);
- CharCode lookup(char *name);
+ void add(const char *name, CharCode c);
+ CharCode lookup(const char *name);
private:
- int hash(char *name);
+ int hash(const char *name);
NameToCharCodeEntry *tab;
int size;
static struct {
Unicode u;
- char *name;
+ const char *name;
} nameToUnicodeTab[] = {
{0x0021, "!"},
{0x0023, "#"},
// Object
//------------------------------------------------------------------------
-char *objTypeNames[numObjTypes] = {
+const char *objTypeNames[numObjTypes] = {
"boolean",
"integer",
"real",
type = objNone;
}
-char *Object::getTypeName() {
+const char *Object::getTypeName() {
return objTypeNames[type];
}
{ initObj(objReal); real = realA; return this; }
Object *initString(GString *stringA)
{ initObj(objString); string = stringA; return this; }
- Object *initName(char *nameA)
+ Object *initName(const char *nameA)
{ initObj(objName); name = copyString(nameA); return this; }
Object *initNull()
{ initObj(objNull); return this; }
Object *initStream(Stream *streamA);
Object *initRef(int numA, int genA)
{ initObj(objRef); ref.num = numA; ref.gen = genA; return this; }
- Object *initCmd(char *cmdA)
+ Object *initCmd(const char *cmdA)
{ initObj(objCmd); cmd = copyString(cmdA); return this; }
Object *initError()
{ initObj(objError); return this; }
GBool isNone() { return type == objNone; }
// Special type checking.
- GBool isName(char *nameA)
+ GBool isName(const char *nameA)
{ return type == objName && !strcmp(name, nameA); }
- GBool isDict(char *dictType);
- GBool isStream(char *dictType);
- GBool isCmd(char *cmdA)
+ GBool isDict(const char *dictType);
+ GBool isStream(const char *dictType);
+ GBool isCmd(const char *cmdA)
{ return type == objCmd && !strcmp(cmd, cmdA); }
// Accessors. NB: these assume object is of correct type.
// Dict accessors.
int dictGetLength();
- void dictAdd(char *key, Object *val);
- GBool dictIs(char *dictType);
- Object *dictLookup(char *key, Object *obj);
- Object *dictLookupNF(char *key, Object *obj);
- char *dictGetKey(int i);
+ void dictAdd(const char *key, Object *val);
+ GBool dictIs(const char *dictType);
+ Object *dictLookup(const char *key, Object *obj);
+ Object *dictLookupNF(const char *key, Object *obj);
+ const char *dictGetKey(int i);
Object *dictGetVal(int i, Object *obj);
Object *dictGetValNF(int i, Object *obj);
// Stream accessors.
- GBool streamIs(char *dictType);
+ GBool streamIs(const char *dictType);
void streamReset();
void streamClose();
int streamGetChar();
Dict *streamGetDict();
// Output.
- char *getTypeName();
+ const char *getTypeName();
void print(FILE *f = stdout);
// Memory testing.
inline int Object::dictGetLength()
{ return dict->getLength(); }
-inline void Object::dictAdd(char *key, Object *val)
+inline void Object::dictAdd(const char *key, Object *val)
{ dict->add(key, val); }
-inline GBool Object::dictIs(char *dictType)
+inline GBool Object::dictIs(const char *dictType)
{ return dict->is(dictType); }
-inline GBool Object::isDict(char *dictType)
+inline GBool Object::isDict(const char *dictType)
{ return type == objDict && dictIs(dictType); }
-inline Object *Object::dictLookup(char *key, Object *obj)
+inline Object *Object::dictLookup(const char *key, Object *obj)
{ return dict->lookup(key, obj); }
-inline Object *Object::dictLookupNF(char *key, Object *obj)
+inline Object *Object::dictLookupNF(const char *key, Object *obj)
{ return dict->lookupNF(key, obj); }
-inline char *Object::dictGetKey(int i)
+inline const char *Object::dictGetKey(int i)
{ return dict->getKey(i); }
inline Object *Object::dictGetVal(int i, Object *obj)
#include "Stream.h"
-inline GBool Object::streamIs(char *dictType)
+inline GBool Object::streamIs(const char *dictType)
{ return stream->getDict()->is(dictType); }
-inline GBool Object::isStream(char *dictType)
+inline GBool Object::isStream(const char *dictType)
{ return type == objStream && streamIs(dictType); }
inline void Object::streamReset()
// PostScript prolog and setup
//------------------------------------------------------------------------
-static char *prolog[] = {
+static const char *prolog[] = {
"/xpdf 75 dict def xpdf begin",
"% PDF special state",
"/pdfDictSize 14 def",
NULL
};
-static char *cmapProlog[] = {
+static const char *cmapProlog[] = {
"/CIDInit /ProcSet findresource begin",
"10 dict begin",
" begincmap",
//------------------------------------------------------------------------
struct PSSubstFont {
- char *psName; // PostScript name
+ const char *psName; // PostScript name
double mWidth; // width of 'm' character
};
-static char *psFonts[] = {
+static const char *psFonts[] = {
"Courier",
"Courier-Bold",
"Courier-Oblique",
typedef void (*SignalFunc)(int);
}
-static void outputToFile(void *stream, char *data, int len) {
+static void outputToFile(void *stream, const char *data, int len) {
fwrite(data, 1, len, (FILE *)stream);
}
-PSOutputDev::PSOutputDev(char *fileName, XRef *xrefA, Catalog *catalog,
+PSOutputDev::PSOutputDev(const char *fileName, XRef *xrefA, Catalog *catalog,
int firstPage, int lastPage, PSOutMode modeA) {
FILE *f;
PSFileType fileTypeA;
PDFRectangle *box;
Dict *resDict;
Annots *annots;
- char **p;
+ const char **p;
int pg;
Object obj1, obj2;
int i;
GString *name;
PSFontParam *fontParam;
GString *psNameStr;
- char *psName;
+ const char *psName;
char type3Name[64], buf[16];
UnicodeMap *uMap;
- char *charName;
+ const char *charName;
double xs, ys;
int code;
double w1, w2;
}
}
writePS("/");
- writePSName(charName ? charName : (char *)".notdef");
+ writePSName(charName ? charName : ".notdef");
}
- writePS((i == 256-8) ? (char *)"]\n" : (char *)"\n");
+ writePS((i == 256-8) ? "]\n" : "\n");
}
writePS("pdfMakeFont\n");
}
}
}
-void PSOutputDev::setupEmbeddedType1Font(Ref *id, char *psName) {
+void PSOutputDev::setupEmbeddedType1Font(Ref *id, const char *psName) {
static char hexChar[17] = "0123456789abcdef";
Object refObj, strObj, obj1, obj2;
Dict *dict;
//~ This doesn't handle .pfb files or binary eexec data (which only
//~ happens in pfb files?).
-void PSOutputDev::setupExternalType1Font(GString *fileName, char *psName) {
+void PSOutputDev::setupExternalType1Font(GString *fileName, const char *psName) {
FILE *fontFile;
int c;
int i;
}
void PSOutputDev::setupEmbeddedType1CFont(GfxFont *font, Ref *id,
- char *psName) {
+ const char *psName) {
char *fontBuf;
int fontLen;
Type1CFontFile *t1cFile;
}
void PSOutputDev::setupEmbeddedTrueTypeFont(GfxFont *font, Ref *id,
- char *psName) {
+ const char *psName) {
char *fontBuf;
int fontLen;
TrueTypeFontFile *ttFile;
writePS("%%EndResource\n");
}
-void PSOutputDev::setupExternalTrueTypeFont(GfxFont *font, char *psName) {
+void PSOutputDev::setupExternalTrueTypeFont(GfxFont *font, const char *psName) {
GString *fileName;
char *fontBuf;
int fontLen;
}
void PSOutputDev::setupEmbeddedCIDType0Font(GfxFont *font, Ref *id,
- char *psName) {
+ const char *psName) {
char *fontBuf;
int fontLen;
Type1CFontFile *t1cFile;
}
void PSOutputDev::setupEmbeddedCIDTrueTypeFont(GfxFont *font, Ref *id,
- char *psName) {
+ const char *psName) {
char *fontBuf;
int fontLen;
TrueTypeFontFile *ttFile;
writePS("%%EndResource\n");
}
-void PSOutputDev::setupType3Font(GfxFont *font, char *psName,
+void PSOutputDev::setupType3Font(GfxFont *font, const char *psName,
Dict *parentResDict) {
Dict *resDict;
Dict *charProcs;
}
}
-void PSOutputDev::writePS(char *s) {
+void PSOutputDev::writePS(const char *s) {
if (t3String) {
t3String->append(s);
} else {
writePSChar(')');
}
-void PSOutputDev::writePSName(char *s) {
- char *p;
+void PSOutputDev::writePSName(const char *s) {
+ const char *p;
char c;
p = s;
psGeneric // write to a generic stream
};
-typedef void (*PSOutputFunc)(void *stream, char *data, int len);
+typedef void (*PSOutputFunc)(void *stream, const char *data, int len);
class PSOutputDev: public OutputDev {
public:
// Open a PostScript output file, and write the prolog.
- PSOutputDev(char *fileName, XRef *xrefA, Catalog *catalog,
+ PSOutputDev(const char *fileName, XRef *xrefA, Catalog *catalog,
int firstPage, int lastPage, PSOutMode modeA);
// Open a PSOutputDev that will write to a generic stream.
void setupResources(Dict *resDict);
void setupFonts(Dict *resDict);
void setupFont(GfxFont *font, Dict *parentResDict);
- void setupEmbeddedType1Font(Ref *id, char *psName);
- void setupExternalType1Font(GString *fileName, char *psName);
- void setupEmbeddedType1CFont(GfxFont *font, Ref *id, char *psName);
- void setupEmbeddedTrueTypeFont(GfxFont *font, Ref *id, char *psName);
- void setupExternalTrueTypeFont(GfxFont *font, char *psName);
- void setupEmbeddedCIDType0Font(GfxFont *font, Ref *id, char *psName);
- void setupEmbeddedCIDTrueTypeFont(GfxFont *font, Ref *id, char *psName);
- void setupType3Font(GfxFont *font, char *psName, Dict *parentResDict);
+ void setupEmbeddedType1Font(Ref *id, const char *psName);
+ void setupExternalType1Font(GString *fileName, const char *psName);
+ void setupEmbeddedType1CFont(GfxFont *font, Ref *id, const char *psName);
+ void setupEmbeddedTrueTypeFont(GfxFont *font, Ref *id, const char *psName);
+ void setupExternalTrueTypeFont(GfxFont *font, const char *psName);
+ void setupEmbeddedCIDType0Font(GfxFont *font, Ref *id, const char *psName);
+ void setupEmbeddedCIDTrueTypeFont(GfxFont *font, Ref *id, const char *psName);
+ void setupType3Font(GfxFont *font, const char *psName, Dict *parentResDict);
void setupImages(Dict *resDict);
void setupImage(Ref id, Stream *str);
void addProcessColor(double c, double m, double y, double k);
GBool getFileSpec(Object *fileSpec, Object *fileName);
#endif
void writePSChar(char c);
- void writePS(char *s);
+ void writePS(const char *s);
void writePSFmt(const char *fmt, ...);
void writePSString(GString *s);
- void writePSName(char *s);
+ void writePSName(const char *s);
GString *filterPSName(GString *name);
PSLevel level; // PostScript level (1, 2, separation)
resources.free();
}
-GBool PageAttrs::readBox(Dict *dict, char *key, PDFRectangle *box) {
+GBool PageAttrs::readBox(Dict *dict, const char *key, PDFRectangle *box) {
PDFRectangle tmp;
Object obj1, obj2;
GBool ok;
private:
- GBool readBox(Dict *dict, char *key, PDFRectangle *box);
+ GBool readBox(Dict *dict, const char *key, PDFRectangle *box);
PDFRectangle mediaBox;
PDFRectangle cropBox;
return buf;
}
-GString *Stream::getPSFilter(char *indent) {
+GString *Stream::getPSFilter(const char *indent) {
return new GString();
}
return str;
}
-Stream *Stream::makeFilter(char *name, Stream *str, Object *params) {
+Stream *Stream::makeFilter(const char *name, Stream *str, Object *params) {
int pred; // parameters
int colors;
int bits;
return buf;
}
-GString *ASCIIHexStream::getPSFilter(char *indent) {
+GString *ASCIIHexStream::getPSFilter(const char *indent) {
GString *s;
if (!(s = str->getPSFilter(indent))) {
return b[index];
}
-GString *ASCII85Stream::getPSFilter(char *indent) {
+GString *ASCII85Stream::getPSFilter(const char *indent) {
GString *s;
if (!(s = str->getPSFilter(indent))) {
return code;
}
-GString *LZWStream::getPSFilter(char *indent) {
+GString *LZWStream::getPSFilter(const char *indent) {
GString *s;
if (pred) {
eof = gFalse;
}
-GString *RunLengthStream::getPSFilter(char *indent) {
+GString *RunLengthStream::getPSFilter(const char *indent) {
GString *s;
if (!(s = str->getPSFilter(indent))) {
return (inputBuf >> (inputBits - n)) & (0xffff >> (16 - n));
}
-GString *CCITTFaxStream::getPSFilter(char *indent) {
+GString *CCITTFaxStream::getPSFilter(const char *indent) {
GString *s;
char s1[50];
return (c1 << 8) + c2;
}
-GString *DCTStream::getPSFilter(char *indent) {
+GString *DCTStream::getPSFilter(const char *indent) {
GString *s;
if (!(s = str->getPSFilter(indent))) {
return c;
}
-GString *FlateStream::getPSFilter(char *indent) {
+GString *FlateStream::getPSFilter(const char *indent) {
return NULL;
}
}
GBool ASCIIHexEncoder::fillBuf() {
- static char *hex = "0123456789abcdef";
+ static const char hex[] = "0123456789abcdef";
int c;
if (eof) {
virtual void setPos(Guint pos, int dir = 0) = 0;
// Get PostScript command for the filter(s).
- virtual GString *getPSFilter(char *indent);
+ virtual GString *getPSFilter(const char *indent);
// Does this stream type potentially contain non-printable chars?
virtual GBool isBinary(GBool last = gTrue) = 0;
private:
- Stream *makeFilter(char *name, Stream *str, Object *params);
+ Stream *makeFilter(const char *name, Stream *str, Object *params);
int ref; // reference count
};
virtual int getChar()
{ int c = lookChar(); buf = EOF; return c; }
virtual int lookChar();
- virtual GString *getPSFilter(char *indent);
+ virtual GString *getPSFilter(const char *indent);
virtual GBool isBinary(GBool last = gTrue);
private:
virtual int getChar()
{ int ch = lookChar(); ++index; return ch; }
virtual int lookChar();
- virtual GString *getPSFilter(char *indent);
+ virtual GString *getPSFilter(const char *indent);
virtual GBool isBinary(GBool last = gTrue);
private:
virtual int getChar();
virtual int lookChar();
virtual int getRawChar();
- virtual GString *getPSFilter(char *indent);
+ virtual GString *getPSFilter(const char *indent);
virtual GBool isBinary(GBool last = gTrue);
private:
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
virtual int lookChar()
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
- virtual GString *getPSFilter(char *indent);
+ virtual GString *getPSFilter(const char *indent);
virtual GBool isBinary(GBool last = gTrue);
private:
virtual int getChar()
{ int c = lookChar(); buf = EOF; return c; }
virtual int lookChar();
- virtual GString *getPSFilter(char *indent);
+ virtual GString *getPSFilter(const char *indent);
virtual GBool isBinary(GBool last = gTrue);
private:
virtual void reset();
virtual int getChar();
virtual int lookChar();
- virtual GString *getPSFilter(char *indent);
+ virtual GString *getPSFilter(const char *indent);
virtual GBool isBinary(GBool last = gTrue);
Stream *getRawStream() { return str; }
virtual int getChar();
virtual int lookChar();
virtual int getRawChar();
- virtual GString *getPSFilter(char *indent);
+ virtual GString *getPSFilter(const char *indent);
virtual GBool isBinary(GBool last = gTrue);
private:
virtual void reset() {}
virtual int getChar() { return EOF; }
virtual int lookChar() { return EOF; }
- virtual GString *getPSFilter(char *indent) { return NULL; }
+ virtual GString *getPSFilter(const char *indent) { return NULL; }
virtual GBool isBinary(GBool last = gTrue) { return gFalse; }
};
virtual void close();
virtual int getChar();
virtual int lookChar();
- virtual GString *getPSFilter(char *indent) { return NULL; }
+ virtual GString *getPSFilter(const char *indent) { return NULL; }
virtual GBool isBinary(GBool last = gTrue) { return gFalse; }
virtual GBool isEncoder() { return gTrue; }
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
virtual int lookChar()
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
- virtual GString *getPSFilter(char *indent) { return NULL; }
+ virtual GString *getPSFilter(const char *indent) { return NULL; }
virtual GBool isBinary(GBool last = gTrue) { return gFalse; }
virtual GBool isEncoder() { return gTrue; }
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
virtual int lookChar()
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
- virtual GString *getPSFilter(char *indent) { return NULL; }
+ virtual GString *getPSFilter(const char *indent) { return NULL; }
virtual GBool isBinary(GBool last = gTrue) { return gFalse; }
virtual GBool isEncoder() { return gTrue; }
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); }
virtual int lookChar()
{ return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); }
- virtual GString *getPSFilter(char *indent) { return NULL; }
+ virtual GString *getPSFilter(const char *indent) { return NULL; }
virtual GBool isBinary(GBool last = gTrue) { return gFalse; }
virtual GBool isEncoder() { return gTrue; }
refCnt = 1;
}
-UnicodeMap::UnicodeMap(char *encodingNameA, GBool unicodeOutA,
+UnicodeMap::UnicodeMap(const char *encodingNameA, GBool unicodeOutA,
UnicodeMapRange *rangesA, int lenA) {
encodingName = new GString(encodingNameA);
unicodeOut = unicodeOutA;
refCnt = 1;
}
-UnicodeMap::UnicodeMap(char *encodingNameA, GBool unicodeOutA,
+UnicodeMap::UnicodeMap(const char *encodingNameA, GBool unicodeOutA,
UnicodeMapFunc funcA) {
encodingName = new GString(encodingNameA);
unicodeOut = unicodeOutA;
static UnicodeMap *parse(GString *encodingNameA);
// Create a resident UnicodeMap.
- UnicodeMap(char *encodingNameA, GBool unicodeOutA,
+ UnicodeMap(const char *encodingNameA, GBool unicodeOutA,
UnicodeMapRange *rangesA, int lenA);
// Create a resident UnicodeMap that uses a function instead of a
// list of ranges.
- UnicodeMap(char *encodingNameA, GBool unicodeOutA,
+ UnicodeMap(const char *encodingNameA, GBool unicodeOutA,
UnicodeMapFunc funcA);
~UnicodeMap();
return new GString();
}
-GString *appendToPath(GString *path, char *fileName) {
+GString *appendToPath(GString *path, const char *fileName) {
#if defined(VMS)
//---------- VMS ----------
//~ this should handle everything necessary for file
#endif
}
-GString *grabPath(char *fileName) {
+GString *grabPath(const char *fileName) {
#ifdef VMS
//---------- VMS ----------
char *p;
#endif
}
-GBool isAbsolutePath(char *path) {
+GBool isAbsolutePath(const char *path) {
#ifdef VMS
//---------- VMS ----------
return strchr(path, ':') ||
#endif
}
-time_t getModTime(char *fileName) {
+time_t getModTime(const char *fileName) {
#ifdef WIN32
//~ should implement this, but it's (currently) only used in xpdf
return 0;
#endif
}
-GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) {
+GBool openTempFile(GString **name, FILE **f, const char *mode, const char *ext) {
#if defined(WIN32)
//---------- Win32 ----------
char *s;
#endif
}
-GBool executeCommand(char *cmd) {
+GBool executeCommand(const char *cmd) {
#ifdef VMS
return system(cmd) ? gTrue : gFalse;
#else
// GDir and GDirEntry
//------------------------------------------------------------------------
-GDirEntry::GDirEntry(char *dirPath, char *nameA, GBool doStat) {
+GDirEntry::GDirEntry(const char *dirPath, const char *nameA, GBool doStat) {
#ifdef VMS
char *p;
#elif defined(WIN32)
delete name;
}
-GDir::GDir(char *name, GBool doStatA) {
+GDir::GDir(const char *name, GBool doStatA) {
path = new GString(name);
doStat = doStatA;
#if defined(WIN32)
// Append a file name to a path string. <path> may be an empty
// string, denoting the current directory). Returns <path>.
-extern GString *appendToPath(GString *path, char *fileName);
+extern GString *appendToPath(GString *path, const char *fileName);
// Grab the path from the front of the file name. If there is no
// directory component in <fileName>, returns an empty string.
-extern GString *grabPath(char *fileName);
+extern GString *grabPath(const char *fileName);
// Is this an absolute path or file name?
-extern GBool isAbsolutePath(char *path);
+extern GBool isAbsolutePath(const char *path);
// Make this path absolute by prepending current directory (if path is
// relative) or prepending user's directory (if path starts with '~').
// should be done to the returned file pointer; the file may be
// reopened later for reading, but not for writing. The <mode> string
// should be "w" or "wb". Returns true on success.
-extern GBool openTempFile(GString **name, FILE **f, char *mode, char *ext);
+extern GBool openTempFile(GString **name, FILE **f, const char *mode, const char *ext);
// Execute <command>. Returns true on success.
-extern GBool executeCommand(char *cmd);
+extern GBool executeCommand(const char *cmd);
// Just like fgets, but handles Unix, Mac, and/or DOS end-of-line
// conventions.
class GDirEntry {
public:
- GDirEntry(char *dirPath, char *nameA, GBool doStat);
+ GDirEntry(const char *dirPath, const char *nameA, GBool doStat);
~GDirEntry();
GString *getName() { return name; }
GBool isDir() { return dir; }
class GDir {
public:
- GDir(char *name, GBool doStatA = gTrue);
+ GDir(const char *name, GBool doStatA = gTrue);
~GDir();
GDirEntry *getNextEntry();
void rewind();
}
#endif
-char *copyString(char *s) {
+char *copyString(const char *s) {
char *s1;
s1 = (char *)gmalloc(strlen(s) + 1);
/*
* Allocate memory and copy a string into it.
*/
-extern char *copyString(char *s);
+extern char *copyString(const char *s);
#ifdef __cplusplus
}
void printUsage(char *program, char *otherArgs, ArgDesc *args) {
ArgDesc *arg;
- char *typ;
+ const char *typ;
int w, w1;
w = 0;