summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-04-06 13:52:45 +0200
committerLiang Qi <liang.qi@qt.io>2017-04-06 14:16:31 +0200
commit0fc569184cf0fb6663e955e68bfa14baf3f3fe0d (patch)
tree0161df2f2ac28b554e77d62498647054198d8e1e
parent280e321e52fd4e86545f3f0d4bd4e047786a897e (diff)
parentefb84b6189f9e98c6dd29c22f00ad760445196c2 (diff)
Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts: src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp src/platformsupport/fontdatabases/freetype/qfreetypefontdatabase.cpp src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp src/widgets/widgets/qtabbar.cpp Change-Id: Iaa9daee5f7a6490d56257a3824730a35751ceb05
-rw-r--r--config.tests/common/c++98default/c++98default.pro3
-rw-r--r--configure.json10
-rw-r--r--mkspecs/features/data/macros.cpp1
-rw-r--r--mkspecs/features/default_post.prf5
-rw-r--r--mkspecs/features/toolchain.prf1
-rw-r--r--mkspecs/linux-aarch64-gnu-g++/qmake.conf24
-rw-r--r--mkspecs/linux-aarch64-gnu-g++/qplatformdefs.h (renamed from config.tests/common/c++98default/c++98default.cpp)10
-rw-r--r--src/concurrent/qtconcurrentstoredfunctioncall.h100
-rw-r--r--src/corelib/global/qcompilerdetection.h9
-rw-r--r--src/corelib/global/qmalloc.cpp11
-rw-r--r--src/corelib/kernel/qmetatype.h2
-rw-r--r--src/corelib/kernel/qvariant.h2
-rw-r--r--src/corelib/tools/qcryptographichash.cpp55
-rw-r--r--src/corelib/tools/qvector.h1
-rw-r--r--src/corelib/xml/qxmlstream_p.h1
-rw-r--r--src/gui/image/qbmphandler.cpp6
-rw-r--r--src/gui/image/qbmphandler_p.h2
-rw-r--r--src/gui/kernel/qopenglcontext.cpp34
-rw-r--r--src/gui/painting/qblendfunctions_p.h12
-rw-r--r--src/gui/painting/qdrawhelper_p.h42
-rw-r--r--src/gui/painting/qgrayraster.c14
-rw-r--r--src/gui/painting/qpdf.cpp2
-rw-r--r--src/gui/painting/qtransform.cpp6
-rw-r--r--src/gui/text/qtextengine.cpp7
-rw-r--r--src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp1
-rw-r--r--src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp2
-rw-r--r--src/platformsupport/graphics/qrasterbackingstore.cpp16
-rw-r--r--src/plugins/platforms/android/qandroidplatformopenglcontext.cpp31
-rw-r--r--src/plugins/platforms/android/qandroidplatformopenglcontext.h1
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbmime.cpp6
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp20
-rw-r--r--src/sql/kernel/qsqldatabase.cpp3
-rw-r--r--src/widgets/styles/qcommonstyle.cpp7
-rw-r--r--src/widgets/styles/qfusionstyle.cpp6
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp4
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp2
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp1
-rw-r--r--src/widgets/widgets/qeffects.cpp1
-rw-r--r--src/widgets/widgets/qtabbar.cpp5
-rw-r--r--src/widgets/widgets/qtoolbar.cpp2
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp1
-rw-r--r--tests/auto/corelib/io/largefile/tst_largefile.cpp41
-rw-r--r--tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp166
-rw-r--r--tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp26
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp9
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp3
48 files changed, 446 insertions, 274 deletions
diff --git a/config.tests/common/c++98default/c++98default.pro b/config.tests/common/c++98default/c++98default.pro
deleted file mode 100644
index 97cf2d7b20..0000000000
--- a/config.tests/common/c++98default/c++98default.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-TEMPLATE = app
-CONFIG -= c++11 c++14 c++1z
-SOURCES = c++98default.cpp
diff --git a/configure.json b/configure.json
index c5be88856d..06c62f5aea 100644
--- a/configure.json
+++ b/configure.json
@@ -247,11 +247,6 @@
"type": "compile",
"test": "common/c++1z"
},
- "cxx11default": {
- "label": "compiler defaulting to C++11 or higher",
- "type": "compile",
- "test": "common/c++98default"
- },
"precompile_header": {
"label": "precompiled header support",
"type": "compile",
@@ -469,11 +464,6 @@
"condition": "call.crossCompile",
"output": [ "publicConfig", "privateConfig", "publicFeature", "crossCompile" ]
},
- "cxx11default": {
- "label": "Compiler defaults to C++11 or higher",
- "condition": "!tests.cxx11default",
- "output": [ { "type": "publicConfig", "name": "c++11" } ]
- },
"compiler-flags": {
"output": [ "compilerFlags" ]
},
diff --git a/mkspecs/features/data/macros.cpp b/mkspecs/features/data/macros.cpp
index 88473fb980..e677dace12 100644
--- a/mkspecs/features/data/macros.cpp
+++ b/mkspecs/features/data/macros.cpp
@@ -1,4 +1,5 @@
// Keep this file small. The pre-processed contents are eval'd by qmake.
+QT_COMPILER_STDCXX = __cplusplus
#ifdef _MSC_VER
QMAKE_MSC_VER = _MSC_VER
QMAKE_MSC_FULL_VER = _MSC_FULL_VER
diff --git a/mkspecs/features/default_post.prf b/mkspecs/features/default_post.prf
index d1ec0ce637..6d6707d6bb 100644
--- a/mkspecs/features/default_post.prf
+++ b/mkspecs/features/default_post.prf
@@ -100,6 +100,11 @@ breakpad {
!isEmpty(QMAKE_STRIP):QMAKE_POST_LINK = $$QMAKE_POST_LINK$$escape_expand(\\n\\t)$$quote($$QMAKE_STRIP $$DEBUGFILENAME)
}
+!c++11:!c++14:!c++1z {
+ # Qt requires C++11 since 5.7, check if we need to force a compiler option
+ QT_COMPILER_STDCXX_no_L = $$replace(QT_COMPILER_STDCXX, "L$", "")
+ !greaterThan(QT_COMPILER_STDCXX_no_L, 199711): CONFIG += c++11
+}
c++11|c++14|c++1z {
# Disable special compiler flags for host builds
!host_build|!cross_compile {
diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf
index 6d96eaf689..46a9c5707a 100644
--- a/mkspecs/features/toolchain.prf
+++ b/mkspecs/features/toolchain.prf
@@ -137,6 +137,7 @@ unset(target_prefix)
# Populate QMAKE_COMPILER_DEFINES and some compatibility variables.
# The $$format_number() calls strip leading zeros to avoid misinterpretation as octal.
+QMAKE_COMPILER_DEFINES += __cplusplus=$$QT_COMPILER_STDCXX
!isEmpty(QMAKE_MSC_VER) {
QMAKE_COMPILER_DEFINES += _MSC_VER=$$QMAKE_MSC_VER _MSC_FULL_VER=$$QMAKE_MSC_FULL_VER
QT_MSVC_MAJOR_VERSION = $$replace(QMAKE_MSC_FULL_VER, "(..)(..)(.*)", "\\1")
diff --git a/mkspecs/linux-aarch64-gnu-g++/qmake.conf b/mkspecs/linux-aarch64-gnu-g++/qmake.conf
new file mode 100644
index 0000000000..2dc57b09fa
--- /dev/null
+++ b/mkspecs/linux-aarch64-gnu-g++/qmake.conf
@@ -0,0 +1,24 @@
+#
+# qmake configuration for building with aarch64-linux-gnu-g++
+#
+
+MAKEFILE_GENERATOR = UNIX
+CONFIG += incremental
+QMAKE_INCREMENTAL_STYLE = sublib
+
+include(../common/linux.conf)
+include(../common/gcc-base-unix.conf)
+include(../common/g++-unix.conf)
+
+# modifications to g++.conf
+QMAKE_CC = aarch64-linux-gnu-gcc
+QMAKE_CXX = aarch64-linux-gnu-g++
+QMAKE_LINK = aarch64-linux-gnu-g++
+QMAKE_LINK_SHLIB = aarch64-linux-gnu-g++
+
+# modifications to linux.conf
+QMAKE_AR = aarch64-linux-gnu-ar cqs
+QMAKE_OBJCOPY = aarch64-linux-gnu-objcopy
+QMAKE_NM = aarch64-linux-gnu-nm -P
+QMAKE_STRIP = aarch64-linux-gnu-strip
+load(qt_config)
diff --git a/config.tests/common/c++98default/c++98default.cpp b/mkspecs/linux-aarch64-gnu-g++/qplatformdefs.h
index 3ff92eda33..2697a75e44 100644
--- a/config.tests/common/c++98default/c++98default.cpp
+++ b/mkspecs/linux-aarch64-gnu-g++/qplatformdefs.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the configuration of the Qt Toolkit.
+** This file is part of the qmake spec of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -37,8 +37,4 @@
**
****************************************************************************/
-#if __cplusplus < 201103L
-#error "compiler does not use c++11 or higher by default"
-#endif
-
-int main(int, char **) {}
+#include "../linux-g++/qplatformdefs.h"
diff --git a/src/concurrent/qtconcurrentstoredfunctioncall.h b/src/concurrent/qtconcurrentstoredfunctioncall.h
index 750ece1ef1..eba6a1aad0 100644
--- a/src/concurrent/qtconcurrentstoredfunctioncall.h
+++ b/src/concurrent/qtconcurrentstoredfunctioncall.h
@@ -103,7 +103,7 @@ template <typename T, typename Class>
class StoredMemberFunctionCall0 : public RunFunctionTask<T>
{
public:
- StoredMemberFunctionCall0(T (Class::*_fn)() , const Class &_object)
+ StoredMemberFunctionCall0(T (Class::*_fn)(), const Class &_object)
: fn(_fn), object(_object){ }
void runFunctor() override
@@ -119,7 +119,7 @@ template <typename T, typename Class>
class VoidStoredMemberFunctionCall0 : public RunFunctionTask<T>
{
public:
- VoidStoredMemberFunctionCall0(T (Class::*_fn)() , const Class &_object)
+ VoidStoredMemberFunctionCall0(T (Class::*_fn)(), const Class &_object)
: fn(_fn), object(_object){ }
void runFunctor() override
@@ -150,7 +150,7 @@ public:
this->result = (object.*fn)();
}
private:
- T (Class::*fn)()const;
+ T (Class::*fn)() const;
const Class object;
};
@@ -166,7 +166,7 @@ public:
(object.*fn)();
}
private:
- T (Class::*fn)()const;
+ T (Class::*fn)() const;
const Class object;
};
@@ -181,7 +181,7 @@ template <typename T, typename Class>
class StoredMemberFunctionPointerCall0 : public RunFunctionTask<T>
{
public:
- StoredMemberFunctionPointerCall0(T (Class::*_fn)() , Class *_object)
+ StoredMemberFunctionPointerCall0(T (Class::*_fn)(), Class *_object)
: fn(_fn), object(_object){ }
void runFunctor() override
@@ -197,7 +197,7 @@ template <typename T, typename Class>
class VoidStoredMemberFunctionPointerCall0 : public RunFunctionTask<T>
{
public:
- VoidStoredMemberFunctionPointerCall0(T (Class::*_fn)() , Class *_object)
+ VoidStoredMemberFunctionPointerCall0(T (Class::*_fn)(), Class *_object)
: fn(_fn), object(_object){ }
void runFunctor() override
@@ -228,7 +228,7 @@ public:
this->result = (object->*fn)();
}
private:
- T (Class::*fn)()const;
+ T (Class::*fn)() const;
Class const *object;
};
@@ -244,7 +244,7 @@ public:
(object->*fn)();
}
private:
- T (Class::*fn)()const;
+ T (Class::*fn)() const;
Class const *object;
};
@@ -306,7 +306,7 @@ template <typename T, typename Class, typename Param1, typename Arg1>
class StoredMemberFunctionCall1 : public RunFunctionTask<T>
{
public:
- StoredMemberFunctionCall1(T (Class::*_fn)(Param1) , const Class &_object, const Arg1 &_arg1)
+ StoredMemberFunctionCall1(T (Class::*_fn)(Param1), const Class &_object, const Arg1 &_arg1)
: fn(_fn), object(_object), arg1(_arg1){ }
void runFunctor() override
@@ -322,7 +322,7 @@ template <typename T, typename Class, typename Param1, typename Arg1>
class VoidStoredMemberFunctionCall1 : public RunFunctionTask<T>
{
public:
- VoidStoredMemberFunctionCall1(T (Class::*_fn)(Param1) , const Class &_object, const Arg1 &_arg1)
+ VoidStoredMemberFunctionCall1(T (Class::*_fn)(Param1), const Class &_object, const Arg1 &_arg1)
: fn(_fn), object(_object), arg1(_arg1){ }
void runFunctor() override
@@ -353,7 +353,7 @@ public:
this->result = (object.*fn)(arg1);
}
private:
- T (Class::*fn)(Param1)const;
+ T (Class::*fn)(Param1) const;
const Class object;
Arg1 arg1;
};
@@ -369,7 +369,7 @@ public:
(object.*fn)(arg1);
}
private:
- T (Class::*fn)(Param1)const;
+ T (Class::*fn)(Param1) const;
const Class object;
Arg1 arg1;
};
@@ -384,7 +384,7 @@ template <typename T, typename Class, typename Param1, typename Arg1>
class StoredMemberFunctionPointerCall1 : public RunFunctionTask<T>
{
public:
- StoredMemberFunctionPointerCall1(T (Class::*_fn)(Param1) , Class *_object, const Arg1 &_arg1)
+ StoredMemberFunctionPointerCall1(T (Class::*_fn)(Param1), Class *_object, const Arg1 &_arg1)
: fn(_fn), object(_object), arg1(_arg1){ }
void runFunctor() override
@@ -400,7 +400,7 @@ template <typename T, typename Class, typename Param1, typename Arg1>
class VoidStoredMemberFunctionPointerCall1 : public RunFunctionTask<T>
{
public:
- VoidStoredMemberFunctionPointerCall1(T (Class::*_fn)(Param1) , Class *_object, const Arg1 &_arg1)
+ VoidStoredMemberFunctionPointerCall1(T (Class::*_fn)(Param1), Class *_object, const Arg1 &_arg1)
: fn(_fn), object(_object), arg1(_arg1){ }
void runFunctor() override
@@ -431,7 +431,7 @@ public:
this->result = (object->*fn)(arg1);
}
private:
- T (Class::*fn)(Param1)const;
+ T (Class::*fn)(Param1) const;
Class const *object;
Arg1 arg1;
};
@@ -447,7 +447,7 @@ public:
(object->*fn)(arg1);
}
private:
- T (Class::*fn)(Param1)const;
+ T (Class::*fn)(Param1) const;
Class const *object;
Arg1 arg1;
};
@@ -492,7 +492,7 @@ template <typename T, typename FunctionPointer, typename Arg1, typename Arg2>
struct VoidStoredFunctorPointerCall2: public RunFunctionTask<T>
{
inline VoidStoredFunctorPointerCall2(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2)
- : function(_function), arg1(_arg1), arg2(_arg2) {}
+ : function(_function), arg1(_arg1), arg2(_arg2) {}
void runFunctor() override { (*function)(arg1, arg2); }
FunctionPointer * function;
Arg1 arg1; Arg2 arg2;
@@ -509,7 +509,7 @@ template <typename T, typename Class, typename Param1, typename Arg1, typename P
class StoredMemberFunctionCall2 : public RunFunctionTask<T>
{
public:
- StoredMemberFunctionCall2(T (Class::*_fn)(Param1, Param2) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2)
+ StoredMemberFunctionCall2(T (Class::*_fn)(Param1, Param2), const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ }
void runFunctor() override
@@ -525,7 +525,7 @@ template <typename T, typename Class, typename Param1, typename Arg1, typename P
class VoidStoredMemberFunctionCall2 : public RunFunctionTask<T>
{
public:
- VoidStoredMemberFunctionCall2(T (Class::*_fn)(Param1, Param2) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2)
+ VoidStoredMemberFunctionCall2(T (Class::*_fn)(Param1, Param2), const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ }
void runFunctor() override
@@ -556,7 +556,7 @@ public:
this->result = (object.*fn)(arg1, arg2);
}
private:
- T (Class::*fn)(Param1, Param2)const;
+ T (Class::*fn)(Param1, Param2) const;
const Class object;
Arg1 arg1; Arg2 arg2;
};
@@ -572,7 +572,7 @@ public:
(object.*fn)(arg1, arg2);
}
private:
- T (Class::*fn)(Param1, Param2)const;
+ T (Class::*fn)(Param1, Param2) const;
const Class object;
Arg1 arg1; Arg2 arg2;
};
@@ -587,7 +587,7 @@ template <typename T, typename Class, typename Param1, typename Arg1, typename P
class StoredMemberFunctionPointerCall2 : public RunFunctionTask<T>
{
public:
- StoredMemberFunctionPointerCall2(T (Class::*_fn)(Param1, Param2) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2)
+ StoredMemberFunctionPointerCall2(T (Class::*_fn)(Param1, Param2), Class *_object, const Arg1 &_arg1, const Arg2 &_arg2)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ }
void runFunctor() override
@@ -603,7 +603,7 @@ template <typename T, typename Class, typename Param1, typename Arg1, typename P
class VoidStoredMemberFunctionPointerCall2 : public RunFunctionTask<T>
{
public:
- VoidStoredMemberFunctionPointerCall2(T (Class::*_fn)(Param1, Param2) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2)
+ VoidStoredMemberFunctionPointerCall2(T (Class::*_fn)(Param1, Param2), Class *_object, const Arg1 &_arg1, const Arg2 &_arg2)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2){ }
void runFunctor() override
@@ -634,7 +634,7 @@ public:
this->result = (object->*fn)(arg1, arg2);
}
private:
- T (Class::*fn)(Param1, Param2)const;
+ T (Class::*fn)(Param1, Param2) const;
Class const *object;
Arg1 arg1; Arg2 arg2;
};
@@ -650,7 +650,7 @@ public:
(object->*fn)(arg1, arg2);
}
private:
- T (Class::*fn)(Param1, Param2)const;
+ T (Class::*fn)(Param1, Param2) const;
Class const *object;
Arg1 arg1; Arg2 arg2;
};
@@ -712,7 +712,7 @@ template <typename T, typename Class, typename Param1, typename Arg1, typename P
class StoredMemberFunctionCall3 : public RunFunctionTask<T>
{
public:
- StoredMemberFunctionCall3(T (Class::*_fn)(Param1, Param2, Param3) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
+ StoredMemberFunctionCall3(T (Class::*_fn)(Param1, Param2, Param3), const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ }
void runFunctor() override
@@ -728,7 +728,7 @@ template <typename T, typename Class, typename Param1, typename Arg1, typename P
class VoidStoredMemberFunctionCall3 : public RunFunctionTask<T>
{
public:
- VoidStoredMemberFunctionCall3(T (Class::*_fn)(Param1, Param2, Param3) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
+ VoidStoredMemberFunctionCall3(T (Class::*_fn)(Param1, Param2, Param3), const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ }
void runFunctor() override
@@ -759,7 +759,7 @@ public:
this->result = (object.*fn)(arg1, arg2, arg3);
}
private:
- T (Class::*fn)(Param1, Param2, Param3)const;
+ T (Class::*fn)(Param1, Param2, Param3) const;
const Class object;
Arg1 arg1; Arg2 arg2; Arg3 arg3;
};
@@ -775,7 +775,7 @@ public:
(object.*fn)(arg1, arg2, arg3);
}
private:
- T (Class::*fn)(Param1, Param2, Param3)const;
+ T (Class::*fn)(Param1, Param2, Param3) const;
const Class object;
Arg1 arg1; Arg2 arg2; Arg3 arg3;
};
@@ -790,7 +790,7 @@ template <typename T, typename Class, typename Param1, typename Arg1, typename P
class StoredMemberFunctionPointerCall3 : public RunFunctionTask<T>
{
public:
- StoredMemberFunctionPointerCall3(T (Class::*_fn)(Param1, Param2, Param3) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
+ StoredMemberFunctionPointerCall3(T (Class::*_fn)(Param1, Param2, Param3), Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ }
void runFunctor() override
@@ -806,7 +806,7 @@ template <typename T, typename Class, typename Param1, typename Arg1, typename P
class VoidStoredMemberFunctionPointerCall3 : public RunFunctionTask<T>
{
public:
- VoidStoredMemberFunctionPointerCall3(T (Class::*_fn)(Param1, Param2, Param3) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
+ VoidStoredMemberFunctionPointerCall3(T (Class::*_fn)(Param1, Param2, Param3), Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3){ }
void runFunctor() override
@@ -837,7 +837,7 @@ public:
this->result = (object->*fn)(arg1, arg2, arg3);
}
private:
- T (Class::*fn)(Param1, Param2, Param3)const;
+ T (Class::*fn)(Param1, Param2, Param3) const;
Class const *object;
Arg1 arg1; Arg2 arg2; Arg3 arg3;
};
@@ -853,7 +853,7 @@ public:
(object->*fn)(arg1, arg2, arg3);
}
private:
- T (Class::*fn)(Param1, Param2, Param3)const;
+ T (Class::*fn)(Param1, Param2, Param3) const;
Class const *object;
Arg1 arg1; Arg2 arg2; Arg3 arg3;
};
@@ -915,7 +915,7 @@ template <typename T, typename Class, typename Param1, typename Arg1, typename P
class StoredMemberFunctionCall4 : public RunFunctionTask<T>
{
public:
- StoredMemberFunctionCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
+ StoredMemberFunctionCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4), const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ }
void runFunctor() override
@@ -931,7 +931,7 @@ template <typename T, typename Class, typename Param1, typename Arg1, typename P
class VoidStoredMemberFunctionCall4 : public RunFunctionTask<T>
{
public:
- VoidStoredMemberFunctionCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
+ VoidStoredMemberFunctionCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4), const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ }
void runFunctor() override
@@ -962,7 +962,7 @@ public:
this->result = (object.*fn)(arg1, arg2, arg3, arg4);
}
private:
- T (Class::*fn)(Param1, Param2, Param3, Param4)const;
+ T (Class::*fn)(Param1, Param2, Param3, Param4) const;
const Class object;
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4;
};
@@ -978,7 +978,7 @@ public:
(object.*fn)(arg1, arg2, arg3, arg4);
}
private:
- T (Class::*fn)(Param1, Param2, Param3, Param4)const;
+ T (Class::*fn)(Param1, Param2, Param3, Param4) const;
const Class object;
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4;
};
@@ -993,7 +993,7 @@ template <typename T, typename Class, typename Param1, typename Arg1, typename P
class StoredMemberFunctionPointerCall4 : public RunFunctionTask<T>
{
public:
- StoredMemberFunctionPointerCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
+ StoredMemberFunctionPointerCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4), Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ }
void runFunctor() override
@@ -1009,7 +1009,7 @@ template <typename T, typename Class, typename Param1, typename Arg1, typename P
class VoidStoredMemberFunctionPointerCall4 : public RunFunctionTask<T>
{
public:
- VoidStoredMemberFunctionPointerCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
+ VoidStoredMemberFunctionPointerCall4(T (Class::*_fn)(Param1, Param2, Param3, Param4), Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4){ }
void runFunctor() override
@@ -1040,7 +1040,7 @@ public:
this->result = (object->*fn)(arg1, arg2, arg3, arg4);
}
private:
- T (Class::*fn)(Param1, Param2, Param3, Param4)const;
+ T (Class::*fn)(Param1, Param2, Param3, Param4) const;
Class const *object;
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4;
};
@@ -1056,7 +1056,7 @@ public:
(object->*fn)(arg1, arg2, arg3, arg4);
}
private:
- T (Class::*fn)(Param1, Param2, Param3, Param4)const;
+ T (Class::*fn)(Param1, Param2, Param3, Param4) const;
Class const *object;
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4;
};
@@ -1102,7 +1102,7 @@ struct VoidStoredFunctorPointerCall5: public RunFunctionTask<T>
{
inline VoidStoredFunctorPointerCall5(FunctionPointer * _function, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
: function(_function), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5) {}
- void runFunctor() override {(*function)(arg1, arg2, arg3, arg4, arg5); }
+ void runFunctor() override { (*function)(arg1, arg2, arg3, arg4, arg5); }
FunctionPointer * function;
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5;
};
@@ -1118,7 +1118,7 @@ template <typename T, typename Class, typename Param1, typename Arg1, typename P
class StoredMemberFunctionCall5 : public RunFunctionTask<T>
{
public:
- StoredMemberFunctionCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
+ StoredMemberFunctionCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5), const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ }
void runFunctor() override
@@ -1134,7 +1134,7 @@ template <typename T, typename Class, typename Param1, typename Arg1, typename P
class VoidStoredMemberFunctionCall5 : public RunFunctionTask<T>
{
public:
- VoidStoredMemberFunctionCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) , const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
+ VoidStoredMemberFunctionCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5), const Class &_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ }
void runFunctor() override
@@ -1165,7 +1165,7 @@ public:
this->result = (object.*fn)(arg1, arg2, arg3, arg4, arg5);
}
private:
- T (Class::*fn)(Param1, Param2, Param3, Param4, Param5)const;
+ T (Class::*fn)(Param1, Param2, Param3, Param4, Param5) const;
const Class object;
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5;
};
@@ -1181,7 +1181,7 @@ public:
(object.*fn)(arg1, arg2, arg3, arg4, arg5);
}
private:
- T (Class::*fn)(Param1, Param2, Param3, Param4, Param5)const;
+ T (Class::*fn)(Param1, Param2, Param3, Param4, Param5) const;
const Class object;
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5;
};
@@ -1196,7 +1196,7 @@ template <typename T, typename Class, typename Param1, typename Arg1, typename P
class StoredMemberFunctionPointerCall5 : public RunFunctionTask<T>
{
public:
- StoredMemberFunctionPointerCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
+ StoredMemberFunctionPointerCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5), Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ }
void runFunctor() override
@@ -1212,7 +1212,7 @@ template <typename T, typename Class, typename Param1, typename Arg1, typename P
class VoidStoredMemberFunctionPointerCall5 : public RunFunctionTask<T>
{
public:
- VoidStoredMemberFunctionPointerCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5) , Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
+ VoidStoredMemberFunctionPointerCall5(T (Class::*_fn)(Param1, Param2, Param3, Param4, Param5), Class *_object, const Arg1 &_arg1, const Arg2 &_arg2, const Arg3 &_arg3, const Arg4 &_arg4, const Arg5 &_arg5)
: fn(_fn), object(_object), arg1(_arg1), arg2(_arg2), arg3(_arg3), arg4(_arg4), arg5(_arg5){ }
void runFunctor() override
@@ -1243,7 +1243,7 @@ public:
this->result = (object->*fn)(arg1, arg2, arg3, arg4, arg5);
}
private:
- T (Class::*fn)(Param1, Param2, Param3, Param4, Param5)const;
+ T (Class::*fn)(Param1, Param2, Param3, Param4, Param5) const;
Class const *object;
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5;
};
@@ -1259,7 +1259,7 @@ public:
(object->*fn)(arg1, arg2, arg3, arg4, arg5);
}
private:
- T (Class::*fn)(Param1, Param2, Param3, Param4, Param5)const;
+ T (Class::*fn)(Param1, Param2, Param3, Param4, Param5) const;
Class const *object;
Arg1 arg1; Arg2 arg2; Arg3 arg3; Arg4 arg4; Arg5 arg5;
};
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 8a8d781cf8..fcfe020509 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -1329,15 +1329,14 @@
Q_ASSUME_IMPL(valueOfExpression);\
} while (0)
+#if defined(__cplusplus)
#if QT_HAS_CPP_ATTRIBUTE(fallthrough)
# define Q_FALLTHROUGH() [[fallthrough]]
-#elif defined(__cplusplus)
-/* Clang can not parse namespaced attributes in C mode, but defines __has_cpp_attribute */
-# if QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
+#elif QT_HAS_CPP_ATTRIBUTE(clang::fallthrough)
# define Q_FALLTHROUGH() [[clang::fallthrough]]
-# elif QT_HAS_CPP_ATTRIBUTE(gnu::fallthrough)
+#elif QT_HAS_CPP_ATTRIBUTE(gnu::fallthrough)
# define Q_FALLTHROUGH() [[gnu::fallthrough]]
-# endif
+#endif
#endif
#ifndef Q_FALLTHROUGH
# if defined(Q_CC_GNU) && Q_CC_GNU >= 700
diff --git a/src/corelib/global/qmalloc.cpp b/src/corelib/global/qmalloc.cpp
index f83cecd499..05676a0da2 100644
--- a/src/corelib/global/qmalloc.cpp
+++ b/src/corelib/global/qmalloc.cpp
@@ -40,6 +40,7 @@
#include "qplatformdefs.h"
#include <stdlib.h>
+#include <string.h>
/*
Define the container allocation functions in a separate file, so that our
@@ -79,8 +80,6 @@ void *qMallocAligned(size_t size, size_t alignment)
void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t alignment)
{
// fake an aligned allocation
- Q_UNUSED(oldsize);
-
void *actualptr = oldptr ? static_cast<void **>(oldptr)[-1] : 0;
if (alignment <= sizeof(void*)) {
// special, fast case
@@ -110,9 +109,15 @@ void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t align
quintptr faked = reinterpret_cast<quintptr>(real) + alignment;
faked &= ~(alignment - 1);
-
void **faked_ptr = reinterpret_cast<void **>(faked);
+ if (oldptr) {
+ qptrdiff oldoffset = static_cast<char *>(oldptr) - static_cast<char *>(actualptr);
+ qptrdiff newoffset = reinterpret_cast<char *>(faked_ptr) - static_cast<char *>(real);
+ if (oldoffset != newoffset)
+ memmove(faked_ptr, static_cast<char *>(real) + oldoffset, qMin(oldsize, newsize));
+ }
+
// now save the value of the real pointer at faked-sizeof(void*)
// by construction, alignment > sizeof(void*) and is a power of 2, so
// faked-sizeof(void*) is properly aligned for a pointer
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 3674ebc1a1..d88f469e0f 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -526,7 +526,7 @@ public:
static bool load(QDataStream &stream, int type, void *data);
#endif
- explicit QMetaType(const int type);
+ explicit QMetaType(const int type); // ### Qt6: drop const
inline ~QMetaType();
inline bool isValid() const;
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index c0e5f2f591..a2c5711993 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -464,7 +464,7 @@ public:
void create(int type, const void *copy);
bool cmp(const QVariant &other) const;
int compare(const QVariant &other) const;
- bool convert(const int t, void *ptr) const;
+ bool convert(const int t, void *ptr) const; // ### Qt6: drop const
private:
// force compile error, prevent QVariant(bool) to be called
diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp
index 08f89d2f02..963a91b9a9 100644
--- a/src/corelib/tools/qcryptographichash.cpp
+++ b/src/corelib/tools/qcryptographichash.cpp
@@ -180,9 +180,45 @@ public:
SHA3Context sha3Context;
#endif
};
+#ifndef QT_CRYPTOGRAPHICHASH_ONLY_SHA1
+ void sha3Finish(int bitCount);
+#endif
QByteArray result;
};
+#ifndef QT_CRYPTOGRAPHICHASH_ONLY_SHA1
+void QCryptographicHashPrivate::sha3Finish(int bitCount)
+{
+ /*
+ FIPS 202 §6.1 defines SHA-3 in terms of calculating the Keccak function
+ over the original message with the two-bit suffix "01" appended to it.
+ This variable stores that suffix (and it's fed into the calculations
+ when the hash is returned to users).
+
+ Only 2 bits of this variable are actually used (see the call to sha3Update
+ below). The Keccak implementation we're using will actually use the
+ *leftmost* 2 bits, and interpret them right-to-left. In other words, the
+ bits must appear in order of *increasing* significance; and as the two most
+ significant bits of the byte -- the rightmost 6 are ignored. (Yes, this
+ seems self-contradictory, but it's the way it is...)
+
+ Overall, this means:
+ * the leftmost two bits must be "10" (not "01"!);
+ * we don't care what the other six bits are set to (they can be set to
+ any value), but we arbitrarily set them to 0;
+
+ and for an unsigned char this gives us 0b10'00'00'00, or 0x80.
+ */
+ static const unsigned char sha3FinalSuffix = 0x80;
+
+ result.resize(bitCount / 8);
+
+ SHA3Context copy = sha3Context;
+ sha3Update(&copy, reinterpret_cast<const BitSequence *>(&sha3FinalSuffix), 2);
+ sha3Final(&copy, reinterpret_cast<BitSequence *>(result.data()));
+}
+#endif
+
/*!
\class QCryptographicHash
\inmodule QtCore
@@ -196,7 +232,8 @@ public:
QCryptographicHash can be used to generate cryptographic hashes of binary or text data.
- Currently MD4, MD5, SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512 are supported.
+ Refer to the documentation of the \l QCryptographicHash::Algorithm enum for a
+ list of the supported algorithms.
*/
/*!
@@ -426,27 +463,19 @@ QByteArray QCryptographicHash::result() const
break;
}
case Sha3_224: {
- SHA3Context copy = d->sha3Context;
- d->result.resize(224/8);
- sha3Final(&copy, reinterpret_cast<BitSequence *>(d->result.data()));
+ d->sha3Finish(224);
break;
}
case Sha3_256: {
- SHA3Context copy = d->sha3Context;
- d->result.resize(256/8);
- sha3Final(&copy, reinterpret_cast<BitSequence *>(d->result.data()));
+ d->sha3Finish(256);
break;
}
case Sha3_384: {
- SHA3Context copy = d->sha3Context;
- d->result.resize(384/8);
- sha3Final(&copy, reinterpret_cast<BitSequence *>(d->result.data()));
+ d->sha3Finish(384);
break;
}
case Sha3_512: {
- SHA3Context copy = d->sha3Context;
- d->result.resize(512/8);
- sha3Final(&copy, reinterpret_cast<BitSequence *>(d->result.data()));
+ d->sha3Finish(512);
break;
}
#endif
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index ab5a2944bf..57e80ae125 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -291,6 +291,7 @@ public:
private:
friend class QRegion; // Optimization for QRegion::rects()
+ // ### Qt6: remove const from int parameters
void reallocData(const int size, const int alloc, QArrayData::AllocationOptions options = QArrayData::Default);
void reallocData(const int sz) { reallocData(sz, d->alloc); }
void freeData(Data *d);
diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h
index b62cc9ac39..9ef95c1fbe 100644
--- a/src/corelib/xml/qxmlstream_p.h
+++ b/src/corelib/xml/qxmlstream_p.h
@@ -1139,6 +1139,7 @@ bool QXmlStreamReaderPrivate::parse()
case '\n':
++lineNumber;
lastLineStart = characterOffset + readBufferPos;
+ Q_FALLTHROUGH();
case ' ':
case '\t':
token = SPACE;
diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp
index 9545abfd21..324fe01414 100644
--- a/src/gui/image/qbmphandler.cpp
+++ b/src/gui/image/qbmphandler.cpp
@@ -183,14 +183,14 @@ static bool read_dib_infoheader(QDataStream &s, BMP_INFOHDR &bi)
return true;
}
-static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int startpos, QImage &image)
+static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, qint64 offset, qint64 startpos, QImage &image)
{
QIODevice* d = s.device();
if (d->atEnd()) // end of stream/file
return false;
#if 0
- qDebug("offset...........%d", offset);
- qDebug("startpos.........%d", startpos);
+ qDebug("offset...........%lld", offset);
+ qDebug("startpos.........%lld", startpos);
qDebug("biSize...........%d", bi.biSize);
qDebug("biWidth..........%d", bi.biWidth);
qDebug("biHeight.........%d", bi.biHeight);
diff --git a/src/gui/image/qbmphandler_p.h b/src/gui/image/qbmphandler_p.h
index 7d3cbab322..3e1fc3d511 100644
--- a/src/gui/image/qbmphandler_p.h
+++ b/src/gui/image/qbmphandler_p.h
@@ -121,7 +121,7 @@ private:
State state;
BMP_FILEHDR fileHeader;
BMP_INFOHDR infoHeader;
- int startpos;
+ qint64 startpos;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 8aea593bf0..3dc06ae60e 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -982,6 +982,40 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
QOpenGLContext *previous = QOpenGLContextPrivate::setCurrentContext(this);
if (d->platformGLContext->makeCurrent(surface->surfaceHandle())) {
+ static bool needsWorkaroundSet = false;
+ static bool needsWorkaround = false;
+
+ if (!needsWorkaroundSet) {
+ QByteArray env;
+#ifdef Q_OS_ANDROID
+ env = qgetenv(QByteArrayLiteral("QT_ANDROID_DISABLE_GLYPH_CACHE_WORKAROUND"));
+ needsWorkaround = env.isEmpty() || env == QByteArrayLiteral("0") || env == QByteArrayLiteral("false");
+#endif
+ env = qgetenv(QByteArrayLiteral("QT_ENABLE_GLYPH_CACHE_WORKAROUND"));
+ if (env == QByteArrayLiteral("1") || env == QByteArrayLiteral("true"))
+ needsWorkaround = true;
+
+ if (!needsWorkaround) {
+ const char *rendererString = reinterpret_cast<const char *>(functions()->glGetString(GL_RENDERER));
+ if (rendererString)
+ needsWorkaround =
+ qstrncmp(rendererString, "Mali-4xx", 6) == 0 // Mali-400, Mali-450
+ || qstrncmp(rendererString, "Adreno (TM) 2xx", 13) == 0 // Adreno 200, 203, 205
+ || qstrncmp(rendererString, "Adreno 2xx", 8) == 0 // Same as above but without the '(TM)'
+ || qstrncmp(rendererString, "Adreno (TM) 30x", 14) == 0 // Adreno 302, 305
+ || qstrncmp(rendererString, "Adreno 30x", 9) == 0 // Same as above but without the '(TM)'
+ || qstrncmp(rendererString, "Adreno (TM) 4xx", 13) == 0 // Adreno 405, 418, 420, 430
+ || qstrncmp(rendererString, "Adreno 4xx", 8) == 0 // Same as above but without the '(TM)'
+ || qstrcmp(rendererString, "GC800 core") == 0
+ || qstrcmp(rendererString, "GC1000 core") == 0
+ || qstrcmp(rendererString, "Immersion.16") == 0;
+ }
+ needsWorkaroundSet = true;
+ }
+
+ if (needsWorkaround)
+ d->workaround_brokenFBOReadBack = true;
+
d->surface = surface;
d->shareGroup->d_func()->deletePendingResources(this);
diff --git a/src/gui/painting/qblendfunctions_p.h b/src/gui/painting/qblendfunctions_p.h
index 7ee04987fe..167f725143 100644
--- a/src/gui/painting/qblendfunctions_p.h
+++ b/src/gui/painting/qblendfunctions_p.h
@@ -375,12 +375,12 @@ void qt_transform_image_rasterize(DestT *destPixels, int dbpl,
--ii;
}
switch (i & 7) {
- case 7: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line;
- case 6: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line;
- case 5: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line;
- case 4: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line;
- case 3: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line;
- case 2: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line;
+ case 7: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line; Q_FALLTHROUGH();
+ case 6: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line; Q_FALLTHROUGH();
+ case 5: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line; Q_FALLTHROUGH();
+ case 4: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line; Q_FALLTHROUGH();
+ case 3: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line; Q_FALLTHROUGH();
+ case 2: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line; Q_FALLTHROUGH();
case 1: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line;
}
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index cf2213042d..1f97621171 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -833,13 +833,13 @@ inline void qt_memfill(T *dest, T value, int count)
int n = (count + 7) / 8;
switch (count & 0x07)
{
- case 0: do { *dest++ = value;
- case 7: *dest++ = value;
- case 6: *dest++ = value;
- case 5: *dest++ = value;
- case 4: *dest++ = value;
- case 3: *dest++ = value;
- case 2: *dest++ = value;
+ case 0: do { *dest++ = value; Q_FALLTHROUGH();
+ case 7: *dest++ = value; Q_FALLTHROUGH();
+ case 6: *dest++ = value; Q_FALLTHROUGH();
+ case 5: *dest++ = value; Q_FALLTHROUGH();
+ case 4: *dest++ = value; Q_FALLTHROUGH();
+ case 3: *dest++ = value; Q_FALLTHROUGH();
+ case 2: *dest++ = value; Q_FALLTHROUGH();
case 1: *dest++ = value;
} while (--n > 0);
}
@@ -875,13 +875,13 @@ do { \
int n = ((length) + 7) / 8; \
switch ((length) & 0x07) \
{ \
- case 0: do { *--_d = *--_s; \
- case 7: *--_d = *--_s; \
- case 6: *--_d = *--_s; \
- case 5: *--_d = *--_s; \
- case 4: *--_d = *--_s; \
- case 3: *--_d = *--_s; \
- case 2: *--_d = *--_s; \
+ case 0: do { *--_d = *--_s; Q_FALLTHROUGH(); \
+ case 7: *--_d = *--_s; Q_FALLTHROUGH(); \
+ case 6: *--_d = *--_s; Q_FALLTHROUGH(); \
+ case 5: *--_d = *--_s; Q_FALLTHROUGH(); \
+ case 4: *--_d = *--_s; Q_FALLTHROUGH(); \
+ case 3: *--_d = *--_s; Q_FALLTHROUGH(); \
+ case 2: *--_d = *--_s; Q_FALLTHROUGH(); \
case 1: *--_d = *--_s; \
} while (--n > 0); \
} \
@@ -895,13 +895,13 @@ do { \
int n = ((length) + 7) / 8; \
switch ((length) & 0x07) \
{ \
- case 0: do { *_d++ = *_s++; \
- case 7: *_d++ = *_s++; \
- case 6: *_d++ = *_s++; \
- case 5: *_d++ = *_s++; \
- case 4: *_d++ = *_s++; \
- case 3: *_d++ = *_s++; \
- case 2: *_d++ = *_s++; \
+ case 0: do { *_d++ = *_s++; Q_FALLTHROUGH(); \
+ case 7: *_d++ = *_s++; Q_FALLTHROUGH(); \
+ case 6: *_d++ = *_s++; Q_FALLTHROUGH(); \
+ case 5: *_d++ = *_s++; Q_FALLTHROUGH(); \
+ case 4: *_d++ = *_s++; Q_FALLTHROUGH(); \
+ case 3: *_d++ = *_s++; Q_FALLTHROUGH(); \
+ case 2: *_d++ = *_s++; Q_FALLTHROUGH(); \
case 1: *_d++ = *_s++; \
} while (--n > 0); \
} \
diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c
index db3453898f..dae1c06bec 100644
--- a/src/gui/painting/qgrayraster.c
+++ b/src/gui/painting/qgrayraster.c
@@ -162,6 +162,8 @@
#include <private/qrasterdefs_p.h>
#include <private/qgrayraster_p.h>
+#include <qcompilerdetection.h>
+
#include <stdlib.h>
#include <stdio.h>
@@ -1147,12 +1149,12 @@
switch ( spans->len )
{
- case 7: *q++ = (unsigned char)coverage;
- case 6: *q++ = (unsigned char)coverage;
- case 5: *q++ = (unsigned char)coverage;
- case 4: *q++ = (unsigned char)coverage;
- case 3: *q++ = (unsigned char)coverage;
- case 2: *q++ = (unsigned char)coverage;
+ case 7: *q++ = (unsigned char)coverage; Q_FALLTHROUGH();
+ case 6: *q++ = (unsigned char)coverage; Q_FALLTHROUGH();
+ case 5: *q++ = (unsigned char)coverage; Q_FALLTHROUGH();
+ case 4: *q++ = (unsigned char)coverage; Q_FALLTHROUGH();
+ case 3: *q++ = (unsigned char)coverage; Q_FALLTHROUGH();
+ case 2: *q++ = (unsigned char)coverage; Q_FALLTHROUGH();
case 1: *q = (unsigned char)coverage;
default:
;
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index ca3e3ac362..afeb198953 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -2565,6 +2565,7 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti)
qreal size = ti.fontEngine->fontDef.pixelSize;
int synthesized = ti.fontEngine->synthesized();
qreal stretch = synthesized & QFontEngine::SynthesizedStretch ? ti.fontEngine->fontDef.stretch/100. : 1.;
+ Q_ASSERT(stretch > qreal(0));
QTransform trans;
// Build text rendering matrix (Trm). We need it to map the text area to user
@@ -2641,6 +2642,7 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti)
return;
int synthesized = ti.fontEngine->synthesized();
qreal stretch = synthesized & QFontEngine::SynthesizedStretch ? ti.fontEngine->fontDef.stretch/100. : 1.;
+ Q_ASSERT(stretch > qreal(0));
*currentPage << "BT\n"
<< "/F" << font->object_id << size << "Tf "
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 673f64fbca..7f06915444 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -2094,7 +2094,8 @@ QTransform::TransformationType QTransform::type() const
if (!qFuzzyIsNull(m_13) || !qFuzzyIsNull(m_23) || !qFuzzyIsNull(m_33 - 1)) {
m_type = TxProject;
break;
- }
+ }
+ Q_FALLTHROUGH();
case TxShear:
case TxRotate:
if (!qFuzzyIsNull(affine._m12) || !qFuzzyIsNull(affine._m21)) {
@@ -2105,16 +2106,19 @@ QTransform::TransformationType QTransform::type() const
m_type = TxShear;
break;
}
+ Q_FALLTHROUGH();
case TxScale:
if (!qFuzzyIsNull(affine._m11 - 1) || !qFuzzyIsNull(affine._m22 - 1)) {
m_type = TxScale;
break;
}
+ Q_FALLTHROUGH();
case TxTranslate:
if (!qFuzzyIsNull(affine._dx) || !qFuzzyIsNull(affine._dy)) {
m_type = TxTranslate;
break;
}
+ Q_FALLTHROUGH();
case TxNone:
m_type = TxNone;
break;
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index f3ed8ef63a..4d24fb50af 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -579,12 +579,14 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
else
eor = current;
status.eor = QChar::DirEN;
- dir = QChar::DirAN; break;
+ dir = QChar::DirAN;
+ break;
case QChar::DirES:
case QChar::DirCS:
if(status.eor == QChar::DirEN || dir == QChar::DirAN) {
eor = current; break;
}
+ Q_FALLTHROUGH();
case QChar::DirBN:
case QChar::DirB:
case QChar::DirS:
@@ -614,11 +616,13 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
eor = current; status.eor = dirCurrent;
}
}
+ break;
default:
break;
}
break;
}
+ Q_FALLTHROUGH();
case QChar::DirAN:
hasBidi = true;
dirCurrent = QChar::DirAN;
@@ -642,6 +646,7 @@ static bool bidiItemize(QTextEngine *engine, QScriptAnalysis *analysis, QBidiCon
if(status.eor == QChar::DirAN) {
eor = current; break;
}
+ Q_FALLTHROUGH();
case QChar::DirES:
case QChar::DirET:
case QChar::DirBN:
diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
index 3895681507..39b6814a57 100644
--- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
+++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
@@ -742,6 +742,7 @@ QFontEngineFT *QFontEngineFT::create(const QByteArray &fontData, qreal pixelSize
{
QFontDef fontDef;
fontDef.pixelSize = pixelSize;
+ fontDef.stretch = QFont::Unstretched;
fontDef.hintingPreference = hintingPreference;
QFontEngineFTRawData *fe = new QFontEngineFTRawData(fontDef);
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp
index 5f55dba9da..6e95fb5a05 100644
--- a/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp
+++ b/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp
@@ -1281,6 +1281,7 @@ QFontEngine *QWindowsMultiFontEngine::loadEngine(int at)
fedw->fontDef.style = fontEngine->fontDef.style;
fedw->fontDef.family = fam;
fedw->fontDef.hintingPreference = fontEngine->fontDef.hintingPreference;
+ fedw->fontDef.stretch = fontEngine->fontDef.stretch;
return fedw;
} else {
qErrnoWarning("%s: CreateFontFace failed", __FUNCTION__);
@@ -1298,6 +1299,7 @@ QFontEngine *QWindowsMultiFontEngine::loadEngine(int at)
fe->fontDef.style = fontEngine->fontDef.style;
fe->fontDef.family = fam;
fe->fontDef.hintingPreference = fontEngine->fontDef.hintingPreference;
+ fe->fontDef.stretch = fontEngine->fontDef.stretch;
return fe;
}
diff --git a/src/platformsupport/graphics/qrasterbackingstore.cpp b/src/platformsupport/graphics/qrasterbackingstore.cpp
index ef26edc494..2f7074403c 100644
--- a/src/platformsupport/graphics/qrasterbackingstore.cpp
+++ b/src/platformsupport/graphics/qrasterbackingstore.cpp
@@ -42,6 +42,9 @@
#include <QtGui/qbackingstore.h>
#include <QtGui/qpainter.h>
+#include <private/qhighdpiscaling_p.h>
+#include <qpa/qplatformwindow.h>
+
QT_BEGIN_NAMESPACE
QRasterBackingStore::QRasterBackingStore(QWindow *window)
@@ -57,14 +60,14 @@ void QRasterBackingStore::resize(const QSize &size, const QRegion &staticContent
{
Q_UNUSED(staticContents);
- int windowDevicePixelRatio = window()->devicePixelRatio();
- QSize effectiveBufferSize = size * windowDevicePixelRatio;
+ qreal nativeWindowDevicePixelRatio = window()->handle()->devicePixelRatio();
+ QSize effectiveBufferSize = size * nativeWindowDevicePixelRatio;
if (m_image.size() == effectiveBufferSize)
return;
m_image = QImage(effectiveBufferSize, format());
- m_image.setDevicePixelRatio(windowDevicePixelRatio);
+ m_image.setDevicePixelRatio(nativeWindowDevicePixelRatio);
if (m_image.format() == QImage::Format_ARGB32_Premultiplied)
m_image.fill(Qt::transparent);
}
@@ -106,8 +109,11 @@ bool QRasterBackingStore::scroll(const QRegion &region, int dx, int dy)
void QRasterBackingStore::beginPaint(const QRegion &region)
{
// Keep backing store device pixel ratio in sync with window
- if (m_image.devicePixelRatio() != window()->devicePixelRatio())
- resize(backingStore()->size(), backingStore()->staticContents());
+ qreal nativeWindowDevicePixelRatio = window()->handle()->devicePixelRatio();
+ if (m_image.devicePixelRatio() != nativeWindowDevicePixelRatio) {
+ const QSize nativeSize = QHighDpi::toNativePixels(backingStore()->size(), window());
+ resize(nativeSize, backingStore()->staticContents());
+ }
if (!m_image.hasAlphaChannel())
return;
diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
index d3810329c5..89ac0cbd93 100644
--- a/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
+++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
@@ -67,42 +67,11 @@ void QAndroidPlatformOpenGLContext::swapBuffers(QPlatformSurface *surface)
QEGLPlatformContext::swapBuffers(surface);
}
-bool QAndroidPlatformOpenGLContext::needsFBOReadBackWorkaround()
-{
- static bool set = false;
- static bool needsWorkaround = false;
-
- if (!set) {
- QByteArray env = qgetenv("QT_ANDROID_DISABLE_GLYPH_CACHE_WORKAROUND");
- needsWorkaround = env.isEmpty() || env == "0" || env == "false";
-
- if (!needsWorkaround) {
- const char *rendererString = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
- needsWorkaround =
- qstrncmp(rendererString, "Mali-4xx", 6) == 0 // Mali-400, Mali-450
- || qstrncmp(rendererString, "Adreno (TM) 2xx", 13) == 0 // Adreno 200, 203, 205
- || qstrncmp(rendererString, "Adreno 2xx", 8) == 0 // Same as above but without the '(TM)'
- || qstrncmp(rendererString, "Adreno (TM) 30x", 14) == 0 // Adreno 302, 305
- || qstrncmp(rendererString, "Adreno 30x", 9) == 0 // Same as above but without the '(TM)'
- || qstrcmp(rendererString, "GC800 core") == 0
- || qstrcmp(rendererString, "GC1000 core") == 0
- || qstrcmp(rendererString, "Immersion.16") == 0;
- }
-
- set = true;
- }
-
- return needsWorkaround;
-}
-
bool QAndroidPlatformOpenGLContext::makeCurrent(QPlatformSurface *surface)
{
bool ret = QEGLPlatformContext::makeCurrent(surface);
QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(context());
- if (!ctx_d->workaround_brokenFBOReadBack && needsFBOReadBackWorkaround())
- ctx_d->workaround_brokenFBOReadBack = true;
-
return ret;
}
diff --git a/src/plugins/platforms/android/qandroidplatformopenglcontext.h b/src/plugins/platforms/android/qandroidplatformopenglcontext.h
index 3897b3166b..8e65b4cc36 100644
--- a/src/plugins/platforms/android/qandroidplatformopenglcontext.h
+++ b/src/plugins/platforms/android/qandroidplatformopenglcontext.h
@@ -55,7 +55,6 @@ public:
private:
EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) override;
- static bool needsFBOReadBackWorkaround();
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 7f3567a2f2..5c15a9cbcb 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -1358,9 +1358,9 @@ void QXcbEventReader::unlock()
m_mutex.unlock();
}
-void QXcbConnection::setFocusWindow(QXcbWindow *w)
+void QXcbConnection::setFocusWindow(QWindow *w)
{
- m_focusWindow = w;
+ m_focusWindow = w ? static_cast<QXcbWindow *>(w->handle()) : nullptr;
}
void QXcbConnection::setMouseGrabber(QXcbWindow *w)
{
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index ffd0c87a3e..6089265304 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -480,7 +480,7 @@ public:
Qt::MouseButton translateMouseButton(xcb_button_t s);
QXcbWindow *focusWindow() const { return m_focusWindow; }
- void setFocusWindow(QXcbWindow *);
+ void setFocusWindow(QWindow *);
QXcbWindow *mouseGrabber() const { return m_mouseGrabber; }
void setMouseGrabber(QXcbWindow *);
QXcbWindow *mousePressWindow() const { return m_mousePressWindow; }
diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp
index 186f31e08a..2848446098 100644
--- a/src/plugins/platforms/xcb/qxcbmime.cpp
+++ b/src/plugins/platforms/xcb/qxcbmime.cpp
@@ -44,12 +44,6 @@
#include <QtCore/QBuffer>
#include <qdebug.h>
-#include <X11/Xutil.h>
-
-#undef XCB_ATOM_STRING
-#undef XCB_ATOM_PIXMAP
-#undef XCB_ATOM_BITMAP
-
QT_BEGIN_NAMESPACE
#if !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD))
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index a79696f758..6365a6e9cb 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -923,7 +923,7 @@ void QXcbWindow::doFocusIn()
if (relayFocusToModalWindow())
return;
QWindow *w = static_cast<QWindowPrivate *>(QObjectPrivate::get(window()))->eventReceiver();
- connection()->setFocusWindow(static_cast<QXcbWindow *>(w->handle()));
+ connection()->setFocusWindow(w);
QWindowSystemInterface::handleWindowActivated(w, Qt::ActiveWindowFocusReason);
}
@@ -931,7 +931,7 @@ static bool focusInPeeker(QXcbConnection *connection, xcb_generic_event_t *event
{
if (!event) {
// FocusIn event is not in the queue, proceed with FocusOut normally.
- QWindowSystemInterface::handleWindowActivated(0, Qt::ActiveWindowFocusReason);
+ QWindowSystemInterface::handleWindowActivated(nullptr, Qt::ActiveWindowFocusReason);
return true;
}
uint response_type = event->response_type & ~0x80;
@@ -956,12 +956,10 @@ static bool focusInPeeker(QXcbConnection *connection, xcb_generic_event_t *event
void QXcbWindow::doFocusOut()
{
- if (relayFocusToModalWindow())
- return;
- connection()->setFocusWindow(0);
- // Do not set the active window to 0 if there is a FocusIn coming.
- // There is however no equivalent for XPutBackEvent so register a
- // callback for QXcbConnection instead.
+ connection()->setFocusWindow(nullptr);
+ relayFocusToModalWindow();
+ // Do not set the active window to nullptr if there is a FocusIn coming.
+ // The FocusIn handler will update QXcbConnection::setFocusWindow() accordingly.
connection()->addPeekFunc(focusInPeeker);
}
@@ -2813,14 +2811,14 @@ void QXcbWindow::handleXEmbedMessage(const xcb_client_message_event_t *event)
reason = Qt::OtherFocusReason;
break;
}
- connection()->setFocusWindow(static_cast<QXcbWindow*>(window()->handle()));
+ connection()->setFocusWindow(window());
QWindowSystemInterface::handleWindowActivated(window(), reason);
break;
case XEMBED_FOCUS_OUT:
if (window() == QGuiApplication::focusWindow()
&& !activeWindowChangeQueued(window())) {
- connection()->setFocusWindow(0);
- QWindowSystemInterface::handleWindowActivated(0);
+ connection()->setFocusWindow(nullptr);
+ QWindowSystemInterface::handleWindowActivated(nullptr);
}
break;
}
diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp
index 0416215870..412658e39c 100644
--- a/src/sql/kernel/qsqldatabase.cpp
+++ b/src/sql/kernel/qsqldatabase.cpp
@@ -695,6 +695,9 @@ void QSqlDatabasePrivate::init(const QString &type)
/*!
Destroys the object and frees any allocated resources.
+ \note When the last connection is destroyed, the destructor
+ implicitly calls close() to release the database connection.
+
\sa close()
*/
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index fcd8f436fe..752e385aa5 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -3019,6 +3019,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
r = subElementRect(SE_CheckBoxIndicator, opt, widget);
break;
}
+ Q_FALLTHROUGH();
case SE_ItemViewItemDecoration:
case SE_ItemViewItemText:
case SE_ItemViewItemFocusRect:
@@ -4194,11 +4195,13 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
case SC_TitleBarContextHelpButton:
if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint)
offset += delta;
+ Q_FALLTHROUGH();
case SC_TitleBarMinButton:
if (!isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
offset += delta;
else if (sc == SC_TitleBarMinButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarNormalButton:
if (isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
offset += delta;
@@ -4206,21 +4209,25 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
offset += delta;
else if (sc == SC_TitleBarNormalButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarMaxButton:
if (!isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint))
offset += delta;
else if (sc == SC_TitleBarMaxButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarShadeButton:
if (!isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
offset += delta;
else if (sc == SC_TitleBarShadeButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarUnshadeButton:
if (isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
offset += delta;
else if (sc == SC_TitleBarUnshadeButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarCloseButton:
if (tb->titleBarFlags & Qt::WindowSystemMenuHint)
offset += delta;
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 1fed4f4b9f..c874b12e45 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -3580,11 +3580,13 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom
case SC_TitleBarContextHelpButton:
if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint)
offset += delta;
+ Q_FALLTHROUGH();
case SC_TitleBarMinButton:
if (!isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
offset += delta;
else if (sc == SC_TitleBarMinButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarNormalButton:
if (isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
offset += delta;
@@ -3592,21 +3594,25 @@ QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionCom
offset += delta;
else if (sc == SC_TitleBarNormalButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarMaxButton:
if (!isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint))
offset += delta;
else if (sc == SC_TitleBarMaxButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarShadeButton:
if (!isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
offset += delta;
else if (sc == SC_TitleBarShadeButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarUnshadeButton:
if (isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
offset += delta;
else if (sc == SC_TitleBarUnshadeButton)
break;
+ Q_FALLTHROUGH();
case SC_TitleBarCloseButton:
if (tb->titleBarFlags & Qt::WindowSystemMenuHint)
offset += delta;
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 94ded82ef5..48068adac9 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -4375,7 +4375,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
break;
}
#endif
- //fall tghought
+ Q_FALLTHROUGH();
case PE_PanelMenu:
case PE_PanelStatusBar:
if(rule.hasDrawable()) {
@@ -4934,7 +4934,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
case CT_ToolButton:
if (rule.hasBox() || !rule.hasNativeBorder() || !rule.baseStyleCanDraw())
sz += QSize(3, 3); // ### broken QToolButton
- //fall thought
+ Q_FALLTHROUGH();
case CT_ComboBox:
case CT_PushButton:
if (rule.hasBox() || !rule.hasNativeBorder()) {
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp
index 7ee53587e6..501d9560d9 100644
--- a/src/widgets/widgets/qabstractspinbox.cpp
+++ b/src/widgets/widgets/qabstractspinbox.cpp
@@ -980,6 +980,7 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event)
case Qt::Key_PageDown:
steps *= 10;
isPgUpOrDown = true;
+ Q_FALLTHROUGH();
case Qt::Key_Up:
case Qt::Key_Down: {
#ifdef QT_KEYPAD_NAVIGATION
@@ -2115,6 +2116,7 @@ int QAbstractSpinBoxPrivate::variantCompare(const QVariant &arg1, const QVariant
case QVariant::Invalid:
if (arg2.type() == QVariant::Invalid)
return 0;
+ Q_FALLTHROUGH();
default:
Q_ASSERT_X(0, "QAbstractSpinBoxPrivate::variantCompare",
qPrintable(QString::fromLatin1("Internal error 3 (%1 %2)").
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index cebfb9316a..0eaa110bee 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -1113,6 +1113,7 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event)
&& !(event->modifiers() & ~(Qt::ShiftModifier|Qt::KeypadModifier));
break;
}
+ Q_FALLTHROUGH();
case Qt::Key_Left:
case Qt::Key_Right:
if (event->key() == Qt::Key_Left || event->key() == Qt::Key_Right) {
diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp
index ecd85c2ca7..736f2599fe 100644
--- a/src/widgets/widgets/qeffects.cpp
+++ b/src/widgets/widgets/qeffects.cpp
@@ -196,6 +196,7 @@ bool QAlphaWidget::eventFilter(QObject *o, QEvent *e)
case QEvent::Close:
if (o != widget)
break;
+ Q_FALLTHROUGH();
case QEvent::MouseButtonPress:
case QEvent::MouseButtonDblClick:
showWidget = false;
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index eeece1a42a..d2bd7285ca 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -176,11 +176,10 @@ void QTabBarPrivate::initBasicStyleOption(QStyleOptionTab *option, int tabIndex)
if (tab.textColor.isValid())
option->palette.setColor(q->foregroundRole(), tab.textColor);
-#ifdef Q_OS_MACOS
- else if (isCurrent && !documentMode && q->isActiveWindow()) {
+ else if (q->style()->inherits("QMacStyle")
+ && isCurrent && !documentMode && q->isActiveWindow()) {
option->palette.setColor(QPalette::WindowText, Qt::white);
}
-#endif
option->icon = tab.icon;
option->iconSize = q->iconSize(); // Will get the default value then.
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index 2a0912df0a..48fa88b7a0 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -1143,7 +1143,7 @@ bool QToolBar::event(QEvent *event)
case QEvent::Hide:
if (!isHidden())
break;
- // fallthrough intended
+ Q_FALLTHROUGH();
case QEvent::Show:
d->toggleViewAction->setChecked(event->type() == QEvent::Show);
#ifdef Q_OS_OSX
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index a862274a3d..363e7157ac 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -1030,6 +1030,7 @@ void QWidgetLineControl::parseInputMask(const QString &maskFields)
break;
case '\\':
escape = true;
+ Q_FALLTHROUGH();
default:
s = true;
break;
diff --git a/tests/auto/corelib/io/largefile/tst_largefile.cpp b/tests/auto/corelib/io/largefile/tst_largefile.cpp
index 4e7877253f..99e1d5a32f 100644
--- a/tests/auto/corelib/io/largefile/tst_largefile.cpp
+++ b/tests/auto/corelib/io/largefile/tst_largefile.cpp
@@ -508,23 +508,42 @@ void tst_LargeFile::mapFile()
}
//Mac: memory-mapping beyond EOF may succeed but it could generate bus error on access
+//FreeBSD: same
+//Linux: memory-mapping beyond EOF usually succeeds, but depends on the filesystem
+// 32-bit: limited to 44-bit offsets
+//Windows: memory-mapping beyond EOF is not allowed
void tst_LargeFile::mapOffsetOverflow()
{
-#ifndef Q_OS_MAC
- // Out-of-range mappings should fail, and not silently clip the offset
- for (int i = 50; i < 63; ++i) {
+ enum {
+#ifdef Q_OS_WIN
+ Succeeds = false,
+ MaxOffset = 63
+#else
+ Succeeds = true,
+# if (defined(Q_OS_LINUX) || defined(Q_OS_ANDROID)) && Q_PROCESSOR_WORDSIZE == 4
+ MaxOffset = 43
+# else
+ MaxOffset = 63
+# endif
+#endif
+ };
+
+ QByteArray zeroPage(blockSize, '\0');
+ for (int i = maxSizeBits + 1; i < 63; ++i) {
+ bool succeeds = Succeeds && (i <= MaxOffset);
uchar *address = 0;
+ qint64 offset = Q_INT64_C(1) << i;
- address = largeFile.map(((qint64)1 << i), blockSize);
-#if defined(__x86_64__)
- QEXPECT_FAIL("", "fails on 64-bit Linux (QTBUG-21175)", Abort);
-#endif
- QVERIFY( !address );
+ if (succeeds)
+ QTest::ignoreMessage(QtWarningMsg, "QFSFileEngine::map: Mapping a file beyond its size is not portable");
+ address = largeFile.map(offset, blockSize);
+ QCOMPARE(!!address, succeeds);
- address = largeFile.map(((qint64)1 << i) + blockSize, blockSize);
- QVERIFY( !address );
+ if (succeeds)
+ QTest::ignoreMessage(QtWarningMsg, "QFSFileEngine::map: Mapping a file beyond its size is not portable");
+ address = largeFile.map(offset + blockSize, blockSize);
+ QCOMPARE(!!address, succeeds);
}
-#endif
}
QTEST_APPLESS_MAIN(tst_LargeFile)
diff --git a/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp b/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp
index dee10cbebc..17a0f3edd9 100644
--- a/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp
+++ b/tests/auto/corelib/tools/qcryptographichash/tst_qcryptographichash.cpp
@@ -30,6 +30,8 @@
#include <QtCore/QCoreApplication>
#include <QtTest/QtTest>
+Q_DECLARE_METATYPE(QCryptographicHash::Algorithm)
+
class tst_QCryptographicHash : public QObject
{
Q_OBJECT
@@ -39,6 +41,7 @@ private slots:
void intermediary_result_data();
void intermediary_result();
void sha1();
+ void sha3_data();
void sha3();
void files_data();
void files();
@@ -107,22 +110,47 @@ void tst_QCryptographicHash::intermediary_result_data()
<< QByteArray::fromHex("DDAF35A193617ABACC417349AE20413112E6FA4E89A97EA20A9EEEE64B55D39A2192992A274FC1A836BA3C23A3FEEBBD454D4423643CE80E2A9AC94FA54CA49F")
<< QByteArray::fromHex("F3C41E7B63EE869596FC28BAD64120612C520F65928AB4D126C72C6998B551B8FF1CEDDFED4373E6717554DC89D1EEE6F0AB22FD3675E561ABA9AE26A3EEC53B");
- QTest::newRow("sha3_224") << int(QCryptographicHash::Sha3_224)
- << QByteArray("abc") << QByteArray("abc")
- << QByteArray::fromHex("C30411768506EBE1C2871B1EE2E87D38DF342317300A9B97A95EC6A8")
- << QByteArray::fromHex("048330E7C7C8B4A41AB713B3A6F958D77B8CF3EE969930F1584DD550");
- QTest::newRow("sha3_256") << int(QCryptographicHash::Sha3_256)
- << QByteArray("abc") << QByteArray("abc")
- << QByteArray::fromHex("4E03657AEA45A94FC7D47BA826C8D667C0D1E6E33A64A036EC44F58FA12D6C45")
- << QByteArray::fromHex("9F0ADAD0A59B05D2E04A1373342B10B9EB16C57C164C8A3BFCBF46DCCEE39A21");
- QTest::newRow("sha3_384") << int(QCryptographicHash::Sha3_384)
- << QByteArray("abc") << QByteArray("abc")
- << QByteArray::fromHex("F7DF1165F033337BE098E7D288AD6A2F74409D7A60B49C36642218DE161B1F99F8C681E4AFAF31A34DB29FB763E3C28E")
- << QByteArray::fromHex("D733B87D392D270889D3DA23AE113F349E25574B445F319CDE4CD3F877C753E9E3C65980421339B3A131457FF393939F");
- QTest::newRow("sha3_512") << int(QCryptographicHash::Sha3_512)
- << QByteArray("abc") << QByteArray("abc")
- << QByteArray::fromHex("18587DC2EA106B9A1563E32B3312421CA164C7F1F07BC922A9C83D77CEA3A1E5D0C69910739025372DC14AC9642629379540C17E2A65B19D77AA511A9D00BB96")
- << QByteArray::fromHex("A7C392D2A42155761CA76BDDDE1C47D55486B007EDF465397BFB9DFA74D11C8F0D7C86CD29415283F1B5E7F655CEC25B869C9E9C33A8986F0B38542FB12BFB93");
+ QTest::newRow("sha3_224_empty_abc")
+ << int(QCryptographicHash::Sha3_224)
+ << QByteArray("") << QByteArray("abc")
+ << QByteArray::fromHex("6B4E03423667DBB73B6E15454F0EB1ABD4597F9A1B078E3F5B5A6BC7")
+ << QByteArray::fromHex("E642824C3F8CF24AD09234EE7D3C766FC9A3A5168D0C94AD73B46FDF");
+ QTest::newRow("sha3_256_empty_abc")
+ << int(QCryptographicHash::Sha3_256)
+ << QByteArray("") << QByteArray("abc")
+ << QByteArray::fromHex("A7FFC6F8BF1ED76651C14756A061D662F580FF4DE43B49FA82D80A4B80F8434A")
+ << QByteArray::fromHex("3A985DA74FE225B2045C172D6BD390BD855F086E3E9D525B46BFE24511431532");
+ QTest::newRow("sha3_384_empty_abc")
+ << int(QCryptographicHash::Sha3_384)
+ << QByteArray("") << QByteArray("abc")
+ << QByteArray::fromHex("0C63A75B845E4F7D01107D852E4C2485C51A50AAAA94FC61995E71BBEE983A2AC3713831264ADB47FB6BD1E058D5F004")
+ << QByteArray::fromHex("EC01498288516FC926459F58E2C6AD8DF9B473CB0FC08C2596DA7CF0E49BE4B298D88CEA927AC7F539F1EDF228376D25");
+ QTest::newRow("sha3_512_empty_abc")
+ << int(QCryptographicHash::Sha3_512)
+ << QByteArray("") << QByteArray("abc")
+ << QByteArray::fromHex("A69F73CCA23A9AC5C8B567DC185A756E97C982164FE25859E0D1DCC1475C80A615B2123AF1F5F94C11E3E9402C3AC558F500199D95B6D3E301758586281DCD26")
+ << QByteArray::fromHex("B751850B1A57168A5693CD924B6B096E08F621827444F70D884F5D0240D2712E10E116E9192AF3C91A7EC57647E3934057340B4CF408D5A56592F8274EEC53F0");
+
+ QTest::newRow("sha3_224_abc_abc")
+ << int(QCryptographicHash::Sha3_224)
+ << QByteArray("abc") << QByteArray("abc")
+ << QByteArray::fromHex("E642824C3F8CF24AD09234EE7D3C766FC9A3A5168D0C94AD73B46FDF")
+ << QByteArray::fromHex("58F426458091E16FBC61DDCB8F2D2A6F30F729CAFA3C289A4EB2BCF8");
+ QTest::newRow("sha3_256_abc_abc")
+ << int(QCryptographicHash::Sha3_256)
+ << QByteArray("abc") << QByteArray("abc")
+ << QByteArray::fromHex("3A985DA74FE225B2045C172D6BD390BD855F086E3E9D525B46BFE24511431532")
+ << QByteArray::fromHex("6C0872716337DE1EE664C1E37F64ADE109448F02681C63A912BC230FDEFC0058");
+ QTest::newRow("sha3_384_abc_abc")
+ << int(QCryptographicHash::Sha3_384)
+ << QByteArray("abc") << QByteArray("abc")
+ << QByteArray::fromHex("EC01498288516FC926459F58E2C6AD8DF9B473CB0FC08C2596DA7CF0E49BE4B298D88CEA927AC7F539F1EDF228376D25")
+ << QByteArray::fromHex("34FA93E11E467D610524EC91CEDC848EE1395BCF8F4F987455478E63DB0BCE47194D33D1251A3CC32BBB18D8726040D0");
+ QTest::newRow("sha3_512_abc_abc")
+ << int(QCryptographicHash::Sha3_512)
+ << QByteArray("abc") << QByteArray("abc")
+ << QByteArray::fromHex("B751850B1A57168A5693CD924B6B096E08F621827444F70D884F5D0240D2712E10E116E9192AF3C91A7EC57647E3934057340B4CF408D5A56592F8274EEC53F0")
+ << QByteArray::fromHex("BB582DA40D15399ACF62AFCBBD6CFC9EE1DD5129B1EF9935DD3B21668F1A73D7841018BE3B13F281C3A8E9DA7EDB60F57B9F9F1C04033DF4CE3654B7B2ADB310");
}
void tst_QCryptographicHash::intermediary_result()
@@ -172,57 +200,67 @@ void tst_QCryptographicHash::sha1()
QByteArray("34AA973CD4C4DAA4F61EEB2BDBAD27316534016F"));
}
-void tst_QCryptographicHash::sha3()
+void tst_QCryptographicHash::sha3_data()
{
- // SHA3-224("The quick brown fox jumps over the lazy dog")
- // 10aee6b30c47350576ac2873fa89fd190cdc488442f3ef654cf23fe
- QCOMPARE(QCryptographicHash::hash("The quick brown fox jumps over the lazy dog",
- QCryptographicHash::Sha3_224).toHex(),
- QByteArray("310aee6b30c47350576ac2873fa89fd190cdc488442f3ef654cf23fe"));
- // SHA3-224("The quick brown fox jumps over the lazy dog.")
- // c59d4eaeac728671c635ff645014e2afa935bebffdb5fbd207ffdeab
- QCOMPARE(QCryptographicHash::hash("The quick brown fox jumps over the lazy dog.",
- QCryptographicHash::Sha3_224).toHex(),
- QByteArray("c59d4eaeac728671c635ff645014e2afa935bebffdb5fbd207ffdeab"));
-
- // SHA3-256("The quick brown fox jumps over the lazy dog")
- // 4d741b6f1eb29cb2a9b9911c82f56fa8d73b04959d3d9d222895df6c0b28aa15
- QCOMPARE(QCryptographicHash::hash("The quick brown fox jumps over the lazy dog",
- QCryptographicHash::Sha3_256).toHex(),
- QByteArray("4d741b6f1eb29cb2a9b9911c82f56fa8d73b04959d3d9d222895df6c0b28aa15"));
-
- // SHA3-256("The quick brown fox jumps over the lazy dog.")
- // 578951e24efd62a3d63a86f7cd19aaa53c898fe287d2552133220370240b572d
- QCOMPARE(QCryptographicHash::hash("The quick brown fox jumps over the lazy dog.",
- QCryptographicHash::Sha3_256).toHex(),
- QByteArray("578951e24efd62a3d63a86f7cd19aaa53c898fe287d2552133220370240b572d"));
-
- // SHA3-384("The quick brown fox jumps over the lazy dog")
- // 283990fa9d5fb731d786c5bbee94ea4db4910f18c62c03d173fc0a5e494422e8a0b3da7574dae7fa0baf005e504063b3
- QCOMPARE(QCryptographicHash::hash("The quick brown fox jumps over the lazy dog",
- QCryptographicHash::Sha3_384).toHex(),
- QByteArray("283990fa9d5fb731d786c5bbee94ea4db4910f18c62c03d173fc0a5e494422e8a0b3da7574dae7fa0baf005e504063b3"));
-
- // SHA3-384("The quick brown fox jumps over the lazy dog.")
- // 9ad8e17325408eddb6edee6147f13856ad819bb7532668b605a24a2d958f88bd5c169e56dc4b2f89ffd325f6006d820b
- QCOMPARE(QCryptographicHash::hash("The quick brown fox jumps over the lazy dog.",
- QCryptographicHash::Sha3_384).toHex(),
- QByteArray("9ad8e17325408eddb6edee6147f13856ad819bb7532668b605a24a2d958f88bd5c169e56dc4b2f89ffd325f6006d820b"));
-
- // SHA3-512("The quick brown fox jumps over the lazy dog")
- // d135bb84d0439dbac432247ee573a23ea7d3c9deb2a968eb31d47c4fb45f1ef4422d6c531b5b9bd6f449ebcc449ea94d0a8f05f62130fda612da53c79659f609
- QCOMPARE(QCryptographicHash::hash("The quick brown fox jumps over the lazy dog",
- QCryptographicHash::Sha3_512).toHex(),
- QByteArray("d135bb84d0439dbac432247ee573a23ea7d3c9deb2a968eb31d47c4fb45f1ef4422d6c531b5b9bd6f449ebcc449ea94d0a8f05f62130fda612da53c79659f609"));
-
- // SHA3-512("The quick brown fox jumps over the lazy dog.")
- // ab7192d2b11f51c7dd744e7b3441febf397ca07bf812cceae122ca4ded6387889064f8db9230f173f6d1ab6e24b6e50f065b039f799f5592360a6558eb52d760
- QCOMPARE(QCryptographicHash::hash("The quick brown fox jumps over the lazy dog.",
- QCryptographicHash::Sha3_512).toHex(),
- QByteArray("ab7192d2b11f51c7dd744e7b3441febf397ca07bf812cceae122ca4ded6387889064f8db9230f173f6d1ab6e24b6e50f065b039f799f5592360a6558eb52d760"));
+ QTest::addColumn<QCryptographicHash::Algorithm>("algorithm");
+ QTest::addColumn<QByteArray>("data");
+ QTest::addColumn<QByteArray>("expectedResult");
+
+#define ROW(Tag, Algorithm, Input, Result) \
+ QTest::newRow(Tag) << Algorithm << QByteArrayLiteral(Input) << QByteArray::fromHex(Result)
+
+ ROW("sha3_224_pangram",
+ QCryptographicHash::Sha3_224,
+ "The quick brown fox jumps over the lazy dog",
+ "d15dadceaa4d5d7bb3b48f446421d542e08ad8887305e28d58335795");
+
+ ROW("sha3_224_pangram_dot",
+ QCryptographicHash::Sha3_224,
+ "The quick brown fox jumps over the lazy dog.",
+ "2d0708903833afabdd232a20201176e8b58c5be8a6fe74265ac54db0");
+
+ ROW("sha3_256_pangram",
+ QCryptographicHash::Sha3_256,
+ "The quick brown fox jumps over the lazy dog",
+ "69070dda01975c8c120c3aada1b282394e7f032fa9cf32f4cb2259a0897dfc04");
+
+ ROW("sha3_256_pangram_dot",
+ QCryptographicHash::Sha3_256,
+ "The quick brown fox jumps over the lazy dog.",
+ "a80f839cd4f83f6c3dafc87feae470045e4eb0d366397d5c6ce34ba1739f734d");
+
+ ROW("sha3_384_pangram",
+ QCryptographicHash::Sha3_384,
+ "The quick brown fox jumps over the lazy dog",
+ "7063465e08a93bce31cd89d2e3ca8f602498696e253592ed26f07bf7e703cf328581e1471a7ba7ab119b1a9ebdf8be41");
+
+ ROW("sha3_384_pangram_dot",
+ QCryptographicHash::Sha3_384,
+ "The quick brown fox jumps over the lazy dog.",
+ "1a34d81695b622df178bc74df7124fe12fac0f64ba5250b78b99c1273d4b080168e10652894ecad5f1f4d5b965437fb9");
+
+ ROW("sha3_512_pangram",
+ QCryptographicHash::Sha3_512,
+ "The quick brown fox jumps over the lazy dog",
+ "01dedd5de4ef14642445ba5f5b97c15e47b9ad931326e4b0727cd94cefc44fff23f07bf543139939b49128caf436dc1bdee54fcb24023a08d9403f9b4bf0d450");
+
+ ROW("sha3_512_pangram_dot",
+ QCryptographicHash::Sha3_512,
+ "The quick brown fox jumps over the lazy dog.",
+ "18f4f4bd419603f95538837003d9d254c26c23765565162247483f65c50303597bc9ce4d289f21d1c2f1f458828e33dc442100331b35e7eb031b5d38ba6460f8");
+
+#undef ROW
}
-Q_DECLARE_METATYPE(QCryptographicHash::Algorithm);
+void tst_QCryptographicHash::sha3()
+{
+ QFETCH(QCryptographicHash::Algorithm, algorithm);
+ QFETCH(QByteArray, data);
+ QFETCH(QByteArray, expectedResult);
+
+ const auto result = QCryptographicHash::hash(data, algorithm);
+ QCOMPARE(result, expectedResult);
+}
void tst_QCryptographicHash::files_data() {
QTest::addColumn<QString>("filename");
diff --git a/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp b/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp
index 00e00ecd6b..c1a8f7f0de 100644
--- a/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp
+++ b/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp
@@ -29,8 +29,11 @@
#include <QtTest/QtTest>
#include <QtGlobal>
#include <QtAlgorithms>
+#include <QtGui/QAbstractTextDocumentLayout>
#include <QtGui/QPageLayout>
#include <QtGui/QPdfWriter>
+#include <QtGui/QTextCursor>
+#include <QtGui/QTextDocument>
class tst_QPdfWriter : public QObject
{
@@ -40,6 +43,7 @@ private slots:
void basics();
void testPageMetrics_data();
void testPageMetrics();
+ void qtbug59443();
};
void tst_QPdfWriter::basics()
@@ -245,6 +249,28 @@ void tst_QPdfWriter::testPageMetrics()
QCOMPARE(writer.pageLayout().paintRect(QPageLayout::Millimeter), QRectF(leftMMf, topMMf, heightMMf - leftMMf - rightMMf, widthMMf - topMMf - bottomMMf));
}
+void tst_QPdfWriter::qtbug59443()
+{
+ // Do not crash or assert
+ QTemporaryFile file;
+ QVERIFY2(file.open(), qPrintable(file.errorString()));
+ QPdfWriter writer(file.fileName());
+ writer.setPageSize(QPdfWriter::A4);
+ QTextDocument doc;
+ doc.documentLayout()->setPaintDevice(&writer);
+
+ doc.setUndoRedoEnabled(false);
+ QTextCursor cursor(&doc);
+ QFont font = doc.defaultFont();
+ font.setFamily("Calibri");
+ font.setPointSize(8);
+ doc.setDefaultFont(font);
+
+ cursor.insertText(QString::fromStdWString(L"기초하며, 베어링제조업체와 타\n"));
+ doc.print(&writer);
+
+}
+
QTEST_MAIN(tst_QPdfWriter)
#include "tst_qpdfwriter.moc"
diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index 9d4b640272..6924b78397 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -150,7 +150,8 @@ public:
m_fnConstraint = fnConstraint;
}
- QSizeF m_sizeHints[Qt::NSizeHints];
+ // Initializer {} is a workaround for gcc bug 68949
+ QSizeF m_sizeHints[Qt::NSizeHints] {};
QSizeF (*m_fnConstraint)(Qt::SizeHint, const QSizeF &);
};
@@ -280,8 +281,10 @@ struct ItemDesc
int m_rowSpan;
int m_colSpan;
QSizePolicy m_sizePolicy;
- QSizeF m_sizeHints[Qt::NSizeHints];
- QSizeF m_sizes[Qt::NSizeHints];
+
+ // Initializer {} is a workaround for gcc bug 68949
+ QSizeF m_sizeHints[Qt::NSizeHints] {};
+ QSizeF m_sizes[Qt::NSizeHints] {};
Qt::Alignment m_align;
Qt::Orientation m_constraintOrientation;
diff --git a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index 322af7c236..0f5277710c 100644
--- a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
@@ -165,7 +165,8 @@ public:
return QGraphicsWidget::sizeHint(which, constraint);
}
- QSizeF m_sizeHints[Qt::NSizeHints];
+ // Initializer {} is a workaround for gcc bug 68949
+ QSizeF m_sizeHints[Qt::NSizeHints] {};
QBrush m_brush;
};