All of lore.kernel.org
 help / color / mirror / Atom feed
* Modernize phonesim codebase
@ 2019-11-12 21:37 Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  2019-11-12 21:37 ` [PATCH phonesim 01/13] Use nullptrs Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (12 more replies)
  0 siblings, 13 replies; 21+ messages in thread
From: Jonah =?unknown-8bit?q?Br=C3=BCchert?= @ 2019-11-12 21:37 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 906 bytes --]

Dear maintainers,
as mentioned earlier I'm now sending the remaining patches to ofono phonesim.

I tried to split them up logically and to explain them in their descriptions. If anything is still unclear, please ask.
Overall the patchset fixes all compiler warnings that appear with the recommedations of Qt, as found in QtCreator.

The changes that have been made automatically using clang tooling are marked as such in their descriptions, and should be reproducible when running clang-tidy again.

Some of the patches are independent of the others and can be left out if not wanted.

I'd still require some help testing the scripting functionality after my changes. If someone has a working scripting setup, I'd be glad if they could test this.
The changes related to scripting are basically a switch of the java script engine from the deprecated QtScript to QtQml.

Kind regards,
Jonah


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH phonesim 01/13] Use nullptrs
  2019-11-12 21:37 Modernize phonesim codebase Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-12 21:37 ` Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  2019-11-18 20:05   ` Denis Kenzior
  2019-11-12 21:37 ` [PATCH phonesim 02/13] Replace deprecated headers Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 21+ messages in thread
From: Jonah =?unknown-8bit?q?Br=C3=BCchert?= @ 2019-11-12 21:37 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 22999 bytes --]

Done using the modernize-use-nullptr check of clang-tidy
---
 src/aidapplication.h              |  2 +-
 src/callmanager.h                 |  2 +-
 src/conformancesimapplication.cpp |  2 +-
 src/control.cpp                   |  2 +-
 src/control.h                     |  2 +-
 src/gsmspec.cpp                   | 20 ++++++------
 src/hardwaremanipulator.h         |  2 +-
 src/main.cpp                      |  6 ++--
 src/phonesim.cpp                  | 54 +++++++++++++++----------------
 src/phonesim.h                    |  2 +-
 src/qatresult.cpp                 |  2 +-
 src/qatresultparser.cpp           |  8 ++---
 src/qatutils.cpp                  | 12 +++----
 src/qcbsmessage.cpp               |  2 +-
 src/qsmsmessage.cpp               |  8 ++---
 src/qsmsmessage_p.h               |  4 +--
 src/qwsppdu.cpp                   |  4 +--
 src/server.cpp                    |  4 +--
 src/simapplication.cpp            | 22 ++++++-------
 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();
--
2.24.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH phonesim 02/13] Replace deprecated headers
  2019-11-12 21:37 Modernize phonesim codebase Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  2019-11-12 21:37 ` [PATCH phonesim 01/13] Use nullptrs Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-12 21:37 ` Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  2019-11-12 21:37 ` [PATCH phonesim 03/13] Port old-style connects Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Jonah =?unknown-8bit?q?Br=C3=BCchert?= @ 2019-11-12 21:37 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1664 bytes --]

Done using the modernize-deprecated-headers check of clang-tidy
---
 src/main.cpp        | 2 +-
 src/phonesim.h      | 6 +++---
 src/qsmsmessage.cpp | 2 +-
 src/qwsppdu.cpp     | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/main.cpp b/src/main.cpp
index b320140..712e767 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -22,7 +22,7 @@
 #include <qapplication.h>
 #include <qstring.h>
 #include <qdebug.h>
-#include <stdlib.h>
+#include <cstdlib>

 static void usage()
 {
diff --git a/src/phonesim.h b/src/phonesim.h
index fef97d4..65ea794 100644
--- a/src/phonesim.h
+++ b/src/phonesim.h
@@ -33,11 +33,11 @@
 #include <qpointer.h>
 #include <qsimcontrolevent.h>

-#include <string.h>
-#include <stdlib.h>
+#include <cstring>
+#include <cstdlib>
 #include <sys/types.h>
 #include <unistd.h>
-#include <signal.h>
+#include <csignal>
 #include <sys/time.h>
 #include <sys/wait.h>
 #include <sys/select.h>
diff --git a/src/qsmsmessage.cpp b/src/qsmsmessage.cpp
index ec158ef..518e542 100644
--- a/src/qsmsmessage.cpp
+++ b/src/qsmsmessage.cpp
@@ -17,7 +17,7 @@
 **
 ****************************************************************************/

-#include <stdlib.h>
+#include <cstdlib>

 #include <qsmsmessage.h>
 #include <qcbsmessage.h>
diff --git a/src/qwsppdu.cpp b/src/qwsppdu.cpp
index f487a35..def5675 100644
--- a/src/qwsppdu.cpp
+++ b/src/qwsppdu.cpp
@@ -24,7 +24,7 @@
 #include <qiodevice.h>
 #include <qbuffer.h>
 #include <netinet/in.h>
-#include <stdlib.h>
+#include <cstdlib>

 // Reference: WAP-230-WSP
 //            Wireless Application Protocol
--
2.24.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH phonesim 03/13] Port old-style connects
  2019-11-12 21:37 Modernize phonesim codebase Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  2019-11-12 21:37 ` [PATCH phonesim 01/13] Use nullptrs Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  2019-11-12 21:37 ` [PATCH phonesim 02/13] Replace deprecated headers Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-12 21:37 ` Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  2019-11-18 20:06   ` Denis Kenzior
  2019-11-12 21:37 ` [PATCH phonesim 04/13] Replace QtScript with QtQml Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (9 subsequent siblings)
  12 siblings, 1 reply; 21+ messages in thread
From: Jonah =?unknown-8bit?q?Br=C3=BCchert?= @ 2019-11-12 21:37 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 16033 bytes --]

* Update CXX Standard to 14 to be able to use qOverload()
---
 configure.ac        |  4 +--
 src/callmanager.cpp | 22 ++++++-------
 src/control.cpp     | 77 +++++++++++++++++++++------------------------
 src/phonesim.cpp    | 56 +++++++++++++++++----------------
 src/phonesim.h      |  3 +-
 5 files changed, 80 insertions(+), 82 deletions(-)

diff --git a/configure.ac b/configure.ac
index e339691..5cc4545 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,8 +25,8 @@ AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
 PKG_CHECK_MODULES(QT, Qt5Core Qt5Gui Qt5Xml Qt5Network Qt5Script Qt5DBus Qt5Widgets, dummy=yes,
 						AC_MSG_ERROR(Qt is required))

-# Needed for Qt 5.7
-CXXFLAGS="$CXXFLAGS --std=gnu++11"
+# Needed for qOverload
+CXXFLAGS="$CXXFLAGS --std=gnu++14"

 AC_SUBST(QT_CFLAGS)
 AC_SUBST(QT_LIBS)
diff --git a/src/callmanager.cpp b/src/callmanager.cpp
index 1995c6d..fbdb179 100644
--- a/src/callmanager.cpp
+++ b/src/callmanager.cpp
@@ -33,11 +33,11 @@ CallManager::CallManager( QObject *parent )

     hangupTimer = new QTimer(this);
     hangupTimer->setSingleShot(true);
-    connect( hangupTimer, SIGNAL(timeout()), this, SLOT(hangupTimeout()) );
+    connect( hangupTimer, &QTimer::timeout, this, &CallManager::hangupTimeout );

     ringTimer = new QTimer(this);
     ringTimer->setSingleShot(true);
-    connect( ringTimer, SIGNAL(timeout()), this, SLOT(sendNextRing()) );
+    connect( ringTimer, &QTimer::timeout, this, &CallManager::sendNextRing );
 }

 CallManager::~CallManager()
@@ -92,19 +92,19 @@ bool CallManager::command( const QString& cmd )
         // Check for special dial-back numbers.
         if ( number == "199" ) {
             send( "NO CARRIER" );
-            QTimer::singleShot( 5000, this, SLOT(dialBack()) );
+            QTimer::singleShot( 5000, this, &CallManager::dialBack );
             return true;
         } else if ( number == "1993" ) {
             send( "NO CARRIER" );
-            QTimer::singleShot( 30000, this, SLOT(dialBack()) );
+            QTimer::singleShot( 30000, this, &CallManager::dialBack );
             return true;
         } else if ( number == "177" ) {
             send( "NO CARRIER" );
-            QTimer::singleShot( 2000, this, SLOT(dialBackWithHangup5()) );
+            QTimer::singleShot( 2000, this, &CallManager::dialBackWithHangup5 );
             return true;
         } else if ( number == "166" ) {
             send( "NO CARRIER" );
-            QTimer::singleShot( 1000, this, SLOT(dialBackWithHangup4()) );
+            QTimer::singleShot( 1000, this, &CallManager::dialBackWithHangup4 );
             return true;
         } else if ( number == "155" ) {
             send( "BUSY" );
@@ -156,11 +156,11 @@ bool CallManager::command( const QString& cmd )

         // Automatic accept of calls
         if ( number == "6789" ) {
-            QTimer::singleShot( 1000, this, SLOT(dialingToConnected()) );
+            QTimer::singleShot( 1000, this, &CallManager::dialingToConnected );
         } else if ( number.startsWith( "05123" ) ) {
-            QTimer::singleShot( 1000, this, SLOT(dialingToConnected()) );
+            QTimer::singleShot( 1000, this, &CallManager::dialingToConnected );
         } else if ( number.startsWith( "06123" ) ) {
-            QTimer::singleShot( 1000, this, SLOT(dialingToAlerting()) );
+            QTimer::singleShot( 1000, this, &CallManager::dialingToAlerting );
         }

     // Data call - phone number 696969
@@ -726,7 +726,7 @@ void CallManager::dialingToConnected()
         temp = temp.replace( "05123" , "" );
         int timeout = temp.toInt( &ok, 10 );
         timeout = ok ? timeout * 1000 : 10000;
-        QTimer::singleShot( timeout, this, SLOT(hangup()) );
+        QTimer::singleShot( timeout, this, &CallManager::hangup );
     }
 }

@@ -750,7 +750,7 @@ void CallManager::dialingToAlerting()
         temp = temp.replace( "06123" , "" );
         int timeout = temp.toInt( &ok, 10 );
         timeout = ok ? timeout * 1000 : 10000;
-        QTimer::singleShot( timeout, this, SLOT(dialingToConnected()) );
+        QTimer::singleShot( timeout, this, &CallManager::dialingToConnected );
     }
 }

diff --git a/src/control.cpp b/src/control.cpp
index 1ea5294..d4732b7 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -63,34 +63,34 @@ ControlWidget::ControlWidget(const QString &ruleFile, Control *parent)

     bus.registerObject("/", script, QDBusConnection::ExportAllSlots);

-    connect(ui->hsSignalQuality, SIGNAL(valueChanged(int)), this, SLOT(sendSQ()));
-    connect(ui->hsBatteryCharge, SIGNAL(valueChanged(int)), this, SLOT(sendBC()));
-    connect(ui->hsBatteryCharging, SIGNAL(stateChanged(int)), this, SLOT(chargingChanged(int)));
-    connect(ui->pbSelectOperator, SIGNAL(clicked()), this, SLOT(sendOPS()));
-    connect(ui->pbRegistration, SIGNAL(clicked()), this, SLOT(sendREG()));
-    connect(ui->pbSendCellBroadcast, SIGNAL(clicked()), this, SLOT(sendCBM()));
-    connect(ui->pbSendSMSMessage, SIGNAL(clicked()), this, SLOT(sendSMSMessage()));
-    connect(ui->pbFile, SIGNAL(clicked()), this, SLOT(selectFile()));
-    connect(ui->pbSendSMSDatagram, SIGNAL(clicked()), this, SLOT(sendSMSDatagram()));
-    connect(ui->pbIncomingCall, SIGNAL(clicked()), this, SLOT(sendCall()));
-    connect(ui->openSpecButton, SIGNAL(clicked()), this, SLOT(resetTranslator()));
-    connect(ui->atCheckBox, SIGNAL(clicked()), this, SLOT(atChanged()));
-    connect(ui->pbAddMessage, SIGNAL(clicked()), this, SLOT(addVoicemail()));
-    connect(ui->pbRemoveMessage, SIGNAL(clicked()), this, SLOT(delVoicemail()));
-    connect(ui->pbNotifyUDH, SIGNAL(clicked()), this, SLOT(sendVMNotify()));
-    connect(ui->pbNotifyUDHEnhanced, SIGNAL(clicked()), this, SLOT(sendEVMNotify()));
-    connect(ui->pbSendUSSD, SIGNAL(clicked()), this, SLOT(sendUSSD()));
-    connect(ui->pbCancelUSSD, SIGNAL(clicked()), this, SLOT(cancelUSSD()));
-    connect(ui->cbSimInserted, SIGNAL(clicked()), this, SLOT(simInsertRemove()));
-    connect(ui->pbStart, SIGNAL(clicked()), this, SLOT(simAppStart()));
-    connect(ui->pbAbort, SIGNAL(clicked()), this, SLOT(simAppAbort()));
-    connect(ui->pbReset, SIGNAL(clicked()), this, SLOT(modemSilentReset()));
-    connect(ui->pbSendGNSSData, SIGNAL(clicked()), this, SLOT(sendGNSSData()));
-    connect(ui->pbGNSSDefault, SIGNAL(clicked()), this, SLOT(setDefaultGNSSData()));
-    connect(ui->pbSendNotif, SIGNAL(clicked()), this, SLOT(sendCSSN()));
-    connect(ui->pbAlerting, SIGNAL(clicked()), this, SLOT(setStateAlerting()));
-    connect(ui->pbActive, SIGNAL(clicked()), this, SLOT(setStateConnected()));
-    connect(ui->pbHangup, SIGNAL(clicked()), this, SLOT(setStateHangup()));
+    connect(ui->hsSignalQuality, &QSlider::valueChanged, this, &ControlWidget::sendSQ);
+    connect(ui->hsBatteryCharge, &QSlider::valueChanged, this, &ControlWidget::sendBC);
+    connect(ui->hsBatteryCharging, &QCheckBox::stateChanged, this, &ControlWidget::chargingChanged);
+    connect(ui->pbSelectOperator, &QPushButton::clicked, this, &ControlWidget::sendOPS);
+    connect(ui->pbRegistration, &QPushButton::clicked, this, &ControlWidget::sendREG);
+    connect(ui->pbSendCellBroadcast, &QPushButton::clicked, this, &ControlWidget::sendCBM);
+    connect(ui->pbSendSMSMessage, &QPushButton::clicked, this, &ControlWidget::sendSMSMessage);
+    connect(ui->pbFile, &QPushButton::clicked, this, &ControlWidget::selectFile);
+    connect(ui->pbSendSMSDatagram, &QPushButton::clicked, this, &ControlWidget::sendSMSDatagram);
+    connect(ui->pbIncomingCall, &QPushButton::clicked, this, &ControlWidget::sendCall);
+    connect(ui->openSpecButton, &QPushButton::clicked, this, &ControlWidget::resetTranslator);
+    connect(ui->atCheckBox, &QCheckBox::clicked, this, &ControlWidget::atChanged);
+    connect(ui->pbAddMessage, &QPushButton::clicked, this, &ControlWidget::addVoicemail);
+    connect(ui->pbRemoveMessage, &QPushButton::clicked, this, &ControlWidget::delVoicemail);
+    connect(ui->pbNotifyUDH, &QPushButton::clicked, this, &ControlWidget::sendVMNotify);
+    connect(ui->pbNotifyUDHEnhanced, &QPushButton::clicked, this, &ControlWidget::sendEVMNotify);
+    connect(ui->pbSendUSSD, &QPushButton::clicked, this, &ControlWidget::sendUSSD);
+    connect(ui->pbCancelUSSD, &QPushButton::clicked, this, &ControlWidget::cancelUSSD);
+    connect(ui->cbSimInserted, &QCheckBox::clicked, this, &ControlWidget::simInsertRemove);
+    connect(ui->pbStart, &QPushButton::clicked, this, &ControlWidget::simAppStart);
+    connect(ui->pbAbort, &QPushButton::clicked, this, &ControlWidget::simAppAbort);
+    connect(ui->pbReset, &QPushButton::clicked, this, &ControlWidget::modemSilentReset);
+    connect(ui->pbSendGNSSData, &QPushButton::clicked, this, &ControlWidget::sendGNSSData);
+    connect(ui->pbGNSSDefault, &QPushButton::clicked, this, &ControlWidget::setDefaultGNSSData);
+    connect(ui->pbSendNotif, &QPushButton::clicked, this, &ControlWidget::sendCSSN);
+    connect(ui->pbAlerting, &QPushButton::clicked, this, &ControlWidget::setStateAlerting);
+    connect(ui->pbActive, &QPushButton::clicked, this, &ControlWidget::setStateConnected);
+    connect(ui->pbHangup, &QPushButton::clicked, this, &ControlWidget::setStateHangup);

     QStringList headers;
     headers << "Sender" << "Priority" << "Notification Status";
@@ -120,19 +120,14 @@ Control::Control(const QString& ruleFile, SimRules *sr, QObject *parent)
         : HardwareManipulator(sr, parent),
         widget(new ControlWidget(ruleFile, this))
 {
-    QList<QByteArray> proxySignals;
-    proxySignals
-        << SIGNAL(unsolicitedCommand(QString))
-        << SIGNAL(command(QString))
-        << SIGNAL(variableChanged(QString,QString))
-        << SIGNAL(switchTo(QString))
-        << SIGNAL(startIncomingCall(QString, QString, QString))
-        << SIGNAL(stateChangedToAlerting())
-        << SIGNAL(stateChangedToConnected())
-        << SIGNAL(stateChangedToHangup(int));
-
-    foreach (QByteArray sig, proxySignals)
-        connect(widget, sig, this, sig);
+    connect(widget, &ControlWidget::unsolicitedCommand, this, &Control::unsolicitedCommand);
+    connect(widget, &ControlWidget::command, this, &Control::command);
+    connect(widget, &ControlWidget::variableChanged, this, &Control::variableChanged);
+    connect(widget, &ControlWidget::switchTo, this, &Control::switchTo);
+    connect(widget, &ControlWidget::startIncomingCall, this, &Control::startIncomingCall);
+    connect(widget, &ControlWidget::stateChangedToAlerting, this, &Control::stateChangedToAlerting);
+    connect(widget, &ControlWidget::stateChangedToConnected, this, &Control::stateChangedToConnected);
+    connect(widget, &ControlWidget::stateChangedToHangup, this, &Control::stateChangedToHangup);
 }

 Control::~Control()
diff --git a/src/phonesim.cpp b/src/phonesim.cpp
index ba99fd0..1fd3c15 100644
--- a/src/phonesim.cpp
+++ b/src/phonesim.cpp
@@ -31,6 +31,7 @@
 #include <qbytearray.h>
 #include <qregexp.h>
 #include <qdebug.h>
+#include <qglobal.h>

 #define PHONEBOOK_NLENGTH 32
 #define PHONEBOOK_TLENGTH 16
@@ -362,8 +363,8 @@ bool SimChat::command( const QString& cmd )

             timer->setSingleShot( true );

-            connect(timer, SIGNAL(timeout()), this->state()->rules(),
-                    SLOT(delaySetVariable()));
+            connect(timer, &QTimer::timeout, this->state()->rules(),
+                    &SimRules::delaySetVariable);
             timer->start( delay );
         } else
             state()->rules()->setVariable( variable, val );
@@ -464,7 +465,7 @@ SimUnsolicited::SimUnsolicited( SimState *state, SimXmlNode& e )

     timer = new QTimer( this );
     timer->setSingleShot( true );
-    connect( timer, SIGNAL(timeout()), this, SLOT(timeout()) );
+    connect( timer, &QTimer::timeout, this, &SimUnsolicited::timeout );
 }


@@ -527,35 +528,36 @@ SimRules::SimRules(qintptr fd, QObject *p,  const QString& filename, HardwareMan
         machine = hmf->create(this, nullptr);

     if (machine) {
-        connect(machine, SIGNAL(unsolicitedCommand(QString)),
-                this, SLOT(unsolicited(QString)));
-        connect(machine, SIGNAL(command(QString)),
-                this, SLOT(command(QString)));
-        connect(machine, SIGNAL(variableChanged(QString,QString)),
-                this, SLOT(setVariable(QString,QString)));
-        connect(machine, SIGNAL(switchTo(QString)),
-                this, SLOT(switchTo(QString)));
+        connect(machine, &HardwareManipulator::unsolicitedCommand,
+                this, &SimRules::unsolicited);
+        connect(machine, &HardwareManipulator::command,
+                this, &SimRules::command);
+        connect(machine, &HardwareManipulator::variableChanged,
+                this, &SimRules::setVariable);
+        connect(machine, &HardwareManipulator::switchTo,
+                this, &SimRules::switchTo);
     }

+
     _callManager = new CallManager(this);
-    connect( _callManager, SIGNAL(send(QString)),
-             this, SLOT(respond(QString)) );
-    connect( _callManager, SIGNAL(unsolicited(QString)),
-             this, SLOT(unsolicited(QString)) );
-    connect( _callManager, SIGNAL(dialCheck(QString,bool&)),
-             this, SLOT(dialCheck(QString,bool&)) );
+    connect( _callManager, &CallManager::send,
+             this, qOverload<const QString &>( &SimRules::respond ) );
+    connect( _callManager, &CallManager::unsolicited,
+             this, &SimRules::unsolicited );
+    connect( _callManager, &CallManager::dialCheck,
+             this, &SimRules::dialCheck );

     if ( machine ) {
-        connect( machine, SIGNAL(startIncomingCall(QString,QString,QString)),
-                 _callManager, SLOT(startIncomingCall(QString,QString,QString)) );
-        connect ( _callManager, SIGNAL( callStatesChanged( QList<CallInfo> * ) ),
-                  machine, SLOT( callManagement( QList<CallInfo> * ) ) );
-        connect ( machine, SIGNAL( stateChangedToAlerting() ), _callManager,
-                SLOT( dialingToAlerting() ) );
-        connect ( machine, SIGNAL( stateChangedToConnected() ), _callManager,
-                SLOT( dialingToConnected() ) );
-        connect ( machine, SIGNAL( stateChangedToHangup( int ) ), _callManager,
-                SLOT( hangupRemote( int ) ) );
+        connect( machine, &HardwareManipulator::startIncomingCall, _callManager,
+                 qOverload<const QString &, const QString &, const QString &>( &CallManager::startIncomingCall ) );
+        connect ( _callManager, &CallManager::callStatesChanged,
+                  machine, &HardwareManipulator::callManagement);
+        connect ( machine, &HardwareManipulator::stateChangedToAlerting, _callManager,
+                &CallManager::dialingToAlerting );
+        connect ( machine, &HardwareManipulator::stateChangedToConnected, _callManager,
+                &CallManager::dialingToConnected );
+        connect ( machine, &HardwareManipulator::stateChangedToHangup, _callManager,
+                &CallManager::hangupRemote );
     }

     connect(this,SIGNAL(readyRead()),
diff --git a/src/phonesim.h b/src/phonesim.h
index 65ea794..ac5084d 100644
--- a/src/phonesim.h
+++ b/src/phonesim.h
@@ -300,6 +300,8 @@ public slots:
     // Set a variable to a new value.
     void setVariable( const QString& name, const QString& value );

+    void delaySetVariable();
+
     // Switch to a new simulator state.
     void switchTo(const QString& name);

@@ -320,7 +322,6 @@ private slots:
     void tryReadCommand();
     void destruct();
     void delayTimeout();
-    void delaySetVariable();
     void dialCheck( const QString& number, bool& ok );

 private:
--
2.24.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH phonesim 04/13] Replace QtScript with QtQml
  2019-11-12 21:37 Modernize phonesim codebase Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (2 preceding siblings ...)
  2019-11-12 21:37 ` [PATCH phonesim 03/13] Port old-style connects Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-12 21:37 ` Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  2019-11-18 20:47   ` Denis Kenzior
  2019-11-12 21:37 ` [PATCH phonesim 05/13] Port away from some deprecated Qt apis Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (8 subsequent siblings)
  12 siblings, 1 reply; 21+ messages in thread
From: Jonah =?unknown-8bit?q?Br=C3=BCchert?= @ 2019-11-12 21:37 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3373 bytes --]

---
 configure.ac    |  2 +-
 src/control.cpp | 18 +++++++++---------
 src/control.h   |  4 ++--
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5cc4545..0587f9f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@ AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
 	fi
 ])

-PKG_CHECK_MODULES(QT, Qt5Core Qt5Gui Qt5Xml Qt5Network Qt5Script Qt5DBus Qt5Widgets, dummy=yes,
+PKG_CHECK_MODULES(QT, Qt5Core Qt5Gui Qt5Xml Qt5Network Qt5Qml Qt5DBus Qt5Widgets, dummy=yes,
 						AC_MSG_ERROR(Qt is required))

 # Needed for qOverload
diff --git a/src/control.cpp b/src/control.cpp
index d4732b7..8c1e412 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -641,28 +641,28 @@ void ControlWidget::modemSilentReset()
 Script::Script(QObject *obj, Ui_ControlBase *ui) : QDBusAbstractAdaptor(obj)
 {
     /* Export tabs to be accessed by script */
-    QScriptValue qsTab = engine.newQObject(ui->tab);
+    QJSValue qsTab = engine.newQObject(ui->tab);
     engine.globalObject().setProperty("tabRegistration", qsTab);

-    QScriptValue qsTab2 = engine.newQObject(ui->tab_2);
+    QJSValue qsTab2 = engine.newQObject(ui->tab_2);
     engine.globalObject().setProperty("tabCBM", qsTab2);

-    QScriptValue qsTab3 = engine.newQObject(ui->tab_3);
+    QJSValue qsTab3 = engine.newQObject(ui->tab_3);
     engine.globalObject().setProperty("tabSMS", qsTab3);

-    QScriptValue qsTab4 = engine.newQObject(ui->tab_4);
+    QJSValue qsTab4 = engine.newQObject(ui->tab_4);
     engine.globalObject().setProperty("tabVoiceMail", qsTab4);

-    QScriptValue qsTab5 = engine.newQObject(ui->tab_5);
+    QJSValue qsTab5 = engine.newQObject(ui->tab_5);
     engine.globalObject().setProperty("tabUSSD", qsTab5);

-    QScriptValue qsTab6 = engine.newQObject(ui->tab_6);
+    QJSValue qsTab6 = engine.newQObject(ui->tab_6);
     engine.globalObject().setProperty("tabSIM", qsTab6);

-    QScriptValue qsTab8 = engine.newQObject(ui->tab_8);
+    QJSValue qsTab8 = engine.newQObject(ui->tab_8);
     engine.globalObject().setProperty("tabPosition", qsTab8);

-    QScriptValue qsTab9 = engine.newQObject(ui->tab_9);
+    QJSValue qsTab9 = engine.newQObject(ui->tab_9);
     engine.globalObject().setProperty("tabCall", qsTab9);
 }

@@ -705,7 +705,7 @@ QString Script::Run(const QString &name, const QDBusMessage &msg)
     QString contents = stream.readAll();
     scriptFile.close();

-    QScriptValue qsScript = engine.evaluate(contents);
+    QJSValue qsScript = engine.evaluate(contents);
     if (qsScript.isError()) {
         QString info = fileName + ", line " + qsScript.property("lineNumber").toString() + ", " + qsScript.toString();
         QDBusMessage reply = msg.createErrorReply(SERVICE ".Error.ScriptExecError", info);
diff --git a/src/control.h b/src/control.h
index 6514bf4..a7c0ff3 100644
--- a/src/control.h
+++ b/src/control.h
@@ -22,7 +22,7 @@

 #include <hardwaremanipulator.h>
 #include <QtDBus/QtDBus>
-#include <QtScript>
+#include <QJSEngine>
 #include "ui_controlbase.h"
 #include "attranslator.h"
 #include "callmanager.h"
@@ -58,7 +58,7 @@ public slots:

 private:
     QString dirPath;
-    QScriptEngine engine;
+    QJSEngine engine;
 };

 class ControlWidget : public QWidget
--
2.24.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH phonesim 05/13] Port away from some deprecated Qt apis
  2019-11-12 21:37 Modernize phonesim codebase Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (3 preceding siblings ...)
  2019-11-12 21:37 ` [PATCH phonesim 04/13] Replace QtScript with QtQml Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-12 21:37 ` Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  2019-11-12 21:37 ` [PATCH phonesim 06/13] qwsppdu: Port to QLocale Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Jonah =?unknown-8bit?q?Br=C3=BCchert?= @ 2019-11-12 21:37 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 2907 bytes --]

---
 src/qsimcommand.cpp    | 4 ++++
 src/qsmsmessage.cpp    | 4 ++++
 src/qwsppdu.cpp        | 4 ++--
 src/simapplication.cpp | 2 +-
 4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/qsimcommand.cpp b/src/qsimcommand.cpp
index 672ffb9..6642035 100644
--- a/src/qsimcommand.cpp
+++ b/src/qsimcommand.cpp
@@ -3764,7 +3764,11 @@ void QSimCommand::addExtensionField( int tag, const QByteArray& value )
 QSimCommandPrivate *QSimCommand::dwrite()
 {
     // If we are the only user of the private object, return it as-is.
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
+    if ( d->ref.loadRelaxed() == 1 )
+#else
     if ( d->ref.load() == 1 )
+#endif
         return d;

     // Create a new private object and copy the current contents into it.
diff --git a/src/qsmsmessage.cpp b/src/qsmsmessage.cpp
index 518e542..e4e41b9 100644
--- a/src/qsmsmessage.cpp
+++ b/src/qsmsmessage.cpp
@@ -365,7 +365,11 @@ QSMSMessage::~QSMSMessage()
 QSMSMessagePrivate *QSMSMessage::dwrite()
 {
     // If we are the only user of the private object, return it as-is.
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
+    if ( d->ref.loadRelaxed() == 1 )
+#else
     if ( d->ref.load() == 1 )
+#endif
         return d;

     // Create a new private object and copy the current contents into it.
diff --git a/src/qwsppdu.cpp b/src/qwsppdu.cpp
index def5675..26f450d 100644
--- a/src/qwsppdu.cpp
+++ b/src/qwsppdu.cpp
@@ -292,7 +292,7 @@ static QString secsToUTC(int seconds)

     int h = seconds / 3600;
     int m = ( abs(seconds) - abs(h * 3600) ) / 60;
-    str.sprintf("%+.2d%.2d", h, m );
+    str.asprintf("%+.2d%.2d", h, m );

     return str;
 }
@@ -413,7 +413,7 @@ QString QWspDateTime::dateString(QDateTime d)
     QByteArray dayName = date.shortDayName(date.dayOfWeek()).toUtf8();
     QByteArray monthName = date.shortMonthName(date.month()).toUtf8();
     QByteArray utcOffs = secsToUTC(timeZoneDiff()).toUtf8();
-    str.sprintf("%s, %.2d %s %d %.2d:%.2d:%.2d %s",
+    str.asprintf("%s, %.2d %s %d %.2d:%.2d:%.2d %s",
             dayName.constData(),
             date.day(),
             monthName.constData(),
diff --git a/src/simapplication.cpp b/src/simapplication.cpp
index f9169f2..84058af 100644
--- a/src/simapplication.cpp
+++ b/src/simapplication.cpp
@@ -2227,7 +2227,7 @@ void DemoSimApplication::timersCmdResp( const QSimTerminalResponse& resp )
     if ( resp.command().qualifier() == 2 ) {
         if ( resp.result() == QSimTerminalResponse::Success ) {
             QString status;
-            status.sprintf( "Timer %i expires in %i:%02i:%02i.\n",
+            status.asprintf( "Timer %i expires in %i:%02i:%02i.\n",
                     resp.timerId(), resp.duration() / 3600000,
                     (resp.duration() / 60000) % 60,
                     (resp.duration() / 1000) % 60 );
--
2.24.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH phonesim 06/13] qwsppdu: Port to QLocale
  2019-11-12 21:37 Modernize phonesim codebase Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (4 preceding siblings ...)
  2019-11-12 21:37 ` [PATCH phonesim 05/13] Port away from some deprecated Qt apis Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-12 21:37 ` Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  2019-11-12 21:37 ` [PATCH phonesim 07/13] Port away from Q_FOREACH Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Jonah =?unknown-8bit?q?Br=C3=BCchert?= @ 2019-11-12 21:37 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1669 bytes --]

---
 src/qwsppdu.cpp | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/qwsppdu.cpp b/src/qwsppdu.cpp
index 26f450d..f3a1661 100644
--- a/src/qwsppdu.cpp
+++ b/src/qwsppdu.cpp
@@ -18,13 +18,15 @@
 ****************************************************************************/

 #include <qwsppdu.h>
-#include <qstringlist.h>
-#include <qtextcodec.h>
+
+#include <cstdlib>
+#include <netinet/in.h>
+#include <qbuffer.h>
 #include <qdatetime.h>
+#include <qlocale.h>
 #include <qiodevice.h>
-#include <qbuffer.h>
-#include <netinet/in.h>
-#include <cstdlib>
+#include <qstringlist.h>
+#include <qtextcodec.h>

 // Reference: WAP-230-WSP
 //            Wireless Application Protocol
@@ -409,9 +411,10 @@ QString QWspDateTime::dateString(QDateTime d)
 {
     QDate date = d.date();
     QTime time = d.time();
+    QLocale locale;
     QString str;
-    QByteArray dayName = date.shortDayName(date.dayOfWeek()).toUtf8();
-    QByteArray monthName = date.shortMonthName(date.month()).toUtf8();
+    QByteArray dayName = locale.dayName(date.dayOfWeek(), QLocale::ShortFormat).toUtf8();
+    QByteArray monthName = locale.monthName(date.month(), QLocale::ShortFormat).toUtf8();
     QByteArray utcOffs = secsToUTC(timeZoneDiff()).toUtf8();
     str.asprintf("%s, %.2d %s %d %.2d:%.2d:%.2d %s",
             dayName.constData(),
@@ -434,7 +437,7 @@ QString QWspDateTime::dateString(QDateTime d)
 QDateTime QWspDateTime::fromGmtTime_t(quint32 t)
 {
     QDateTime dt;
-    dt.setTime_t(t + timeZoneDiff());
+    dt.setSecsSinceEpoch(t + timeZoneDiff());
     return dt;
 }

--
2.24.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH phonesim 07/13] Port away from Q_FOREACH
  2019-11-12 21:37 Modernize phonesim codebase Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (5 preceding siblings ...)
  2019-11-12 21:37 ` [PATCH phonesim 06/13] qwsppdu: Port to QLocale Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-12 21:37 ` Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  2019-11-12 21:37 ` [PATCH phonesim 08/13] Port deprecations in controlbase.ui Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Jonah =?unknown-8bit?q?Br=C3=BCchert?= @ 2019-11-12 21:37 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 10140 bytes --]

---
 src/aidapplication.cpp      |  4 ++--
 src/callmanager.cpp         |  6 +++---
 src/control.cpp             | 19 +++++++++----------
 src/hardwaremanipulator.cpp |  4 ++--
 src/phonesim.cpp            |  4 ++--
 src/qsimcommand.cpp         | 10 +++++-----
 src/simfilesystem.cpp       |  8 ++++----
 7 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/src/aidapplication.cpp b/src/aidapplication.cpp
index e255145..16fef0c 100644
--- a/src/aidapplication.cpp
+++ b/src/aidapplication.cpp
@@ -47,7 +47,7 @@ bool AidAppWrapper::command( const QString& cmd )
             return true;
         }

-        foreach ( AidApplication* app, applications )
+        for ( AidApplication* app : qAsConst(applications) )
         response += app->getAid();

         response.append( "\n\nOK" );
@@ -72,7 +72,7 @@ bool AidAppWrapper::command( const QString& cmd )
         aid = cmd.split('=')[1];
         aid = aid.replace("\"", "");

-        foreach ( AidApplication* app, applications ) {
+        for ( AidApplication* app : qAsConst(applications) ) {
             if ( app->getAid().contains( aid ) ) {
                 if ( sessions.size() >= MAX_LOGICAL_CHANNELS )
                     break;
diff --git a/src/callmanager.cpp b/src/callmanager.cpp
index fbdb179..1fa13cf 100644
--- a/src/callmanager.cpp
+++ b/src/callmanager.cpp
@@ -195,7 +195,7 @@ bool CallManager::command( const QString& cmd )
     } else if ( cmd == "AT+CLCC" ) {

         // List all calls that are presently active.
-        foreach ( CallInfo info, callList ) {
+        for ( const CallInfo &info : qAsConst(callList) ) {
             int multiparty;
             if ( countForState(info.state) >= 2 )
                 multiparty = 1;
@@ -821,7 +821,7 @@ int CallManager::newId()
     bool seen;
     for ( id = 1; id <= 32; ++id ) {
         seen = false;
-        foreach ( CallInfo info, callList ) {
+        for ( const CallInfo &info : qAsConst(callList) ) {
             if ( info.id == id ) {
                 seen = true;
                 break;
@@ -879,7 +879,7 @@ int CallManager::indexForId( int id )

 bool CallManager::hasCall( CallState state )
 {
-    foreach ( CallInfo info, callList ) {
+    for ( const CallInfo &info : qAsConst(callList) ) {
         if ( info.state == state )
             return true;
     }
diff --git a/src/control.cpp b/src/control.cpp
index 8c1e412..817a0b2 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -147,7 +147,7 @@ void Control::callManagement( QList<CallInfo> *list )

     widget->clearCallView();

-    foreach( CallInfo i, *list ) {
+    for ( const CallInfo &i : qAsConst(*list) ) {
         QString param[5];

         if ( i.incoming && !enableCSSU )
@@ -181,15 +181,15 @@ void ControlWidget::setStateAlerting()

 void ControlWidget::setStateHangup()
 {
-    QList <QTableWidgetItem *> items = ui->twCallMgt->selectedItems();
+    const QList <QTableWidgetItem *> items = ui->twCallMgt->selectedItems();

-    foreach ( QTableWidgetItem *item, items )
+    for ( QTableWidgetItem *item : items )
     {
         int row = item->row();
         if ( row >= 0 )
         {
             QTableWidgetItem *itemCallId = ui->twCallMgt->item( row, 0 );
-            if ( itemCallId != 0 )
+            if ( itemCallId != nullptr )
             {
                 QString strid = itemCallId->text();
                 int id = strid.toInt();
@@ -360,9 +360,9 @@ void ControlWidget::setDefaultGNSSData()

 void ControlWidget::sendGNSSData()
 {
-    QStringList xml = ui->teGNSStext->toPlainText().split("\n");
+    const QStringList xml = ui->teGNSStext->toPlainText().split("\n");

-    foreach ( QString line, xml )
+    for ( const QString &line : xml )
     {
         if (!line.isEmpty()) {
             QString cposr =  "+CPOSR: " + line;
@@ -468,9 +468,8 @@ void Control::handleFromData( const QString& cmd )

 void ControlWidget::handleToData( const QString& cmd )
 {
-    QStringList dataList = cmd.split("\n");
-    QString dataItem;
-    foreach( dataItem, dataList ){
+    const QStringList dataList = cmd.split("\n");
+    for ( auto &dataItem : dataList ){
         if( dataItem != "" ){
             ui->atViewer->append( dataItem + " : " + translator->translateCommand(dataItem) );
         }
@@ -564,7 +563,7 @@ void ControlWidget::addVoicemail()

 void ControlWidget::delVoicemail()
 {
-    foreach ( QTableWidgetSelectionRange range,
+    for ( QTableWidgetSelectionRange &range :
             ui->twMessageList->selectedRanges() ) {
         for ( int i = range.topRow(); i <= range.bottomRow(); i ++ ) {
             VoicemailItem &item = mailbox[i];
diff --git a/src/hardwaremanipulator.cpp b/src/hardwaremanipulator.cpp
index 6c83c8e..7a61c0e 100644
--- a/src/hardwaremanipulator.cpp
+++ b/src/hardwaremanipulator.cpp
@@ -239,7 +239,7 @@ void HardwareManipulator::sendVMNotify( int type, int count, const QList<QVMMess
             mwiUdh.append( count );    // Number of Voice Messages
             mwiUdh.append( received.size() ); // Number of VM Notifications

-            foreach ( QVMMessage msg, received ) {
+            for ( const QVMMessage &msg : received ) {
                 mwiUdh.append( msg.id & 0xff );
                 mwiUdh.append( msg.id >> 8 ); // Endianness doesn't matter here
                 mwiUdh.append( qMin( msg.lengthSecs, 255 ) );
@@ -261,7 +261,7 @@ void HardwareManipulator::sendVMNotify( int type, int count, const QList<QVMMess
             mwiUdh.append( count ); // Number of Voice Messages
             mwiUdh.append( deleted.size() ); // Number of VM Notifications

-            foreach ( QVMMessage msg, deleted ) {
+            for ( const QVMMessage &msg : deleted ) {
                 mwiUdh.append( msg.id & 0xff );
                 mwiUdh.append( msg.id >> 8 ); // Endianness doesn't matter here
                 mwiUdh.append( qMin( msg.lengthSecs, 255 ) );
diff --git a/src/phonesim.cpp b/src/phonesim.cpp
index 1fd3c15..0f72a09 100644
--- a/src/phonesim.cpp
+++ b/src/phonesim.cpp
@@ -1380,9 +1380,9 @@ void SimRules::phoneBook( const QString& cmd )
     }

     if ( cmd.startsWith( "AT+CPBS=?" ) ) {
-        QStringList names = phoneBooks.keys();
+        const QStringList names = phoneBooks.keys();
         QString response = "+CPBS: (";
-        foreach ( QString name, names ) {
+        for ( const QString &name : names ) {
             if ( response.length() > 8 )
                 response += QChar(',');
             response += "\"" + name + "\"";
diff --git a/src/qsimcommand.cpp b/src/qsimcommand.cpp
index 6642035..fb200ed 100644
--- a/src/qsimcommand.cpp
+++ b/src/qsimcommand.cpp
@@ -3119,7 +3119,7 @@ static void writeSubAddress( QByteArray& data, const QString& value )
     writeBerLength( data, value.length() + 2 );
     data += (char)0x80;     // NSAP address type
     data += (char)0x50;     // NSAP address is BCD-encoded IA5 characters
-    foreach ( QChar ch, value ) {
+    for ( const QChar &ch : value ) {
         int val = ch.unicode() - 32;
         if ( val > 127 )
             val = 0;
@@ -3368,7 +3368,7 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const
                 data += (char)0x8F;
                 data += (char)0x00;
             }
-            foreach ( QSimMenuItem item, menuItems() ) {
+            for ( QSimMenuItem &item : menuItems() ) {
                 QByteArray contents;
                 contents += (char)item.identifier();
                 writeEFADN( contents, item.label(), options, -1 );
@@ -3386,7 +3386,7 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const
             if ( hasNextActions ) {
                 data += (char)0x18;
                 data += (char)menuItems().size();
-                foreach ( QSimMenuItem item, menuItems() )
+                for ( const QSimMenuItem &item : menuItems() )
                     data += (char)item.nextAction();
             }
             if ( type() == SelectItem && defaultItem() != 0 ) {
@@ -3399,14 +3399,14 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const
                 data += (char)0x9F;
                 data += (char)(menuItems().size() + 1);
                 data += (char)(selfExplanatory ? 0x00 : 0x01);
-                foreach ( QSimMenuItem item, menuItems() )
+                for ( const QSimMenuItem &item : menuItems() )
                     data += (char)item.iconId();
             }
             writeTextAttribute( data, titleAttribute() );
             if ( attrLen != 0 ) {
                 data += (char)0xD1;
                 writeBerLength( data, attrLen );
-                foreach ( QSimMenuItem item, menuItems() ) {
+                for ( QSimMenuItem &item : menuItems() ) {
                     data += item.labelAttribute();
                 }
             }
diff --git a/src/simfilesystem.cpp b/src/simfilesystem.cpp
index 0e5c2a9..b3ea8a4 100644
--- a/src/simfilesystem.cpp
+++ b/src/simfilesystem.cpp
@@ -514,9 +514,9 @@ SimFileItem *SimFileSystem::findItemRelative( const QString& fileid )
         item = currentItem->parentDir();
     } else {
         // Search the current item's immediate children.
-        QList<SimFileItem *> children = currentItem->children();
-        item = 0;
-        foreach( SimFileItem *temp, children ) {
+        const QList<SimFileItem *> children = currentItem->children();
+        item = nullptr;
+        for ( SimFileItem *temp : children ) {
             if ( temp->fileid() == fileid ) {
                 item = temp;
                 break;
@@ -635,7 +635,7 @@ SimFileItem *SimFileItem::findItem( const QString& fileid )
 {
     if ( fileid == _fileid )
         return this;
-    foreach ( SimFileItem *item, _children ) {
+    for ( SimFileItem *item : qAsConst(_children) ) {
         SimFileItem *temp = item->findItem( fileid );
         if ( temp )
             return temp;
--
2.24.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH phonesim 08/13] Port deprecations in controlbase.ui
  2019-11-12 21:37 Modernize phonesim codebase Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (6 preceding siblings ...)
  2019-11-12 21:37 ` [PATCH phonesim 07/13] Port away from Q_FOREACH Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-12 21:37 ` Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  2019-11-12 21:37 ` [PATCH phonesim 09/13] Require Qt5Widgets >= 5.10 Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Jonah =?unknown-8bit?q?Br=C3=BCchert?= @ 2019-11-12 21:37 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 8270 bytes --]

---
 src/controlbase.ui | 158 ++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 142 insertions(+), 16 deletions(-)

diff --git a/src/controlbase.ui b/src/controlbase.ui
index 4eb1355..c2acbf6 100644
--- a/src/controlbase.ui
+++ b/src/controlbase.ui
@@ -17,7 +17,16 @@
    <property name="spacing">
     <number>6</number>
    </property>
-   <property name="margin">
+   <property name="leftMargin">
+    <number>9</number>
+   </property>
+   <property name="topMargin">
+    <number>9</number>
+   </property>
+   <property name="rightMargin">
+    <number>9</number>
+   </property>
+   <property name="bottomMargin">
     <number>9</number>
    </property>
    <item>
@@ -162,7 +171,16 @@
           <property name="spacing">
            <number>6</number>
           </property>
-          <property name="margin">
+          <property name="leftMargin">
+           <number>9</number>
+          </property>
+          <property name="topMargin">
+           <number>9</number>
+          </property>
+          <property name="rightMargin">
+           <number>9</number>
+          </property>
+          <property name="bottomMargin">
            <number>9</number>
           </property>
           <item>
@@ -180,7 +198,16 @@
             <property name="spacing">
              <number>6</number>
             </property>
-            <property name="margin">
+            <property name="leftMargin">
+             <number>0</number>
+            </property>
+            <property name="topMargin">
+             <number>0</number>
+            </property>
+            <property name="rightMargin">
+             <number>0</number>
+            </property>
+            <property name="bottomMargin">
              <number>0</number>
             </property>
             <item>
@@ -197,7 +224,16 @@
           </item>
           <item>
            <layout class="QGridLayout">
-            <property name="margin">
+            <property name="leftMargin">
+             <number>0</number>
+            </property>
+            <property name="topMargin">
+             <number>0</number>
+            </property>
+            <property name="rightMargin">
+             <number>0</number>
+            </property>
+            <property name="bottomMargin">
              <number>0</number>
             </property>
             <property name="spacing">
@@ -319,7 +355,16 @@
        <property name="spacing">
         <number>6</number>
        </property>
-       <property name="margin">
+       <property name="leftMargin">
+        <number>9</number>
+       </property>
+       <property name="topMargin">
+        <number>9</number>
+       </property>
+       <property name="rightMargin">
+        <number>9</number>
+       </property>
+       <property name="bottomMargin">
         <number>9</number>
        </property>
        <item>
@@ -337,8 +382,8 @@
          <property name="tabChangesFocus">
           <bool>true</bool>
          </property>
-         <property name="tabStopWidth">
-          <number>40</number>
+         <property name="tabStopDistance">
+          <double>40.000000000000000</double>
          </property>
          <property name="acceptRichText">
           <bool>false</bool>
@@ -350,7 +395,16 @@
          <property name="spacing">
           <number>6</number>
          </property>
-         <property name="margin">
+         <property name="leftMargin">
+          <number>0</number>
+         </property>
+         <property name="topMargin">
+          <number>0</number>
+         </property>
+         <property name="rightMargin">
+          <number>0</number>
+         </property>
+         <property name="bottomMargin">
           <number>0</number>
          </property>
          <item>
@@ -387,7 +441,16 @@
           <bool>false</bool>
          </property>
          <layout class="QGridLayout">
-          <property name="margin">
+          <property name="leftMargin">
+           <number>9</number>
+          </property>
+          <property name="topMargin">
+           <number>9</number>
+          </property>
+          <property name="rightMargin">
+           <number>9</number>
+          </property>
+          <property name="bottomMargin">
            <number>9</number>
           </property>
           <property name="spacing">
@@ -601,7 +664,16 @@
        <property name="spacing">
         <number>6</number>
        </property>
-       <property name="margin">
+       <property name="leftMargin">
+        <number>9</number>
+       </property>
+       <property name="topMargin">
+        <number>9</number>
+       </property>
+       <property name="rightMargin">
+        <number>9</number>
+       </property>
+       <property name="bottomMargin">
         <number>9</number>
        </property>
        <item>
@@ -867,7 +939,16 @@
             <property name="spacing">
              <number>6</number>
             </property>
-            <property name="margin">
+            <property name="leftMargin">
+             <number>0</number>
+            </property>
+            <property name="topMargin">
+             <number>0</number>
+            </property>
+            <property name="rightMargin">
+             <number>0</number>
+            </property>
+            <property name="bottomMargin">
              <number>0</number>
             </property>
             <item>
@@ -905,7 +986,16 @@
        <property name="spacing">
         <number>6</number>
        </property>
-       <property name="margin">
+       <property name="leftMargin">
+        <number>9</number>
+       </property>
+       <property name="topMargin">
+        <number>9</number>
+       </property>
+       <property name="rightMargin">
+        <number>9</number>
+       </property>
+       <property name="bottomMargin">
         <number>9</number>
        </property>
        <item>
@@ -1077,7 +1167,16 @@
        <property name="spacing">
         <number>6</number>
        </property>
-       <property name="margin">
+       <property name="leftMargin">
+        <number>9</number>
+       </property>
+       <property name="topMargin">
+        <number>9</number>
+       </property>
+       <property name="rightMargin">
+        <number>9</number>
+       </property>
+       <property name="bottomMargin">
         <number>9</number>
        </property>
        <item>
@@ -1138,7 +1237,16 @@
        <property name="spacing">
         <number>6</number>
        </property>
-       <property name="margin">
+       <property name="leftMargin">
+        <number>9</number>
+       </property>
+       <property name="topMargin">
+        <number>9</number>
+       </property>
+       <property name="rightMargin">
+        <number>9</number>
+       </property>
+       <property name="bottomMargin">
         <number>9</number>
        </property>
        <item>
@@ -1413,7 +1521,16 @@
               <property name="spacing">
                <number>6</number>
               </property>
-              <property name="margin">
+              <property name="leftMargin">
+               <number>0</number>
+              </property>
+              <property name="topMargin">
+               <number>0</number>
+              </property>
+              <property name="rightMargin">
+               <number>0</number>
+              </property>
+              <property name="bottomMargin">
                <number>0</number>
               </property>
               <item>
@@ -1492,7 +1609,16 @@
       <property name="spacing">
        <number>6</number>
       </property>
-      <property name="margin">
+      <property name="leftMargin">
+       <number>9</number>
+      </property>
+      <property name="topMargin">
+       <number>9</number>
+      </property>
+      <property name="rightMargin">
+       <number>9</number>
+      </property>
+      <property name="bottomMargin">
        <number>9</number>
       </property>
       <item>
--
2.24.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH phonesim 09/13] Require Qt5Widgets >= 5.10
  2019-11-12 21:37 Modernize phonesim codebase Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (7 preceding siblings ...)
  2019-11-12 21:37 ` [PATCH phonesim 08/13] Port deprecations in controlbase.ui Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-12 21:37 ` Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  2019-11-12 21:37 ` [PATCH phonesim 10/13] Port from c-style casts to static_cast<>() Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 21+ messages in thread
From: Jonah =?unknown-8bit?q?Br=C3=BCchert?= @ 2019-11-12 21:37 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 671 bytes --]

I don't think it's possible to use preprocessor directives with Qt's ui files, so this is neccessary.
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 0587f9f..da87afe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@ AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization],
 	fi
 ])

-PKG_CHECK_MODULES(QT, Qt5Core Qt5Gui Qt5Xml Qt5Network Qt5Qml Qt5DBus Qt5Widgets, dummy=yes,
+PKG_CHECK_MODULES(QT, Qt5Core Qt5Gui Qt5Xml Qt5Network Qt5Qml Qt5DBus [Qt5Widgets >= 5.10], dummy=yes,
 						AC_MSG_ERROR(Qt is required))

 # Needed for qOverload
--
2.24.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH phonesim 10/13] Port from c-style casts to static_cast<>()
  2019-11-12 21:37 Modernize phonesim codebase Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (8 preceding siblings ...)
  2019-11-12 21:37 ` [PATCH phonesim 09/13] Require Qt5Widgets >= 5.10 Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-12 21:37 ` Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  2019-11-18 21:13   ` Denis Kenzior
  2019-11-12 21:37 ` [PATCH phonesim 11/13] Use dynamic_cast where appropriate Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (2 subsequent siblings)
  12 siblings, 1 reply; 21+ messages in thread
From: Jonah =?unknown-8bit?q?Br=C3=BCchert?= @ 2019-11-12 21:37 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 146082 bytes --]

Done using the google-readability-casting check of clang-tidy
---
 src/callmanager.cpp          |   6 +-
 src/hardwaremanipulator.cpp  |  12 +-
 src/phonesim.cpp             |  62 +++---
 src/qatresult.cpp            |  10 +-
 src/qatresultparser.cpp      |   6 +-
 src/qatutils.cpp             | 116 +++++------
 src/qcbsmessage.cpp          |   6 +-
 src/qgsmcodec.cpp            |  54 ++---
 src/qsimcommand.cpp          | 370 +++++++++++++++++------------------
 src/qsimcontrolevent.cpp     |  16 +-
 src/qsimenvelope.cpp         |  48 ++---
 src/qsimterminalresponse.cpp |  98 +++++-----
 src/qsmsmessage.cpp          | 208 ++++++++++----------
 src/qsmsmessage_p.h          |   4 +-
 src/qwsppdu.cpp              |  94 ++++-----
 src/simapplication.cpp       |  68 +++----
 src/simauth.cpp              |  12 +-
 src/simfilesystem.cpp        |  24 +--
 18 files changed, 605 insertions(+), 609 deletions(-)

diff --git a/src/callmanager.cpp b/src/callmanager.cpp
index 1fa13cf..5436e08 100644
--- a/src/callmanager.cpp
+++ b/src/callmanager.cpp
@@ -203,8 +203,8 @@ bool CallManager::command( const QString& cmd )
                 multiparty = 0;
             QString line =
                 "+CLCC: " + QString::number(info.id) + "," +
-                QString::number((int)(info.incoming)) + "," +
-                QString::number((int)(info.state)) + ",0," +
+                QString::number(static_cast<int>(info.incoming)) + "," +
+                QString::number(static_cast<int>(info.state)) + ",0," +
                 QString::number(multiparty);
             if ( !info.number.isEmpty() ) {
                 line += ",";
@@ -904,7 +904,7 @@ void CallManager::sendState( const CallInfo& info )
         return;     // In the middle of a state swap: don't send this.
     QString line =
         "*ECAV: " + QString::number(info.id) + "," +
-        QString::number(stateMap[(int)(info.state)]) + ",0";
+        QString::number(stateMap[static_cast<int>(info.state)]) + ",0";
     if ( !info.number.isEmpty() ) {
         line += ",,," + QAtUtils::encodeNumber(info.number);
     }
diff --git a/src/hardwaremanipulator.cpp b/src/hardwaremanipulator.cpp
index 7a61c0e..ea895e7 100644
--- a/src/hardwaremanipulator.cpp
+++ b/src/hardwaremanipulator.cpp
@@ -74,7 +74,7 @@ void HardwareManipulator::constructCBMessage(const QString &messageCode, int geo
         return;
     }

-    QCBSMessage::GeographicalScope gs = (QCBSMessage::GeographicalScope)geographicalScope;
+    QCBSMessage::GeographicalScope gs = static_cast<QCBSMessage::GeographicalScope>(geographicalScope);

     uint un = convertString(updateNumber,NIBBLE_MAX,ONE_CHAR,HEX_BASE,&ok);
     if ( !ok ) {
@@ -93,7 +93,7 @@ void HardwareManipulator::constructCBMessage(const QString &messageCode, int geo
         return;
     }

-    QCBSMessage::Language lang = (QCBSMessage::Language)language;
+    QCBSMessage::Language lang = static_cast<QCBSMessage::Language>(language);

     QCBSMessage m;
     m.setMessageCode(mc);
@@ -226,7 +226,7 @@ void HardwareManipulator::sendVMNotify( int type, int count, const QList<QVMMess
     if ( type == 0 ) {
         mwiUdh.append( 0x01 );     // Special SMS message indication
         mwiUdh.append( 0x02 );     // IE length
-        mwiUdh.append( (char) 0 ); // Message type: Voice
+        mwiUdh.append( static_cast<char>(0) ); // Message type: Voice
         mwiUdh.append( count );    // Message count
     } else if ( type == 1 ) {
         if ( received.size() ) {
@@ -234,7 +234,7 @@ void HardwareManipulator::sendVMNotify( int type, int count, const QList<QVMMess

             mwiUdh.append( 0x23 );     // Enhanced Voice Mail Notification
             mwiUdh.append( 0x02 );     // IE length (Filled in later)
-            mwiUdh.append( (char) 0 ); // Parameters
+            mwiUdh.append( static_cast<char>(0) ); // Parameters
             QSMSMessage::appendAddress( mwiUdh, mailbox, false );
             mwiUdh.append( count );    // Number of Voice Messages
             mwiUdh.append( received.size() ); // Number of VM Notifications
@@ -308,8 +308,8 @@ void HardwareManipulator::sendUSSD( bool cancel, bool response,
             uint len = content.length();

             for ( u = 0; u < len; u++ ) {
-                binary += (unsigned char)(content[u].unicode() >> 8);
-                binary += (unsigned char)(content[u].unicode() & 0xFF);
+                binary += static_cast<unsigned char>(content[u].unicode() >> 8);
+                binary += static_cast<unsigned char>(content[u].unicode() & 0xFF);
             }
             request = PS_toHex( binary );
         }
diff --git a/src/phonesim.cpp b/src/phonesim.cpp
index 0f72a09..f9dab52 100644
--- a/src/phonesim.cpp
+++ b/src/phonesim.cpp
@@ -299,8 +299,8 @@ QString PS_toHex( const QByteArray& binary )
     static char const hexchars[] = "0123456789ABCDEF";

     for ( int i = 0; i < binary.size(); i++ ) {
-        str += (QChar)(hexchars[ (binary[i] >> 4) & 0x0F ]);
-        str += (QChar)(hexchars[ binary[i] & 0x0F ]);
+        str += QChar(hexchars[ (binary[i] >> 4) & 0x0F ]);
+        str += QChar(hexchars[ binary[i] & 0x0F ]);
     }

     return str;
@@ -726,11 +726,11 @@ void SimRules::tryReadCommand()
         // Extract GSM 07.10 packets from the incoming buffer.
         posn = 0;
         while ( posn < incomingUsed ) {
-            if ( incomingBuffer[posn] == (char)0xF9 ) {
+            if ( incomingBuffer[posn] == static_cast<char>(0xF9) ) {

                 // Skip additional 0xF9 bytes between frames.
                 while ( ( posn + 1 ) < incomingUsed &&
-                        incomingBuffer[posn + 1] == (char)0xF9 ) {
+                        incomingBuffer[posn + 1] == static_cast<char>(0xF9) ) {
                     ++posn;
                 }

@@ -767,14 +767,14 @@ void SimRules::tryReadCommand()
                 if ( type == 0xEF || type == 0x03 ) {
                     if ( channel == 0 ) {
                         if ( len == 2 &&
-                             incomingBuffer[posn + 4] == (char)0xC3 &&
-                             incomingBuffer[posn + 5] == (char)0x01 ) {
+                             incomingBuffer[posn + 4] == static_cast<char>(0xC3) &&
+                             incomingBuffer[posn + 5] == static_cast<char>(0x01) ) {
                             // This is the "terminate" commmand, which
                             // indicates that we should exit GSM 07.10 mode.
                             useGsm0710 = false;
                             posn += len + 5;
                             if ( posn < incomingUsed &&
-                                 incomingBuffer[posn] == (char)0xF9 ) {
+                                 incomingBuffer[posn] == static_cast<char>(0xF9) ) {
                                 // Skip the trailing 0xF9 on the terminate.
                                 ++posn;
                             }
@@ -849,7 +849,7 @@ void SimRules::tryReadCommand()
                     ++len;
                 }
                 lineBuffer[lineUsed] = '\0';
-                if ( lineBuffer[0] != (char)0xF9 ) {
+                if ( lineBuffer[0] != static_cast<char>(0xF9) ) {
                     command( lineBuffer );
                 }
                 lineUsed = 0;
@@ -861,17 +861,17 @@ void SimRules::tryReadCommand()
                     ++len;
                 }
                 lineBuffer[lineUsed] = '\0';
-                if ( lineBuffer[0] != (char)0xF9 ) {
+                if ( lineBuffer[0] != static_cast<char>(0xF9) ) {
                     command( lineBuffer );
                 }
                 lineUsed = 0;
             } else if ( incomingBuffer[len] == '\n' ) {
                 lineBuffer[lineUsed] = '\0';
-                if ( lineBuffer[0] != (char)0xF9 ) {
+                if ( lineBuffer[0] != static_cast<char>(0xF9) ) {
                     command( lineBuffer );
                 }
                 lineUsed = 0;
-            } else if ( lineUsed < (int)( sizeof(lineBuffer) - 1 ) ) {
+            } else if ( lineUsed < static_cast<int>( sizeof(lineBuffer) - 1 ) ) {
                 lineBuffer[lineUsed++] = incomingBuffer[len];
             }
             ++len;
@@ -1040,7 +1040,7 @@ bool SimRules::simCommand( const QString& cmd )
         return false;
     }

-    if ( param[0] != (char)0xA0 ) {
+    if ( param[0] != static_cast<char>(0xA0) ) {
         /* CLA not supported */
         respond( "+CSIM: 4,6800\\n\\nOK" );
         return false;
@@ -1049,7 +1049,7 @@ bool SimRules::simCommand( const QString& cmd )
     // Determine what kind of command we are dealing with.
     // Check for TERMINAL PROFILE, FETCH, TERMINAL RESPONSE,
     // ENVELOPE and UNBLOCK CHV packets.
-    if ( param[1] == (char)0x10 ) {
+    if ( param[1] == static_cast<char>(0x10) ) {
         /* Abort the SIM application and force it to return to the main menu. */
         if ( toolkitApp )
             toolkitApp->abort();
@@ -1057,7 +1057,7 @@ bool SimRules::simCommand( const QString& cmd )
         /* Download of a TERMINAL PROFILE.  We respond with a simple OK,
          * on the assumption that what we were sent was valid.  */
         return simCsimOk( QByteArray() );
-    } else if ( param[1] == (char)0x12 ) {
+    } else if ( param[1] == static_cast<char>(0x12) ) {
         if ( !toolkitApp ) {
             respond( "+CSIM: 4,6F00\\n\\nOK" );
             return true;
@@ -1072,7 +1072,7 @@ bool SimRules::simCommand( const QString& cmd )
         }

         return simCsimOk( resp );
-    } else if ( param.length() >= 5 && param[1] == (char)0x14 ) {
+    } else if ( param.length() >= 5 && param[1] == static_cast<char>(0x14) ) {
         if ( !toolkitApp ) {
             respond( "+CSIM: 4,6F00\\n\\nOK" );
             return true;
@@ -1090,20 +1090,20 @@ bool SimRules::simCommand( const QString& cmd )
             respond( "+CSIM: 4,6F00\\n\\nOK" );

         return true;
-    } else if ( param.length() >= 5 && param[1] == (char)0x2c &&
-                    param[4] == (char)0x10 && param.size() >= 21 ) {
+    } else if ( param.length() >= 5 && param[1] == static_cast<char>(0x2c) &&
+                    param[4] == static_cast<char>(0x10) && param.size() >= 21 ) {
         // UNBLOCK CHV command, for resetting a PIN using a PUK.
         QString pinName = "PINVALUE";
         QString pukName = "PUKVALUE";
-        if ( param[3] == (char)0x02 ) {
+        if ( param[3] == static_cast<char>(0x02) ) {
             pinName = "PIN2VALUE";
             pukName = "PUK2VALUE";
         }
         QByteArray pukValue = param.mid(5, 8);
         QByteArray pinValue = param.mid(13, 8);
-        while ( pukValue.size() > 0 && pukValue[pukValue.size() - 1] == (char)0xFF )
+        while ( pukValue.size() > 0 && pukValue[pukValue.size() - 1] == static_cast<char>(0xFF) )
             pukValue = pukValue.left( pukValue.size() - 1 );
-        while ( pinValue.size() > 0 && pinValue[pinValue.size() - 1] == (char)0xFF )
+        while ( pinValue.size() > 0 && pinValue[pinValue.size() - 1] == static_cast<char>(0xFF) )
             pinValue = pinValue.left( pinValue.size() - 1 );
         if ( QString::fromUtf8( pukValue ) != variable( pukName ) ) {
             respond( "+CSIM: 4,9804\\n\\nOK" );
@@ -1113,7 +1113,7 @@ bool SimRules::simCommand( const QString& cmd )
         }

         return true;
-    } else if ( param.length() >= 5 && param[1] == (char)0xC2 ) {
+    } else if ( param.length() >= 5 && param[1] == static_cast<char>(0xC2) ) {
         /* ENVELOPE */
         if ( !toolkitApp ) {
             respond( "+CSIM: 4,6F00\\n\\nOK" );
@@ -1127,7 +1127,7 @@ bool SimRules::simCommand( const QString& cmd )
         /* Envelope not supported or current command doesn't allow envelopes. */
         respond( "+CSIM: 4,6F00\\n\\nOK" );
         return true;
-    } else if ( param[1] == (char)0xf2 ) {
+    } else if ( param[1] == static_cast<char>(0xf2) ) {
         /* STATUS command, for now ignore the parameters */
         return simCsimOk( QByteArray() );
     }
@@ -1485,13 +1485,13 @@ out:
         respond( "OK" );
     } else if ( cmd.startsWith( "AT+CPBW=" ) ) {
         uint posn = 8;
-        int index = (int)QAtUtils::parseNumber( cmd, posn );
+        int index = static_cast<int>(QAtUtils::parseNumber( cmd, posn ));
         if ( index < 1 || index > pb->size() ) {
             // Invalid index.
             respond( "ERROR" );
             return;
         }
-        if ( ((int)posn) >= cmd.length() ) {
+        if ( (static_cast<int>(posn)) >= cmd.length() ) {
             // Delete an entry from the phone book.
             pb->setDetails( index, QString(), QString() );
         } else {
@@ -1659,7 +1659,7 @@ void SimRules::modemHandledCommandNotify( const QByteArray& cmd )

 void SimRules::callControlEventNotify( const QSimControlEvent& evt )
 {
-    unsolicited( "*TCC: " + QString::number( (int) (evt.type()) ) +
+    unsolicited( "*TCC: " + QString::number( static_cast<int>(evt.type()) ) +
               "," + QAtUtils::toHex( evt.toPdu() ) );
 }

@@ -1722,15 +1722,15 @@ void SimRules::unsolicited( const QString& resp )
 void SimRules::writeGsmFrame( int type, const char *data, uint len )
 {
     char frame[MAX_GSM0710_FRAME_SIZE + 6];
-    frame[0] = (char)0xF9;
-    frame[1] = (char)((currentChannel << 2) | 0x03);
-    frame[2] = (char)type;
-    frame[3] = (char)((len << 1) | 0x01);
+    frame[0] = static_cast<char>(0xF9);
+    frame[1] = static_cast<char>((currentChannel << 2) | 0x03);
+    frame[2] = static_cast<char>(type);
+    frame[3] = static_cast<char>((len << 1) | 0x01);
     if ( len > 0 )
         memcpy( frame + 4, data, len);
     // Note: GSM 07.10 says that the CRC is only computed over the header.
-    frame[len + 4] = (char)computeCrc( frame + 1, 3 );
-    frame[len + 5] = (char)0xF9;
+    frame[len + 4] = static_cast<char>(computeCrc( frame + 1, 3 ));
+    frame[len + 5] = static_cast<char>(0xF9);
     write( frame, len + 6 );
 }

diff --git a/src/qatresult.cpp b/src/qatresult.cpp
index 9a29503..1c7e785 100644
--- a/src/qatresult.cpp
+++ b/src/qatresult.cpp
@@ -483,7 +483,7 @@ static int numeric( const QString& value )
         return -1;
     int number = 0;
     while ( posn < value.length() && value[posn] >= '0' && value[posn] <= '9' )
-        number = number * 10 + (int)(value[posn++].unicode() - '0');
+        number = number * 10 + (value[posn++].unicode() - '0');
     return number;
 }

@@ -519,7 +519,7 @@ void QAtResult::resultToCode( const QString& value )
         val = value.mid( 11 ).trimmed();
         index = numeric( val );
         if ( index >= 0 ) {
-            d->resultCode = (QAtResult::ResultCode)index;
+            d->resultCode = static_cast<QAtResult::ResultCode>(index);
             d->verbose = false;
             return;
         }
@@ -531,7 +531,7 @@ void QAtResult::resultToCode( const QString& value )
         val = value.mid( 11 ).trimmed();
         index = numeric( val );
         if ( index >= 0 ) {
-            d->resultCode = (QAtResult::ResultCode)index;
+            d->resultCode = static_cast<QAtResult::ResultCode>(index);
             d->verbose = false;
             return;
         }
@@ -591,8 +591,8 @@ QString QAtResult::codeToResult( const QString& defaultValue ) const
         }
     }
     if ( defaultValue.isEmpty() ) {
-        if ( ((int)d->resultCode) >= 300 &&
-             ((int)d->resultCode) <= 500 ) {
+        if ( (static_cast<int>(d->resultCode)) >= 300 &&
+             (static_cast<int>(d->resultCode)) <= 500 ) {
             return "+CMS ERROR: " + QString::number( d->resultCode );
         } else {
             return "+CME ERROR: " + QString::number( d->resultCode );
diff --git a/src/qatresultparser.cpp b/src/qatresultparser.cpp
index cba41ad..7e694e2 100644
--- a/src/qatresultparser.cpp
+++ b/src/qatresultparser.cpp
@@ -174,7 +174,7 @@ uint QAtResultParser::readNumeric()
     uint value = 0;
     while ( d->linePosn < d->line.length() &&
             d->line[d->linePosn] >= '0' && d->line[d->linePosn] <= '9' ) {
-        value = value * 10 + (uint)(d->line[d->linePosn].unicode() - '0');
+        value = value * 10 + static_cast<uint>(d->line[d->linePosn].unicode() - '0');
         ++(d->linePosn);
     }
     if ( d->linePosn < d->line.length() && d->line[d->linePosn] == ',' ) {
@@ -188,9 +188,9 @@ uint QAtResultParser::readNumeric()

 static QString nextString( const QString& buf, int& posn )
 {
-    uint posn2 = (uint)posn;
+    uint posn2 = static_cast<uint>(posn);
     QString result = QAtUtils::nextString( buf, posn2 );
-    posn = (int)posn2;
+    posn = static_cast<int>(posn2);
     return result;
 }

diff --git a/src/qatutils.cpp b/src/qatutils.cpp
index 51161bb..c6cc013 100644
--- a/src/qatutils.cpp
+++ b/src/qatutils.cpp
@@ -54,11 +54,11 @@ QString QAtUtils::quote( const QString& str )
     while ( posn < str.length() ) {
         ch = str[posn++].unicode();
         if ( ch == '"' || ch == '\\' || ch == '\r' || ch == '\n' ) {
-            result += (QChar)'\\';
-            result += (QChar)(hexchars[(ch >> 4) & 0x0F]);
-            result += (QChar)(hexchars[ch & 0x0F]);
+            result += QChar('\\');
+            result += QChar(hexchars[(ch >> 4) & 0x0F]);
+            result += QChar(hexchars[ch & 0x0F]);
         } else {
-            result += (QChar)ch;
+            result += QChar(ch);
         }
     }
     return result;
@@ -75,8 +75,8 @@ QString QAtUtils::toHex( const QByteArray& binary )
     static char const hexchars[] = "0123456789ABCDEF";

     for ( int i = 0; i < binary.size(); i++ ) {
-        str += (QChar)(hexchars[ (binary[i] >> 4) & 0x0F ]);
-        str += (QChar)(hexchars[ binary[i] & 0x0F ]);
+        str += QChar(hexchars[ (binary[i] >> 4) & 0x0F ]);
+        str += QChar(hexchars[ binary[i] & 0x0F ]);
     }

     return str;
@@ -98,7 +98,7 @@ QByteArray QAtUtils::fromHex( const QString& hex )
     value = 0;
     size = 0;
     for ( posn = 0; posn < hex.length(); ++posn ) {
-        ch = (uint)( hex[posn].unicode() );
+        ch = static_cast<uint>( hex[posn].unicode() );
         if ( ch >= '0' && ch <= '9' ) {
             nibble = ch - '0';
         } else if ( ch >= 'A' && ch <= 'F' ) {
@@ -112,7 +112,7 @@ QByteArray QAtUtils::fromHex( const QString& hex )
         flag = !flag;
         if ( !flag ) {
             bytes.resize( size + 1 );
-            bytes[size++] = (char)value;
+            bytes[size++] = static_cast<char>(value);
             value = 0;
         }
     }
@@ -177,11 +177,11 @@ QString QAtUtils::encodeNumber( const QString& value, bool keepPlus )
 static int FromHexDigit( uint ch )
 {
     if ( ch >= '0' && ch <= '9' ) {
-        return (int)( ch - '0' );
+        return static_cast<int>( ch - '0' );
     } else if ( ch >= 'A' && ch <= 'F' ) {
-        return (int)( ch - 'A' + 10 );
+        return static_cast<int>( ch - 'A' + 10 );
     } else if ( ch >= 'a' && ch <= 'f' ) {
-        return (int)( ch - 'a' + 10 );
+        return static_cast<int>( ch - 'a' + 10 );
     } else {
         return -1;
     }
@@ -190,7 +190,7 @@ static int FromHexDigit( uint ch )
 static int FromOctalDigit( uint ch )
 {
     if ( ch >= '0' && ch <= '7' ) {
-        return (int)( ch - '0' );
+        return static_cast<int>( ch - '0' );
     } else {
         return -1;
     }
@@ -207,66 +207,66 @@ QString QAtUtils::nextString( const QString& buf, uint& posn )
     QString result = "";
     uint ch;
     int digit, digit2, digit3;
-    while ( posn < (uint)(buf.length()) && buf[posn] != '"' ) {
+    while ( posn < static_cast<uint>(buf.length()) && buf[posn] != '"' ) {
         ++posn;
     }
-    if ( posn >= (uint)(buf.length()) ) {
+    if ( posn >= static_cast<uint>(buf.length()) ) {
         return result;
     }
     ++posn;
-    while ( posn < (uint)(buf.length()) && ( ch = buf[posn].unicode() ) != '"' ) {
+    while ( posn < static_cast<uint>(buf.length()) && ( ch = buf[posn].unicode() ) != '"' ) {
         ++posn;
         if ( ch == '\\' ) {
             if ( !octalEscapesFlag ) {
                 // Hex-quoted character.
-                if ( posn >= (uint)buf.length() )
+                if ( posn >= static_cast<uint>(buf.length()) )
                     break;
                 digit = FromHexDigit( buf[posn].unicode() );
                 if ( digit == -1 ) {
-                    result += (QChar)'\\';
+                    result += QChar('\\');
                     continue;
                 }
-                if ( ( posn + 1 ) >= (uint)buf.length() ) {
-                    ch = (uint)digit;
+                if ( ( posn + 1 ) >= static_cast<uint>(buf.length()) ) {
+                    ch = static_cast<uint>(digit);
                     ++posn;
                 } else {
                     digit2 = FromHexDigit( buf[posn + 1].unicode() );
                     if ( digit2 == -1 ) {
-                        ch = (uint)digit;
+                        ch = static_cast<uint>(digit);
                         ++posn;
                     } else {
-                        ch = (uint)(digit * 16 + digit2);
+                        ch = static_cast<uint>(digit * 16 + digit2);
                         posn += 2;
                     }
                 }
             } else {
                 // Octal-quoted character.
-                if ( posn >= (uint)buf.length() )
+                if ( posn >= static_cast<uint>(buf.length()) )
                     break;
                 digit = FromOctalDigit( buf[posn].unicode() );
                 if ( digit == -1 ) {
-                    result += (QChar)'\\';
+                    result += QChar('\\');
                     continue;
                 }
-                if ( ( posn + 1 ) >= (uint)buf.length() ) {
-                    ch = (uint)digit;
+                if ( ( posn + 1 ) >= static_cast<uint>(buf.length()) ) {
+                    ch = static_cast<uint>(digit);
                     ++posn;
                 } else {
                     digit2 = FromOctalDigit( buf[posn + 1].unicode() );
                     if ( digit2 == -1 ) {
-                        ch = (uint)digit;
+                        ch = static_cast<uint>(digit);
                         ++posn;
                     } else {
-                        if ( ( posn + 2 ) >= (uint)buf.length() ) {
-                            ch = (uint)(digit * 8 + digit2);
+                        if ( ( posn + 2 ) >= static_cast<uint>(buf.length()) ) {
+                            ch = static_cast<uint>(digit * 8 + digit2);
                             posn += 2;
                         } else {
                             digit3 = FromOctalDigit( buf[posn + 2].unicode() );
                             if ( digit3 == -1 ) {
-                                ch = (uint)(digit * 8 + digit2);
+                                ch = static_cast<uint>(digit * 8 + digit2);
                                 posn += 2;
                             } else {
-                                ch = (uint)(digit * 64 + digit2 * 8 + digit3);
+                                ch = static_cast<uint>(digit * 64 + digit2 * 8 + digit3);
                                 posn += 3;
                             }
                         }
@@ -274,9 +274,9 @@ QString QAtUtils::nextString( const QString& buf, uint& posn )
                 }
             }
         }
-        result += (QChar)ch;
+        result += QChar(ch);
     }
-    if ( posn < (uint)buf.length() ) {
+    if ( posn < static_cast<uint>(buf.length()) ) {
         ++posn;
     }
     return result;
@@ -291,12 +291,12 @@ uint QAtUtils::parseNumber( const QString& str, uint& posn , int invalidValue)
 {
     uint num = 0;
     int isValid = 0;
-    while ( posn < (uint)str.length() && ( str[posn] == ' ' || str[posn] == ',' ) ) {
+    while ( posn < static_cast<uint>(str.length()) && ( str[posn] == ' ' || str[posn] == ',' ) ) {
         ++posn;
     }
-    while ( posn < (uint)str.length() && str[posn] >= '0' && str[posn] <= '9' ) {
+    while ( posn < static_cast<uint>(str.length()) && str[posn] >= '0' && str[posn] <= '9' ) {
         isValid = 1;
-        num = num * 10 + (uint)(str[posn].unicode() - '0');
+        num = num * 10 + static_cast<uint>(str[posn].unicode() - '0');
         ++posn;
     }
     if (isValid)
@@ -313,10 +313,10 @@ uint QAtUtils::parseNumber( const QString& str, uint& posn , int invalidValue)
 */
 void QAtUtils::skipField( const QString& str, uint& posn )
 {
-    if ( posn < (uint)str.length() && str[posn] == ',' ) {
+    if ( posn < static_cast<uint>(str.length()) && str[posn] == ',' ) {
         ++posn;
     }
-    while ( posn < (uint)str.length() && str[posn] != ',' ) {
+    while ( posn < static_cast<uint>(str.length()) && str[posn] != ',' ) {
         ++posn;
     }
 }
@@ -377,13 +377,13 @@ QString QGsmHexCodec::convertToUnicode(const char *in, int length, ConverterStat
             value += digit;
             if ( !secondByte ) {
                 if ( value != 0x1B ) {
-                    str += QGsmCodec::twoByteToUnicode( (unsigned short)value );
+                    str += QGsmCodec::twoByteToUnicode( static_cast<unsigned short>(value) );
                 } else {
                     secondByte = true;
                 }
             } else {
                 value += 0x1B00;
-                str += QGsmCodec::twoByteToUnicode( (unsigned short)value );
+                str += QGsmCodec::twoByteToUnicode( static_cast<unsigned short>(value) );
                 secondByte = false;
             }
             nibble = 0;
@@ -458,7 +458,7 @@ QString QUcs2HexCodec::convertToUnicode(const char *in, int length, ConverterSta
         value = value * 16 + digit;
         ++nibble;
         if ( nibble >= 4 ) {
-            str += QChar( (ushort)value );
+            str += QChar( static_cast<ushort>(value) );
             nibble = 0;
             value = 0;
         }
@@ -618,7 +618,7 @@ QString QCodePage437Codec::convertToUnicode(const char *in, int length, Converte
             value = value * 16 + digit;
             ++nibble;
             if ( nibble >= 4 ) {
-                str += QChar( (ushort)value );
+                str += QChar( static_cast<ushort>(value) );
                 nibble = 0;
                 value = 0;
             }
@@ -628,7 +628,7 @@ QString QCodePage437Codec::convertToUnicode(const char *in, int length, Converte

         // Regular 437-encoded string.
         while ( length-- > 0 )
-            str += QChar((unsigned int)cp437ToUnicode[*in++ & 0xFF]);
+            str += QChar(static_cast<unsigned int>(cp437ToUnicode[*in++ & 0xFF]));

     }
     return str;
@@ -675,7 +675,7 @@ QByteArray QCodePage437Codec::convertFromUnicode(const QChar *in, int length, Co
     result.resize( length );
     out = result.data();
     while ( length-- > 0 ) {
-        *out++ = (char)cp437FromUnicode[in->unicode()];
+        *out++ = static_cast<char>(cp437FromUnicode[in->unicode()]);
         ++in;
     }
     return result;
@@ -846,7 +846,7 @@ QString QCodePage850Codec::convertToUnicode(const char *in, int length, Converte
 {
     QString str;
     while ( length-- > 0 )
-        str += QChar((unsigned int)cp850ToUnicode[*in++ & 0xFF]);
+        str += QChar(static_cast<unsigned int>(cp850ToUnicode[*in++ & 0xFF]));
     return str;
 }

@@ -861,7 +861,7 @@ QByteArray QCodePage850Codec::convertFromUnicode(const QChar *in, int length, Co
         ch = in->unicode();
         ++in;
         if ( ch < 0x0100 ) {
-            *out++ = (char)cp850FromUnicode[ch];
+            *out++ = static_cast<char>(cp850FromUnicode[ch]);
         } else {
             // Perform a binary search on the sparse mapping table.
             int left = 0;
@@ -874,7 +874,7 @@ QByteArray QCodePage850Codec::convertFromUnicode(const QChar *in, int length, Co
                 } else if ( ch > cp850MappingInput[middle] ) {
                     left = middle + 1;
                 } else {
-                    *out++ = (char)cp850MappingOutput[middle];
+                    *out++ = static_cast<char>(cp850MappingOutput[middle]);
                     break;
                 }
             }
@@ -1037,11 +1037,11 @@ QString QAtUtils::quote( const QString& str, QTextCodec *codec )
     while ( posn < bytes.length() ) {
         ch = bytes[posn++] & 0xFF;
         if ( ch == '"' || ch == '\\' || ch == '\r' || ch == '\n' ) {
-            result += (QChar)'\\';
-            result += (QChar)(hexchars[(ch >> 4) & 0x0F]);
-            result += (QChar)(hexchars[ch & 0x0F]);
+            result += QChar('\\');
+            result += QChar(hexchars[(ch >> 4) & 0x0F]);
+            result += QChar(hexchars[ch & 0x0F]);
         } else {
-            result += (QChar)ch;
+            result += QChar(ch);
         }
     }
     return result;
@@ -1087,24 +1087,24 @@ QString QAtUtils::stripNumber( const QString& number )
     for ( posn = 0; posn < number.length(); ++posn ) {
         ch = number[posn].unicode();
         if ( ch >= '0' && ch <= '9' ) {
-            n += (QChar)ch;
+            n += QChar(ch);
         } else if ( ch == '+' || ch == '#' || ch == '*' ) {
-            n += (QChar)ch;
+            n += QChar(ch);
         } else if ( ch == 'A' || ch == 'B' || ch == 'C' || ch == 'D' ) {
             // ABCD can actually be digits!
-            n += (QChar)ch;
+            n += QChar(ch);
         } else if ( ch == 'a' || ch == 'b' || ch == 'c' || ch == 'd' ) {
-            n += (QChar)( ch - 'a' + 'A' );
+            n += QChar( ch - 'a' + 'A' );
         } else if ( ch == ',' || ch == 'p' || ch == 'P' || ch == 'X' || ch == 'x' ) {
             // Comma and 'p' mean a short pause.
             // 'x' means an extension, which for now is the same as a pause.
-            n += (QChar)',';
+            n += QChar(',');
         } else if ( ch == 'w' || ch == 'W' ) {
             // 'w' means wait for dial tone.
-            n += (QChar)'W';
+            n += QChar('W');
         } else if ( ch == '!' || ch == '@' ) {
             // '!' = hook flash, '@' = wait for silence.
-            n += (QChar)ch;
+            n += QChar(ch);
         }
     }
     return n;
@@ -1157,7 +1157,7 @@ QString QAtUtils::decodeString( const QString& value, uint dcs )
     if ((dcs & 0xC0) == 0)
         scheme = QSMS_DefaultAlphabet;  // Other bits indicate 7-bit GSM language.
     else
-        scheme = (QSMSDataCodingScheme)(dcs & 0x0C);
+        scheme = static_cast<QSMSDataCodingScheme>(dcs & 0x0C);
     if ( scheme == QSMS_UCS2Alphabet ) {
         // The string is hex-encoded UCS-2.
         return codec("ucs2")->toUnicode( value.toLatin1() );
diff --git a/src/qcbsmessage.cpp b/src/qcbsmessage.cpp
index b56a761..17a2cd5 100644
--- a/src/qcbsmessage.cpp
+++ b/src/qcbsmessage.cpp
@@ -387,8 +387,8 @@ bool QCBSMessage::operator!=( const QCBSMessage& other ) const
 void QCBSMessage::print()
 {
     qLog(Modem) << "channel=" << channel()
-                  << ", scope=" << (int)scope()
-                  << ", messageCode=" << (int)messageCode()
+                  << ", scope=" << static_cast<int>(scope())
+                  << ", messageCode=" << static_cast<int>(messageCode())
                   << ", updateNumber=" << updateNumber()
                   << ", language=" << language()
                   << ", page=" << page()
@@ -434,7 +434,7 @@ QByteArray QCBSMessage::toPdu() const
 {
     QCBSDeliverMessage deliver;

-    deliver.pack( *this, (QSMSDataCodingScheme)bestScheme() );
+    deliver.pack( *this, static_cast<QSMSDataCodingScheme>(bestScheme()) );
     return deliver.toByteArray();
 }

diff --git a/src/qgsmcodec.cpp b/src/qgsmcodec.cpp
index 4120226..5bb12e1 100644
--- a/src/qgsmcodec.cpp
+++ b/src/qgsmcodec.cpp
@@ -283,11 +283,11 @@ char QGsmCodec::singleFromUnicode(QChar c)
 {
     unsigned int ch = c.unicode();
     if ( ch < 256 )
-        return (char)(latin1GSMTable[ch]);
+        return static_cast<char>(latin1GSMTable[ch]);
     else if ( ch >= 0x0390 && ch <= 0x03AF )
-        return (char)(greekGSMTable[ch - 0x0390]);
+        return static_cast<char>(greekGSMTable[ch - 0x0390]);
     else
-        return (char)GUC;
+        return static_cast<char>(GUC);
 }

 /*!
@@ -301,7 +301,7 @@ char QGsmCodec::singleFromUnicode(QChar c)
 */
 QChar QGsmCodec::singleToUnicode(char ch)
 {
-    return QChar((unsigned int)(gsmLatin1Table[((int)ch) & 0xFF]));
+    return QChar(static_cast<unsigned int>(gsmLatin1Table[(static_cast<int>(ch)) & 0xFF]));
 }

 /*!
@@ -319,7 +319,7 @@ unsigned short QGsmCodec::twoByteFromUnicode(QChar ch)
     else if ( c < 256 )
         return latin1GSMTable[c];
     else if ( c >= 0x0390 && c <= 0x03AF )
-        return (char)(greekGSMTable[c - 0x0390]);
+        return static_cast<char>(greekGSMTable[c - 0x0390]);
     else
         return GUC;
 }
@@ -366,18 +366,18 @@ QString QGsmCodec::convertToUnicode(const char *in, int length, ConverterState *
                     (state->invalidChars)++;
                 break;
             }
-            ch = extensionLatin1Table[((int)(*in)) & 0xFF];
+            ch = extensionLatin1Table[(static_cast<int>(*in)) & 0xFF];
             if ( ch != UUC ) {
-                str += QChar((unsigned int)ch);
+                str += QChar(static_cast<unsigned int>(ch));
             } else {
-                str += QChar(gsmLatin1Table[((int)(*in)) & 0xFF]);
+                str += QChar(gsmLatin1Table[(static_cast<int>(*in)) & 0xFF]);
                 if ( state )
                     (state->invalidChars)++;
             }
         } else {
-            ch = gsmLatin1Table[((int)(*in)) & 0xFF];
+            ch = gsmLatin1Table[(static_cast<int>(*in)) & 0xFF];
             if ( ch != UUC )
-                str += QChar((unsigned int)ch);
+                str += QChar(static_cast<unsigned int>(ch));
             else if ( state )
                 (state->invalidChars)++;
         }
@@ -402,25 +402,25 @@ QByteArray QGsmCodec::convertFromUnicode(const QChar *in, int length, ConverterS
         while ( length > 0 ) {
             unicode = (*in).unicode();
             if ( unicode == 0x20AC ) {    // Euro
-                result += (char)0x1B;
-                result += (char)0x65;
+                result += static_cast<char>(0x1B);
+                result += static_cast<char>(0x65);
             } else if ( unicode < 256 ) {
                 unsigned short code = latin1GSMNoLossTable[unicode];
                 if ( code < 256 ) {
-                    if(((char)code == GUC) && state)
+                    if((static_cast<char>(code) == GUC) && state)
                         (state->invalidChars)++;
-                    result += (char)code;
+                    result += static_cast<char>(code);
                 } else {
-                    result += (char)(code >> 8);
-                    result += (char)code;
+                    result += static_cast<char>(code >> 8);
+                    result += static_cast<char>(code);
                 }
             } else if ( unicode >= 0x0390 && unicode <= 0x03AF ) {
-                char c = (char)(greekGSMTable[unicode - 0x0390]);
+                char c = static_cast<char>(greekGSMTable[unicode - 0x0390]);
                 result += c;
-                if ( c == (char)GUC && unicode != 0x0394 && state )
+                if ( c == static_cast<char>(GUC) && unicode != 0x0394 && state )
                     (state->invalidChars)++;
             } else {
-                result += (char)GUC;
+                result += static_cast<char>(GUC);
                 if ( state )
                     (state->invalidChars)++;
             }
@@ -431,23 +431,23 @@ QByteArray QGsmCodec::convertFromUnicode(const QChar *in, int length, ConverterS
         while ( length > 0 ) {
             unicode = (*in).unicode();
             if ( unicode == 0x20AC ) {    // Euro
-                result += (char)0x1B;
-                result += (char)0x65;
+                result += static_cast<char>(0x1B);
+                result += static_cast<char>(0x65);
             } else if ( unicode < 256 ) {
                 unsigned short code = latin1GSMTable[unicode];
                 if ( code < 256 ) {
-                    result += (char)code;
+                    result += static_cast<char>(code);
                 } else {
-                    result += (char)(code >> 8);
-                    result += (char)code;
+                    result += static_cast<char>(code >> 8);
+                    result += static_cast<char>(code);
                 }
             } else if ( unicode >= 0x0390 && unicode <= 0x03AF ) {
-                char c = (char)(greekGSMTable[unicode - 0x0390]);
+                char c = static_cast<char>(greekGSMTable[unicode - 0x0390]);
                 result += c;
-                if ( c == (char)GUC && unicode != 0x0394 && state )
+                if ( c == static_cast<char>(GUC) && unicode != 0x0394 && state )
                     (state->invalidChars)++;
             } else {
-                result += (char)GUC;
+                result += static_cast<char>(GUC);
                 if ( state )
                     (state->invalidChars)++;
             }
diff --git a/src/qsimcommand.cpp b/src/qsimcommand.cpp
index fb200ed..c7f3f85 100644
--- a/src/qsimcommand.cpp
+++ b/src/qsimcommand.cpp
@@ -1440,7 +1440,7 @@ void QSimCommand::setEcho( bool value )
 QSimCommand::Disposition QSimCommand::disposition() const
 {
     if ( d->type == QSimCommand::SetupCall )
-        return (QSimCommand::Disposition)(d->qualifier >> 1);
+        return static_cast<QSimCommand::Disposition>(d->qualifier >> 1);
     else
         return IfNoOtherCalls;
 }
@@ -1456,7 +1456,7 @@ QSimCommand::Disposition QSimCommand::disposition() const
 void QSimCommand::setDisposition( QSimCommand::Disposition value )
 {
     if ( d->type == QSimCommand::SetupCall )
-        dwrite()->qualifier = (((int)value) << 1) | (d->qualifier & 0x01);
+        dwrite()->qualifier = ((static_cast<int>(value)) << 1) | (d->qualifier & 0x01);
 }


@@ -1872,7 +1872,7 @@ void QSimCommand::setMenuItems( const QList<QSimMenuItem>& value )
 QSimCommand::RefreshType QSimCommand::refreshType() const
 {
     if ( d->type == QSimCommand::Refresh )
-        return (QSimCommand::RefreshType)(d->qualifier);
+        return static_cast<QSimCommand::RefreshType>(d->qualifier);
     else
         return InitAndFullFileChange;
 }
@@ -1889,7 +1889,7 @@ QSimCommand::RefreshType QSimCommand::refreshType() const
 void QSimCommand::setRefreshType( QSimCommand::RefreshType value )
 {
     if ( d->type == QSimCommand::Refresh )
-        setQualifier( (int)value );
+        setQualifier( static_cast<int>(value) );
 }


@@ -1913,12 +1913,12 @@ QSimCommand::Event QSimCommand::events() const
     QByteArray evdata = extensionField( 0x99 );
     if ( evdata.isEmpty() ) {
         return Cancel;      // Field is present, but empty, which means "Cancel".
-    } else if ( evdata.contains( (char)0x05 ) ) {
-        if ( evdata.contains( (char)0x04 ) )
+    } else if ( evdata.contains( static_cast<char>(0x05) ) ) {
+        if ( evdata.contains( static_cast<char>(0x04) ) )
             return Both;
         else
             return IdleScreen;
-    } else if ( evdata.contains( (char)0x04 ) ) {
+    } else if ( evdata.contains( static_cast<char>(0x04) ) ) {
         return UserActivity;
     } else {
         return NoEvent;
@@ -1947,33 +1947,33 @@ void QSimCommand::setEvents( QSimCommand::Event value )

             case IdleScreen:
             {
-                d->extensionData += (char)0x99;
-                d->extensionData += (char)0x01;
-                d->extensionData += (char)0x05;
+                d->extensionData += static_cast<char>(0x99);
+                d->extensionData += static_cast<char>(0x01);
+                d->extensionData += static_cast<char>(0x05);
             }
             break;

             case UserActivity:
             {
-                d->extensionData += (char)0x99;
-                d->extensionData += (char)0x01;
-                d->extensionData += (char)0x04;
+                d->extensionData += static_cast<char>(0x99);
+                d->extensionData += static_cast<char>(0x01);
+                d->extensionData += static_cast<char>(0x04);
             }
             break;

             case Both:
             {
-                d->extensionData += (char)0x99;
-                d->extensionData += (char)0x02;
-                d->extensionData += (char)0x04;
-                d->extensionData += (char)0x05;
+                d->extensionData += static_cast<char>(0x99);
+                d->extensionData += static_cast<char>(0x02);
+                d->extensionData += static_cast<char>(0x04);
+                d->extensionData += static_cast<char>(0x05);
             }
             break;

             case Cancel:
             {
-                d->extensionData += (char)0x99;
-                d->extensionData += (char)0x00;
+                d->extensionData += static_cast<char>(0x99);
+                d->extensionData += static_cast<char>(0x00);
             }
             break;
         }
@@ -1991,7 +1991,7 @@ void QSimCommand::setEvents( QSimCommand::Event value )
 QSimCommand::BrowserLaunchMode QSimCommand::browserLaunchMode() const
 {
     if ( d->type == QSimCommand::LaunchBrowser )
-        return (QSimCommand::BrowserLaunchMode)(d->qualifier);
+        return static_cast<QSimCommand::BrowserLaunchMode>(d->qualifier);
     else
         return IfNotAlreadyLaunched;
 }
@@ -2006,7 +2006,7 @@ QSimCommand::BrowserLaunchMode QSimCommand::browserLaunchMode() const
 void QSimCommand::setBrowserLaunchMode( QSimCommand::BrowserLaunchMode value )
 {
     if ( d->type == QSimCommand::LaunchBrowser )
-        setQualifier( (int)value );
+        setQualifier( static_cast<int>(value) );
 }

 /*!
@@ -2362,32 +2362,32 @@ QSimCommand& QSimCommand::operator=( const QSimCommand & value )
 // We also need to export this to qsimterminalresponse.cpp and qsimenvelope.cpp.
 void _qtopiaphone_readBer( const QByteArray& binary, uint& posn, uint& tag, uint& length )
 {
-    if ( posn < (uint)binary.size() ) {
-        tag = (uint)(binary[posn] & 0xFF);
+    if ( posn < static_cast<uint>(binary.size()) ) {
+        tag = static_cast<uint>(binary[posn] & 0xFF);
         ++posn;
     } else {
-        tag = (uint)(-1);
+        tag = static_cast<uint>(-1);
     }
-    if ( posn < (uint)binary.size() ) {
-        length = (uint)(binary[posn] & 0xFF);
+    if ( posn < static_cast<uint>(binary.size()) ) {
+        length = static_cast<uint>(binary[posn] & 0xFF);
         ++posn;
         if ( length == 0x81 ) {
             // Two-byte length value.
-            if ( posn < (uint)binary.size() ) {
-                length = (uint)(binary[posn] & 0xFF);
+            if ( posn < static_cast<uint>(binary.size()) ) {
+                length = static_cast<uint>(binary[posn] & 0xFF);
                 ++posn;
             } else {
                 length = 0;
             }
         } else if ( length == 0x82 ) {
             // Three-byte length value.
-            if ( ( posn + 1 ) < (uint)binary.size() ) {
-                length = (((uint)(binary[posn] & 0xFF)) << 8) |
-                         (uint)(binary[posn + 1] & 0xFF);
+            if ( ( posn + 1 ) < static_cast<uint>(binary.size()) ) {
+                length = ((static_cast<uint>(binary[posn] & 0xFF)) << 8) |
+                         static_cast<uint>(binary[posn + 1] & 0xFF);
                 posn += 2;
             } else {
                 length = 0;
-                posn = (uint)binary.size();
+                posn = static_cast<uint>(binary.size());
             }
         }
     } else {
@@ -2405,50 +2405,50 @@ QString _qtopiaphone_decodeEFADN( const QByteArray& binary, uint posn, uint leng
     QTextCodec *codec = QAtUtils::codec( "gsm" );
     if ( length == 0 )
         return QString("");
-    else if ( binary[posn] == (char)0x80 ) {
+    else if ( binary[posn] == static_cast<char>(0x80) ) {
         // UCS-2 coding.
         ++posn;
         --length;
         while ( length >= 2 ) {
-            ch = (((uint)((binary[posn]) & 0xFF)) << 8) |
-                  ((uint)(binary[posn + 1] & 0xFF));
+            ch = ((static_cast<uint>((binary[posn]) & 0xFF)) << 8) |
+                  (static_cast<uint>(binary[posn + 1] & 0xFF));
             if ( ch != 0xFFFF )
-                temp += (QChar)ch;
+                temp += QChar(ch);
             posn += 2;
             length -= 2;
         }
         return temp;
-    } else if ( binary[posn] == (char)0x81 ) {
+    } else if ( binary[posn] == static_cast<char>(0x81) ) {
         // 8-bit half page index coding.
         if ( length < 3 )
             return QString("");
-        num = ((uint)(binary[posn + 1] & 0xFF));
-        page = ((uint)(binary[posn + 2] & 0xFF)) << 7;
+        num = (static_cast<uint>(binary[posn + 1] & 0xFF));
+        page = (static_cast<uint>(binary[posn + 2] & 0xFF)) << 7;
         posn += 3;
         length -= 3;
-    } else if ( binary[posn] == (char)0x82 ) {
+    } else if ( binary[posn] == static_cast<char>(0x82) ) {
         // 16-bit half page index coding.
         if ( length < 4 )
             return QString("");
-        num = ((uint)(binary[posn + 1] & 0xFF));
-        page = (((uint)(binary[posn + 2] & 0xFF)) << 8) |
-                ((uint)(binary[posn + 3] & 0xFF));
+        num = (static_cast<uint>(binary[posn + 1] & 0xFF));
+        page = ((static_cast<uint>(binary[posn + 2] & 0xFF)) << 8) |
+                (static_cast<uint>(binary[posn + 3] & 0xFF));
         posn += 4;
         length -= 4;
     } else {
         // 7-bit GSM default alphabet coding.
-        while ( length > 0 && binary[posn + length - 1] == (char)0xFF ) {
+        while ( length > 0 && binary[posn + length - 1] == static_cast<char>(0xFF) ) {
             // Strip 0xFF bytes from the end of the string first.
             --length;
         }
-        return codec->toUnicode( binary.data() + posn, (int)length );
+        return codec->toUnicode( binary.data() + posn, static_cast<int>(length) );
     }
     while ( num > 0 && length > 0 ) {
-        ch = ((uint)(binary[posn] & 0xFF));
+        ch = (static_cast<uint>(binary[posn] & 0xFF));
         if ( ch < 0x80 ) {
-            temp += QGsmCodec::singleToUnicode( (char)ch );
+            temp += QGsmCodec::singleToUnicode( static_cast<char>(ch) );
         } else {
-            temp += (QChar)( page + (ch & 0x7F) );
+            temp += QChar( page + (ch & 0x7F) );
         }
         ++posn;
         --length;
@@ -2466,13 +2466,13 @@ static QString decodeEFADNNumber( const QByteArray& binary,
     QString temp;
     uint ch;
     while ( length > 0 ) {
-        ch = ((uint)(binary[posn] & 0xFF));
+        ch = (static_cast<uint>(binary[posn] & 0xFF));
         if ( ( ch & 0x0F ) == 0x0F )
             break;
-        temp += (QChar)( digits[ch & 0x0F] );
+        temp += QChar( digits[ch & 0x0F] );
         if ( ( ch & 0xF0 ) == 0xF0 )
             break;
-        temp += (QChar)( digits[(ch >> 4) & 0x0F] );
+        temp += QChar( digits[(ch >> 4) & 0x0F] );
         ++posn;
         --length;
     }
@@ -2486,17 +2486,17 @@ static void writeEFADNNumber( QByteArray& data, const QString& number, int tag =
     QString num = QAtUtils::stripNumber( number );
     if ( tag == 0xAC ) {
         // DTMF strings don't have a type prefix.
-        data += (char)tag;
-        data += (char)((num.length() + 1) / 2);
+        data += static_cast<char>(tag);
+        data += static_cast<char>((num.length() + 1) / 2);
     } else if ( num.startsWith( QChar('+') ) ) {
         num = num.mid(1);
-        data += (char)tag;
-        data += (char)(1 + ((num.length() + 1) / 2));
-        data += (char)145;
+        data += static_cast<char>(tag);
+        data += static_cast<char>(1 + ((num.length() + 1) / 2));
+        data += static_cast<char>(145);
     } else {
-        data += (char)tag;
-        data += (char)(1 + ((num.length() + 1) / 2));
-        data += (char)localTag;
+        data += static_cast<char>(tag);
+        data += static_cast<char>(1 + ((num.length() + 1) / 2));
+        data += static_cast<char>(localTag);
     }
     int byte = 0;
     int nibble = 0;
@@ -2516,7 +2516,7 @@ static void writeEFADNNumber( QByteArray& data, const QString& number, int tag =
             default:            ch = 10; break;
         }
         if ( nibble ) {
-            data += (char)(byte | (ch << 4));
+            data += static_cast<char>(byte | (ch << 4));
             nibble = 0;
         } else {
             byte = ch;
@@ -2524,7 +2524,7 @@ static void writeEFADNNumber( QByteArray& data, const QString& number, int tag =
         }
     }
     if ( nibble ) {
-        data += (char)(byte | 0xF0);
+        data += static_cast<char>(byte | 0xF0);
     }
 }

@@ -2535,7 +2535,7 @@ QString _qtopiaphone_decodeCodedString( const QByteArray& binary, uint posn, uin
     uint ch, byte, bitCount;
     if ( length == 0 )
         return QString("");
-    ch = (uint)(binary[posn++] & 0x0C);
+    ch = static_cast<uint>(binary[posn++] & 0x0C);
     --length;
     if ( ch == QSMS_DefaultAlphabet ) {
         ch = 0;
@@ -2550,22 +2550,22 @@ QString _qtopiaphone_decodeCodedString( const QByteArray& binary, uint posn, uin
                 bitCount++;
                 if ( bitCount == 7 ) {
                     bitCount = 0;
-                    temp += QGsmCodec::singleToUnicode( (char)ch );
+                    temp += QGsmCodec::singleToUnicode( static_cast<char>(ch) );
                     ch = 0;
                 }
             }
         }
         if ( bitCount == 0 && temp.length() > 0 &&
-             temp[temp.length() - 1] == (char)0x0D ) {
+             temp[temp.length() - 1] == static_cast<char>(0x0D) ) {
             // CR used as a padding character in the last byte - strip it.
             temp = temp.left( temp.length() - 1 );
         }
         return temp;
     } else if ( ch == QSMS_UCS2Alphabet ) {
         while ( length >= 2 ) {
-            ch = (((uint)((binary[posn]) & 0xFF)) << 8) |
-                  ((uint)(binary[posn + 1] & 0xFF));
-            temp += (QChar)ch;
+            ch = ((static_cast<uint>((binary[posn]) & 0xFF)) << 8) |
+                  (static_cast<uint>(binary[posn + 1] & 0xFF));
+            temp += QChar(ch);
             posn += 2;
             length -= 2;
         }
@@ -2581,7 +2581,7 @@ QString _qtopiaphone_decodeCodedString( const QByteArray& binary, uint posn, uin
 static QString decodeSubAddress( const QByteArray& pdu, uint posn, uint length )
 {
     // Verify that this looks like a BCD-encoded IA5 NSAP subaddress.
-    if ( length < 2 || pdu[posn] != (char)0x80 || pdu[posn + 1] != (char)0x50 )
+    if ( length < 2 || pdu[posn] != static_cast<char>(0x80) || pdu[posn + 1] != static_cast<char>(0x50) )
         return QString();
     QString result;
     posn += 2;
@@ -2628,7 +2628,7 @@ QSimCommand QSimCommand::fromPdu( const QByteArray& pdu )

     // Process the contents of the SIM command, tag by tag.
     for (;;) {
-        if ( ( posn + length ) > (uint)pdu.size() ) {
+        if ( ( posn + length ) > static_cast<uint>(pdu.size()) ) {
             break;
         }
         newPosn = posn + length;
@@ -2640,7 +2640,7 @@ QSimCommand QSimCommand::fromPdu( const QByteArray& pdu )
                 if ( length < 3 )
                     break;
                 sc.setCommandNumber( pdu[posn] & 0xFF );
-                sc.setType( (QSimCommand::Type)(pdu[posn + 1] & 0xFF) );
+                sc.setType( static_cast<QSimCommand::Type>(pdu[posn + 1] & 0xFF) );
                 sc.setQualifier( pdu[posn + 2] & 0xFF );
             }
             break;
@@ -2649,8 +2649,8 @@ QSimCommand QSimCommand::fromPdu( const QByteArray& pdu )
             {
                 // Device identities, GSM 11.14, section 12.7.
                 if ( length >= 2 ) {
-                    sc.setSourceDevice( (QSimCommand::Device)( pdu[posn] & 0xFF ) );
-                    sc.setDestinationDevice( (QSimCommand::Device)( pdu[posn + 1] & 0xFF ) );
+                    sc.setSourceDevice( static_cast<QSimCommand::Device>( pdu[posn] & 0xFF ) );
+                    sc.setDestinationDevice( static_cast<QSimCommand::Device>( pdu[posn + 1] & 0xFF ) );
                 }
             }
             break;
@@ -2699,7 +2699,7 @@ QSimCommand QSimCommand::fromPdu( const QByteArray& pdu )
                 // SS string for SendSS command, GSM 11.14, section 12.14.
                 if ( length < 1 )
                     break;
-                if ( pdu[posn] == (char)145 ) {
+                if ( pdu[posn] == static_cast<char>(145) ) {
                     sc.setNumber
                         ( "+" + decodeEFADNNumber
                                     ( pdu, posn + 1, length - 1 ) );
@@ -2760,7 +2760,7 @@ QSimCommand QSimCommand::fromPdu( const QByteArray& pdu )
                 // Next action indicator list, GSM 11.14, section 12.24.
                 int index = 0;
                 while ( length > 0 && index < items.size() ) {
-                    uint action = (uint)(pdu[posn++] & 0xFF);
+                    uint action = static_cast<uint>(pdu[posn++] & 0xFF);
                     items[index].setNextAction( action );
                     --length;
                     ++index;
@@ -2772,7 +2772,7 @@ QSimCommand QSimCommand::fromPdu( const QByteArray& pdu )
             {
                 // Tone code for a PlayTone command, GSM 11.14, section 12.16.
                 if ( length > 0 )
-                    sc.setTone( (QSimCommand::Tone)(pdu[posn] & 0xFF) );
+                    sc.setTone( static_cast<QSimCommand::Tone>(pdu[posn] & 0xFF) );
             }
             break;

@@ -2783,7 +2783,7 @@ QSimCommand QSimCommand::fromPdu( const QByteArray& pdu )
                     break;      // Zero-length items indicate empty menu.
                 QSimMenuItem item;
                 if ( length > 0 ) {
-                    item.setIdentifier( (uint)(pdu[posn] & 0xFF) );
+                    item.setIdentifier( static_cast<uint>(pdu[posn] & 0xFF) );
                     ++posn;
                     --length;
                 }
@@ -2797,7 +2797,7 @@ QSimCommand QSimCommand::fromPdu( const QByteArray& pdu )
             {
                 // Default menu item identifier, GSM 11.14, section 12.10.
                 if ( length > 0 )
-                    sc.setDefaultItem( (uint)(pdu[posn] & 0xFF) );
+                    sc.setDefaultItem( static_cast<uint>(pdu[posn] & 0xFF) );
             }
             break;

@@ -2807,10 +2807,10 @@ QSimCommand QSimCommand::fromPdu( const QByteArray& pdu )
                 if ( length >= 2 ) {
                     if ( seenIcon ) {
                         sc.setOtherIconSelfExplanatory( (pdu[posn] & 0x01) == 0 );
-                        sc.setOtherIconId( (uint)(pdu[posn + 1] & 0xFF) );
+                        sc.setOtherIconId( static_cast<uint>(pdu[posn + 1] & 0xFF) );
                     } else {
                         sc.setIconSelfExplanatory( (pdu[posn] & 0x01) == 0 );
-                        sc.setIconId( (uint)(pdu[posn + 1] & 0xFF) );
+                        sc.setIconId( static_cast<uint>(pdu[posn + 1] & 0xFF) );
                         seenIcon = true;
                     }
                 }
@@ -2829,7 +2829,7 @@ QSimCommand QSimCommand::fromPdu( const QByteArray& pdu )
                     --length;
                 }
                 while ( length > 0 && index < items.size() ) {
-                    uint iconId = (uint)(pdu[posn++] & 0xFF);
+                    uint iconId = static_cast<uint>(pdu[posn++] & 0xFF);
                     items[index].setIconId( iconId );
                     items[index].setIconSelfExplanatory( selfExplanatory );
                     --length;
@@ -2849,12 +2849,12 @@ QSimCommand QSimCommand::fromPdu( const QByteArray& pdu )
             {
                 // Timer value.
                 int secs = 0;
-                secs += ((unsigned char) pdu[posn + 0] >> 4) * 3600;
-                secs += ((unsigned char) pdu[posn + 0] & 15) * 36000;
-                secs += ((unsigned char) pdu[posn + 1] >> 4) * 60;
-                secs += ((unsigned char) pdu[posn + 1] & 15) * 600;
-                secs += ((unsigned char) pdu[posn + 2] >> 4) * 1;
-                secs += ((unsigned char) pdu[posn + 2] & 15) * 10;
+                secs += (static_cast<unsigned char>(pdu[posn + 0]) >> 4) * 3600;
+                secs += (static_cast<unsigned char>(pdu[posn + 0]) & 15) * 36000;
+                secs += (static_cast<unsigned char>(pdu[posn + 1]) >> 4) * 60;
+                secs += (static_cast<unsigned char>(pdu[posn + 1]) & 15) * 600;
+                secs += (static_cast<unsigned char>(pdu[posn + 2]) >> 4) * 1;
+                secs += (static_cast<unsigned char>(pdu[posn + 2]) & 15) * 10;
                 sc.setDuration( secs * 1000 );
             }
             break;
@@ -2915,7 +2915,7 @@ QSimCommand QSimCommand::fromPdu( const QByteArray& pdu )
             break;
         }
         posn = newPosn;
-        if ( posn >= (uint)pdu.size() ) {
+        if ( posn >= static_cast<uint>(pdu.size()) ) {
             break;
         }
         readBer( pdu, posn, tag, length );
@@ -2931,16 +2931,16 @@ void _qtopiaphone_writeBerLength( QByteArray& binary, int length )
     int size = binary.size();
     if ( length < 128 ) {
         binary.resize( size + 1 );
-        binary[size] = (char)length;
+        binary[size] = static_cast<char>(length);
     } else if ( length < 256 ) {
         binary.resize( size + 2 );
-        binary[size] = (char)0x81;
-        binary[size + 1] = (char)length;
+        binary[size] = static_cast<char>(0x81);
+        binary[size + 1] = static_cast<char>(length);
     } else {
         binary.resize( size + 3 );
-        binary[size] = (char)0x82;
-        binary[size + 1] = (char)( length >> 8 );
-        binary[size + 2] = (char)length;
+        binary[size] = static_cast<char>(0x82);
+        binary[size + 1] = static_cast<char>( length >> 8 );
+        binary[size + 2] = static_cast<char>(length);
     }
 }
 #define writeBerLength _qtopiaphone_writeBerLength
@@ -2953,15 +2953,15 @@ void _qtopiaphone_writeTextString( QByteArray& binary, const QString& str,
                                    QSimCommand::ToPduOptions options, int tag )
 {
     if ( str.isNull() ) {
-        binary += (char)tag;
-        binary += (char)0x00;
+        binary += static_cast<char>(tag);
+        binary += static_cast<char>(0x00);
         return;
     }
     if ( str.isEmpty() && ( options & QSimCommand::EncodeEmptyStrings ) == 0 ) {
         // Special form for empty strings.
-        binary += (char)tag;
-        binary += (char)0x01;
-        binary += (char)0x00;
+        binary += static_cast<char>(tag);
+        binary += static_cast<char>(0x01);
+        binary += static_cast<char>(0x00);
         return;
     }
     int schemeMask = ((tag & 0xFF00) >> 8);     // For USSD string output.
@@ -2980,7 +2980,7 @@ void _qtopiaphone_writeTextString( QByteArray& binary, const QString& str,
                         for ( int i = 0; i < 7; i++ ) {
                             if ( bitCount == 8 ) {
                                 bitCount = 0;
-                                packed += (char)bits;
+                                packed += static_cast<char>(bits);
                                 bits = 0;
                             }
                             if ( ((1 << (i+8)) & c) != 0 )
@@ -2991,7 +2991,7 @@ void _qtopiaphone_writeTextString( QByteArray& binary, const QString& str,
                     for ( int i = 0; i < 7; i++ ) {
                         if ( bitCount == 8 ) {
                             bitCount = 0;
-                            packed += (char)bits;
+                            packed += static_cast<char>(bits);
                             bits = 0;
                         }
                         if ( ((1 << i) & c) != 0 )
@@ -3000,18 +3000,18 @@ void _qtopiaphone_writeTextString( QByteArray& binary, const QString& str,
                     }
                 }
                 if ( bitCount != 0 ) {
-                    packed += (char)bits;
+                    packed += static_cast<char>(bits);
                 }
-                binary += (char)tag;
+                binary += static_cast<char>(tag);
                 writeBerLength( binary, packed.length() + 1 );
-                binary += (char)(QSMS_DefaultAlphabet | schemeMask);
+                binary += static_cast<char>(QSMS_DefaultAlphabet | schemeMask);
                 binary += packed;
             } else {
                 // Use the unpacked 8-bit GSM alphabet to encode the string.
                 QByteArray unpacked = gsm->fromUnicode( str );
-                binary += (char)tag;
+                binary += static_cast<char>(tag);
                 writeBerLength( binary, unpacked.length() + 1 );
-                binary += (char)(QSMS_8BitAlphabet | schemeMask);
+                binary += static_cast<char>(QSMS_8BitAlphabet | schemeMask);
                 binary += unpacked;
             }
             return;
@@ -3024,12 +3024,12 @@ void _qtopiaphone_writeTextString( QByteArray& binary, const QString& str,
     int len = str.length();
     while ( len-- > 0 ) {
         ushort ch = *data++;
-        ucs2 += (char)(ch >> 8);
-        ucs2 += (char)ch;
+        ucs2 += static_cast<char>(ch >> 8);
+        ucs2 += static_cast<char>(ch);
     }
-    binary += (char)tag;
+    binary += static_cast<char>(tag);
     writeBerLength( binary, ucs2.length() + 1 );
-    binary += (char)(QSMS_UCS2Alphabet | schemeMask);
+    binary += static_cast<char>(QSMS_UCS2Alphabet | schemeMask);
     binary += ucs2;
 }
 #define writeTextString _qtopiaphone_writeTextString
@@ -3047,7 +3047,7 @@ void _qtopiaphone_writeEFADN( QByteArray& binary, const QString& str,
         if ( gsm->canEncode( str ) ) {
             QByteArray unpacked = gsm->fromUnicode( str );
             if ( tag != -1 ) {
-                binary += (char)tag;
+                binary += static_cast<char>(tag);
                 writeBerLength( binary, unpacked.length() );
             }
             binary += unpacked;
@@ -3061,14 +3061,14 @@ void _qtopiaphone_writeEFADN( QByteArray& binary, const QString& str,
     int len = str.length();
     while ( len-- > 0 ) {
         ushort ch = *data++;
-        ucs2 += (char)(ch >> 8);
-        ucs2 += (char)ch;
+        ucs2 += static_cast<char>(ch >> 8);
+        ucs2 += static_cast<char>(ch);
     }
     if ( tag != -1 ) {
-        binary += (char)tag;
+        binary += static_cast<char>(tag);
         writeBerLength( binary, ucs2.length() + 1 );
     }
-    binary += (char)0x80;
+    binary += static_cast<char>(0x80);
     binary += ucs2;
 }
 #define writeEFADN _qtopiaphone_writeEFADN
@@ -3077,10 +3077,10 @@ void _qtopiaphone_writeEFADN( QByteArray& binary, const QString& str,
 static void writeIcon( QByteArray& binary, uint iconId, bool selfExplanatory, bool mandatory )
 {
     if ( iconId ) {
-        binary += (char)( mandatory ? 0x9E : 0x1E );
-        binary += (char)0x02;
-        binary += (char)( selfExplanatory ? 0 : 1 );
-        binary += (char)iconId;
+        binary += static_cast<char>( mandatory ? 0x9E : 0x1E );
+        binary += static_cast<char>(0x02);
+        binary += static_cast<char>( selfExplanatory ? 0 : 1 );
+        binary += static_cast<char>(iconId);
     }
 }

@@ -3088,24 +3088,24 @@ static void writeIcon( QByteArray& binary, uint iconId, bool selfExplanatory, bo
 void _qtopiaphone_writeDuration( QByteArray& data, uint time )
 {
     if ( time != 0 ) {
-        data += (char)0x84;
-        data += (char)0x02;
+        data += static_cast<char>(0x84);
+        data += static_cast<char>(0x02);
         if ( ( time % 1000 ) != 0 && time <= 25500 ) {
             // Encode in tenths of a second.
-            data += (char)0x02;
-            data += (char)(time / 100);
+            data += static_cast<char>(0x02);
+            data += static_cast<char>(time / 100);
         } else if ( ( time % 60000 ) != 0 && time <= 255000 ) {
             // Encode in seconds.
-            data += (char)0x01;
-            data += (char)(time / 1000);
+            data += static_cast<char>(0x01);
+            data += static_cast<char>(time / 1000);
         } else if ( time <= 255 * 6000 ) {
             // Encode in minutes.
-            data += (char)0x00;
-            data += (char)(time / 60000);
+            data += static_cast<char>(0x00);
+            data += static_cast<char>(time / 60000);
         } else {
             // Encode maximum time value.
-            data += (char)0x00;
-            data += (char)0xFF;
+            data += static_cast<char>(0x00);
+            data += static_cast<char>(0xFF);
         }
     }
 }
@@ -3115,15 +3115,15 @@ void _qtopiaphone_writeDuration( QByteArray& data, uint time )
 // is specified in GSM 24.008, Annex E.
 static void writeSubAddress( QByteArray& data, const QString& value )
 {
-    data += (char)0x88;
+    data += static_cast<char>(0x88);
     writeBerLength( data, value.length() + 2 );
-    data += (char)0x80;     // NSAP address type
-    data += (char)0x50;     // NSAP address is BCD-encoded IA5 characters
+    data += static_cast<char>(0x80);     // NSAP address type
+    data += static_cast<char>(0x50);     // NSAP address is BCD-encoded IA5 characters
     for ( const QChar &ch : value ) {
         int val = ch.unicode() - 32;
         if ( val > 127 )
             val = 0;
-        data += (char)(((val / 10) << 4) + (val % 10));
+        data += static_cast<char>(((val / 10) << 4) + (val % 10));
     }
 }

@@ -3135,10 +3135,10 @@ bool _qtopiaphone_extractAndWriteExtField( QByteArray& data, QByteArray& extData
     uint startposn;
     uint posn = 0;
     uint currentTag, length;
-    while ( posn < (uint)( extData.length() ) ) {
+    while ( posn < static_cast<uint>( extData.length() ) ) {
         startposn = posn;
         readBer( extData, posn, currentTag, length );
-        if ( ( currentTag & 0x7F ) == (uint)( tag & 0x7F ) ) {
+        if ( ( currentTag & 0x7F ) == static_cast<uint>( tag & 0x7F ) ) {
             data += extData.mid( startposn, (posn + length) - startposn );
             extData = extData.left( startposn ) + extData.mid( posn + length );
             return true;
@@ -3153,7 +3153,7 @@ bool _qtopiaphone_extractAndWriteExtField( QByteArray& data, QByteArray& extData
 static void writeTextAttribute( QByteArray& data, const QByteArray& attr )
 {
     if ( !attr.isEmpty() ) {
-        data += (char)0xD0;
+        data += static_cast<char>(0xD0);
         writeBerLength( data, attr.length() );
         data += attr;
     }
@@ -3164,7 +3164,7 @@ void _qtopiaphone_writeTimerId( QByteArray& data, uint timerId )
 {
     data += 0xa4;
     data += 0x01;
-    data += (char) timerId;
+    data += static_cast<char>(timerId);
 }
 #define writeTimerId _qtopiaphone_writeTimerId

@@ -3188,7 +3188,7 @@ void _qtopiaphone_writeTimerValue( QByteArray& data, uint value )
 static void writeBearerDesc( QByteArray& data, const QByteArray& bearerDesc )
 {
     if ( !bearerDesc.isEmpty() ) {
-        data += (char)0x35;
+        data += static_cast<char>(0x35);
         writeBerLength( data, bearerDesc.length() );
         data += bearerDesc;
     }
@@ -3198,7 +3198,7 @@ static void writeBearerDesc( QByteArray& data, const QByteArray& bearerDesc )
 static void writeApn( QByteArray& data, const QByteArray& apn )
 {
     if ( !apn.isEmpty() ) {
-        data += (char)0x47;
+        data += static_cast<char>(0x47);
         writeBerLength( data, apn.length() );
         data += apn;
     }
@@ -3210,8 +3210,8 @@ static void writeBufferSize( QByteArray& data, ushort size )
     if ( size ) {
         data += 0x39;
         data += 0x02;
-        data += (char)(size >> 8);
-        data += (char)size;
+        data += static_cast<char>(size >> 8);
+        data += static_cast<char>(size);
     }
 }

@@ -3220,14 +3220,14 @@ static void writeDataLength( QByteArray& data, uint value )
 {
     data += 0x37;
     data += 0x01;
-    data += (char)value;
+    data += static_cast<char>(value);
 }

 // Write a UICC/terminal interface transport level field
 static void writeUti( QByteArray& data, const QByteArray& uti )
 {
     if ( !uti.isEmpty() ) {
-        data += (char)0x3C;
+        data += static_cast<char>(0x3C);
         writeBerLength( data, uti.length() );
         data += uti;
     }
@@ -3237,7 +3237,7 @@ static void writeUti( QByteArray& data, const QByteArray& uti )
 static void writeOtherAddress( QByteArray& data, const QByteArray& otherAddress )
 {
     if ( !otherAddress.isEmpty() ) {
-        data += (char)0x3E;
+        data += static_cast<char>(0x3E);
         writeBerLength( data, otherAddress.length() );
         data += otherAddress;
     }
@@ -3278,21 +3278,21 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const
         // Make sure the "wantDigits" bit is unset if using Yes/No.
         qualifier &= ~0x01;
     }
-    data += (char)0x81;
-    data += (char)0x03;
-    data += (char)commandNumber();
-    data += (char)cmd;
-    data += (char)qualifier;
+    data += static_cast<char>(0x81);
+    data += static_cast<char>(0x03);
+    data += static_cast<char>(commandNumber());
+    data += static_cast<char>(cmd);
+    data += static_cast<char>(qualifier);

     // Output the device identities (SIM to Display/Keypad/Earpiece/etc).
-    data += (char)0x82;
-    data += (char)0x02;
-    data += (char)sourceDevice();
-    data += (char)destinationDevice();
+    data += static_cast<char>(0x82);
+    data += static_cast<char>(0x02);
+    data += static_cast<char>(sourceDevice());
+    data += static_cast<char>(destinationDevice());

     // If user feedback suppression is on, then encode empty strings.
     if ( suppressUserFeedback() )
-        options = (QSimCommand::ToPduOptions)( options | EncodeEmptyStrings );
+        options = static_cast<QSimCommand::ToPduOptions>( options | EncodeEmptyStrings );

     // Add the command parameters.
     QByteArray extData = extensionData();
@@ -3302,8 +3302,8 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const
             writeTextString( data, text(), options );
             writeIcon( data, iconId(), iconSelfExplanatory(), true );
             if ( immediateResponse() ) {
-                data += (char)0xAB;
-                data += (char)0x00;
+                data += static_cast<char>(0xAB);
+                data += static_cast<char>(0x00);
             }
             writeTextAttribute( data, textAttribute() );
         }
@@ -3321,10 +3321,10 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const
         {
             writeTextString( data, text(), options );
             if ( minimumLength() != 0 || maximumLength() != 255 ) {
-                data += (char)0x91;
-                data += (char)0x02;
-                data += (char)minimumLength();
-                data += (char)maximumLength();
+                data += static_cast<char>(0x91);
+                data += static_cast<char>(0x02);
+                data += static_cast<char>(minimumLength());
+                data += static_cast<char>(maximumLength());
             }
             if ( !defaultText().isEmpty() ) {
                 writeTextString( data, defaultText(), QSimCommand::NoPduOptions, 0x17 );
@@ -3339,9 +3339,9 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const
             if ( !text().isEmpty() )
                 writeEFADN( data, text(), options );
             if ( tone() != ToneNone ) {
-                data += (char)0x8E;
-                data += (char)0x01;
-                data += (char)tone();
+                data += static_cast<char>(0x8E);
+                data += static_cast<char>(0x01);
+                data += static_cast<char>(tone());
             }
             writeDuration( data, duration() );
             writeIcon( data, iconId(), iconSelfExplanatory(), false );
@@ -3365,14 +3365,14 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const
             bool hasNextActions = false;
             bool selfExplanatory = false;
             if ( menuItems().size() == 0 ) {
-                data += (char)0x8F;
-                data += (char)0x00;
+                data += static_cast<char>(0x8F);
+                data += static_cast<char>(0x00);
             }
             for ( QSimMenuItem &item : menuItems() ) {
                 QByteArray contents;
-                contents += (char)item.identifier();
+                contents += static_cast<char>(item.identifier());
                 writeEFADN( contents, item.label(), options, -1 );
-                data += (char)0x8F;
+                data += static_cast<char>(0x8F);
                 writeBerLength( data, contents.size() );
                 data += contents;
                 if ( item.iconId() != 0 )
@@ -3384,27 +3384,27 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const
                 attrLen += item.labelAttribute().size();
             }
             if ( hasNextActions ) {
-                data += (char)0x18;
-                data += (char)menuItems().size();
+                data += static_cast<char>(0x18);
+                data += static_cast<char>(menuItems().size());
                 for ( const QSimMenuItem &item : menuItems() )
-                    data += (char)item.nextAction();
+                    data += static_cast<char>(item.nextAction());
             }
             if ( type() == SelectItem && defaultItem() != 0 ) {
-                data += (char)0x90;
-                data += (char)0x01;
-                data += (char)defaultItem();
+                data += static_cast<char>(0x90);
+                data += static_cast<char>(0x01);
+                data += static_cast<char>(defaultItem());
             }
             writeIcon( data, iconId(), iconSelfExplanatory(), true );
             if ( hasIcons ) {
-                data += (char)0x9F;
-                data += (char)(menuItems().size() + 1);
-                data += (char)(selfExplanatory ? 0x00 : 0x01);
+                data += static_cast<char>(0x9F);
+                data += static_cast<char>(menuItems().size() + 1);
+                data += static_cast<char>(selfExplanatory ? 0x00 : 0x01);
                 for ( const QSimMenuItem &item : menuItems() )
-                    data += (char)item.iconId();
+                    data += static_cast<char>(item.iconId());
             }
             writeTextAttribute( data, titleAttribute() );
             if ( attrLen != 0 ) {
-                data += (char)0xD1;
+                data += static_cast<char>(0xD1);
                 writeBerLength( data, attrLen );
                 for ( QSimMenuItem &item : menuItems() ) {
                     data += item.labelAttribute();
@@ -3615,8 +3615,8 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const
             extractAndWriteExtField( data, extData, 0x92 ); // MMS submission file
             extractAndWriteExtField( data, extData, 0xEB ); // Message identifier
             if ( immediateResponse() ) {
-                data += (char)0xAB;
-                data += (char)0x00;
+                data += static_cast<char>(0xAB);
+                data += static_cast<char>(0x00);
             }
         }
         break;
@@ -3624,8 +3624,8 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const
         case LanguageNotification:
         {
             if ( !language().isEmpty() && language().length() == 2 ) {
-                data += (char)0xAD;
-                data += (char)0x02;
+                data += static_cast<char>(0xAD);
+                data += static_cast<char>(0x02);
                 data += language();
             }
         }
@@ -3640,7 +3640,7 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const
     // Add the "Proactive SIM" BER command wrapper if required.
     if ( ( options & NoBerWrapper ) == 0 ) {
         QByteArray ber;
-        ber += (char)0xD0;
+        ber += static_cast<char>(0xD0);
         writeBerLength( ber, data.size() );
         ber += data;
         return ber;
@@ -3736,9 +3736,9 @@ QByteArray QSimCommand::extensionField( int tag ) const
 {
     uint posn = 0;
     uint currentTag, length;
-    while ( posn < (uint)( d->extensionData.length() ) ) {
+    while ( posn < static_cast<uint>( d->extensionData.length() ) ) {
         readBer( d->extensionData, posn, currentTag, length );
-        if ( ( currentTag & 0x7F ) == (uint)( tag & 0x7F ) )
+        if ( ( currentTag & 0x7F ) == static_cast<uint>( tag & 0x7F ) )
             return d->extensionData.mid( posn, length );
         posn += length;
     }
@@ -3755,7 +3755,7 @@ QByteArray QSimCommand::extensionField( int tag ) const
 */
 void QSimCommand::addExtensionField( int tag, const QByteArray& value )
 {
-    d->extensionData += (char)tag;
+    d->extensionData += static_cast<char>(tag);
     writeBerLength( d->extensionData, value.size() );
     d->extensionData += value;
 }
diff --git a/src/qsimcontrolevent.cpp b/src/qsimcontrolevent.cpp
index 4502d78..8b41890 100644
--- a/src/qsimcontrolevent.cpp
+++ b/src/qsimcontrolevent.cpp
@@ -226,9 +226,9 @@ QByteArray QSimControlEvent::extensionField( int tag ) const
 {
     uint posn = 0;
     uint currentTag, length;
-    while ( posn < (uint)( d->extensionData.length() ) ) {
+    while ( posn < static_cast<uint>( d->extensionData.length() ) ) {
         readBer( d->extensionData, posn, currentTag, length );
-        if ( ( currentTag & 0x7F ) == (uint)( tag & 0x7F ) )
+        if ( ( currentTag & 0x7F ) == static_cast<uint>( tag & 0x7F ) )
             return d->extensionData.mid( posn, length );
         posn += length;
     }
@@ -243,7 +243,7 @@ QByteArray QSimControlEvent::extensionField( int tag ) const
 */
 void QSimControlEvent::addExtensionField( int tag, const QByteArray& value )
 {
-    d->extensionData += (char)tag;
+    d->extensionData += static_cast<char>(tag);
     writeBerLength( d->extensionData, value.size() );
     d->extensionData += value;
 }
@@ -269,14 +269,14 @@ QSimControlEvent QSimControlEvent::fromPdu
         return ev;
     }
     readBer( pdu, posn, tag, length );
-    ev.setResult( (QSimControlEvent::Result)tag );
+    ev.setResult( static_cast<QSimControlEvent::Result>(tag) );
     content = pdu.mid( posn, length );
     posn = 0;
-    if ( posn >= (uint)content.size() )
+    if ( posn >= static_cast<uint>(content.size()) )
         return ev;
     readBer( content, posn, tag, length );
     for (;;) {
-        if ( ( posn + length ) > (uint)content.size() )
+        if ( ( posn + length ) > static_cast<uint>(content.size()) )
             break;
         newPosn = posn + length;
         switch ( tag & 0x7F ) {
@@ -296,7 +296,7 @@ QSimControlEvent QSimControlEvent::fromPdu
             break;
         }
         posn = newPosn;
-        if ( posn >= (uint)content.size() )
+        if ( posn >= static_cast<uint>(content.size()) )
             break;
         readBer( content, posn, tag, length );
     }
@@ -335,7 +335,7 @@ QByteArray QSimControlEvent::toPdu() const

     // Add the outermost tag layer and return.
     QByteArray outer;
-    outer += (char)result();
+    outer += static_cast<char>(result());
     writeBerLength( outer, data.size() );
     outer += data;
     return outer;
diff --git a/src/qsimenvelope.cpp b/src/qsimenvelope.cpp
index 3942dad..a9f6bb7 100644
--- a/src/qsimenvelope.cpp
+++ b/src/qsimenvelope.cpp
@@ -324,9 +324,9 @@ QByteArray QSimEnvelope::extensionField( int tag ) const
 {
     uint posn = 0;
     uint currentTag, length;
-    while ( posn < (uint)( d->extensionData.length() ) ) {
+    while ( posn < static_cast<uint>( d->extensionData.length() ) ) {
         readBer( d->extensionData, posn, currentTag, length );
-        if ( ( currentTag & 0x7F ) == (uint)( tag & 0x7F ) )
+        if ( ( currentTag & 0x7F ) == static_cast<uint>( tag & 0x7F ) )
             return d->extensionData.mid( posn, length );
         posn += length;
     }
@@ -341,7 +341,7 @@ QByteArray QSimEnvelope::extensionField( int tag ) const
 */
 void QSimEnvelope::addExtensionField( int tag, const QByteArray& value )
 {
-    d->extensionData += (char)tag;
+    d->extensionData += static_cast<char>(tag);
     writeBerLength( d->extensionData, value.size() );
     d->extensionData += value;
 }
@@ -364,12 +364,12 @@ QSimEnvelope QSimEnvelope::fromPdu( const QByteArray& pdu )
         // Doesn't appear to be a valid ENVELOPE.
         return env;
     }
-    env.setType( (QSimEnvelope::Type)tag );
+    env.setType( static_cast<QSimEnvelope::Type>(tag) );
     content = pdu.mid( posn, length );
     posn = 0;
     readBer( content, posn, tag, length );
     for (;;) {
-        if ( ( posn + length ) > (uint)content.size() )
+        if ( ( posn + length ) > static_cast<uint>(content.size()) )
             break;
         newPosn = posn + length;
         switch ( tag & 0x7F ) {
@@ -379,9 +379,9 @@ QSimEnvelope QSimEnvelope::fromPdu( const QByteArray& pdu )
                 // Device identities, GSM 11.14, section 12.7.
                 if ( length >= 2 ) {
                     env.setSourceDevice
-                        ( (QSimCommand::Device)( content[posn] & 0xFF ) );
+                        ( static_cast<QSimCommand::Device>( content[posn] & 0xFF ) );
                     env.setDestinationDevice
-                        ( (QSimCommand::Device)( content[posn + 1] & 0xFF ) );
+                        ( static_cast<QSimCommand::Device>( content[posn + 1] & 0xFF ) );
                 }
             }
             break;
@@ -390,7 +390,7 @@ QSimEnvelope QSimEnvelope::fromPdu( const QByteArray& pdu )
             {
                 // Menu item identifier, GSM 11.14, section 12.10.
                 if ( length > 0 )
-                    env.setMenuItem( (uint)(content[posn] & 0xFF) );
+                    env.setMenuItem( static_cast<uint>(content[posn] & 0xFF) );
             }
             break;

@@ -405,7 +405,7 @@ QSimEnvelope QSimEnvelope::fromPdu( const QByteArray& pdu )
             {
                 // Event list, GSM 11.14, section 12.25.
                 if ( length > 0 )
-                    env.setEvent( (QSimEnvelope::Event)( content[posn] & 0xFF ) );
+                    env.setEvent( static_cast<QSimEnvelope::Event>( content[posn] & 0xFF ) );
             }
             break;

@@ -417,7 +417,7 @@ QSimEnvelope QSimEnvelope::fromPdu( const QByteArray& pdu )
             break;
         }
         posn = newPosn;
-        if ( posn >= (uint)content.size() )
+        if ( posn >= static_cast<uint>(content.size()) )
             break;
         readBer( content, posn, tag, length );
     }
@@ -435,33 +435,33 @@ QByteArray QSimEnvelope::toPdu() const

     // Output the event list before the device identities.
     if ( d->type == QSimEnvelope::EventDownload ) {
-        data += (char)0x99;
-        data += (char)0x01;
-        data += (char)(d->event);
+        data += static_cast<char>(0x99);
+        data += static_cast<char>(0x01);
+        data += static_cast<char>(d->event);
     }

     // Add the device identity section (ME/Keypad/... to SIM).
     // According to 3GPP TS 51.010-4, the tag should be 0x02 for
     // MO-SMS control by SIM.
     if ( d->type == QSimEnvelope::MOSMSControl )
-        data += (char)0x02;
+        data += static_cast<char>(0x02);
     else
-        data += (char)0x82;
-    data += (char)0x02;
-    data += (char)sourceDevice();
-    data += (char)destinationDevice();
+        data += static_cast<char>(0x82);
+    data += static_cast<char>(0x02);
+    data += static_cast<char>(sourceDevice());
+    data += static_cast<char>(destinationDevice());

     // Add parameters specific to this type of envelope.
     switch ( type() ) {

         case MenuSelection:
         {
-            data += (char)0x90;
-            data += (char)0x01;
-            data += (char)menuItem();
+            data += static_cast<char>(0x90);
+            data += static_cast<char>(0x01);
+            data += static_cast<char>(menuItem());
             if ( requestHelp() ) {
-                data += (char)0x15;
-                data += (char)0x00;
+                data += static_cast<char>(0x15);
+                data += static_cast<char>(0x00);
             }
         }
         break;
@@ -475,7 +475,7 @@ QByteArray QSimEnvelope::toPdu() const

     // Add the outermost envelope tag layer and return.
     QByteArray env;
-    env += (char)type();
+    env += static_cast<char>(type());
     writeBerLength( env, data.size() );
     env += data;
     return env;
diff --git a/src/qsimterminalresponse.cpp b/src/qsimterminalresponse.cpp
index bd600dd..cb78bfb 100644
--- a/src/qsimterminalresponse.cpp
+++ b/src/qsimterminalresponse.cpp
@@ -316,7 +316,7 @@ QSimTerminalResponse::Cause QSimTerminalResponse::cause() const
     if ( d->causeData.isEmpty() )
         return NoSpecificCause;
     else
-        return (QSimTerminalResponse::Cause)(d->causeData[0] & 0xFF);
+        return static_cast<QSimTerminalResponse::Cause>(d->causeData[0] & 0xFF);
 }

 /*!
@@ -328,7 +328,7 @@ QSimTerminalResponse::Cause QSimTerminalResponse::cause() const
 */
 void QSimTerminalResponse::setCause( QSimTerminalResponse::Cause value )
 {
-    d->causeData = QByteArray(1, (char)value);
+    d->causeData = QByteArray(1, static_cast<char>(value));
 }

 /*!
@@ -539,9 +539,9 @@ QByteArray QSimTerminalResponse::extensionField( int tag ) const
 {
     uint posn = 0;
     uint currentTag, length;
-    while ( posn < (uint)( d->extensionData.length() ) ) {
+    while ( posn < static_cast<uint>( d->extensionData.length() ) ) {
         readBer( d->extensionData, posn, currentTag, length );
-        if ( ( currentTag & 0x7F ) == (uint)( tag & 0x7F ) )
+        if ( ( currentTag & 0x7F ) == static_cast<uint>( tag & 0x7F ) )
             return d->extensionData.mid( posn, length );
         posn += length;
     }
@@ -556,7 +556,7 @@ QByteArray QSimTerminalResponse::extensionField( int tag ) const
 */
 void QSimTerminalResponse::addExtensionField( int tag, const QByteArray& value )
 {
-    d->extensionData += (char)tag;
+    d->extensionData += static_cast<char>(tag);
     writeBerLength( d->extensionData, value.size() );
     d->extensionData += value;
 }
@@ -580,7 +580,7 @@ QSimTerminalResponse QSimTerminalResponse::fromPdu( const QByteArray& pdu )
         return resp;
     }
     for (;;) {
-        if ( ( posn + length ) > (uint)pdu.size() )
+        if ( ( posn + length ) > static_cast<uint>(pdu.size()) )
             break;
         newPosn = posn + length;
         switch ( tag & 0x7F ) {
@@ -596,8 +596,8 @@ QSimTerminalResponse QSimTerminalResponse::fromPdu( const QByteArray& pdu )
             {
                 // Device identities, GSM 11.14, section 12.7.
                 if ( length >= 2 ) {
-                    resp.setSourceDevice( (QSimCommand::Device)( pdu[posn] & 0xFF ) );
-                    resp.setDestinationDevice( (QSimCommand::Device)( pdu[posn + 1] & 0xFF ) );
+                    resp.setSourceDevice( static_cast<QSimCommand::Device>( pdu[posn] & 0xFF ) );
+                    resp.setDestinationDevice( static_cast<QSimCommand::Device>( pdu[posn + 1] & 0xFF ) );
                 }
             }
             break;
@@ -607,7 +607,7 @@ QSimTerminalResponse QSimTerminalResponse::fromPdu( const QByteArray& pdu )
                 // Result information.
                 if ( length < 1 )
                     break;
-                resp.setResult( (QSimTerminalResponse::Result)(pdu[posn] & 0xFF) );
+                resp.setResult( static_cast<QSimTerminalResponse::Result>(pdu[posn] & 0xFF) );
                 resp.setCauseData( pdu.mid( posn + 1, length - 1 ) );
             }
             break;
@@ -629,10 +629,10 @@ QSimTerminalResponse QSimTerminalResponse::fromPdu( const QByteArray& pdu )
             case 0x0D:
             {
                 // Text string for terminal response, GSM 11.14, section 12.15.
-                if ( pdu.length() >= 5 && pdu[3] == (int)QSimCommand::GetInkey &&
+                if ( pdu.length() >= 5 && pdu[3] == static_cast<int>(QSimCommand::GetInkey) &&
                      (pdu[4] & 0x04) != 0 ) {
                     // Processing Yes/No responses: convert 0x01/0x00 into Yes/No.
-                    if ( length >= 2 && pdu[posn + 1] != (char)0x00 )
+                    if ( length >= 2 && pdu[posn + 1] != static_cast<char>(0x00) )
                         resp.setText( "Yes" );    // No tr
                     else
                         resp.setText( "No" );     // No tr
@@ -648,7 +648,7 @@ QSimTerminalResponse QSimTerminalResponse::fromPdu( const QByteArray& pdu )
             {
                 // Menu item identifier, GSM 11.14, section 12.10.
                 if ( length > 0 )
-                    resp.setMenuItem( (uint)(pdu[posn] & 0xFF) );
+                    resp.setMenuItem( static_cast<uint>(pdu[posn] & 0xFF) );
             }
             break;

@@ -663,12 +663,12 @@ QSimTerminalResponse QSimTerminalResponse::fromPdu( const QByteArray& pdu )
             {
                 // Timer value.
                 int secs = 0;
-                secs += ((unsigned char) pdu[posn + 0] >> 4) * 3600;
-                secs += ((unsigned char) pdu[posn + 0] & 15) * 36000;
-                secs += ((unsigned char) pdu[posn + 1] >> 4) * 60;
-                secs += ((unsigned char) pdu[posn + 1] & 15) * 600;
-                secs += ((unsigned char) pdu[posn + 2] >> 4) * 1;
-                secs += ((unsigned char) pdu[posn + 2] & 15) * 10;
+                secs += (static_cast<unsigned char>(pdu[posn + 0]) >> 4) * 3600;
+                secs += (static_cast<unsigned char>(pdu[posn + 0]) & 15) * 36000;
+                secs += (static_cast<unsigned char>(pdu[posn + 1]) >> 4) * 60;
+                secs += (static_cast<unsigned char>(pdu[posn + 1]) & 15) * 600;
+                secs += (static_cast<unsigned char>(pdu[posn + 2]) >> 4) * 1;
+                secs += (static_cast<unsigned char>(pdu[posn + 2]) & 15) * 10;
                 resp.setDuration( secs * 1000 );
             }
             break;
@@ -681,7 +681,7 @@ QSimTerminalResponse QSimTerminalResponse::fromPdu( const QByteArray& pdu )
             break;
         }
         posn = newPosn;
-        if ( posn >= (uint)pdu.size() )
+        if ( posn >= static_cast<uint>(pdu.size()) )
             break;
         startPosn = newPosn;
         readBer( pdu, posn, tag, length );
@@ -722,37 +722,37 @@ QByteArray QSimTerminalResponse::toPdu() const
         }
     } else {
         // Could not find the command details, so output default details.
-        data += (char)0x81;
-        data += (char)0x03;
-        data += (char)0x00;
-        data += (char)0x00;
-        data += (char)0x00;
+        data += static_cast<char>(0x81);
+        data += static_cast<char>(0x03);
+        data += static_cast<char>(0x00);
+        data += static_cast<char>(0x00);
+        data += static_cast<char>(0x00);
         tag = 0;
         qual = 0;
     }

     // Add the device identity section (ME to SIM).
-    data += (char)0x82;
-    data += (char)0x02;
-    data += (char)sourceDevice();
-    data += (char)destinationDevice();
+    data += static_cast<char>(0x82);
+    data += static_cast<char>(0x02);
+    data += static_cast<char>(sourceDevice());
+    data += static_cast<char>(destinationDevice());

     // Add the result details.
-    switch ( (QSimCommand::Type)tag ) {
+    switch ( static_cast<QSimCommand::Type>(tag) ) {
         case QSimCommand::SendSS:
             if ( d->result == DataNotUnderstood )
-                data += (char)0x83;
+                data += static_cast<char>(0x83);
             else
-                data += (char)0x03;
+                data += static_cast<char>(0x03);
             break;
-        default:                        data += (char)0x83; break;
+        default:                        data += static_cast<char>(0x83); break;
     }
-    data += (char)(d->causeData.length() + 1);
-    data += (char)(d->result);
+    data += static_cast<char>(d->causeData.length() + 1);
+    data += static_cast<char>(d->result);
     data += d->causeData;

     // Add other information for specific command response types.
-    switch ( (QSimCommand::Type)tag ) {
+    switch ( static_cast<QSimCommand::Type>(tag) ) {

         case QSimCommand::GetInkey:
         {
@@ -761,15 +761,15 @@ QByteArray QSimTerminalResponse::toPdu() const
             if ( ( qual & 0x04 ) != 0 ) {
                 // Encode a Yes/No response.
                 if ( text() == "Yes" ) {      // No tr
-                    data += (char)0x8D;
-                    data += (char)0x02;
-                    data += (char)0x04;
-                    data += (char)0x01;
+                    data += static_cast<char>(0x8D);
+                    data += static_cast<char>(0x02);
+                    data += static_cast<char>(0x04);
+                    data += static_cast<char>(0x01);
                 } else {
-                    data += (char)0x8D;
-                    data += (char)0x02;
-                    data += (char)0x04;
-                    data += (char)0x00;
+                    data += static_cast<char>(0x8D);
+                    data += static_cast<char>(0x02);
+                    data += static_cast<char>(0x04);
+                    data += static_cast<char>(0x00);
                 }
             } else if ( ( qual & 0x02 ) != 0 ) {
                 // Use UCS-2 to encode the data.
@@ -787,13 +787,11 @@ QByteArray QSimTerminalResponse::toPdu() const
                 break;
             if ( ( qual & 0x02 ) != 0 ) {
                 // Use UCS-2 to encode the data.
-                writeTextString( data, text(), (QSimCommand::ToPduOptions)
-                                                 (QSimCommand::UCS2Strings |
+                writeTextString( data, text(), static_cast<QSimCommand::ToPduOptions>(QSimCommand::UCS2Strings |
                                                   QSimCommand::EncodeEmptyStrings) );
             } else if ( ( qual & 0x08 ) != 0 ) {
                 // Use the packed 7-bit GSM encoding to encode the data.
-                writeTextString( data, text(), (QSimCommand::ToPduOptions)
-                                                 (QSimCommand::PackedStrings |
+                writeTextString( data, text(), static_cast<QSimCommand::ToPduOptions>(QSimCommand::PackedStrings |
                                                   QSimCommand::EncodeEmptyStrings) );
             } else {
                 // Use the unpacked 8-bit GSM encoding to encode the data.
@@ -811,9 +809,9 @@ QByteArray QSimTerminalResponse::toPdu() const
         case QSimCommand::SelectItem:
         {
             if ( menuItem() != 0 ) {
-                data += (char)0x90;
-                data += (char)0x01;
-                data += (char)menuItem();
+                data += static_cast<char>(0x90);
+                data += static_cast<char>(0x01);
+                data += static_cast<char>(menuItem());
             }
         }
         break;
diff --git a/src/qsmsmessage.cpp b/src/qsmsmessage.cpp
index e4e41b9..1d0f733 100644
--- a/src/qsmsmessage.cpp
+++ b/src/qsmsmessage.cpp
@@ -87,7 +87,7 @@ public:
         mMessageType = QSMSMessage::Normal;
         mCodec = nullptr;
         mForceGsm = false;
-        mBestScheme = (QSMSDataCodingScheme)(-1);
+        mBestScheme = static_cast<QSMSDataCodingScheme>(-1);
         mDataCodingScheme = -1;
         mMessageClass = -1;
         mProtocol = 0;
@@ -525,7 +525,7 @@ QSMSDataCodingScheme QSMSMessage::bestScheme() const
     bool gsmSafe;

     // Did the user provide a scheme override?
-    if ( d->mBestScheme != (QSMSDataCodingScheme)(-1) )
+    if ( d->mBestScheme != static_cast<QSMSDataCodingScheme>(-1) )
         return d->mBestScheme;

     // Encode zero-length bodies in the default alphabet.
@@ -847,7 +847,7 @@ void QSMSMessage::computeSize( uint& numMessages, uint& spaceLeftInLast ) const
     if ( part != -1 ) {
         // This is an application datagram, which has its size
         // computed using a different algorithm.
-        uint headerLen = 3 + d->mParts[(uint)part].data().size();
+        uint headerLen = 3 + d->mParts[static_cast<uint>(part)].data().size();
         uint dataLen = applicationData().size();
         if ( ( headerLen + dataLen ) <= 140 ) {
             numMessages = 1;
@@ -977,7 +977,7 @@ int QSMSMessage::destinationPort() const
     if ( part == -1 )
         return -1;

-    QByteArray data = d->mParts[(uint)part].data();
+    QByteArray data = d->mParts[static_cast<uint>(part)].data();
     if ( data.size() == 4 ) {

         return ((((int)(data[0])) & 0xFF) << 8) |
@@ -1004,17 +1004,17 @@ void QSMSMessage::setDestinationPort(int value)
     int part = findPart( "application/x-qtopia-wdp-ports" );
     if ( part == -1 ) {
         data.resize(4);
-        data[0] = (char)(value >> 8);
-        data[1] = (char)value;
-        data[2] = (char)0;
-        data[3] = (char)0;
+        data[0] = static_cast<char>(value >> 8);
+        data[1] = static_cast<char>(value);
+        data[2] = static_cast<char>(0);
+        data[3] = static_cast<char>(0);
     } else {
         source = sourcePort();
         data.resize(4);
-        data[0] = (char)(value >> 8);
-        data[1] = (char)value;
-        data[2] = (char)(source >> 8);
-        data[3] = (char)source;
+        data[0] = static_cast<char>(value >> 8);
+        data[1] = static_cast<char>(value);
+        data[2] = static_cast<char>(source >> 8);
+        data[3] = static_cast<char>(source);
     }
     removeParts( "application/x-qtopia-wdp-ports" );
     addPart( QSMSMessagePart( "application/x-qtopia-wdp-ports", data ) );
@@ -1032,7 +1032,7 @@ int QSMSMessage::sourcePort() const
     if ( part == -1 )
         return -1;

-    QByteArray data = d->mParts[(uint)part].data();
+    QByteArray data = d->mParts[static_cast<uint>(part)].data();
     if ( data.size() == 4 ) {

         return ((((int)(data[2])) & 0xFF) << 8) |
@@ -1059,17 +1059,17 @@ void QSMSMessage::setSourcePort(int value)
     int part = findPart( "application/x-qtopia-wdp-ports" );
     if ( part == -1 ) {
         data.resize(4);
-        data[0] = (char)0;
-        data[1] = (char)0;
-        data[2] = (char)(value >> 8);
-        data[3] = (char)value;
+        data[0] = static_cast<char>(0);
+        data[1] = static_cast<char>(0);
+        data[2] = static_cast<char>(value >> 8);
+        data[3] = static_cast<char>(value);
     } else {
         dest = destinationPort();
         data.resize(4);
-        data[0] = (char)(dest >> 8);
-        data[1] = (char)dest;
-        data[2] = (char)(value >> 8);
-        data[3] = (char)value;
+        data[0] = static_cast<char>(dest >> 8);
+        data[1] = static_cast<char>(dest);
+        data[2] = static_cast<char>(value >> 8);
+        data[3] = static_cast<char>(value);
     }
     removeParts( "application/x-qtopia-wdp-ports" );
     addPart( QSMSMessagePart( "application/x-qtopia-wdp-ports", data ) );
@@ -1248,7 +1248,7 @@ QList<QSMSMessage> QSMSMessage::split() const
         uint partSize = 134 - 6;
         while ( posn < data.size() ) {
             tmp = *this;
-            if ( ( posn + partSize ) <= (uint)data.size() ) {
+            if ( ( posn + partSize ) <= static_cast<uint>(data.size()) ) {
                 part.resize(partSize);
                 memcpy(part.data(), data.data() + posn, partSize );
             } else {
@@ -1343,9 +1343,9 @@ void QSMSMessage::setFragmentHeader( uint refNum, uint part, uint numParts,
     d->mHeaders.resize( len + 5 );
     d->mHeaders[len++] = 0;         // Type for concatenated short messages.
     d->mHeaders[len++] = 3;         // Length of header information.
-    d->mHeaders[len++] = (char)refNum;
-    d->mHeaders[len++] = (char)numParts;
-    d->mHeaders[len++] = (char)part;
+    d->mHeaders[len++] = static_cast<char>(refNum);
+    d->mHeaders[len++] = static_cast<char>(numParts);
+    d->mHeaders[len++] = static_cast<char>(part);
 }


@@ -1356,12 +1356,12 @@ void QSMSMessage::unpackHeaderParts()
     uint tag, len;
     uint temp;
     QString type;
-    while ( ( posn + 2 ) <= (uint)(headers.size()) ) {
+    while ( ( posn + 2 ) <= static_cast<uint>(headers.size()) ) {
         tag = (unsigned char)(headers[posn]);
         len = (unsigned char)(headers[posn + 1]);
-        if ( ( posn + len + 2 ) > (uint)(headers.size()) )
+        if ( ( posn + len + 2 ) > static_cast<uint>(headers.size()) )
             break;
-        switch ( (SMSHeaderKind)tag ) {
+        switch ( static_cast<SMSHeaderKind>(tag) ) {

             case SMS_HK_Predefined_Sound:
             {
@@ -1412,7 +1412,7 @@ void QSMSMessage::unpackHeaderParts()
                     data[2] = 0x20;
                     data[3] = 0x20;
                     for ( temp = 0; temp < (len - 1); ++temp ) {
-                        data[4 + temp] = (char)(~(headers[posn + 3 + temp]));
+                        data[4 + temp] = static_cast<char>(~(headers[posn + 3 + temp]));
                     }
                     addPart( QSMSMessagePart
                         ( "image/vnd.wap.wbmp", data,
@@ -1432,7 +1432,7 @@ void QSMSMessage::unpackHeaderParts()
                     data[2] = 0x10;
                     data[3] = 0x10;
                     for ( temp = 0; temp < (len - 1); ++temp ) {
-                        data[4 + temp] = (char)(~(headers[posn + 3 + temp]));
+                        data[4 + temp] = static_cast<char>(~(headers[posn + 3 + temp]));
                     }
                     addPart( QSMSMessagePart
                         ( "image/vnd.wap.wbmp", data,
@@ -1451,7 +1451,7 @@ void QSMSMessage::unpackHeaderParts()
                     data[2] = headers[posn + 3];
                     data[3] = headers[posn + 4];
                     for ( temp = 2; temp < (len - 1); ++temp ) {
-                        data[2 + temp] = (char)(~(headers[posn + 3 + temp]));
+                        data[2 + temp] = static_cast<char>(~(headers[posn + 3 + temp]));
                     }
                     addPart( QSMSMessagePart
                         ( "image/vnd.wap.wbmp", data,
@@ -1521,11 +1521,11 @@ void QPDUMessage::skipOctet()
 QByteArray QPDUMessage::getOctets( uint len )
 {
     QByteArray result;
-    if ( ( mBuffer.size() - mPosn ) < (int)len ) {
+    if ( ( mBuffer.size() - mPosn ) < static_cast<int>(len) ) {
         result = mBuffer.mid( mPosn );
         abort();
     } else {
-        result = mBuffer.mid( mPosn, (int)len );
+        result = mBuffer.mid( mPosn, static_cast<int>(len) );
         mPosn += len;
     }
     return result;
@@ -1537,15 +1537,15 @@ char QPDUMessage::mBits;
 void QPDUMessage::setBit(int b, bool on)
 {
     if ( on )
-        mBits |= (char)(Unit << b);
+        mBits |= static_cast<char>(Unit << b);
     else
-        mBits &= (char)(~(Unit << b));
+        mBits &= static_cast<char>(~(Unit << b));
 }

 void QPDUMessage::setBits(int offset, int len, int val)
 {
     uint mask = ((Unit << len) - 1) << offset;
-    mBits = (char)((mBits & ~mask) | ((val << offset) & mask));
+    mBits = static_cast<char>((mBits & ~mask) | ((val << offset) & mask));
 }

 void QPDUMessage::commitBits()
@@ -1571,8 +1571,7 @@ bool QPDUMessage::bit(int b)
 unsigned char QPDUMessage::bits(int offset, int len)
 {
     if ( needOctets(1) )
-        return (unsigned char)
-            ((mBuffer[mPosn] >> offset) & ((Unit << len) - 1));
+        return static_cast<unsigned char>((mBuffer[mPosn] >> offset) & ((Unit << len) - 1));
     else
         return 0;
 }
@@ -1588,7 +1587,7 @@ unsigned char QPDUMessage::getOctet()
 unsigned char QPDUMessage::peekOctet() const
 {
     if ( needOctets(1) )
-        return (unsigned char)(mBuffer[mPosn]);
+        return static_cast<unsigned char>(mBuffer[mPosn]);
     else
         return 0;
 }
@@ -1605,14 +1604,14 @@ static QByteArray collapse7Bit( const QByteArray& in )
                 byte |= (1 << size);
             ++size;
             if ( size >= 8 ) {
-                out += (char)byte;
+                out += static_cast<char>(byte);
                 byte = 0;
                 size = 0;
             }
         }
     }
     if ( size != 0 ) {
-        out += (char)byte;
+        out += static_cast<char>(byte);
     }
     return out;
 }
@@ -1655,7 +1654,7 @@ void QPDUMessage::appendAddress( QByteArray &buffer, const QString &strin, bool

     // Bail out early if the address is zero-length.
     if ( !len ) {
-        buffer.append( (char) 0 );
+        buffer.append( static_cast<char>(0) );
         return;
     }

@@ -1755,7 +1754,7 @@ static QByteArray expand7Bit( const QByteArray& in )
                 byte |= (1 << size);
             ++size;
             if ( size >= 7 ) {
-                out += (char)byte;
+                out += static_cast<char>(byte);
                 byte = 0;
                 size = 0;
             }
@@ -1771,14 +1770,14 @@ QString QPDUMessage::address(bool SCAddress)
     // Get the address length and validate it.
     if ( !needOctets(1) )
         return str;
-    uint len = (((uint)(getOctet())) & 0xFF);
+    uint len = ((static_cast<uint>(getOctet())) & 0xFF);
     if ( !needOctets(len) ) {
         abort();
         return str;
     }

     if ( len ) {
-        SMSAddressType at = (SMSAddressType) bits(4, 3);
+        SMSAddressType at = static_cast<SMSAddressType>(bits(4, 3));

         if ( at == SMS_Address_International )
             str += "+";
@@ -1792,12 +1791,12 @@ QString QPDUMessage::address(bool SCAddress)

         if ( at != SMS_Address_AlphaNumeric ) {
             unsigned char c;
-            for (int i = 0; i < (int)len; i++) {
+            for (int i = 0; i < static_cast<int>(len); i++) {
                 c = peekOctet() & 0x0F;
-                str += (char) ('0' + c);
+                str += static_cast<char>('0' + c);
                 c = (peekOctet() & 0xF0) >> 4;
                 if ( c != 0xf )
-                    str += (char) ('0' + c);
+                    str += static_cast<char>('0' + c);
                 skipOctet();
             }
         } else {
@@ -1815,7 +1814,7 @@ QString QPDUMessage::address(bool SCAddress)
 uint QPDUMessage::addressLength() const
 {
     if( mPosn < mBuffer.size() )
-        return (((uint)peekOctet()) & 0xFF) + 1;
+        return ((static_cast<uint>(peekOctet())) & 0xFF) + 1;
     else
         return 0;
 }
@@ -1834,7 +1833,7 @@ void QPDUMessage::setTimeStamp(const QDateTime &dt)
     tArr[5] = t.second();

     for ( int i = 0; i < 6; i++) {
-        appendOctet((unsigned char) ( (((tArr[i]/10)%10) & 0x0F) | (((tArr[i]%10) & 0x0F)<<4) ) );
+        appendOctet(static_cast<unsigned char>( (((tArr[i]/10)%10) & 0x0F) | (((tArr[i]%10) & 0x0F)<<4) ) );
     }

     appendOctet(0x04); //arbitrary random timezone
@@ -1870,7 +1869,7 @@ QDateTime QPDUMessage::timeStamp()
 static uint getEncodedLength( const QString& txt, uint size )
 {
     uint len = 0;
-    for ( int u = 0; u < (int)size; u++ ) {
+    for ( int u = 0; u < static_cast<int>(size); u++ ) {
         if ( QGsmCodec::twoByteFromUnicode( txt[u].unicode() ) >= 256 )
             len += 2;
         else
@@ -1884,7 +1883,7 @@ void QPDUMessage::setUserData(const QString &txt, QSMSDataCodingScheme scheme, Q
     uint len = txt.length();
     uint u;
     uint encodedLen;
-    uint headerLen = (uint)(headers.size());
+    uint headerLen = static_cast<uint>(headers.size());
     if ( headerLen )
         ++headerLen;

@@ -1892,7 +1891,7 @@ void QPDUMessage::setUserData(const QString &txt, QSMSDataCodingScheme scheme, Q
     switch (scheme >> 6) {
     case 0:
     default:
-        scheme = (QSMSDataCodingScheme)(scheme & 0x0C);
+        scheme = static_cast<QSMSDataCodingScheme>(scheme & 0x0C);
         break;
     case 3:
         switch ((scheme & 0x30) >> 4) {
@@ -1982,7 +1981,7 @@ void QPDUMessage::setUserData(const QString &txt, QSMSDataCodingScheme scheme, Q
         }
         const char *s = (const char *)converted;
         for ( u = 0; u < len; u++ ) {
-            appendOctet( (unsigned char)(s[u]) );
+            appendOctet( static_cast<unsigned char>(s[u]) );
         }

     } else {
@@ -1999,8 +1998,8 @@ void QPDUMessage::setUserData(const QString &txt, QSMSDataCodingScheme scheme, Q
             }
         }
         for ( u = 0; u < len; u++ ) {
-            appendOctet( (unsigned char)(txt[u].unicode() >> 8) );
-            appendOctet( (unsigned char)(txt[u].unicode() & 0xFF) );
+            appendOctet( static_cast<unsigned char>(txt[u].unicode() >> 8) );
+            appendOctet( static_cast<unsigned char>(txt[u].unicode() & 0xFF) );
         }

     }
@@ -2012,13 +2011,13 @@ static bool isSMSDatagram( const QByteArray& headers )
 {
     uint posn = 0;
     uint tag, len;
-    while ( ( posn + 2 ) <= (uint)(headers.size()) ) {
-        tag = (unsigned char)(headers[posn]);
-        len = (unsigned char)(headers[posn + 1]);
-        if ( ( posn + len + 2 ) > (uint)(headers.size()) )
+    while ( ( posn + 2 ) <= static_cast<uint>(headers.size()) ) {
+        tag = static_cast<unsigned char>(headers[posn]);
+        len = static_cast<unsigned char>(headers[posn + 1]);
+        if ( ( posn + len + 2 ) > static_cast<uint>(headers.size()) )
             break;
-        if ( tag == (uint)SMS_HK_AppPort_8Bit ||
-             tag == (uint)SMS_HK_AppPort_16Bit ) {
+        if ( tag == static_cast<uint>(SMS_HK_AppPort_8Bit) ||
+             tag == static_cast<uint>(SMS_HK_AppPort_16Bit) ) {
             return true;
         }
         posn += len + 2;
@@ -2042,11 +2041,11 @@ QString QPDUMessage::userData(QSMSDataCodingScheme scheme, QTextCodec *codec, QB
     } else {
         if ( !needOctets(1) )
             return str;
-        len = (uint)getOctet();
+        len = static_cast<uint>(getOctet());
     }

     // Strip off everything except the alphabet bits.
-    scheme = (QSMSDataCodingScheme)(scheme & 0x0C);
+    scheme = static_cast<QSMSDataCodingScheme>(scheme & 0x0C);

     if ( scheme == QSMS_DefaultAlphabet ) {

@@ -2092,7 +2091,7 @@ QString QPDUMessage::userData(QSMSDataCodingScheme scheme, QTextCodec *codec, QB
                             ( QGsmCodec::twoByteToUnicode( 0x1B00 | ch ) );
                         prefixed = false;
                     } else {
-                        str += QGsmCodec::singleToUnicode( (unsigned char)ch );
+                        str += QGsmCodec::singleToUnicode( static_cast<unsigned char>(ch) );
                     }
                     ch = 0;
                     --len;
@@ -2110,7 +2109,7 @@ QString QPDUMessage::userData(QSMSDataCodingScheme scheme, QTextCodec *codec, QB
             return str;
         }
         if ( hasHeaders ) {
-            if ( !len || len < (uint)( (peekOctet() & 0xFF) + 1 ) ) {
+            if ( !len || len < static_cast<uint>( (peekOctet() & 0xFF) + 1 ) ) {
                 abort();
                 return str;
             }
@@ -2130,7 +2129,7 @@ QString QPDUMessage::userData(QSMSDataCodingScheme scheme, QTextCodec *codec, QB
             return str;
         }
         if ( hasHeaders ) {
-            if ( !len || len < (uint)( (peekOctet() & 0xFF) + 1 ) ) {
+            if ( !len || len < static_cast<uint>( (peekOctet() & 0xFF) + 1 ) ) {
                 abort();
                 return str;
             }
@@ -2140,9 +2139,9 @@ QString QPDUMessage::userData(QSMSDataCodingScheme scheme, QTextCodec *codec, QB
         }
         len /= 2;
         for ( u = 0; u < len; ++u ) {
-            ch = (((uint)(getOctet() & 0xFF)) << 8);
-            ch |= ((uint)(getOctet() & 0xFF));
-            str += (QChar)ch;
+            ch = ((static_cast<uint>(getOctet() & 0xFF)) << 8);
+            ch |= (static_cast<uint>(getOctet() & 0xFF));
+            str += QChar(ch);
         }

     } else {
@@ -2150,12 +2149,12 @@ QString QPDUMessage::userData(QSMSDataCodingScheme scheme, QTextCodec *codec, QB
         // Assume 8-bit for any other coding scheme value.

         // Process an 8-bit sequence using the default Latin1 codec.
-        if ( len > (uint)(mBuffer.size() - mPosn) ) {
+        if ( len > static_cast<uint>(mBuffer.size() - mPosn) ) {
             // The length field is invalid - use the actual size.
             len = mBuffer.size() - mPosn;
         }
         if ( hasHeaders ) {
-            if ( !len || len < (uint)( (peekOctet() & 0xFF) + 1 ) ) {
+            if ( !len || len < static_cast<uint>( (peekOctet() & 0xFF) + 1 ) ) {
                 abort();
                 return str;
             }
@@ -2166,7 +2165,7 @@ QString QPDUMessage::userData(QSMSDataCodingScheme scheme, QTextCodec *codec, QB
             len -= headerLen + 1;
         }
         for ( u = 0; u < len; ++u ) {
-            str += (QChar)(getOctet() & 0xFF);
+            str += QChar(getOctet() & 0xFF);
         }

     }
@@ -2184,10 +2183,10 @@ SMSMessageType QPDUMessage::messageType()
         const char *ptr = mBuffer.constData();
         ptr += (*ptr & 0xFF) + 1;
         unsigned char c = *ptr & 3;
-        return (SMSMessageType) c;
+        return static_cast<SMSMessageType>(c);

     }
-    return (SMSMessageType)0;
+    return static_cast<SMSMessageType>(0);
 }

 QSMSSubmitMessage::QSMSSubmitMessage(const QSMSMessage &m, bool isDeliver)
@@ -2207,30 +2206,29 @@ QSMSSubmitMessage::QSMSSubmitMessage(const QSMSMessage &m, bool isDeliver)
     QSMSDataCodingScheme scheme = m.bestScheme();
     int part = m.findPart( "application/x-qtopia-wdp-ports" );
     if ( part != -1 ) {
-        QByteArray portData = m.parts()[(uint)part].data();
+        QByteArray portData = m.parts()[static_cast<uint>(part)].data();
         uint size = headers.size();
         headers.resize(size + portData.size() + 2);
         if ( portData.size() == 4 ) {
-            headers[size++] = (char)SMS_HK_AppPort_16Bit;
+            headers[size++] = static_cast<char>(SMS_HK_AppPort_16Bit);
         } else {
-            headers[size++] = (char)SMS_HK_AppPort_8Bit;
+            headers[size++] = static_cast<char>(SMS_HK_AppPort_8Bit);
         }
-        headers[size++] = (char)(portData.size());
+        headers[size++] = static_cast<char>(portData.size());
         memcpy(headers.data() + size, portData.data(), portData.size());
         int dataScheme = m.dataCodingScheme(); // User-supplied override.
         if ( dataScheme == -1 )
             dataScheme = 0xF5;      // Special value for datagrams.
-        scheme = (QSMSDataCodingScheme)dataScheme;
+        scheme = static_cast<QSMSDataCodingScheme>(dataScheme);
     } else if ( m.messageClass() != -1 ) {
-        scheme = (QSMSDataCodingScheme)
-                    (scheme | QSMS_MessageClass | m.messageClass());
+        scheme = static_cast<QSMSDataCodingScheme>(scheme | QSMS_MessageClass | m.messageClass());
         int dataScheme = m.dataCodingScheme(); // User-supplied override.
         if ( dataScheme != -1 )
-            scheme = (QSMSDataCodingScheme)dataScheme;
+            scheme = static_cast<QSMSDataCodingScheme>(dataScheme);
     } else {
         int dataScheme = m.dataCodingScheme(); // User-supplied override.
         if ( dataScheme != -1 )
-            scheme = (QSMSDataCodingScheme)dataScheme;
+            scheme = static_cast<QSMSDataCodingScheme>(dataScheme);
     }

     if ( !isDeliver )
@@ -2239,7 +2237,7 @@ QSMSSubmitMessage::QSMSSubmitMessage(const QSMSMessage &m, bool isDeliver)
         setBits(0, 2, SMS_Deliver);

     setBit(2, false);                   // TP-Reject-Duplicates
-    if ( !isDeliver && m.validityPeriod() == (uint)(-1) )
+    if ( !isDeliver && m.validityPeriod() == static_cast<uint>(-1) )
         setBits(3, 2, SMS_VF_NoPresent);
     else
         setBits(3, 2, SMS_VF_Relative);
@@ -2273,7 +2271,7 @@ QSMSSubmitMessage::QSMSSubmitMessage(const QSMSMessage &m, bool isDeliver)

     if ( !isDeliver ) {
         // TP-VP ( Validity Period )
-        if ( m.validityPeriod() != (uint)(-1) )
+        if ( m.validityPeriod() != static_cast<uint>(-1) )
             appendOctet(m.gsmValidityPeriod());
     }  else {
         setTimeStamp(m.timestamp());
@@ -2291,7 +2289,7 @@ QSMSSubmitMessage::QSMSSubmitMessage(const QSMSMessage &m, bool isDeliver)
         appendOctet( len + headers.size() + 1 );
         appendOctet( headers.size() );
         uint u;
-        for ( u = 0; u < (uint)headers.size(); u++ ) {
+        for ( u = 0; u < static_cast<uint>(headers.size()); u++ ) {
             appendOctet( headers[u] );
         }
         for ( u = 0; u < len; u++ ) {
@@ -2333,8 +2331,8 @@ static void unpackSckl( QSMSMessage& m, const QString& text )
     m.addPart( QSMSMessagePart( "application/x-qtopia-wdp-ports", ports ) );
     if ( header.size() > 4 ) {
         QByteArray fragments( header.size() - 4 + 2, '\0' );
-        fragments[0] = (char)( SMS_HK_Concat_8Bit );
-        fragments[1] = (char)( header.size() - 4 );
+        fragments[0] = static_cast<char>( SMS_HK_Concat_8Bit );
+        fragments[1] = static_cast<char>( header.size() - 4 );
         memcpy( fragments.data() + 2, header.data() + 4, header.size() - 4 );
         m.setHeaders( fragments );
     }
@@ -2436,14 +2434,14 @@ QSMSMessage QSMSDeliverMessage::unpack(QTextCodec *codec)
                 return m;
             mPosn += 7;
         } else {
-            m.setValidityPeriod( (uint)(-1) );
+            m.setValidityPeriod( static_cast<uint>(-1) );
         }
     }

     // Read the user data field.
     QByteArray *headers = nullptr;
     QString text;
-    text = userData( (QSMSDataCodingScheme)scheme, codec,
+    text = userData( static_cast<QSMSDataCodingScheme>(scheme), codec,
                      headers, userDataHeader, false );
     if ( !headers && text.startsWith( "//SCKL" ) ) {
         unpackSckl( m, text );
@@ -2584,19 +2582,19 @@ QCBSMessage QCBSDeliverMessage::unpack(QTextCodec *codec)

     const char *mOffset = mBuffer.constData() + mPosn;
     m.setMessageCode( ((mOffset[0] & 0xFC) << 2) | (mOffset[1] & 0x0F) );
-    m.setScope( (QCBSMessage::GeographicalScope)(mOffset[0] & 0x03) );
+    m.setScope( static_cast<QCBSMessage::GeographicalScope>(mOffset[0] & 0x03) );
     m.setUpdateNumber( (mOffset[1] >> 4) & 0x0F );
     m.setChannel( ((mOffset[2] & 0xFF) << 8) | (mOffset[3] & 0xFF) );
-    scheme = (unsigned char)((mOffset[4] >> 4) & 0x0F);
-    m.setLanguage( (QCBSMessage::Language)(mOffset[4] & 0x0F) );
-    m.setNumPages( (uint)((mOffset[5] >> 4) & 0x0F) );
-    m.setPage( (uint)(mOffset[5] & 0x0F) );
+    scheme = static_cast<unsigned char>((mOffset[4] >> 4) & 0x0F);
+    m.setLanguage( static_cast<QCBSMessage::Language>(mOffset[4] & 0x0F) );
+    m.setNumPages( static_cast<uint>((mOffset[5] >> 4) & 0x0F) );
+    m.setPage( static_cast<uint>(mOffset[5] & 0x0F) );
     mPosn += 6;

     // Read the user data field and strip CR's, LF's, and NUL's from the end.
     QByteArray *headers = nullptr;
     QString text = userData
-        ( (QSMSDataCodingScheme)scheme, codec, headers, false, true );
+        ( static_cast<QSMSDataCodingScheme>(scheme), codec, headers, false, true );
     len = text.length();
     while ( len > 0 && ( text.at(len - 1) == QChar ('\r') || text.at(len - 1) == QChar ('\n') ||
                          text.at(len - 1) == QChar ('\0') ) ) {
@@ -2619,17 +2617,17 @@ void QCBSDeliverMessage::pack(const QCBSMessage &m, QSMSDataCodingScheme scheme)
     mPosn = 0;
     mBits = 0;

-    mBuffer.append( (char) (((m.messageCode() >> 4) & 0x3F) | (m.scope() << 6)) );
-    mBuffer.append( (char)(((m.messageCode() & 0xF) << 4) | (m.updateNumber() & 0xF)) );
-    mBuffer.append( (char)((m.channel() & 0x0000FF00) >> 8) );
-    mBuffer.append( (char)(m.channel() & 0x000000FF) );
+    mBuffer.append( static_cast<char>(((m.messageCode() >> 4) & 0x3F) | (m.scope() << 6)) );
+    mBuffer.append( static_cast<char>(((m.messageCode() & 0xF) << 4) | (m.updateNumber() & 0xF)) );
+    mBuffer.append( static_cast<char>((m.channel() & 0x0000FF00) >> 8) );
+    mBuffer.append( static_cast<char>(m.channel() & 0x000000FF) );

     if (scheme == QSMS_UCS2Alphabet)
         mBuffer.append( 0x11 );
     else
-        mBuffer.append( (char)(((scheme & 0x0F)<<4) | (m.language() & 0x0F)) );
+        mBuffer.append( static_cast<char>(((scheme & 0x0F)<<4) | (m.language() & 0x0F)) );

-    mBuffer.append( (char)((m.numPages() & 0x0F) | ((m.page() & 0x0F) << 4)) );
+    mBuffer.append( static_cast<char>((m.numPages() & 0x0F) | ((m.page() & 0x0F) << 4)) );

     QString paddedText = m.text();

@@ -2639,8 +2637,8 @@ void QCBSDeliverMessage::pack(const QCBSMessage &m, QSMSDataCodingScheme scheme)

         iso639_2_from_language(m.language(), iso639);
         c = ((iso639[1] & 0x7F)<<7) | (iso639[0] & 0x7F);
-        mBuffer.append( (char)(c & 0xFF) );
-        mBuffer.append( (char)(c >> 8) );
+        mBuffer.append( static_cast<char>(c & 0xFF) );
+        mBuffer.append( static_cast<char>(c >> 8) );
         numPad = 40 - (paddedText.length());
     }
     else
diff --git a/src/qsmsmessage_p.h b/src/qsmsmessage_p.h
index 49060c7..b25056f 100644
--- a/src/qsmsmessage_p.h
+++ b/src/qsmsmessage_p.h
@@ -120,7 +120,7 @@ public:
     static void setBits(int offset, int len, int val);
     void commitBits();
     static void commitBits(QByteArray& buffer);
-    void appendOctet(uchar c) { mBuffer += (char)c; }
+    void appendOctet(uchar c) { mBuffer += static_cast<char>(c); }

     bool bit(int b);
     unsigned char bits(int offset, int len);
@@ -147,7 +147,7 @@ public:
     void reset() { mPosn = 0; }

     bool needOctets( uint num ) const
-        { return ((uint)(mBuffer.size() - mPosn) >= num); }
+        { return (static_cast<uint>(mBuffer.size() - mPosn) >= num); }

     static void appendAddress( QByteArray &buffer, const QString &strin, bool SCAddress );

diff --git a/src/qwsppdu.cpp b/src/qwsppdu.cpp
index f3a1661..ccb6869 100644
--- a/src/qwsppdu.cpp
+++ b/src/qwsppdu.cpp
@@ -346,8 +346,8 @@ QDateTime QWspDateTime::parseDate(QString in)
     QString time, timeDiff;

     for (int z = 0; z < in.length(); z++) {
-        if (in[(int)z] != ',') {
-            org += in[(int)z];
+        if (in[z] != ',') {
+            org += in[z];
         } else {
             org += " ";
         }
@@ -357,7 +357,7 @@ QDateTime QWspDateTime::parseDate(QString in)
     org += " ";

     index = org.indexOf(' ');
-    str = org.left((uint) index);
+    str = org.left(static_cast<uint>(index));
     while ( str != QString() ) {
         len = str.length();
         index--;
@@ -547,9 +547,9 @@ quint8 QWspPduDecoder::peekOctet()
     char o;
     if ( dev->getChar(&o) ) {
         dev->ungetChar(o);
-        return (quint8)o;
+        return static_cast<quint8>(o);
     } else {
-        return (quint8)0;
+        return static_cast<quint8>(0);
     }
 }

@@ -561,12 +561,12 @@ quint8 QWspPduDecoder::decodeOctet()
     char o;
     if (dev->atEnd()) {
         stat = Eof;
-        return (quint8)0;
+        return static_cast<quint8>(0);
     } else if ( dev->getChar(&o) ) {
-        return (quint8)o;
+        return static_cast<quint8>(o);
     } else {
         stat = Eof;
-        return (quint8)0;
+        return static_cast<quint8>(0);
     }
 }

@@ -621,7 +621,7 @@ quint32 QWspPduDecoder::decodeUIntVar()

     quint32 v = 0;
     for (int i = 0; i < count; i++) {
-        v |= (quint32)d[i] << ((count-i-1)*7);
+        v |= static_cast<quint32>(d[i]) << ((count-i-1)*7);
     }

     return v;
@@ -648,7 +648,7 @@ quint32 QWspPduDecoder::decodeLongInteger()
     quint8 len = decodeUInt8();    // short length
     quint32 v = 0;
     for (int i = 0; i < len && !dev->atEnd(); i++) {
-        v |= (quint32)decodeOctet() << ((len-i-1)*8);
+        v |= static_cast<quint32>(decodeOctet()) << ((len-i-1)*8);
     }
     return v;
 }
@@ -680,7 +680,7 @@ quint32 QWspPduDecoder::decodeLength()
     quint32 len = 0;
     quint8 o = peekOctet();
     if (o < 31) {
-        len = (quint32)decodeOctet();
+        len = static_cast<quint32>(decodeOctet());
     } else if (o == 31) {
         decodeOctet();
         len = decodeUIntVar();
@@ -791,7 +791,7 @@ QString QWspPduDecoder::decodeContentType()
     if (o <= 31) {
         // Content-general-form
         quint32 len = decodeLength();
-        int endByte = (int)(dev->pos()+len);
+        int endByte = static_cast<int>(dev->pos()+len);
         // decode media type
         o = peekOctet();
         if (o & 0x80) {
@@ -811,7 +811,7 @@ QString QWspPduDecoder::decodeContentType()
                 o = decodeOctet();
             }
         }
-        while (endByte > ((int)(dev->pos())) && !dev->atEnd()) {
+        while (endByte > (static_cast<int>(dev->pos())) && !dev->atEnd()) {
             // read parameters
             QString p = decodeParameter();
             if (!p.isEmpty())
@@ -924,12 +924,12 @@ QString QWspPduDecoder::decodeParameter()
             case 0x07:
                 p = "differences=";
                 if (octet & 0x80)
-                    p += QString::number((int)decodeShortInteger());
+                    p += QString::number(static_cast<int>(decodeShortInteger()));
                 else
                     p += '\"' + decodeTokenText() + '\"';
                 break;
             case 0x08:
-                p = "padding=" + QString::number((int)decodeShortInteger());
+                p = "padding=" + QString::number(static_cast<int>(decodeShortInteger()));
                 break;
             case 0x09:
                 p = "type=";
@@ -1019,16 +1019,16 @@ QWspMultipart QWspPduDecoder::decodeMultipart()
 */
 void QWspPduDecoder::decodeContentTypeAndHeaders(QWspPart& part, quint32 hdrLen)
 {
-    int curByte = (int)(dev->pos());
-    int afterHeader = curByte + (int)hdrLen;
+    int curByte = static_cast<int>(dev->pos());
+    int afterHeader = curByte + static_cast<int>(hdrLen);
     QWspField field;
     field.name = "Content-Type";
     field.value = decodeContentType();
     part.addHeader(field);
-    hdrLen -= ((int)(dev->pos())) - curByte;
+    hdrLen -= (static_cast<int>(dev->pos())) - curByte;

-    int dataByte = ((int)(dev->pos())) + hdrLen;
-    while (((int)(dev->pos())) < dataByte && !dev->atEnd()) {
+    int dataByte = (static_cast<int>(dev->pos())) + hdrLen;
+    while ((static_cast<int>(dev->pos())) < dataByte && !dev->atEnd()) {
         field = decodeField();
         part.addHeader(field);
     }
@@ -1065,7 +1065,7 @@ QWspPush QWspPduDecoder::decodePush()

     decodeContentTypeAndHeaders(part, hdrLen);

-    part.readData(dev, ((int)dev->size()) - ((int)(dev->pos())));
+    part.readData(dev, (static_cast<int>(dev->size())) - (static_cast<int>(dev->pos())));

     return part;
 }
@@ -1128,16 +1128,16 @@ QString QWspPduDecoder::decodeCharset( const QString &encoded, quint32 mib)
     {
         for(int x = 1; x < encoded.length(); x+=2)
         {
-            bytes[x-1] = (char)encoded[x].unicode();
-            bytes[x] = (char)encoded[x-1].unicode();
+            bytes[x-1] = static_cast<char>(encoded[x].unicode());
+            bytes[x] = static_cast<char>(encoded[x-1].unicode());
         }
     }
     else
     {
-        int posn = (int)encoded.length();
+        int posn = encoded.length();
         while ( posn > 0 ) {
             --posn;
-            bytes[posn] = (char)( encoded[posn].unicode() );
+            bytes[posn] = static_cast<char>( encoded[posn].unicode() );
         }
     }

@@ -1179,7 +1179,7 @@ QWspPduEncoder::~QWspPduEncoder()
 */
 void QWspPduEncoder::encodeOctet(quint8 octet)
 {
-    dev->putChar((char)octet);
+    dev->putChar(static_cast<char>(octet));
 }

 /*!
@@ -1187,7 +1187,7 @@ void QWspPduEncoder::encodeOctet(quint8 octet)
 */
 void QWspPduEncoder::encodeUInt8(quint8 octet)
 {
-    dev->putChar((char)octet);
+    dev->putChar(static_cast<char>(octet));
 }

 /*!
@@ -1195,8 +1195,8 @@ void QWspPduEncoder::encodeUInt8(quint8 octet)
 */
 void QWspPduEncoder::encodeUInt16(quint16 d)
 {
-    dev->putChar((char)(d >> 8));
-    dev->putChar((char)(d & 0x0f));
+    dev->putChar(static_cast<char>(d >> 8));
+    dev->putChar(static_cast<char>(d & 0x0f));
 }

 /*!
@@ -1204,10 +1204,10 @@ void QWspPduEncoder::encodeUInt16(quint16 d)
 */
 void QWspPduEncoder::encodeUInt32(quint32 d)
 {
-    dev->putChar((char)((d >> 24) & 0x0f));
-    dev->putChar((char)((d >> 16) & 0x0f));
-    dev->putChar((char)((d >> 8) & 0x0f));
-    dev->putChar((char)(d & 0x0f));
+    dev->putChar(static_cast<char>((d >> 24) & 0x0f));
+    dev->putChar(static_cast<char>((d >> 16) & 0x0f));
+    dev->putChar(static_cast<char>((d >> 8) & 0x0f));
+    dev->putChar(static_cast<char>(d & 0x0f));
 }

 /*!
@@ -1228,7 +1228,7 @@ void QWspPduEncoder::encodeUIntVar(quint32 iv)
         int val = d[count];
         if (count)
             val |= 0x80;
-        dev->putChar((char)val);
+        dev->putChar(static_cast<char>(val));
     }
 }

@@ -1237,7 +1237,7 @@ void QWspPduEncoder::encodeUIntVar(quint32 iv)
 */
 void QWspPduEncoder::encodeShortInteger(quint8 d)
 {
-    dev->putChar((char)(d | 0x80));
+    dev->putChar(static_cast<char>(d | 0x80));
 }

 /*!
@@ -1255,7 +1255,7 @@ void QWspPduEncoder::encodeLongInteger(quint32 iv)
     encodeUInt8(count);
     while (count) {
         count--;
-        dev->putChar((char)(d[count]));
+        dev->putChar(static_cast<char>(d[count]));
     }
 }

@@ -1288,13 +1288,13 @@ void QWspPduEncoder::encodeLength(quint32 d)
 */
 void QWspPduEncoder::encodeTextString(const QString &str)
 {
-    if ((uchar)str[0].toLatin1() >= 128)
+    if (static_cast<uchar>(str[0].toLatin1()) >= 128)
         dev->putChar('\"');

     for (int i = 0; i < str.length(); i++)
-        dev->putChar((char)(str[i].toLatin1()));
+        dev->putChar((str[i].toLatin1()));

-    if ((uchar)str[0].toLatin1() >= 128)
+    if (static_cast<uchar>(str[0].toLatin1()) >= 128)
         dev->putChar('\"');

     dev->putChar(0);
@@ -1614,8 +1614,8 @@ void QWspPduEncoder::encodePush(const QWspPush &part)

     quint32 hdrLen = buffer.buffer().size();

-    encodeOctet((quint8)(part.identifier()));
-    encodeOctet((quint8)(part.pduType()));
+    encodeOctet(static_cast<quint8>(part.identifier()));
+    encodeOctet(static_cast<quint8>(part.pduType()));
     encodeUIntVar(hdrLen);
     buffer.close();

@@ -1630,7 +1630,7 @@ QString QWspPduEncoder::unquoteString(const QString &str)

     if ( tmp[0] == '\"' )
         tmp = tmp.right( tmp.length() - 1 );
-    if ( tmp[(int)tmp.length() - 1] == '\"' )
+    if ( tmp[tmp.length() - 1] == '\"' )
         tmp = tmp.left( tmp.length() - 1 );

     return tmp;
@@ -1977,7 +1977,7 @@ QString QWspPush::quickContentType( const QByteArray& data )
                 type = contentTypeAssignments[ch];
         } else {
             while ( ch != 0 ) {
-                type += (QChar)ch;
+                type += QChar(ch);
                 ++posn;
                 if ( posn < size )
                     ch = data[posn] & 0xFF;
@@ -1991,7 +1991,7 @@ QString QWspPush::quickContentType( const QByteArray& data )
             type = contentTypeAssignments[ch];
     } else {
         while ( ch != 0 ) {
-            type += (QChar)ch;
+            type += QChar(ch);
             ++posn;
             if ( posn < size )
                 ch = data[posn] & 0xFF;
@@ -2004,8 +2004,8 @@ QString QWspPush::quickContentType( const QByteArray& data )

     // Make sure that the content type does not contain
     // invalid characters, to protect the filesystem.
-    for ( posn = 0; posn < (uint)(type.length()); ++posn ) {
-        ch = (int)(type[posn].unicode());
+    for ( posn = 0; posn < static_cast<uint>(type.length()); ++posn ) {
+        ch = static_cast<int>(type[posn].unicode());
         if ( ch >= 'A' && ch <= 'Z' )
             continue;
         if ( ch >= 'a' && ch <= 'z' )
@@ -2017,7 +2017,7 @@ QString QWspPush::quickContentType( const QByteArray& data )
         if ( ch == '/' ) {
             // If the '/' is followed by '.', it may be an attempt
             // to do "xyz/..", which would be bad.
-            if ( (posn + 1) < (uint)(type.length()) && type[posn + 1] == '.' )
+            if ( (posn + 1) < static_cast<uint>(type.length()) && type[posn + 1] == '.' )
                 return QString();

             // Cannot use '/' at the start of a MIME type.
diff --git a/src/simapplication.cpp b/src/simapplication.cpp
index 84058af..5968399 100644
--- a/src/simapplication.cpp
+++ b/src/simapplication.cpp
@@ -910,43 +910,43 @@ void DemoSimApplication::sendToneMenu()
     cmd.setType( QSimCommand::SelectItem );
     cmd.setTitle( "Tones" );

-    item.setIdentifier( (uint)QSimCommand::ToneDial );
+    item.setIdentifier( static_cast<uint>(QSimCommand::ToneDial) );
     item.setLabel( "Dial" );
     items += item;

-    item.setIdentifier( (uint)QSimCommand::ToneBusy );
+    item.setIdentifier( static_cast<uint>(QSimCommand::ToneBusy) );
     item.setLabel( "Busy" );
     items += item;

-    item.setIdentifier( (uint)QSimCommand::ToneCongestion );
+    item.setIdentifier( static_cast<uint>(QSimCommand::ToneCongestion) );
     item.setLabel( "Congestion" );
     items += item;

-    item.setIdentifier( (uint)QSimCommand::ToneRadioAck );
+    item.setIdentifier( static_cast<uint>(QSimCommand::ToneRadioAck) );
     item.setLabel( "Radio Ack" );
     items += item;

-    item.setIdentifier( (uint)QSimCommand::ToneDropped );
+    item.setIdentifier( static_cast<uint>(QSimCommand::ToneDropped) );
     item.setLabel( "Dropped" );
     items += item;

-    item.setIdentifier( (uint)QSimCommand::ToneError );
+    item.setIdentifier( static_cast<uint>(QSimCommand::ToneError) );
     item.setLabel( "Error" );
     items += item;

-    item.setIdentifier( (uint)QSimCommand::ToneCallWaiting );
+    item.setIdentifier( static_cast<uint>(QSimCommand::ToneCallWaiting) );
     item.setLabel( "Call Waiting" );
     items += item;

-    item.setIdentifier( (uint)QSimCommand::ToneGeneralBeep );
+    item.setIdentifier( static_cast<uint>(QSimCommand::ToneGeneralBeep) );
     item.setLabel( "General Beep" );
     items += item;

-    item.setIdentifier( (uint)QSimCommand::TonePositiveBeep );
+    item.setIdentifier( static_cast<uint>(QSimCommand::TonePositiveBeep) );
     item.setLabel( "Positive Beep" );
     items += item;

-    item.setIdentifier( (uint)QSimCommand::ToneNegativeBeep );
+    item.setIdentifier( static_cast<uint>(QSimCommand::ToneNegativeBeep) );
     item.setLabel( "Negative Beep" );
     items += item;

@@ -964,7 +964,7 @@ void DemoSimApplication::toneMenu( const QSimTerminalResponse& resp )
         cmd.setType( QSimCommand::PlayTone );
         cmd.setText( "Play a standard supervisory tone" );
         cmd.setDestinationDevice( QSimCommand::Earpiece );
-        cmd.setTone( (QSimCommand::Tone)( resp.menuItem() ) );
+        cmd.setTone( static_cast<QSimCommand::Tone>( resp.menuItem() ) );
         if ( cmd.tone() == QSimCommand::ToneDial )
             cmd.setDuration( 5000 );
         else if ( cmd.tone() == QSimCommand::ToneGeneralBeep ||
@@ -2338,28 +2338,28 @@ void DemoSimApplication::refreshMenuResp( const QSimTerminalResponse& resp )
             cmd.refreshType() == QSimCommand::InitAndFileChange ||
             cmd.refreshType() == QSimCommand::NaaSessionReset ) {
         QByteArray files;
-        files += (char) 0x03;
+        files += static_cast<char>(0x03);
         /* EFmsisdn */
-        files += (char) 0x3f;
-        files += (char) 0x00;
-        files += (char) 0x7f;
-        files += (char) 0xff;
-        files += (char) 0x6f;
-        files += (char) 0x40;
+        files += static_cast<char>(0x3f);
+        files += static_cast<char>(0x00);
+        files += static_cast<char>(0x7f);
+        files += static_cast<char>(0xff);
+        files += static_cast<char>(0x6f);
+        files += static_cast<char>(0x40);
         /* EFecc */
-        files += (char) 0x3f;
-        files += (char) 0x00;
-        files += (char) 0x7f;
-        files += (char) 0xff;
-        files += (char) 0x6f;
-        files += (char) 0xb7;
+        files += static_cast<char>(0x3f);
+        files += static_cast<char>(0x00);
+        files += static_cast<char>(0x7f);
+        files += static_cast<char>(0xff);
+        files += static_cast<char>(0x6f);
+        files += static_cast<char>(0xb7);
         /* EFfdn */
-        files += (char) 0x3f;
-        files += (char) 0x00;
-        files += (char) 0x7f;
-        files += (char) 0xff;
-        files += (char) 0x6f;
-        files += (char) 0x3b;
+        files += static_cast<char>(0x3f);
+        files += static_cast<char>(0x00);
+        files += static_cast<char>(0x7f);
+        files += static_cast<char>(0xff);
+        files += static_cast<char>(0x6f);
+        files += static_cast<char>(0x3b);
         cmd.addExtensionField( 0x92, files );
     }

@@ -2451,8 +2451,8 @@ void DemoSimApplication::BIPMenu( const QSimTerminalResponse& resp )

                 destAddress += 0x21;
                 destAddress += 0x7F; /* local host 127.0.0.1 */
-                destAddress += (char) 0x00;
-                destAddress += (char) 0x00;
+                destAddress += static_cast<char>(0x00);
+                destAddress += static_cast<char>(0x00);
                 destAddress += 0x01;

                 apn += 0x06;
@@ -2501,8 +2501,8 @@ void DemoSimApplication::BIPMenu( const QSimTerminalResponse& resp )

                 destAddress += 0x21;
                 destAddress += 0x7F; /* local host 127.0.0.1 */
-                destAddress += (char) 0x00;
-                destAddress += (char) 0x00;
+                destAddress += static_cast<char>(0x00);
+                destAddress += static_cast<char>(0x00);
                 destAddress += 0x01;

                 apn += 0x06;
diff --git a/src/simauth.cpp b/src/simauth.cpp
index 93b8826..b5fc7b1 100644
--- a/src/simauth.cpp
+++ b/src/simauth.cpp
@@ -52,8 +52,8 @@ void SimAuth::gsmAuthenticate( QString rand, QString &sres,

     comp128( ki, _rand, _sres, _kc );

-    sres = QByteArray( (const char *)_sres, 4 ).toHex();
-    kc = QByteArray( (const char *)_kc, 8 ).toHex();
+    sres = QByteArray( reinterpret_cast<const char *>(_sres), 4 ).toHex();
+    kc = QByteArray( reinterpret_cast<const char *>(_kc), 8 ).toHex();
 }

 /*
@@ -167,7 +167,7 @@ enum UmtsStatus SimAuth::umtsAuthenticate( QString rand, QString autn,

         memcpy(_auts + 6, out1 + 8, 8);

-        auts = QByteArray( (const char *)_auts, 14 ).toHex();
+        auts = QByteArray( reinterpret_cast<const char *>(_auts), 14 ).toHex();

         return UMTS_SYNC_FAILURE;
     }
@@ -206,9 +206,9 @@ enum UmtsStatus SimAuth::umtsAuthenticate( QString rand, QString autn,
     /* ik ^ opc */
     XOR(_ik, _ik, opc, 16);

-    res = QByteArray( (const char *)_res, 8 ).toHex();
-    ck = QByteArray( (const char *)_ck, 16 ).toHex();
-    ik = QByteArray( (const char *)_ik, 16 ).toHex();
+    res = QByteArray( reinterpret_cast<const char *>(_res), 8 ).toHex();
+    ck = QByteArray( reinterpret_cast<const char *>(_ck), 16 ).toHex();
+    ik = QByteArray( reinterpret_cast<const char *>(_ik), 16 ).toHex();

     return UMTS_OK;
 }
diff --git a/src/simfilesystem.cpp b/src/simfilesystem.cpp
index b3ea8a4..7293a2f 100644
--- a/src/simfilesystem.cpp
+++ b/src/simfilesystem.cpp
@@ -249,8 +249,8 @@ bool SimFileSystem::fileAccess( const QString& args, QString& resp )

         case 176:       // READ BINARY
         {
-            offset = (int)((p1 << 8) + p2);
-            length = (int)p3;
+            offset = static_cast<int>((p1 << 8) + p2);
+            length = static_cast<int>(p3);
             item = findItem( fileid );
             if ( !item ) {
                 sw1 = 0x94;
@@ -283,8 +283,8 @@ bool SimFileSystem::fileAccess( const QString& args, QString& resp )

         case 178:       // READ RECORD
         {
-            offset = (int)(p1 - 1);
-            length = (int)p3;
+            offset = static_cast<int>(p1 - 1);
+            length = static_cast<int>(p3);
             item = findItem( fileid );
             if ( !item ) {
                 sw1 = 0x94;
@@ -339,8 +339,8 @@ bool SimFileSystem::fileAccess( const QString& args, QString& resp )
             status[0] = 0x00;           // RFU
             status[1] = 0x00;
             int size = currentItem->contents().size();
-            status[2] = (char)(size >> 8);
-            status[3] = (char)size;
+            status[2] = static_cast<char>(size >> 8);
+            status[3] = static_cast<char>(size);
             status[4] = fileid.left(2).toInt(0, 16);
             status[5] = fileid.right(2).toInt(0, 16);
             if ( currentItem == rootItem ) {
@@ -365,8 +365,8 @@ bool SimFileSystem::fileAccess( const QString& args, QString& resp )
                 status[13] = 0x00;
                 status[14] = 0x00;
             } else if ( currentItem->recordSize() > 0 ) {
-                status[13] = (char)(currentItem->type() );
-                status[14] = (char)( currentItem->recordSize() );
+                status[13] = static_cast<char>(currentItem->type() );
+                status[14] = static_cast<char>( currentItem->recordSize() );
             } else {
                 status[13] = 0x00;
                 status[14] = 0x00;
@@ -379,8 +379,8 @@ bool SimFileSystem::fileAccess( const QString& args, QString& resp )

         case 214:       // UPDATE BINARY
         {
-            offset = (int)((p1 << 8) + p2);
-            length = (int)p3;
+            offset = static_cast<int>((p1 << 8) + p2);
+            length = static_cast<int>(p3);
             item = findItem( fileid );
             if ( !item ) {
                 sw1 = 0x94;
@@ -415,8 +415,8 @@ bool SimFileSystem::fileAccess( const QString& args, QString& resp )

         case 220:       // UPDATE RECORD
         {
-            offset = (int)(p1 - 1);
-            length = (int)p3;
+            offset = static_cast<int>(p1 - 1);
+            length = static_cast<int>(p3);
             item = findItem( fileid );
             if ( !item ) {
                 sw1 = 0x94;
--
2.24.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH phonesim 11/13] Use dynamic_cast where appropriate
  2019-11-12 21:37 Modernize phonesim codebase Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (9 preceding siblings ...)
  2019-11-12 21:37 ` [PATCH phonesim 10/13] Port from c-style casts to static_cast<>() Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-12 21:37 ` Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  2019-11-18 21:24   ` Denis Kenzior
  2019-11-12 21:37 ` [PATCH phonesim 12/13] Annotate overriding functions with override Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  2019-11-12 21:37 ` [PATCH phonesim 13/13] Use bool literals Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  12 siblings, 1 reply; 21+ messages in thread
From: Jonah =?unknown-8bit?q?Br=C3=BCchert?= @ 2019-11-12 21:37 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1607 bytes --]

Done using the cppcoreguidelines-pro-type-cstyle-cast check of clang-tidy
---
 src/aidapplication.cpp | 2 +-
 src/phonesim.cpp       | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/aidapplication.cpp b/src/aidapplication.cpp
index 16fef0c..807d7f9 100644
--- a/src/aidapplication.cpp
+++ b/src/aidapplication.cpp
@@ -15,7 +15,7 @@ AidApplication::AidApplication( QObject *parent, SimXmlNode& n )

     while (child) {
         if ( child->tag == "filesystem" )
-            fs = new SimFileSystem( (SimRules *)parent, *child, FILE_SYSTEM_TYPE_ISIM );
+            fs = new SimFileSystem( dynamic_cast<SimRules *>(parent), *child, FILE_SYSTEM_TYPE_ISIM );

         child = child->next;
     }
diff --git a/src/phonesim.cpp b/src/phonesim.cpp
index f9dab52..9acd39e 100644
--- a/src/phonesim.cpp
+++ b/src/phonesim.cpp
@@ -1665,7 +1665,7 @@ void SimRules::callControlEventNotify( const QSimControlEvent& evt )

 void SimRules::delayTimeout()
 {
-    SimDelayTimer *timer = (SimDelayTimer *)sender();
+    SimDelayTimer *timer = dynamic_cast<SimDelayTimer *>(sender());
     int save = currentChannel;
     currentChannel = timer->channel;
     writeChatData(timer->response.toLatin1().data(), timer->response.length());
@@ -1676,7 +1676,7 @@ void SimRules::delayTimeout()

 void SimRules::delaySetVariable()
 {
-    QVariantTimer *timer = (QVariantTimer *)sender();
+    QVariantTimer *timer = dynamic_cast<QVariantTimer *>(sender());
     QPairKV kv = timer->param.value<QPairKV>();

     setVariable( kv.first, kv.second );
--
2.24.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH phonesim 12/13] Annotate overriding functions with override
  2019-11-12 21:37 Modernize phonesim codebase Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (10 preceding siblings ...)
  2019-11-12 21:37 ` [PATCH phonesim 11/13] Use dynamic_cast where appropriate Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-12 21:37 ` Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  2019-11-18 21:32   ` Denis Kenzior
  2019-11-12 21:37 ` [PATCH phonesim 13/13] Use bool literals Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  12 siblings, 1 reply; 21+ messages in thread
From: Jonah =?unknown-8bit?q?Br=C3=BCchert?= @ 2019-11-12 21:37 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 14616 bytes --]

* Allows us to notice when a function becomes source incompatible in a Qt major release,
  and our implementation stops overriding.
---
 src/aidapplication.cpp      |  3 ++-
 src/aidapplication.h        |  4 ++--
 src/callmanager.h           |  2 +-
 src/control.h               | 18 +++++++--------
 src/hardwaremanipulator.cpp |  1 +
 src/phonesim.h              | 16 +++++++-------
 src/qatutils.cpp            | 44 ++++++++++++++++++-------------------
 src/qgsmcodec.h             | 10 ++++-----
 src/qwsppdu.cpp             |  6 ++---
 src/qwsppdu.h               |  4 ++--
 src/simapplication.h        | 20 ++++++++---------
 src/simauth.h               |  2 +-
 src/simfilesystem.h         |  4 ++--
 13 files changed, 68 insertions(+), 66 deletions(-)

diff --git a/src/aidapplication.cpp b/src/aidapplication.cpp
index 807d7f9..395fe99 100644
--- a/src/aidapplication.cpp
+++ b/src/aidapplication.cpp
@@ -190,7 +190,8 @@ bool AidAppWrapper::command( const QString& cmd )

             return true;
         }
-        break;
+        // if CMD_TYPE_GSM_AUTH is the case, we already returned
+        // and can't fallthrough, so no break here
         case CMD_TYPE_UMTS_AUTH:
         {
             enum UmtsStatus status;
diff --git a/src/aidapplication.h b/src/aidapplication.h
index d8b1b93..9126412 100644
--- a/src/aidapplication.h
+++ b/src/aidapplication.h
@@ -44,7 +44,7 @@ class AidApplication : public QObject
     Q_OBJECT
 public:
     AidApplication( QObject *parent, SimXmlNode& n );
-    ~AidApplication();
+    ~AidApplication() override;

     QString getAid() { return aid; };
     QString getType() { return type; };
@@ -67,7 +67,7 @@ class AidAppWrapper : public QObject
     Q_OBJECT
 public:
     AidAppWrapper( SimRules *r, QList<AidApplication *> apps, SimAuth *auth = nullptr );
-    ~AidAppWrapper();
+    ~AidAppWrapper() override;

     bool command( const QString& cmd );

diff --git a/src/callmanager.h b/src/callmanager.h
index 9b1eef0..a39f484 100644
--- a/src/callmanager.h
+++ b/src/callmanager.h
@@ -52,7 +52,7 @@ class CallManager : public QObject
     Q_OBJECT
 public:
     CallManager( QObject *parent = nullptr );
-    ~CallManager();
+    ~CallManager() override;

     // Process an AT command.  Returns false if not a call-related command.
     bool command( const QString& cmd );
diff --git a/src/control.h b/src/control.h
index a7c0ff3..79cd417 100644
--- a/src/control.h
+++ b/src/control.h
@@ -119,7 +119,7 @@ signals:
     void stateChangedToHangup( int callId );

 protected:
-    void closeEvent(QCloseEvent *event);
+    void closeEvent(QCloseEvent *event) override;

 private:
     Ui_ControlBase *ui;
@@ -150,17 +150,17 @@ Q_OBJECT

 public:
     Control(const QString& ruleFile, SimRules *sr, QObject *parent=nullptr);
-    virtual ~Control();
+    ~Control() override;

 public slots:
-    void handleFromData( const QString& );
-    void handleToData( const QString& );
-    void setPhoneNumber( const QString& );
-    void handleNewApp();
-    void callManagement( QList<CallInfo> *info );
+    void handleFromData( const QString& ) override;
+    void handleToData( const QString& ) override;
+    void setPhoneNumber( const QString& ) override;
+    void handleNewApp() override;
+    void callManagement( QList<CallInfo> *info ) override;

 protected:
-    virtual void warning( const QString&, const QString& );
+    void warning( const QString&, const QString& ) override;

 private:
     ControlWidget *widget;
@@ -170,7 +170,7 @@ private:
 class ControlFactory : public HardwareManipulatorFactory
 {
 public:
-    inline virtual HardwareManipulator *create(SimRules *sr, QObject *parent)
+    inline HardwareManipulator *create(SimRules *sr, QObject *parent) override
         { return new Control(ruleFile(), sr, parent); }
 };

diff --git a/src/hardwaremanipulator.cpp b/src/hardwaremanipulator.cpp
index ea895e7..63c498a 100644
--- a/src/hardwaremanipulator.cpp
+++ b/src/hardwaremanipulator.cpp
@@ -363,4 +363,5 @@ void HardwareManipulator::simAppAbort()

 void HardwareManipulator::callManagement( QList<CallInfo> *info )
 {
+    Q_UNUSED(info)
 }
diff --git a/src/phonesim.h b/src/phonesim.h
index ac5084d..362a6a8 100644
--- a/src/phonesim.h
+++ b/src/phonesim.h
@@ -128,7 +128,7 @@ class SimItem : public QObject
     Q_OBJECT
 public:
     SimItem( SimState *state ) { _state = state; }
-    virtual ~SimItem() {}
+    ~SimItem() override {}

     // Get the state that contains this item.
     SimState *state() { return _state; }
@@ -153,9 +153,9 @@ class SimChat : public SimItem
     Q_OBJECT
 public:
     SimChat( SimState *state, SimXmlNode& e );
-    ~SimChat() {}
+    ~SimChat() override {}

-    virtual bool command( const QString& cmd );
+    bool command( const QString& cmd ) override;

 private:
     QString _command;
@@ -180,10 +180,10 @@ class SimUnsolicited : public SimItem
     Q_OBJECT
 public:
     SimUnsolicited( SimState *state, SimXmlNode& e );
-    ~SimUnsolicited() {}
+    ~SimUnsolicited() override {}

-    virtual void enter();
-    virtual void leave();
+    void enter() override;
+    void leave() override;

 private:
     QString response;
@@ -204,7 +204,7 @@ class SimPhoneBook : public QObject
     Q_OBJECT
 public:
     SimPhoneBook( int size, QObject *parent );
-    ~SimPhoneBook();
+    ~SimPhoneBook() override;

     int size() const { return numbers.size(); }
     int used() const;
@@ -248,7 +248,7 @@ class SimRules : public QTcpSocket
     Q_OBJECT
 public:
     SimRules(qintptr fd, QObject *parent, const QString& filename, HardwareManipulatorFactory *hmf );
-    ~SimRules() {}
+    ~SimRules() override {}

     // get the variable value for.
     QString variable(const QString &name);
diff --git a/src/qatutils.cpp b/src/qatutils.cpp
index c6cc013..253a932 100644
--- a/src/qatutils.cpp
+++ b/src/qatutils.cpp
@@ -325,14 +325,14 @@ class QGsmHexCodec : public QTextCodec
 {
 public:
     QGsmHexCodec();
-    ~QGsmHexCodec();
+    ~QGsmHexCodec() override;

-    QByteArray name() const;
-    int mibEnum() const;
+    QByteArray name() const override;
+    int mibEnum() const override;

 protected:
-    QString convertToUnicode(const char *in, int length, ConverterState *state) const;
-    QByteArray convertFromUnicode(const QChar *in, int length, ConverterState *state) const;
+    QString convertToUnicode(const char *in, int length, ConverterState *state) const override;
+    QByteArray convertFromUnicode(const QChar *in, int length, ConverterState *state) const override;
 };

 QGsmHexCodec::QGsmHexCodec()
@@ -411,14 +411,14 @@ class QUcs2HexCodec : public QTextCodec
 {
 public:
     QUcs2HexCodec();
-    ~QUcs2HexCodec();
+    ~QUcs2HexCodec() override;

-    QByteArray name() const;
-    int mibEnum() const;
+    QByteArray name() const override;
+    int mibEnum() const override;

 protected:
-    QString convertToUnicode(const char *in, int length, ConverterState *state) const;
-    QByteArray convertFromUnicode(const QChar *in, int length, ConverterState *state) const;
+    QString convertToUnicode(const char *in, int length, ConverterState *state) const override;
+    QByteArray convertFromUnicode(const QChar *in, int length, ConverterState *state) const override;
 };

 QUcs2HexCodec::QUcs2HexCodec()
@@ -484,15 +484,15 @@ class QCodePage437Codec : public QTextCodec
 {
 public:
     QCodePage437Codec();
-    ~QCodePage437Codec();
+    ~QCodePage437Codec() override;

-    QByteArray name() const;
-    QList<QByteArray> aliases() const;
-    int mibEnum() const;
+    QByteArray name() const override;
+    QList<QByteArray> aliases() const override;
+    int mibEnum() const override;

 protected:
-    QString convertToUnicode(const char *in, int length, ConverterState *state) const;
-    QByteArray convertFromUnicode(const QChar *in, int length, ConverterState *state) const;
+    QString convertToUnicode(const char *in, int length, ConverterState *state) const override;
+    QByteArray convertFromUnicode(const QChar *in, int length, ConverterState *state) const override;
 };

 // Convert IBM437 character codes 0x00 - 0xFF into Unicode.
@@ -685,15 +685,15 @@ class QCodePage850Codec : public QTextCodec
 {
 public:
     QCodePage850Codec();
-    ~QCodePage850Codec();
+    ~QCodePage850Codec() override;

-    QByteArray name() const;
-    QList<QByteArray> aliases() const;
-    int mibEnum() const;
+    QByteArray name() const override;
+    QList<QByteArray> aliases() const override;
+    int mibEnum() const override;

 protected:
-    QString convertToUnicode(const char *in, int length, ConverterState *state) const;
-    QByteArray convertFromUnicode(const QChar *in, int length, ConverterState *state) const;
+    QString convertToUnicode(const char *in, int length, ConverterState *state) const override;
+    QByteArray convertFromUnicode(const QChar *in, int length, ConverterState *state) const override;
 };

 // Convert IBM850 character codes 0x00 - 0xFF into Unicode.
diff --git a/src/qgsmcodec.h b/src/qgsmcodec.h
index 8ecb6f9..b2347d5 100644
--- a/src/qgsmcodec.h
+++ b/src/qgsmcodec.h
@@ -27,10 +27,10 @@ class QGsmCodec : public QTextCodec
 {
 public:
     explicit QGsmCodec( bool noLoss=false );
-    ~QGsmCodec();
+    ~QGsmCodec() override;

-    QByteArray name() const;
-    int mibEnum() const;
+    QByteArray name() const override;
+    int mibEnum() const override;

     static char singleFromUnicode(QChar ch);
     static QChar singleToUnicode(char ch);
@@ -39,8 +39,8 @@ public:
     static QChar twoByteToUnicode(unsigned short ch);

 protected:
-    QString convertToUnicode(const char *in, int length, ConverterState *state) const;
-    QByteArray convertFromUnicode(const QChar *in, int length, ConverterState *state) const;
+    QString convertToUnicode(const char *in, int length, ConverterState *state) const override;
+    QByteArray convertFromUnicode(const QChar *in, int length, ConverterState *state) const override;

 private:
     bool noLoss;
diff --git a/src/qwsppdu.cpp b/src/qwsppdu.cpp
index ccb6869..f830a94 100644
--- a/src/qwsppdu.cpp
+++ b/src/qwsppdu.cpp
@@ -164,9 +164,9 @@ public:
                 EncodingVersion
     };

-    virtual QWspField decode(QWspPduDecoder &);
-    virtual bool encode(QWspPduEncoder&, const QWspField&);
-    virtual quint8 codePage() const { return 1; }
+    QWspField decode(QWspPduDecoder &) override;
+    bool encode(QWspPduEncoder&, const QWspField&) override;
+    quint8 codePage() const override { return 1; }

 private:
     int fieldFromNumber(quint8 id);
diff --git a/src/qwsppdu.h b/src/qwsppdu.h
index 91b3880..fac0176 100644
--- a/src/qwsppdu.h
+++ b/src/qwsppdu.h
@@ -129,7 +129,7 @@ class QWspPduDecoder : public QObject
     Q_OBJECT
 public:
     explicit QWspPduDecoder(QIODevice *);
-    ~QWspPduDecoder();
+    ~QWspPduDecoder() override;

     quint8 peekOctet();
     quint8 decodeOctet();
@@ -184,7 +184,7 @@ class QWspPduEncoder : public QObject
     Q_OBJECT
 public:
     explicit QWspPduEncoder(QIODevice *);
-    ~QWspPduEncoder();
+    ~QWspPduEncoder() override;

     void encodeOctet(quint8);
     void encodeUInt8(quint8);
diff --git a/src/simapplication.h b/src/simapplication.h
index c5c6501..5f427ed 100644
--- a/src/simapplication.h
+++ b/src/simapplication.h
@@ -33,7 +33,7 @@ class SimApplication : public QObject
     Q_OBJECT
 public:
     SimApplication( SimRules *rules, QObject *parent = nullptr );
-    ~SimApplication();
+    ~SimApplication() override;

     virtual bool envelope( const QSimEnvelope& env );
     virtual bool response( const QSimTerminalResponse& resp );
@@ -68,15 +68,15 @@ class DemoSimApplication : public SimApplication
     Q_OBJECT
 public:
     DemoSimApplication( SimRules *rules, QObject *parent = nullptr );
-    ~DemoSimApplication();
+    ~DemoSimApplication() override;

-    const QString getName();
+    const QString getName() override;

-    bool envelope( const QSimEnvelope& env );
+    bool envelope( const QSimEnvelope& env ) override;

 protected slots:
-    void mainMenu();
-    void mainMenuSelection( int id );
+    void mainMenu() override;
+    void mainMenuSelection( int id ) override;
     void sendSportsMenu();
     void sportsMenu( const QSimTerminalResponse& resp );
     void sendCallsMenu();
@@ -149,13 +149,13 @@ class ConformanceSimApplication : public SimApplication
     Q_OBJECT
 public:
     ConformanceSimApplication( SimRules *rules, QObject *parent = nullptr );
-    ~ConformanceSimApplication();
+    ~ConformanceSimApplication() override;

-    const QString getName();
+    const QString getName() override;

 protected slots:
-    void mainMenu();
-    void mainMenuSelection( int id );
+    void mainMenu() override;
+    void mainMenuSelection( int id ) override;
     void sendDisplayTextMenu();
     void DisplayTextMenu( const QSimTerminalResponse& resp );
     void DisplayTextNormalMenu( const QSimTerminalResponse& resp );
diff --git a/src/simauth.h b/src/simauth.h
index fb66593..5a4996d 100644
--- a/src/simauth.h
+++ b/src/simauth.h
@@ -34,7 +34,7 @@ class SimAuth : public QObject
     Q_OBJECT
 public:
     SimAuth( QObject *parent, SimXmlNode& n );
-    ~SimAuth();
+    ~SimAuth() override;

     void gsmAuthenticate( QString rand, QString &sres, QString &kc );
     enum UmtsStatus umtsAuthenticate( QString rand, QString autn,
diff --git a/src/simfilesystem.h b/src/simfilesystem.h
index 477c6c7..9988c82 100644
--- a/src/simfilesystem.h
+++ b/src/simfilesystem.h
@@ -58,7 +58,7 @@ class SimFileSystem : public QObject
     Q_OBJECT
 public:
     SimFileSystem( SimRules *rules, SimXmlNode& e, enum file_system_type type = FILE_SYSTEM_TYPE_DEFAULT );
-    ~SimFileSystem();
+    ~SimFileSystem() override;

     // Execute an AT+CRSM command against the filesystem.
     void crsm( const QString& args );
@@ -98,7 +98,7 @@ class SimFileItem : public QObject
 public:
     SimFileItem( const QString& fileid, SimFileItem *parentDir,
                  int access = 0, enum file_type type = FILE_TYPE_INVALID);
-    ~SimFileItem();
+    ~SimFileItem() override;

     QString fileid() const { return _fileid; }
     SimFileItem *parentDir() const { return _parentDir; }
--
2.24.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH phonesim 13/13] Use bool literals
  2019-11-12 21:37 Modernize phonesim codebase Jonah =?unknown-8bit?q?Br=C3=BCchert?=
                   ` (11 preceding siblings ...)
  2019-11-12 21:37 ` [PATCH phonesim 12/13] Annotate overriding functions with override Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-12 21:37 ` Jonah =?unknown-8bit?q?Br=C3=BCchert?=
  2019-11-18 21:24   ` Denis Kenzior
  12 siblings, 1 reply; 21+ messages in thread
From: Jonah =?unknown-8bit?q?Br=C3=BCchert?= @ 2019-11-12 21:37 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 539 bytes --]

Done using the modernize-use-bool-literals of clang-tidy
---
 src/qsmsmessage.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qsmsmessage.cpp b/src/qsmsmessage.cpp
index 1d0f733..06845bf 100644
--- a/src/qsmsmessage.cpp
+++ b/src/qsmsmessage.cpp
@@ -1565,7 +1565,7 @@ bool QPDUMessage::bit(int b)
     if ( needOctets(1) )
         return (mBuffer[mPosn] & (Unit << b));
     else
-        return 0;
+        return false;
 }

 unsigned char QPDUMessage::bits(int offset, int len)
--
2.24.0

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH phonesim 01/13] Use nullptrs
  2019-11-12 21:37 ` [PATCH phonesim 01/13] Use nullptrs Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-18 20:05   ` Denis Kenzior
  0 siblings, 0 replies; 21+ messages in thread
From: Denis Kenzior @ 2019-11-18 20:05 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1248 bytes --]

Hi Jonah,

On 11/12/19 3:37 PM, Jonah Brüchert wrote:
> Done using the modernize-use-nullptr check of clang-tidy
> ---
>   src/aidapplication.h              |  2 +-
>   src/callmanager.h                 |  2 +-
>   src/conformancesimapplication.cpp |  2 +-
>   src/control.cpp                   |  2 +-
>   src/control.h                     |  2 +-
>   src/gsmspec.cpp                   | 20 ++++++------
>   src/hardwaremanipulator.h         |  2 +-
>   src/main.cpp                      |  6 ++--
>   src/phonesim.cpp                  | 54 +++++++++++++++----------------
>   src/phonesim.h                    |  2 +-
>   src/qatresult.cpp                 |  2 +-
>   src/qatresultparser.cpp           |  8 ++---
>   src/qatutils.cpp                  | 12 +++----
>   src/qcbsmessage.cpp               |  2 +-
>   src/qsmsmessage.cpp               |  8 ++---
>   src/qsmsmessage_p.h               |  4 +--
>   src/qwsppdu.cpp                   |  4 +--
>   src/server.cpp                    |  4 +--
>   src/simapplication.cpp            | 22 ++++++-------
>   src/simapplication.h              |  6 ++--
>   20 files changed, 83 insertions(+), 83 deletions(-)
> 

Patches 1 & 2 applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH phonesim 03/13] Port old-style connects
  2019-11-12 21:37 ` [PATCH phonesim 03/13] Port old-style connects Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-18 20:06   ` Denis Kenzior
  0 siblings, 0 replies; 21+ messages in thread
From: Denis Kenzior @ 2019-11-18 20:06 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3991 bytes --]

Hi Jonah,

On 11/12/19 3:37 PM, Jonah Brüchert wrote:
> * Update CXX Standard to 14 to be able to use qOverload()
> ---
>   configure.ac        |  4 +--
>   src/callmanager.cpp | 22 ++++++-------
>   src/control.cpp     | 77 +++++++++++++++++++++------------------------
>   src/phonesim.cpp    | 56 +++++++++++++++++----------------
>   src/phonesim.h      |  3 +-
>   5 files changed, 80 insertions(+), 82 deletions(-)
> 

<snip>

> @@ -527,35 +528,36 @@ SimRules::SimRules(qintptr fd, QObject *p,  const QString& filename, HardwareMan
>           machine = hmf->create(this, nullptr);
> 
>       if (machine) {
> -        connect(machine, SIGNAL(unsolicitedCommand(QString)),
> -                this, SLOT(unsolicited(QString)));
> -        connect(machine, SIGNAL(command(QString)),
> -                this, SLOT(command(QString)));
> -        connect(machine, SIGNAL(variableChanged(QString,QString)),
> -                this, SLOT(setVariable(QString,QString)));
> -        connect(machine, SIGNAL(switchTo(QString)),
> -                this, SLOT(switchTo(QString)));
> +        connect(machine, &HardwareManipulator::unsolicitedCommand,
> +                this, &SimRules::unsolicited);
> +        connect(machine, &HardwareManipulator::command,
> +                this, &SimRules::command);
> +        connect(machine, &HardwareManipulator::variableChanged,
> +                this, &SimRules::setVariable);
> +        connect(machine, &HardwareManipulator::switchTo,
> +                this, &SimRules::switchTo);
>       }
> 
> +

I squashed this stray whitespace...

>       _callManager = new CallManager(this);
> -    connect( _callManager, SIGNAL(send(QString)),
> -             this, SLOT(respond(QString)) );
> -    connect( _callManager, SIGNAL(unsolicited(QString)),
> -             this, SLOT(unsolicited(QString)) );
> -    connect( _callManager, SIGNAL(dialCheck(QString,bool&)),
> -             this, SLOT(dialCheck(QString,bool&)) );
> +    connect( _callManager, &CallManager::send,
> +             this, qOverload<const QString &>( &SimRules::respond ) );
> +    connect( _callManager, &CallManager::unsolicited,
> +             this, &SimRules::unsolicited );
> +    connect( _callManager, &CallManager::dialCheck,
> +             this, &SimRules::dialCheck );
> 
>       if ( machine ) {
> -        connect( machine, SIGNAL(startIncomingCall(QString,QString,QString)),
> -                 _callManager, SLOT(startIncomingCall(QString,QString,QString)) );
> -        connect ( _callManager, SIGNAL( callStatesChanged( QList<CallInfo> * ) ),
> -                  machine, SLOT( callManagement( QList<CallInfo> * ) ) );
> -        connect ( machine, SIGNAL( stateChangedToAlerting() ), _callManager,
> -                SLOT( dialingToAlerting() ) );
> -        connect ( machine, SIGNAL( stateChangedToConnected() ), _callManager,
> -                SLOT( dialingToConnected() ) );
> -        connect ( machine, SIGNAL( stateChangedToHangup( int ) ), _callManager,
> -                SLOT( hangupRemote( int ) ) );
> +        connect( machine, &HardwareManipulator::startIncomingCall, _callManager,
> +                 qOverload<const QString &, const QString &, const QString &>( &CallManager::startIncomingCall ) );
> +        connect ( _callManager, &CallManager::callStatesChanged,
> +                  machine, &HardwareManipulator::callManagement);
> +        connect ( machine, &HardwareManipulator::stateChangedToAlerting, _callManager,
> +                &CallManager::dialingToAlerting );
> +        connect ( machine, &HardwareManipulator::stateChangedToConnected, _callManager,
> +                &CallManager::dialingToConnected );
> +        connect ( machine, &HardwareManipulator::stateChangedToHangup, _callManager,
> +                &CallManager::hangupRemote );
>       }
> 
>       connect(this,SIGNAL(readyRead()),

... and applied this patch.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH phonesim 04/13] Replace QtScript with QtQml
  2019-11-12 21:37 ` [PATCH phonesim 04/13] Replace QtScript with QtQml Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-18 20:47   ` Denis Kenzior
  0 siblings, 0 replies; 21+ messages in thread
From: Denis Kenzior @ 2019-11-18 20:47 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 282 bytes --]

Hi Jonah,

On 11/12/19 3:37 PM, Jonah Brüchert wrote:
> ---
>   configure.ac    |  2 +-
>   src/control.cpp | 18 +++++++++---------
>   src/control.h   |  4 ++--
>   3 files changed, 12 insertions(+), 12 deletions(-)
> 

Patches 4-9 applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH phonesim 10/13] Port from c-style casts to static_cast<>()
  2019-11-12 21:37 ` [PATCH phonesim 10/13] Port from c-style casts to static_cast<>() Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-18 21:13   ` Denis Kenzior
  0 siblings, 0 replies; 21+ messages in thread
From: Denis Kenzior @ 2019-11-18 21:13 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3478 bytes --]

Hi Jonah,

On 11/12/19 3:37 PM, Jonah Brüchert wrote:
> Done using the google-readability-casting check of clang-tidy
> ---
>   src/callmanager.cpp          |   6 +-
>   src/hardwaremanipulator.cpp  |  12 +-
>   src/phonesim.cpp             |  62 +++---
>   src/qatresult.cpp            |  10 +-
>   src/qatresultparser.cpp      |   6 +-
>   src/qatutils.cpp             | 116 +++++------
>   src/qcbsmessage.cpp          |   6 +-
>   src/qgsmcodec.cpp            |  54 ++---
>   src/qsimcommand.cpp          | 370 +++++++++++++++++------------------
>   src/qsimcontrolevent.cpp     |  16 +-
>   src/qsimenvelope.cpp         |  48 ++---
>   src/qsimterminalresponse.cpp |  98 +++++-----
>   src/qsmsmessage.cpp          | 208 ++++++++++----------
>   src/qsmsmessage_p.h          |   4 +-
>   src/qwsppdu.cpp              |  94 ++++-----
>   src/simapplication.cpp       |  68 +++----
>   src/simauth.cpp              |  12 +-
>   src/simfilesystem.cpp        |  24 +--
>   18 files changed, 605 insertions(+), 609 deletions(-)
> 

This patch is really way too long, and since it was seemingly done by 
machine, you probably need to check whether all the changes make sense 
first.  Just a few examples, picking at random:

> diff --git a/src/callmanager.cpp b/src/callmanager.cpp
> index 1fa13cf..5436e08 100644
> --- a/src/callmanager.cpp
> +++ b/src/callmanager.cpp
> @@ -203,8 +203,8 @@ bool CallManager::command( const QString& cmd )
>                   multiparty = 0;
>               QString line =
>                   "+CLCC: " + QString::number(info.id) + "," +
> -                QString::number((int)(info.incoming)) + "," +
> -                QString::number((int)(info.state)) + ",0," +
> +                QString::number(static_cast<int>(info.incoming)) + "," +
> +                QString::number(static_cast<int>(info.state)) + ",0," +

These casts are not needed at all due to implicit conversions

>                   QString::number(multiparty);
>               if ( !info.number.isEmpty() ) {
>                   line += ",";

<snip>

> @@ -2501,8 +2501,8 @@ void DemoSimApplication::BIPMenu( const QSimTerminalResponse& resp )
> 
>                   destAddress += 0x21;
>                   destAddress += 0x7F; /* local host 127.0.0.1 */
> -                destAddress += (char) 0x00;
> -                destAddress += (char) 0x00;
> +                destAddress += static_cast<char>(0x00);
> +                destAddress += static_cast<char>(0x00);

Why use a cast here but not lines above or below..

>                   destAddress += 0x01;
> 
>                   apn += 0x06;
> diff --git a/src/simauth.cpp b/src/simauth.cpp
> index 93b8826..b5fc7b1 100644
> --- a/src/simauth.cpp
> +++ b/src/simauth.cpp
> @@ -52,8 +52,8 @@ void SimAuth::gsmAuthenticate( QString rand, QString &sres,
> 
>       comp128( ki, _rand, _sres, _kc );
> 
> -    sres = QByteArray( (const char *)_sres, 4 ).toHex();
> -    kc = QByteArray( (const char *)_kc, 8 ).toHex();
> +    sres = QByteArray( reinterpret_cast<const char *>(_sres), 4 ).toHex();
> +    kc = QByteArray( reinterpret_cast<const char *>(_kc), 8 ).toHex();

This likely needs a toUtf8 or something instead of messing with casts.

>   }
> 

Perhaps you want to split it up a bit more so the parts that make sense 
can get merged, and the rest we can address piecemeal by removing the 
unnecessary casts.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH phonesim 11/13] Use dynamic_cast where appropriate
  2019-11-12 21:37 ` [PATCH phonesim 11/13] Use dynamic_cast where appropriate Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-18 21:24   ` Denis Kenzior
  0 siblings, 0 replies; 21+ messages in thread
From: Denis Kenzior @ 2019-11-18 21:24 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 312 bytes --]

Hi Jonah,

On 11/12/19 3:37 PM, Jonah Brüchert wrote:
> Done using the cppcoreguidelines-pro-type-cstyle-cast check of clang-tidy
> ---
>   src/aidapplication.cpp | 2 +-
>   src/phonesim.cpp       | 4 ++--
>   2 files changed, 3 insertions(+), 3 deletions(-)
> 

Applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH phonesim 13/13] Use bool literals
  2019-11-12 21:37 ` [PATCH phonesim 13/13] Use bool literals Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-18 21:24   ` Denis Kenzior
  0 siblings, 0 replies; 21+ messages in thread
From: Denis Kenzior @ 2019-11-18 21:24 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 252 bytes --]

Hi Jonah,

On 11/12/19 3:37 PM, Jonah Brüchert wrote:
> Done using the modernize-use-bool-literals of clang-tidy
> ---
>   src/qsmsmessage.cpp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 

Applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH phonesim 12/13] Annotate overriding functions with override
  2019-11-12 21:37 ` [PATCH phonesim 12/13] Annotate overriding functions with override Jonah =?unknown-8bit?q?Br=C3=BCchert?=
@ 2019-11-18 21:32   ` Denis Kenzior
  0 siblings, 0 replies; 21+ messages in thread
From: Denis Kenzior @ 2019-11-18 21:32 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1899 bytes --]

Hi Jonah,

On 11/12/19 3:37 PM, Jonah Brüchert wrote:
> * Allows us to notice when a function becomes source incompatible in a Qt major release,
>    and our implementation stops overriding.
> ---
>   src/aidapplication.cpp      |  3 ++-
>   src/aidapplication.h        |  4 ++--
>   src/callmanager.h           |  2 +-
>   src/control.h               | 18 +++++++--------
>   src/hardwaremanipulator.cpp |  1 +
>   src/phonesim.h              | 16 +++++++-------
>   src/qatutils.cpp            | 44 ++++++++++++++++++-------------------
>   src/qgsmcodec.h             | 10 ++++-----
>   src/qwsppdu.cpp             |  6 ++---
>   src/qwsppdu.h               |  4 ++--
>   src/simapplication.h        | 20 ++++++++---------
>   src/simauth.h               |  2 +-
>   src/simfilesystem.h         |  4 ++--
>   13 files changed, 68 insertions(+), 66 deletions(-)
> 
> diff --git a/src/aidapplication.cpp b/src/aidapplication.cpp
> index 807d7f9..395fe99 100644
> --- a/src/aidapplication.cpp
> +++ b/src/aidapplication.cpp
> @@ -190,7 +190,8 @@ bool AidAppWrapper::command( const QString& cmd )
> 
>               return true;
>           }
> -        break;
> +        // if CMD_TYPE_GSM_AUTH is the case, we already returned
> +        // and can't fallthrough, so no break here

This doesn't seem to belong in this patch, so I left it out.

>           case CMD_TYPE_UMTS_AUTH:
>           {
>               enum UmtsStatus status;

<snip>

> diff --git a/src/hardwaremanipulator.cpp b/src/hardwaremanipulator.cpp
> index ea895e7..63c498a 100644
> --- a/src/hardwaremanipulator.cpp
> +++ b/src/hardwaremanipulator.cpp
> @@ -363,4 +363,5 @@ void HardwareManipulator::simAppAbort()
> 
>   void HardwareManipulator::callManagement( QList<CallInfo> *info )
>   {
> +    Q_UNUSED(info)
>   }

Same here

Rest applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2019-11-18 21:32 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12 21:37 Modernize phonesim codebase Jonah =?unknown-8bit?q?Br=C3=BCchert?=
2019-11-12 21:37 ` [PATCH phonesim 01/13] Use nullptrs Jonah =?unknown-8bit?q?Br=C3=BCchert?=
2019-11-18 20:05   ` Denis Kenzior
2019-11-12 21:37 ` [PATCH phonesim 02/13] Replace deprecated headers Jonah =?unknown-8bit?q?Br=C3=BCchert?=
2019-11-12 21:37 ` [PATCH phonesim 03/13] Port old-style connects Jonah =?unknown-8bit?q?Br=C3=BCchert?=
2019-11-18 20:06   ` Denis Kenzior
2019-11-12 21:37 ` [PATCH phonesim 04/13] Replace QtScript with QtQml Jonah =?unknown-8bit?q?Br=C3=BCchert?=
2019-11-18 20:47   ` Denis Kenzior
2019-11-12 21:37 ` [PATCH phonesim 05/13] Port away from some deprecated Qt apis Jonah =?unknown-8bit?q?Br=C3=BCchert?=
2019-11-12 21:37 ` [PATCH phonesim 06/13] qwsppdu: Port to QLocale Jonah =?unknown-8bit?q?Br=C3=BCchert?=
2019-11-12 21:37 ` [PATCH phonesim 07/13] Port away from Q_FOREACH Jonah =?unknown-8bit?q?Br=C3=BCchert?=
2019-11-12 21:37 ` [PATCH phonesim 08/13] Port deprecations in controlbase.ui Jonah =?unknown-8bit?q?Br=C3=BCchert?=
2019-11-12 21:37 ` [PATCH phonesim 09/13] Require Qt5Widgets >= 5.10 Jonah =?unknown-8bit?q?Br=C3=BCchert?=
2019-11-12 21:37 ` [PATCH phonesim 10/13] Port from c-style casts to static_cast<>() Jonah =?unknown-8bit?q?Br=C3=BCchert?=
2019-11-18 21:13   ` Denis Kenzior
2019-11-12 21:37 ` [PATCH phonesim 11/13] Use dynamic_cast where appropriate Jonah =?unknown-8bit?q?Br=C3=BCchert?=
2019-11-18 21:24   ` Denis Kenzior
2019-11-12 21:37 ` [PATCH phonesim 12/13] Annotate overriding functions with override Jonah =?unknown-8bit?q?Br=C3=BCchert?=
2019-11-18 21:32   ` Denis Kenzior
2019-11-12 21:37 ` [PATCH phonesim 13/13] Use bool literals Jonah =?unknown-8bit?q?Br=C3=BCchert?=
2019-11-18 21:24   ` Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.