Commit 82cd404f authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Make compilation give less warnings, i'm sending that patch upstream to xpdf...

Make compilation give less warnings, i'm sending that patch upstream to xpdf author to see if he adds it to the source of the "problems"

svn path=/trunk/kdegraphics/kpdf/; revision=340184
parent 3503ef9d
......@@ -19,7 +19,7 @@
//------------------------------------------------------------------------
typedef void (*FoFiOutputFunc)(void *stream, char *data, int len);
typedef void (*FoFiOutputFunc)(void *stream, const char *data, int len);
//------------------------------------------------------------------------
// FoFiBase
......
......@@ -19,7 +19,7 @@
// Type 1 and 1C font data
//------------------------------------------------------------------------
char *fofiType1StandardEncoding[256] = {
const char *fofiType1StandardEncoding[256] = {
NULL,
NULL,
NULL,
......@@ -278,7 +278,7 @@ char *fofiType1StandardEncoding[256] = {
NULL
};
char *fofiType1ExpertEncoding[256] = {
const char *fofiType1ExpertEncoding[256] = {
NULL,
NULL,
NULL,
......@@ -541,7 +541,7 @@ char *fofiType1ExpertEncoding[256] = {
// Type 1C font data
//------------------------------------------------------------------------
char *fofiType1CStdStrings[391] = {
const char *fofiType1CStdStrings[391] = {
".notdef",
"space",
"exclam",
......
......@@ -21,14 +21,14 @@
// Type 1 and 1C font data
//------------------------------------------------------------------------
extern char *fofiType1StandardEncoding[256];
extern char *fofiType1ExpertEncoding[256];
extern const char *fofiType1StandardEncoding[256];
extern const char *fofiType1ExpertEncoding[256];
//------------------------------------------------------------------------
// Type 1C font data
//------------------------------------------------------------------------
extern char *fofiType1CStdStrings[391];
extern const char *fofiType1CStdStrings[391];
extern Gushort fofiType1CISOAdobeCharset[229];
extern Gushort fofiType1CExpertCharset[166];
extern Gushort fofiType1CExpertSubsetCharset[87];
......
......@@ -133,7 +133,7 @@ static int cmpTrueTypeTableTag(const void *p1, const void *p2) {
//------------------------------------------------------------------------
struct T42Table {
char *tag; // 4-byte tag
const char *tag; // 4-byte tag
GBool required; // required by the TrueType spec?
};
......@@ -161,7 +161,7 @@ static T42Table t42Tables[nT42Tables] = {
// Glyph names in some arbitrary standard order that Apple uses for
// their TrueType fonts.
static char *macGlyphNames[258] = {
static const char *macGlyphNames[258] = {
".notdef", "null", "CR", "space",
"exclam", "quotedbl", "numbersign", "dollar",
"percent", "ampersand", "quotesingle", "parenleft",
......@@ -374,7 +374,7 @@ Gushort FoFiTrueType::mapCodeToGID(int i, int c) {
return gid;
}
int FoFiTrueType::mapNameToGID(char *name) {
int FoFiTrueType::mapNameToGID(const char *name) {
if (!nameToGID) {
return 0;
}
......@@ -405,7 +405,7 @@ int FoFiTrueType::getEmbeddingRights() {
return 3;
}
void FoFiTrueType::convertToType42(char *psName, char **encoding,
void FoFiTrueType::convertToType42(char *psName, const char **encoding,
Gushort *codeToGID,
FoFiOutputFunc outputFunc,
void *outputStream) {
......@@ -896,10 +896,10 @@ void FoFiTrueType::writeTTF(FoFiOutputFunc outputFunc,
gfree(locaTable);
}
void FoFiTrueType::cvtEncoding(char **encoding,
void FoFiTrueType::cvtEncoding(const char **encoding,
FoFiOutputFunc outputFunc,
void *outputStream) {
char *name;
const char *name;
char buf[64];
int i;
......@@ -923,11 +923,11 @@ void FoFiTrueType::cvtEncoding(char **encoding,
(*outputFunc)(outputStream, "readonly def\n", 13);
}
void FoFiTrueType::cvtCharStrings(char **encoding,
void FoFiTrueType::cvtCharStrings(const char **encoding,
Gushort *codeToGID,
FoFiOutputFunc outputFunc,
void *outputStream) {
char *name;
const char *name;
char buf[64], buf2[16];
int i, k;
......@@ -1421,7 +1421,7 @@ void FoFiTrueType::readPostTable() {
}
}
int FoFiTrueType::seekTable(char *tag) {
int FoFiTrueType::seekTable(const char *tag) {
Guint tagI;
int i;
......
......@@ -56,7 +56,7 @@ public:
// Returns the GID corresponding to <name> according to the post
// table. Returns 0 if there is no mapping for <name> or if the
// font does not have a post table.
int mapNameToGID(char *name);
int mapNameToGID(const char *name);
// Returns the least restrictive embedding licensing right (as
// defined by the TrueType spec):
......@@ -73,7 +73,7 @@ public:
// <encoding> array specifies the mapping from char codes to names.
// If <encoding> is NULL, the encoding is unknown or undefined. The
// <codeToGID> array specifies the mapping from char codes to GIDs.
void convertToType42(char *psName, char **encoding,
void convertToType42(char *psName, const char **encoding,
Gushort *codeToGID,
FoFiOutputFunc outputFunc, void *outputStream);
......@@ -101,10 +101,10 @@ public:
private:
FoFiTrueType(char *fileA, int lenA, GBool freeFileDataA);
void cvtEncoding(char **encoding,
void cvtEncoding(const char **encoding,
FoFiOutputFunc outputFunc,
void *outputStream);
void cvtCharStrings(char **encoding,
void cvtCharStrings(const char **encoding,
Gushort *codeToGID,
FoFiOutputFunc outputFunc,
void *outputStream);
......@@ -116,7 +116,7 @@ private:
Guint computeTableChecksum(Guchar *data, int length);
void parse();
void readPostTable();
int seekTable(char *tag);
int seekTable(const char *tag);
TrueTypeTable *tables;
int nTables;
......
......@@ -48,24 +48,24 @@ FoFiType1::~FoFiType1() {
int i;
if (name) {
gfree(name);
gfree((void*)name);
}
if (encoding && encoding != fofiType1StandardEncoding) {
for (i = 0; i < 256; ++i) {
gfree(encoding[i]);
gfree((void*)encoding[i]);
}
gfree(encoding);
}
}
char *FoFiType1::getName() {
const char *FoFiType1::getName() {
if (!parsed) {
parse();
}
return name;
}
char **FoFiType1::getEncoding() {
const char **FoFiType1::getEncoding() {
if (!parsed) {
parse();
}
......@@ -156,7 +156,7 @@ void FoFiType1::parse() {
encoding = fofiType1StandardEncoding;
} else if (!encoding &&
!strncmp(line, "/Encoding 256 array", 19)) {
encoding = (char **)gmalloc(256 * sizeof(char *));
encoding = (const char **)gmalloc(256 * sizeof(char *));
for (j = 0; j < 256; ++j) {
encoding[j] = NULL;
}
......
......@@ -34,11 +34,11 @@ public:
virtual ~FoFiType1();
// Return the font name.
char *getName();
const char *getName();
// Return the encoding, as an array of 256 names (any of which may
// be NULL).
char **getEncoding();
const char **getEncoding();
// Write a version of the Type 1 font file with a new encoding.
void writeEncoded(char **newEncoding,
......@@ -51,8 +51,8 @@ private:
char *getNextLine(char *line);
void parse();
char *name;
char **encoding;
const char *name;
const char **encoding;
GBool parsed;
};
......
......@@ -75,7 +75,7 @@ FoFiType1C::~FoFiType1C() {
encoding != fofiType1StandardEncoding &&
encoding != fofiType1ExpertEncoding) {
for (i = 0; i < 256; ++i) {
gfree(encoding[i]);
gfree((void*)encoding[i]);
}
gfree(encoding);
}
......@@ -97,7 +97,7 @@ char *FoFiType1C::getName() {
return name ? name->getCString() : (char *)NULL;
}
char **FoFiType1C::getEncoding() {
const char **FoFiType1C::getEncoding() {
return encoding;
}
......@@ -129,14 +129,14 @@ Gushort *FoFiType1C::getCIDToGIDMap(int *nCIDs) {
return map;
}
void FoFiType1C::convertToType1(char **newEncoding, GBool ascii,
void FoFiType1C::convertToType1(const char **newEncoding, GBool ascii,
FoFiOutputFunc outputFunc,
void *outputStream) {
Type1CEexecBuf eb;
Type1CIndex subrIdx;
Type1CIndexVal val;
char buf[512];
char **enc;
const char **enc;
GBool ok;
int i;
......@@ -908,7 +908,7 @@ void FoFiType1C::convertToType0(char *psName,
gfree(cidMap);
}
void FoFiType1C::eexecCvtGlyph(Type1CEexecBuf *eb, char *glyphName,
void FoFiType1C::eexecCvtGlyph(Type1CEexecBuf *eb, const char *glyphName,
int offset, int nBytes,
Type1CIndex *subrIdx,
Type1CPrivateDict *pDict) {
......@@ -1600,7 +1600,7 @@ void FoFiType1C::cvtNum(double x, GBool isFP, GString *charBuf) {
charBuf->append((char *)buf, n);
}
void FoFiType1C::eexecWrite(Type1CEexecBuf *eb, char *s) {
void FoFiType1C::eexecWrite(Type1CEexecBuf *eb, const char *s) {
Guchar *p;
Guchar x;
......@@ -2049,7 +2049,7 @@ void FoFiType1C::buildEncoding() {
encoding = fofiType1ExpertEncoding;
} else {
encoding = (char **)gmalloc(256 * sizeof(char *));
encoding = (const char **)gmalloc(256 * sizeof(char *));
for (i = 0; i < 256; ++i) {
encoding[i] = NULL;
}
......@@ -2072,7 +2072,7 @@ void FoFiType1C::buildEncoding() {
return;
}
if (encoding[c]) {
gfree(encoding[c]);
gfree((void*)encoding[c]);
}
encoding[c] = copyString(getString(charset[i], buf, &parsedOk));
}
......@@ -2091,7 +2091,7 @@ void FoFiType1C::buildEncoding() {
for (j = 0; j <= nLeft && nCodes < nGlyphs; ++j) {
if (c < 256) {
if (encoding[c]) {
gfree(encoding[c]);
gfree((void*)encoding[c]);
}
encoding[c] = copyString(getString(charset[nCodes], buf,
&parsedOk));
......@@ -2117,7 +2117,7 @@ void FoFiType1C::buildEncoding() {
return;
}
if (encoding[c]) {
gfree(encoding[c]);
gfree((void*)encoding[c]);
}
encoding[c] = copyString(getString(sid, buf, &parsedOk));
}
......
......@@ -142,7 +142,7 @@ public:
// Return the encoding, as an array of 256 names (any of which may
// be NULL). This is only useful with 8-bit fonts.
char **getEncoding();
const char **getEncoding();
// Return the mapping from CIDs to GIDs, and return the number of
// CIDs in *<nCIDs>. This is only useful for CID fonts.
......@@ -153,7 +153,7 @@ public:
// not NULL, it will be used in place of the encoding in the Type 1C
// font. If <ascii> is true the eexec section will be hex-encoded,
// otherwise it will be left as binary data.
void convertToType1(char **newEncoding, GBool ascii,
void convertToType1(const char **newEncoding, GBool ascii,
FoFiOutputFunc outputFunc, void *outputStream);
// Convert to a Type 0 CIDFont, suitable for embedding in a
......@@ -171,7 +171,7 @@ public:
private:
FoFiType1C(char *fileA, int lenA, GBool freeFileDataA);
void eexecCvtGlyph(Type1CEexecBuf *eb, char *glyphName,
void eexecCvtGlyph(Type1CEexecBuf *eb, const char *glyphName,
int offset, int nBytes,
Type1CIndex *subrIdx,
Type1CPrivateDict *pDict);
......@@ -181,7 +181,7 @@ private:
void cvtGlyphWidth(GBool useOp, GString *charBuf,
Type1CPrivateDict *pDict);
void cvtNum(double x, GBool isFP, GString *charBuf);
void eexecWrite(Type1CEexecBuf *eb, char *s);
void eexecWrite(Type1CEexecBuf *eb, const char *s);
void eexecWriteCharstring(Type1CEexecBuf *eb, Guchar *s, int n);
GBool parse();
void readTopDict();
......@@ -198,7 +198,7 @@ private:
char *getString(int sid, char *buf, GBool *ok);
GString *name;
char **encoding;
const char **encoding;
Type1CIndex nameIdx;
Type1CIndex topDictIdx;
......
......@@ -131,7 +131,7 @@ void *GHash::lookup(char *key) {
return p->val.p;
}
int GHash::lookupInt(char *key) {
int GHash::lookupInt(const char *key) {
GHashBucket *p;
int h;
......@@ -210,7 +210,7 @@ void *GHash::remove(char *key) {
return val;
}
int GHash::removeInt(char *key) {
int GHash::removeInt(const char *key) {
GHashBucket *p;
GHashBucket **q;
int val;
......@@ -320,7 +320,7 @@ GHashBucket *GHash::find(GString *key, int *h) {
return NULL;
}
GHashBucket *GHash::find(char *key, int *h) {
GHashBucket *GHash::find(const char *key, int *h) {
GHashBucket *p;
*h = hash(key);
......@@ -344,8 +344,8 @@ int GHash::hash(GString *key) {
return (int)(h % size);
}
int GHash::hash(char *key) {
char *p;
int GHash::hash(const char *key) {
const char *p;
unsigned int h;
h = 0;
......
......@@ -33,11 +33,11 @@ public:
void *lookup(GString *key);
int lookupInt(GString *key);
void *lookup(char *key);
int lookupInt(char *key);
int lookupInt(const char *key);
void *remove(GString *key);
int removeInt(GString *key);
void *remove(char *key);
int removeInt(char *key);
int removeInt(const char *key);
int getLength() { return len; }
void startIter(GHashIter **iter);
GBool getNext(GHashIter **iter, GString **key, void **val);
......@@ -48,9 +48,9 @@ private:
void expand();
GHashBucket *find(GString *key, int *h);
GHashBucket *find(char *key, int *h);
GHashBucket *find(const char *key, int *h);
int hash(GString *key);
int hash(char *key);
int hash(const char *key);
GBool deleteKeys; // set if key strings should be deleted
int size; // number of buckets
......
......@@ -102,7 +102,7 @@ GString *getCurrentDir() {
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
......@@ -437,7 +437,7 @@ time_t getModTime(char *fileName) {
#endif
}
GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) {
GBool openTempFile(GString **name, FILE **f, const char *mode, char *ext) {
#if defined(WIN32)
//---------- Win32 ----------
char *s;
......
......@@ -60,7 +60,7 @@ extern GString *getCurrentDir();
// 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.
......@@ -83,7 +83,7 @@ extern time_t getModTime(char *fileName);
// 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, char *ext);
// Execute <command>. Returns true on success.
extern GBool executeCommand(char *cmd);
......
......@@ -195,7 +195,7 @@ void gMemReport(FILE *f) {
}
#endif
char *copyString(char *s) {
const char *copyString(const char *s) {
char *s1;
s1 = (char *)gmalloc(strlen(s) + 1);
......
......@@ -44,7 +44,7 @@ extern void gMemReport(FILE *f);
/*
* Allocate memory and copy a string into it.
*/
extern char *copyString(char *s);
extern const char *copyString(const char *s);
#ifdef __cplusplus
}
......
......@@ -39,7 +39,7 @@ BuiltinFontWidths::~BuiltinFontWidths() {
gfree(tab);
}
GBool BuiltinFontWidths::getWidth(char *name, Gushort *width) {
GBool BuiltinFontWidths::getWidth(const char *name, Gushort *width) {
int h;
BuiltinFontWidth *p;
......@@ -53,8 +53,8 @@ GBool BuiltinFontWidths::getWidth(char *name, Gushort *width) {
return gFalse;
}
int BuiltinFontWidths::hash(char *name) {
char *p;
int BuiltinFontWidths::hash(const char *name) {
const char *p;
unsigned int h;
h = 0;
......
......@@ -23,8 +23,8 @@ class BuiltinFontWidths;
//------------------------------------------------------------------------
struct BuiltinFont {
char *name;
char **defaultBaseEnc;
const char *name;
const char **defaultBaseEnc;
short ascent;
short descent;
short bbox[4];
......@@ -34,7 +34,7 @@ struct BuiltinFont {
//------------------------------------------------------------------------
struct BuiltinFontWidth {
char *name;
const char *name;
Gushort width;
BuiltinFontWidth *next;
};
......@@ -44,11 +44,11 @@ public:
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;
......
......@@ -73,7 +73,7 @@ private:
CMapVectorEntry *vector; // vector for first byte (NULL for
// identity CMap)
int refCnt;
#ifdef MULTITHREADED
#if MULTITHREADED
GMutex mutex;
#endif
};
......
......@@ -83,7 +83,7 @@ private:
CharCodeToUnicodeString *sMap;
int sMapLen, sMapSize;
int refCnt;
#ifdef MULTITHREADED
#if MULTITHREADED
GMutex mutex;
#endif
};
......
......@@ -123,7 +123,7 @@ GBool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength,
permissions, fileID, userPassword, fileKey);
}
GBool Decrypt::makeFileKey2(int encVersion, int encRevision, int keyLength,
GBool Decrypt::makeFileKey2(int /*encVersion*/, int encRevision, int keyLength,
GString *ownerKey, GString *userKey,
int permissions, GString *fileID,
GString *userPassword, Guchar *fileKey) {
......
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