Commit 3f3176a9 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use capturedLength directly

parent 2c379a85
...@@ -52,7 +52,7 @@ bool DKIMAuthenticationStatusInfo::parseAuthenticationStatus(const QString &key, ...@@ -52,7 +52,7 @@ bool DKIMAuthenticationStatusInfo::parseAuthenticationStatus(const QString &key,
} else { } else {
mAuthVersion = 1; mAuthVersion = 1;
} }
valueKey = valueKey.right(valueKey.length() - (index + match.captured(0).length())); valueKey = valueKey.right(valueKey.length() - (index + match.capturedLength(0)));
//qDebug() << " match.captured(0)"<<match.captured(0)<<"match.captured(1)" <<match.captured(1) << match.captured(2); //qDebug() << " match.captured(0)"<<match.captured(0)<<"match.captured(1)" <<match.captured(1) << match.captured(2);
//qDebug() << " valueKey" << valueKey; //qDebug() << " valueKey" << valueKey;
} else { } else {
...@@ -107,7 +107,7 @@ DKIMAuthenticationStatusInfo::AuthStatusInfo DKIMAuthenticationStatusInfo::parse ...@@ -107,7 +107,7 @@ DKIMAuthenticationStatusInfo::AuthStatusInfo DKIMAuthenticationStatusInfo::parse
} }
authStatusInfo.result = match.captured(3); authStatusInfo.result = match.captured(3);
valueKey = valueKey.right(valueKey.length() - (index + match.captured(0).length())); // Improve it! valueKey = valueKey.right(valueKey.length() - (index + match.capturedLength(0))); // Improve it!
// 3) extract reasonspec (optional) // 3) extract reasonspec (optional)
const QString reasonspec_p = DKIMAuthenticationStatusInfoUtil::regexMatchO(QLatin1String("reason") + DKIMAuthenticationStatusInfoUtil::cfws_op() + QLatin1Char('=') + DKIMAuthenticationStatusInfoUtil::cfws_op() + DKIMAuthenticationStatusInfoUtil::value_cp()); const QString reasonspec_p = DKIMAuthenticationStatusInfoUtil::regexMatchO(QLatin1String("reason") + DKIMAuthenticationStatusInfoUtil::cfws_op() + QLatin1Char('=') + DKIMAuthenticationStatusInfoUtil::cfws_op() + DKIMAuthenticationStatusInfoUtil::value_cp());
...@@ -115,7 +115,7 @@ DKIMAuthenticationStatusInfo::AuthStatusInfo DKIMAuthenticationStatusInfo::parse ...@@ -115,7 +115,7 @@ DKIMAuthenticationStatusInfo::AuthStatusInfo DKIMAuthenticationStatusInfo::parse
if (index != -1) { if (index != -1) {
//qDebug() << " reason " << match.capturedTexts(); //qDebug() << " reason " << match.capturedTexts();
authStatusInfo.reason = match.captured(2); authStatusInfo.reason = match.captured(2);
valueKey = valueKey.right(valueKey.length() - (index + match.captured(0).length())); // Improve it! valueKey = valueKey.right(valueKey.length() - (index + match.capturedLength(0))); // Improve it!
} }
// 4) extract propspec (optional) // 4) extract propspec (optional)
QString pvalue_p = DKIMAuthenticationStatusInfoUtil::value_p() + QLatin1String("|(?:(?:") + DKIMAuthenticationStatusInfoUtil::localPart_p() + QLatin1String("?@)?") + DKIMAuthenticationStatusInfoUtil::domainName_p() + QLatin1Char(')'); QString pvalue_p = DKIMAuthenticationStatusInfoUtil::value_p() + QLatin1String("|(?:(?:") + DKIMAuthenticationStatusInfoUtil::localPart_p() + QLatin1String("?@)?") + DKIMAuthenticationStatusInfoUtil::domainName_p() + QLatin1Char(')');
...@@ -140,7 +140,7 @@ DKIMAuthenticationStatusInfo::AuthStatusInfo DKIMAuthenticationStatusInfo::parse ...@@ -140,7 +140,7 @@ DKIMAuthenticationStatusInfo::AuthStatusInfo DKIMAuthenticationStatusInfo::parse
index = valueKey.indexOf(reg, 0, &match); index = valueKey.indexOf(reg, 0, &match);
while (index != -1) { while (index != -1) {
//qDebug() << " propspec " << match.capturedTexts(); //qDebug() << " propspec " << match.capturedTexts();
valueKey = valueKey.right(valueKey.length() - (index + match.captured(0).length())); // Improve it! valueKey = valueKey.right(valueKey.length() - (index + match.capturedLength(0))); // Improve it!
//qDebug() << " value KEy " << valueKey; //qDebug() << " value KEy " << valueKey;
const QString &captured1 = match.captured(1); const QString &captured1 = match.captured(1);
//qDebug() << " captured1 " << captured1; //qDebug() << " captured1 " << captured1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment