OSDN Git Service

use proper type for argument in QVariant::f_convert function prototype
authorIvailo Monev <xakepa10@gmail.com>
Tue, 26 Jan 2021 14:33:01 +0000 (16:33 +0200)
committerIvailo Monev <xakepa10@gmail.com>
Tue, 26 Jan 2021 14:33:01 +0000 (16:33 +0200)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/core/kernel/qvariant.cpp
src/core/kernel/qvariant.h
src/gui/kernel/qguivariant.cpp

index c48aea8..76a87b6 100644 (file)
@@ -656,16 +656,16 @@ static qulonglong qConvertToUnsignedNumber(const QVariant::Private *d, bool *ok)
 
  Converts \a d to type \a t, which is placed in \a result.
  */
-static bool convert(const QVariant::Private *d, QVariant::Type t, void *result, bool *ok)
+static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
 {
-    Q_ASSERT(d->type != int(t));
+    Q_ASSERT(d->type != t);
     Q_ASSERT(result);
 
     bool dummy;
     if (!ok)
         ok = &dummy;
 
-    switch (int(t)) {
+    switch (t) {
 #ifndef QT_BOOTSTRAPPED
     case QVariant::Url:
         switch (d->type) {
@@ -2513,7 +2513,7 @@ inline T qNumVariantToHelper(const QVariant::Private &d,
         return val;
 
     T ret;
-    if (!handler->convert(&d, QVariant::Type(t), &ret, ok) && ok)
+    if (!handler->convert(&d, t, &ret, ok) && ok)
         *ok = false;
     return ret;
 }
index 6c38ab0..49bfc75 100644 (file)
@@ -345,7 +345,7 @@ class Q_CORE_EXPORT QVariant
     typedef void (*f_save)(const Private *, QDataStream &);
 #endif
     typedef bool (*f_compare)(const Private *, const Private *);
-    typedef bool (*f_convert)(const QVariant::Private *d, Type t, void *, bool *);
+    typedef bool (*f_convert)(const QVariant::Private *d, int t, void *, bool *);
     typedef void (*f_debugStream)(QDebug, const QVariant &);
     struct Handler {
         f_construct construct;
index 1160dc0..9f4a8c3 100644 (file)
@@ -386,7 +386,7 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b)
     return qcoreVariantHandler()->compare(a, b);
 }
 
-static bool convert(const QVariant::Private *d, QVariant::Type t,
+static bool convert(const QVariant::Private *d, int t,
                  void *result, bool *ok)
 {
     switch (t) {