various cleanups

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2019-06-26 23:22:14 +00:00
parent e4fdd0d70b
commit 0bad599825
11 changed files with 54 additions and 36 deletions

View file

@ -3871,7 +3871,7 @@ template<class T> inline void do_mirror_data(QImageData *dst, QImageData *src,
int w, int h)
{
for (int srcY = 0, dstY = dstY0; srcY < h; ++srcY, dstY += dstYIncr) {
T *srcPtr = (T *) (src->data + srcY * src->bytes_per_line);
const T *srcPtr = (const T *) (src->data + srcY * src->bytes_per_line);
T *dstPtr = (T *) (dst->data + dstY * dst->bytes_per_line);
for (int srcX = 0, dstX = dstX0; srcX < w; ++srcX, dstX += dstXIncr)
dstPtr[dstX] = srcPtr[srcX];

View file

@ -586,7 +586,7 @@ bool QMYSQLResult::fetchFirst()
return fetch(0);
}
QVariant QMYSQLResult::data(int field)
QVariant QMYSQLResult::data(int field) const
{
if (!isSelect() || field >= d->fields.count()) {
@ -675,7 +675,7 @@ QVariant QMYSQLResult::data(int field)
return QVariant();
}
bool QMYSQLResult::isNull(int field)
bool QMYSQLResult::isNull(int field) const
{
if (d->preparedQuery)
return d->fields.at(field).nullIndicator;
@ -720,7 +720,7 @@ bool QMYSQLResult::reset (const QString& query)
return isActive();
}
int QMYSQLResult::size()
int QMYSQLResult::size() const
{
if (d->driver && isSelect())
if (d->preparedQuery)
@ -735,7 +735,7 @@ int QMYSQLResult::size()
return -1;
}
int QMYSQLResult::numRowsAffected()
int QMYSQLResult::numRowsAffected() const
{
return d->rowsAffected;
}

View file

@ -73,11 +73,11 @@ protected:
bool fetchNext();
bool fetchLast();
bool fetchFirst();
QVariant data(int field);
bool isNull(int field);
QVariant data(int field) const;
bool isNull(int field) const;
bool reset (const QString& query);
int size();
int numRowsAffected();
int size() const;
int numRowsAffected() const;
QVariant lastInsertId() const;
QSqlRecord record() const;
void virtual_hook(int id, void *data);

View file

@ -1088,7 +1088,7 @@ bool QODBCResult::fetchLast()
return true;
}
QVariant QODBCResult::data(int field)
QVariant QODBCResult::data(int field) const
{
if (field >= d->rInf.count() || field < 0) {
qWarning() << "QODBCResult::data: column" << field << "out of range";
@ -1188,7 +1188,7 @@ QVariant QODBCResult::data(int field)
return d->fieldCache[field];
}
bool QODBCResult::isNull(int field)
bool QODBCResult::isNull(int field) const
{
if (field < 0 || field > d->fieldCache.size())
return true;
@ -1201,12 +1201,12 @@ bool QODBCResult::isNull(int field)
return d->fieldCache.at(field).isNull();
}
int QODBCResult::size()
int QODBCResult::size() const
{
return -1;
}
int QODBCResult::numRowsAffected()
int QODBCResult::numRowsAffected() const
{
SQLLEN affectedRowCount = 0;
SQLRETURN r = SQLRowCount(d->hStmt, &affectedRowCount);

View file

@ -78,10 +78,10 @@ protected:
bool fetchPrevious();
bool fetch(int i);
bool reset (const QString& query);
QVariant data(int field);
bool isNull(int field);
int size();
int numRowsAffected();
QVariant data(int field) const;
bool isNull(int field) const;
int size() const;
int numRowsAffected() const;
QSqlRecord record() const;
void virtual_hook(int id, void *data);
bool nextResult();

View file

@ -456,12 +456,12 @@ bool QSQLiteResult::gotoNext(QSqlCachedResult::ValueCache& row, int idx)
return d->fetchNext(row, idx, false);
}
int QSQLiteResult::size()
int QSQLiteResult::size() const
{
return -1;
}
int QSQLiteResult::numRowsAffected()
int QSQLiteResult::numRowsAffected() const
{
return sqlite3_changes(d->access);
}

View file

@ -67,8 +67,8 @@ protected:
bool reset(const QString &query);
bool prepare(const QString &query);
bool exec();
int size();
int numRowsAffected();
int size() const;
int numRowsAffected() const;
QVariant lastInsertId() const;
QSqlRecord record() const;
void virtual_hook(int id, void *data);

View file

@ -84,15 +84,15 @@ public:
QAtomicInt ref;
QString nm;
uint ro: 1;
bool ro;
QVariant::Type type;
QSqlField::RequiredStatus req;
int len;
int prec;
QVariant def;
int tp;
uint gen: 1;
uint autoval: 1;
bool gen;
bool autoval;
};
@ -241,6 +241,8 @@ void QSqlField::setRequiredStatus(RequiredStatus required)
*/
void QSqlField::setLength(int fieldLength)
{
if (d->len == fieldLength)
return;
detach();
d->len = fieldLength;
}
@ -252,6 +254,8 @@ void QSqlField::setLength(int fieldLength)
*/
void QSqlField::setPrecision(int precision)
{
if (d->prec == precision)
return;
detach();
d->prec = precision;
}
@ -263,6 +267,8 @@ void QSqlField::setPrecision(int precision)
*/
void QSqlField::setDefaultValue(const QVariant &value)
{
if (d->def == value)
return;
detach();
d->def = value;
}
@ -272,6 +278,8 @@ void QSqlField::setDefaultValue(const QVariant &value)
*/
void QSqlField::setSqlType(int type)
{
if (d->tp = type)
return;
detach();
d->tp = type;
}
@ -286,6 +294,8 @@ void QSqlField::setSqlType(int type)
*/
void QSqlField::setGenerated(bool gen)
{
if (d->gen == gen)
return;
detach();
d->gen = gen;
}
@ -334,6 +344,8 @@ void QSqlField::clear()
void QSqlField::setName(const QString& name)
{
if (d->nm == name)
return;
detach();
d->nm = name;
}
@ -345,6 +357,8 @@ void QSqlField::setName(const QString& name)
*/
void QSqlField::setReadOnly(bool readOnly)
{
if (d->ro == readOnly)
return;
detach();
d->ro = readOnly;
}
@ -388,6 +402,8 @@ QVariant::Type QSqlField::type() const
*/
void QSqlField::setType(QVariant::Type type)
{
if (d->type == type)
return;
detach();
d->type = type;
if (!val.isValid())
@ -553,6 +569,8 @@ bool QSqlField::isAutoValue() const
*/
void QSqlField::setAutoValue(bool autoVal)
{
if (d->autoval == autoVal)
return;
detach();
d->autoval = autoVal;
}

View file

@ -59,14 +59,14 @@ public:
{ QSqlResult::setLastError(
QSqlError(QLatin1String("Driver not loaded"), QLatin1String("Driver not loaded"), QSqlError::ConnectionError)); }
protected:
inline QVariant data(int) { return QVariant(); }
inline QVariant data(int) const { return QVariant(); }
inline bool reset (const QString&) { return false; }
inline bool fetch(int) { return false; }
inline bool fetchFirst() { return false; }
inline bool fetchLast() { return false; }
inline bool isNull(int) { return false; }
inline int size() { return -1; }
inline int numRowsAffected() { return 0; }
inline bool isNull(int) const { return false; }
inline int size() const { return -1; }
inline int numRowsAffected() const { return 0; }
inline void setAt(int) {}
inline void setActive(bool) {}

View file

@ -317,7 +317,7 @@ bool QSqlResult::isValid() const
}
/*!
\fn bool QSqlResult::isNull(int index)
\fn bool QSqlResult::isNull(int index) const
Returns true if the field at position \a index in the current row
is null; otherwise returns false.
@ -421,7 +421,7 @@ QSqlError QSqlResult::lastError() const
}
/*!
\fn int QSqlResult::size()
\fn int QSqlResult::size() const
Returns the size of the \c SELECT result, or -1 if it cannot be
determined or if the query is not a \c SELECT statement.
@ -430,7 +430,7 @@ QSqlError QSqlResult::lastError() const
*/
/*!
\fn int QSqlResult::numRowsAffected()
\fn int QSqlResult::numRowsAffected() const
Returns the number of rows affected by the last query executed, or
-1 if it cannot be determined or if the query is a \c SELECT
@ -440,7 +440,7 @@ QSqlError QSqlResult::lastError() const
*/
/*!
\fn QVariant QSqlResult::data(int index)
\fn QVariant QSqlResult::data(int index) const
Returns the data for field \a index in the current row as
a QVariant. This function is only called if the result is in

View file

@ -104,16 +104,16 @@ protected:
BindingSyntax bindingSyntax() const;
virtual QVariant data(int i) = 0;
virtual bool isNull(int i) = 0;
virtual QVariant data(int i) const = 0;
virtual bool isNull(int i) const = 0;
virtual bool reset(const QString& sqlquery) = 0;
virtual bool fetch(int i) = 0;
virtual bool fetchNext();
virtual bool fetchPrevious();
virtual bool fetchFirst() = 0;
virtual bool fetchLast() = 0;
virtual int size() = 0;
virtual int numRowsAffected() = 0;
virtual int size() const = 0;
virtual int numRowsAffected() const = 0;
virtual QSqlRecord record() const;
virtual QVariant lastInsertId() const;