summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-02 17:01:13 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-02 17:01:13 (GMT)
commit20cfe1e790295254370cf472df39813f864de7ea (patch)
tree98ac008f7c468ed37a61c051870810db2bbf2360 /examples
parent83e497fdae56e11c79d913cdc665e78615291e9c (diff)
parent2ed925753cb194970712330edca4da8e91fa8f28 (diff)
downloadQt-20cfe1e790295254370cf472df39813f864de7ea.zip
Qt-20cfe1e790295254370cf472df39813f864de7ea.tar.gz
Qt-20cfe1e790295254370cf472df39813f864de7ea.tar.bz2
Merge remote branch 'mainline/4.6' into 4.6
Diffstat (limited to 'examples')
-rw-r--r--examples/script/customclass/bytearrayclass.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/examples/script/customclass/bytearrayclass.cpp b/examples/script/customclass/bytearrayclass.cpp
index 7291b97..bce69e4 100644
--- a/examples/script/customclass/bytearrayclass.cpp
+++ b/examples/script/customclass/bytearrayclass.cpp
@@ -72,18 +72,6 @@ private:
int m_last;
};
-static qint32 toArrayIndex(const QString &str)
-{
- QByteArray bytes = str.toUtf8();
- char *eptr;
- quint32 pos = strtoul(bytes.constData(), &eptr, 10);
- if ((eptr == bytes.constData() + bytes.size())
- && (QByteArray::number(pos) == bytes)) {
- return pos;
- }
- return -1;
-}
-
//! [0]
ByteArrayClass::ByteArrayClass(QScriptEngine *engine)
: QObject(engine), QScriptClass(engine)
@@ -120,8 +108,9 @@ QScriptClass::QueryFlags ByteArrayClass::queryProperty(const QScriptValue &objec
if (name == length) {
return flags;
} else {
- qint32 pos = toArrayIndex(name);
- if (pos == -1)
+ bool isArrayIndex;
+ qint32 pos = name.toArrayIndex(&isArrayIndex);
+ if (!isArrayIndex)
return 0;
*id = pos;
if ((flags & HandlesReadAccess) && (pos >= ba->size()))