QCborValue: fix warning about shadowing members

qcborvalue.h:145:9: error: declaration of 'taggedValue' shadows a member of 'this' [-Werror=shadow]

Newer versions of GCC don't warn for variable shadowing a member
function.

Task-number: QTBUG-68889
Change-Id: I6efb28c3145047559ec0fffd153857b856267d6d
Reviewed-by: Liang Qi <liang.qi@qt.io>
This commit is contained in:
Thiago Macieira 2018-06-15 06:15:22 -07:00
parent c1345bda99
commit 467c112d12
3 changed files with 18 additions and 15 deletions

View File

@ -269,28 +269,28 @@ public:
const_iterator find(const QString & key) const { return constFind(key); } const_iterator find(const QString & key) const { return constFind(key); }
const_iterator find(const QCborValue &key) const { return constFind(key); } const_iterator find(const QCborValue &key) const { return constFind(key); }
iterator insert(qint64 key, const QCborValue &value) iterator insert(qint64 key, const QCborValue &value_)
{ {
QCborValueRef v = operator[](key); // detaches QCborValueRef v = operator[](key); // detaches
v = value; v = value_;
return { d.data(), v.i }; return { d.data(), v.i };
} }
iterator insert(QLatin1String key, const QCborValue &value) iterator insert(QLatin1String key, const QCborValue &value_)
{ {
QCborValueRef v = operator[](key); // detaches QCborValueRef v = operator[](key); // detaches
v = value; v = value_;
return { d.data(), v.i }; return { d.data(), v.i };
} }
iterator insert(const QString &key, const QCborValue &value) iterator insert(const QString &key, const QCborValue &value_)
{ {
QCborValueRef v = operator[](key); // detaches QCborValueRef v = operator[](key); // detaches
v = value; v = value_;
return { d.data(), v.i }; return { d.data(), v.i };
} }
iterator insert(const QCborValue &key, const QCborValue &value) iterator insert(const QCborValue &key, const QCborValue &value_)
{ {
QCborValueRef v = operator[](key); // detaches QCborValueRef v = operator[](key); // detaches
v = value; v = value_;
return { d.data(), v.i }; return { d.data(), v.i };
} }
iterator insert(value_type v) { return insert(v.first, v.second); } iterator insert(value_type v) { return insert(v.first, v.second); }

View File

@ -1832,17 +1832,20 @@ QCborValue::QCborValue(const QCborMap &m)
} }
/*! /*!
\fn QCborValue::QCborValue(QCborTag t, const QCborValue &tv)
\fn QCborValue::QCborValue(QCborKnownTags t, const QCborValue &tv)
Creates a QCborValue for the extended type represented by the tag value \a Creates a QCborValue for the extended type represented by the tag value \a
tag, tagging value \a tv. The tag can later be retrieved using tag() and t, tagging value \a tv. The tag can later be retrieved using tag() and
the tagged value using taggedValue(). the tagged value using taggedValue().
\sa isTag(), tag(), taggedValue(), QCborKnownTags \sa isTag(), tag(), taggedValue(), QCborKnownTags
*/ */
QCborValue::QCborValue(QCborTag tag, const QCborValue &tv) QCborValue::QCborValue(QCborTag t, const QCborValue &tv)
: n(-1), container(new QCborContainerPrivate), t(Tag) : n(-1), container(new QCborContainerPrivate), t(Tag)
{ {
container->ref.store(1); container->ref.store(1);
container->append(tag); container->append(t);
container->append(tv); container->append(tv);
} }

View File

@ -141,8 +141,8 @@ public:
QCborValue(const QCborArray &a); QCborValue(const QCborArray &a);
QCborValue(const QCborMap &m); QCborValue(const QCborMap &m);
QCborValue(QCborTag tag, const QCborValue &taggedValue = QCborValue()); QCborValue(QCborTag tag, const QCborValue &taggedValue = QCborValue());
QCborValue(QCborKnownTags tag, const QCborValue &taggedValue = QCborValue()) QCborValue(QCborKnownTags t_, const QCborValue &tv = QCborValue())
: QCborValue(QCborTag(tag), taggedValue) : QCborValue(QCborTag(t_), tv)
{} {}
explicit QCborValue(const QDateTime &dt); explicit QCborValue(const QDateTime &dt);
@ -342,8 +342,8 @@ public:
return type() == QCborValue::type_helper(st); return type() == QCborValue::type_helper(st);
} }
QCborTag tag(QCborTag tag = QCborTag(-1)) const QCborTag tag(QCborTag defaultValue = QCborTag(-1)) const
{ return concrete().tag(tag); } { return concrete().tag(defaultValue); }
QCborValue taggedValue(const QCborValue &defaultValue = QCborValue()) const QCborValue taggedValue(const QCborValue &defaultValue = QCborValue()) const
{ return concrete().taggedValue(defaultValue); } { return concrete().taggedValue(defaultValue); }