[PATCH phonesim 1/3] Fix compatibility with Qt6

Andres Salomon <[email protected]> Sat, 28 Feb 2026 04:15:57 -0500
Newsgroups dev.linux.lists.ofono
Message-ID <20260228041557.16eaa9d1@5400>
From: =?UTF-8?q?Jonah=20Br=C3=BCchert?= <[email protected]>

---
 src/control.cpp  |  6 +++---
 src/phonesim.cpp |  2 +-
 src/qwsppdu.cpp  | 12 ++++++------
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/control.cpp b/src/control.cpp
index 817a0b2..b06dbc1 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -337,7 +337,7 @@ void ControlWidget::sendSMSMessage()
         return;
     }
 
-    if (ui->leSMSServiceCenter->text().isEmpty() || ui->leSMSServiceCenter->text().contains(QRegExp("\\D"))) {
+    if (ui->leSMSServiceCenter->text().isEmpty() || ui->leSMSServiceCenter->text().contains(QRegularExpression(R"(\D)"))) {
         p->warning(tr("Invalid Service Center"),
                 tr("Service Center must not be empty and contain "
                    "only digits"));
@@ -386,14 +386,14 @@ void ControlWidget::selectFile()
 void ControlWidget::sendSMSDatagram()
 {
     QString dstPortStr = ui->leDstPort->text();
-    if ( dstPortStr.contains(QRegExp("\\D")) ) {
+    if ( dstPortStr.contains(QRegularExpression(R"(\D)")) ) {
         p->warning(tr("Invalid Port"), tr("Port number can contain only digits" ));
         return;
     }
     int dst = dstPortStr.toInt();
 
     QString srcPortStr = ui->leSrcPort->text();
-    if ( srcPortStr.contains(QRegExp("\\D")) ) {
+    if ( srcPortStr.contains(QRegularExpression(R"(\D)")) ) {
         p->warning(tr("Invalid Port"), tr("Port number can contain only digits" ));
         return;
     }
diff --git a/src/phonesim.cpp b/src/phonesim.cpp
index 89d5e9d..1b826ed 100644
--- a/src/phonesim.cpp
+++ b/src/phonesim.cpp
@@ -346,7 +346,7 @@ bool SimChat::command( const QString& cmd )
         else {
             int index = value.indexOf( "${*}" );
             if ( index != -1 ) {
-                if ( wild.length() > 0 && wild[wild.length() - 1] == 0x1A ) {
+                if ( wild.length() > 0 && wild[wild.length() - 1] == QChar(0x1A) ) {
                     // Strip the terminating ^Z from SMS PDU's.
                     wild = wild.left( wild.length() - 1 );
                 }
diff --git a/src/qwsppdu.cpp b/src/qwsppdu.cpp
index d636b5c..9798374 100644
--- a/src/qwsppdu.cpp
+++ b/src/qwsppdu.cpp
@@ -707,7 +707,7 @@ QString QWspPduDecoder::decodeTextString()
     if (o == '\"')
         o = decodeOctet();
     while (o != 0 && !dev->atEnd()) {
-        str += o;
+        str += QChar(o);
         o = decodeOctet();
     }
 
@@ -722,7 +722,7 @@ QString QWspPduDecoder::decodeTextBlock(int length)
 {
     QString result;
     for(int i = 0; i < length; ++i)
-        result += decodeOctet();
+        result += QChar(decodeOctet());
     return result;
 }
 
@@ -815,7 +815,7 @@ QString QWspPduDecoder::decodeContentType()
             // Extension-Media
             o = decodeOctet();
             while (o != 0) {
-                type += o;
+                type += QChar(o);
                 o = decodeOctet();
             }
         }
@@ -838,7 +838,7 @@ QString QWspPduDecoder::decodeContentType()
         // Constrained-encoding = Extension-Media
         o = decodeOctet();
         while (o != 0) {
-            type += o;
+            type += QChar(o);
             o = decodeOctet();
         }
     }
@@ -988,13 +988,13 @@ QString QWspPduDecoder::decodeParameter()
         p = decodeTokenText() + "=";
         octet = peekOctet();
         if (octet <= 31 || octet & 0x80) {
-            p += decodeInteger();
+            p += QChar(decodeInteger());
         } else {
             // Extension-Media
             p += '\"';
             octet = decodeOctet();
             while (octet != 0 && !dev->atEnd()) {
-                p += octet;
+                p += QChar(octet);
                 octet = decodeOctet();
             }
             p += '\"';
-- 
2.51.0