From 60ea2c106dd6520296ab1593a7236d43040ab1fd Mon Sep 17 00:00:00 2001
From: Sebastião Guerra <sebastiao.luiz.guerra@gmail.com>
Date: Sun, 15 Nov 2026 02:00:41 -0300
Subject: Use nullptr in Xpdf support libraries
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Group the small Goo, FoFi, and Splash libraries used by the Xpdf engine.

Signed-off-by: Sebastião Guerra <sebastiao.luiz.guerra@gmail.com>
---
 kpdf/xpdf/fofi/FoFiBase.cpp             |   4 +-
 kpdf/xpdf/fofi/FoFiEncodings.cpp        | 396 ++++++++++++++++----------------
 kpdf/xpdf/fofi/FoFiTrueType.cpp         |  32 +--
 kpdf/xpdf/fofi/FoFiTrueType.h           |   2 +-
 kpdf/xpdf/fofi/FoFiType1.cpp            |  14 +-
 kpdf/xpdf/goo/GHash.cpp                 |  24 +-
 kpdf/xpdf/goo/GMutex.h                  |   2 +-
 kpdf/xpdf/goo/GString.cpp               |  14 +-
 kpdf/xpdf/goo/gfile.cpp                 |  24 +-
 kpdf/xpdf/goo/gmem.cpp                  |  28 +--
 kpdf/xpdf/splash/Splash.cpp             |  36 +--
 kpdf/xpdf/splash/Splash.h               |   2 +-
 kpdf/xpdf/splash/SplashBitmap.cpp       |   2 +-
 kpdf/xpdf/splash/SplashClip.cpp         |  12 +-
 kpdf/xpdf/splash/SplashFTFont.cpp       |   8 +-
 kpdf/xpdf/splash/SplashFTFontEngine.cpp |  16 +-
 kpdf/xpdf/splash/SplashFTFontFile.cpp   |  12 +-
 kpdf/xpdf/splash/SplashFont.cpp         |   8 +-
 kpdf/xpdf/splash/SplashFontEngine.cpp   |  18 +-
 kpdf/xpdf/splash/SplashFontFile.cpp     |   4 +-
 kpdf/xpdf/splash/SplashPath.cpp         |   8 +-
 kpdf/xpdf/splash/SplashState.cpp        |  22 +-
 kpdf/xpdf/splash/SplashXPath.cpp        |  10 +-
 kpdf/xpdf/splash/SplashXPathScanner.cpp |   2 +-
 24 files changed, 350 insertions(+), 350 deletions(-)

diff --git a/kpdf/xpdf/fofi/FoFiBase.cpp b/kpdf/xpdf/fofi/FoFiBase.cpp
index af6fe112..5ccfddba 100644
--- a/kpdf/xpdf/fofi/FoFiBase.cpp
+++ b/kpdf/xpdf/fofi/FoFiBase.cpp
@@ -38,7 +38,7 @@ char *FoFiBase::readFile(char *fileName, int *fileLen) {
   int n;
 
   if (!(f = fopen(fileName, "rb"))) {
-    return NULL;
+    return nullptr;
   }
   fseek(f, 0, SEEK_END);
   n = (int)ftell(f);
@@ -47,7 +47,7 @@ char *FoFiBase::readFile(char *fileName, int *fileLen) {
   if ((int)fread(buf, 1, n, f) != n) {
     gfree(buf);
     fclose(f);
-    return NULL;
+    return nullptr;
   }
   fclose(f);
   *fileLen = n;
diff --git a/kpdf/xpdf/fofi/FoFiEncodings.cpp b/kpdf/xpdf/fofi/FoFiEncodings.cpp
index 3c0d39a3..0ccbf80f 100644
--- a/kpdf/xpdf/fofi/FoFiEncodings.cpp
+++ b/kpdf/xpdf/fofi/FoFiEncodings.cpp
@@ -20,38 +20,38 @@
 //------------------------------------------------------------------------
 
 char *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",
@@ -147,40 +147,40 @@ char *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",
@@ -196,12 +196,12 @@ char *fofiType1StandardEncoding[256] = {
   "guilsinglright",
   "fi",
   "fl",
-  NULL,
+  nullptr,
   "endash",
   "dagger",
   "daggerdbl",
   "periodcentered",
-  NULL,
+  nullptr,
   "paragraph",
   "bullet",
   "quotesinglbase",
@@ -210,9 +210,9 @@ char *fofiType1StandardEncoding[256] = {
   "guillemotright",
   "ellipsis",
   "perthousand",
-  NULL,
+  nullptr,
   "questiondown",
-  NULL,
+  nullptr,
   "grave",
   "acute",
   "circumflex",
@@ -221,100 +221,100 @@ char *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
 };
 
 char *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",
@@ -343,35 +343,35 @@ char *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",
@@ -406,67 +406,67 @@ char *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",
@@ -477,8 +477,8 @@ char *fofiType1ExpertEncoding[256] = {
   "seveneighths",
   "onethird",
   "twothirds",
-  NULL,
-  NULL,
+  nullptr,
+  nullptr,
   "zerosuperior",
   "onesuperior",
   "twosuperior",
diff --git a/kpdf/xpdf/fofi/FoFiTrueType.cpp b/kpdf/xpdf/fofi/FoFiTrueType.cpp
index 18253335..0ff90a3f 100644
--- a/kpdf/xpdf/fofi/FoFiTrueType.cpp
+++ b/kpdf/xpdf/fofi/FoFiTrueType.cpp
@@ -251,7 +251,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;
 }
@@ -262,12 +262,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;
 }
@@ -275,11 +275,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;
 
@@ -403,15 +403,15 @@ Gushort *FoFiTrueType::getCIDToGIDMap(int *nCIDs) {
 
   *nCIDs = 0;
   if (!openTypeCFF) {
-    return NULL;
+    return nullptr;
   }
   i = seekTable("CFF ");
   if (!checkRegion(tables[i].offset, tables[i].len)) {
-    return NULL;
+    return nullptr;
   }
   if (!(ff = FoFiType1C::make((char *)file + tables[i].offset,
 			      tables[i].len))) {
-    return NULL;
+    return nullptr;
   }
   map = ff->getCIDToGIDMap(nCIDs);
   delete ff;
@@ -476,7 +476,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);
+  cvtSfnts(outputFunc, outputStream, nullptr, gFalse);
 
   // end the dictionary and define the font
   (*outputFunc)(outputStream, "FontName currentdict end definefont pop\n", 40);
@@ -625,7 +625,7 @@ void FoFiTrueType::convertToCIDType2(char *psName,
   (*outputFunc)(outputStream, "  end readonly def\n", 19);
 
   // write the guts of the dictionary
-  cvtSfnts(outputFunc, outputStream, NULL, needVerticalMetrics);
+  cvtSfnts(outputFunc, outputStream, nullptr, needVerticalMetrics);
 
   // end the dictionary and define the font
   (*outputFunc)(outputStream,
@@ -1028,7 +1028,7 @@ void FoFiTrueType::writeTTF(FoFiOutputFunc outputFunc,
     }
   } else {
     newNameLen = 0;
-    newNameTab = NULL;
+    newNameTab = nullptr;
   }
 
   // construct the new cmap table
@@ -1085,7 +1085,7 @@ void FoFiTrueType::writeTTF(FoFiOutputFunc outputFunc,
     }
   } else {
     newCmapLen = 0;
-    newCmapTab = NULL;
+    newCmapTab = nullptr;
   }
 
   // generate the new hmtx table and the updated hhea table
@@ -1122,7 +1122,7 @@ void FoFiTrueType::writeTTF(FoFiOutputFunc outputFunc,
       newHMTXTab[4*i + 3] = lsb & 0xff;
     }
   } else {
-    newHHEATab = newHMTXTab = NULL;
+    newHHEATab = newHMTXTab = nullptr;
     newHHEALen = newHMTXLen = 0; // make gcc happy
   }
 
@@ -1551,7 +1551,7 @@ void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc,
       ++nNewTables;
     }
   }
-  vmtxTab = NULL; // make gcc happy
+  vmtxTab = nullptr; // make gcc happy
   advance = 0; // make gcc happy
   if (needVerticalMetrics) {
     needVhea = seekTable("vhea") < 0;
@@ -2019,7 +2019,7 @@ void FoFiTrueType::readPostTable() {
  err:
   if (nameToGID) {
     delete nameToGID;
-    nameToGID = NULL;
+    nameToGID = nullptr;
   }
 }
 
diff --git a/kpdf/xpdf/fofi/FoFiTrueType.h b/kpdf/xpdf/fofi/FoFiTrueType.h
index eadf5c9f..0907efb2 100644
--- a/kpdf/xpdf/fofi/FoFiTrueType.h
+++ b/kpdf/xpdf/fofi/FoFiTrueType.h
@@ -135,7 +135,7 @@ public:
   // complete and correct, it will be written unmodified.  (Not useful
   // for OpenType CFF fonts.)
   void writeTTF(FoFiOutputFunc outputFunc, void *outputStream,
-		char *name = NULL, Gushort *codeToGID = NULL);
+		char *name = nullptr, Gushort *codeToGID = nullptr);
 
 private:
 
diff --git a/kpdf/xpdf/fofi/FoFiType1.cpp b/kpdf/xpdf/fofi/FoFiType1.cpp
index f6e676a2..33937a00 100644
--- a/kpdf/xpdf/fofi/FoFiType1.cpp
+++ b/kpdf/xpdf/fofi/FoFiType1.cpp
@@ -31,7 +31,7 @@ FoFiType1 *FoFiType1::load(char *fileName) {
   int lenA;
 
   if (!(fileA = FoFiBase::readFile(fileName, &lenA))) {
-    return NULL;
+    return nullptr;
   }
   return new FoFiType1(fileA, lenA, gTrue);
 }
@@ -39,8 +39,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;
   parsed = gFalse;
 }
 
@@ -109,7 +109,7 @@ void FoFiType1::writeEncoded(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') &&
@@ -135,7 +135,7 @@ void FoFiType1::writeEncoded(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') &&
@@ -166,7 +166,7 @@ char *FoFiType1::getNextLine(char *line) {
     ++line;
   }
   if (line >= (char *)file + len) {
-    return NULL;
+    return nullptr;
   }
   return line;
 }
@@ -199,7 +199,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;
       }
       for (j = 0, line = getNextLine(line);
 	   j < 300 && line && (line1 = getNextLine(line));
diff --git a/kpdf/xpdf/goo/GHash.cpp b/kpdf/xpdf/goo/GHash.cpp
index f642a261..a621edca 100644
--- a/kpdf/xpdf/goo/GHash.cpp
+++ b/kpdf/xpdf/goo/GHash.cpp
@@ -41,7 +41,7 @@ GHash::GHash(GBool deleteKeysA) {
   size = 7;
   tab = (GHashBucket **)gmallocn(size, sizeof(GHashBucket *));
   for (h = 0; h < size; ++h) {
-    tab[h] = NULL;
+    tab[h] = nullptr;
   }
   len = 0;
 }
@@ -130,7 +130,7 @@ void *GHash::lookup(GString *key) {
   int h;
 
   if (!(p = find(key, &h))) {
-    return NULL;
+    return nullptr;
   }
   return p->val.p;
 }
@@ -150,7 +150,7 @@ void *GHash::lookup(char *key) {
   int h;
 
   if (!(p = find(key, &h))) {
-    return NULL;
+    return nullptr;
   }
   return p->val.p;
 }
@@ -172,7 +172,7 @@ void *GHash::remove(GString *key) {
   int h;
 
   if (!(p = find(key, &h))) {
-    return NULL;
+    return nullptr;
   }
   q = &tab[h];
   while (*q != p) {
@@ -218,7 +218,7 @@ void *GHash::remove(char *key) {
   int h;
 
   if (!(p = find(key, &h))) {
-    return NULL;
+    return nullptr;
   }
   q = &tab[h];
   while (*q != p) {
@@ -260,7 +260,7 @@ int GHash::removeInt(char *key) {
 void GHash::startIter(GHashIter **iter) {
   *iter = new GHashIter;
   (*iter)->h = -1;
-  (*iter)->p = NULL;
+  (*iter)->p = nullptr;
 }
 
 GBool GHash::getNext(GHashIter **iter, GString **key, void **val) {
@@ -273,7 +273,7 @@ GBool GHash::getNext(GHashIter **iter, GString **key, void **val) {
   while (!(*iter)->p) {
     if (++(*iter)->h == size) {
       delete *iter;
-      *iter = NULL;
+      *iter = nullptr;
       return gFalse;
     }
     (*iter)->p = tab[(*iter)->h];
@@ -293,7 +293,7 @@ GBool GHash::getNext(GHashIter **iter, GString **key, int *val) {
   while (!(*iter)->p) {
     if (++(*iter)->h == size) {
       delete *iter;
-      *iter = NULL;
+      *iter = nullptr;
       return gFalse;
     }
     (*iter)->p = tab[(*iter)->h];
@@ -305,7 +305,7 @@ GBool GHash::getNext(GHashIter **iter, GString **key, int *val) {
 
 void GHash::killIter(GHashIter **iter) {
   delete *iter;
-  *iter = NULL;
+  *iter = nullptr;
 }
 
 void GHash::expand() {
@@ -318,7 +318,7 @@ void GHash::expand() {
   size = 2*size + 1;
   tab = (GHashBucket **)gmallocn(size, sizeof(GHashBucket *));
   for (h = 0; h < size; ++h) {
-    tab[h] = NULL;
+    tab[h] = nullptr;
   }
   for (i = 0; i < oldSize; ++i) {
     while (oldTab[i]) {
@@ -341,7 +341,7 @@ GHashBucket *GHash::find(GString *key, int *h) {
       return p;
     }
   }
-  return NULL;
+  return nullptr;
 }
 
 GHashBucket *GHash::find(char *key, int *h) {
@@ -353,7 +353,7 @@ GHashBucket *GHash::find(char *key, int *h) {
       return p;
     }
   }
-  return NULL;
+  return nullptr;
 }
 
 int GHash::hash(GString *key) {
diff --git a/kpdf/xpdf/goo/GMutex.h b/kpdf/xpdf/goo/GMutex.h
index 7fa93d85..2790e1fb 100644
--- a/kpdf/xpdf/goo/GMutex.h
+++ b/kpdf/xpdf/goo/GMutex.h
@@ -39,7 +39,7 @@ typedef CRITICAL_SECTION GMutex;
 
 typedef pthread_mutex_t GMutex;
 
-#define gInitMutex(m) pthread_mutex_init(m, NULL)
+#define gInitMutex(m) pthread_mutex_init(m, nullptr)
 #define gDestroyMutex(m) pthread_mutex_destroy(m)
 #define gLockMutex(m) pthread_mutex_lock(m)
 #define gUnlockMutex(m) pthread_mutex_unlock(m)
diff --git a/kpdf/xpdf/goo/GString.cpp b/kpdf/xpdf/goo/GString.cpp
index 89f122e1..3a55b1bb 100644
--- a/kpdf/xpdf/goo/GString.cpp
+++ b/kpdf/xpdf/goo/GString.cpp
@@ -68,7 +68,7 @@ static char *formatStrings[] = {
   "s",
   "t",
   "w",
-  NULL
+  nullptr
 };
 
 //------------------------------------------------------------------------
@@ -99,7 +99,7 @@ inline void GString::resize(int length1) {
 }
 
 GString::GString() {
-  s = NULL;
+  s = nullptr;
   resize(length = 0);
   s[0] = '\0';
 }
@@ -107,27 +107,27 @@ GString::GString() {
 GString::GString(const char *sA) {
   int n = strlen(sA);
 
-  s = NULL;
+  s = nullptr;
   resize(length = n);
   memcpy(s, sA, n + 1);
 }
 
 GString::GString(const char *sA, int lengthA) {
-  s = NULL;
+  s = nullptr;
   resize(length = lengthA);
   memcpy(s, sA, length * sizeof(char));
   s[length] = '\0';
 }
 
 GString::GString(GString *str, int idx, int lengthA) {
-  s = NULL;
+  s = nullptr;
   resize(length = lengthA);
   memcpy(s, str->getCString() + idx, length);
   s[length] = '\0';
 }
 
 GString::GString(GString *str) {
-  s = NULL;
+  s = nullptr;
   resize(length = str->getLength());
   memcpy(s, str->getCString(), length + 1);
 }
@@ -136,7 +136,7 @@ GString::GString(GString *str1, GString *str2) {
   int n1 = str1->getLength();
   int n2 = str2->getLength();
 
-  s = NULL;
+  s = nullptr;
   resize(length = n1 + n2);
   memcpy(s, str1->getCString(), n1);
   memcpy(s + n1, str2->getCString(), n2 + 1);
diff --git a/kpdf/xpdf/goo/gfile.cpp b/kpdf/xpdf/goo/gfile.cpp
index bb75b855..c9e99981 100644
--- a/kpdf/xpdf/goo/gfile.cpp
+++ b/kpdf/xpdf/goo/gfile.cpp
@@ -458,7 +458,7 @@ GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) {
     s = new GString();
   }
   s->append("x");
-  t = (int)time(NULL);
+  t = (int)time(nullptr);
   for (i = 0; i < 1000; ++i) {
     sprintf(buf, "%d", t + i);
     s2 = s->copy()->append(buf);
@@ -489,7 +489,7 @@ GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) {
   // with this file name after the tmpnam call and before the fopen
   // call.  I will happily accept fixes to this function for non-Unix
   // OSs.
-  if (!(s = tmpnam(NULL))) {
+  if (!(s = tmpnam(nullptr))) {
     return gFalse;
   }
   *name = new GString(s);
@@ -516,7 +516,7 @@ GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) {
     (*name)->append("/XXXXXX")->append(ext);
     fd = mkstemps((*name)->getCString(), strlen(ext));
 #else
-    if (!(s = tmpnam(NULL))) {
+    if (!(s = tmpnam(nullptr))) {
       return gFalse;
     }
     *name = new GString(s);
@@ -533,7 +533,7 @@ GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) {
     (*name)->append("/XXXXXX");
     fd = mkstemp((*name)->getCString());
 #else // HAVE_MKSTEMP
-    if (!(s = tmpnam(NULL))) {
+    if (!(s = tmpnam(nullptr))) {
       return gFalse;
     }
     *name = new GString(s);
@@ -580,7 +580,7 @@ char *getLine(char *buf, int size, FILE *f) {
   }
   buf[i] = '\0';
   if (i == 0) {
-    return NULL;
+    return nullptr;
   }
   return buf;
 }
@@ -643,7 +643,7 @@ GDir::GDir(char *name, GBool doStatA) {
 #else
   dir = opendir(name);
 #ifdef VMS
-  needParent = strchr(name, '[') != NULL;
+  needParent = strchr(name, '[') != nullptr;
 #endif
 #endif
 }
@@ -653,7 +653,7 @@ GDir::~GDir() {
 #if defined(WIN32)
   if (hnd) {
     FindClose(hnd);
-    hnd = NULL;
+    hnd = nullptr;
   }
 #elif defined(ACORN)
 #elif defined(MACOS)
@@ -671,16 +671,16 @@ GDirEntry *GDir::getNextEntry() {
     e = new GDirEntry(path->getCString(), ffd.cFileName, doStat);
     if (hnd  && !FindNextFile(hnd, &ffd)) {
       FindClose(hnd);
-      hnd = NULL;
+      hnd = nullptr;
     }
   } else {
-    e = NULL;
+    e = nullptr;
   }
 #elif defined(ACORN)
 #elif defined(MACOS)
 #elif defined(VMS)
   struct dirent *ent;
-  e = NULL;
+  e = nullptr;
   if (dir) {
     if (needParent) {
       e = new GDirEntry(path->getCString(), "-", doStat);
@@ -694,7 +694,7 @@ GDirEntry *GDir::getNextEntry() {
   }
 #else
   struct dirent *ent;
-  e = NULL;
+  e = nullptr;
   if (dir) {
     ent = (struct dirent *)readdir(dir);
     if (ent && !strcmp(ent->d_name, ".")) {
@@ -725,7 +725,7 @@ void GDir::rewind() {
   if (dir)
     rewinddir(dir);
 #ifdef VMS
-  needParent = strchr(path->getCString(), '[') != NULL;
+  needParent = strchr(path->getCString(), '[') != nullptr;
 #endif
 #endif
 }
diff --git a/kpdf/xpdf/goo/gmem.cpp b/kpdf/xpdf/goo/gmem.cpp
index d8962aba..6b16281f 100644
--- a/kpdf/xpdf/goo/gmem.cpp
+++ b/kpdf/xpdf/goo/gmem.cpp
@@ -38,8 +38,8 @@ typedef struct _GMemHdr {
 #define gMemDataSize(size) \
   ((((size) + gMemTrlSize - 1) / gMemTrlSize) * gMemTrlSize)
 
-static GMemHdr *gMemHead = NULL;
-static GMemHdr *gMemTail = NULL;
+static GMemHdr *gMemHead = nullptr;
+static GMemHdr *gMemTail = nullptr;
 
 static int gMemIndex = 0;
 static int gMemAlloc = 0;
@@ -64,7 +64,7 @@ void *gmalloc(int size) GMEM_EXCEP {
 #endif
   }
   if (size == 0) {
-    return NULL;
+    return nullptr;
   }
   size1 = gMemDataSize(size);
   if (!(mem = (char *)malloc(size1 + gMemHdrSize + gMemTrlSize))) {
@@ -86,10 +86,10 @@ void *gmalloc(int size) GMEM_EXCEP {
     hdr->prev = gMemTail;
     gMemTail = hdr;
   } else {
-    hdr->prev = NULL;
+    hdr->prev = nullptr;
     gMemHead = gMemTail = hdr;
   }
-  hdr->next = NULL;
+  hdr->next = nullptr;
   ++gMemAlloc;
   gMemInUse += size;
   for (p = (unsigned long *)data; p <= trl; ++p) {
@@ -108,7 +108,7 @@ void *gmalloc(int size) GMEM_EXCEP {
 #endif
   }
   if (size == 0) {
-    return NULL;
+    return nullptr;
   }
   if (!(p = malloc(size))) {
 #if USE_EXCEPTIONS
@@ -140,7 +140,7 @@ void *grealloc(void *p, int size) GMEM_EXCEP {
     if (p) {
       gfree(p);
     }
-    return NULL;
+    return nullptr;
   }
   if (p) {
     hdr = (GMemHdr *)((char *)p - gMemHdrSize);
@@ -167,7 +167,7 @@ void *grealloc(void *p, int size) GMEM_EXCEP {
     if (p) {
       free(p);
     }
-    return NULL;
+    return nullptr;
   }
   if (p) {
     q = realloc(p, size);
@@ -190,7 +190,7 @@ void *gmallocn(int nObjs, int objSize) GMEM_EXCEP {
   int n;
 
   if (nObjs == 0) {
-    return NULL;
+    return nullptr;
   }
   n = nObjs * objSize;
   if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) {
@@ -208,7 +208,7 @@ void *gmallocn_checkoverflow(int nObjs, int objSize) GMEM_EXCEP {
   int n;
 
   if (nObjs == 0) {
-    return NULL;
+    return nullptr;
   }
   n = nObjs * objSize;
   if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) {
@@ -216,7 +216,7 @@ void *gmallocn_checkoverflow(int nObjs, int objSize) GMEM_EXCEP {
     throw GMemException();
 #else
     fprintf(stderr, "Bogus memory allocation size\n");
-    return NULL;
+    return nullptr;
 #endif
   }
   return gmalloc(n);
@@ -230,7 +230,7 @@ void *greallocn(void *p, int nObjs, int objSize) GMEM_EXCEP {
     if (p) {
       gfree(p);
     }
-    return NULL;
+    return nullptr;
   }
   n = nObjs * objSize;
   if (objSize <= 0 || nObjs < 0 || nObjs >= INT_MAX / objSize) {
@@ -253,8 +253,8 @@ void gfree(void *p) {
   if (p) {
     hdr = (GMemHdr *)((char *)p - gMemHdrSize);
     if (hdr->magic == gMemMagic &&
-	((hdr->prev == NULL) == (hdr == gMemHead)) &&
-	((hdr->next == NULL) == (hdr == gMemTail))) {
+	((hdr->prev == nullptr) == (hdr == gMemHead)) &&
+	((hdr->next == nullptr) == (hdr == gMemTail))) {
       if (hdr->prev) {
 	hdr->prev->next = hdr->next;
       } else {
diff --git a/kpdf/xpdf/splash/Splash.cpp b/kpdf/xpdf/splash/Splash.cpp
index 2cfc1ee2..cc0cef28 100644
--- a/kpdf/xpdf/splash/Splash.cpp
+++ b/kpdf/xpdf/splash/Splash.cpp
@@ -163,7 +163,7 @@ inline void Splash::pipeInit(SplashPipe *pipe, int x, int y,
 			     SplashCoord aInput, GBool usesShape,
 			     GBool nonIsolatedGroup) {
   pipeSetXY(pipe, x, y);
-  pipe->pattern = NULL;
+  pipe->pattern = nullptr;
 
   // source color
   if (pattern) {
@@ -559,14 +559,14 @@ inline void Splash::pipeSetXY(SplashPipe *pipe, int x, int y) {
   if (bitmap->alpha) {
     pipe->destAlphaPtr = &bitmap->alpha[y * bitmap->width + x];
   } else {
-    pipe->destAlphaPtr = NULL;
+    pipe->destAlphaPtr = nullptr;
   }
   if (state->inNonIsolatedGroup && alpha0Bitmap->alpha) {
     pipe->alpha0Ptr =
         &alpha0Bitmap->alpha[(alpha0Y + y) * alpha0Bitmap->width +
 			     (alpha0X + x)];
   } else {
-    pipe->alpha0Ptr = NULL;
+    pipe->alpha0Ptr = nullptr;
   }
 }
 
@@ -786,7 +786,7 @@ Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA,
 			     1.5);
     }
   } else {
-    aaBuf = NULL;
+    aaBuf = nullptr;
   }
   clearModRegion();
   debugMode = gFalse;
@@ -809,7 +809,7 @@ Splash::Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA,
 			     1.5);
     }
   } else {
-    aaBuf = NULL;
+    aaBuf = nullptr;
   }
   clearModRegion();
   debugMode = gFalse;
@@ -1162,7 +1162,7 @@ void Splash::strokeNarrow(SplashPath *path) {
 
   xPath = new SplashXPath(path, state->matrix, state->flatness, gFalse);
 
-  pipeInit(&pipe, 0, 0, state->strokePattern, NULL, state->strokeAlpha,
+  pipeInit(&pipe, 0, 0, state->strokePattern, nullptr, state->strokeAlpha,
 	   gFalse, gFalse);
 
   for (i = 0, seg = xPath->segs; i < xPath->length; ++i, ++seg) {
@@ -1528,7 +1528,7 @@ SplashError Splash::fillWithPattern(SplashPath *path, GBool eo,
       yMaxI = state->clip->getYMaxI();
     }
 
-    pipeInit(&pipe, 0, yMinI, pattern, NULL, alpha, vectorAntialias, gFalse);
+    pipeInit(&pipe, 0, yMinI, pattern, nullptr, alpha, vectorAntialias, gFalse);
 
     // draw the spans
     if (vectorAntialias) {
@@ -1598,7 +1598,7 @@ SplashError Splash::xorFill(SplashPath *path, GBool eo) {
 
     origBlendFunc = state->blendFunc;
     state->blendFunc = &blendXor;
-    pipeInit(&pipe, 0, yMinI, state->fillPattern, NULL, 1, gFalse, gFalse);
+    pipeInit(&pipe, 0, yMinI, state->fillPattern, nullptr, 1, gFalse, gFalse);
 
     // draw the spans
     for (y = yMinI; y <= yMaxI; ++y) {
@@ -1706,7 +1706,7 @@ void Splash::fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, GBool noClip)
     if (noClip) {
       if (glyph->aa) {
 	pipeInit(&pipe, xStart, yStart,
-		 state->fillPattern, NULL, state->fillAlpha, gTrue, gFalse);
+		 state->fillPattern, nullptr, state->fillAlpha, gTrue, gFalse);
 	for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) {
 	  pipeSetXY(&pipe, xStart, y1);
 	  for (xx = 0, x1 = xStart; xx < xxLimit; ++xx, ++x1) {
@@ -1726,7 +1726,7 @@ void Splash::fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, GBool noClip)
 	const int widthEight = (int)ceil(glyph->w / 8.0);
 
 	pipeInit(&pipe, xStart, yStart,
-		 state->fillPattern, NULL, state->fillAlpha, gFalse, gFalse);
+		 state->fillPattern, nullptr, state->fillAlpha, gFalse, gFalse);
 	for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) {
 	  pipeSetXY(&pipe, xStart, y1);
 	  for (xx = 0, x1 = xStart; xx < xxLimit; xx += 8) {
@@ -1748,7 +1748,7 @@ void Splash::fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, GBool noClip)
     } else {
       if (glyph->aa) {
 	pipeInit(&pipe, xStart, yStart,
-		 state->fillPattern, NULL, state->fillAlpha, gTrue, gFalse);
+		 state->fillPattern, nullptr, state->fillAlpha, gTrue, gFalse);
 	for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) {
 	  pipeSetXY(&pipe, xStart, y1);
 	  for (xx = 0, x1 = xStart; xx < xxLimit; ++xx, ++x1) {
@@ -1772,7 +1772,7 @@ void Splash::fillGlyph2(int x0, int y0, SplashGlyphBitmap *glyph, GBool noClip)
 	const int widthEight = (int)ceil(glyph->w / 8.0);
 
 	pipeInit(&pipe, xStart, yStart,
-		 state->fillPattern, NULL, state->fillAlpha, gFalse, gFalse);
+		 state->fillPattern, nullptr, state->fillAlpha, gFalse, gFalse);
 	for (yy = 0, y1 = yStart; yy < yyLimit; ++yy, ++y1) {
 	  pipeSetXY(&pipe, xStart, y1);
 	  for (xx = 0, x1 = xStart; xx < xxLimit; xx += 8) {
@@ -1949,7 +1949,7 @@ SplashError Splash::fillImageMask(SplashImageMaskSource src, void *srcData,
   pixBuf = (SplashColorPtr)gmallocn(yp + 1, w);
 
   // initialize the pixel pipe
-  pipeInit(&pipe, 0, 0, state->fillPattern, NULL, state->fillAlpha,
+  pipeInit(&pipe, 0, 0, state->fillPattern, nullptr, state->fillAlpha,
 	   gTrue, gFalse);
   if (vectorAntialias) {
     drawAAPixelInit();
@@ -2249,7 +2249,7 @@ SplashError Splash::drawImage(SplashImageSource src, void *srcData,
   if (srcAlpha) {
     alphaBuf = (Guchar *)gmallocn(yp + 1, w);
   } else {
-    alphaBuf = NULL;
+    alphaBuf = nullptr;
   }
 
   pixAcc0 = pixAcc1 = pixAcc2 = 0; // make gcc happy
@@ -2258,7 +2258,7 @@ SplashError Splash::drawImage(SplashImageSource src, void *srcData,
 #endif
 
   // initialize the pixel pipe
-  pipeInit(&pipe, 0, 0, NULL, pix, state->fillAlpha,
+  pipeInit(&pipe, 0, 0, nullptr, pix, state->fillAlpha,
 	   srcAlpha || (vectorAntialias && clipRes != splashClipAllInside),
 	   gFalse);
   if (vectorAntialias) {
@@ -2565,7 +2565,7 @@ SplashError Splash::drawImage(SplashImageSource src, void *srcData,
       if (n > 0) {
 	p = colorBuf;
 	for (i = 0; i < n; ++i) {
-	  (*src)(srcData, p, NULL);
+	  (*src)(srcData, p, nullptr);
 	  p += w * nComps;
 	}
       }
@@ -2819,7 +2819,7 @@ SplashError Splash::composite(SplashBitmap *src, int xSrc, int ySrc,
   }
 
   if (src->alpha) {
-    pipeInit(&pipe, xDest, yDest, NULL, pixel, state->fillAlpha,
+    pipeInit(&pipe, xDest, yDest, nullptr, pixel, state->fillAlpha,
 	     gTrue, nonIsolated);
     for (y = 0; y < h; ++y) {
       pipeSetXY(&pipe, xDest, yDest + y);
@@ -2840,7 +2840,7 @@ SplashError Splash::composite(SplashBitmap *src, int xSrc, int ySrc,
       }
     }
   } else {
-    pipeInit(&pipe, xDest, yDest, NULL, pixel, state->fillAlpha,
+    pipeInit(&pipe, xDest, yDest, nullptr, pixel, state->fillAlpha,
 	     gFalse, nonIsolated);
     for (y = 0; y < h; ++y) {
       pipeSetXY(&pipe, xDest, yDest + y);
diff --git a/kpdf/xpdf/splash/Splash.h b/kpdf/xpdf/splash/Splash.h
index 3c7571fb..24b44425 100644
--- a/kpdf/xpdf/splash/Splash.h
+++ b/kpdf/xpdf/splash/Splash.h
@@ -70,7 +70,7 @@ public:
 
   // Create a new rasterizer object.
   Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA,
-	 SplashScreenParams *screenParams = NULL);
+	 SplashScreenParams *screenParams = nullptr);
   Splash(SplashBitmap *bitmapA, GBool vectorAntialiasA,
 	 SplashScreen *screenA);
 
diff --git a/kpdf/xpdf/splash/SplashBitmap.cpp b/kpdf/xpdf/splash/SplashBitmap.cpp
index 5b5d28d1..dc7f11bb 100644
--- a/kpdf/xpdf/splash/SplashBitmap.cpp
+++ b/kpdf/xpdf/splash/SplashBitmap.cpp
@@ -71,7 +71,7 @@ SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPad,
   if (alphaA) {
     alpha = (Guchar *)gmallocn(width, height);
   } else {
-    alpha = NULL;
+    alpha = nullptr;
   }
 }
 
diff --git a/kpdf/xpdf/splash/SplashClip.cpp b/kpdf/xpdf/splash/SplashClip.cpp
index ba03b7a4..62d006d9 100644
--- a/kpdf/xpdf/splash/SplashClip.cpp
+++ b/kpdf/xpdf/splash/SplashClip.cpp
@@ -52,9 +52,9 @@ SplashClip::SplashClip(SplashCoord x0, SplashCoord y0,
   yMinI = splashFloor(yMin);
   xMaxI = splashFloor(xMax);
   yMaxI = splashFloor(yMax);
-  paths = NULL;
-  flags = NULL;
-  scanners = NULL;
+  paths = nullptr;
+  flags = nullptr;
+  scanners = nullptr;
   length = size = 0;
 }
 
@@ -121,9 +121,9 @@ void SplashClip::resetToRect(SplashCoord x0, SplashCoord y0,
   gfree(paths);
   gfree(flags);
   gfree(scanners);
-  paths = NULL;
-  flags = NULL;
-  scanners = NULL;
+  paths = nullptr;
+  flags = nullptr;
+  scanners = nullptr;
   length = size = 0;
 
   if (x0 < x1) {
diff --git a/kpdf/xpdf/splash/SplashFTFont.cpp b/kpdf/xpdf/splash/SplashFTFont.cpp
index 4bc31210..3357fd5b 100644
--- a/kpdf/xpdf/splash/SplashFTFont.cpp
+++ b/kpdf/xpdf/splash/SplashFTFont.cpp
@@ -269,7 +269,7 @@ SplashPath *SplashFTFont::getGlyphPath(int c) {
 
   ff = (SplashFTFontFile *)fontFile;
   ff->face->size = sizeObj;
-  FT_Set_Transform(ff->face, &textMatrix, NULL);
+  FT_Set_Transform(ff->face, &textMatrix, nullptr);
   slot = ff->face->glyph;
   if (ff->codeToGID && c < ff->codeToGIDLen) {
     gid = ff->codeToGID[c];
@@ -278,13 +278,13 @@ SplashPath *SplashFTFont::getGlyphPath(int c) {
   }
   if (ff->trueType && gid == 0) {
     // skip the TrueType notdef glyph
-    return NULL;
+    return nullptr;
   }
   if (FT_Load_Glyph(ff->face, gid, FT_LOAD_NO_BITMAP)) {
-    return NULL;
+    return nullptr;
   }
   if (FT_Get_Glyph(slot, &glyph)) {
-    return NULL;
+    return nullptr;
   }
   path.path = new SplashPath();
   path.textScale = textScale;
diff --git a/kpdf/xpdf/splash/SplashFTFontEngine.cpp b/kpdf/xpdf/splash/SplashFTFontEngine.cpp
index 36cf32e6..affaa440 100644
--- a/kpdf/xpdf/splash/SplashFTFontEngine.cpp
+++ b/kpdf/xpdf/splash/SplashFTFontEngine.cpp
@@ -57,7 +57,7 @@ SplashFTFontEngine *SplashFTFontEngine::init(GBool aaA) {
   FT_Library libA;
 
   if (FT_Init_FreeType(&libA)) {
-    return NULL;
+    return nullptr;
   }
   return new SplashFTFontEngine(aaA, libA);
 }
@@ -93,7 +93,7 @@ SplashFontFile *SplashFTFontEngine::loadCIDFont(SplashFontFileID *idA,
 
   // check for a CFF font
   if (useCIDs) {
-    cidToGIDMap = NULL;
+    cidToGIDMap = nullptr;
     nCIDs = 0;
   } else {
     if (src->isFile) {
@@ -105,7 +105,7 @@ SplashFontFile *SplashFTFontEngine::loadCIDFont(SplashFontFileID *idA,
       cidToGIDMap = ff->getCIDToGIDMap(&nCIDs);
       delete ff;
     } else {
-      cidToGIDMap = NULL;
+      cidToGIDMap = nullptr;
       nCIDs = 0;
     }
   }
@@ -124,7 +124,7 @@ SplashFontFile *SplashFTFontEngine::loadOpenTypeCFFFont(SplashFontFileID *idA,
   int nCIDs;
   SplashFontFile *ret;
 
-  cidToGIDMap = NULL;
+  cidToGIDMap = nullptr;
   nCIDs = 0;
   isCID = gFalse;
   if (!useCIDs) {
@@ -160,12 +160,12 @@ SplashFontFile *SplashFTFontEngine::loadTrueTypeFont(SplashFontFileID *idA,
   SplashFontFile *ret;
 
   if (!(ff = FoFiTrueType::load(fileName))) {
-    return NULL;
+    return nullptr;
   }
-  tmpFileName = NULL;
-  if (!openTempFile(&tmpFileName, &tmpFile, "wb", NULL)) {
+  tmpFileName = nullptr;
+  if (!openTempFile(&tmpFileName, &tmpFile, "wb", nullptr)) {
     delete ff;
-    return NULL;
+    return nullptr;
   }
   ff->writeTTF(&fileWrite, tmpFile);
   delete ff;
diff --git a/kpdf/xpdf/splash/SplashFTFontFile.cpp b/kpdf/xpdf/splash/SplashFTFontFile.cpp
index 697c3ed8..17d7ae8a 100644
--- a/kpdf/xpdf/splash/SplashFTFontFile.cpp
+++ b/kpdf/xpdf/splash/SplashFTFontFile.cpp
@@ -33,10 +33,10 @@ SplashFontFile *SplashFTFontFile::loadType1Font(SplashFTFontEngine *engineA,
 
   if (src->isFile) {
     if (FT_New_Face(engineA->lib, src->fileName->getCString(), 0, &faceA))
-      return NULL;
+      return nullptr;
   } else {
     if (FT_New_Memory_Face(engineA->lib, (const FT_Byte *)src->buf, src->bufLen, 0, &faceA))
-      return NULL;
+      return nullptr;
   }
   codeToGIDA = (Gushort *)gmallocn(256, sizeof(int));
   for (i = 0; i < 256; ++i) {
@@ -59,10 +59,10 @@ SplashFontFile *SplashFTFontFile::loadCIDFont(SplashFTFontEngine *engineA,
 
   if (src->isFile) {
     if (FT_New_Face(engineA->lib, src->fileName->getCString(), 0, &faceA))
-      return NULL;
+      return nullptr;
   } else {
     if (FT_New_Memory_Face(engineA->lib, (const FT_Byte *)src->buf, src->bufLen, 0, &faceA))
-      return NULL;
+      return nullptr;
   }
 
   return new SplashFTFontFile(engineA, idA, src,
@@ -79,10 +79,10 @@ SplashFontFile *SplashFTFontFile::loadTrueTypeFont(SplashFTFontEngine *engineA,
 
   if (src->isFile) {
     if (FT_New_Face(engineA->lib, src->fileName->getCString(), faceIndexA, &faceA))
-      return NULL;
+      return nullptr;
   } else {
     if (FT_New_Memory_Face(engineA->lib, (const FT_Byte *)src->buf, src->bufLen, faceIndexA, &faceA))
-      return NULL;
+      return nullptr;
   }
 
   return new SplashFTFontFile(engineA, idA, src,
diff --git a/kpdf/xpdf/splash/SplashFont.cpp b/kpdf/xpdf/splash/SplashFont.cpp
index 42c9e999..43c0f79d 100644
--- a/kpdf/xpdf/splash/SplashFont.cpp
+++ b/kpdf/xpdf/splash/SplashFont.cpp
@@ -44,8 +44,8 @@ SplashFont::SplashFont(SplashFontFile *fontFileA, SplashCoord *matA,
   textMat[3] = textMatA[3];
   aa = aaA;
 
-  cache = NULL;
-  cacheTags = NULL;
+  cache = nullptr;
+  cacheTags = nullptr;
 
   xMin = yMin = xMax = yMax = 0;
 }
@@ -75,7 +75,7 @@ void SplashFont::initCache() {
     cacheSets = 1;
   }
   cache = (Guchar *)gmallocn_checkoverflow(cacheSets * cacheAssoc, glyphSize);
-  if (cache != NULL) {
+  if (cache) {
     cacheTags = (SplashFontCacheTag *)gmallocn(cacheSets * cacheAssoc,
 					     sizeof(SplashFontCacheTag));
     for (i = 0; i < cacheSets * cacheAssoc; ++i) {
@@ -166,7 +166,7 @@ GBool SplashFont::getGlyph(int c, int xFrac, int yFrac,
   } else {
     size = ((bitmap2.w + 7) >> 3) * bitmap2.h;
   }
-  p = NULL; // make gcc happy
+  p = nullptr; // make gcc happy
   if (cacheAssoc == 0)
   {
     // we had problems on the malloc of the cache, so ignore it
diff --git a/kpdf/xpdf/splash/SplashFontEngine.cpp b/kpdf/xpdf/splash/SplashFontEngine.cpp
index c3eb33a7..39d7d12d 100644
--- a/kpdf/xpdf/splash/SplashFontEngine.cpp
+++ b/kpdf/xpdf/splash/SplashFontEngine.cpp
@@ -42,14 +42,14 @@ SplashFontEngine::SplashFontEngine(
   int i;
 
   for (i = 0; i < splashFontCacheSize; ++i) {
-    fontCache[i] = NULL;
+    fontCache[i] = nullptr;
   }
 
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   if (enableFreeType) {
     ftEngine = SplashFTFontEngine::init(aa);
   } else {
-    ftEngine = NULL;
+    ftEngine = nullptr;
   }
 #endif
 }
@@ -82,7 +82,7 @@ SplashFontFile *SplashFontEngine::getFontFile(SplashFontFileID *id) {
       }
     }
   }
-  return NULL;
+  return nullptr;
 }
 
 SplashFontFile *SplashFontEngine::loadType1Font(SplashFontFileID *idA,
@@ -90,7 +90,7 @@ SplashFontFile *SplashFontEngine::loadType1Font(SplashFontFileID *idA,
 						char **enc) {
   SplashFontFile *fontFile;
 
-  fontFile = NULL;
+  fontFile = nullptr;
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   if (!fontFile && ftEngine) {
     fontFile = ftEngine->loadType1Font(idA, src, enc);
@@ -112,7 +112,7 @@ SplashFontFile *SplashFontEngine::loadType1CFont(SplashFontFileID *idA,
 						 char **enc) {
   SplashFontFile *fontFile;
 
-  fontFile = NULL;
+  fontFile = nullptr;
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   if (!fontFile && ftEngine) {
     fontFile = ftEngine->loadType1CFont(idA, src, enc);
@@ -134,7 +134,7 @@ SplashFontFile *SplashFontEngine::loadOpenTypeT1CFont(SplashFontFileID *idA,
 						      char **enc) {
   SplashFontFile *fontFile;
 
-  fontFile = NULL;
+  fontFile = nullptr;
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   if (!fontFile && ftEngine) {
     fontFile = ftEngine->loadOpenTypeT1CFont(idA, src, enc);
@@ -155,7 +155,7 @@ SplashFontFile *SplashFontEngine::loadCIDFont(SplashFontFileID *idA,
 					      SplashFontSrc *src) {
   SplashFontFile *fontFile;
 
-  fontFile = NULL;
+  fontFile = nullptr;
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   if (!fontFile && ftEngine) {
     fontFile = ftEngine->loadCIDFont(idA, src);
@@ -176,7 +176,7 @@ SplashFontFile *SplashFontEngine::loadOpenTypeCFFFont(SplashFontFileID *idA,
 						      SplashFontSrc *src) {
   SplashFontFile *fontFile;
 
-  fontFile = NULL;
+  fontFile = nullptr;
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   if (!fontFile && ftEngine) {
     fontFile = ftEngine->loadOpenTypeCFFFont(idA, src);
@@ -200,7 +200,7 @@ SplashFontFile *SplashFontEngine::loadTrueTypeFont(SplashFontFileID *idA,
 						   int faceIndex) {
   SplashFontFile *fontFile;
 
-  fontFile = NULL;
+  fontFile = nullptr;
 #if HAVE_FREETYPE_FREETYPE_H || HAVE_FREETYPE_H
   if (!fontFile && ftEngine) {
     fontFile = ftEngine->loadTrueTypeFont(idA, src,
diff --git a/kpdf/xpdf/splash/SplashFontFile.cpp b/kpdf/xpdf/splash/SplashFontFile.cpp
index c66447bb..77b10799 100644
--- a/kpdf/xpdf/splash/SplashFontFile.cpp
+++ b/kpdf/xpdf/splash/SplashFontFile.cpp
@@ -56,8 +56,8 @@ void SplashFontFile::decRefCnt() {
 SplashFontSrc::SplashFontSrc() {
   isFile = gFalse;
   deleteSrc = gFalse;
-  fileName = NULL;
-  buf = NULL;
+  fileName = nullptr;
+  buf = nullptr;
   refcnt = 1;
 }
 
diff --git a/kpdf/xpdf/splash/SplashPath.cpp b/kpdf/xpdf/splash/SplashPath.cpp
index 4a3c334c..610df925 100644
--- a/kpdf/xpdf/splash/SplashPath.cpp
+++ b/kpdf/xpdf/splash/SplashPath.cpp
@@ -31,11 +31,11 @@
 //    [curSubpath < length - 1]
 
 SplashPath::SplashPath() {
-  pts = NULL;
-  flags = NULL;
+  pts = nullptr;
+  flags = nullptr;
   length = size = 0;
   curSubpath = 0;
-  hints = NULL;
+  hints = nullptr;
   hintsLength = hintsSize = 0;
 }
 
@@ -52,7 +52,7 @@ SplashPath::SplashPath(SplashPath *path) {
     hints = (SplashPathHint *)gmallocn(hintsSize, sizeof(SplashPathHint));
     memcpy(hints, path->hints, hintsLength * sizeof(SplashPathHint));
   } else {
-    hints = NULL;
+    hints = nullptr;
   }
 }
 
diff --git a/kpdf/xpdf/splash/SplashState.cpp b/kpdf/xpdf/splash/SplashState.cpp
index 17445ad7..571ae1b6 100644
--- a/kpdf/xpdf/splash/SplashState.cpp
+++ b/kpdf/xpdf/splash/SplashState.cpp
@@ -38,7 +38,7 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias,
   strokePattern = new SplashSolidColor(color);
   fillPattern = new SplashSolidColor(color);
   screen = new SplashScreen(screenParams);
-  blendFunc = NULL;
+  blendFunc = nullptr;
   strokeAlpha = 1;
   fillAlpha = 1;
   lineWidth = 0;
@@ -46,15 +46,15 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias,
   lineJoin = splashLineJoinMiter;
   miterLimit = 10;
   flatness = 1;
-  lineDash = NULL;
+  lineDash = nullptr;
   lineDashLength = 0;
   lineDashPhase = 0;
   strokeAdjust = gFalse;
   clip = new SplashClip(0, 0, width - 0.001, height - 0.001, vectorAntialias);
-  softMask = NULL;
+  softMask = nullptr;
   deleteSoftMask = gFalse;
   inNonIsolatedGroup = gFalse;
-  next = NULL;
+  next = nullptr;
 }
 
 SplashState::SplashState(int width, int height, GBool vectorAntialias,
@@ -68,7 +68,7 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias,
   strokePattern = new SplashSolidColor(color);
   fillPattern = new SplashSolidColor(color);
   screen = screenA->copy();
-  blendFunc = NULL;
+  blendFunc = nullptr;
   strokeAlpha = 1;
   fillAlpha = 1;
   lineWidth = 0;
@@ -76,15 +76,15 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias,
   lineJoin = splashLineJoinMiter;
   miterLimit = 10;
   flatness = 1;
-  lineDash = NULL;
+  lineDash = nullptr;
   lineDashLength = 0;
   lineDashPhase = 0;
   strokeAdjust = gFalse;
   clip = new SplashClip(0, 0, width - 0.001, height - 0.001, vectorAntialias);
-  softMask = NULL;
+  softMask = nullptr;
   deleteSoftMask = gFalse;
   inNonIsolatedGroup = gFalse;
-  next = NULL;
+  next = nullptr;
 }
 
 SplashState::SplashState(SplashState *state) {
@@ -105,7 +105,7 @@ SplashState::SplashState(SplashState *state) {
     lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord));
     memcpy(lineDash, state->lineDash, lineDashLength * sizeof(SplashCoord));
   } else {
-    lineDash = NULL;
+    lineDash = nullptr;
     lineDashLength = 0;
   }
   lineDashPhase = state->lineDashPhase;
@@ -114,7 +114,7 @@ SplashState::SplashState(SplashState *state) {
   softMask = state->softMask;
   deleteSoftMask = gFalse;
   inNonIsolatedGroup = state->inNonIsolatedGroup;
-  next = NULL;
+  next = nullptr;
 }
 
 SplashState::~SplashState() {
@@ -151,7 +151,7 @@ void SplashState::setLineDash(SplashCoord *lineDashA, int lineDashLengthA,
     lineDash = (SplashCoord *)gmallocn(lineDashLength, sizeof(SplashCoord));
     memcpy(lineDash, lineDashA, lineDashLength * sizeof(SplashCoord));
   } else {
-    lineDash = NULL;
+    lineDash = nullptr;
   }
   lineDashPhase = lineDashPhaseA;
 }
diff --git a/kpdf/xpdf/splash/SplashXPath.cpp b/kpdf/xpdf/splash/SplashXPath.cpp
index 267643bb..97faf701 100644
--- a/kpdf/xpdf/splash/SplashXPath.cpp
+++ b/kpdf/xpdf/splash/SplashXPath.cpp
@@ -50,7 +50,7 @@ inline void SplashXPath::transform(SplashCoord *matrix,
 //------------------------------------------------------------------------
 
 SplashXPath::SplashXPath() {
-  segs = NULL;
+  segs = nullptr;
   length = size = 0;
 }
 
@@ -78,7 +78,7 @@ SplashXPath::SplashXPath(SplashPath *path, SplashCoord *matrix,
       hint = &path->hints[i];
       if (hint->ctrl0 + 1 >= path->length || hint->ctrl1 + 1 >= path->length) {
 	gfree(adjusts);
-	adjusts = NULL;
+	adjusts = nullptr;
 	break;
       }
       x0 = pts[hint->ctrl0    ].x;    y0 = pts[hint->ctrl0    ].y;
@@ -95,7 +95,7 @@ SplashXPath::SplashXPath(SplashPath *path, SplashCoord *matrix,
 	adj1 = y2;
       } else {
 	gfree(adjusts);
-	adjusts = NULL;
+	adjusts = nullptr;
 	break;
       }
       if (adj0 > adj1) {
@@ -122,7 +122,7 @@ SplashXPath::SplashXPath(SplashPath *path, SplashCoord *matrix,
     }
 
   } else {
-    adjusts = NULL;
+    adjusts = nullptr;
   }
 
   // perform stroke adjustment
@@ -135,7 +135,7 @@ SplashXPath::SplashXPath(SplashPath *path, SplashCoord *matrix,
     gfree(adjusts);
   }
 
-  segs = NULL;
+  segs = nullptr;
   length = size = 0;
 
   x0 = y0 = xsp = ysp = 0; // make gcc happy
diff --git a/kpdf/xpdf/splash/SplashXPathScanner.cpp b/kpdf/xpdf/splash/SplashXPathScanner.cpp
index 8c7d505a..1a46b33b 100644
--- a/kpdf/xpdf/splash/SplashXPathScanner.cpp
+++ b/kpdf/xpdf/splash/SplashXPathScanner.cpp
@@ -91,7 +91,7 @@ SplashXPathScanner::SplashXPathScanner(SplashXPath *xPathA, GBool eoA) {
 
   interY = yMin - 1;
   xPathIdx = 0;
-  inter = NULL;
+  inter = nullptr;
   interLen = interSize = 0;
 }
 
-- 
cgit v1.2.3

