[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Review Request: Fix sanitization of dbus path in KMainWindow
From:       Thomas =?iso-8859-15?q?L=FCbking?= <thomas.luebking () web ! de>
Date:       2009-08-17 22:10:22
Message-ID: 200908180010.22838.thomas.luebking () web ! de
[Download RAW message or body]

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.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic