Found with GCC's -Wcast-qual.
Change-Id: Ia0aac2f09e9245339951ffff13c958364a2e9859
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
void QAbstractAnimationJob::debugAnimation(QDebug d) const
{
- d << "AbstractAnimationJob(" << hex << (void *) this << dec << ") state:"
+ d << "AbstractAnimationJob(" << hex << (const void *) this << dec << ") state:"
<< m_state << "duration:" << duration();
}
void QContinuingAnimationGroupJob::debugAnimation(QDebug d) const
{
- d << "ContinuingAnimationGroupJob(" << hex << (void *) this << dec << ")";
+ d << "ContinuingAnimationGroupJob(" << hex << (const void *) this << dec << ")";
debugChildren(d);
}
void QParallelAnimationGroupJob::debugAnimation(QDebug d) const
{
- d << "ParallelAnimationGroupJob(" << hex << (void *) this << dec << ")";
+ d << "ParallelAnimationGroupJob(" << hex << (const void *) this << dec << ")";
debugChildren(d);
}
void QPauseAnimationJob::debugAnimation(QDebug d) const
{
- d << "PauseAnimationJob(" << hex << (void *) this << dec << ")" << "duration:" << m_duration;
+ d << "PauseAnimationJob(" << hex << (const void *) this << dec << ")" << "duration:" << m_duration;
}
QT_END_NAMESPACE
void QSequentialAnimationGroupJob::debugAnimation(QDebug d) const
{
- d << "SequentialAnimationGroupJob(" << hex << (void *) this << dec << ")" << "currentAnimation:" << (void *)m_currentAnimation;
+ d << "SequentialAnimationGroupJob(" << hex << (const void *) this << dec << ")" << "currentAnimation:" << (void *)m_currentAnimation;
debugChildren(d);
}
QV4::Scope scope(this);
if (type == qMetaTypeId<QQmlListReference>()) {
typedef QQmlListReferencePrivate QDLRP;
- QDLRP *p = QDLRP::get((QQmlListReference*)ptr);
+ QDLRP *p = QDLRP::get((QQmlListReference*)const_cast<void *>(ptr));
if (p->object) {
return QV4::QmlListWrapper::create(scope.engine, p->property, p->propertyType);
} else {
} else if (type == qMetaTypeId<QList<QObject *> >()) {
// XXX Can this be made more by using Array as a prototype and implementing
// directly against QList<QObject*>?
- const QList<QObject *> &list = *(QList<QObject *>*)ptr;
+ const QList<QObject *> &list = *(const QList<QObject *>*)ptr;
QV4::ScopedArrayObject a(scope, newArrayObject());
a->arrayReserve(list.count());
QV4::ScopedValue v(scope);
static inline quint32 popUint32(const char *&data)
{
- quint32 rv = *((quint32 *)data);
+ quint32 rv = *((const quint32 *)data);
data += sizeof(quint32);
return rv;
}
static inline double popDouble(const char *&data)
{
- double rv = *((double *)data);
+ double rv = *((const double *)data);
data += sizeof(double);
return rv;
}
static inline void *popPtr(const char *&data)
{
- void *rv = *((void **)data);
+ void *rv = *((void *const *)data);
data += sizeof(void *);
return rv;
}
case WorkerString:
{
quint32 size = headersize(header);
- QString qstr((QChar *)data, size);
+ QString qstr((const QChar *)data, size);
data += ALIGN(size * sizeof(quint16));
return QV4::Encode(engine->newString(qstr));
}
{
quint32 flags = headersize(header);
quint32 length = popUint32(data);
- QString pattern = QString((QChar *)data, length - 1);
+ QString pattern = QString((const QChar *)data, length - 1);
data += ALIGN(length * sizeof(quint16));
return Encode(engine->newRegExpObject(pattern, flags));
}
ReturnedValue Int16ArrayRead(const char *data, int index)
{
- return Encode((int)*(short *)(data + index));
+ return Encode((int)*(const short *)(data + index));
}
void Int16ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value)
ReturnedValue UInt16ArrayRead(const char *data, int index)
{
- return Encode((int)*(unsigned short *)(data + index));
+ return Encode((int)*(const unsigned short *)(data + index));
}
void UInt16ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value)
ReturnedValue Int32ArrayRead(const char *data, int index)
{
- return Encode(*(int *)(data + index));
+ return Encode(*(const int *)(data + index));
}
void Int32ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value)
ReturnedValue UInt32ArrayRead(const char *data, int index)
{
- return Encode(*(unsigned int *)(data + index));
+ return Encode(*(const unsigned int *)(data + index));
}
void UInt32ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value)
ReturnedValue Float32ArrayRead(const char *data, int index)
{
- return Encode(*(float *)(data + index));
+ return Encode(*(const float *)(data + index));
}
void Float32ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value)
ReturnedValue Float64ArrayRead(const char *data, int index)
{
- return Encode(*(double *)(data + index));
+ return Encode(*(const double *)(data + index));
}
void Float64ArrayWrite(ExecutionEngine *e, char *data, int index, const Value &value)
MOTH_END_INSTR(CallGlobalLookup)
MOTH_BEGIN_INSTR(SetExceptionHandler)
- exceptionHandler = instr.offset ? ((uchar *)&instr.offset) + instr.offset : 0;
+ exceptionHandler = instr.offset ? ((const uchar *)&instr.offset) + instr.offset : 0;
MOTH_END_INSTR(SetExceptionHandler)
MOTH_BEGIN_INSTR(CallBuiltinThrow)
MOTH_END_INSTR(ConstructGlobalLookup)
MOTH_BEGIN_INSTR(Jump)
- code = ((uchar *)&instr.offset) + instr.offset;
+ code = ((const uchar *)&instr.offset) + instr.offset;
MOTH_END_INSTR(Jump)
MOTH_BEGIN_INSTR(JumpEq)
bool cond = VALUEPTR(instr.condition)->toBoolean();
TRACE(condition, "%s", cond ? "TRUE" : "FALSE");
if (cond)
- code = ((uchar *)&instr.offset) + instr.offset;
+ code = ((const uchar *)&instr.offset) + instr.offset;
MOTH_END_INSTR(JumpEq)
MOTH_BEGIN_INSTR(JumpNe)
bool cond = VALUEPTR(instr.condition)->toBoolean();
TRACE(condition, "%s", cond ? "TRUE" : "FALSE");
if (!cond)
- code = ((uchar *)&instr.offset) + instr.offset;
+ code = ((const uchar *)&instr.offset) + instr.offset;
MOTH_END_INSTR(JumpNe)
MOTH_BEGIN_INSTR(UNot)
rv.bits = max;
rv.ownData = new quint32[length + 1];
*(rv.ownData) = 1;
- rv.data = rv.ownData + 1;
+ quint32 *rvdata;
+ rv.data = rvdata = rv.ownData + 1;
if (bits > o.bits) {
- ::memcpy((quint32 *)rv.data, data, length * sizeof(quint32));
+ ::memcpy(rvdata, data, length * sizeof(quint32));
for (quint32 ii = 0; ii < (o.bits + quint32(31)) / 32; ++ii)
- ((quint32 *)rv.data)[ii] |= o.data[ii];
+ (rvdata)[ii] |= o.data[ii];
} else {
- ::memcpy((quint32 *)rv.data, o.data, length * sizeof(quint32));
+ ::memcpy(rvdata, o.data, length * sizeof(quint32));
for (quint32 ii = 0; ii < (bits + quint32(31)) / 32; ++ii)
- ((quint32 *)rv.data)[ii] |= data[ii];
+ (rvdata)[ii] |= data[ii];
}
return rv;
}
inline bool equals(const QHashedStringRef &string) const {
return length == string.length() &&
hash == string.hash() &&
- (isQString()?QHashedString::compare(string.constData(), (QChar *)utf16Data(), length):
+ (isQString()?QHashedString::compare(string.constData(), (const QChar *)utf16Data(), length):
QHashedString::compare(string.constData(), cStrData(), length));
}
inline bool equals(const QHashedCStringRef &string) const {
return length == string.length() &&
hash == string.hash() &&
- (isQString()?QHashedString::compare((QChar *)utf16Data(), string.constData(), length):
+ (isQString()?QHashedString::compare((const QChar *)utf16Data(), string.constData(), length):
QHashedString::compare(string.constData(), cStrData(), length));
}
};
if (publicContext) {
QQmlContextPrivate *p = QQmlContextPrivate::get(publicContext);
for (int ii = 0; ii < p->propertyValues.count(); ++ii)
- if (p->propertyValues.at(ii) == QVariant::fromValue((QObject *)obj))
+ if (p->propertyValues.at(ii) == QVariant::fromValue(const_cast<QObject *>(obj)))
return properties.findId(ii);
}
int t = v.userType();
if (t == QMetaType::QObjectStar || m_compositeTypes.contains(t)) {
if (ok) *ok = true;
- return *(QObject **)(v.constData());
+ return *(QObject *const *)(v.constData());
} else {
return QQmlMetaType::toQObject(v, ok);
}
if (ok) *ok = true;
- return *(QObject **)v.constData();
+ return *(QObject *const *)v.constData();
}
bool QQmlMetaType::isQObject(int userType)
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, argv);
} else if (variantType == propertyType) {
- void *a[] = { (void *)value.constData(), 0, &status, &flags };
+ void *a[] = { const_cast<void *>(value.constData()), 0, &status, &flags };
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
} else if (qMetaTypeId<QVariant>() == propertyType) {
- void *a[] = { (void *)&value, 0, &status, &flags };
+ void *a[] = { const_cast<QVariant *>(&value), 0, &status, &flags };
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
} else if (property.isQObject()) {
if (valMo.isNull())
return false;
- QObject *o = *(QObject **)value.constData();
+ QObject *o = *(QObject *const *)value.constData();
QQmlMetaObject propMo = rawMetaObjectForType(enginePriv, propertyType);
if (o) valMo = o;
}
if (ok) {
- void *a[] = { (void *)v.constData(), 0, &status, &flags};
+ void *a[] = { const_cast<void *>(v.constData()), 0, &status, &flags};
QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a);
} else {
return false;
const char *propertyType = 0;
if (value.userType() == QMetaType::QObjectStar) {
- if (QObject *o = *(QObject **)value.constData()) {
+ if (QObject *o = *(QObject *const *)value.constData()) {
valueType = o->metaObject()->className();
QQmlMetaObject propertyMetaObject = rawMetaObjectForType(QQmlEnginePrivate::get(engine), type);
stringCache.clear();
if (_parent) _parent->release();
- if (_ownMetaObject) free((void *)_metaObject);
+ if (_ownMetaObject) free(const_cast<QMetaObject *>(_metaObject));
_metaObject = 0;
_parent = 0;
engine = 0;
QObjectPrivate *op = QObjectPrivate::get(this);
Q_ASSERT(op->metaObject == this);
op->metaObject = 0;
- ::free((void*)_metaObject);
+ ::free(const_cast<QMetaObject *>(_metaObject));
metaType.destroy(gadgetPtr);
}
int listIndex = data[id].asInt();
const List *list = &listProperties.at(listIndex);
*reinterpret_cast<QQmlListProperty<QObject> *>(a[0]) =
- QQmlListProperty<QObject>(object, (void *)list,
+ QQmlListProperty<QObject>(object, const_cast<List *>(list),
list_append, list_count, list_at,
list_clear);
}
} else {
bool needActivate = false;
if (value.userType() == QMetaType::QObjectStar) {
- QObject *o = *(QObject **)value.data();
+ QObject *o = *(QObject *const *)value.data();
needActivate = (data[id].dataType() != QMetaType::QObjectStar || data[id].asQObject() != o);
data[id].setValue(o, this, id);
} else {
};
PropertyData *propertyData() const {
- return (PropertyData *)(((const char *)this) + sizeof(QQmlVMEMetaData));
+ return (PropertyData *)(((char *)const_cast<QQmlVMEMetaData *>(this)) + sizeof(QQmlVMEMetaData));
}
AliasData *aliasData() const {
case VariantList:
return qvariant_cast<QVariantList>(d).count();
case ListProperty:
- return ((QQmlListReference *)d.constData())->count();
+ return ((const QQmlListReference *)d.constData())->count();
case Instance:
return 1;
case Integer:
case VariantList:
return qvariant_cast<QVariantList>(d).at(idx);
case ListProperty:
- return QVariant::fromValue(((QQmlListReference *)d.constData())->at(idx));
+ return QVariant::fromValue(((const QQmlListReference *)d.constData())->at(idx));
case Instance:
return d;
case Integer: