Merge remote-tracking branch 'origin/5.7' into 5.8.0
Change-Id: I576187a9905802c177ae483e6c29d0f55cf7034d
This commit is contained in:
commit
cae32bd04d
@ -25,7 +25,7 @@ for (s, QLALRSOURCES) {
|
|||||||
$${base}.variable_out = GENERATED_SOURCES
|
$${base}.variable_out = GENERATED_SOURCES
|
||||||
$${base}.depends += $$QMAKE_QLALR_EXE
|
$${base}.depends += $$QMAKE_QLALR_EXE
|
||||||
$${base}.commands = $$QMAKE_QLALR $$QMAKE_QLALRFLAGS ${QMAKE_FILE_IN}
|
$${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}.name = QLALR ${QMAKE_FILE_IN}
|
||||||
|
|
||||||
$${base}_h.input = $$invar
|
$${base}_h.input = $$invar
|
||||||
|
@ -308,13 +308,13 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t)
|
|||||||
{
|
{
|
||||||
t << "first: all\n";
|
t << "first: all\n";
|
||||||
t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName()))
|
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") {
|
if (project->first("TEMPLATE") == "aux") {
|
||||||
t << "\n\n";
|
t << "\n\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
t << " $(DESTDIR_TARGET)\n\n";
|
|
||||||
t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS");
|
|
||||||
if(!project->isEmpty("QMAKE_PRE_LINK"))
|
if(!project->isEmpty("QMAKE_PRE_LINK"))
|
||||||
t << "\n\t" <<var("QMAKE_PRE_LINK");
|
t << "\n\t" <<var("QMAKE_PRE_LINK");
|
||||||
if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
|
if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
|
||||||
|
@ -517,13 +517,12 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t)
|
|||||||
|
|
||||||
t << "first: all\n";
|
t << "first: all\n";
|
||||||
t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName()))
|
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") {
|
if (templateName == "aux") {
|
||||||
t << "\n\n";
|
t << "\n\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
t << " $(DESTDIR_TARGET)\n\n";
|
|
||||||
t << "$(DESTDIR_TARGET): " << depVar("PRE_TARGETDEPS") << " $(OBJECTS) " << depVar("POST_TARGETDEPS");
|
|
||||||
|
|
||||||
if(!project->isEmpty("QMAKE_PRE_LINK"))
|
if(!project->isEmpty("QMAKE_PRE_LINK"))
|
||||||
t << "\n\t" <<var("QMAKE_PRE_LINK");
|
t << "\n\t" <<var("QMAKE_PRE_LINK");
|
||||||
|
@ -165,6 +165,9 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
|
|||||||
|
|
||||||
void Win32MakefileGenerator::processVars()
|
void Win32MakefileGenerator::processVars()
|
||||||
{
|
{
|
||||||
|
if (project->first("TEMPLATE").endsWith("aux"))
|
||||||
|
return;
|
||||||
|
|
||||||
project->values("QMAKE_ORIG_TARGET") = project->values("TARGET");
|
project->values("QMAKE_ORIG_TARGET") = project->values("TARGET");
|
||||||
if (project->isEmpty("QMAKE_PROJECT_NAME"))
|
if (project->isEmpty("QMAKE_PROJECT_NAME"))
|
||||||
project->values("QMAKE_PROJECT_NAME") = project->values("QMAKE_ORIG_TARGET");
|
project->values("QMAKE_PROJECT_NAME") = project->values("QMAKE_ORIG_TARGET");
|
||||||
|
@ -1041,6 +1041,10 @@ void QMessagePattern::setPattern(const QString &pattern)
|
|||||||
delete [] literals;
|
delete [] literals;
|
||||||
}
|
}
|
||||||
delete [] tokens;
|
delete [] tokens;
|
||||||
|
timeArgs.clear();
|
||||||
|
#ifdef QLOGGING_HAVE_BACKTRACE
|
||||||
|
backtraceArgs.clear();
|
||||||
|
#endif
|
||||||
|
|
||||||
// scanner
|
// scanner
|
||||||
QList<QString> lexemes;
|
QList<QString> lexemes;
|
||||||
|
@ -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> char qt_getEnumMetaObject(const T&);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -1405,7 +1401,6 @@ QT_WARNING_DISABLE_CLANG("-Wlocal-type-template-args")
|
|||||||
enum { Value = sizeof(qt_getEnumMetaObject(declval())) == sizeof(QMetaObject*) };
|
enum { Value = sizeof(qt_getEnumMetaObject(declval())) == sizeof(QMetaObject*) };
|
||||||
};
|
};
|
||||||
template<> struct IsQEnumHelper<void> { enum { Value = false }; };
|
template<> struct IsQEnumHelper<void> { enum { Value = false }; };
|
||||||
QT_WARNING_POP
|
|
||||||
|
|
||||||
template<typename T, typename Enable = void>
|
template<typename T, typename Enable = void>
|
||||||
struct MetaObjectForType
|
struct MetaObjectForType
|
||||||
|
@ -94,17 +94,17 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
explicit QBmpHandler(InternalFormat fmt = BmpFormat);
|
explicit QBmpHandler(InternalFormat fmt = BmpFormat);
|
||||||
bool canRead() const;
|
bool canRead() const override;
|
||||||
bool read(QImage *image);
|
bool read(QImage *image) override;
|
||||||
bool write(const QImage &image);
|
bool write(const QImage &image) override;
|
||||||
|
|
||||||
QByteArray name() const;
|
QByteArray name() const override;
|
||||||
|
|
||||||
static bool canRead(QIODevice *device);
|
static bool canRead(QIODevice *device);
|
||||||
|
|
||||||
QVariant option(ImageOption option) const;
|
QVariant option(ImageOption option) const override;
|
||||||
void setOption(ImageOption option, const QVariant &value);
|
void setOption(ImageOption option, const QVariant &value) override;
|
||||||
bool supportsOption(ImageOption option) const;
|
bool supportsOption(ImageOption option) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool readHeader();
|
bool readHeader();
|
||||||
|
@ -65,15 +65,15 @@ public:
|
|||||||
QPngHandler();
|
QPngHandler();
|
||||||
~QPngHandler();
|
~QPngHandler();
|
||||||
|
|
||||||
bool canRead() const;
|
bool canRead() const override;
|
||||||
bool read(QImage *image);
|
bool read(QImage *image) override;
|
||||||
bool write(const QImage &image);
|
bool write(const QImage &image) override;
|
||||||
|
|
||||||
QByteArray name() const;
|
QByteArray name() const override;
|
||||||
|
|
||||||
QVariant option(ImageOption option) const;
|
QVariant option(ImageOption option) const override;
|
||||||
void setOption(ImageOption option, const QVariant &value);
|
void setOption(ImageOption option, const QVariant &value) override;
|
||||||
bool supportsOption(ImageOption option) const;
|
bool supportsOption(ImageOption option) const override;
|
||||||
|
|
||||||
static bool canRead(QIODevice *device);
|
static bool canRead(QIODevice *device);
|
||||||
|
|
||||||
|
@ -63,17 +63,17 @@ class QPpmHandler : public QImageIOHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QPpmHandler();
|
QPpmHandler();
|
||||||
bool canRead() const;
|
bool canRead() const override;
|
||||||
bool read(QImage *image);
|
bool read(QImage *image) override;
|
||||||
bool write(const QImage &image);
|
bool write(const QImage &image) override;
|
||||||
|
|
||||||
QByteArray name() const;
|
QByteArray name() const override;
|
||||||
|
|
||||||
static bool canRead(QIODevice *device, QByteArray *subType = 0);
|
static bool canRead(QIODevice *device, QByteArray *subType = 0);
|
||||||
|
|
||||||
QVariant option(ImageOption option) const;
|
QVariant option(ImageOption option) const override;
|
||||||
void setOption(ImageOption option, const QVariant &value);
|
void setOption(ImageOption option, const QVariant &value) override;
|
||||||
bool supportsOption(ImageOption option) const;
|
bool supportsOption(ImageOption option) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool readHeader();
|
bool readHeader();
|
||||||
|
@ -62,17 +62,17 @@ class QXbmHandler : public QImageIOHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QXbmHandler();
|
QXbmHandler();
|
||||||
bool canRead() const;
|
bool canRead() const override;
|
||||||
bool read(QImage *image);
|
bool read(QImage *image) override;
|
||||||
bool write(const QImage &image);
|
bool write(const QImage &image) override;
|
||||||
|
|
||||||
QByteArray name() const;
|
QByteArray name() const override;
|
||||||
|
|
||||||
static bool canRead(QIODevice *device);
|
static bool canRead(QIODevice *device);
|
||||||
|
|
||||||
QVariant option(ImageOption option) const;
|
QVariant option(ImageOption option) const override;
|
||||||
void setOption(ImageOption option, const QVariant &value);
|
void setOption(ImageOption option, const QVariant &value) override;
|
||||||
bool supportsOption(ImageOption option) const;
|
bool supportsOption(ImageOption option) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool readHeader();
|
bool readHeader();
|
||||||
|
@ -62,17 +62,17 @@ class QXpmHandler : public QImageIOHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QXpmHandler();
|
QXpmHandler();
|
||||||
bool canRead() const;
|
bool canRead() const override;
|
||||||
bool read(QImage *image);
|
bool read(QImage *image) override;
|
||||||
bool write(const QImage &image);
|
bool write(const QImage &image) override;
|
||||||
|
|
||||||
static bool canRead(QIODevice *device);
|
static bool canRead(QIODevice *device);
|
||||||
|
|
||||||
QByteArray name() const;
|
QByteArray name() const override;
|
||||||
|
|
||||||
QVariant option(ImageOption option) const;
|
QVariant option(ImageOption option) const override;
|
||||||
void setOption(ImageOption option, const QVariant &value);
|
void setOption(ImageOption option, const QVariant &value) override;
|
||||||
bool supportsOption(ImageOption option) const;
|
bool supportsOption(ImageOption option) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool readHeader();
|
bool readHeader();
|
||||||
|
@ -61,8 +61,8 @@ public:
|
|||||||
QOpenGLPaintDevice(int width, int height);
|
QOpenGLPaintDevice(int width, int height);
|
||||||
virtual ~QOpenGLPaintDevice();
|
virtual ~QOpenGLPaintDevice();
|
||||||
|
|
||||||
int devType() const { return QInternal::OpenGL; }
|
int devType() const override { return QInternal::OpenGL; }
|
||||||
QPaintEngine *paintEngine() const;
|
QPaintEngine *paintEngine() const override;
|
||||||
|
|
||||||
QOpenGLContext *context() const;
|
QOpenGLContext *context() const;
|
||||||
QSize size() const;
|
QSize size() const;
|
||||||
@ -82,7 +82,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
QOpenGLPaintDevice(QOpenGLPaintDevicePrivate &dd);
|
QOpenGLPaintDevice(QOpenGLPaintDevicePrivate &dd);
|
||||||
int metric(QPaintDevice::PaintDeviceMetric metric) const;
|
int metric(QPaintDevice::PaintDeviceMetric metric) const override;
|
||||||
|
|
||||||
Q_DISABLE_COPY(QOpenGLPaintDevice)
|
Q_DISABLE_COPY(QOpenGLPaintDevice)
|
||||||
QScopedPointer<QOpenGLPaintDevicePrivate> d_ptr;
|
QScopedPointer<QOpenGLPaintDevicePrivate> d_ptr;
|
||||||
|
@ -62,37 +62,37 @@ class QEmulationPaintEngine : public QPaintEngineEx
|
|||||||
public:
|
public:
|
||||||
QEmulationPaintEngine(QPaintEngineEx *engine);
|
QEmulationPaintEngine(QPaintEngineEx *engine);
|
||||||
|
|
||||||
virtual bool begin(QPaintDevice *pdev);
|
bool begin(QPaintDevice *pdev) override;
|
||||||
virtual bool end();
|
bool end() override;
|
||||||
|
|
||||||
virtual Type type() const;
|
Type type() const override;
|
||||||
virtual QPainterState *createState(QPainterState *orig) const;
|
QPainterState *createState(QPainterState *orig) const override;
|
||||||
|
|
||||||
virtual void fill(const QVectorPath &path, const QBrush &brush);
|
void fill(const QVectorPath &path, const QBrush &brush) override;
|
||||||
virtual void stroke(const QVectorPath &path, const QPen &pen);
|
void stroke(const QVectorPath &path, const QPen &pen) override;
|
||||||
virtual void clip(const QVectorPath &path, Qt::ClipOperation op);
|
void clip(const QVectorPath &path, Qt::ClipOperation op) override;
|
||||||
|
|
||||||
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
|
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override;
|
||||||
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem);
|
void drawTextItem(const QPointF &p, const QTextItem &textItem) override;
|
||||||
virtual void drawStaticTextItem(QStaticTextItem *item);
|
void drawStaticTextItem(QStaticTextItem *item) override;
|
||||||
virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
|
void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) override;
|
||||||
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags);
|
void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags) override;
|
||||||
|
|
||||||
virtual void clipEnabledChanged();
|
void clipEnabledChanged() override;
|
||||||
virtual void penChanged();
|
void penChanged() override;
|
||||||
virtual void brushChanged();
|
void brushChanged() override;
|
||||||
virtual void brushOriginChanged();
|
void brushOriginChanged() override;
|
||||||
virtual void opacityChanged();
|
void opacityChanged() override;
|
||||||
virtual void compositionModeChanged();
|
void compositionModeChanged() override;
|
||||||
virtual void renderHintsChanged();
|
void renderHintsChanged() override;
|
||||||
virtual void transformChanged();
|
void transformChanged() override;
|
||||||
|
|
||||||
virtual void setState(QPainterState *s);
|
void setState(QPainterState *s) override;
|
||||||
|
|
||||||
virtual void beginNativePainting();
|
void beginNativePainting() override;
|
||||||
virtual void endNativePainting();
|
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 QPainterState *state() { return (QPainterState *)QPaintEngine::state; }
|
||||||
inline const QPainterState *state() const { return (const QPainterState *)QPaintEngine::state; }
|
inline const QPainterState *state() const { return (const QPainterState *)QPaintEngine::state; }
|
||||||
|
@ -287,7 +287,7 @@ public:
|
|||||||
void rasterize(QT_FT_Outline *outline, ProcessSpans callback, void *userData, QRasterBuffer *rasterBuffer);
|
void rasterize(QT_FT_Outline *outline, ProcessSpans callback, void *userData, QRasterBuffer *rasterBuffer);
|
||||||
void updateMatrixData(QSpanData *spanData, const QBrush &brush, const QTransform &brushMatrix);
|
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,
|
void drawImage(const QPointF &pt, const QImage &img, SrcOverBlendFunc func,
|
||||||
const QRect &clip, int alpha, const QRect &sr = QRect());
|
const QRect &clip, int alpha, const QRect &sr = QRect());
|
||||||
|
@ -67,7 +67,7 @@ public:
|
|||||||
QString creator() const;
|
QString creator() const;
|
||||||
void setCreator(const QString &creator);
|
void setCreator(const QString &creator);
|
||||||
|
|
||||||
bool newPage();
|
bool newPage() override;
|
||||||
|
|
||||||
void setResolution(int resolution);
|
void setResolution(int resolution);
|
||||||
int resolution() const;
|
int resolution() const;
|
||||||
@ -83,14 +83,14 @@ public:
|
|||||||
using QPagedPaintDevice::setPageSize;
|
using QPagedPaintDevice::setPageSize;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void setPageSize(PageSize size);
|
void setPageSize(PageSize size) override;
|
||||||
void setPageSizeMM(const QSizeF &size);
|
void setPageSizeMM(const QSizeF &size) override;
|
||||||
|
|
||||||
void setMargins(const Margins &m);
|
void setMargins(const Margins &m) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QPaintEngine *paintEngine() const;
|
QPaintEngine *paintEngine() const override;
|
||||||
int metric(PaintDeviceMetric id) const;
|
int metric(PaintDeviceMetric id) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(QPdfWriter)
|
Q_DISABLE_COPY(QPdfWriter)
|
||||||
|
@ -234,7 +234,7 @@ protected:
|
|||||||
static Qt::PenJoinStyle joinForJoinMode(LineJoinMode mode);
|
static Qt::PenJoinStyle joinForJoinMode(LineJoinMode mode);
|
||||||
static LineJoinMode joinModeForJoin(Qt::PenJoinStyle joinStyle);
|
static LineJoinMode joinModeForJoin(Qt::PenJoinStyle joinStyle);
|
||||||
|
|
||||||
virtual void processCurrentSubpath();
|
void processCurrentSubpath() override;
|
||||||
|
|
||||||
qfixed m_strokeWidth;
|
qfixed m_strokeWidth;
|
||||||
qfixed m_miterLimit;
|
qfixed m_miterLimit;
|
||||||
@ -265,14 +265,14 @@ public:
|
|||||||
void setDashOffset(qreal offset) { m_dashOffset = offset; }
|
void setDashOffset(qreal offset) { m_dashOffset = offset; }
|
||||||
qreal dashOffset() const { return m_dashOffset; }
|
qreal dashOffset() const { return m_dashOffset; }
|
||||||
|
|
||||||
virtual void begin(void *data);
|
void begin(void *data) override;
|
||||||
virtual void end();
|
void end() override;
|
||||||
|
|
||||||
inline void setStrokeWidth(qreal width) { m_stroke_width = width; }
|
inline void setStrokeWidth(qreal width) { m_stroke_width = width; }
|
||||||
inline void setMiterLimit(qreal limit) { m_miter_limit = limit; }
|
inline void setMiterLimit(qreal limit) { m_miter_limit = limit; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void processCurrentSubpath();
|
void processCurrentSubpath() override;
|
||||||
|
|
||||||
QStroker *m_stroker;
|
QStroker *m_stroker;
|
||||||
QVector<qfixed> m_dashPattern;
|
QVector<qfixed> m_dashPattern;
|
||||||
|
@ -118,6 +118,7 @@ QHttpNetworkConnectionPrivate::~QHttpNetworkConnectionPrivate()
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < channelCount; ++i) {
|
for (int i = 0; i < channelCount; ++i) {
|
||||||
if (channels[i].socket) {
|
if (channels[i].socket) {
|
||||||
|
QObject::disconnect(channels[i].socket, Q_NULLPTR, &channels[i], Q_NULLPTR);
|
||||||
channels[i].socket->close();
|
channels[i].socket->close();
|
||||||
delete channels[i].socket;
|
delete channels[i].socket;
|
||||||
}
|
}
|
||||||
|
@ -767,6 +767,10 @@ static bool readExifHeader(QDataStream &stream)
|
|||||||
*/
|
*/
|
||||||
static int getExifOrientation(QByteArray &exifData)
|
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);
|
QDataStream stream(&exifData, QIODevice::ReadOnly);
|
||||||
|
|
||||||
if (!readExifHeader(stream))
|
if (!readExifHeader(stream))
|
||||||
@ -774,7 +778,8 @@ static int getExifOrientation(QByteArray &exifData)
|
|||||||
|
|
||||||
quint16 val;
|
quint16 val;
|
||||||
quint32 offset;
|
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
|
// read byte order marker
|
||||||
stream >> val;
|
stream >> val;
|
||||||
@ -785,7 +790,7 @@ static int getExifOrientation(QByteArray &exifData)
|
|||||||
else
|
else
|
||||||
return -1; // unknown byte order
|
return -1; // unknown byte order
|
||||||
|
|
||||||
// read size
|
// confirm byte order
|
||||||
stream >> val;
|
stream >> val;
|
||||||
if (val != 0x2a)
|
if (val != 0x2a)
|
||||||
return -1;
|
return -1;
|
||||||
@ -793,18 +798,22 @@ static int getExifOrientation(QByteArray &exifData)
|
|||||||
stream >> offset;
|
stream >> offset;
|
||||||
|
|
||||||
// read IFD
|
// read IFD
|
||||||
while (!stream.atEnd()) {
|
for (int n = 0; n < maxIfdCount; ++n) {
|
||||||
quint16 numEntries;
|
quint16 numEntries;
|
||||||
|
|
||||||
// skip offset bytes to get the next IFD
|
|
||||||
const qint64 bytesToSkip = offset - (stream.device()->pos() - headerStart);
|
const qint64 bytesToSkip = offset - (stream.device()->pos() - headerStart);
|
||||||
|
if (bytesToSkip < 0 || (offset + headerStart >= exifData.size())) {
|
||||||
if (stream.skipRawData(bytesToSkip) != bytesToSkip)
|
// disallow going backwards, though it's permitted in the spec
|
||||||
return -1;
|
return -1;
|
||||||
|
} else if (bytesToSkip != 0) {
|
||||||
|
// seek to the IFD
|
||||||
|
if (!stream.device()->seek(offset + headerStart))
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
stream >> numEntries;
|
stream >> numEntries;
|
||||||
|
|
||||||
for (; numEntries > 0; --numEntries) {
|
for (; numEntries > 0 && stream.status() == QDataStream::Ok; --numEntries) {
|
||||||
quint16 tag;
|
quint16 tag;
|
||||||
quint16 type;
|
quint16 type;
|
||||||
quint32 components;
|
quint32 components;
|
||||||
@ -828,12 +837,14 @@ static int getExifOrientation(QByteArray &exifData)
|
|||||||
|
|
||||||
// read offset to next IFD
|
// read offset to next IFD
|
||||||
stream >> offset;
|
stream >> offset;
|
||||||
|
if (stream.status() != QDataStream::Ok)
|
||||||
|
return -1;
|
||||||
if (offset == 0) // this is the last IFD
|
if (offset == 0) // this is the last IFD
|
||||||
break;
|
return 0; // No Exif orientation was found
|
||||||
}
|
}
|
||||||
|
|
||||||
// No Exif orientation was found
|
// too many IFDs
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QImageIOHandler::Transformations exif2Qt(int exifOrientation)
|
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 |
@ -188,7 +188,8 @@ private slots:
|
|||||||
void exifOrientation();
|
void exifOrientation();
|
||||||
|
|
||||||
void exif_QTBUG45865();
|
void exif_QTBUG45865();
|
||||||
void exif_invalid_data_QTBUG46870();
|
void exifInvalidData_data();
|
||||||
|
void exifInvalidData();
|
||||||
|
|
||||||
void cleanupFunctions();
|
void cleanupFunctions();
|
||||||
|
|
||||||
@ -3049,10 +3050,20 @@ void tst_QImage::exif_QTBUG45865()
|
|||||||
QCOMPARE(image.size(), QSize(5, 8));
|
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;
|
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());
|
QVERIFY(!image.isNull());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user