Commit 7e9060b1 authored by EXT Arnaud Clère's avatar EXT Arnaud Clère

Make sure isErrorFiltered is called in release as well

parent f0e64b1d
......@@ -199,9 +199,9 @@ protected:
bool tryBind ( bool&& b) { set(QCborValue( b )); return true; }
bool tryBind ( float&& d) { set(QCborValue(double(d))); return true; }
bool tryBind ( double&& d) { set(QCborValue( d )); return true; }
bool tryBind ( quint64&& n) { if (quint64(std::numeric_limits<qint64>::max())<n) { if (isErrorFiltered(qBindExpectedSmallerNumber)) { set(QCborValue(std::numeric_limits<qint64>::max())); return true; } return false; }
set(QCborValue(qint64(n))); return true; }
bool tryBind ( double&& d) { set(QCborValue( d )); return true; }
bool tryBind ( quint64&& n) { if (quint64(std::numeric_limits<qint64>::max())<n) { if (isErrorFiltered(qBindExpectedSmallerNumber)) { set(QCborValue(std::numeric_limits<qint64>::max())); return true; } return false; }
set(QCborValue(qint64(n))); return true; }
bool tryBind ( qint64&& n) { set(QCborValue( n )); return true; }
bool tryBind ( QByteArray&& s) { set(QCborValue( s )); return true; }
......@@ -329,10 +329,10 @@ protected:
bool tryBind ( double& n) { if (caching) { return caching->tryBind(n) && cacheOut(); }
return getNumber(n); }
bool tryBind ( float& n) { double d;
if (!tryBind(d)) { return false; }
if (d<double(std::numeric_limits<float>::min()) ) { Q_ASSERT(isErrorFiltered(qBindExpectedSmallerNumber)); n=std::numeric_limits<float>::min(); return true; } // using isErrorFiltered result to return false (allowing user to bind with a larger type) would require a cachedNumber like in JSON
if ( double(std::numeric_limits<float>::max())<d) { Q_ASSERT(isErrorFiltered(qBindExpectedSmallerNumber)); n=std::numeric_limits<float>::max(); return true; }
n=float(d); return true; }
if (!tryBind(d)) { return false; }
if (d<double(std::numeric_limits<float>::min()) ) { Q_VERIFY(isErrorFiltered(qBindExpectedSmallerNumber)); n=std::numeric_limits<float>::min(); return true; } // using isErrorFiltered result to return false (allowing user to bind with a larger type) would require a cachedNumber like in JSON
if ( double(std::numeric_limits<float>::max())<d) { Q_VERIFY(isErrorFiltered(qBindExpectedSmallerNumber)); n=std::numeric_limits<float>::max(); return true; }
n=float(d); return true; }
bool tryBind ( quint64& t) { if (caching) { return caching->tryBind(t) && cacheOut(); }
skipTag();
......@@ -340,11 +340,11 @@ protected:
t=toUnsignedInteger(); return true; }
bool tryBind ( qint64& t) { if (caching) { return caching->tryBind(t) && cacheOut(); }
quint64 i; bool neg;
if (!getInteger(i,neg)) { return false; }
if ( neg && quint64(std::numeric_limits<qint64>::max())+1<i) { Q_ASSERT(isErrorFiltered(qBindExpectedSmallerNumber)); t=std::numeric_limits<qint64>::min(); return true; } // using isErrorFiltered result to return false (allowing user to bind with a larger type) would require a cachedNumber like in JSON
if (!neg && quint64(std::numeric_limits<qint64>::max()) <i) { Q_ASSERT(isErrorFiltered(qBindExpectedSmallerNumber)); t=std::numeric_limits<qint64>::max(); return true; }
t = neg ? -qint64(i) : qint64(i); return true;
}
if (!getInteger(i,neg)) { return false; }
if ( neg && quint64(std::numeric_limits<qint64>::max())+1<i) { Q_VERIFY(isErrorFiltered(qBindExpectedSmallerNumber)); t=std::numeric_limits<qint64>::min(); return true; } // using isErrorFiltered result to return false (allowing user to bind with a larger type) would require a cachedNumber like in JSON
if (!neg && quint64(std::numeric_limits<qint64>::max()) <i) { Q_VERIFY(isErrorFiltered(qBindExpectedSmallerNumber)); t=std::numeric_limits<qint64>::max(); return true; }
t = neg ? -qint64(i) : qint64(i); return true;
}
bool tryItem( QIdentifierLiteral u) { if (caching) { return caching->tryItem(u); }
QIdentifier s;
......
......@@ -303,8 +303,8 @@ protected:
bool tryBind ( qint64& t) { if (caching) { return caching->tryBind(t) && cacheOut(); }
if (getNumber()==None) return false;
if (cachedNumber==FloatingPoint) { if (isErrorFiltered(qBindExpectedInteger)) { t=i; cachedNumber=None; return true; } return false; }
if (!neg && quint64( std::numeric_limits<qint64>::max())<i) { if (isErrorFiltered(qBindExpectedSmallerNumber)) { t=std::numeric_limits<qint64>::max(); cachedNumber=None; return true; } return false; }
if ( neg && quint64(-std::numeric_limits<qint64>::min())<i) { if (isErrorFiltered(qBindExpectedSmallerNumber)) { t=std::numeric_limits<qint64>::min(); cachedNumber=None; return true; } return false; }
if (!neg && quint64(std::numeric_limits<qint64>::max()) <i) { if (isErrorFiltered(qBindExpectedSmallerNumber)) { t=std::numeric_limits<qint64>::max(); cachedNumber=None; return true; } return false; }
if ( neg && quint64(std::numeric_limits<qint64>::max())+1<i) { if (isErrorFiltered(qBindExpectedSmallerNumber)) { t=std::numeric_limits<qint64>::min(); cachedNumber=None; return true; } return false; }
t = neg ? -qint64(i) : qint64(i); cachedNumber=None; return true; }
bool tryBind ( QVariant& dst) { if (caching) { return caching->tryBind(dst) && cacheOut(); }
{
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment