Review Request: Fix sanitization of dbus path in KMainWindow

Thomas L├╝bking thomas.luebking at web.de
Mon Aug 17 23:10:22 BST 2009


static inline bool isIdentifier(char c)
{  // the order btw is [a-zA-Z_0-9]
    return (c > 96 && c < 123) || (c > 64 && c < 91) ||
               c == '_' || (c > 47 && c < 58);
}

QByteArray ascii = o.objectName().toAscii();
const int n = ascii.length();
const char *data = ascii.data();
for (int i = 0; i <  n; ++i)
   qDebug() << isIdentifier(data[i]);

Am Monday 17 August 2009 schrieb Thiago Macieira:
> No need for QRegExp. Just iterate over the string and change the
> characters that aren't A-Z, a-z, 0-9 and underscore.




More information about the kde-core-devel mailing list