path: root/src/tools
diff options
authorMarc Mutz <>2012-02-22 16:17:30 +0100
committerQt by Nokia <>2012-02-26 09:14:11 +0100
commit8397a44bedf542b53284674c87268819f4911d31 (patch)
treecb3dd1025c99aaac9716d62a39ad3a6a5a17babf /src/tools
parentddf4b378f1e7eac62bd504a1e453cb7b894e21f2 (diff)
QByteArray: deprecate QT_NO_CAST_FROM_BYTEARRAY-protected operators
The QByteArray::operator const {char,void}*() implicit conversions are a source of subtle bugs, so they right- fully can be disabled with QT_NO_CAST_FROM_BYTEARRAY. const char *d = qstring.toLatin1(); // implicit conversion while ( d ) // oops: d points to freed memory // ... But almost no-one ever enabled this macros in the wild and many were bitten by these implicit conversions, so this patch deprecates them. I would have liked to remove them completely, but there are just too many occurrences even in Qt itself to hope to find all conditionally-compiled code that uses these. Also fixes all code that needs to compile under QT_NO_DEPRECATED (in qmake/, src/tools/). I984706452db7d0841620a0f64e179906123f3849 separately deals with the bulk of changes in src/ and examples/. Depends on I5ea1ad3c96d9e64167be53c0c418c7b7dba51f68. Change-Id: I8d47e6c293c80f61c6288c9f8d42fda41afe2267 Reviewed-by: David Faure <> Reviewed-by: Lars Knoll <>
Diffstat (limited to 'src/tools')
2 files changed, 3 insertions, 3 deletions
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp
index 5fbda35fc6..bfb3206778 100644
--- a/src/tools/rcc/rcc.cpp
+++ b/src/tools/rcc/rcc.cpp
@@ -681,7 +681,7 @@ bool RCCResourceLibrary::output(QIODevice &outDevice, QIODevice &errorDevice)
m_errorDevice->write("Could not write footer\n");
return false;
- outDevice.write(m_out, m_out.size());
+ outDevice.write(m_out.constData(), m_out.size());
return true;
diff --git a/src/tools/uic/cpp/cppwriteicondata.cpp b/src/tools/uic/cpp/cppwriteicondata.cpp
index 39ce52f4b3..082961cfe6 100644
--- a/src/tools/uic/cpp/cppwriteicondata.cpp
+++ b/src/tools/uic/cpp/cppwriteicondata.cpp
@@ -176,8 +176,8 @@ void WriteIconData::writeImage(QTextStream &output, const QString &indent,
void WriteIconData::writeImage(QIODevice &output, DomImage *image)
- QByteArray array = transformImageData(image->elementData()->text());
- output.write(array, array.size());
+ const QByteArray array = transformImageData(image->elementData()->text());
+ output.write(array.constData(), array.size());
} // namespace CPP