Commit d1104f9d authored by Albert Astals Cid's avatar Albert Astals Cid

Don't cast nullptr

Doesn't make any sense
parent 8a845c65
......@@ -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;
......
......@@ -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 {
......
......@@ -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());
}
......
......@@ -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);
......
......@@ -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,
......
......@@ -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) {
......
......@@ -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())) {
......
......@@ -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");
......
......@@ -15,7 +15,7 @@
//
// Copyright (C) 2005 Kristian Høgsberg <krh@redhat.com>
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
// Copyright (C) 2005-2013, 2016, 2017 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2005-2013, 2016-2018 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2006-2008 Pino Toscano <pino@kde.org>
// Copyright (C) 2006 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
// Copyright (C) 2006 Scott Turner <scotty1024@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;
......
......@@ -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() {
......
......@@ -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);
}
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment