Merge remote-tracking branch 'origin/5.7' into 5.8.0

Change-Id: I576187a9905802c177ae483e6c29d0f55cf7034d
This commit is contained in:
Liang Qi 2016-12-08 08:20:36 +01:00
commit cae32bd04d
23 changed files with 122 additions and 98 deletions

View File

@ -25,7 +25,7 @@ for (s, QLALRSOURCES) {
$${base}.variable_out = GENERATED_SOURCES
$${base}.depends += $$QMAKE_QLALR_EXE
$${base}.commands = $$QMAKE_QLALR $$QMAKE_QLALRFLAGS ${QMAKE_FILE_IN}
silent: $${base}.commands = @echo qlalr ${QMAKE_FILE_IN} && $${base}.commands
silent: $${base}.commands = @echo qlalr ${QMAKE_FILE_IN} && $$eval($${base}.commands)
$${base}.name = QLALR ${QMAKE_FILE_IN}
$${base}_h.input = $$invar

View File

@ -308,13 +308,13 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t)
{
t << "first: all\n";
t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName()))
<< ' ' << depVar("ALL_DEPS");
<< ' ' << depVar("ALL_DEPS") << " $(DESTDIR_TARGET)\n\n";
t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS");
if (project->first("TEMPLATE") == "aux") {
t << "\n\n";
return;
}
t << " $(DESTDIR_TARGET)\n\n";
t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS");
if(!project->isEmpty("QMAKE_PRE_LINK"))
t << "\n\t" <<var("QMAKE_PRE_LINK");
if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {

View File

@ -517,13 +517,12 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t)
t << "first: all\n";
t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName()))
<< ' ' << depVar("ALL_DEPS");
<< ' ' << depVar("ALL_DEPS") << " $(DESTDIR_TARGET)\n\n";
t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS");
if (templateName == "aux") {
t << "\n\n";
return;
}
t << " $(DESTDIR_TARGET)\n\n";
t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS");
if(!project->isEmpty("QMAKE_PRE_LINK"))
t << "\n\t" <<var("QMAKE_PRE_LINK");

View File

@ -165,6 +165,9 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
void Win32MakefileGenerator::processVars()
{
if (project->first("TEMPLATE").endsWith("aux"))
return;
project->values("QMAKE_ORIG_TARGET") = project->values("TARGET");
if (project->isEmpty("QMAKE_PROJECT_NAME"))
project->values("QMAKE_PROJECT_NAME") = project->values("QMAKE_ORIG_TARGET");

View File

@ -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;

View File

@ -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

View File

@ -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();

View File

@ -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);

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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;

View File

@ -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; }

View File

@ -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());

View File

@ -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)

View File

@ -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;

View File

@ -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;
}

View File

@ -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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 964 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

View File

@ -188,7 +188,8 @@ private slots:
void exifOrientation();
void exif_QTBUG45865();
void exif_invalid_data_QTBUG46870();
void exifInvalidData_data();
void exifInvalidData();
void cleanupFunctions();
@ -3049,10 +3050,20 @@ void tst_QImage::exif_QTBUG45865()
QCOMPARE(image.size(), QSize(5, 8));
}
void tst_QImage::exif_invalid_data_QTBUG46870()
void tst_QImage::exifInvalidData_data()
{
QTest::addColumn<bool>("$never used");
QTest::newRow("QTBUG-46870");
QTest::newRow("back_pointers");
QTest::newRow("past_end");
QTest::newRow("too_many_ifds");
QTest::newRow("too_many_tags");
}
void tst_QImage::exifInvalidData()
{
QImage image;
QVERIFY(image.load(m_prefix + "jpeg_exif_invalid_data_QTBUG-46870.jpg"));
QVERIFY(image.load(m_prefix + "jpeg_exif_invalid_data_" + QTest::currentDataTag() + ".jpg"));
QVERIFY(!image.isNull());
}