summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-12-08 08:20:36 +0100
committerLiang Qi <liang.qi@qt.io>2016-12-08 08:20:36 +0100
commitcae32bd04d117ba2423a8c4db12f8d2d5b809bcb (patch)
tree179cc91b4b34b9e7ec587d576e42d89fc13fec43 /src
parente1a70ce495928e8d81e80b11d7dbd4c4913ee438 (diff)
parent04f68053df5c90dca6947c6d2a5bb4e6851e62bb (diff)
downloadqtbase-cae32bd04d117ba2423a8c4db12f8d2d5b809bcb.tar.gz
Merge remote-tracking branch 'origin/5.7' into 5.8.0
Change-Id: I576187a9905802c177ae483e6c29d0f55cf7034d
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qlogging.cpp4
-rw-r--r--src/corelib/kernel/qmetatype.h5
-rw-r--r--src/gui/image/qbmphandler_p.h14
-rw-r--r--src/gui/image/qpnghandler_p.h14
-rw-r--r--src/gui/image/qppmhandler_p.h14
-rw-r--r--src/gui/image/qxbmhandler_p.h14
-rw-r--r--src/gui/image/qxpmhandler_p.h14
-rw-r--r--src/gui/opengl/qopenglpaintdevice.h6
-rw-r--r--src/gui/painting/qemulationpaintengine_p.h48
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h2
-rw-r--r--src/gui/painting/qpdfwriter.h12
-rw-r--r--src/gui/painting/qstroker_p.h8
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp1
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.cpp31
14 files changed, 99 insertions, 88 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index f344873276..6984097b70 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -1041,6 +1041,10 @@ void QMessagePattern::setPattern(const QString &pattern)
delete [] literals;
}
delete [] tokens;
+ timeArgs.clear();
+#ifdef QLOGGING_HAVE_BACKTRACE
+ backtraceArgs.clear();
+#endif
// scanner
QList<QString> lexemes;
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index e64812b3ae..7b0a9f986b 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -1389,10 +1389,6 @@ namespace QtPrivate
};
-QT_WARNING_PUSH
-// In C++03 mode, clang consider local or unnamed type and throw a warning instead of ignoring them
-QT_WARNING_DISABLE_CLANG("-Wunnamed-type-template-args")
-QT_WARNING_DISABLE_CLANG("-Wlocal-type-template-args")
template<typename T> char qt_getEnumMetaObject(const T&);
template<typename T>
@@ -1405,7 +1401,6 @@ QT_WARNING_DISABLE_CLANG("-Wlocal-type-template-args")
enum { Value = sizeof(qt_getEnumMetaObject(declval())) == sizeof(QMetaObject*) };
};
template<> struct IsQEnumHelper<void> { enum { Value = false }; };
-QT_WARNING_POP
template<typename T, typename Enable = void>
struct MetaObjectForType
diff --git a/src/gui/image/qbmphandler_p.h b/src/gui/image/qbmphandler_p.h
index 258ce0fce6..7d3cbab322 100644
--- a/src/gui/image/qbmphandler_p.h
+++ b/src/gui/image/qbmphandler_p.h
@@ -94,17 +94,17 @@ public:
};
explicit QBmpHandler(InternalFormat fmt = BmpFormat);
- bool canRead() const;
- bool read(QImage *image);
- bool write(const QImage &image);
+ bool canRead() const override;
+ bool read(QImage *image) override;
+ bool write(const QImage &image) override;
- QByteArray name() const;
+ QByteArray name() const override;
static bool canRead(QIODevice *device);
- QVariant option(ImageOption option) const;
- void setOption(ImageOption option, const QVariant &value);
- bool supportsOption(ImageOption option) const;
+ QVariant option(ImageOption option) const override;
+ void setOption(ImageOption option, const QVariant &value) override;
+ bool supportsOption(ImageOption option) const override;
private:
bool readHeader();
diff --git a/src/gui/image/qpnghandler_p.h b/src/gui/image/qpnghandler_p.h
index 269df25794..4ca716e7c2 100644
--- a/src/gui/image/qpnghandler_p.h
+++ b/src/gui/image/qpnghandler_p.h
@@ -65,15 +65,15 @@ public:
QPngHandler();
~QPngHandler();
- bool canRead() const;
- bool read(QImage *image);
- bool write(const QImage &image);
+ bool canRead() const override;
+ bool read(QImage *image) override;
+ bool write(const QImage &image) override;
- QByteArray name() const;
+ QByteArray name() const override;
- QVariant option(ImageOption option) const;
- void setOption(ImageOption option, const QVariant &value);
- bool supportsOption(ImageOption option) const;
+ QVariant option(ImageOption option) const override;
+ void setOption(ImageOption option, const QVariant &value) override;
+ bool supportsOption(ImageOption option) const override;
static bool canRead(QIODevice *device);
diff --git a/src/gui/image/qppmhandler_p.h b/src/gui/image/qppmhandler_p.h
index 8889d9e663..1c6fbd6869 100644
--- a/src/gui/image/qppmhandler_p.h
+++ b/src/gui/image/qppmhandler_p.h
@@ -63,17 +63,17 @@ class QPpmHandler : public QImageIOHandler
{
public:
QPpmHandler();
- bool canRead() const;
- bool read(QImage *image);
- bool write(const QImage &image);
+ bool canRead() const override;
+ bool read(QImage *image) override;
+ bool write(const QImage &image) override;
- QByteArray name() const;
+ QByteArray name() const override;
static bool canRead(QIODevice *device, QByteArray *subType = 0);
- QVariant option(ImageOption option) const;
- void setOption(ImageOption option, const QVariant &value);
- bool supportsOption(ImageOption option) const;
+ QVariant option(ImageOption option) const override;
+ void setOption(ImageOption option, const QVariant &value) override;
+ bool supportsOption(ImageOption option) const override;
private:
bool readHeader();
diff --git a/src/gui/image/qxbmhandler_p.h b/src/gui/image/qxbmhandler_p.h
index 561153376d..26439af527 100644
--- a/src/gui/image/qxbmhandler_p.h
+++ b/src/gui/image/qxbmhandler_p.h
@@ -62,17 +62,17 @@ class QXbmHandler : public QImageIOHandler
{
public:
QXbmHandler();
- bool canRead() const;
- bool read(QImage *image);
- bool write(const QImage &image);
+ bool canRead() const override;
+ bool read(QImage *image) override;
+ bool write(const QImage &image) override;
- QByteArray name() const;
+ QByteArray name() const override;
static bool canRead(QIODevice *device);
- QVariant option(ImageOption option) const;
- void setOption(ImageOption option, const QVariant &value);
- bool supportsOption(ImageOption option) const;
+ QVariant option(ImageOption option) const override;
+ void setOption(ImageOption option, const QVariant &value) override;
+ bool supportsOption(ImageOption option) const override;
private:
bool readHeader();
diff --git a/src/gui/image/qxpmhandler_p.h b/src/gui/image/qxpmhandler_p.h
index af3e98d3ff..f118bf2309 100644
--- a/src/gui/image/qxpmhandler_p.h
+++ b/src/gui/image/qxpmhandler_p.h
@@ -62,17 +62,17 @@ class QXpmHandler : public QImageIOHandler
{
public:
QXpmHandler();
- bool canRead() const;
- bool read(QImage *image);
- bool write(const QImage &image);
+ bool canRead() const override;
+ bool read(QImage *image) override;
+ bool write(const QImage &image) override;
static bool canRead(QIODevice *device);
- QByteArray name() const;
+ QByteArray name() const override;
- QVariant option(ImageOption option) const;
- void setOption(ImageOption option, const QVariant &value);
- bool supportsOption(ImageOption option) const;
+ QVariant option(ImageOption option) const override;
+ void setOption(ImageOption option, const QVariant &value) override;
+ bool supportsOption(ImageOption option) const override;
private:
bool readHeader();
diff --git a/src/gui/opengl/qopenglpaintdevice.h b/src/gui/opengl/qopenglpaintdevice.h
index 27b7fba84f..300002a9c1 100644
--- a/src/gui/opengl/qopenglpaintdevice.h
+++ b/src/gui/opengl/qopenglpaintdevice.h
@@ -61,8 +61,8 @@ public:
QOpenGLPaintDevice(int width, int height);
virtual ~QOpenGLPaintDevice();
- int devType() const { return QInternal::OpenGL; }
- QPaintEngine *paintEngine() const;
+ int devType() const override { return QInternal::OpenGL; }
+ QPaintEngine *paintEngine() const override;
QOpenGLContext *context() const;
QSize size() const;
@@ -82,7 +82,7 @@ public:
protected:
QOpenGLPaintDevice(QOpenGLPaintDevicePrivate &dd);
- int metric(QPaintDevice::PaintDeviceMetric metric) const;
+ int metric(QPaintDevice::PaintDeviceMetric metric) const override;
Q_DISABLE_COPY(QOpenGLPaintDevice)
QScopedPointer<QOpenGLPaintDevicePrivate> d_ptr;
diff --git a/src/gui/painting/qemulationpaintengine_p.h b/src/gui/painting/qemulationpaintengine_p.h
index 457cc06d63..a2eb9b008c 100644
--- a/src/gui/painting/qemulationpaintengine_p.h
+++ b/src/gui/painting/qemulationpaintengine_p.h
@@ -62,37 +62,37 @@ class QEmulationPaintEngine : public QPaintEngineEx
public:
QEmulationPaintEngine(QPaintEngineEx *engine);
- virtual bool begin(QPaintDevice *pdev);
- virtual bool end();
+ bool begin(QPaintDevice *pdev) override;
+ bool end() override;
- virtual Type type() const;
- virtual QPainterState *createState(QPainterState *orig) const;
+ Type type() const override;
+ QPainterState *createState(QPainterState *orig) const override;
- virtual void fill(const QVectorPath &path, const QBrush &brush);
- virtual void stroke(const QVectorPath &path, const QPen &pen);
- virtual void clip(const QVectorPath &path, Qt::ClipOperation op);
+ void fill(const QVectorPath &path, const QBrush &brush) override;
+ void stroke(const QVectorPath &path, const QPen &pen) override;
+ void clip(const QVectorPath &path, Qt::ClipOperation op) override;
- virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
- virtual void drawTextItem(const QPointF &p, const QTextItem &textItem);
- virtual void drawStaticTextItem(QStaticTextItem *item);
- virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
- virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags);
+ void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override;
+ void drawTextItem(const QPointF &p, const QTextItem &textItem) override;
+ void drawStaticTextItem(QStaticTextItem *item) override;
+ void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) override;
+ void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags) override;
- virtual void clipEnabledChanged();
- virtual void penChanged();
- virtual void brushChanged();
- virtual void brushOriginChanged();
- virtual void opacityChanged();
- virtual void compositionModeChanged();
- virtual void renderHintsChanged();
- virtual void transformChanged();
+ void clipEnabledChanged() override;
+ void penChanged() override;
+ void brushChanged() override;
+ void brushOriginChanged() override;
+ void opacityChanged() override;
+ void compositionModeChanged() override;
+ void renderHintsChanged() override;
+ void transformChanged() override;
- virtual void setState(QPainterState *s);
+ void setState(QPainterState *s) override;
- virtual void beginNativePainting();
- virtual void endNativePainting();
+ void beginNativePainting() override;
+ void endNativePainting() override;
- virtual uint flags() const {return QPaintEngineEx::IsEmulationEngine | QPaintEngineEx::DoNotEmulate;}
+ uint flags() const override { return QPaintEngineEx::IsEmulationEngine | QPaintEngineEx::DoNotEmulate; }
inline QPainterState *state() { return (QPainterState *)QPaintEngine::state; }
inline const QPainterState *state() const { return (const QPainterState *)QPaintEngine::state; }
diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h
index 8cde88fa82..59213220a6 100644
--- a/src/gui/painting/qpaintengine_raster_p.h
+++ b/src/gui/painting/qpaintengine_raster_p.h
@@ -287,7 +287,7 @@ public:
void rasterize(QT_FT_Outline *outline, ProcessSpans callback, void *userData, QRasterBuffer *rasterBuffer);
void updateMatrixData(QSpanData *spanData, const QBrush &brush, const QTransform &brushMatrix);
- void systemStateChanged();
+ void systemStateChanged() override;
void drawImage(const QPointF &pt, const QImage &img, SrcOverBlendFunc func,
const QRect &clip, int alpha, const QRect &sr = QRect());
diff --git a/src/gui/painting/qpdfwriter.h b/src/gui/painting/qpdfwriter.h
index baad274818..17c73dd480 100644
--- a/src/gui/painting/qpdfwriter.h
+++ b/src/gui/painting/qpdfwriter.h
@@ -67,7 +67,7 @@ public:
QString creator() const;
void setCreator(const QString &creator);
- bool newPage();
+ bool newPage() override;
void setResolution(int resolution);
int resolution() const;
@@ -83,14 +83,14 @@ public:
using QPagedPaintDevice::setPageSize;
#endif
- void setPageSize(PageSize size);
- void setPageSizeMM(const QSizeF &size);
+ void setPageSize(PageSize size) override;
+ void setPageSizeMM(const QSizeF &size) override;
- void setMargins(const Margins &m);
+ void setMargins(const Margins &m) override;
protected:
- QPaintEngine *paintEngine() const;
- int metric(PaintDeviceMetric id) const;
+ QPaintEngine *paintEngine() const override;
+ int metric(PaintDeviceMetric id) const override;
private:
Q_DISABLE_COPY(QPdfWriter)
diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h
index ededb5d80b..1a7c184e1a 100644
--- a/src/gui/painting/qstroker_p.h
+++ b/src/gui/painting/qstroker_p.h
@@ -234,7 +234,7 @@ protected:
static Qt::PenJoinStyle joinForJoinMode(LineJoinMode mode);
static LineJoinMode joinModeForJoin(Qt::PenJoinStyle joinStyle);
- virtual void processCurrentSubpath();
+ void processCurrentSubpath() override;
qfixed m_strokeWidth;
qfixed m_miterLimit;
@@ -265,14 +265,14 @@ public:
void setDashOffset(qreal offset) { m_dashOffset = offset; }
qreal dashOffset() const { return m_dashOffset; }
- virtual void begin(void *data);
- virtual void end();
+ void begin(void *data) override;
+ void end() override;
inline void setStrokeWidth(qreal width) { m_stroke_width = width; }
inline void setMiterLimit(qreal limit) { m_miter_limit = limit; }
protected:
- virtual void processCurrentSubpath();
+ void processCurrentSubpath() override;
QStroker *m_stroker;
QVector<qfixed> m_dashPattern;
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 6f837de27f..128f75f93b 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -118,6 +118,7 @@ QHttpNetworkConnectionPrivate::~QHttpNetworkConnectionPrivate()
{
for (int i = 0; i < channelCount; ++i) {
if (channels[i].socket) {
+ QObject::disconnect(channels[i].socket, Q_NULLPTR, &channels[i], Q_NULLPTR);
channels[i].socket->close();
delete channels[i].socket;
}
diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
index d89b8d398b..68619928d3 100644
--- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp
+++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
@@ -767,6 +767,10 @@ static bool readExifHeader(QDataStream &stream)
*/
static int getExifOrientation(QByteArray &exifData)
{
+ // Current EXIF version (2.3) says there can be at most 5 IFDs,
+ // byte we allow for 10 so we're able to deal with future extensions.
+ const int maxIfdCount = 10;
+
QDataStream stream(&exifData, QIODevice::ReadOnly);
if (!readExifHeader(stream))
@@ -774,7 +778,8 @@ static int getExifOrientation(QByteArray &exifData)
quint16 val;
quint32 offset;
- const qint64 headerStart = stream.device()->pos();
+ const qint64 headerStart = 6; // the EXIF header has a constant size
+ Q_ASSERT(headerStart == stream.device()->pos());
// read byte order marker
stream >> val;
@@ -785,7 +790,7 @@ static int getExifOrientation(QByteArray &exifData)
else
return -1; // unknown byte order
- // read size
+ // confirm byte order
stream >> val;
if (val != 0x2a)
return -1;
@@ -793,18 +798,22 @@ static int getExifOrientation(QByteArray &exifData)
stream >> offset;
// read IFD
- while (!stream.atEnd()) {
+ for (int n = 0; n < maxIfdCount; ++n) {
quint16 numEntries;
- // skip offset bytes to get the next IFD
const qint64 bytesToSkip = offset - (stream.device()->pos() - headerStart);
-
- if (stream.skipRawData(bytesToSkip) != bytesToSkip)
+ if (bytesToSkip < 0 || (offset + headerStart >= exifData.size())) {
+ // disallow going backwards, though it's permitted in the spec
return -1;
+ } else if (bytesToSkip != 0) {
+ // seek to the IFD
+ if (!stream.device()->seek(offset + headerStart))
+ return -1;
+ }
stream >> numEntries;
- for (; numEntries > 0; --numEntries) {
+ for (; numEntries > 0 && stream.status() == QDataStream::Ok; --numEntries) {
quint16 tag;
quint16 type;
quint32 components;
@@ -828,12 +837,14 @@ static int getExifOrientation(QByteArray &exifData)
// read offset to next IFD
stream >> offset;
+ if (stream.status() != QDataStream::Ok)
+ return -1;
if (offset == 0) // this is the last IFD
- break;
+ return 0; // No Exif orientation was found
}
- // No Exif orientation was found
- return 0;
+ // too many IFDs
+ return -1;
}
static QImageIOHandler::Transformations exif2Qt(int exifOrientation)