diff options
author | Jonah BrĂ¼chert <jbb.prv@gmx.de> | 2019-11-12 22:37:07 +0100 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2019-11-18 13:59:07 -0600 |
commit | 7216b9fd3c0285a5e5dd1d5e1e21c618eb18eb1c (patch) | |
tree | 062aab47ab9fa1c8117aec98b0aac9fd9f6cb447 | |
parent | 5e3406bbb0139227d18fe4b8edf07c89204f37ae (diff) | |
download | phonesim-7216b9fd3c0285a5e5dd1d5e1e21c618eb18eb1c.tar.gz |
Use nullptrs
Done using the modernize-use-nullptr check of clang-tidy
-rw-r--r-- | src/aidapplication.h | 2 | ||||
-rw-r--r-- | src/callmanager.h | 2 | ||||
-rw-r--r-- | src/conformancesimapplication.cpp | 2 | ||||
-rw-r--r-- | src/control.cpp | 2 | ||||
-rw-r--r-- | src/control.h | 2 | ||||
-rw-r--r-- | src/gsmspec.cpp | 20 | ||||
-rw-r--r-- | src/hardwaremanipulator.h | 2 | ||||
-rw-r--r-- | src/main.cpp | 6 | ||||
-rw-r--r-- | src/phonesim.cpp | 54 | ||||
-rw-r--r-- | src/phonesim.h | 2 | ||||
-rw-r--r-- | src/qatresult.cpp | 2 | ||||
-rw-r--r-- | src/qatresultparser.cpp | 8 | ||||
-rw-r--r-- | src/qatutils.cpp | 12 | ||||
-rw-r--r-- | src/qcbsmessage.cpp | 2 | ||||
-rw-r--r-- | src/qsmsmessage.cpp | 8 | ||||
-rw-r--r-- | src/qsmsmessage_p.h | 4 | ||||
-rw-r--r-- | src/qwsppdu.cpp | 4 | ||||
-rw-r--r-- | src/server.cpp | 4 | ||||
-rw-r--r-- | src/simapplication.cpp | 22 | ||||
-rw-r--r-- | src/simapplication.h | 6 |
20 files changed, 83 insertions, 83 deletions
diff --git a/src/aidapplication.h b/src/aidapplication.h index 6a2f4d9..d8b1b93 100644 --- a/src/aidapplication.h +++ b/src/aidapplication.h @@ -66,7 +66,7 @@ class AidAppWrapper : public QObject { Q_OBJECT public: - AidAppWrapper( SimRules *r, QList<AidApplication *> apps, SimAuth *auth = NULL ); + AidAppWrapper( SimRules *r, QList<AidApplication *> apps, SimAuth *auth = nullptr ); ~AidAppWrapper(); bool command( const QString& cmd ); diff --git a/src/callmanager.h b/src/callmanager.h index c34e7fd..9b1eef0 100644 --- a/src/callmanager.h +++ b/src/callmanager.h @@ -51,7 +51,7 @@ class CallManager : public QObject { Q_OBJECT public: - CallManager( QObject *parent = 0 ); + CallManager( QObject *parent = nullptr ); ~CallManager(); // Process an AT command. Returns false if not a call-related command. diff --git a/src/conformancesimapplication.cpp b/src/conformancesimapplication.cpp index 108b060..2817b0c 100644 --- a/src/conformancesimapplication.cpp +++ b/src/conformancesimapplication.cpp @@ -147,7 +147,7 @@ void ConformanceSimApplication::mainMenu() cmd.setMenuItems( items ); - command( cmd, 0, 0 ); + command( cmd, nullptr, nullptr ); } void ConformanceSimApplication::mainMenuSelection( int id ) diff --git a/src/control.cpp b/src/control.cpp index 5eb82f1..1ea5294 100644 --- a/src/control.cpp +++ b/src/control.cpp @@ -503,7 +503,7 @@ void ControlWidget::resetTranslator() { QString fileName = QFileDialog::getOpenFileName(this, tr("Open Specification File"), QDir::homePath(), tr("Specification files (*.xml)")); - if(fileName != 0) + if(fileName != nullptr) translator->resetSpecification(fileName); } diff --git a/src/control.h b/src/control.h index fd1a4e6..6514bf4 100644 --- a/src/control.h +++ b/src/control.h @@ -149,7 +149,7 @@ class Control: public HardwareManipulator Q_OBJECT public: - Control(const QString& ruleFile, SimRules *sr, QObject *parent=0); + Control(const QString& ruleFile, SimRules *sr, QObject *parent=nullptr); virtual ~Control(); public slots: diff --git a/src/gsmspec.cpp b/src/gsmspec.cpp index 013ef62..fbb7e2a 100644 --- a/src/gsmspec.cpp +++ b/src/gsmspec.cpp @@ -137,11 +137,11 @@ void GSMSpec::setupDictionary(const QString& filePath) GsmXmlNode *specNode = handler->documentElement()->children; QString command, profile, format, response, description; - while ( specNode != 0 ) { + while ( specNode != nullptr ) { if ( specNode->tag == "spec" ) { GsmXmlNode *specData = specNode->children; - while ( specData != 0 ) { + while ( specData != nullptr ) { if( specData->tag == "command" ) { command = specData->contents; @@ -171,10 +171,10 @@ void GSMSpec::setupDictionary(const QString& filePath) GsmXmlNode::GsmXmlNode( const QString& _tag ) { - parent = 0; - next = 0; - children = 0; - attributes = 0; + parent = nullptr; + next = nullptr; + children = nullptr; + attributes = nullptr; tag = _tag; } @@ -200,7 +200,7 @@ GsmXmlNode::~GsmXmlNode() void GsmXmlNode::addChild( GsmXmlNode *child ) { GsmXmlNode *current = children; - GsmXmlNode *prev = 0; + GsmXmlNode *prev = nullptr; while ( current ) { prev = current; current = current->next; @@ -210,7 +210,7 @@ void GsmXmlNode::addChild( GsmXmlNode *child ) } else { children = child; } - child->next = 0; + child->next = nullptr; child->parent = this; } @@ -218,7 +218,7 @@ void GsmXmlNode::addChild( GsmXmlNode *child ) void GsmXmlNode::addAttribute( GsmXmlNode *child ) { GsmXmlNode *current = attributes; - GsmXmlNode *prev = 0; + GsmXmlNode *prev = nullptr; while ( current ) { prev = current; current = current->next; @@ -228,7 +228,7 @@ void GsmXmlNode::addAttribute( GsmXmlNode *child ) } else { attributes = child; } - child->next = 0; + child->next = nullptr; child->parent = this; } diff --git a/src/hardwaremanipulator.h b/src/hardwaremanipulator.h index 87a8c6e..ae071e5 100644 --- a/src/hardwaremanipulator.h +++ b/src/hardwaremanipulator.h @@ -34,7 +34,7 @@ class HardwareManipulator : public QObject Q_OBJECT public: - HardwareManipulator(SimRules *sr, QObject *parent=0); + HardwareManipulator(SimRules *sr, QObject *parent=nullptr); QSMSMessageList & getSMSList(); bool getSimPresent(); QStringList getSimAppsNameList(); diff --git a/src/main.cpp b/src/main.cpp index 684a9b7..b320140 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,7 +34,7 @@ static void usage() int main(int argc, char **argv) { - QString filename = NULL; + QString filename = nullptr; QCoreApplication *app; int port = 12345; int index; @@ -72,7 +72,7 @@ int main(int argc, char **argv) } - if (filename == NULL) { + if (filename == nullptr) { qWarning() << "ERROR: filename must be the last argument"; usage(); } @@ -85,7 +85,7 @@ int main(int argc, char **argv) } else app = new QCoreApplication(argc, argv); - PhoneSimServer *pss = new PhoneSimServer(filename, port, 0); + PhoneSimServer *pss = new PhoneSimServer(filename, port, nullptr); if (with_gui) pss->setHardwareManipulator(new ControlFactory); diff --git a/src/phonesim.cpp b/src/phonesim.cpp index f14281b..ba99fd0 100644 --- a/src/phonesim.cpp +++ b/src/phonesim.cpp @@ -44,10 +44,10 @@ SimXmlNode::SimXmlNode( const QString& _tag ) { - parent = 0; - next = 0; - children = 0; - attributes = 0; + parent = nullptr; + next = nullptr; + children = nullptr; + attributes = nullptr; tag = _tag; } @@ -72,7 +72,7 @@ SimXmlNode::~SimXmlNode() void SimXmlNode::addChild( SimXmlNode *child ) { SimXmlNode *current = children; - SimXmlNode *prev = 0; + SimXmlNode *prev = nullptr; while ( current ) { prev = current; current = current->next; @@ -82,7 +82,7 @@ void SimXmlNode::addChild( SimXmlNode *child ) } else { children = child; } - child->next = 0; + child->next = nullptr; child->parent = this; } @@ -90,7 +90,7 @@ void SimXmlNode::addChild( SimXmlNode *child ) void SimXmlNode::addAttribute( SimXmlNode *child ) { SimXmlNode *current = attributes; - SimXmlNode *prev = 0; + SimXmlNode *prev = nullptr; while ( current ) { prev = current; current = current->next; @@ -100,7 +100,7 @@ void SimXmlNode::addAttribute( SimXmlNode *child ) } else { attributes = child; } - child->next = 0; + child->next = nullptr; child->parent = this; } @@ -177,7 +177,7 @@ SimState::SimState( SimRules *rules, SimXmlNode& e ) _name = e.getAttribute( "name" ); } SimXmlNode *n = e.children; - while ( n != 0 ) { + while ( n != nullptr ) { if ( n->tag == "chat" ) { // Load a chat response definition. @@ -244,7 +244,7 @@ SimChat::SimChat( SimState *state, SimXmlNode& e ) deleteSMS = false; readSMS = false; - while ( n != 0 ) { + while ( n != nullptr ) { if ( n->tag == "command" ) { _command = n->contents; int w=_command.indexOf(QChar('*')); @@ -520,11 +520,11 @@ SimRules::SimRules(qintptr fd, QObject *p, const QString& filename, HardwareMan : QTcpSocket(p) { setSocketDescriptor(fd); - machine = 0; - toolkitApp = 0; + machine = nullptr; + toolkitApp = nullptr; if (hmf) - machine = hmf->create(this, 0); + machine = hmf->create(this, nullptr); if (machine) { connect(machine, SIGNAL(unsolicitedCommand(QString)), @@ -563,10 +563,10 @@ SimRules::SimRules(qintptr fd, QObject *p, const QString& filename, HardwareMan connect(this,SIGNAL(disconnected()), this,SLOT(destruct())); // Initialize the local state. - currentState = 0; - defState = 0; + currentState = nullptr; + defState = nullptr; usedCallIds = 0; - fileSystem = 0; + fileSystem = nullptr; useGsm0710 = false; currentChannel = 1; incomingUsed = 0; @@ -599,7 +599,7 @@ SimRules::SimRules(qintptr fd, QObject *p, const QString& filename, HardwareMan // Load the other states, and the start state's name (if specified). SimXmlNode *n = handler->documentElement()->children; QString start = QString(); - while ( n != 0 ) { + while ( n != nullptr ) { if ( n->tag == "state" ) { // Load a new state definition. @@ -886,29 +886,29 @@ void SimRules::destruct() simApps.removeAt( 0 ); delete conformanceApp; - conformanceApp = NULL; + conformanceApp = nullptr; delete defaultToolkitApp; - defaultToolkitApp = NULL; - toolkitApp = NULL; + defaultToolkitApp = nullptr; + toolkitApp = nullptr; if ( getMachine() ) getMachine()->handleNewApp(); if ( defState ) delete defState; - defState = NULL; + defState = nullptr; if ( _simAuth ) delete _simAuth; - _simAuth = NULL; + _simAuth = nullptr; if ( _callManager ) delete _callManager; - _callManager = NULL; + _callManager = nullptr; if ( fileSystem ) delete fileSystem; - fileSystem = NULL; + fileSystem = nullptr; if (machine) machine->deleteLater(); deleteLater(); @@ -968,7 +968,7 @@ SimState *SimRules::state( const QString& name ) const } qWarning() << "Warning: no state called \"" << name << "\" has been defined"; - return 0; + return nullptr; } bool SimRules::simCsimOk( const QByteArray& payload ) @@ -1319,7 +1319,7 @@ void SimRules::loadPhoneBook( SimXmlNode& node ) } SimPhoneBook *pb = phoneBooks[name]; SimXmlNode *n = node.children; - while ( n != 0 ) { + while ( n != nullptr ) { if ( n->tag == "entry" ) { // Load a phone book entry. int index = n->getAttribute( "index" ).toInt(); @@ -1553,7 +1553,7 @@ SimPhoneBook *SimRules::currentPB() const if ( phoneBooks.contains( currentPhoneBook ) ) return phoneBooks[currentPhoneBook]; else - return 0; + return nullptr; } int SimRules::newCall() diff --git a/src/phonesim.h b/src/phonesim.h index 466f88d..fef97d4 100644 --- a/src/phonesim.h +++ b/src/phonesim.h @@ -386,7 +386,7 @@ class QVariantTimer : public QTimer { Q_OBJECT public: - QVariantTimer( QObject *parent = 0 ) : QTimer(parent) { } + QVariantTimer( QObject *parent = nullptr ) : QTimer(parent) { } QVariant param; }; diff --git a/src/qatresult.cpp b/src/qatresult.cpp index d4b8cab..9a29503 100644 --- a/src/qatresult.cpp +++ b/src/qatresult.cpp @@ -45,7 +45,7 @@ public: result = "OK"; resultCode = QAtResult::OK; verbose = true; - userData = 0; + userData = nullptr; } ~QAtResultPrivate() { diff --git a/src/qatresultparser.cpp b/src/qatresultparser.cpp index 0cc0b24..cba41ad 100644 --- a/src/qatresultparser.cpp +++ b/src/qatresultparser.cpp @@ -328,7 +328,7 @@ QAtResultParser::Node::Node( uint number ) { _kind = Number; _number = number; - _list = 0; + _list = nullptr; } QAtResultParser::Node::Node( uint first, uint last ) @@ -336,14 +336,14 @@ QAtResultParser::Node::Node( uint first, uint last ) _kind = Range; _number = first; _last = last; - _list = 0; + _list = nullptr; } QAtResultParser::Node::Node( const QString& str ) { _kind = String; _str = str; - _list = 0; + _list = nullptr; } QAtResultParser::Node::Node( QList<Node> *list ) @@ -361,7 +361,7 @@ QAtResultParser::Node::Node( const Node& other ) _number = other._number; _last = other._last; _str = other._str; - _list = ( other._list ? new QList<Node>( *other._list ) : 0 ); + _list = ( other._list ? new QList<Node>( *other._list ) : nullptr ); } /*! diff --git a/src/qatutils.cpp b/src/qatutils.cpp index 6fa191f..51161bb 100644 --- a/src/qatutils.cpp +++ b/src/qatutils.cpp @@ -923,18 +923,18 @@ QByteArray QCodePage850Codec::convertFromUnicode(const QChar *in, int length, Co QTextCodec *QAtUtils::codec( const QString& gsmCharset ) { QString cs = gsmCharset.toLower(); - QTextCodec *codec = 0; + QTextCodec *codec = nullptr; // Convert the name into an appropriate codec. if ( cs == "gsm" ) { // 7-bit GSM character set. - static QTextCodec *gsm = 0; + static QTextCodec *gsm = nullptr; if ( !gsm ) gsm = new QGsmCodec(); codec = gsm; } else if ( cs == "gsm-noloss" ) { // 7-bit GSM character set, with no loss of quality. - static QTextCodec *gsmNoLoss = 0; + static QTextCodec *gsmNoLoss = nullptr; if ( !gsmNoLoss ) gsmNoLoss = new QGsmCodec( true ); codec = gsmNoLoss; @@ -943,13 +943,13 @@ QTextCodec *QAtUtils::codec( const QString& gsmCharset ) // be anything according to the specification, but we need to pick // something. We assume that it is 7-bit GSM, as that is the most // likely value. - static QTextCodec *hex = 0; + static QTextCodec *hex = nullptr; if ( !hex ) hex = new QGsmHexCodec(); codec = hex; } else if ( cs == "ucs2" ) { // Hex-encoded UCS2 character set. - static QTextCodec *ucs2 = 0; + static QTextCodec *ucs2 = nullptr; if ( !ucs2 ) ucs2 = new QUcs2HexCodec(); codec = ucs2; @@ -964,7 +964,7 @@ QTextCodec *QAtUtils::codec( const QString& gsmCharset ) // to handle embedded UCS-2 character strings. A hex UCS-2 string // will start with "80" and end with "FFFF". If the string does // not have this format, it is interpreted as code page 437. - static QTextCodec *cp437 = 0; + static QTextCodec *cp437 = nullptr; if ( !cp437 ) cp437 = new QCodePage437Codec(); codec = cp437; diff --git a/src/qcbsmessage.cpp b/src/qcbsmessage.cpp index a1c0913..b56a761 100644 --- a/src/qcbsmessage.cpp +++ b/src/qcbsmessage.cpp @@ -135,7 +135,7 @@ QCBSMessage::QCBSMessage() */ QCBSMessage::QCBSMessage(const QCBSMessage &msg) { - d = 0; + d = nullptr; *this = msg; } diff --git a/src/qsmsmessage.cpp b/src/qsmsmessage.cpp index 63d6952..ec158ef 100644 --- a/src/qsmsmessage.cpp +++ b/src/qsmsmessage.cpp @@ -85,7 +85,7 @@ public: mReplyRequest = false; mStatusReportRequested = false; mMessageType = QSMSMessage::Normal; - mCodec = 0; + mCodec = nullptr; mForceGsm = false; mBestScheme = (QSMSDataCodingScheme)(-1); mDataCodingScheme = -1; @@ -2030,7 +2030,7 @@ QString QPDUMessage::userData(QSMSDataCodingScheme scheme, QTextCodec *codec, QB uint ch; // Reset the header return. - headers = 0; + headers = nullptr; // Get the length of the user data payload. if ( implicitLength ) { @@ -2437,7 +2437,7 @@ QSMSMessage QSMSDeliverMessage::unpack(QTextCodec *codec) } // Read the user data field. - QByteArray *headers = 0; + QByteArray *headers = nullptr; QString text; text = userData( (QSMSDataCodingScheme)scheme, codec, headers, userDataHeader, false ); @@ -2590,7 +2590,7 @@ QCBSMessage QCBSDeliverMessage::unpack(QTextCodec *codec) mPosn += 6; // Read the user data field and strip CR's, LF's, and NUL's from the end. - QByteArray *headers = 0; + QByteArray *headers = nullptr; QString text = userData ( (QSMSDataCodingScheme)scheme, codec, headers, false, true ); len = text.length(); diff --git a/src/qsmsmessage_p.h b/src/qsmsmessage_p.h index f26d066..49060c7 100644 --- a/src/qsmsmessage_p.h +++ b/src/qsmsmessage_p.h @@ -169,7 +169,7 @@ class QSMSDeliverMessage: public QPDUMessage public: explicit QSMSDeliverMessage(const QByteArray &pdu); - QSMSMessage unpack(QTextCodec *codec=0); + QSMSMessage unpack(QTextCodec *codec=nullptr); }; class QCBSDeliverMessage: public QPDUMessage @@ -178,7 +178,7 @@ public: QCBSDeliverMessage(); explicit QCBSDeliverMessage(const QByteArray &pdu); - QCBSMessage unpack(QTextCodec *codec=0); + QCBSMessage unpack(QTextCodec *codec=nullptr); void pack(const QCBSMessage &m, QSMSDataCodingScheme scheme); }; diff --git a/src/qwsppdu.cpp b/src/qwsppdu.cpp index 49b9405..f487a35 100644 --- a/src/qwsppdu.cpp +++ b/src/qwsppdu.cpp @@ -108,7 +108,7 @@ static const char * const contentTypeAssignments[] = { "application/vnd.oma.drm.content", "application/vnd.oma.drm.rights+xml", "application/vnd.oma.drm.rights+wbxml", - 0 + nullptr }; #define numContentTypes (int)((sizeof(contentTypeAssignments) / \ sizeof(char *)) - 1) @@ -1731,7 +1731,7 @@ const QWspField *QWspPart::header(const QString &name) const return &(*it); } - return 0; + return nullptr; } /*! diff --git a/src/server.cpp b/src/server.cpp index 62487ee..3ff7def 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -25,7 +25,7 @@ static int phonenumber = 555000; PhoneSimServer::PhoneSimServer(const QString &f, quint16 port, QObject *parent) - : QTcpServer(parent), fact(0), currentRules(0) + : QTcpServer(parent), fact(nullptr), currentRules(nullptr) { listen( QHostAddress::Any, port ); filename = f; @@ -33,7 +33,7 @@ PhoneSimServer::PhoneSimServer(const QString &f, quint16 port, QObject *parent) PhoneSimServer::~PhoneSimServer() { - setHardwareManipulator(0); + setHardwareManipulator(nullptr); } void PhoneSimServer::setHardwareManipulator(HardwareManipulatorFactory *f) diff --git a/src/simapplication.cpp b/src/simapplication.cpp index c491674..f9169f2 100644 --- a/src/simapplication.cpp +++ b/src/simapplication.cpp @@ -30,8 +30,8 @@ public: { expectedType = QSimCommand::NoCommand; modemHandled = false; - target = 0; - slot = 0; + target = nullptr; + slot = nullptr; inResponse = false; } @@ -136,8 +136,8 @@ void SimApplication::abort() d->expectedType = QSimCommand::NoCommand; d->modemHandled = false; d->currentCommand = QByteArray(); - d->target = 0; - d->slot = 0; + d->target = nullptr; + d->slot = nullptr; endSession(); } @@ -196,8 +196,8 @@ bool SimApplication::envelope( const QSimEnvelope& env ) d->expectedType = QSimCommand::NoCommand; d->currentCommand = QByteArray(); - d->target = 0; - d->slot = 0; + d->target = nullptr; + d->slot = nullptr; if ( env.requestHelp() ) mainMenuHelpRequest( env.menuItem() ); else @@ -235,8 +235,8 @@ bool SimApplication::response( const QSimTerminalResponse& resp ) d->modemHandled = false; d->currentCommand = QByteArray(); } - d->target = 0; - d->slot = 0; + d->target = nullptr; + d->slot = nullptr; // Process the response. d->inResponse = true; @@ -247,7 +247,7 @@ bool SimApplication::response( const QSimTerminalResponse& resp ) int index = target->metaObject()->indexOfMethod( name.constData() ); if ( index != -1 ) { void *args[2]; - args[0] = 0; + args[0] = nullptr; args[1] = (void *)&resp; target->qt_metacall ( QMetaObject::InvokeMetaMethod, index, args ); @@ -500,7 +500,7 @@ void DemoSimApplication::mainMenu() cmd.setMenuItems( items ); - command( cmd, 0, 0 ); + command( cmd, nullptr, nullptr ); } void DemoSimApplication::sendDisplayText() @@ -2186,7 +2186,7 @@ void DemoSimApplication::timersMenuResp( const QSimTerminalResponse& resp ) cmd.setTimerId( 2 ); cmd.setDuration( 10000 ); cmd.setDestinationDevice( QSimCommand::ME ); - command( cmd, NULL, NULL ); + command( cmd, nullptr, nullptr ); break; case Timers_Query: diff --git a/src/simapplication.h b/src/simapplication.h index d80d0e6..c5c6501 100644 --- a/src/simapplication.h +++ b/src/simapplication.h @@ -32,7 +32,7 @@ class SimApplication : public QObject { Q_OBJECT public: - SimApplication( SimRules *rules, QObject *parent = 0 ); + SimApplication( SimRules *rules, QObject *parent = nullptr ); ~SimApplication(); virtual bool envelope( const QSimEnvelope& env ); @@ -67,7 +67,7 @@ class DemoSimApplication : public SimApplication { Q_OBJECT public: - DemoSimApplication( SimRules *rules, QObject *parent = 0 ); + DemoSimApplication( SimRules *rules, QObject *parent = nullptr ); ~DemoSimApplication(); const QString getName(); @@ -148,7 +148,7 @@ class ConformanceSimApplication : public SimApplication { Q_OBJECT public: - ConformanceSimApplication( SimRules *rules, QObject *parent = 0 ); + ConformanceSimApplication( SimRules *rules, QObject *parent = nullptr ); ~ConformanceSimApplication(); const QString getName(); |