summaryrefslogtreecommitdiff
path: root/fofi
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2018-01-08 22:55:00 +0100
committerAlbert Astals Cid <aacid@kde.org>2018-01-08 22:55:00 +0100
commite428033c2d7efbbbf89bb2f84c8998521ac7ef8e (patch)
tree546f48df418659224c4500adc01fcddb4d9384a9 /fofi
parent2e47887616155dee566083e1aac9adab69aa4386 (diff)
Run clang-tidy with modernize nullptr
Also add two enum values in the qt5 frontend to representate no flags Also mark glib/gtk/cairo system includes so that gcc doesn't report the issues in those headers
Diffstat (limited to 'fofi')
-rw-r--r--fofi/FoFiBase.cc10
-rw-r--r--fofi/FoFiEncodings.cc396
-rw-r--r--fofi/FoFiIdentifier.cc2
-rw-r--r--fofi/FoFiTrueType.cc30
-rw-r--r--fofi/FoFiType1.cc18
-rw-r--r--fofi/FoFiType1C.cc28
6 files changed, 242 insertions, 242 deletions
diff --git a/fofi/FoFiBase.cc b/fofi/FoFiBase.cc
index c5823118..2fa71d13 100644
--- a/fofi/FoFiBase.cc
+++ b/fofi/FoFiBase.cc
@@ -57,29 +57,29 @@ char *FoFiBase::readFile(char *fileName, int *fileLen) {
if (!(f = fopen(fileName, "rb"))) {
error(errIO, -1, "Cannot open '{0:s}'", fileName);
- return NULL;
+ return nullptr;
}
if (fseek(f, 0, SEEK_END) != 0) {
error(errIO, -1, "Cannot seek to end of '{0:s}'", fileName);
fclose(f);
- return NULL;
+ return nullptr;
}
n = (int)ftell(f);
if (n < 0) {
error(errIO, -1, "Cannot determine length of '{0:s}'", fileName);
fclose(f);
- return NULL;
+ return nullptr;
}
if (fseek(f, 0, SEEK_SET) != 0) {
error(errIO, -1, "Cannot seek to start of '{0:s}'", fileName);
fclose(f);
- return NULL;
+ return nullptr;
}
buf = (char *)gmalloc(n);
if ((int)fread(buf, 1, n, f) != n) {
gfree(buf);
fclose(f);
- return NULL;
+ return nullptr;
}
fclose(f);
*fileLen = n;
diff --git a/fofi/FoFiEncodings.cc b/fofi/FoFiEncodings.cc
index 9fad1eba..96bd4e95 100644
--- a/fofi/FoFiEncodings.cc
+++ b/fofi/FoFiEncodings.cc
@@ -34,38 +34,38 @@
//------------------------------------------------------------------------
const char * const fofiType1StandardEncoding[256] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
"space",
"exclam",
"quotedbl",
@@ -161,40 +161,40 @@ const char * const fofiType1StandardEncoding[256] = {
"bar",
"braceright",
"asciitilde",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
"exclamdown",
"cent",
"sterling",
@@ -210,12 +210,12 @@ const char * const fofiType1StandardEncoding[256] = {
"guilsinglright",
"fi",
"fl",
- NULL,
+ nullptr,
"endash",
"dagger",
"daggerdbl",
"periodcentered",
- NULL,
+ nullptr,
"paragraph",
"bullet",
"quotesinglbase",
@@ -224,9 +224,9 @@ const char * const fofiType1StandardEncoding[256] = {
"guillemotright",
"ellipsis",
"perthousand",
- NULL,
+ nullptr,
"questiondown",
- NULL,
+ nullptr,
"grave",
"acute",
"circumflex",
@@ -235,100 +235,100 @@ const char * const fofiType1StandardEncoding[256] = {
"breve",
"dotaccent",
"dieresis",
- NULL,
+ nullptr,
"ring",
"cedilla",
- NULL,
+ nullptr,
"hungarumlaut",
"ogonek",
"caron",
"emdash",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
"AE",
- NULL,
+ nullptr,
"ordfeminine",
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
"Lslash",
"Oslash",
"OE",
"ordmasculine",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
"ae",
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
"dotlessi",
- NULL,
- NULL,
+ nullptr,
+ nullptr,
"lslash",
"oslash",
"oe",
"germandbls",
- NULL,
- NULL,
- NULL,
- NULL
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr
};
const char * const fofiType1ExpertEncoding[256] = {
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
"space",
"exclamsmall",
"Hungarumlautsmall",
- NULL,
+ nullptr,
"dollaroldstyle",
"dollarsuperior",
"ampersandsmall",
@@ -357,35 +357,35 @@ const char * const fofiType1ExpertEncoding[256] = {
"threequartersemdash",
"periodsuperior",
"questionsmall",
- NULL,
+ nullptr,
"asuperior",
"bsuperior",
"centsuperior",
"dsuperior",
"esuperior",
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
"isuperior",
- NULL,
- NULL,
+ nullptr,
+ nullptr,
"lsuperior",
"msuperior",
"nsuperior",
"osuperior",
- NULL,
- NULL,
+ nullptr,
+ nullptr,
"rsuperior",
"ssuperior",
"tsuperior",
- NULL,
+ nullptr,
"ff",
"fi",
"fl",
"ffi",
"ffl",
"parenleftinferior",
- NULL,
+ nullptr,
"parenrightinferior",
"Circumflexsmall",
"hyphensuperior",
@@ -420,67 +420,67 @@ const char * const fofiType1ExpertEncoding[256] = {
"onefitted",
"rupiah",
"Tildesmall",
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
"exclamdownsmall",
"centoldstyle",
"Lslashsmall",
- NULL,
- NULL,
+ nullptr,
+ nullptr,
"Scaronsmall",
"Zcaronsmall",
"Dieresissmall",
"Brevesmall",
"Caronsmall",
- NULL,
+ nullptr,
"Dotaccentsmall",
- NULL,
- NULL,
+ nullptr,
+ nullptr,
"Macronsmall",
- NULL,
- NULL,
+ nullptr,
+ nullptr,
"figuredash",
"hypheninferior",
- NULL,
- NULL,
+ nullptr,
+ nullptr,
"Ogoneksmall",
"Ringsmall",
"Cedillasmall",
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
"onequarter",
"onehalf",
"threequarters",
@@ -491,8 +491,8 @@ const char * const fofiType1ExpertEncoding[256] = {
"seveneighths",
"onethird",
"twothirds",
- NULL,
- NULL,
+ nullptr,
+ nullptr,
"zerosuperior",
"onesuperior",
"twosuperior",
diff --git a/fofi/FoFiIdentifier.cc b/fofi/FoFiIdentifier.cc
index 1e657ef2..3d41145b 100644
--- a/fofi/FoFiIdentifier.cc
+++ b/fofi/FoFiIdentifier.cc
@@ -190,7 +190,7 @@ FileReader *FileReader::make(char *fileName) {
FILE *fA;
if (!(fA = fopen(fileName, "rb"))) {
- return NULL;
+ return nullptr;
}
return new FileReader(fA);
}
diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc
index c663249d..76299acc 100644
--- a/fofi/FoFiTrueType.cc
+++ b/fofi/FoFiTrueType.cc
@@ -277,7 +277,7 @@ FoFiTrueType *FoFiTrueType::make(char *fileA, int lenA, int faceIndexA) {
ff = new FoFiTrueType(fileA, lenA, gFalse, faceIndexA);
if (!ff->parsedOk) {
delete ff;
- return NULL;
+ return nullptr;
}
return ff;
}
@@ -288,12 +288,12 @@ FoFiTrueType *FoFiTrueType::load(char *fileName, int faceIndexA) {
int lenA;
if (!(fileA = FoFiBase::readFile(fileName, &lenA))) {
- return NULL;
+ return nullptr;
}
ff = new FoFiTrueType(fileA, lenA, gTrue, faceIndexA);
if (!ff->parsedOk) {
delete ff;
- return NULL;
+ return nullptr;
}
return ff;
}
@@ -301,11 +301,11 @@ FoFiTrueType *FoFiTrueType::load(char *fileName, int faceIndexA) {
FoFiTrueType::FoFiTrueType(char *fileA, int lenA, GBool freeFileDataA, int faceIndexA):
FoFiBase(fileA, lenA, freeFileDataA)
{
- tables = NULL;
+ tables = nullptr;
nTables = 0;
- cmaps = NULL;
+ cmaps = nullptr;
nCmaps = 0;
- nameToGID = NULL;
+ nameToGID = nullptr;
parsedOk = gFalse;
faceIndex = faceIndexA;
gsubFeatureTable = 0;
@@ -472,10 +472,10 @@ int *FoFiTrueType::getCIDToGIDMap(int *nCIDs) {
*nCIDs = 0;
if (!getCFFBlock(&start, &length)) {
- return NULL;
+ return nullptr;
}
if (!(ff = FoFiType1C::make(start, length))) {
- return NULL;
+ return nullptr;
}
map = ff->getCIDToGIDMap(nCIDs);
delete ff;
@@ -556,7 +556,7 @@ void FoFiTrueType::convertToType42(char *psName, char **encoding,
// write the guts of the dictionary
cvtEncoding(encoding, outputFunc, outputStream);
cvtCharStrings(encoding, codeToGID, outputFunc, outputStream);
- cvtSfnts(outputFunc, outputStream, NULL, gFalse, &maxUsedGlyph);
+ cvtSfnts(outputFunc, outputStream, nullptr, gFalse, &maxUsedGlyph);
// end the dictionary and define the font
(*outputFunc)(outputStream, "FontName currentdict end definefont pop\n", 40);
@@ -701,7 +701,7 @@ void FoFiTrueType::convertToCIDType2(char *psName,
(*outputFunc)(outputStream, " end readonly def\n", 19);
// write the guts of the dictionary
- cvtSfnts(outputFunc, outputStream, NULL, needVerticalMetrics, &maxUsedGlyph);
+ cvtSfnts(outputFunc, outputStream, nullptr, needVerticalMetrics, &maxUsedGlyph);
// end the dictionary and define the font
(*outputFunc)(outputStream,
@@ -1061,7 +1061,7 @@ void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc,
++nNewTables;
}
}
- vmtxTab = NULL; // make gcc happy
+ vmtxTab = nullptr; // make gcc happy
vmtxTabLength = 0;
advance = 0; // make gcc happy
if (needVerticalMetrics) {
@@ -1387,7 +1387,7 @@ void FoFiTrueType::parse() {
nTables = j;
tables = (TrueTypeTable *)greallocn_checkoverflow(tables, nTables, sizeof(TrueTypeTable));
}
- if (!parsedOk || tables == NULL) {
+ if (!parsedOk || tables == nullptr) {
return;
}
@@ -1526,7 +1526,7 @@ void FoFiTrueType::readPostTable() {
err:
if (nameToGID) {
delete nameToGID;
- nameToGID = NULL;
+ nameToGID = nullptr;
}
}
@@ -1570,7 +1570,7 @@ Guint FoFiTrueType::charToTag(const char *tagName)
*/
int FoFiTrueType::setupGSUB(const char *scriptName)
{
- return setupGSUB(scriptName, NULL);
+ return setupGSUB(scriptName, nullptr);
}
/*
@@ -1595,7 +1595,7 @@ int FoFiTrueType::setupGSUB(const char *scriptName,
int x;
Guint pos;
- if (scriptName == 0) {
+ if (scriptName == nullptr) {
gsubFeatureTable = 0;
return 0;
}
diff --git a/fofi/FoFiType1.cc b/fofi/FoFiType1.cc
index a73b77c2..dbe95b67 100644
--- a/fofi/FoFiType1.cc
+++ b/fofi/FoFiType1.cc
@@ -54,7 +54,7 @@ FoFiType1 *FoFiType1::load(char *fileName) {
int lenA;
if (!(fileA = FoFiBase::readFile(fileName, &lenA))) {
- return NULL;
+ return nullptr;
}
return new FoFiType1(fileA, lenA, gTrue);
}
@@ -62,8 +62,8 @@ FoFiType1 *FoFiType1::load(char *fileName) {
FoFiType1::FoFiType1(char *fileA, int lenA, GBool freeFileDataA):
FoFiBase(fileA, lenA, freeFileDataA)
{
- name = NULL;
- encoding = NULL;
+ name = nullptr;
+ encoding = nullptr;
fontMatrix[0] = 0.001;
fontMatrix[1] = 0;
fontMatrix[2] = 0;
@@ -150,7 +150,7 @@ void FoFiType1::writeEncoded(const char **newEncoding,
// skip "/Encoding" + one whitespace char,
// then look for 'def' preceded by PostScript whitespace
p = line + 10;
- line = NULL;
+ line = nullptr;
for (; p < (char *)file + len; ++p) {
if ((*p == ' ' || *p == '\t' || *p == '\x0a' ||
*p == '\x0d' || *p == '\x0c' || *p == '\0') &&
@@ -176,7 +176,7 @@ void FoFiType1::writeEncoded(const char **newEncoding,
// skip "/Encoding" + one whitespace char,
// then look for 'def' preceded by PostScript whitespace
p = line2 + 10;
- line = NULL;
+ line = nullptr;
for (; p < (char *)file + len; ++p) {
if ((*p == ' ' || *p == '\t' || *p == '\x0a' ||
*p == '\x0d' || *p == '\x0c' || *p == '\0') &&
@@ -207,7 +207,7 @@ char *FoFiType1::getNextLine(char *line) {
++line;
}
if (line >= (char *)file + len) {
- return NULL;
+ return nullptr;
}
return line;
}
@@ -243,7 +243,7 @@ void FoFiType1::parse() {
!strncmp(line, "/Encoding 256 array", 19)) {
encoding = (char **)gmallocn(256, sizeof(char *));
for (j = 0; j < 256; ++j) {
- encoding[j] = NULL;
+ encoding[j] = nullptr;
}
continueLine = gFalse;
for (j = 0, line = getNextLine(line);
@@ -324,7 +324,7 @@ void FoFiType1::parse() {
}
} else {
if (strtok_r(buf, " \t", &tokptr) &&
- (p = strtok_r(NULL, " \t\n\r", &tokptr)) && !strcmp(p, "def")) {
+ (p = strtok_r(nullptr, " \t\n\r", &tokptr)) && !strcmp(p, "def")) {
break;
}
}
@@ -339,7 +339,7 @@ void FoFiType1::parse() {
if ((p2 = strchr(p, ']'))) {
*p2 = '\0';
for (j = 0; j < 6; ++j) {
- if ((p = strtok(j == 0 ? p : (char *)NULL, " \t\n\r"))) {
+ if ((p = strtok(j == 0 ? p : (char *)nullptr, " \t\n\r"))) {
fontMatrix[j] = atof(p);
} else {
break;
diff --git a/fofi/FoFiType1C.cc b/fofi/FoFiType1C.cc
index 7c9494f5..03e77993 100644
--- a/fofi/FoFiType1C.cc
+++ b/fofi/FoFiType1C.cc
@@ -51,7 +51,7 @@ FoFiType1C *FoFiType1C::make(char *fileA, int lenA) {
ff = new FoFiType1C(fileA, lenA, gFalse);
if (!ff->parse()) {
delete ff;
- return NULL;
+ return nullptr;
}
return ff;
}
@@ -62,12 +62,12 @@ FoFiType1C *FoFiType1C::load(char *fileName) {
int lenA;
if (!(fileA = FoFiBase::readFile(fileName, &lenA))) {
- return NULL;
+ return nullptr;
}
ff = new FoFiType1C(fileA, lenA, gTrue);
if (!ff->parse()) {
delete ff;
- return NULL;
+ return nullptr;
}
return ff;
}
@@ -75,11 +75,11 @@ FoFiType1C *FoFiType1C::load(char *fileName) {
FoFiType1C::FoFiType1C(char *fileA, int lenA, GBool freeFileDataA):
FoFiBase(fileA, lenA, freeFileDataA)
{
- name = NULL;
- encoding = NULL;
- privateDicts = NULL;
- fdSelect = NULL;
- charset = NULL;
+ name = nullptr;
+ encoding = nullptr;
+ privateDicts = nullptr;
+ fdSelect = nullptr;
+ charset = nullptr;
charsetLength = 0;
}
@@ -112,7 +112,7 @@ FoFiType1C::~FoFiType1C() {
}
char *FoFiType1C::getName() {
- return name ? name->getCString() : (char *)NULL;
+ return name ? name->getCString() : (char *)nullptr;
}
char **FoFiType1C::getEncoding() {
@@ -125,10 +125,10 @@ GooString *FoFiType1C::getGlyphName(int gid) {
ok = gTrue;
if (gid < 0 || gid >= charsetLength)
- return NULL;
+ return nullptr;
getString(charset[gid], buf, &ok);
if (!ok) {
- return NULL;
+ return nullptr;
}
return new GooString(buf);
}
@@ -140,7 +140,7 @@ int *FoFiType1C::getCIDToGIDMap(int *nCIDs) {
// a CID font's top dict has ROS as the first operator
if (topDict.firstOp != 0x0c1e) {
*nCIDs = 0;
- return NULL;
+ return nullptr;
}
// in a CID font, the charset data is the GID-to-CID mapping, so all
@@ -2412,7 +2412,7 @@ void FoFiType1C::buildEncoding() {
} else {
encoding = (char **)gmallocn(256, sizeof(char *));
for (i = 0; i < 256; ++i) {
- encoding[i] = NULL;
+ encoding[i] = nullptr;
}
pos = topDict.encodingOffset;
encFormat = getU8(pos++, &parsedOk);
@@ -2545,7 +2545,7 @@ GBool FoFiType1C::readCharset() {
}
if (!parsedOk) {
gfree(charset);
- charset = NULL;
+ charset = nullptr;
charsetLength = 0;
return gFalse;
}