All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Match AT commands with exactMatch
@ 2021-09-08 13:23 Bettina Jennifer Riedl
  0 siblings, 0 replies; only message in thread
From: Bettina Jennifer Riedl @ 2021-09-08 13:23 UTC (permalink / raw)
  To: ofono

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

From d315cccd5404b6f26b31111f57b7f83063b0213b Mon Sep 17 00:00:00 2001
From: Bettina Riedl <bettina-jennifer.riedl@expleogroup.com>
Date: Fri, 3 Sep 2021 11:38:43 +0200
Subject: [PATCH] Match AT commands with exactMatch

Use QRegEx's exactMatch method instead of indexIn to prevent matching
only the front part of an AT command.
---
 src/phonesim.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/phonesim.cpp b/src/phonesim.cpp
index 89d5e9d..151ceca 100644
--- a/src/phonesim.cpp
+++ b/src/phonesim.cpp
@@ -313,8 +313,7 @@ bool SimChat::command( const QString& cmd )
     QString _ecommand = state()->rules()->expand(_command);
 
     if ( wildcard ) {
-        int
s=QRegExp(_ecommand,Qt::CaseSensitive,QRegExp::Wildcard).indexIn(cmd,0);
-        if (s==0) {
+        if
(QRegExp(_ecommand,Qt::CaseSensitive,QRegExp::Wildcard).exactMatch(cmd)) {
             int w=_ecommand.indexOf(QChar('*'));
             while(w <= 2 && w >= 0)
                 w=_ecommand.indexOf(QChar('*'),w+1);
-- 
2.25.1

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 6169 bytes --]

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-08 13:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08 13:23 [PATCH] Match AT commands with exactMatch Bettina Jennifer Riedl

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.