[poppler] fofi/FoFiType1.cc fofi/FoFiType1C.cc poppler/Annot.cc poppler/Gfx.cc poppler/GfxFont.cc poppler/GfxState.cc poppler/Hints.cc poppler/Page.cc poppler/PSOutputDev.cc poppler/SecurityHandler.cc poppler/TextOutputDev.cc test/perf-test.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Sep 22 23:55:03 UTC 2018


 fofi/FoFiType1.cc          |    2 +-
 fofi/FoFiType1C.cc         |    2 +-
 poppler/Annot.cc           |   34 +++++++++++++++++-----------------
 poppler/Gfx.cc             |   10 +++++-----
 poppler/GfxFont.cc         |    6 +++---
 poppler/GfxState.cc        |    2 +-
 poppler/Hints.cc           |    2 +-
 poppler/PSOutputDev.cc     |    6 +++---
 poppler/Page.cc            |    4 ++--
 poppler/SecurityHandler.cc |    4 ++--
 poppler/TextOutputDev.cc   |    4 ++--
 test/perf-test.cc          |    2 +-
 12 files changed, 39 insertions(+), 39 deletions(-)

New commits:
commit d1104f9d7a5e86b80244d0627562fe832d5bcd4b
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 23 01:54:47 2018 +0200

    Don't cast nullptr
    
    Doesn't make any sense

diff --git a/fofi/FoFiType1.cc b/fofi/FoFiType1.cc
index a5d73e0e..889ea111 100644
--- a/fofi/FoFiType1.cc
+++ b/fofi/FoFiType1.cc
@@ -349,7 +349,7 @@ void FoFiType1::parse() {
 	if ((p2 = strchr(p, ']'))) {
 	  *p2 = '\0';
 	  for (j = 0; j < 6; ++j) {
-	    if ((p = strtok(j == 0 ? p : (char *)nullptr, " \t\n\r"))) {
+	    if ((p = strtok(j == 0 ? p : nullptr, " \t\n\r"))) {
 	      fontMatrix[j] = atof(p);
 	    } else {
 	      break;
diff --git a/fofi/FoFiType1C.cc b/fofi/FoFiType1C.cc
index 8b632c44..52f9f5bb 100644
--- a/fofi/FoFiType1C.cc
+++ b/fofi/FoFiType1C.cc
@@ -114,7 +114,7 @@ FoFiType1C::~FoFiType1C() {
 }
 
 const char *FoFiType1C::getName() const {
-  return name ? name->getCString() : (char *)nullptr;
+  return name ? name->getCString() : nullptr;
 }
 
 char **FoFiType1C::getEncoding() const {
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 90c12737..238dbe94 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -1878,7 +1878,7 @@ void Annot::draw(Gfx *gfx, GBool printing) {
 
   // draw the appearance stream
   Object obj = appearance.fetch(gfx->getXRef());
-  gfx->drawAnnot(&obj, (AnnotBorder *)nullptr, color,
+  gfx->drawAnnot(&obj, nullptr, color,
       rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
 }
 
@@ -2532,12 +2532,12 @@ void AnnotText::draw(Gfx *gfx, GBool printing) {
   // draw the appearance stream
   Object obj = appearance.fetch(gfx->getXRef());
   if (appearBBox) {
-    gfx->drawAnnot(&obj, (AnnotBorder *)nullptr, color,
+    gfx->drawAnnot(&obj, nullptr, color,
                    appearBBox->getPageXMin(), appearBBox->getPageYMin(),
                    appearBBox->getPageXMax(), appearBBox->getPageYMax(),
                    getRotation());
   } else {
-    gfx->drawAnnot(&obj, (AnnotBorder *)nullptr, color,
+    gfx->drawAnnot(&obj, nullptr, color,
                    rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
   }
 }
@@ -2982,7 +2982,7 @@ void AnnotFreeText::draw(Gfx *gfx, GBool printing) {
 
   // draw the appearance stream
   Object obj = appearance.fetch(gfx->getXRef());
-  gfx->drawAnnot(&obj, (AnnotBorder *)nullptr, color,
+  gfx->drawAnnot(&obj, nullptr, color,
                  rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
 }
 
@@ -3419,12 +3419,12 @@ void AnnotLine::draw(Gfx *gfx, GBool printing) {
   // draw the appearance stream
   Object obj = appearance.fetch(gfx->getXRef());
   if (appearBBox) {
-    gfx->drawAnnot(&obj, (AnnotBorder *)nullptr, color,
+    gfx->drawAnnot(&obj, nullptr, color,
                    appearBBox->getPageXMin(), appearBBox->getPageYMin(),
                    appearBBox->getPageXMax(), appearBBox->getPageYMax(),
                    getRotation());
   } else {
-    gfx->drawAnnot(&obj, (AnnotBorder *)nullptr, color,
+    gfx->drawAnnot(&obj, nullptr, color,
                    rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
   }
 }
@@ -3710,12 +3710,12 @@ void AnnotTextMarkup::draw(Gfx *gfx, GBool printing) {
   // draw the appearance stream
   Object obj = appearance.fetch(gfx->getXRef());
   if (appearBBox) {
-    gfx->drawAnnot(&obj, (AnnotBorder *)nullptr, color,
+    gfx->drawAnnot(&obj, nullptr, color,
                    appearBBox->getPageXMin(), appearBBox->getPageYMin(),
                    appearBBox->getPageXMax(), appearBBox->getPageYMax(),
                    getRotation());
   } else {
-    gfx->drawAnnot(&obj, (AnnotBorder *)nullptr, color,
+    gfx->drawAnnot(&obj, nullptr, color,
                    rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
   }
 }
@@ -4995,7 +4995,7 @@ void AnnotWidget::draw(Gfx *gfx, GBool printing) {
     gfx->pushResources(dict);
     delete dict;
   }
-  gfx->drawAnnot(&obj, (AnnotBorder *)nullptr, color,
+  gfx->drawAnnot(&obj, nullptr, color,
 		 rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
   if (addDingbatsResource) {
     gfx->popResources();
@@ -5132,7 +5132,7 @@ void AnnotMovie::draw(Gfx *gfx, GBool printing) {
 
   // draw the appearance stream
   Object obj = appearance.fetch(gfx->getXRef());
-  gfx->drawAnnot(&obj, (AnnotBorder *)nullptr, color,
+  gfx->drawAnnot(&obj, nullptr, color,
 		 rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
 }
 
@@ -5444,7 +5444,7 @@ void AnnotGeometry::draw(Gfx *gfx, GBool printing) {
 
   // draw the appearance stream
   Object obj = appearance.fetch(gfx->getXRef());
-  gfx->drawAnnot(&obj, (AnnotBorder *)nullptr, color,
+  gfx->drawAnnot(&obj, nullptr, color,
 		 rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
 }
 
@@ -5703,12 +5703,12 @@ void AnnotPolygon::draw(Gfx *gfx, GBool printing) {
   // draw the appearance stream
   Object obj = appearance.fetch(gfx->getXRef());
   if (appearBBox) {
-    gfx->drawAnnot(&obj, (AnnotBorder *)nullptr, color,
+    gfx->drawAnnot(&obj, nullptr, color,
                    appearBBox->getPageXMin(), appearBBox->getPageYMin(),
                    appearBBox->getPageXMax(), appearBBox->getPageYMax(),
                    getRotation());
   } else {
-    gfx->drawAnnot(&obj, (AnnotBorder *)nullptr, color,
+    gfx->drawAnnot(&obj, nullptr, color,
                    rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
   }
 }
@@ -5910,12 +5910,12 @@ void AnnotInk::draw(Gfx *gfx, GBool printing) {
   // draw the appearance stream
   Object obj = appearance.fetch(gfx->getXRef());
   if (appearBBox) {
-    gfx->drawAnnot(&obj, (AnnotBorder *)nullptr, color,
+    gfx->drawAnnot(&obj, nullptr, color,
                    appearBBox->getPageXMin(), appearBBox->getPageYMin(),
                    appearBBox->getPageXMax(), appearBBox->getPageYMax(),
                    getRotation());
   } else {
-    gfx->drawAnnot(&obj, (AnnotBorder *)nullptr, color,
+    gfx->drawAnnot(&obj, nullptr, color,
                    rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
   }
 }
@@ -6117,7 +6117,7 @@ void AnnotFileAttachment::draw(Gfx *gfx, GBool printing) {
 
   // draw the appearance stream
   Object obj = appearance.fetch(gfx->getXRef());
-  gfx->drawAnnot(&obj, (AnnotBorder *)nullptr, color,
+  gfx->drawAnnot(&obj, nullptr, color,
 		 rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
 }
 
@@ -6266,7 +6266,7 @@ void AnnotSound::draw(Gfx *gfx, GBool printing) {
 
   // draw the appearance stream
   obj = appearance.fetch(gfx->getXRef());
-  gfx->drawAnnot(&obj, (AnnotBorder *)nullptr, color,
+  gfx->drawAnnot(&obj, nullptr, color,
 		 rect->x1, rect->y1, rect->x2, rect->y2, getRotation());
 }
 
diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index 5b3b8f12..ea85dcd1 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -1353,7 +1353,7 @@ void Gfx::doSoftMask(Object *str, GBool alpha,
 
   // get resources
   obj1 = dict->lookup("Resources");
-  resDict = obj1.isDict() ? obj1.getDict() : (Dict *)nullptr;
+  resDict = obj1.isDict() ? obj1.getDict() : nullptr;
 
   // draw it
   ++formDepth;
@@ -4189,7 +4189,7 @@ void Gfx::opXObject(Object args[], int numArgs) {
   } else if (obj2.isName("PS")) {
     Object obj3 = obj1.streamGetDict()->lookup("Level1");
     out->psXObject(obj1.getStream(),
-		   obj3.isStream() ? obj3.getStream() : (Stream *)nullptr);
+		   obj3.isStream() ? obj3.getStream() : nullptr);
   } else if (obj2.isName()) {
     error(errSyntaxError, getPos(), "Unknown XObject subtype '{0:s}'", obj2.getName());
   } else {
@@ -4593,7 +4593,7 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) {
 			     maskStr, maskWidth, maskHeight, maskInvert, maskInterpolate);
       } else {
 	out->drawImage(state, ref, str, width, height, &colorMap, interpolate,
-		       haveColorKeyMask ? maskColors : (int *)nullptr, inlineImg);
+		       haveColorKeyMask ? maskColors : nullptr, inlineImg);
       }
     }
   }
@@ -4736,7 +4736,7 @@ void Gfx::doForm(Object *str) {
 
   // get resources
   Object resObj = dict->lookup("Resources");
-  resDict = resObj.isDict() ? resObj.getDict() : (Dict *)nullptr;
+  resDict = resObj.isDict() ? resObj.getDict() : nullptr;
 
   // check for a transparency group
   transpGroup = isolated = knockout = gFalse;
@@ -5278,7 +5278,7 @@ void Gfx::drawAnnot(Object *str, AnnotBorder *border, AnnotColor *aColor,
 
     // get the resources
     Object resObj = dict->lookup("Resources");
-    resDict = resObj.isDict() ? resObj.getDict() : (Dict *)nullptr;
+    resDict = resObj.isDict() ? resObj.getDict() : nullptr;
 
     // draw it
     drawForm(str, resDict, m, bbox);
diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index 662c9a49..b135d059 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -1675,7 +1675,7 @@ int *Gfx8BitFont::getCodeToGIDMap(FoFiTrueType *ff) {
 }
 
 Dict *Gfx8BitFont::getCharProcs() {
-  return charProcs.isDict() ? charProcs.getDict() : (Dict *)nullptr;
+  return charProcs.isDict() ? charProcs.getDict() : nullptr;
 }
 
 Object Gfx8BitFont::getCharProc(int code) {
@@ -1695,7 +1695,7 @@ Object Gfx8BitFont::getCharProcNF(int code) {
 }
 
 Dict *Gfx8BitFont::getResources() {
-  return resources.isDict() ? resources.getDict() : (Dict *)nullptr;
+  return resources.isDict() ? resources.getDict() : nullptr;
 }
 
 //------------------------------------------------------------------------
@@ -2088,7 +2088,7 @@ const CharCodeToUnicode *GfxCIDFont::getToUnicode() const {
 }
 
 GooString *GfxCIDFont::getCollection() {
-  return cMap ? cMap->getCollection() : (GooString *)nullptr;
+  return cMap ? cMap->getCollection() : nullptr;
 }
 
 int GfxCIDFont::mapCodeToGID(FoFiTrueType *ff, int cmapi,
diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index ef5aefbc..fa31c360 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -3285,7 +3285,7 @@ GfxPatternColorSpace::~GfxPatternColorSpace() {
 
 GfxColorSpace *GfxPatternColorSpace::copy() {
   return new GfxPatternColorSpace(under ? under->copy() :
-				          (GfxColorSpace *)nullptr);
+				          nullptr);
 }
 
 GfxColorSpace *GfxPatternColorSpace::parse(GfxResources *res, Array *arr, OutputDev *out, GfxState *state, int recursion) {
diff --git a/poppler/Hints.cc b/poppler/Hints.cc
index ecee0468..a231ba34 100644
--- a/poppler/Hints.cc
+++ b/poppler/Hints.cc
@@ -209,7 +209,7 @@ void Hints::readTables(BaseStream *str, Linearization *linearization, XRef *xref
      (num = obj.getInt(), obj = parser->getObj(), obj.isInt()) &&
      (gen = obj.getInt(), obj = parser->getObj(), obj.isCmd("obj")) &&
      (obj = parser->getObj(gFalse,
-         secHdlr ? secHdlr->getFileKey() : (Guchar *)nullptr,
+         secHdlr ? secHdlr->getFileKey() : nullptr,
          secHdlr ? secHdlr->getEncAlgorithm() : cryptRC4,
          secHdlr ? secHdlr->getFileKeyLength() : 0,
          num, gen, 0, gTrue), obj.isStream())) {
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index d6a31773..439b70bd 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -2479,7 +2479,7 @@ void PSOutputDev::setupEmbeddedTrueTypeFont(GfxFont *font, Ref *id,
       ffTT->convertToType42(psName->getCString(),
 			    ((Gfx8BitFont *)font)->getHasEncoding()
 			      ? ((Gfx8BitFont *)font)->getEncoding()
-			      : (char **)nullptr,
+			      : nullptr,
 			    codeToGID, outputFunc, outputStream);
       if (codeToGID) {
 	if (font8InfoLen >= font8InfoSize) {
@@ -2518,7 +2518,7 @@ void PSOutputDev::setupExternalTrueTypeFont(GfxFont *font, GooString *fileName,
     ffTT->convertToType42(psName->getCString(),
 			  ((Gfx8BitFont *)font)->getHasEncoding()
 			    ? ((Gfx8BitFont *)font)->getEncoding()
-			    : (char **)nullptr,
+			    : nullptr,
 			  codeToGID, outputFunc, outputStream);
     if (codeToGID) {
       if (font8InfoLen >= font8InfoSize) {
@@ -3190,7 +3190,7 @@ void PSOutputDev::setupForm(Ref id, Object *strObj) {
 
   // get resources
   Object resObj = dict->lookup("Resources");
-  resDict = resObj.isDict() ? resObj.getDict() : (Dict *)nullptr;
+  resDict = resObj.isDict() ? resObj.getDict() : nullptr;
 
   writePSFmt("/f_{0:d}_{1:d} {{\n", id.num, id.gen);
   writePS("q\n");
diff --git a/poppler/Page.cc b/poppler/Page.cc
index f460b7ed..7fea66c5 100644
--- a/poppler/Page.cc
+++ b/poppler/Page.cc
@@ -15,7 +15,7 @@
 //
 // Copyright (C) 2005 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2005 Jeff Muizelaar <jeff at infidigm.net>
-// Copyright (C) 2005-2013, 2016, 2017 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005-2013, 2016-2018 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2006-2008 Pino Toscano <pino at kde.org>
 // Copyright (C) 2006 Nickolay V. Shmyrev <nshmyrev at yandex.ru>
 // Copyright (C) 2006 Scott Turner <scotty1024 at mac.com>
@@ -508,7 +508,7 @@ Gfx *Page::createGfx(OutputDev *out, double hDPI, double vDPI,
     crop = (box == *cropBox) && out->needClipToCropBox();
   }
   gfx = new Gfx(doc, out, num, attrs->getResourceDict(),
-		hDPI, vDPI, &box, crop ? cropBox : (PDFRectangle *)nullptr,
+		hDPI, vDPI, &box, crop ? cropBox : nullptr,
 		rotate, abortCheckCbk, abortCheckCbkData, xrefA);
 
   return gfx;
diff --git a/poppler/SecurityHandler.cc b/poppler/SecurityHandler.cc
index bdfd89f8..58012595 100644
--- a/poppler/SecurityHandler.cc
+++ b/poppler/SecurityHandler.cc
@@ -324,9 +324,9 @@ GBool StandardSecurityHandler::isUnencrypted() {
 void *StandardSecurityHandler::makeAuthData(GooString *ownerPassword,
 					    GooString *userPassword) {
   return new StandardAuthData(ownerPassword ? ownerPassword->copy()
-			                    : (GooString *)nullptr,
+			                    : nullptr,
 			      userPassword ? userPassword->copy()
-			                   : (GooString *)nullptr);
+			                   : nullptr);
 }
 
 void *StandardSecurityHandler::getAuthData() {
diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index 7a92ff3b..66e0d047 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -310,7 +310,7 @@ TextFontInfo::TextFontInfo(GfxState *state) {
     gfxFont->incRefCnt();
 #ifdef TEXTOUT_WORD_LIST
   fontName = (gfxFont && gfxFont->getName()) ? gfxFont->getName()->copy()
-                                             : (GooString *)nullptr;
+                                             : nullptr;
   flags = gfxFont ? gfxFont->getFlags() : 0;
 #endif
 }
@@ -2176,7 +2176,7 @@ int TextBlock::visitDepthFirst(TextBlock *blkList, int pos1,
 			       GBool* visited) {
   const int blockCacheSize = 4;
   TextBlock *blockCache[blockCacheSize];
-  std::fill(blockCache, blockCache + blockCacheSize, (TextBlock*)nullptr);
+  std::fill(blockCache, blockCache + blockCacheSize, nullptr);
   return visitDepthFirst(blkList, pos1, sorted, sortPos, visited, blockCache,
 			 blockCacheSize);
 }
diff --git a/test/perf-test.cc b/test/perf-test.cc
index c73eed08..ea86c910 100644
--- a/test/perf-test.cc
+++ b/test/perf-test.cc
@@ -425,7 +425,7 @@ bool PdfEnginePoppler::load(const char *fileName)
     GooString *fileNameStr = new GooString(fileName);
     if (!fileNameStr) return false;
 
-    _pdfDoc = new PDFDoc(fileNameStr, nullptr, nullptr, (void*)nullptr);
+    _pdfDoc = new PDFDoc(fileNameStr, nullptr, nullptr, nullptr);
     if (!_pdfDoc->isOk()) {
         return false;
     }


More information about the poppler mailing list