Apply nullptr across the tree (#7890)
Some checks are pending
CodeQL / Analyze (cpp) (push) Waiting to run
CodeQL / Analyze (actions) (push) Waiting to run
Build Desktop / Configure (push) Waiting to run
Build Desktop / vcpkg baseline (push) Waiting to run
Build Desktop / Debian 13 (push) Blocked by required conditions
Build Desktop / Fedora 45 release (push) Blocked by required conditions
Build Desktop / Fedora 45 debug (push) Blocked by required conditions
Build Desktop / Servatrice_Debian 12 (push) Blocked by required conditions
Build Desktop / Ubuntu 26.04 (push) Blocked by required conditions
Build Desktop / Arch (push) Blocked by required conditions
Build Desktop / Debian 12 (push) Blocked by required conditions
Build Desktop / Fedora 44 (push) Blocked by required conditions
Build Desktop / Ubuntu 24.04 (push) Blocked by required conditions
Build Desktop / Ubuntu 26.04 sanitize (push) Blocked by required conditions
Build Desktop / Ubuntu 26.04 cover (push) Blocked by required conditions
Build Desktop / macOS 14 (push) Blocked by required conditions
Build Desktop / macOS 15 (push) Blocked by required conditions
Build Desktop / macOS 27 Debug (push) Blocked by required conditions
Build Desktop / Windows 10 (push) Blocked by required conditions
Build Desktop / macOS 13 Intel (push) Blocked by required conditions
Build Desktop / Prune caches (push) Waiting to run
Build Docker / Servatrice (arm) (push) Waiting to run
Build Docker / Servatrice (x86) (push) Waiting to run
Build Docker / Publish multi-platform Servatrice image (push) Blocked by required conditions

This commit is contained in:
AI-scor 2026-11-10 20:48:18 +01:00 • committed by GitHub
parent fa523af857
commit eb5672014d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 43 additions and 42 deletions

View file

@ -104,7 +104,7 @@ FilterTreeNode *FilterTreeModel::indexToNode(const QModelIndex &idx) const
}
ip = idx.internalPointer();
if (ip == NULL) {
if (ip == nullptr) {
return fTree;
}
@ -203,7 +203,7 @@ QVariant FilterTreeModel::data(const QModelIndex &index, int role) const
}
node = indexToNode(index);
if (node == NULL) {
if (node == nullptr) {
return QVariant();
}
@ -250,7 +250,7 @@ bool FilterTreeModel::setData(const QModelIndex &index, const QVariant &value, i
}
node = indexToNode(index);
if (node == NULL || node == fTree) {
if (node == nullptr || node == fTree) {
return false;
}
@ -357,7 +357,7 @@ bool FilterTreeModel::removeRows(int row, int count, const QModelIndex &parent)
}
node = indexToNode(parent);
if (node == NULL || last >= node->childCount()) {
if (node == nullptr || last >= node->childCount()) {
return false;
}

View file

@ -39,7 +39,7 @@ public:
{
return Type;
}
AbstractCardDragItem(AbstractCardItem *_item, const QPointF &_hotSpot, AbstractCardDragItem *parentDrag = 0);
AbstractCardDragItem(AbstractCardItem *_item, const QPointF &_hotSpot, AbstractCardDragItem *parentDrag = nullptr);
[[nodiscard]] QRectF boundingRect() const override
{
return QRectF(0, 0, CardDimensions::WIDTH_F, CardDimensions::HEIGHT_F);

View file

@ -27,7 +27,7 @@ CardDragItem::CardDragItem(CardItem *_item,
bool _forceFaceDown,
AbstractCardDragItem *parentDrag)
: AbstractCardDragItem(_item, _hotSpot, parentDrag), id(_id), forceFaceDown(_forceFaceDown), occupied(false),
currentZone(0)
currentZone(nullptr)
{
}
@ -46,8 +46,8 @@ void CardDragItem::updatePosition(const QPointF &cursorScenePos)
scene()->items(cursorScenePos, Qt::IntersectsItemBoundingRect, Qt::DescendingOrder,
static_cast<GameScene *>(scene())->getViewTransform());
CardZone *cardZone = 0;
ZoneViewZone *zoneViewZone = 0;
CardZone *cardZone = nullptr;
ZoneViewZone *zoneViewZone = nullptr;
for (int i = colliding.size() - 1; i >= 0; i--) {
CardZone *temp = qgraphicsitem_cast<CardZone *>(colliding.at(i));
if (!cardZone) {
@ -57,7 +57,7 @@ void CardDragItem::updatePosition(const QPointF &cursorScenePos)
zoneViewZone = qobject_cast<ZoneViewZone *>(temp);
}
}
CardZone *cursorZone = 0;
CardZone *cursorZone = nullptr;
if (zoneViewZone) {
cursorZone = zoneViewZone;
} else if (cardZone) {

View file

@ -29,7 +29,7 @@ public:
int _id,
const QPointF &_hotSpot,
bool _forceFaceDown,
AbstractCardDragItem *parentDrag = 0);
AbstractCardDragItem *parentDrag = nullptr);
int getId() const
{
return id;

View file

@ -47,7 +47,7 @@ struct CardRef;
DeckViewCardDragItem::DeckViewCardDragItem(DeckViewCard *_item,
const QPointF &_hotSpot,
AbstractCardDragItem *parentDrag)
: AbstractCardDragItem(_item, _hotSpot, parentDrag), currentZone(0)
: AbstractCardDragItem(_item, _hotSpot, parentDrag), currentZone(nullptr)
{
}
@ -55,7 +55,7 @@ void DeckViewCardDragItem::updatePosition(const QPointF &cursorScenePos)
{
QList<QGraphicsItem *> colliding = scene()->items(cursorScenePos);
DeckViewCardContainer *cursorZone = 0;
DeckViewCardContainer *cursorZone = nullptr;
for (int i = colliding.size() - 1; i >= 0; i--) {
if ((cursorZone = qgraphicsitem_cast<DeckViewCardContainer *>(colliding.at(i)))) {
break;
@ -105,7 +105,7 @@ void DeckViewCardDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
}
DeckViewCard::DeckViewCard(QGraphicsItem *parent, const CardRef &cardRef, const QString &_originZone)
: AbstractCardItem(parent, cardRef, 0, -1), originZone(_originZone), dragItem(0)
: AbstractCardItem(parent, cardRef, nullptr, -1), originZone(_originZone), dragItem(0)
{
setAcceptHoverEvents(true);
@ -364,7 +364,8 @@ void DeckViewCardContainer::setWidth(qreal _width)
update();
}
DeckViewScene::DeckViewScene(QObject *parent) : QGraphicsScene(parent), locked(true), deck(0), optimalAspectRatio(1.0)
DeckViewScene::DeckViewScene(QObject *parent)
: QGraphicsScene(parent), locked(true), deck(nullptr), optimalAspectRatio(1.0)
{
// Zone headers read the DeckList role at paint time and cache their
// rendering, so touch every item to invalidate the caches and pick up the
@ -453,7 +454,7 @@ void DeckViewScene::applySideboardPlan(const QList<MoveCard_ToZone> &plan)
continue;
}
DeckViewCard *card = 0;
DeckViewCard *card = nullptr;
const QList<DeckViewCard *> &cardList = start->getCards();
for (int j = 0; j < cardList.size(); ++j) {
if (cardList[j]->getName() == QString::fromStdString(m.card_name())) {

View file

@ -66,7 +66,7 @@ private:
void handleDrop(DeckViewCardContainer *target);
public:
DeckViewCardDragItem(DeckViewCard *_item, const QPointF &_hotSpot, AbstractCardDragItem *parentDrag = 0);
DeckViewCardDragItem(DeckViewCard *_item, const QPointF &_hotSpot, AbstractCardDragItem *parentDrag = nullptr);
void updatePosition(const QPointF &cursorScenePos) override;
protected:

View file

@ -63,7 +63,7 @@ protected:
}
};
GameView::GameView(GameScene *scene, QWidget *parent) : QGraphicsView(scene, parent), rubberBand(0)
GameView::GameView(GameScene *scene, QWidget *parent) : QGraphicsView(scene, parent), rubberBand(nullptr)
{
setObjectName("gameView");
setBackgroundBrush(QBrush(QColor(0, 0, 0)));

View file

@ -15,7 +15,7 @@ class QPoint;
class QPointF;
CardZone::CardZone(CardZoneLogic *_logic, QGraphicsItem *parent)
: AbstractGraphicsItem(parent), menu(nullptr), doubleClickAction(0), logic(_logic)
: AbstractGraphicsItem(parent), menu(nullptr), doubleClickAction(nullptr), logic(_logic)
{
connect(logic, &CardZoneLogic::retranslateUi, this, &CardZone::retranslateUi);
// Invalidation is connected before any consumer so a handler that reads cardItems()

View file

@ -91,7 +91,7 @@ public:
*/
[[nodiscard]] const QList<CardItem *> &cardItems() const;
void setMenu(QMenu *_menu, QAction *_doubleClickAction = 0)
void setMenu(QMenu *_menu, QAction *_doubleClickAction = nullptr)
{
menu = _menu;
doubleClickAction = _doubleClickAction;

View file

@ -364,7 +364,7 @@ CardItem *TableZone::getCardFromGrid(const QPoint &gridPoint) const
return cardItems().at(i);
}
}
return 0;
return nullptr;
}
CardItem *TableZone::getCardFromCoords(const QPointF &point) const

View file

@ -78,7 +78,7 @@ ZoneViewWidget::ZoneViewWidget(PlayerLogic *_player,
bool _writeableRevealZone,
const QList<const ServerInfo_Card *> &cardList,
bool _isReversed)
: QGraphicsWidget(0, Qt::Window), canBeShuffled(_origZone->getIsShufflable()), player(_player)
: QGraphicsWidget(nullptr, Qt::Window), canBeShuffled(_origZone->getIsShufflable()), player(_player)
{
setAcceptHoverEvents(true);
setAttribute(Qt::WA_DeleteOnClose);
@ -570,7 +570,7 @@ void ZoneViewWidget::handleScrollBarChange(int value)
void ZoneViewWidget::closeEvent(QCloseEvent *event)
{
stopWindowDrag();
disconnect(zone, &ZoneViewZone::closed, this, 0);
disconnect(zone, &ZoneViewZone::closed, this, nullptr);
// manually call zone->close in order to remove it from the origZones views
zone->close();
if (shuffleCheckBox.isChecked()) {

View file

@ -21,7 +21,7 @@ class DynamicFontSizeLabel : public QLabel
Q_OBJECT
public:
explicit DynamicFontSizeLabel(QWidget *parent = NULL, Qt::WindowFlags f = Qt::WindowFlags());
explicit DynamicFontSizeLabel(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
~DynamicFontSizeLabel()
{

View file

@ -17,7 +17,7 @@ class QWidget;
class DynamicFontSizePushButton : public QPushButton
{
public:
explicit DynamicFontSizePushButton(QWidget *parent = NULL);
explicit DynamicFontSizePushButton(QWidget *parent = nullptr);
/* This method overwrite stylesheet */
void setTextColor(QColor color);

View file

@ -73,7 +73,7 @@ RemoteDeckList_TreeModel::DirectoryNode *RemoteDeckList_TreeModel::DirectoryNode
return node->getNodeByPath(path);
}
}
return 0;
return nullptr;
}
RemoteDeckList_TreeModel::FileNode *RemoteDeckList_TreeModel::DirectoryNode::getNodeById(int id) const

View file

@ -229,7 +229,7 @@ Qt::ItemFlags RemoteReplayList_TreeModel::flags(const QModelIndex &index) const
ServerInfo_Replay const *RemoteReplayList_TreeModel::getReplay(const QModelIndex &index) const
{
if (!index.isValid()) {
return 0;
return nullptr;
}
auto *node = dynamic_cast<ReplayNode *>(static_cast<Node *>(index.internalPointer()));

View file

@ -71,7 +71,7 @@ private slots:
void gamesOfUserReceived(const Response &resp, const CommandContainer &commandContainer);
public:
UserContextMenu(TabSupervisor *_tabSupervisor, QWidget *_parent, AbstractGame *_game = 0);
UserContextMenu(TabSupervisor *_tabSupervisor, QWidget *_parent, AbstractGame *_game = nullptr);
void retranslateUi();
void showContextMenu(const QPoint &pos,
const QString &userName,

View file

@ -14,7 +14,7 @@
#include <qnamespace.h>
Tab::Tab(TabSupervisor *_tabSupervisor)
: QMainWindow(_tabSupervisor), tabSupervisor(_tabSupervisor), contentsChanged(false), infoPopup(0)
: QMainWindow(_tabSupervisor), tabSupervisor(_tabSupervisor), contentsChanged(false), infoPopup(nullptr)
{
setAttribute(Qt::WA_DeleteOnClose);
}
@ -43,7 +43,7 @@ void Tab::deleteCardInfoPopup(const QString &cardName)
if (infoPopup) {
if (currentCard.name == cardName || cardName == "_") {
infoPopup->deleteLater();
infoPopup = 0;
infoPopup = nullptr;
}
}
}

View file

@ -35,7 +35,7 @@ TabMessage::TabMessage(TabSupervisor *_tabSupervisor,
: Tab(_tabSupervisor), client(_client), ownUserInfo(new ServerInfo_User(_ownUserInfo)),
otherUserInfo(new ServerInfo_User(_otherUserInfo)), userOnline(_userOnline)
{
chatView = new ChatView(tabSupervisor, 0, true);
chatView = new ChatView(tabSupervisor, nullptr, true);
connect(chatView, &ChatView::showCardInfoPopup, this, &TabMessage::showCardInfoPopup);
connect(chatView, &ChatView::deleteCardInfoPopup, this, &TabMessage::deleteCardInfoPopup);
connect(chatView, &ChatView::addMentionTag, this, &TabMessage::addMentionTag);
@ -184,7 +184,7 @@ void TabMessage::processUserMessageEvent(const Event_UserMessage &event)
bool TabMessage::shouldShowSystemPopup(const Event_UserMessage &event)
{
return (QApplication::activeWindow() == 0 || QApplication::focusWidget() == 0 ||
return (QApplication::activeWindow() == nullptr || QApplication::focusWidget() == 0 ||
(event.sender_name() == otherUserInfo->name() &&
tabSupervisor->currentIndex() != tabSupervisor->indexOf(this)));
}
@ -192,7 +192,7 @@ bool TabMessage::shouldShowSystemPopup(const Event_UserMessage &event)
void TabMessage::showSystemPopup(const Event_UserMessage &event)
{
if (trayIcon) {
disconnect(trayIcon, &QSystemTrayIcon::messageClicked, 0, 0);
disconnect(trayIcon, &QSystemTrayIcon::messageClicked, nullptr, 0);
trayIcon->showMessage(tr("Private message from") + " " + otherUserInfo->name().c_str(),
event.message().c_str());
connect(trayIcon, &QSystemTrayIcon::messageClicked, this, &TabMessage::messageClicked);

View file

@ -137,7 +137,7 @@ Qt::DropActions SetsModel::supportedDropActions() const
QMimeData *SetsModel::mimeData(const QModelIndexList &indexes) const
{
if (indexes.isEmpty()) {
return 0;
return nullptr;
}
SetsMimeData *result = new SetsMimeData(indexes[0].row());

View file

@ -38,7 +38,7 @@
Server_Card::Server_Card(const CardRef &cardRef, int _id, int _coord_x, int _coord_y, Server_CardZone *_zone)
: zone(_zone), id(_id), coord_x(_coord_x), coord_y(_coord_y), cardRef(cardRef), tapped(false), attacking(false),
facedown(false), destroyOnZoneChange(false), doesntUntap(false), parentCard(0), stashedCard(nullptr)
facedown(false), destroyOnZoneChange(false), doesntUntap(false), parentCard(nullptr), stashedCard(nullptr)
{
}
@ -46,7 +46,7 @@ Server_Card::~Server_Card()
{
// setParentCard(0) leads to the item being removed from our list, so we can't iterate properly
while (!attachedCards.isEmpty()) {
attachedCards.first()->setParentCard(0);
attachedCards.first()->setParentCard(nullptr);
}
if (parentCard) {

View file

@ -127,7 +127,7 @@ Server_Game::~Server_Game()
room->removeGame(this);
delete creatorInfo;
creatorInfo = 0;
creatorInfo = nullptr;
gameMutex.unlock();
room->gamesLock.unlock();

View file

@ -245,7 +245,7 @@ public:
void createGameJoinedEvent(Server_AbstractParticipant *participant, ResponseContainer &rc, bool resuming);
GameEventContainer *
prepareGameEvent(const ::google::protobuf::Message &gameEvent, int playerId, GameEventContext *context = 0);
prepareGameEvent(const ::google::protobuf::Message &gameEvent, int playerId, GameEventContext *context = nullptr);
GameEventContext prepareGameEventContext(const ::google::protobuf::Message &gameEventContext);
void sendGameStateToPlayers();

View file

@ -180,7 +180,7 @@ public:
}
virtual DeckList *getDeckFromDatabase(int /* deckId */, int /* userId */)
{
return 0;
return nullptr;
}
/** @brief One folder row of a user's deck storage tree. */
struct DeckListFolderRecord

View file

@ -128,7 +128,7 @@ public slots:
void prepareDestroy();
public:
Server_ProtocolHandler(Server *_server, Server_DatabaseInterface *_databaseInterface, QObject *parent = 0);
Server_ProtocolHandler(Server *_server, Server_DatabaseInterface *_databaseInterface, QObject *parent = nullptr);
~Server_ProtocolHandler();
bool getAcceptsUserListChanges() const

View file

@ -23,7 +23,7 @@ GameEventStorageItem::~GameEventStorageItem()
delete event;
}
GameEventStorage::GameEventStorage() : gameEventContext(0), privatePlayerId(0)
GameEventStorage::GameEventStorage() : gameEventContext(nullptr), privatePlayerId(0)
{
}
@ -91,7 +91,7 @@ void GameEventStorage::sendToGame(Server_Game *game)
game->sendGameEventContainer(contOthers, GameEventStorageItem::SendToOthers, id);
}
ResponseContainer::ResponseContainer(int _cmdId) : cmdId(_cmdId), responseExtension(0)
ResponseContainer::ResponseContainer(int _cmdId) : cmdId(_cmdId), responseExtension(nullptr)
{
}

View file

@ -522,7 +522,7 @@ void Server_Room::removeGame(Server_Game *game)
// No need to lock gamesLock or gameMutex. This method is only
// called from ~Server_Game, which locks both mutexes anyway beforehand.
disconnect(game, 0, this, 0);
disconnect(game, nullptr, this, 0);
ServerInfo_Game gameInfo;
game->getInfo(gameInfo);