From 51bb46766cc5b50d81227cd91e518bc78b0a944b Mon Sep 17 00:00:00 2001 From: Oliver Sander Date: Fri, 30 Nov 2018 18:02:01 +0100 Subject: Replace Guchar by unsigned char --- fofi/FoFiBase.cc | 2 +- fofi/FoFiBase.h | 2 +- fofi/FoFiTrueType.cc | 76 ++++++++++++++++++++++++++-------------------------- fofi/FoFiTrueType.h | 4 +-- fofi/FoFiType1.cc | 4 +-- fofi/FoFiType1C.cc | 44 +++++++++++++++--------------- fofi/FoFiType1C.h | 4 +-- 7 files changed, 68 insertions(+), 68 deletions(-) (limited to 'fofi') diff --git a/fofi/FoFiBase.cc b/fofi/FoFiBase.cc index ff1d92ca..bbe70b9a 100644 --- a/fofi/FoFiBase.cc +++ b/fofi/FoFiBase.cc @@ -35,7 +35,7 @@ //------------------------------------------------------------------------ FoFiBase::FoFiBase(const char *fileA, int lenA, bool freeFileDataA) { - file = (const Guchar *)fileA; + file = (const unsigned char *)fileA; len = lenA; freeFileData = freeFileDataA; } diff --git a/fofi/FoFiBase.h b/fofi/FoFiBase.h index 73842769..62c7e606 100644 --- a/fofi/FoFiBase.h +++ b/fofi/FoFiBase.h @@ -59,7 +59,7 @@ protected: bool checkRegion(int pos, int size) const; - const Guchar *file; + const unsigned char *file; int len; bool freeFileData; }; diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc index 06b724a8..2cc35c3f 100644 --- a/fofi/FoFiTrueType.cc +++ b/fofi/FoFiTrueType.cc @@ -936,16 +936,16 @@ void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc, void *outputStream, GooString *name, bool needVerticalMetrics, int *maxUsedGlyph) const { - Guchar headData[54]; + unsigned char headData[54]; TrueTypeLoca *locaTable; - Guchar *locaData; + unsigned char *locaData; TrueTypeTable newTables[nT42Tables]; - Guchar tableDir[12 + nT42Tables*16]; + unsigned char tableDir[12 + nT42Tables*16]; bool ok; Guint checksum; int nNewTables; int glyfTableLen, length, pos, glyfPos, i, j, k, vmtxTabLength; - Guchar vheaTab[36] = { + unsigned char vheaTab[36] = { 0, 1, 0, 0, // table version number 0, 0, // ascent 0, 0, // descent @@ -964,7 +964,7 @@ void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc, 0, 0, // metric data format 0, 1 // number of advance heights in vmtx table }; - Guchar *vmtxTab; + unsigned char *vmtxTab; bool needVhea, needVmtx; int advance; @@ -978,7 +978,7 @@ void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc, return; } memcpy(headData, file + pos, 54); - headData[8] = headData[9] = headData[10] = headData[11] = (Guchar)0; + headData[8] = headData[9] = headData[10] = headData[11] = (unsigned char)0; // check for a bogus loca format field in the 'head' table // (I've encountered fonts with loca format set to 0x0100 instead of 0x0001) @@ -1032,17 +1032,17 @@ void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc, } // construct the new 'loca' table - locaData = (Guchar *)gmallocn(nGlyphs + 1, (locaFmt ? 4 : 2)); + locaData = (unsigned char *)gmallocn(nGlyphs + 1, (locaFmt ? 4 : 2)); for (i = 0; i <= nGlyphs; ++i) { pos = locaTable[i].newOffset; if (locaFmt) { - locaData[4*i ] = (Guchar)(pos >> 24); - locaData[4*i+1] = (Guchar)(pos >> 16); - locaData[4*i+2] = (Guchar)(pos >> 8); - locaData[4*i+3] = (Guchar) pos; + locaData[4*i ] = (unsigned char)(pos >> 24); + locaData[4*i+1] = (unsigned char)(pos >> 16); + locaData[4*i+2] = (unsigned char)(pos >> 8); + locaData[4*i+3] = (unsigned char) pos; } else { - locaData[2*i ] = (Guchar)(pos >> 9); - locaData[2*i+1] = (Guchar)(pos >> 1); + locaData[2*i ] = (unsigned char)(pos >> 9); + locaData[2*i+1] = (unsigned char)(pos >> 1); } } @@ -1114,7 +1114,7 @@ void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc, } else if (needVerticalMetrics && i == t42VmtxTable) { length = 4 + (nGlyphs - 1) * 2; vmtxTabLength = length; - vmtxTab = (Guchar *)gmalloc(length); + vmtxTab = (unsigned char *)gmalloc(length); vmtxTab[0] = advance / 256; vmtxTab[1] = advance % 256; for (j = 2; j < length; j += 2) { @@ -1153,29 +1153,29 @@ void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc, tableDir[4] = 0; // numTables tableDir[5] = nNewTables; tableDir[6] = 0; // searchRange - tableDir[7] = (Guchar)128; + tableDir[7] = (unsigned char)128; tableDir[8] = 0; // entrySelector tableDir[9] = 3; tableDir[10] = 0; // rangeShift - tableDir[11] = (Guchar)(16 * nNewTables - 128); + tableDir[11] = (unsigned char)(16 * nNewTables - 128); pos = 12; for (i = 0; i < nNewTables; ++i) { - tableDir[pos ] = (Guchar)(newTables[i].tag >> 24); - tableDir[pos+ 1] = (Guchar)(newTables[i].tag >> 16); - tableDir[pos+ 2] = (Guchar)(newTables[i].tag >> 8); - tableDir[pos+ 3] = (Guchar) newTables[i].tag; - tableDir[pos+ 4] = (Guchar)(newTables[i].checksum >> 24); - tableDir[pos+ 5] = (Guchar)(newTables[i].checksum >> 16); - tableDir[pos+ 6] = (Guchar)(newTables[i].checksum >> 8); - tableDir[pos+ 7] = (Guchar) newTables[i].checksum; - tableDir[pos+ 8] = (Guchar)(newTables[i].offset >> 24); - tableDir[pos+ 9] = (Guchar)(newTables[i].offset >> 16); - tableDir[pos+10] = (Guchar)(newTables[i].offset >> 8); - tableDir[pos+11] = (Guchar) newTables[i].offset; - tableDir[pos+12] = (Guchar)(newTables[i].len >> 24); - tableDir[pos+13] = (Guchar)(newTables[i].len >> 16); - tableDir[pos+14] = (Guchar)(newTables[i].len >> 8); - tableDir[pos+15] = (Guchar) newTables[i].len; + tableDir[pos ] = (unsigned char)(newTables[i].tag >> 24); + tableDir[pos+ 1] = (unsigned char)(newTables[i].tag >> 16); + tableDir[pos+ 2] = (unsigned char)(newTables[i].tag >> 8); + tableDir[pos+ 3] = (unsigned char) newTables[i].tag; + tableDir[pos+ 4] = (unsigned char)(newTables[i].checksum >> 24); + tableDir[pos+ 5] = (unsigned char)(newTables[i].checksum >> 16); + tableDir[pos+ 6] = (unsigned char)(newTables[i].checksum >> 8); + tableDir[pos+ 7] = (unsigned char) newTables[i].checksum; + tableDir[pos+ 8] = (unsigned char)(newTables[i].offset >> 24); + tableDir[pos+ 9] = (unsigned char)(newTables[i].offset >> 16); + tableDir[pos+10] = (unsigned char)(newTables[i].offset >> 8); + tableDir[pos+11] = (unsigned char) newTables[i].offset; + tableDir[pos+12] = (unsigned char)(newTables[i].len >> 24); + tableDir[pos+13] = (unsigned char)(newTables[i].len >> 16); + tableDir[pos+14] = (unsigned char)(newTables[i].len >> 8); + tableDir[pos+15] = (unsigned char) newTables[i].len; pos += 16; } @@ -1185,10 +1185,10 @@ void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc, checksum += newTables[i].checksum; } checksum = 0xb1b0afba - checksum; // because the TrueType spec says so - headData[ 8] = (Guchar)(checksum >> 24); - headData[ 9] = (Guchar)(checksum >> 16); - headData[10] = (Guchar)(checksum >> 8); - headData[11] = (Guchar) checksum; + headData[ 8] = (unsigned char)(checksum >> 24); + headData[ 9] = (unsigned char)(checksum >> 16); + headData[10] = (unsigned char)(checksum >> 8); + headData[11] = (unsigned char) checksum; // start the sfnts array if (name) { @@ -1254,7 +1254,7 @@ void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc, } } -void FoFiTrueType::dumpString(const Guchar *s, int length, +void FoFiTrueType::dumpString(const unsigned char *s, int length, FoFiOutputFunc outputFunc, void *outputStream) const { GooString *buf; @@ -1283,7 +1283,7 @@ void FoFiTrueType::dumpString(const Guchar *s, int length, (*outputFunc)(outputStream, "00>\n", 4); } -Guint FoFiTrueType::computeTableChecksum(const Guchar *data, int length) const { +Guint FoFiTrueType::computeTableChecksum(const unsigned char *data, int length) const { Guint checksum, word; int i; diff --git a/fofi/FoFiTrueType.h b/fofi/FoFiTrueType.h index 3f2a1b7d..1f6f1f8a 100644 --- a/fofi/FoFiTrueType.h +++ b/fofi/FoFiTrueType.h @@ -177,10 +177,10 @@ private: void *outputStream, GooString *name, bool needVerticalMetrics, int *maxUsedGlyph) const; - void dumpString(const Guchar *s, int length, + void dumpString(const unsigned char *s, int length, FoFiOutputFunc outputFunc, void *outputStream) const; - Guint computeTableChecksum(const Guchar *data, int length) const; + Guint computeTableChecksum(const unsigned char *data, int length) const; void parse(); void readPostTable(); int seekTable(const char *tag) const; diff --git a/fofi/FoFiType1.cc b/fofi/FoFiType1.cc index 00fb9591..6fdeb4ec 100644 --- a/fofi/FoFiType1.cc +++ b/fofi/FoFiType1.cc @@ -366,7 +366,7 @@ void FoFiType1::parse() { // Undo the PFB encoding, i.e., remove the PFB headers. void FoFiType1::undoPFB() { bool ok; - Guchar *file2; + unsigned char *file2; int pos1, pos2, type; Guint segLen; @@ -374,7 +374,7 @@ void FoFiType1::undoPFB() { if (getU8(0, &ok) != 0x80 || !ok) { return; } - file2 = (Guchar *)gmalloc(len); + file2 = (unsigned char *)gmalloc(len); pos1 = pos2 = 0; while (getU8(pos1, &ok) == 0x80 && ok) { type = getU8(pos1 + 1, &ok); diff --git a/fofi/FoFiType1C.cc b/fofi/FoFiType1C.cc index 0ba0c135..39931fa6 100644 --- a/fofi/FoFiType1C.cc +++ b/fofi/FoFiType1C.cc @@ -1186,7 +1186,7 @@ void FoFiType1C::eexecCvtGlyph(Type1CEexecBuf *eb, const char *glyphName, buf = GooString::format("/{0:s} {1:d} RD ", glyphName, charBuf->getLength()); eexecWrite(eb, buf->c_str()); delete buf; - eexecWriteCharstring(eb, (Guchar *)charBuf->c_str(), + eexecWriteCharstring(eb, (unsigned char *)charBuf->c_str(), charBuf->getLength()); eexecWrite(eb, " ND\n"); @@ -1200,7 +1200,7 @@ void FoFiType1C::cvtGlyph(int offset, int nBytes, GooString *charBuf, bool ok, dFP; double d, dx, dy; Gushort r2; - Guchar byte; + unsigned char byte; int pos, subrBias, start, i, k; start = charBuf->getLength(); @@ -1848,7 +1848,7 @@ void FoFiType1C::cvtGlyphWidth(bool useOp, GooString *charBuf, } void FoFiType1C::cvtNum(double x, bool isFP, GooString *charBuf) const { - Guchar buf[12]; + unsigned char buf[12]; int y, n; n = 0; @@ -1856,10 +1856,10 @@ void FoFiType1C::cvtNum(double x, bool isFP, GooString *charBuf) const { if (x >= -32768 && x < 32768) { y = (int)(x * 256.0); buf[0] = 255; - buf[1] = (Guchar)(y >> 24); - buf[2] = (Guchar)(y >> 16); - buf[3] = (Guchar)(y >> 8); - buf[4] = (Guchar)y; + buf[1] = (unsigned char)(y >> 24); + buf[2] = (unsigned char)(y >> 16); + buf[3] = (unsigned char)(y >> 8); + buf[4] = (unsigned char)y; buf[5] = 255; buf[6] = 0; buf[7] = 0; @@ -1874,24 +1874,24 @@ void FoFiType1C::cvtNum(double x, bool isFP, GooString *charBuf) const { } else { y = (int)x; if (y >= -107 && y <= 107) { - buf[0] = (Guchar)(y + 139); + buf[0] = (unsigned char)(y + 139); n = 1; } else if (y > 107 && y <= 1131) { y -= 108; - buf[0] = (Guchar)((y >> 8) + 247); - buf[1] = (Guchar)(y & 0xff); + buf[0] = (unsigned char)((y >> 8) + 247); + buf[1] = (unsigned char)(y & 0xff); n = 2; } else if (y < -107 && y >= -1131) { y = -y - 108; - buf[0] = (Guchar)((y >> 8) + 251); - buf[1] = (Guchar)(y & 0xff); + buf[0] = (unsigned char)((y >> 8) + 251); + buf[1] = (unsigned char)(y & 0xff); n = 2; } else { buf[0] = 255; - buf[1] = (Guchar)(y >> 24); - buf[2] = (Guchar)(y >> 16); - buf[3] = (Guchar)(y >> 8); - buf[4] = (Guchar)y; + buf[1] = (unsigned char)(y >> 24); + buf[2] = (unsigned char)(y >> 16); + buf[3] = (unsigned char)(y >> 8); + buf[4] = (unsigned char)y; n = 5; } } @@ -1899,10 +1899,10 @@ void FoFiType1C::cvtNum(double x, bool isFP, GooString *charBuf) const { } void FoFiType1C::eexecWrite(Type1CEexecBuf *eb, const char *s) const { - Guchar *p; - Guchar x; + unsigned char *p; + unsigned char x; - for (p = (Guchar *)s; *p; ++p) { + for (p = (unsigned char *)s; *p; ++p) { x = *p ^ (eb->r1 >> 8); eb->r1 = (x + eb->r1) * 52845 + 22719; if (eb->ascii) { @@ -1920,8 +1920,8 @@ void FoFiType1C::eexecWrite(Type1CEexecBuf *eb, const char *s) const { } void FoFiType1C::eexecWriteCharstring(Type1CEexecBuf *eb, - const Guchar *s, int n) const { - Guchar x; + const unsigned char *s, int n) const { + unsigned char x; int i; // eexec encryption @@ -2360,7 +2360,7 @@ void FoFiType1C::readPrivateDict(int offset, int length, void FoFiType1C::readFDSelect() { int fdSelectFmt, pos, nRanges, gid0, gid1, fd, i, j; - fdSelect = (Guchar *)gmalloc(nGlyphs); + fdSelect = (unsigned char *)gmalloc(nGlyphs); if (topDict.fdSelectOffset == 0) { for (i = 0; i < nGlyphs; ++i) { fdSelect[i] = 0; diff --git a/fofi/FoFiType1C.h b/fofi/FoFiType1C.h index 0c7884fe..cc9a622d 100644 --- a/fofi/FoFiType1C.h +++ b/fofi/FoFiType1C.h @@ -216,7 +216,7 @@ private: Type1CPrivateDict *pDict); void cvtNum(double x, bool isFP, GooString *charBuf) const; void eexecWrite(Type1CEexecBuf *eb, const char *s) const; - void eexecWriteCharstring(Type1CEexecBuf *eb, const Guchar *s, int n) const; + void eexecWriteCharstring(Type1CEexecBuf *eb, const unsigned char *s, int n) const; void writePSString(const char *s, FoFiOutputFunc outputFunc, void *outputStream) const; bool parse(); void readTopDict(); @@ -246,7 +246,7 @@ private: int nGlyphs; int nFDs; - Guchar *fdSelect; + unsigned char *fdSelect; Gushort *charset; Gushort charsetLength; int gsubrBias; -- cgit v1.2.3