Use more nullptr instead of 0

This commit is contained in:
Friedrich W. H. Kossebau 2020-09-13 11:20:09 +02:00
parent 7d34808dd3
commit 1784c1d0cb
7 changed files with 14 additions and 14 deletions

View file

@ -1444,7 +1444,7 @@ void DocumentPrivate::sendGeneratorPixmapRequest()
void DocumentPrivate::rotationFinished(int page, Okular::Page *okularPage)
{
Okular::Page *wantedPage = m_pagesVector.value(page, 0);
Okular::Page *wantedPage = m_pagesVector.value(page, nullptr);
if (!wantedPage || wantedPage != okularPage)
return;
@ -1512,7 +1512,7 @@ void DocumentPrivate::slotGeneratorConfigChanged()
void DocumentPrivate::refreshPixmaps(int pageNumber)
{
Page *page = m_pagesVector.value(pageNumber, 0);
Page *page = m_pagesVector.value(pageNumber, nullptr);
if (!page)
return;
@ -3150,7 +3150,7 @@ void Document::requestPixmaps(const QLinkedList<PixmapRequest *> &requests, Pixm
for (PixmapRequest *request : requests) {
// set the 'page field' (see PixmapRequest) and check if it is valid
qCDebug(OkularCoreDebug).nospace() << "request observer=" << request->observer() << " " << request->width() << "x" << request->height() << "@" << request->pageNumber();
if (d->m_pagesVector.value(request->pageNumber()) == 0) {
if (d->m_pagesVector.value(request->pageNumber()) == nullptr) {
// skip requests referencing an invalid page (must not happen)
delete request;
continue;
@ -3614,7 +3614,7 @@ void Document::searchText(int searchID, const QString &text, bool fromStart, Qt:
const int viewportPage = (*d->m_viewportIterator).pageNumber;
const int fromStartSearchPage = forward ? 0 : d->m_pagesVector.count() - 1;
int currentPage = fromStart ? fromStartSearchPage : ((s->continueOnPage != -1) ? s->continueOnPage : viewportPage);
Page *lastPage = fromStart ? 0 : d->m_pagesVector[currentPage];
Page *lastPage = fromStart ? nullptr : d->m_pagesVector[currentPage];
int pagesDone = 0;
// continue checking last TextPage first (if it is the current page)

View file

@ -70,7 +70,7 @@ void ghostscript_interface::setPostScript(const PageNumber page, const QString &
qCDebug(OkularDviDebug) << "ghostscript_interface::setPostScript( " << page << ", ... )";
#endif
if (pageList.value(page) == 0) {
if (pageList.value(page) == nullptr) {
pageInfo *info = new pageInfo(PostScript);
// Check if dict is big enough
if (pageList.count() > pageList.capacity() - 2)
@ -94,7 +94,7 @@ void ghostscript_interface::setBackgroundColor(const PageNumber page, const QCol
qCDebug(OkularDviDebug) << "ghostscript_interface::setBackgroundColor( " << page << ", " << background_color << " )";
#endif
if (pageList.value(page) == 0) {
if (pageList.value(page) == nullptr) {
pageInfo *info = new pageInfo(QString());
info->background = background_color;
if (permanent)
@ -115,7 +115,7 @@ void ghostscript_interface::restoreBackgroundColor(const PageNumber page)
#ifdef DEBUG_PSGS
qCDebug(OkularDviDebug) << "ghostscript_interface::restoreBackgroundColor( " << page << " )";
#endif
if (pageList.value(page) == 0)
if (pageList.value(page) == nullptr)
return;
pageInfo *info = pageList.value(page);
@ -131,7 +131,7 @@ QColor ghostscript_interface::getBackgroundColor(const PageNumber page) const
qCDebug(OkularDviDebug) << "ghostscript_interface::getBackgroundColor( " << page << " )";
#endif
if (pageList.value(page) == 0)
if (pageList.value(page) == nullptr)
return Qt::white;
else
return pageList.value(page)->background;

View file

@ -213,7 +213,7 @@ Manifest::~Manifest()
ManifestEntry *Manifest::entryByName(const QString &filename)
{
return mEntries.value(filename, 0);
return mEntries.value(filename, nullptr);
}
bool Manifest::testIfEncrypted(const QString &filename)

View file

@ -239,7 +239,7 @@ Okular::Movie *createMovieFromPopplerScreen(const Poppler::LinkRendition *popple
QPair<Okular::Movie *, Okular::EmbeddedFile *> createMovieFromPopplerRichMedia(const Poppler::RichMediaAnnotation *popplerRichMedia)
{
const QPair<Okular::Movie *, Okular::EmbeddedFile *> emptyResult(0, 0);
const QPair<Okular::Movie *, Okular::EmbeddedFile *> emptyResult(nullptr, nullptr);
/**
* To convert a Flash/Video based RichMedia annotation to a movie, we search for the first

View file

@ -3191,7 +3191,7 @@ void Part::psTransformEnded(int exit, QProcess::ExitStatus status)
if (status != QProcess::NormalExit)
return;
QProcess *senderobj = sender() ? qobject_cast<QProcess *>(sender()) : 0;
QProcess *senderobj = sender() ? qobject_cast<QProcess *>(sender()) : nullptr;
if (senderobj) {
senderobj->close();
senderobj->deleteLater();

View file

@ -563,7 +563,7 @@ void AuthorGroupProxyModel::rebuildIndexes()
if (!author.isEmpty()) {
// We have the annotations as top-level, so introduce authors as new
// top-levels and append the annotations
AuthorGroupItem *authorItem = authorMap.value(author, 0);
AuthorGroupItem *authorItem = authorMap.value(author, nullptr);
if (!authorItem) {
authorItem = new AuthorGroupItem(d->mRoot, AuthorGroupItem::Author);
authorItem->setAuthor(author);
@ -589,7 +589,7 @@ void AuthorGroupProxyModel::rebuildIndexes()
const QModelIndex annIdx = sourceModel()->index(subRow, 0, idx);
const QString author = sourceModel()->data(annIdx, AnnotationModel::AuthorRole).toString();
AuthorGroupItem *authorItem = pageAuthorMap.value(author, 0);
AuthorGroupItem *authorItem = pageAuthorMap.value(author, nullptr);
if (!authorItem) {
authorItem = new AuthorGroupItem(pageItem, AuthorGroupItem::Author);
authorItem->setAuthor(author);

View file

@ -37,7 +37,7 @@
#include "settings_core.h"
#include "ui/debug_ui.h"
Q_GLOBAL_STATIC_WITH_ARGS(QPixmap, busyPixmap, (KIconLoader::global()->loadIcon(QLatin1String("okular"), KIconLoader::NoGroup, IconSize(KIconLoader::Desktop), KIconLoader::DefaultState, QStringList(), 0, true)))
Q_GLOBAL_STATIC_WITH_ARGS(QPixmap, busyPixmap, (KIconLoader::global()->loadIcon(QLatin1String("okular"), KIconLoader::NoGroup, IconSize(KIconLoader::Desktop), KIconLoader::DefaultState, QStringList(), nullptr, true)))
#define TEXTANNOTATION_ICONSIZE 24