diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2014-10-30 22:30:01 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-10-31 15:42:42 +0100 |
commit | 0704d2be63b484cb579c1507223db3f914b1338a (patch) | |
tree | 66d4e616545d7f576125e85cc108c7e2988cecdd /src/qml/jsruntime/qv4identifier_p.h | |
parent | e67948823d6810c2de784859da52a261bf80b550 (diff) |
Get rid of !this and similar constructs
The C++ standard doesn't allow calling member functions
on a mull object. Fix all such places, by moving the checks
to the caller where required.
Change-Id: I10fb22acaf0324d8ffd3a6d8e19152e5d32f56bb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4identifier_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4identifier_p.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/qml/jsruntime/qv4identifier_p.h b/src/qml/jsruntime/qv4identifier_p.h index 9ca6714b90..afed5c646f 100644 --- a/src/qml/jsruntime/qv4identifier_p.h +++ b/src/qml/jsruntime/qv4identifier_p.h @@ -56,9 +56,9 @@ struct IdentifierHashEntry { int value; void *pointer; }; - int get(int *) const { return this ? value : -1; } - bool get(bool *) const { return this != 0; } - void *get(void **) const { return this ? pointer : 0; } + static int get(const IdentifierHashEntry *This, int *) { return This ? This->value : -1; } + static bool get(const IdentifierHashEntry *This, bool *) { return This != 0; } + static void *get(const IdentifierHashEntry *This, void **) { return This ? This->pointer : 0; } }; struct IdentifierHashData @@ -181,13 +181,13 @@ void IdentifierHash<T>::add(const QString &str, const T &value) template<typename T> inline T IdentifierHash<T>::value(const QString &str) const { - return lookup(str)->get((T*)0); + return IdentifierHashEntry::get(lookup(str), (T*)0); } template<typename T> inline T IdentifierHash<T>::value(String *str) const { - return lookup(str)->get((T*)0); + return IdentifierHashEntry::get(lookup(str), (T*)0); } @@ -197,7 +197,7 @@ QString IdentifierHash<T>::findId(T value) const IdentifierHashEntry *e = d->entries; IdentifierHashEntry *end = e + d->alloc; while (e < end) { - if (e->identifier && e->get((T*)0) == value) + if (e->identifier && IdentifierHashEntry::get(e, (T*)0) == value) return e->identifier->string; ++e; } |