Parse a hex-or-decimal handle/token string (e.g. "0x12345678" or "305419896") into a quint32. Returns 0 on failure.
| 11 | // Parse a hex-or-decimal handle/token string (e.g. "0x12345678" or "305419896") |
| 12 | // into a quint32. Returns 0 on failure. |
| 13 | inline quint32 parseStatusHandle(QString text) |
| 14 | { |
| 15 | text = text.trimmed(); |
| 16 | bool ok = false; |
| 17 | quint32 value = text.toUInt(&ok, 0); |
| 18 | if (ok) |
| 19 | return value; |
| 20 | |
| 21 | if (text.startsWith(QStringLiteral("0x"), Qt::CaseInsensitive)) |
| 22 | text = text.mid(2); |
| 23 | value = text.toUInt(&ok, 16); |
| 24 | return ok ? value : 0; |
| 25 | } |
| 26 | |
| 27 | // Return true if a stream-status key-value map either omits client_handle |
| 28 | // (legacy firmware) or explicitly matches our own handle. Current firmware can |
no outgoing calls
no test coverage detected