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

Conflicts:
	config_help.txt
	configure
	mkspecs/features/uikit/sdk.prf
	src/corelib/global/qhooks.cpp
	src/corelib/io/qfilesystemwatcher.cpp
	src/corelib/io/qlockfile_unix.cpp
	src/corelib/tools/qalgorithms.h
	src/gui/kernel/qwindowsysteminterface.h
	src/gui/text/qtextdocument_p.cpp
	src/network/access/access.pri
	src/network/access/qnetworkaccessmanager.cpp
	src/network/access/qnetworkreplynsurlconnectionimpl.mm
	src/src.pro
	src/testlib/qtestcase.cpp
	src/widgets/kernel/qwidgetbackingstore_p.h
	src/widgets/styles/qwindowscestyle.cpp
	src/widgets/styles/qwindowsmobilestyle.cpp
	tests/auto/corelib/io/qdiriterator/qdiriterator.pro
	tests/auto/corelib/io/qfileinfo/qfileinfo.pro
	tests/auto/gui/kernel/qwindow/BLACKLIST
	tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
	tools/configure/configureapp.cpp

Change-Id: Ibf7fb9c8cf263a810ade82f821345d0725c57c67
This commit is contained in:
Liang Qi 2016-06-13 09:01:02 +02:00
commit 511790fd1a
252 changed files with 3892 additions and 2559 deletions

View File

@ -0,0 +1,58 @@
/****************************************************************************
**
** Copyright (C) 2016 Intel Corporation.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the FOO module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <atomic>
typedef void (*fptr)(int);
typedef std::atomic<fptr> atomicfptr;
void testfunction(int) { }
void test(volatile atomicfptr &a)
{
fptr v = a.load(std::memory_order_acquire);
while (!a.compare_exchange_strong(v, &testfunction,
std::memory_order_acq_rel,
std::memory_order_acquire)) {
v = a.exchange(&testfunction);
}
a.store(&testfunction, std::memory_order_release);
}
int main(int, char **)
{
atomicfptr fptr(testfunction);
test(fptr);
return 0;
}

View File

@ -0,0 +1,3 @@
SOURCES = atomicfptr.cpp
CONFIG += c++11 console
CONFIG -= qt app_bundle

View File

@ -0,0 +1,18 @@
Patch for fixing std::atomic support for function pointers for the Intel
Composer XE 2016 (compiler version 16.0).
To apply:
cd /opt/intel/compilers_and_libraries_2016/mac/include
sudo patch -p1 < /path-to-this-file/icc2016_mac.diff
--- include/stdatomic.h.orig 2015-08-28 15:05:13.000000000 -0700
+++ include/stdatomic.h 2015-08-28 15:19:25.000000000 -0700
@@ -451,7 +451,7 @@
}
_STRONG_INLINE atomic() _DEFAULTED
_STRONG_INLINE _CONSTEXPR atomic(T* _Ptr)
- : atomic_address(_Ptr)
+ : atomic_address((void*)_Ptr)
{
}
_STRONG_INLINE T* operator+=(ptrdiff_t _V) volatile

View File

@ -0,0 +1,3 @@
Patch is available from QNX. Please see
http://www.qnx.com/download/feature.html?programid=27555

View File

@ -6,7 +6,10 @@ for(p, QMAKE_LIBDIR_EGL) {
INCLUDEPATH += $$QMAKE_INCDIR_EGL
LIBS += $$QMAKE_LIBS_EGL
LIBS += -ldrm
CONFIG += link_pkgconfig
!contains(QT_CONFIG, no-pkg-config) {
PKGCONFIG += libdrm
} else {
LIBS += -ldrm
}
CONFIG -= qt

View File

@ -42,7 +42,7 @@
int main(int, char **)
{
#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0)
#if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0)) || defined(__OpenBSD__)
timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
#else

View File

@ -0,0 +1,2 @@
SOURCES = $$PWD/dlopen.cpp
CONFIG -= qt dylib

View File

@ -1,3 +1,3 @@
SOURCES = iconv.cpp
CONFIG -= qt dylib
mac|mingw|qnx|haiku:LIBS += -liconv
mac|mingw|openbsd|qnx|haiku:LIBS += -liconv

View File

@ -1,3 +1,2 @@
SOURCES = libdl.cpp
CONFIG -= qt dylib
!qnx: LIBS += -ldl
include(../dlopen/dlopen.pro)
LIBS += -ldl

View File

@ -41,5 +41,6 @@
int main(int, char **)
{
mysql_get_client_version();
return 0;
}

View File

@ -1,50 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the config.tests of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <sys/types.h>
#include <rpc/rpc.h>
#include <rpcsvc/ypclnt.h>
#include <rpcsvc/yp_prot.h>
int main(int, char **)
{
char *d;
yp_get_default_domain(&d);
return 0;
}

View File

@ -1,4 +0,0 @@
SOURCES = nis.cpp
CONFIG -= qt dylib
solaris-*:LIBS += -lnsl
else:LIBS += $$QMAKE_LIBS_NIS

View File

@ -1,4 +1,7 @@
SOURCES = objcopy.cpp
CONFIG -= qt
TARGET = objcopytest
QMAKE_POST_LINK += $$QMAKE_OBJCOPY --only-keep-debug objcopy objcopy.debug && $$QMAKE_OBJCOPY --strip-debug objcopy && $$QMAKE_OBJCOPY --add-gnu-debuglink=objcopy.debug objcopy
load(resolve_target)
QMAKE_POST_LINK += $$QMAKE_OBJCOPY --only-keep-debug $$QMAKE_RESOLVED_TARGET objcopytest.debug && $$QMAKE_OBJCOPY --strip-debug $$QMAKE_RESOLVED_TARGET && $$QMAKE_OBJCOPY --add-gnu-debuglink=objcopytest.debug $$QMAKE_RESOLVED_TARGET

View File

@ -43,6 +43,12 @@
# error "OpenSSL >= 0.9.7 is required"
#endif
#include <openssl/ssl.h>
#if OPENSSL_VERSION_NUMBER-0 >= 0x10002000L && !defined(OPENSSL_NO_EC) && !defined(SSL_CTRL_SET_CURVES)
# error "OpenSSL was reported as >= 1.0.2 but is missing required features, possibly it's libressl which is unsupported"
#endif
int main()
{
}

View File

@ -258,9 +258,6 @@ Additional options:
-silent .............. Reduce the build output so that warnings and errors
can be seen more easily.
-no-nis .............. Do not compile NIS support.
* -nis ................. Compile NIS support.
-no-cups ............. Do not compile CUPS support.
* -cups ................ Compile CUPS support.
Requires cups/cups.h and libcups.so.2.

67
configure vendored
View File

@ -707,7 +707,6 @@ CFG_LIBUDEV=auto
CFG_LIBINPUT=auto
CFG_EVDEV=auto
CFG_TSLIB=auto
CFG_NIS=auto
CFG_CUPS=auto
CFG_ICONV=auto
CFG_DBUS=auto
@ -844,7 +843,7 @@ QT_QPA_DEFAULT_PLATFORM=
# Android vars
CFG_DEFAULT_ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT
CFG_DEFAULT_ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT
CFG_DEFAULT_ANDROID_PLATFORM=android-9
CFG_DEFAULT_ANDROID_PLATFORM=android-16
CFG_DEFAULT_ANDROID_TARGET_ARCH=armeabi-v7a
CFG_DEFAULT_ANDROID_NDK_TOOLCHAIN_VERSION=4.9
CFG_DEFAULT_ANDROID_NDK_HOST=$ANDROID_NDK_HOST
@ -1895,13 +1894,6 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
nis)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_NIS="$VAL"
else
UNKNOWN_OPT=yes
fi
;;
openssl)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_OPENSSL="$VAL"
@ -2206,10 +2198,17 @@ if [ -z "$PLATFORM" ]; then
PLATFORM=ultrix-g++
;;
FreeBSD:*)
PLATFORM=freebsd-clang
PLATFORM_NOTES="
- Also available for FreeBSD: freebsd-icc
"
if [ "$(uname -r | cut -d. -f1)" -ge 10 ]; then
PLATFORM=freebsd-clang
PLATFORM_NOTES="
- Also available for FreeBSD: freebsd-g++
"
else
PLATFORM=freebsd-g++
PLATFORM_NOTES="
- Also available for FreeBSD: freebsd-clang
"
fi
;;
OpenBSD:*)
PLATFORM=openbsd-g++
@ -2534,6 +2533,9 @@ if [ "$XPLATFORM_ANDROID" = "yes" ]; then
if [ "$CFG_DBUS" = "auto" ]; then
CFG_DBUS="no"
fi
if [ "$CFG_EGLFS" = "auto" ]; then
CFG_EGLFS="no"
fi
if [ -z "$CFG_DEFAULT_ANDROID_NDK_HOST" ]; then
case $PLATFORM in
linux-*)
@ -2727,8 +2729,7 @@ if [ "$XPLATFORM_IOS" = "yes" ] || [ "$XPLATFORM_TVOS" = "yes" ]; then
# If the user passes -sdk on the command line we build a SDK-specific Qt build.
# Otherwise we build a joined simulator and device build, which is the default.
if [ -z "$OPT_MAC_SDK" ]; then
QT_CONFIG="$QT_CONFIG build_all"
QTCONFIG_CONFIG="$QTCONFIG_CONFIG simulator_and_device"
QT_CONFIG="$QT_CONFIG build_all simulator_and_device"
fi
fi
@ -3758,6 +3759,14 @@ else
CFG_STD_ATOMIC64=no
fi
# Detect whether std::atomic works for function pointers -- some implementations are buggy
if ! compileTest common/atomicfptr "std::atomic for function pointers"; then
echo "ERROR: detected a std::atomic implementation that fails for function pointers."
echo "Please apply the patch corresponding to your Standard Library vendor, found in"
echo " $relpath/config.tests/common/atomicfptr"
exit 101
fi
# detect sse2 support
CFG_SSE_LIST=
if [ "${CFG_SSE2}" = "auto" ]; then
@ -4060,9 +4069,13 @@ if [ "$CFG_LIBPNG" = "auto" ]; then
fi
# detect dl
if ! compileTest unix/libdl "libdl"; then
QMakeVar add DEFINES QT_NO_DYNAMIC_LIBRARY
if compileTest unix/dlopen "dlopen"; then
QMAKE_CONFIG="$QMAKE_CONFIG no-libdl"
else
if ! compileTest unix/libdl "libdl"; then
QMAKE_CONFIG="$QMAKE_CONFIG no-libdl"
QMakeVar add DEFINES QT_NO_DYNAMIC_LIBRARY
fi
fi
if [ "$CFG_EGLFS" = "yes" ]; then
@ -4304,23 +4317,6 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do
esac
done
# auto-detect NIS support
if [ "$CFG_NIS" != "no" ]; then
if compileTest unix/nis "NIS"; then
CFG_NIS=yes
else
if [ "$CFG_NIS" = "yes" ] && [ "$CFG_CONFIGURE_EXIT_ON_ERROR" = "yes" ]; then
echo "NIS support cannot be enabled due to functionality tests!"
echo " Turn on verbose messaging (-v) to $0 to see the final report."
echo " If you believe this message is in error you may use the continue"
echo " switch (-continue) to $0 to continue."
exit 101
else
CFG_NIS=no
fi
fi
fi
# auto-detect CUPS support
if [ "$CFG_CUPS" != "no" ]; then
if compileTest unix/cups "Cups"; then
@ -5685,7 +5681,6 @@ if [ "$CFG_SYSTEM_ZLIB" = "yes" ]; then
fi
[ "$CFG_MTDEV" = "yes" ] && QT_CONFIG="$QT_CONFIG mtdev"
[ "$CFG_NIS" = "yes" ] && QT_CONFIG="$QT_CONFIG nis"
[ "$CFG_CUPS" = "yes" ] && QT_CONFIG="$QT_CONFIG cups"
[ "$CFG_ICONV" != "no" ] && QT_CONFIG="$QT_CONFIG iconv"
[ "$CFG_ICONV" = "sun" ] && QT_CONFIG="$QT_CONFIG sun-libiconv"
@ -5953,7 +5948,6 @@ QMakeVar set sql-drivers "$SQL_DRIVERS"
[ "$CFG_INOTIFY" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_INOTIFY"
[ "$CFG_EVENTFD" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_EVENTFD"
[ "$CFG_CLOEXEC" = "yes" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_THREADSAFE_CLOEXEC=1"
[ "$CFG_NIS" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_NIS"
[ "$CFG_OPENSSL" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_OPENSSL"
[ "$CFG_OPENSSL" = "linked" ]&& QCONFIG_FLAGS="$QCONFIG_FLAGS QT_LINKED_OPENSSL"
[ "$CFG_OPENSSL" = "no" ] && [ "$CFG_SECURETRANSPORT" = "no" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_SSL"
@ -6407,7 +6401,6 @@ report_support " libproxy.............." "$CFG_LIBPROXY"
report_support " OpenSSL .............." "$CFG_OPENSSL" yes "loading libraries at run-time" linked "linked to the libraries"
[ "$XPLATFORM_MAC" = "yes" ] && \
report_support " SecureTransport ......" "$CFG_SECURETRANSPORT"
report_support " NIS ...................." "$CFG_NIS"
report_support " OpenGL / OpenVG:"
report_support " EGL .................." "$CFG_EGL"
report_support " OpenGL ..............." "$CFG_OPENGL" yes "Desktop OpenGL" es2 "OpenGL ES 2.0+"

165
dist/changes-5.6.1 vendored Normal file
View File

@ -0,0 +1,165 @@
Qt 5.6.1 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.6.0.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
https://doc.qt.io/qt-5/
The Qt version 5.6 series is binary compatible with the 5.5.x series.
Applications compiled for 5.5 will continue to run with 5.6.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Important Behavior Changes *
****************************************************************************
- Support for DirectFB is disabled by default, due to lack of
development in upstream. To enable the platform plugin, pass the
-directfb option to configure.
- [QTBUG-44964] The new X event compression feature that was added in 5.6.0
no longer applies to motion events from drawing tablets.
configure & build system
------------------------
- The configure -D/-I/-L/-l/-R options do not affect the build of Qt's
host tools any more when cross-building. While this usually improves
the chances of a build succeeding, it may also require adjustments.
qmake
-----
- [Unix] Paths passed to configure -R are not automatically used by 3rd
party projects any more. Use QMAKE_RPATHDIR if your project explicitly
depends on external libraries. Note that this is not needed for Qt or
its transitive dependencies.
- Expansions of ${QMAKE_FILE_IN_BASE} and ${QMAKE_FILE_OUT_BASE} in extra
compilers are now automatically quoted.
****************************************************************************
* Library *
****************************************************************************
QtCore
------
- QObject:
* [QTBUG-52542] If the compiler supports variadic templates, functors
connected to signals will no longer be copied each time the signal is
emitted.
- QRect:
* Fixed integer overflow in center(). This fixes the result for some
corner-cases such as a 1x1 rectangle at (INT_MIN, INT_MIN), for which the
previous implementation could return anything (due to invoking undefined
behavior), but commonly returned (0, 0).
- QStringRef:
* Fixed relational operators against (const char*) to return the correct
result.
QtGui
-----
- [QTBUG-50199] QWheelEvent::phase() now returns zero rather than
Qt::ScrollUpdate when the wheel event comes from an actual non-emulated
mouse wheel, and the QT_ENABLE_MOUSE_WHEEL_TRACKING environment variable
is set.
- Image:
* [QTBUG-50745] Fixed possible crash in QImage::pixel() for mono or indexed
images.
QtWidgets
---------
- Dialogs:
* [QTBUG-51148] Fixed font dialog support for fonts with a non-existent
family name and/or pixel size.
- QHeaderView:
* [QTBUG-50171] Fixed a repainting issue when items had been reordered.
- QListWidget:
* [QTBUG-15741] Fixed a bug that caused the default drop action to be
ignored when using icon mode.
****************************************************************************
* Platform-specific Changes *
****************************************************************************
Android
-------
- The navigation bar is now hidden only on Android API level 19 and above.
OS X
----
- [QTBUG-50262] QStandardPaths now returns the correct display name for the
download folder.
- [QTBUG-7000] QMacPrintEngine now really sets the printer resolution.
- [QTBUG-48138] QPinchGesture on OS X now behaves like on other platforms:
totalScaleFactor is the magnitude of the pinch and scaleFactor is the delta
for the current event.
Windows
-------
- Text:
* [QTBUG-18711] Fixed disabling hints for application fonts.
For example, when automatic scaling by device pixel ratio is in effect.
* [QTBUG-47141] Made it possible to disable antialiasing for text when
drawing into images.
X11/XCB
-------
- [QTBUG-49071] Fixed failure to deliver focusIn events on hide/show.
****************************************************************************
* Tools *
****************************************************************************
configure & build system
------------------------
- [QTBUG-11545][Windows] Added missing -pch/-no-pch options to configure.exe.
- [QTBUG-37952][Apple] configure -separate-debug-info is now supported.
- [QTBUG-47313][QTBUG-47639] Fixed builds with "debug" and/or "release" in
the build path's name.
- [QTBUG-51621][Unix] Fixed transitive dependencies on non-Qt libraries.
- [QTBUG-51644][QTBUG-53017] Fixed cross-builds which use a host compiler
which is significantly different from the target compiler.
- [QTBUG-52578][QNX] Unified some defaults between the Unix and Windows
configures.
- [Unix] configure -R now supports paths relative to -libdir.
- [Android@Windows] Added missing -android-ndk-host option to configure.exe.
- [MinGW] Fixed -release -force-debug-info builds actually being neither.
- [WinCE] Fixed (Open)SSL detection.
- Fixed builds with static libc.
qmake
-----
- [QTBUG-34182] Fixed UTF-8 BOM breaking dependency calculation.
- [QTBUG-38802][WinRT] Capabilities needed by Qt are now automatically
added to the manifest.
- [QTBUG-50924][WEC7][VS] Fixed deployment of Qt.
- [QTBUG-51775][Unix@Windows] Fixed installation of target.targets when
cross-building.
- [QTBUG-51782] Fixed simultaneous use of the separate_debug_info and
no_plugin_name_prefix CONFIG flags.
- [QTBUG-52008] qmake-generated Visual Studio projects now automatically
invoke windeployqt by default.
- [QTBUG-52998] Restored use of -P option when invoking lex.
- The expansions ${QMAKE_FILE_IN_EXT}, ${QMAKE_FILE_IN_NAME}, and
${QMAKE_FILE_OUT_PATH} are now understood in extra compilers.

View File

@ -1,3 +1,4 @@
TEMPLATE = subdirs
SUBDIRS = mimetypebrowser
qtHaveModule(widgets): SUBDIRS += \
mimetypebrowser

View File

@ -56,9 +56,9 @@
#include "ui_authenticationdialog.h"
#ifndef QT_NO_SSL
static const char defaultUrl[] = "https://qt-project.org/";
static const char defaultUrl[] = "https://www.qt.io/";
#else
static const char defaultUrl[] = "http://qt-project.org/";
static const char defaultUrl[] = "http://www.qt.io/";
#endif
static const char defaultFileName[] = "index.html";
@ -106,7 +106,7 @@ HttpWindow::HttpWindow(QWidget *parent)
connect(urlLineEdit, &QLineEdit::textChanged,
this, &HttpWindow::enableDownloadButton);
formLayout->addRow(tr("&URL:"), urlLineEdit);
QString downloadDirectory = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
QString downloadDirectory = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
if (downloadDirectory.isEmpty() || !QFileInfo(downloadDirectory).isDir())
downloadDirectory = QDir::currentPath();
downloadDirectoryLineEdit->setText(QDir::toNativeSeparators(downloadDirectory));

View File

@ -54,7 +54,8 @@
#include <QObject>
#include <QColor>
class QOpenGLFunctions_1_1;
QT_FORWARD_DECLARE_CLASS(QOpenGLFunctions_1_1)
class Patch;
struct Geometry;

View File

@ -5,3 +5,6 @@ LIBS += -framework AppKit
QT += widgets
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/mac/qmaccocoaviewcontainer
INSTALLS += target

View File

@ -5,3 +5,7 @@ LIBS += -framework AppKit
QT += widgets
#QT += widgets-private gui-private core-private
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/mac/qmacnativewidget
INSTALLS += target

View File

@ -168,13 +168,6 @@ QMAKE_STRIP =
QMAKE_RANLIB = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-ranlib
QMAKE_INCDIR = $$ANDROID_SOURCES_CXX_STL_INCDIR $$QMAKE_ANDROID_PLATFORM_INCDIR
QMAKE_LIBDIR = $$ANDROID_SOURCES_CXX_STL_LIBDIR $$QMAKE_ANDROID_PLATFORM_LIBDIR $$LIBGCC_PATH
QMAKE_INCDIR_X11 =
QMAKE_LIBDIR_X11 =
QMAKE_INCDIR_OPENGL = $$QMAKE_ANDROID_PLATFORM_INCDIR
QMAKE_LIBDIR_OPENGL = $$QMAKE_ANDROID_PLATFORM_LIBDIR
equals(ANDROID_TARGET_ARCH, armeabi)|equals(ANDROID_TARGET_ARCH, armeabi-v7a): \
LIBGCC_PATH_FULL = $$system("$$QMAKE_CC -mthumb-interwork -print-libgcc-file-name")
else: \
@ -182,20 +175,19 @@ else: \
LIBGCC_PATH = $$dirname(LIBGCC_PATH_FULL)
QMAKE_INCDIR = $$ANDROID_SOURCES_CXX_STL_INCDIR $$QMAKE_ANDROID_PLATFORM_INCDIR
QMAKE_LIBDIR = $$ANDROID_SOURCES_CXX_STL_LIBDIR $$QMAKE_ANDROID_PLATFORM_LIBDIR $$LIBGCC_PATH
QMAKE_INCDIR_X11 =
QMAKE_LIBDIR_X11 =
QMAKE_INCDIR_OPENGL = $$QMAKE_ANDROID_PLATFORM_INCDIR
QMAKE_LIBDIR_OPENGL = $$QMAKE_ANDROID_PLATFORM_LIBDIR
QMAKE_LINK = $$QMAKE_CXX
QMAKE_LINK_SHLIB = $$QMAKE_CXX
QMAKE_LFLAGS = --sysroot=$$ANDROID_PLATFORM_ROOT_PATH
QMAKE_RPATHLINK = $$QMAKE_ANDROID_PLATFORM_LIBDIR
QMAKE_LFLAGS_APP = -Wl,--no-undefined -Wl,-z,noexecstack -shared
QMAKE_LFLAGS_SHLIB = -Wl,--no-undefined -Wl,-z,noexecstack -shared
contains(NDK_ROOT, ".*r6")|contains(NDK_ROOT, ".*r5.*") {
!equals(ANDROID_PLATFORM, android-4):!equals(ANDROID_PLATFORM, android-5):!equals(ANDROID_PLATFORM, android-8) {
warning("Your NDK version is outdated. A workaround is enabled. Consider updating your NDK (workarounds are required until r6(a))")
QMAKE_LFLAGS_SHLIB += $$QMAKE_ANDROID_PLATFORM_LIBDIR/crtbegin_so.o $$QMAKE_ANDROID_PLATFORM_LIBDIR/crtend_so.o
}
}
QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB
QMAKE_LFLAGS_NOUNDEF = -Wl,--no-undefined
QMAKE_LFLAGS_RPATH = -Wl,-rpath=

View File

@ -15,7 +15,9 @@ TEMPLATE = lib
CONFIG += plugin
if(win32|mac):!macx-xcode {
contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release build_all
contains(QT_CONFIG, simulator_and_device): CONFIG += iphonesimulator_and_iphoneos
contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release
contains(QT_CONFIG, build_all): CONFIG += build_all
}
CONFIG += relative_qt_rpath # Qt's QML plugins should be relocatable

View File

@ -1,3 +1,3 @@
contains(QT_CONFIG, system-freetype) {
LIBS += -lfreetype
LIBS_PRIVATE += -lfreetype
}

View File

@ -1,7 +1,7 @@
CONFIG += qpa/basicunixfontdatabase
contains(QT_CONFIG, fontconfig) {
DEFINES += Q_FONTCONFIGDATABASE
LIBS += -lfontconfig
LIBS_PRIVATE += -lfontconfig
} else:!android {
fonts.path = $$[QT_INSTALL_LIBS]/fonts
fonts.files = $$QT_SOURCE_TREE/lib/fonts/*

View File

@ -18,7 +18,9 @@ QT = # In case qt is re-added.
CONFIG -= warning_clean # Don't presume 3rd party code to be clean
load(qt_common)
contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release build_all
contains(QT_CONFIG, simulator_and_device): CONFIG += iphonesimulator_and_iphoneos
contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release
contains(QT_CONFIG, build_all): CONFIG += build_all
DESTDIR = $$MODULE_BASE_OUTDIR/lib
DLLDESTDIR = $$MODULE_BASE_OUTDIR/bin

View File

@ -89,7 +89,9 @@ INCLUDEPATH *= $$eval(QT.$${MODULE}.includes) $$eval(QT.$${MODULE}_private.inclu
# If Qt was configured with -debug-and-release then build the module the same way
# - unless this is a host library
!host_build:if(win32|mac):!macx-xcode {
contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release build_all
contains(QT_CONFIG, simulator_and_device): CONFIG += iphonesimulator_and_iphoneos
contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release
contains(QT_CONFIG, build_all): CONFIG += build_all
}
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF

View File

@ -26,7 +26,9 @@ win32:CONFIG(shared, static|shared) {
tool_plugin {
!build_pass:contains(QT_CONFIG, debug_and_release): CONFIG += release
} else:if(win32|mac):!macx-xcode {
contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release build_all
contains(QT_CONFIG, simulator_and_device): CONFIG += iphonesimulator_and_iphoneos
contains(QT_CONFIG, debug_and_release): CONFIG += debug_and_release
contains(QT_CONFIG, build_all): CONFIG += build_all
}
CONFIG += relative_qt_rpath # Qt's plugins should be relocatable

View File

@ -2,14 +2,14 @@
load(default_pre)
# In case Qt was built for a specific SDK
!simulator_and_device:contains(QMAKE_MAC_SDK, ^$${simulator.sdk}.*): \
!contains(QT_CONFIG, simulator_and_device):contains(QMAKE_MAC_SDK, ^$${simulator.sdk}.*): \
CONFIG += simulator $${simulator.sdk}
# Check for supported Xcode versions
lessThan(QMAKE_XCODE_VERSION, "4.3"): \
error("This mkspec requires Xcode 4.3 or later")
simulator_and_device:iphonesimulator {
build_pass:simulator {
# For a simulator_and_device build all the config tests
# are based on the iPhoneOS ARM SDK, but we know that the simulator
# is i386 and that we support SSE/SSE2.
@ -19,7 +19,7 @@ simulator_and_device:iphonesimulator {
CONFIG -= neon
CONFIG += sse sse2
}
simulator_and_device:appletvsimulator {
build_pass:appletvsimulator {
# For a simulator_and_device build all the config tests
# are based on the AppleTVOS ARM SDK, but we know that the simulator
# is x64 and that we support SSE/SSE2.

View File

@ -1,13 +1,13 @@
# In case the user sets the SDK manually
contains(QMAKE_MAC_SDK, ^$${simulator.sdk}.*) {
simulator_and_device: \
contains(QT_CONFIG, simulator_and_device): \
error("Simulator is handled automatically for simulator_and_device")
CONFIG += simulator $${simulator.sdk}
}
simulator_and_device:simulator: \
build_pass:simulator: \
QMAKE_MAC_SDK ~= s,^$${device.sdk},$${simulator.sdk},
load(sdk)

View File

@ -0,0 +1,18 @@
have_target:!static:!isEmpty(QMAKE_OBJCOPY) {
load(resolve_target)
QMAKE_TARGET_DEBUG_INFO = $${QMAKE_RESOLVED_TARGET}.debug
shell_target = $$shell_quote($$relative_path($$QMAKE_RESOLVED_TARGET, $$OUT_PWD))
shell_target_debug_info = $$shell_quote($$relative_path($$QMAKE_TARGET_DEBUG_INFO, $$OUT_PWD))
copy_debug_info = $$QMAKE_OBJCOPY --only-keep-debug $$shell_target $$shell_target_debug_info
link_debug_info = $$QMAKE_OBJCOPY --add-gnu-debuglink=$$shell_target_debug_info $$shell_target
strip_debug_info = $$QMAKE_OBJCOPY --strip-debug $$shell_target
!isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK
QMAKE_POST_LINK = $$copy_debug_info && $$strip_debug_info && $$link_debug_info $$QMAKE_POST_LINK
silent:QMAKE_POST_LINK = @echo creating $@.debug && $$QMAKE_POST_LINK
target.targets += $$QMAKE_TARGET_DEBUG_INFO
QMAKE_DISTCLEAN += $$QMAKE_TARGET_DEBUG_INFO
}

View File

@ -7,7 +7,7 @@ QMAKE_PLATFORM = freebsd bsd
include(../common/unix.conf)
QMAKE_CFLAGS_THREAD = -pthread -D_THREAD_SAFE
QMAKE_CFLAGS_THREAD = -pthread
QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD

View File

@ -5,9 +5,9 @@
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = freebsd bsd
include(../../common/unix.conf)
include(../common/unix.conf)
QMAKE_CFLAGS_THREAD = -pthread -D_THREAD_SAFE
QMAKE_CFLAGS_THREAD = -pthread
QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
@ -29,6 +29,6 @@ QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
load(qt_config)

View File

@ -37,4 +37,4 @@
**
****************************************************************************/
#include "../freebsd-g++/qplatformdefs.h"
#include "../freebsd-clang/qplatformdefs.h"

View File

@ -1,95 +0,0 @@
#
# qmake configuration for freebsd-icc
#
# Written for Intel C++ 7.1 and 8.0 on FreeBSD
#
# Note: Some of the remarks from the Intel compiler are disabled (even
# with 'warn_on' specified):
#
# remark #171: invalid type conversion: "int" to "void *"
# remark #193: zero used for undefined preprocessing identifier
# remark #279: controlling expression is constant
# remark #304: access control not specified ("public" by default)
# remark #310: old-style parameter list (anachronism)
# remark #383: value copied to temporary, reference to temporary used
# remark #424: extra ";" ignored
# remark #444: destructor for base class "Class" is not virtual
# remark #488: template parameter "T" is not used in declaring the parameter
# types of function template "function"
# remark #810: conversion from "type1" to "type2" may loose significant bits
# remark #858: type qualifier on return type is meaningless
# remark #967: conversion from "type1" to "type2"; sizes do not match
# remark #981: operands are evaluated in unspecified order
# remark #1418: external definition with no prior declaration
# remark #1419: external declaration in primary source file
# warning #1476: field uses tail padding of a base class
# warning #1477: GNU C++ compilers may use bit field padding
# warning #1572: floating-point equality and inequality comparisons are unreliable
#
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = freebsd bsd
include(../common/unix.conf)
QMAKE_COMPILER = gcc intel_icc # icc pretends to be gcc
QMAKE_CC = icc
QMAKE_LEX = flex
QMAKE_LEXFLAGS =
QMAKE_YACC = yacc
QMAKE_YACCFLAGS = -d
QMAKE_CFLAGS = -wd858,1572
QMAKE_CFLAGS_DEPS = -M
QMAKE_CFLAGS_WARN_ON = -w2 -wd171,193,279,304,310,383,424,444,488,810,967,981,1418,1419,1476,1477
QMAKE_CFLAGS_WARN_OFF = -w
QMAKE_CFLAGS_RELEASE =
QMAKE_CFLAGS_DEBUG = -g
QMAKE_CFLAGS_SHLIB = -fpic
QMAKE_CFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_SHLIB
QMAKE_CFLAGS_YACC =
QMAKE_CFLAGS_THREAD = -D_THREAD_SAFE
QMAKE_CXX = icpc
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS
QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG
QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB
QMAKE_CXXFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_STATIC_LIB
QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC
QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
# Addon software goes into /usr/local on the BSDs, by default we will look there
QMAKE_INCDIR = /usr/local/include
QMAKE_LIBDIR = /usr/local/lib
QMAKE_INCDIR_X11 = /usr/X11R6/include
QMAKE_LIBDIR_X11 = /usr/X11R6/lib
QMAKE_INCDIR_OPENGL = /usr/X11R6/include
QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib
QMAKE_LINK = icpc
QMAKE_LINK_SHLIB = icpc
QMAKE_LFLAGS =
QMAKE_LFLAGS_RELEASE =
QMAKE_LFLAGS_DEBUG =
QMAKE_LFLAGS_SHLIB = -shared
QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB
QMAKE_LFLAGS_SONAME = -Qoption,ld,-soname,
QMAKE_LFLAGS_THREAD = -mt
QMAKE_LFLAGS_RPATH = -Qoption,ld,-rpath,
QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD =
QMAKE_LIBS_X11 = -lXext -lX11 -lm
QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_THREAD =
QMAKE_AR = ar cqs
QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
load(qt_config)

View File

@ -6,61 +6,25 @@ MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = netbsd bsd
include(../common/unix.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
QMAKE_COMPILER = gcc
QMAKE_CC = gcc
QMAKE_LEX = flex
QMAKE_LEXFLAGS =
QMAKE_YACC = yacc
QMAKE_YACCFLAGS = -d
QMAKE_CFLAGS = -pipe
QMAKE_CFLAGS_DEPS = -M
QMAKE_CFLAGS_WARN_ON = -Wall -W
QMAKE_CFLAGS_WARN_OFF = -w
QMAKE_CFLAGS_RELEASE = -O2
QMAKE_CFLAGS_DEBUG = -g
QMAKE_CFLAGS_SHLIB = -fPIC
QMAKE_CFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_SHLIB
QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses
QMAKE_CFLAGS_THREAD = -pthread
QMAKE_CXX = g++
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS
QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG
QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB
QMAKE_CXXFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_STATIC_LIB
QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC
QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
QMAKE_INCDIR = /usr/local/include
QMAKE_LIBDIR = /usr/local/lib
QMAKE_INCDIR_X11 = /usr/X11R6/include
QMAKE_LIBDIR_X11 = /usr/X11R6/lib
QMAKE_INCDIR_OPENGL = /usr/X11R6/include
QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib
QMAKE_INCDIR = /usr/pkg/include
QMAKE_LIBDIR = /usr/pkg/lib
QMAKE_INCDIR_X11 = /usr/X11R7/include
QMAKE_LIBDIR_X11 = /usr/X11R7/lib
QMAKE_INCDIR_OPENGL = /usr/X11R7/include
QMAKE_LIBDIR_OPENGL = /usr/X11R7/lib
QMAKE_LINK = g++
QMAKE_LINK_SHLIB = g++
QMAKE_LINK_C = gcc
QMAKE_LINK_C_SHLIB = gcc
QMAKE_LINK_SHLIB_CMD = $$QMAKE_LINK_SHLIB $$QMAKE_LFLAGS_SHLIB $(LFLAGS) $$QMAKE_LFLAGS -o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
QMAKE_LFLAGS =
QMAKE_LFLAGS_RELEASE =
QMAKE_LFLAGS_DEBUG =
QMAKE_LFLAGS_SHLIB = -shared
QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB
QMAKE_LFLAGS_SONAME = -Wl,-soname,
QMAKE_LFLAGS_THREAD = -pthread
QMAKE_LFLAGS_NOUNDEF = -Wl,-no_unresolved
QMAKE_LFLAGS_RPATH = -Wl,-rpath,
QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD =
QMAKE_LIBS_EXECINFO = -lexecinfo
QMAKE_LIBS_X11 = -lXext -lX11 -lm
QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_THREAD =
@ -68,6 +32,6 @@ QMAKE_LIBS_THREAD =
QMAKE_AR = ar cqs
QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB = ranlib
QMAKE_RANLIB =
load(qt_config)

View File

@ -78,16 +78,7 @@
#undef QT_OPEN_LARGEFILE
#define QT_OPEN_LARGEFILE 0
// QT_SOCKLEN_T
// NetBSD 1.0 - 1.3.3 int
// NetBSD 1.4 - 1.5 socklen_t
#define QT_SNPRINTF ::snprintf
#define QT_VSNPRINTF ::vsnprintf
// Older NetBSD versions may still use the a.out format instead of ELF.
#ifndef __ELF__
#define QT_AOUT_UNDERSCORE
#endif
#endif // QPLATFORMDEFS_H

View File

@ -6,35 +6,11 @@ MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = openbsd bsd
include(../common/unix.conf)
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
QMAKE_COMPILER = gcc
QMAKE_CC = gcc
QMAKE_LEX = flex
QMAKE_LEXFLAGS =
QMAKE_YACC = yacc
QMAKE_YACCFLAGS = -d
QMAKE_CFLAGS = -pipe
QMAKE_CFLAGS_DEPS = -M
QMAKE_CFLAGS_WARN_ON = -Wall -W
QMAKE_CFLAGS_WARN_OFF = -w
QMAKE_CFLAGS_RELEASE = -O2
QMAKE_CFLAGS_DEBUG = -g
QMAKE_CFLAGS_SHLIB = -fPIC
QMAKE_CFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_SHLIB
QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses
QMAKE_CFLAGS_THREAD = -pthread
QMAKE_CXX = g++
QMAKE_CXXFLAGS = $$QMAKE_CFLAGS
QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS
QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE
QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG
QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB
QMAKE_CXXFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_STATIC_LIB
QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC
QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
QMAKE_INCDIR = /usr/local/include
@ -44,31 +20,19 @@ QMAKE_LIBDIR_X11 = /usr/X11R6/lib
QMAKE_INCDIR_OPENGL = /usr/X11R6/include
QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib
QMAKE_LINK = g++
QMAKE_LINK_SHLIB = g++
QMAKE_LINK_C = gcc
QMAKE_LINK_C_SHLIB = gcc
QMAKE_LINK_SHLIB_CMD = $$QMAKE_LINK_SHLIB $(LFLAGS) \
$$QMAKE_CFLAGS_SHLIB $$QMAKE_LFLAGS \
-o $(TARGETD) $(OBJECTS) $(OBJMOC) $(LIBS)
QMAKE_LFLAGS =
QMAKE_LFLAGS_RELEASE =
QMAKE_LFLAGS_DEBUG =
QMAKE_LFLAGS_SHLIB = -shared
QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB
QMAKE_LFLAGS_SONAME = -Wl,-soname,
QMAKE_LFLAGS_THREAD = -pthread
QMAKE_LFLAGS_NOUNDEF = -Wl,-no_unresolved
QMAKE_LFLAGS_NOUNDEF =
QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD =
QMAKE_LIBS_EXECINFO = -lexecinfo
QMAKE_LIBS_X11 = -lXext -lX11 -lm
QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_THREAD =
QMAKE_AR = ar q
QMAKE_AR = ar cqs
QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB = ranlib
QMAKE_RANLIB =
load(qt_config)

View File

@ -79,31 +79,7 @@
#undef QT_OPEN_LARGEFILE
#define QT_OPEN_LARGEFILE 0
// QT_SOCKLEN_T
// OpenBSD 2.2 - 2.4 int
// OpenBSD 2.5 - 2.8 socklen_t
#define QT_SNPRINTF ::snprintf
#define QT_VSNPRINTF ::vsnprintf
// 1003.1c-1995 says on page 38 (2.9.3, paragraph 3) that if _POSIX_THREADS
// is defined, then _POSIX_THREAD_SAFE_FUNCTIONS must also be defined.
// However this looks like a well-known typo (reversed dependency).
//
// On the other hand _POSIX_THREAD_SAFE_FUNCTIONS should be defined only
// if the Thread-Safe Functions option is implemented. OpenBSD does not
// support all of the required _r() interfaces, especially getpwuid_r(),
// which means it should not define _POSIX_THREAD_SAFE_FUNCTIONS.
//
// Since OpenBSD does define _POSIX_THREAD_SAFE_FUNCTIONS, we have to
// undefine it behind its back.
#ifdef _POSIX_THREAD_SAFE_FUNCTIONS
#undef _POSIX_THREAD_SAFE_FUNCTIONS
#endif
// Older OpenBSD versions may still use the a.out format instead of ELF.
#ifndef __ELF__
#define QT_AOUT_UNDERSCORE
#endif
#endif // QPLATFORMDEFS_H

View File

@ -1,40 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the qmake spec of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "../../freebsd-clang/qplatformdefs.h"

View File

@ -1,44 +0,0 @@
#
# qmake configuration for freebsd-g++46 (using g++46 from ports/lang/gcc)
#
MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = freebsd bsd
include(../../common/unix.conf)
QMAKE_CFLAGS_THREAD = -pthread -D_THREAD_SAFE
QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
# Addon software goes into /usr/local on the BSDs, by default we will look there
QMAKE_INCDIR = /usr/local/include
QMAKE_LIBDIR = /usr/local/lib
QMAKE_LFLAGS_THREAD = -pthread
QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD =
QMAKE_LIBS_EXECINFO = -lexecinfo
QMAKE_LIBS_X11 = -lXext -lX11 -lm
QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_THREAD =
QMAKE_AR = ar cqs
QMAKE_OBJCOPY = objcopy
QMAKE_NM = nm -P
QMAKE_RANLIB =
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
# Redefined here because g++-base.conf sets QMAKE_CC and QMAKE_CXX
# to gcc and g++, respectively.
QMAKE_CC = gcc46
QMAKE_CXX = g++46
QMAKE_LINK_C = $$QMAKE_CC
QMAKE_LINK_C_SHLIB = $$QMAKE_CC
QMAKE_LINK = $$QMAKE_CXX
QMAKE_LINK_SHLIB = $$QMAKE_CXX
load(qt_config)

View File

@ -1,40 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the qmake spec of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "../../freebsd-clang/qplatformdefs.h"

View File

@ -1616,6 +1616,13 @@
\note Platform-specific variables that change the extension override
the contents of this variable.
\target QMAKE_EXTENSION_STATICLIB
\section1 QMAKE_EXTENSION_STATICLIB
Contains the extension for shared static libraries. The value of
this variable is typically handled by qmake or
\l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
\section1 QMAKE_EXT_MOC
Contains the extension used on included moc files.

View File

@ -30,6 +30,9 @@
#include "forkfd.h"
#include <sys/types.h>
#if defined(__OpenBSD__) || defined(__NetBSD__)
# include <sys/param.h>
#endif
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>
@ -65,7 +68,9 @@
# undef HAVE_WAITID
#endif
#if defined(__FreeBSD__) && defined(__FreeBSD_version) && __FreeBSD_version >= 1000032
#if (defined(__FreeBSD__) && defined(__FreeBSD_version) && __FreeBSD_version >= 1000032) || \
(defined(__OpenBSD__) && OpenBSD >= 201505) || \
(defined(__NetBSD__) && __NetBSD_Version__ >= 600000000)
# define HAVE_PIPE2 1
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) || \
@ -410,6 +415,26 @@ chain_handler:
old_sigaction.sa_handler(signum);
}
static void ignore_sigpipe()
{
#ifdef O_NOSIGPIPE
static ffd_atomic_int done = FFD_ATOMIC_INIT(0);
if (ffd_atomic_load(&done, FFD_ATOMIC_RELAXED))
return;
#endif
struct sigaction action;
memset(&action, 0, sizeof action);
sigemptyset(&action.sa_mask);
action.sa_handler = SIG_IGN;
action.sa_flags = 0;
sigaction(SIGPIPE, &action, NULL);
#ifdef O_NOSIGPIPE
ffd_atomic_store(&done, 1, FFD_ATOMIC_RELAXED);
#endif
}
static void forkfd_initialize()
{
#if defined(HAVE_BROKEN_WAITID)
@ -446,6 +471,11 @@ static void forkfd_initialize()
*/
sigaction(SIGCHLD, &action, &old_sigaction);
#ifndef O_NOSIGPIPE
/* disable SIGPIPE too */
ignore_sigpipe();
#endif
#ifndef __GNUC__
atexit(cleanup);
#endif
@ -486,13 +516,23 @@ static void cleanup()
static int create_pipe(int filedes[], int flags)
{
int ret;
int ret = -1;
#ifdef HAVE_PIPE2
/* use pipe2(2) whenever possible, since it can thread-safely create a
* cloexec pair of pipes. Without it, we have a race condition setting
* FD_CLOEXEC
*/
ret = pipe2(filedes, O_CLOEXEC);
# ifdef O_NOSIGPIPE
/* try first with O_NOSIGPIPE */
ret = pipe2(filedes, O_CLOEXEC | O_NOSIGPIPE);
if (ret == -1) {
/* O_NOSIGPIPE not supported, ignore SIGPIPE */
ignore_sigpipe();
}
# endif
if (ret == -1)
ret = pipe2(filedes, O_CLOEXEC);
if (ret == -1)
return ret;

View File

@ -68,12 +68,7 @@ DEFINES += FT2_BUILD_LIBRARY
DEFINES += FT_CONFIG_OPTION_SYSTEM_ZLIB
include(../zlib_dependency.pri)
contains(QT_CONFIG, system-png) {
DEFINES += FT_CONFIG_OPTION_USE_PNG
include($$PWD/../png_dependency.pri)
} else:!contains(QT_CONFIG, no-png):!win32 {
DEFINES += FT_CONFIG_OPTION_USE_PNG
include($$PWD/../libpng.pri)
}
DEFINES += FT_CONFIG_OPTION_USE_PNG
include($$PWD/../png_dependency.pri)
DEFINES += TT_CONFIG_OPTION_SUBPIXEL_HINTING

View File

@ -1,21 +0,0 @@
DEFINES += PNG_ARM_NEON_OPT=0
INCLUDEPATH += $$PWD/libpng
SOURCES += $$PWD/libpng/png.c \
$$PWD/libpng/pngerror.c \
$$PWD/libpng/pngget.c \
$$PWD/libpng/pngmem.c \
$$PWD/libpng/pngpread.c \
$$PWD/libpng/pngread.c \
$$PWD/libpng/pngrio.c \
$$PWD/libpng/pngrtran.c \
$$PWD/libpng/pngrutil.c \
$$PWD/libpng/pngset.c \
$$PWD/libpng/pngtrans.c \
$$PWD/libpng/pngwio.c \
$$PWD/libpng/pngwrite.c \
$$PWD/libpng/pngwtran.c \
$$PWD/libpng/pngwutil.c
TR_EXCLUDE += $$PWD/*
include($$PWD/zlib_dependency.pri)

31
src/3rdparty/libpng/libpng.pro vendored Normal file
View File

@ -0,0 +1,31 @@
TARGET = qtpng
CONFIG += \
static \
hide_symbols \
exceptions_off rtti_off warn_off \
installed
load(qt_helper_lib)
DEFINES += PNG_ARM_NEON_OPT=0
SOURCES += \
png.c \
pngerror.c \
pngget.c \
pngmem.c \
pngpread.c \
pngread.c \
pngrio.c \
pngrtran.c \
pngrutil.c \
pngset.c \
pngtrans.c \
pngwio.c \
pngwrite.c \
pngwtran.c \
pngwutil.c
TR_EXCLUDE += $$PWD/*
include(../zlib_dependency.pri)

View File

@ -2,5 +2,6 @@ contains(QT_CONFIG, system-png) {
unix|mingw: LIBS_PRIVATE += -lpng
else: LIBS += libpng.lib
} else: contains(QT_CONFIG, png) {
include($$PWD/libpng.pri)
INCLUDEPATH += $$PWD/libpng
LIBS_PRIVATE += -L$$QT_BUILD_TREE/lib -lqtpng$$qtPlatformTargetSuffix()
}

View File

@ -77,7 +77,7 @@ static qint64 getticks()
static qint64 getticks()
{
#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0)
#if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0)) || defined(Q_OS_OPENBSD)
clockid_t clockId;
#ifndef _POSIX_THREAD_CPUTIME

View File

@ -46,6 +46,21 @@ if (NOT TARGET Qt5::rcc)
)
endif()
if (NOT TARGET Qt5::qdoc)
add_executable(Qt5::qdoc IMPORTED)
!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}qdoc$$CMAKE_BIN_SUFFIX\")
!!ELSE
set(imported_location \"$${CMAKE_BIN_DIR}qdoc$$CMAKE_BIN_SUFFIX\")
!!ENDIF
_qt5_Core_check_file_exists(${imported_location})
set_target_properties(Qt5::qdoc PROPERTIES
IMPORTED_LOCATION ${imported_location}
)
endif()
set(Qt5Core_QMAKE_EXECUTABLE Qt5::qmake)
set(Qt5Core_MOC_EXECUTABLE Qt5::moc)
set(Qt5Core_RCC_EXECUTABLE Qt5::rcc)

View File

@ -54,15 +54,13 @@ QT_BEGIN_NAMESPACE
\class QVariantAnimation
\inmodule QtCore
\ingroup animation
\brief The QVariantAnimation class provides an abstract base class for animations.
\brief The QVariantAnimation class provides a base class for animations.
\since 4.6
This class is part of \l{The Animation Framework}. It serves as a
base class for property and item animations, with functions for
shared functionality.
QVariantAnimation cannot be used directly as it is an abstract
class; it has a pure virtual method called updateCurrentValue().
The class performs interpolation over
\l{QVariant}s, but leaves using the interpolated values to its
subclasses. Currently, Qt provides QPropertyAnimation, which
@ -75,7 +73,7 @@ QT_BEGIN_NAMESPACE
start the animation. QVariantAnimation will interpolate the
property of the target object and emit valueChanged(). To react to
a change in the current value you have to reimplement the
updateCurrentValue() virtual function.
updateCurrentValue() virtual function or connect to said signal.
It is also possible to set values at specified steps situated
between the start and end value. The interpolation will then

View File

@ -118,11 +118,12 @@
\section1 Animating Qt Properties
As mentioned in the previous section, the QPropertyAnimation class
can interpolate over Qt properties. It is this class that should
be used for animation of values; in fact, its superclass,
QVariantAnimation, is an abstract class, and cannot be used
directly.
As mentioned in the previous section, the QPropertyAnimation class can
interpolate over Qt properties. It is often this class that should be used
for animation of values; in fact, its superclass, QVariantAnimation, has an
empty implementation of \l{QAbstractAnimation::}{updateCurrentValue()}, and
does not change any value unless we change it ourselves on the
\l{QVariantAnimation::valueChanged()}{valueChanged signal}.
A major reason we chose to animate Qt properties is that it
presents us with freedom to animate already existing classes in

View File

@ -28,8 +28,9 @@ SOURCES += \
global/qmalloc.cpp \
global/qnumeric.cpp \
global/qlogging.cpp \
global/qhooks.cpp \
global/qversiontagging.cpp
global/qhooks.cpp
VERSIONTAGGING_SOURCES = global/qversiontagging.cpp
# qlibraryinfo.cpp includes qconfig.cpp
INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global
@ -63,3 +64,21 @@ journald {
syslog {
DEFINES += QT_USE_SYSLOG
}
gcc:ltcg {
versiontagging_compiler.commands = $$QMAKE_CXX -c $(CXXFLAGS) $(INCPATH)
# Disable LTO, as the symbols disappear somehow under GCC
versiontagging_compiler.commands += -fno-lto
versiontagging_compiler.commands += -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
versiontagging_compiler.dependency_type = TYPE_C
versiontagging_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
versiontagging_compiler.input = VERSIONTAGGING_SOURCES
versiontagging_compiler.variable_out = OBJECTS
versiontagging_compiler.name = compiling[versiontagging] ${QMAKE_FILE_IN}
silent: versiontagging_compiler.commands = @echo compiling[versiontagging] ${QMAKE_FILE_IN} && $$versiontagging_compiler.commands
QMAKE_EXTRA_COMPILERS += versiontagging_compiler
} else {
SOURCES += $$VERSIONTAGGING_SOURCES
}

View File

@ -748,7 +748,9 @@
# define Q_COMPILER_TEMPLATE_ALIAS
# endif
# if __has_feature(cxx_thread_local)
# define Q_COMPILER_THREAD_LOCAL
# if !defined(__FreeBSD__) /* FreeBSD clang fails on __cxa_thread_atexit */
# define Q_COMPILER_THREAD_LOCAL
# endif
# endif
# if __has_feature(cxx_user_literals)
# define Q_COMPILER_UDL
@ -1108,7 +1110,8 @@
# define Q_DECL_NOTHROW Q_DECL_NOEXCEPT
#endif
#if defined(Q_COMPILER_ALIGNOF) && !defined(Q_ALIGNOF)
#if defined(Q_COMPILER_ALIGNOF)
# undef Q_ALIGNOF
# define Q_ALIGNOF(x) alignof(x)
#endif

View File

@ -49,6 +49,11 @@
QT_BEGIN_NAMESPACE
#ifdef __has_builtin
# define QT_HAS_BUILTIN(x) __has_builtin(x)
#else
# define QT_HAS_BUILTIN(x) 0
#endif
/*
* ENDIAN FUNCTIONS
@ -71,18 +76,29 @@ template <typename T> inline void qbswap(const T src, uchar *dest)
// Used to implement a type-safe and alignment-safe copy operation
// If you want to avoid the memcpy, you must write specializations for these functions
template <typename T> inline void qToUnaligned(const T src, uchar *dest)
template <typename T> Q_ALWAYS_INLINE void qToUnaligned(const T src, uchar *dest)
{
// Using sizeof(T) inside memcpy function produces internal compiler error with
// MSVC2008/ARM in tst_endian -> use extra indirection to resolve size of T.
const size_t size = sizeof(T);
memcpy(dest, &src, size);
#if QT_HAS_BUILTIN(__builtin_memcpy)
__builtin_memcpy
#else
memcpy
#endif
(dest, &src, size);
}
template <typename T> inline T qFromUnaligned(const uchar *src)
template <typename T> Q_ALWAYS_INLINE T qFromUnaligned(const uchar *src)
{
T dest;
const size_t size = sizeof(T);
memcpy(&dest, src, size);
#if QT_HAS_BUILTIN(__builtin_memcpy)
__builtin_memcpy
#else
memcpy
#endif
(&dest, src, size);
return dest;
}

View File

@ -33,6 +33,29 @@
little and big endian representations of numbers.
*/
/*!
\internal
\fn T qFromUnaligned(const uchar *ptr)
\since 5.5
Loads a \c{T} from address \a ptr, which may be misaligned.
Use of this function avoids the undefined behavior that the C++ standard
otherwise attributes to unaligned loads.
*/
/*!
\internal
\fn void qToUnaligned(T t, uchar *ptr)
\since 4.5
Stores \a t to address \a ptr, which may be misaligned.
Use of this function avoids the undefined behavior that the C++ standard
otherwise attributes to unaligned stores.
*/
/*!
\fn T qFromBigEndian(const uchar *src)
\since 4.3

View File

@ -67,7 +67,7 @@ quintptr Q_CORE_EXPORT qtHookData[] = {
// The required sizes and offsets are tested in tests/auto/other/toolsupport.
// When this fails and the change was intentional, adjust the test and
// adjust this value here.
14
15
};
Q_STATIC_ASSERT(QHooks::LastHookIndex == sizeof(qtHookData) / sizeof(qtHookData[0]));

View File

@ -66,6 +66,7 @@
NETBSD - NetBSD
OPENBSD - OpenBSD
BSDI - BSD/OS
INTERIX - Interix
IRIX - SGI Irix
OSF - HP Tru64 UNIX
SCO - SCO OpenServer 5
@ -172,6 +173,9 @@
#elif defined(__bsdi__)
# define Q_OS_BSDI
# define Q_OS_BSD4
#elif defined(__INTERIX)
# define Q_OS_INTERIX
# define Q_OS_BSD4
#elif defined(__sgi)
# define Q_OS_IRIX
#elif defined(__osf__)

View File

@ -144,7 +144,6 @@ win32 {
!nacl:mac: {
SOURCES += io/qsettings_mac.cpp
}
freebsd: LIBS_PRIVATE += -lutil # qlockfile_unix.cpp requires this
mac {
SOURCES += io/qstorageinfo_mac.cpp
OBJECTIVE_SOURCES += io/qstandardpaths_mac.mm

View File

@ -166,16 +166,15 @@ void QDebug::putUcs4(uint ucs4)
{
maybeQuote('\'');
if (ucs4 < 0x20) {
stream->ts << hex << "\\x" << ucs4 << reset;
stream->ts << "\\x" << hex << ucs4 << reset;
} else if (ucs4 < 0x80) {
stream->ts << char(ucs4);
} else {
stream->ts << hex << qSetPadChar(QLatin1Char('0'));
if (ucs4 < 0x10000)
stream->ts << qSetFieldWidth(4) << "\\u";
stream->ts << "\\u" << qSetFieldWidth(4);
else
stream->ts << qSetFieldWidth(8) << "\\U";
stream->ts << ucs4 << reset;
stream->ts << "\\U" << qSetFieldWidth(8);
stream->ts << hex << qSetPadChar(QLatin1Char('0')) << ucs4 << reset;
}
maybeQuote('\'');
}

View File

@ -820,7 +820,7 @@ QString QFileInfo::completeBaseName() const
}
/*!
Returns the complete suffix of the file.
Returns the complete suffix (extension) of the file.
The complete suffix consists of all characters in the file after
(but not including) the first '.'.
@ -839,7 +839,7 @@ QString QFileInfo::completeSuffix() const
}
/*!
Returns the suffix of the file.
Returns the suffix (extension) of the file.
The suffix consists of all characters in the file after (but not
including) the last '.'.

View File

@ -58,7 +58,7 @@
# include "qfilesystemwatcher_win_p.h"
#elif defined(USE_INOTIFY)
# include "qfilesystemwatcher_inotify_p.h"
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(QT_PLATFORM_UIKIT)
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(QT_PLATFORM_UIKIT)
# include "qfilesystemwatcher_kqueue_p.h"
#elif defined(Q_OS_OSX)
# include "qfilesystemwatcher_fsevents_p.h"
@ -74,7 +74,7 @@ QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine(QObject
// there is a chance that inotify may fail on Linux pre-2.6.13 (August
// 2005), so we can't just new inotify directly.
return QInotifyFileSystemWatcherEngine::create(parent);
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(QT_PLATFORM_UIKIT)
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(QT_PLATFORM_UIKIT)
return QKqueueFileSystemWatcherEngine::create(parent);
#elif defined(Q_OS_OSX)
return QFseventsFileSystemWatcherEngine::create(parent);

View File

@ -172,7 +172,6 @@ QStringList QKqueueFileSystemWatcherEngine::removePaths(const QStringList &paths
QStringList *files,
QStringList *directories)
{
bool isEmpty;
QStringList p = paths;
if (pathToID.isEmpty())
return p;
@ -193,7 +192,6 @@ QStringList QKqueueFileSystemWatcherEngine::removePaths(const QStringList &paths
else
files->removeAll(path);
}
isEmpty = pathToID.isEmpty();
return p;
}

View File

@ -71,14 +71,12 @@
#elif defined(Q_OS_HAIKU)
# include <kernel/OS.h>
#elif defined(Q_OS_BSD4) && !defined(QT_PLATFORM_UIKIT)
# if !defined(Q_OS_NETBSD)
# include <sys/user.h>
# if defined(__GLIBC__) && defined(__FreeBSD_kernel__)
# endif
# include <sys/cdefs.h>
# include <sys/param.h>
# include <sys/sysctl.h>
# else
# include <libutil.h>
# endif
#endif
QT_BEGIN_NAMESPACE
@ -286,30 +284,33 @@ QString QLockFilePrivate::processNameByPid(qint64 pid)
return QString();
return QFile::decodeName(info.name);
#elif defined(Q_OS_BSD4) && !defined(QT_PLATFORM_UIKIT)
# if defined(__GLIBC__) && defined(__FreeBSD_kernel__)
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid };
size_t len = 0;
if (sysctl(mib, 4, NULL, &len, NULL, 0) < 0)
return QString();
kinfo_proc *proc = static_cast<kinfo_proc *>(malloc(len));
# if defined(Q_OS_NETBSD)
struct kinfo_proc2 kp;
int mib[6] = { CTL_KERN, KERN_PROC2, KERN_PROC_PID, (int)pid, sizeof(struct kinfo_proc2), 1 };
# elif defined(Q_OS_OPENBSD)
struct kinfo_proc kp;
int mib[6] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, (int)pid, sizeof(struct kinfo_proc), 1 };
# else
kinfo_proc *proc = kinfo_getproc(pid);
struct kinfo_proc kp;
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, (int)pid };
# endif
if (!proc)
size_t len = sizeof(kp);
u_int mib_len = sizeof(mib)/sizeof(u_int);
if (sysctl(mib, mib_len, &kp, &len, NULL, 0) < 0)
return QString();
# if defined(__GLIBC__) && defined(__FreeBSD_kernel__)
if (sysctl(mib, 4, proc, &len, NULL, 0) < 0) {
free(proc);
# if defined(Q_OS_OPENBSD) || defined(Q_OS_NETBSD)
if (kp.p_pid != pid)
return QString();
}
if (proc->ki_pid != pid) {
free(proc);
QString name = QFile::decodeName(kp.p_comm);
# else
if (kp.ki_pid != pid)
return QString();
}
QString name = QFile::decodeName(kp.ki_comm);
# endif
QString name = QFile::decodeName(proc->ki_comm);
free(proc);
return name;
#else
Q_UNUSED(pid);
return QString();

View File

@ -143,9 +143,11 @@ bool QLockFilePrivate::isApparentlyStale() const
if (!procHandle)
return true;
// We got a handle but check if process is still alive
DWORD dwR = ::WaitForSingleObject(procHandle, 0);
DWORD exitCode = 0;
if (!::GetExitCodeProcess(procHandle, &exitCode))
exitCode = 0;
::CloseHandle(procHandle);
if (dwR == WAIT_TIMEOUT)
if (exitCode != STILL_ACTIVE)
return true;
const QString processName = processNameByPid(pid);
if (!processName.isEmpty() && processName != appname)

View File

@ -2087,10 +2087,7 @@ void QProcess::start(const QString &program, const QStringList &arguments, OpenM
return;
}
if (program.isEmpty()) {
Q_D(QProcess);
d->processError = QProcess::FailedToStart;
setErrorString(tr("No program defined"));
emit error(d->processError);
d->setErrorAndEmit(QProcess::FailedToStart, tr("No program defined"));
return;
}
@ -2117,10 +2114,7 @@ void QProcess::start(OpenMode mode)
return;
}
if (d->program.isEmpty()) {
Q_D(QProcess);
d->processError = QProcess::FailedToStart;
setErrorString(tr("No program defined"));
emit error(d->processError);
d->setErrorAndEmit(QProcess::FailedToStart, tr("No program defined"));
return;
}

View File

@ -84,7 +84,7 @@
# if !defined(ST_RDONLY)
# define ST_RDONLY MNT_RDONLY
# endif
# if !defined(_STATFS_F_FLAGS)
# if !defined(_STATFS_F_FLAGS) && !defined(Q_OS_NETBSD)
# define _STATFS_F_FLAGS 1
# endif
#elif defined(Q_OS_ANDROID)

View File

@ -205,6 +205,8 @@ bool QWindowsPipeWriter::write(const QByteArray &ba)
void QWindowsPipeWriter::stop()
{
stopped = true;
bytesWrittenPending = false;
pendingBytesWrittenValue = 0;
if (writeSequenceStarted) {
if (!CancelIoEx(handle, &overlapped)) {
const DWORD dwError = GetLastError();

View File

@ -410,7 +410,7 @@ public:
// pack with itself, we'll discard the high part anyway
chunk = _mm_packus_epi16(chunk, chunk);
// unaligned 64-bit store
qUnalignedStore(l + i, _mm_cvtsi128_si64(chunk));
qToUnaligned(_mm_cvtsi128_si64(chunk), l + i);
i += 8;
}
# endif
@ -684,6 +684,8 @@ public:
bool operator >=(const Entry &other) const;
};
inline bool operator!=(const Entry &lhs, const Entry &rhs) { return !(lhs == rhs); }
inline bool Entry::operator >=(const QString &key) const
{
if (value.latinKey)

View File

@ -599,8 +599,8 @@ bool QJsonObject::operator==(const QJsonObject &other) const
for (uint i = 0; i < o->length; ++i) {
QJsonPrivate::Entry *e = o->entryAt(i);
QJsonValue v(d, o, e->value);
if (other.value(e->key()) != v)
QJsonPrivate::Entry *oe = other.o->entryAt(i);
if (*e != *oe || QJsonValue(d, o, e->value) != QJsonValue(other.d, other.o, oe->value))
return false;
}

View File

@ -275,25 +275,11 @@ QJsonValue::QJsonValue(const QJsonValue &other)
*/
QJsonValue &QJsonValue::operator =(const QJsonValue &other)
{
if (t == String && stringData && !stringData->ref.deref())
free(stringData);
t = other.t;
dbl = other.dbl;
if (d != other.d) {
if (d && !d->ref.deref())
delete d;
d = other.d;
if (d)
d->ref.ref();
}
if (t == String && stringData)
stringData->ref.ref();
QJsonValue copy(other);
// swap(copy);
qSwap(dbl, copy.dbl);
qSwap(d, copy.d);
qSwap(t, copy.t);
return *this;
}

View File

@ -41,16 +41,6 @@
#include "qcore_unix_p.h"
#include "qelapsedtimer.h"
#ifdef Q_OS_NACL
#elif !defined (Q_OS_VXWORKS)
# if !defined(Q_OS_HPUX) || defined(__ia64)
# include <sys/select.h>
# endif
# include <sys/time.h>
#else
# include <selectLib.h>
#endif
#include <stdlib.h>
#ifdef Q_OS_MAC

View File

@ -65,6 +65,16 @@
#include <sys/stat.h>
#include <unistd.h>
#ifdef Q_OS_NACL
#elif !defined (Q_OS_VXWORKS)
# if !defined(Q_OS_HPUX) || defined(__ia64)
# include <sys/select.h>
# endif
# include <sys/time.h>
#else
# include <selectLib.h>
#endif
#include <sys/wait.h>
#include <errno.h>
#include <fcntl.h>

View File

@ -4699,7 +4699,7 @@ QMetaObject::Connection QObjectPrivate::connectImpl(const QObject *sender, int s
QOrderedMutexLocker locker(signalSlotLock(sender),
signalSlotLock(receiver));
if (type & Qt::UniqueConnection) {
if (type & Qt::UniqueConnection && slot) {
QObjectConnectionListVector *connectionLists = QObjectPrivate::get(s)->connectionLists;
if (connectionLists && connectionLists->count() > signal_index) {
const QObjectPrivate::Connection *c2 =

View File

@ -302,7 +302,6 @@ public:
connect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, const QObject *context, Func2 slot,
Qt::ConnectionType type = Qt::AutoConnection)
{
#if defined (Q_COMPILER_VARIADIC_TEMPLATES)
typedef QtPrivate::FunctionPointer<Func1> SignalType;
const int FunctorArgumentCount = QtPrivate::ComputeFunctorArgumentCount<Func2 , typename SignalType::Arguments>::Value;
@ -310,28 +309,6 @@ public:
"Signal and slot arguments are not compatible.");
const int SlotArgumentCount = (FunctorArgumentCount >= 0) ? FunctorArgumentCount : 0;
typedef typename QtPrivate::FunctorReturnType<Func2, typename QtPrivate::List_Left<typename SignalType::Arguments, SlotArgumentCount>::Value>::Value SlotReturnType;
#else
// Without variadic template, we don't detect the best overload of operator(). We just
// assume there is only one simple operator() and connect to &Func2::operator()
/* If you get an error such as:
couldn't deduce template parameter 'Func2Operator'
or
cannot resolve address of overloaded function
It means the functor does not have a single operator().
Functors with overloaded or templated operator() are only supported if the compiler supports
C++11 variadic templates
*/
typedef QtPrivate::FunctionPointer<decltype(&Func2::operator())> SlotType ;
typedef QtPrivate::FunctionPointer<Func1> SignalType;
typedef typename SlotType::ReturnType SlotReturnType;
const int SlotArgumentCount = SlotType::ArgumentCount;
Q_STATIC_ASSERT_X(int(SignalType::ArgumentCount) >= SlotArgumentCount,
"The slot requires more arguments than the signal provides.");
Q_STATIC_ASSERT_X((QtPrivate::CheckCompatibleArguments<typename SignalType::Arguments, typename SlotType::Arguments>::value),
"Signal and slot arguments are not compatible.");
#endif
Q_STATIC_ASSERT_X((QtPrivate::AreArgumentsCompatible<SlotReturnType, typename SignalType::ReturnType>::value),
"Return type of the slot is not compatible with the return type of the signal.");
@ -446,8 +423,7 @@ protected:
QScopedPointer<QObjectData> d_ptr;
static const QMetaObject staticQtMetaObject;
friend inline const QMetaObject *qt_getQtMetaObject() Q_DECL_NOEXCEPT
{ return &staticQtMetaObject; }
friend inline const QMetaObject *qt_getQtMetaObject() Q_DECL_NOEXCEPT;
friend struct QMetaObject;
friend struct QMetaObjectPrivate;
@ -478,6 +454,9 @@ inline QMetaObject::Connection QObject::connect(const QObject *asender, const ch
const char *amember, Qt::ConnectionType atype) const
{ return connect(asender, asignal, this, amember, atype); }
inline const QMetaObject *qt_getQtMetaObject() Q_DECL_NOEXCEPT
{ return &QObject::staticQtMetaObject; }
#ifndef QT_NO_USERDATA
class Q_CORE_EXPORT QObjectUserData {
public:

View File

@ -62,34 +62,6 @@ namespace QtPrivate {
If one of the type is not declared, the function return 0 and the signal
cannot be used in queued connection.
*/
#ifndef Q_COMPILER_VARIADIC_TEMPLATES
template <typename ArgList> struct TypesAreDeclaredMetaType { enum { Value = false }; };
template <> struct TypesAreDeclaredMetaType<void> { enum { Value = true }; };
template <typename Arg, typename Tail> struct TypesAreDeclaredMetaType<List<Arg, Tail> > { enum { Value = QMetaTypeId2<Arg>::Defined && TypesAreDeclaredMetaType<Tail>::Value }; };
template <typename ArgList, bool Declared = TypesAreDeclaredMetaType<ArgList>::Value > struct ConnectionTypes
{ static const int *types() { return 0; } };
template <> struct ConnectionTypes<void, true>
{ static const int *types() { static const int t[1] = { 0 }; return t; } };
template <typename Arg1> struct ConnectionTypes<List<Arg1, void>, true>
{ static const int *types() { static const int t[2] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), 0 }; return t; } };
template <typename Arg1, typename Arg2> struct ConnectionTypes<List<Arg1, List<Arg2, void> >, true>
{ static const int *types() { static const int t[3] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg2>::qt_metatype_id(), 0 }; return t; } };
template <typename Arg1, typename Arg2, typename Arg3> struct ConnectionTypes<List<Arg1, List<Arg2, List<Arg3, void> > >, true>
{ static const int *types() { static const int t[4] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg2>::qt_metatype_id(),
QtPrivate::QMetaTypeIdHelper<Arg3>::qt_metatype_id(), 0 }; return t; } };
template <typename Arg1, typename Arg2, typename Arg3, typename Arg4> struct ConnectionTypes<List<Arg1, List<Arg2, List<Arg3, List<Arg4, void> > > >, true>
{ static const int *types() { static const int t[5] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg2>::qt_metatype_id(),
QtPrivate::QMetaTypeIdHelper<Arg3>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg4>::qt_metatype_id(), 0 }; return t; } };
template <typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> struct ConnectionTypes<List<Arg1, List<Arg2, List<Arg3, List<Arg4, List<Arg5, void> > > > >, true>
{ static const int *types() { static const int t[6] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg2>::qt_metatype_id(),
QtPrivate::QMetaTypeIdHelper<Arg3>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg4>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg5>::qt_metatype_id(), 0 }; return t; } };
template <typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5, typename Arg6>
struct ConnectionTypes<List<Arg1, List<Arg2, List<Arg3, List<Arg4, List<Arg5, List<Arg6, void> > > > > >, true>
{ static const int *types() { static const int t[7] = { QtPrivate::QMetaTypeIdHelper<Arg1>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg2>::qt_metatype_id(),
QtPrivate::QMetaTypeIdHelper<Arg3>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg4>::qt_metatype_id(), QtPrivate::QMetaTypeIdHelper<Arg5>::qt_metatype_id(),
QtPrivate::QMetaTypeIdHelper<Arg6>::qt_metatype_id(), 0 }; return t; } };
#else
template <typename ArgList> struct TypesAreDeclaredMetaType { enum { Value = false }; };
template <> struct TypesAreDeclaredMetaType<List<>> { enum { Value = true }; };
template <typename Arg, typename... Tail> struct TypesAreDeclaredMetaType<List<Arg, Tail...> >
@ -101,7 +73,6 @@ namespace QtPrivate {
{ static const int *types() { return Q_NULLPTR; } };
template <typename... Args> struct ConnectionTypes<List<Args...>, true>
{ static const int *types() { static const int t[sizeof...(Args) + 1] = { (QtPrivate::QMetaTypeIdHelper<Args>::qt_metatype_id())..., 0 }; return t; } };
#endif
// internal base class (interface) containing functions required to call a slot managed by a pointer to function.
class QSlotObjectBase {

View File

@ -65,11 +65,6 @@ namespace QtPrivate {
List_Left<L,N> take a list and a number as a parameter and returns (via the Value typedef,
the list composed of the first N element of the list
*/
#ifndef Q_COMPILER_VARIADIC_TEMPLATES
template <typename Head, typename Tail> struct List { typedef Head Car; typedef Tail Cdr; };
template <typename L, int N> struct List_Left { typedef List<typename L::Car, typename List_Left<typename L::Cdr, N - 1>::Value > Value; };
template <typename L> struct List_Left<L,0> { typedef void Value; };
#else
// With variadic template, lists are represented using a variadic template argument instead of the lisp way
template <typename...> struct List {};
template <typename Head, typename... Tail> struct List<Head, Tail...> { typedef Head Car; typedef List<Tail...> Cdr; };
@ -79,7 +74,6 @@ namespace QtPrivate {
typedef typename List_Append<List<typename L::Car>,typename List_Left<typename L::Cdr, N - 1>::Value>::Value Value;
};
template <typename L> struct List_Left<L, 0> { typedef List<> Value; };
#endif
// List_Select<L,N> returns (via typedef Value) the Nth element of the list L
template <typename L, int N> struct List_Select { typedef typename List_Select<typename L::Cdr, N - 1>::Value Value; };
template <typename L> struct List_Select<L,0> { typedef typename L::Car Value; };
@ -100,13 +94,11 @@ namespace QtPrivate {
if (container.data)
*reinterpret_cast<U*>(container.data) = value;
}
#ifdef Q_COMPILER_RVALUE_REFS
template<typename T, typename U>
void operator,(T &&value, const ApplyReturnValue<U> &container) {
if (container.data)
*reinterpret_cast<U*>(container.data) = value;
}
#endif
template<typename T>
void operator,(T, const ApplyReturnValue<void> &) {}
@ -127,364 +119,6 @@ namespace QtPrivate {
The Functor<Func,N> struct is the helper to call a functor of N argument.
its call function is the same as the FunctionPointer::call function.
*/
#ifndef Q_COMPILER_VARIADIC_TEMPLATES
template<typename Func> struct FunctionPointer { enum {ArgumentCount = -1, IsPointerToMemberFunction = false}; };
//Pointers to member functions
template<class Obj, typename Ret> struct FunctionPointer<Ret (Obj::*) ()>
{
typedef Obj Object;
typedef void Arguments;
typedef Ret ReturnType;
typedef Ret (Obj::*Function) ();
enum {ArgumentCount = 0, IsPointerToMemberFunction = true};
template <typename Args, typename R>
static void call(Function f, Obj *o, void **arg) { (o->*f)(), ApplyReturnValue<R>(arg[0]); }
};
template<class Obj, typename Ret, typename Arg1> struct FunctionPointer<Ret (Obj::*) (Arg1)>
{
typedef Obj Object;
typedef List<Arg1, void> Arguments;
typedef Ret ReturnType;
typedef Ret (Obj::*Function) (Arg1);
enum {ArgumentCount = 1, IsPointerToMemberFunction = true};
template <typename Args, typename R>
static void call(Function f, Obj *o, void **arg) {
(o->*f)((*reinterpret_cast<typename RemoveRef<typename Args::Car>::Type *>(arg[1]))), ApplyReturnValue<R>(arg[0]);
}
};
template<class Obj, typename Ret, typename Arg1, typename Arg2> struct FunctionPointer<Ret (Obj::*) (Arg1, Arg2)>
{
typedef Obj Object;
typedef List<Arg1, List<Arg2, void> > Arguments;
typedef Ret ReturnType;
typedef Ret (Obj::*Function) (Arg1, Arg2);
enum {ArgumentCount = 2, IsPointerToMemberFunction = true};
template <typename Args, typename R>
static void call(Function f, Obj *o, void **arg) {
(o->*f)( *reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2])), ApplyReturnValue<R>(arg[0]);
}
};
template<class Obj, typename Ret, typename Arg1, typename Arg2, typename Arg3> struct FunctionPointer<Ret (Obj::*) (Arg1, Arg2, Arg3)>
{
typedef Obj Object;
typedef List<Arg1, List<Arg2, List<Arg3, void> > > Arguments;
typedef Ret ReturnType;
typedef Ret (Obj::*Function) (Arg1, Arg2, Arg3);
enum {ArgumentCount = 3, IsPointerToMemberFunction = true};
template <typename Args, typename R>
static void call(Function f, Obj *o, void **arg) {
(o->*f)( *reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 2>::Value>::Type *>(arg[3])), ApplyReturnValue<R>(arg[0]);
}
};
template<class Obj, typename Ret, typename Arg1, typename Arg2, typename Arg3, typename Arg4> struct FunctionPointer<Ret (Obj::*) (Arg1, Arg2, Arg3, Arg4)>
{
typedef Obj Object;
typedef List<Arg1, List<Arg2, List<Arg3, List<Arg4, void> > > > Arguments;
typedef Ret ReturnType;
typedef Ret (Obj::*Function) (Arg1, Arg2, Arg3, Arg4);
enum {ArgumentCount = 4, IsPointerToMemberFunction = true};
template <typename Args, typename R>
static void call(Function f, Obj *o, void **arg) {
(o->*f)( *reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 2>::Value>::Type *>(arg[3]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 3>::Value>::Type *>(arg[4])), ApplyReturnValue<R>(arg[0]);
}
};
template<class Obj, typename Ret, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> struct FunctionPointer<Ret (Obj::*) (Arg1, Arg2, Arg3, Arg4, Arg5)>
{
typedef Obj Object;
typedef List<Arg1, List<Arg2, List<Arg3, List<Arg4, List<Arg5, void> > > > > Arguments;
typedef Ret ReturnType;
typedef Ret (Obj::*Function) (Arg1, Arg2, Arg3, Arg4, Arg5);
enum {ArgumentCount = 5, IsPointerToMemberFunction = true};
template <typename Args, typename R>
static void call(Function f, Obj *o, void **arg) {
(o->*f)( *reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 2>::Value>::Type *>(arg[3]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 3>::Value>::Type *>(arg[4]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 4>::Value>::Type *>(arg[5])), ApplyReturnValue<R>(arg[0]);
}
};
template<class Obj, typename Ret, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5, typename Arg6>
struct FunctionPointer<Ret (Obj::*) (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)>
{
typedef Obj Object;
typedef List<Arg1, List<Arg2, List<Arg3, List<Arg4, List<Arg5, List<Arg6, void> > > > > > Arguments;
typedef Ret ReturnType;
typedef Ret (Obj::*Function) (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6);
enum {ArgumentCount = 6, IsPointerToMemberFunction = true};
template <typename Args, typename R>
static void call(Function f, Obj *o, void **arg) {
(o->*f)( *reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 2>::Value>::Type *>(arg[3]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 3>::Value>::Type *>(arg[4]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 4>::Value>::Type *>(arg[5]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 5>::Value>::Type *>(arg[6])), ApplyReturnValue<R>(arg[0]);
}
};
//Pointers to const member functions
template<class Obj, typename Ret> struct FunctionPointer<Ret (Obj::*) () const>
{
typedef Obj Object;
typedef void Arguments;
typedef Ret ReturnType;
typedef Ret (Obj::*Function) () const;
enum {ArgumentCount = 0, IsPointerToMemberFunction = true};
template <typename Args, typename R>
static void call(Function f, Obj *o, void **arg) { (o->*f)(), ApplyReturnValue<R>(arg[0]); }
};
template<class Obj, typename Ret, typename Arg1> struct FunctionPointer<Ret (Obj::*) (Arg1) const>
{
typedef Obj Object;
typedef List<Arg1, void> Arguments;
typedef Ret ReturnType;
typedef Ret (Obj::*Function) (Arg1) const;
enum {ArgumentCount = 1, IsPointerToMemberFunction = true};
template <typename Args, typename R>
static void call(Function f, Obj *o, void **arg) {
(o->*f)((*reinterpret_cast<typename RemoveRef<typename Args::Car>::Type *>(arg[1]))), ApplyReturnValue<R>(arg[0]);
}
};
template<class Obj, typename Ret, typename Arg1, typename Arg2> struct FunctionPointer<Ret (Obj::*) (Arg1, Arg2) const>
{
typedef Obj Object;
typedef List<Arg1, List<Arg2, void> > Arguments;
typedef Ret ReturnType;
typedef Ret (Obj::*Function) (Arg1, Arg2) const;
enum {ArgumentCount = 2, IsPointerToMemberFunction = true};
template <typename Args, typename R>
static void call(Function f, Obj *o, void **arg) {
(o->*f)( *reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2])), ApplyReturnValue<R>(arg[0]);
}
};
template<class Obj, typename Ret, typename Arg1, typename Arg2, typename Arg3> struct FunctionPointer<Ret (Obj::*) (Arg1, Arg2, Arg3) const>
{
typedef Obj Object;
typedef List<Arg1, List<Arg2, List<Arg3, void> > > Arguments;
typedef Ret ReturnType;
typedef Ret (Obj::*Function) (Arg1, Arg2, Arg3) const;
enum {ArgumentCount = 3, IsPointerToMemberFunction = true};
template <typename Args, typename R>
static void call(Function f, Obj *o, void **arg) {
(o->*f)( *reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 2>::Value>::Type *>(arg[3])), ApplyReturnValue<R>(arg[0]);
}
};
template<class Obj, typename Ret, typename Arg1, typename Arg2, typename Arg3, typename Arg4> struct FunctionPointer<Ret (Obj::*) (Arg1, Arg2, Arg3, Arg4) const>
{
typedef Obj Object;
typedef List<Arg1, List<Arg2, List<Arg3, List<Arg4, void> > > > Arguments;
typedef Ret ReturnType;
typedef Ret (Obj::*Function) (Arg1, Arg2, Arg3, Arg4) const;
enum {ArgumentCount = 4, IsPointerToMemberFunction = true};
template <typename Args, typename R>
static void call(Function f, Obj *o, void **arg) {
(o->*f)( *reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 2>::Value>::Type *>(arg[3]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 3>::Value>::Type *>(arg[4])), ApplyReturnValue<R>(arg[0]);
}
};
template<class Obj, typename Ret, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> struct FunctionPointer<Ret (Obj::*) (Arg1, Arg2, Arg3, Arg4, Arg5) const>
{
typedef Obj Object;
typedef List<Arg1, List<Arg2, List<Arg3, List<Arg4, List<Arg5, void> > > > > Arguments;
typedef Ret ReturnType;
typedef Ret (Obj::*Function) (Arg1, Arg2, Arg3, Arg4, Arg5) const;
enum {ArgumentCount = 5, IsPointerToMemberFunction = true};
template <typename Args, typename R>
static void call(Function f, Obj *o, void **arg) {
(o->*f)( *reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 2>::Value>::Type *>(arg[3]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 3>::Value>::Type *>(arg[4]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 4>::Value>::Type *>(arg[5])), ApplyReturnValue<R>(arg[0]);
}
};
template<class Obj, typename Ret, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5, typename Arg6>
struct FunctionPointer<Ret (Obj::*) (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) const>
{
typedef Obj Object;
typedef List<Arg1, List<Arg2, List<Arg3, List<Arg4, List<Arg5, List<Arg6, void> > > > > > Arguments;
typedef Ret ReturnType;
typedef Ret (Obj::*Function) (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) const;
enum {ArgumentCount = 6, IsPointerToMemberFunction = true};
template <typename Args, typename R>
static void call(Function f, Obj *o, void **arg) {
(o->*f)( *reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 2>::Value>::Type *>(arg[3]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 3>::Value>::Type *>(arg[4]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 4>::Value>::Type *>(arg[5]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 5>::Value>::Type *>(arg[6])), ApplyReturnValue<R>(arg[0]);
}
};
//Static functions
template<typename Ret> struct FunctionPointer<Ret (*) ()>
{
typedef void Arguments;
typedef Ret (*Function) ();
typedef Ret ReturnType;
enum {ArgumentCount = 0, IsPointerToMemberFunction = false};
template <typename Args, typename R>
static void call(Function f, void *, void **arg) { f(), ApplyReturnValue<R>(arg[0]); }
};
template<typename Ret, typename Arg1> struct FunctionPointer<Ret (*) (Arg1)>
{
typedef List<Arg1, void> Arguments;
typedef Ret ReturnType;
typedef Ret (*Function) (Arg1);
enum {ArgumentCount = 1, IsPointerToMemberFunction = false};
template <typename Args, typename R>
static void call(Function f, void *, void **arg)
{ f(*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1])), ApplyReturnValue<R>(arg[0]); }
};
template<typename Ret, typename Arg1, typename Arg2> struct FunctionPointer<Ret (*) (Arg1, Arg2)>
{
typedef List<Arg1, List<Arg2, void> > Arguments;
typedef Ret ReturnType;
typedef Ret (*Function) (Arg1, Arg2);
enum {ArgumentCount = 2, IsPointerToMemberFunction = false};
template <typename Args, typename R>
static void call(Function f, void *, void **arg) {
f(*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2])), ApplyReturnValue<R>(arg[0]); }
};
template<typename Ret, typename Arg1, typename Arg2, typename Arg3> struct FunctionPointer<Ret (*) (Arg1, Arg2, Arg3)>
{
typedef List<Arg1, List<Arg2, List<Arg3, void> > > Arguments;
typedef Ret ReturnType;
typedef Ret (*Function) (Arg1, Arg2, Arg3);
enum {ArgumentCount = 3, IsPointerToMemberFunction = false};
template <typename Args, typename R>
static void call(Function f, void *, void **arg) {
f( *reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 2>::Value>::Type *>(arg[3])), ApplyReturnValue<R>(arg[0]);
}
};
template<typename Ret, typename Arg1, typename Arg2, typename Arg3, typename Arg4> struct FunctionPointer<Ret (*) (Arg1, Arg2, Arg3, Arg4)>
{
typedef List<Arg1, List<Arg2, List<Arg3, List<Arg4, void> > > > Arguments;
typedef Ret ReturnType;
typedef Ret (*Function) (Arg1, Arg2, Arg3, Arg4);
enum {ArgumentCount = 4, IsPointerToMemberFunction = false};
template <typename Args, typename R>
static void call(Function f, void *, void **arg) {
f( *reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 2>::Value>::Type *>(arg[3]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 3>::Value>::Type *>(arg[4])), ApplyReturnValue<R>(arg[0]);
}
};
template<typename Ret, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> struct FunctionPointer<Ret (*) (Arg1, Arg2, Arg3, Arg4, Arg5)>
{
typedef List<Arg1, List<Arg2, List<Arg3,
List<Arg4, List<Arg5, void > > > > > Arguments;
typedef Ret ReturnType;
typedef Ret (*Function) (Arg1, Arg2, Arg3, Arg4, Arg5);
enum {ArgumentCount = 5, IsPointerToMemberFunction = false};
template <typename Args, typename R>
static void call(Function f, void *, void **arg) {
f( *reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 2>::Value>::Type *>(arg[3]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 3>::Value>::Type *>(arg[4]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 4>::Value>::Type *>(arg[5])), ApplyReturnValue<R>(arg[0]);
}
};
template<typename Ret, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5, typename Arg6> struct FunctionPointer<Ret (*) (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)>
{
typedef List<Arg1, List<Arg2, List<Arg3, List<Arg4, List<Arg5, List<Arg6, void> > > > > > Arguments;
typedef Ret ReturnType;
typedef Ret (*Function) (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6);
enum {ArgumentCount = 6, IsPointerToMemberFunction = false};
template <typename Args, typename R>
static void call(Function f, void *, void **arg) {
f( *reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 2>::Value>::Type *>(arg[3]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 3>::Value>::Type *>(arg[4]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 4>::Value>::Type *>(arg[5]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 5>::Value>::Type *>(arg[6])), ApplyReturnValue<R>(arg[0]);
}
};
//Functors
template<typename F, int N> struct Functor;
template<typename Function> struct Functor<Function, 0>
{
template <typename Args, typename R>
static void call(Function &f, void *, void **arg) { f(), ApplyReturnValue<R>(arg[0]); }
};
template<typename Function> struct Functor<Function, 1>
{
template <typename Args, typename R>
static void call(Function &f, void *, void **arg) {
f(*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1])), ApplyReturnValue<R>(arg[0]);
}
};
template<typename Function> struct Functor<Function, 2>
{
template <typename Args, typename R>
static void call(Function &f, void *, void **arg) {
f( *reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2])), ApplyReturnValue<R>(arg[0]);
}
};
template<typename Function> struct Functor<Function, 3>
{
template <typename Args, typename R>
static void call(Function &f, void *, void **arg) {
f( *reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 2>::Value>::Type *>(arg[3])), ApplyReturnValue<R>(arg[0]);
}
};
template<typename Function> struct Functor<Function, 4>
{
template <typename Args, typename R>
static void call(Function &f, void *, void **arg) {
f( *reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 2>::Value>::Type *>(arg[3]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 3>::Value>::Type *>(arg[4])), ApplyReturnValue<R>(arg[0]);
}
};
template<typename Function> struct Functor<Function, 5>
{
template <typename Args, typename R>
static void call(Function &f, void *, void **arg) {
f( *reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 2>::Value>::Type *>(arg[3]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 3>::Value>::Type *>(arg[4]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 4>::Value>::Type *>(arg[5])), ApplyReturnValue<R>(arg[0]);
}
};
template<typename Function> struct Functor<Function, 6>
{
template <typename Args, typename R>
static void call(Function &f, void *, void **arg) {
f( *reinterpret_cast<typename RemoveRef<typename List_Select<Args, 0>::Value>::Type *>(arg[1]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 1>::Value>::Type *>(arg[2]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 2>::Value>::Type *>(arg[3]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 3>::Value>::Type *>(arg[4]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 4>::Value>::Type *>(arg[5]),
*reinterpret_cast<typename RemoveRef<typename List_Select<Args, 5>::Value>::Type *>(arg[6])), ApplyReturnValue<R>(arg[0]);
}
};
#else
template <int...> struct IndexesList {};
template <typename IndexList, int Right> struct IndexesAppend;
template <int... Left, int Right> struct IndexesAppend<IndexesList<Left...>, Right>
@ -558,7 +192,6 @@ namespace QtPrivate {
FunctorCall<typename Indexes<N>::Value, SignalArgs, R, Function>::call(f, arg);
}
};
#endif
/*
Logic that check if the arguments of the slot matches the argument of the signal.
@ -578,16 +211,6 @@ namespace QtPrivate {
template<typename A> struct AreArgumentsCompatible<A, void> { enum { value = true }; };
template<> struct AreArgumentsCompatible<void, void> { enum { value = true }; };
#ifndef Q_COMPILER_VARIADIC_TEMPLATES
template <typename List1, typename List2> struct CheckCompatibleArguments { enum { value = false }; };
template <> struct CheckCompatibleArguments<void, void> { enum { value = true }; };
template <typename List1> struct CheckCompatibleArguments<List1, void> { enum { value = true }; };
template <typename Arg1, typename Arg2, typename Tail1, typename Tail2> struct CheckCompatibleArguments<List<Arg1, Tail1>, List<Arg2, Tail2> >
{
enum { value = AreArgumentsCompatible<typename RemoveConstRef<Arg1>::Type, typename RemoveConstRef<Arg2>::Type>::value
&& CheckCompatibleArguments<Tail1, Tail2>::value };
};
#else
template <typename List1, typename List2> struct CheckCompatibleArguments { enum { value = false }; };
template <> struct CheckCompatibleArguments<List<>, List<>> { enum { value = true }; };
template <typename List1> struct CheckCompatibleArguments<List1, List<>> { enum { value = true }; };
@ -597,9 +220,7 @@ namespace QtPrivate {
enum { value = AreArgumentsCompatible<typename RemoveConstRef<Arg1>::Type, typename RemoveConstRef<Arg2>::Type>::value
&& CheckCompatibleArguments<List<Tail1...>, List<Tail2...>>::value };
};
#endif
#if defined(Q_COMPILER_VARIADIC_TEMPLATES)
/*
Find the maximum number of arguments a functor object can take and be still compatible with
the arguments from the signal.
@ -631,8 +252,6 @@ namespace QtPrivate {
template <typename D> static D dummy();
typedef decltype(dummy<Functor>().operator()((dummy<ArgList>())...)) Value;
};
#endif
}
QT_END_NAMESPACE

View File

@ -48,7 +48,6 @@
#include <QtCore/QList>
#include <QtCore/QDebug>
#include <qendian.h>
#include <private/qsimd_p.h> // for qUnalignedLoad
QT_BEGIN_NAMESPACE
@ -164,7 +163,7 @@ bool QMimeMagicRule::matchNumber(const QByteArray &data) const
const char *p = data.constData() + m_startPos;
const char *e = data.constData() + qMin(data.size() - int(sizeof(T)), m_endPos + 1);
for ( ; p <= e; ++p) {
if ((qUnalignedLoad<T>(p) & mask) == (value & mask))
if ((qFromUnaligned<T>(reinterpret_cast<const uchar *>(p)) & mask) == (value & mask))
return true;
}

View File

@ -57,7 +57,7 @@
#endif
#ifndef FUTEX_PRIVATE_FLAG
# define FUTEX_PRIVATE_FLAG 128
# define FUTEX_PRIVATE_FLAG 0
#endif

View File

@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@ -87,29 +88,20 @@ QArrayData *QArrayData::allocate(size_t objectSize, size_t alignment,
if (!(options & RawData))
headerSize += (alignment - Q_ALIGNOF(QArrayData));
// Allocate additional space if array is growing
if (options & Grow) {
// Guard against integer overflow when multiplying.
if (capacity > std::numeric_limits<size_t>::max() / objectSize)
return 0;
size_t alloc;
if (mul_overflow(objectSize, capacity, &alloc))
return 0;
// Make sure qAllocMore won't overflow qAllocMore.
if (headerSize > size_t(MaxAllocSize) || alloc > size_t(MaxAllocSize) - headerSize)
return 0;
capacity = qAllocMore(int(alloc), int(headerSize)) / int(objectSize);
}
if (headerSize > size_t(MaxAllocSize))
return 0;
// Calculate the byte size
// allocSize = objectSize * capacity + headerSize, but checked for overflow
// plus padded to grow in size
size_t allocSize;
if (mul_overflow(objectSize, capacity, &allocSize))
return 0;
if (add_overflow(allocSize, headerSize, &allocSize))
return 0;
if (options & Grow) {
auto r = qCalculateGrowingBlockSize(capacity, objectSize, headerSize);
capacity = r.elementCount;
allocSize = r.size;
} else {
allocSize = qCalculateBlockSize(capacity, objectSize, headerSize);
}
QArrayData *header = static_cast<QArrayData *>(::malloc(allocSize));
if (header) {

View File

@ -42,6 +42,7 @@
#include <qalgorithms.h>
#include <qdatastream.h>
#include <qdebug.h>
#include <qendian.h>
#include <string.h>
QT_BEGIN_NAMESPACE
@ -169,25 +170,6 @@ QBitArray::QBitArray(int size, bool value)
Same as size().
*/
template <typename T> T qUnalignedLoad(const uchar *ptr)
{
/*
* Testing with different compilers shows that they all optimize the memcpy
* call away and replace with direct loads whenever possible. On x86 and PPC,
* GCC does direct unaligned loads; on MIPS, it generates a pair of load-left
* and load-right instructions. ICC and Clang do the same on x86. This is both
* 32- and 64-bit.
*
* On ARM cores without unaligned loads, the compiler leaves a call to
* memcpy.
*/
T u;
memcpy(&u, ptr, sizeof(u));
return u;
}
/*!
If \a on is true, this function returns the number of
1-bits stored in the bit array; otherwise the number
@ -203,17 +185,17 @@ int QBitArray::count(bool on) const
const quint8 *const end = reinterpret_cast<const quint8 *>(d.end());
while (bits + 7 <= end) {
quint64 v = qUnalignedLoad<quint64>(bits);
quint64 v = qFromUnaligned<quint64>(bits);
bits += 8;
numBits += int(qPopulationCount(v));
}
if (bits + 3 <= end) {
quint32 v = qUnalignedLoad<quint32>(bits);
quint32 v = qFromUnaligned<quint32>(bits);
bits += 4;
numBits += int(qPopulationCount(v));
}
if (bits + 1 < end) {
quint16 v = qUnalignedLoad<quint16>(bits);
quint16 v = qFromUnaligned<quint16>(bits);
bits += 2;
numBits += int(qPopulationCount(v));
}

View File

@ -46,6 +46,7 @@
#include "qlocale.h"
#include "qlocale_p.h"
#include "qlocale_tools_p.h"
#include "private/qnumeric_p.h"
#include "qstringalgorithms_p.h"
#include "qscopedpointer.h"
#include "qbytearray_p.h"
@ -128,17 +129,104 @@ int qFindByteArray(
const char *haystack0, int haystackLen, int from,
const char *needle0, int needleLen);
/*
* This pair of functions is declared in qtools_p.h and is used by the Qt
* containers to allocate memory and grow the memory block during append
* operations.
*
* They take size_t parameters and return size_t so they will change sizes
* according to the pointer width. However, knowing Qt containers store the
* container size and element indexes in ints, these functions never return a
* size larger than INT_MAX. This is done by casting the element count and
* memory block size to int in several comparisons: the check for negative is
* very fast on most platforms as the code only needs to check the sign bit.
*
* These functions return SIZE_MAX on overflow, which can be passed to malloc()
* and will surely cause a NULL return (there's no way you can allocate a
* memory block the size of your entire VM space).
*/
int qAllocMore(int alloc, int extra) Q_DECL_NOTHROW
/*!
\internal
\since 5.7
Returns the memory block size for a container containing \a elementCount
elements, each of \a elementSize bytes, plus a header of \a headerSize
bytes. That is, this function returns \c
{elementCount * elementSize + headerSize}
but unlike the simple calculation, it checks for overflows during the
multiplication and the addition.
Both \a elementCount and \a headerSize can be zero, but \a elementSize
cannot.
This function returns SIZE_MAX (~0) on overflow or if the memory block size
would not fit an int.
*/
size_t qCalculateBlockSize(size_t elementCount, size_t elementSize, size_t headerSize) Q_DECL_NOTHROW
{
Q_ASSERT(alloc >= 0 && extra >= 0 && extra <= MaxAllocSize);
Q_ASSERT_X(alloc <= MaxAllocSize - extra, "qAllocMore", "Requested size is too large!");
unsigned count = unsigned(elementCount);
unsigned size = unsigned(elementSize);
unsigned header = unsigned(headerSize);
Q_ASSERT(elementSize);
Q_ASSERT(size == elementSize);
Q_ASSERT(header == headerSize);
unsigned nalloc = qNextPowerOfTwo(alloc + extra);
if (Q_UNLIKELY(count != elementCount))
return std::numeric_limits<size_t>::max();
Q_ASSERT(nalloc > unsigned(alloc + extra));
unsigned bytes;
if (Q_UNLIKELY(mul_overflow(size, count, &bytes)) ||
Q_UNLIKELY(add_overflow(bytes, header, &bytes)))
return std::numeric_limits<size_t>::max();
if (Q_UNLIKELY(int(bytes) < 0)) // catches bytes >= 2GB
return std::numeric_limits<size_t>::max();
return nalloc - extra;
return bytes;
}
/*!
\internal
\since 5.7
Returns the memory block size and the number of elements that will fit in
that block for a container containing \a elementCount elements, each of \a
elementSize bytes, plus a header of \a headerSize bytes. This function
assumes the container will grow and pre-allocates a growth factor.
Both \a elementCount and \a headerSize can be zero, but \a elementSize
cannot.
This function returns SIZE_MAX (~0) on overflow or if the memory block size
would not fit an int.
\note The memory block may contain up to \a elementSize - 1 bytes more than
needed.
*/
CalculateGrowingBlockSizeResult
qCalculateGrowingBlockSize(size_t elementCount, size_t elementSize, size_t headerSize) Q_DECL_NOTHROW
{
CalculateGrowingBlockSizeResult result = {
std::numeric_limits<size_t>::max(),std::numeric_limits<size_t>::max()
};
unsigned bytes = unsigned(qCalculateBlockSize(elementCount, elementSize, headerSize));
if (int(bytes) < 0) // catches std::numeric_limits<size_t>::max()
return result;
unsigned morebytes = qNextPowerOfTwo(bytes);
if (Q_UNLIKELY(int(morebytes) < 0)) {
// catches morebytes == 2GB
// grow by half the difference between bytes and morebytes
bytes += (morebytes - bytes) / 2;
} else {
bytes = morebytes;
}
result.elementCount = (bytes - unsigned(headerSize)) / unsigned(elementSize);
result.size = bytes;
return result;
}
/*****************************************************************************
@ -1618,12 +1706,16 @@ void QByteArray::reallocData(uint alloc, Data::AllocationOptions options)
Data::deallocate(d);
d = x;
} else {
size_t blockSize;
if (options & Data::Grow) {
if (alloc > MaxByteArraySize)
qBadAlloc();
alloc = qAllocMore(alloc, sizeof(Data));
auto r = qCalculateGrowingBlockSize(alloc, sizeof(QChar), sizeof(Data));
blockSize = r.size;
alloc = uint(r.elementCount);
} else {
blockSize = qCalculateBlockSize(alloc, sizeof(QChar), sizeof(Data));
}
Data *x = static_cast<Data *>(::realloc(d, sizeof(Data) + alloc));
Data *x = static_cast<Data *>(::realloc(d, blockSize));
Q_CHECK_PTR(x);
x->alloc = alloc;
x->capacityReserved = (options & Data::CapacityReserved) ? 1 : 0;

View File

@ -95,9 +95,29 @@ static SHA3Final * const sha3Final = Final;
available on all platforms (MSVC 2008, for example), we #define them to the
Qt equivalents.
*/
#ifdef uint64_t
#undef uint64_t
#endif
#define uint64_t QT_PREPEND_NAMESPACE(quint64)
#ifdef uint32_t
#undef uint32_t
#endif
#define uint32_t QT_PREPEND_NAMESPACE(quint32)
#ifdef uint8_t
#undef uint8_t
#endif
#define uint8_t QT_PREPEND_NAMESPACE(quint8)
#ifdef int_least16_t
#undef int_least16_t
#endif
#define int_least16_t QT_PREPEND_NAMESPACE(qint16)
// Header from rfc6234 with 1 modification:

View File

@ -2158,7 +2158,7 @@ static int qt_timezone()
// number of seconds west of UTC.
// - It also takes DST into account, so we need to adjust it to always
// get the Standard Time offset.
return -t.tm_gmtoff + (t.tm_isdst ? SECS_PER_HOUR : 0L);
return -t.tm_gmtoff + (t.tm_isdst ? (long)SECS_PER_HOUR : 0L);
#elif defined(Q_OS_INTEGRITY)
return 0;
#else

View File

@ -708,17 +708,18 @@ int QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionInde
}
const int sectionmaxsize = sectionMaxSize(sectionIndex);
QString sectiontext = text.mid(index, sectionmaxsize);
int sectiontextSize = sectiontext.size();
QStringRef sectionTextRef = text.midRef(index, sectionmaxsize);
int sectiontextSize = sectionTextRef.size();
QDTPDEBUG << "sectionValue for" << sn.name()
<< "with text" << text << "and st" << sectiontext
<< "with text" << text << "and st" << sectionTextRef
<< text.midRef(index, sectionmaxsize)
<< index;
int used = 0;
switch (sn.type) {
case AmPmSection: {
QString sectiontext = sectionTextRef.toString();
const int ampm = findAmPm(sectiontext, sectionIndex, &used);
switch (ampm) {
case AM: // sectiontext == AM
@ -750,6 +751,7 @@ int QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionInde
case DayOfWeekSectionShort:
case DayOfWeekSectionLong:
if (sn.count >= 3) {
QString sectiontext = sectionTextRef.toString();
if (sn.type == MonthSection) {
int min = 1;
const QDate minDate = getMinimum().date();
@ -788,7 +790,7 @@ int QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionInde
int last = -1;
used = -1;
QString digitsStr(sectiontext);
QStringRef digitsStr = sectionTextRef;
for (int i = 0; i < sectiontextSize; ++i) {
if (digitsStr.at(i).isSpace()) {
sectiontextSize = i;
@ -809,7 +811,7 @@ int QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionInde
}
}
if (ok && tmp <= absMax) {
QDTPDEBUG << sectiontext.leftRef(digits) << tmp << digits;
QDTPDEBUG << sectionTextRef.left(digits) << tmp << digits;
last = tmp;
used = digits;
break;
@ -817,13 +819,13 @@ int QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionInde
}
if (last == -1) {
QChar first(sectiontext.at(0));
QChar first(sectionTextRef.at(0));
if (separators.at(sectionIndex + 1).startsWith(first)) {
used = 0;
state = Intermediate;
} else {
state = Invalid;
QDTPDEBUG << "invalid because" << sectiontext << "can't become a uint" << last << ok;
QDTPDEBUG << "invalid because" << sectionTextRef << "can't become a uint" << last << ok;
}
} else {
num += last;
@ -1565,7 +1567,7 @@ QString QDateTimeParser::SectionNode::format() const
number that is within min and max.
*/
bool QDateTimeParser::potentialValue(const QString &str, int min, int max, int index,
bool QDateTimeParser::potentialValue(const QStringRef &str, int min, int max, int index,
const QDateTime &currentValue, int insert) const
{
if (str.isEmpty()) {
@ -1592,8 +1594,7 @@ bool QDateTimeParser::potentialValue(const QString &str, int min, int max, int i
if (potentialValue(str + QLatin1Char('0' + j), min, max, index, currentValue, insert)) {
return true;
} else if (insert >= 0) {
QString tmp = str;
tmp.insert(insert, QLatin1Char('0' + j));
const QString tmp = str.left(insert) + QLatin1Char('0' + j) + str.mid(insert);
if (potentialValue(tmp, min, max, index, currentValue, insert))
return true;
}
@ -1603,7 +1604,7 @@ bool QDateTimeParser::potentialValue(const QString &str, int min, int max, int i
return false;
}
bool QDateTimeParser::skipToNextSection(int index, const QDateTime &current, const QString &text) const
bool QDateTimeParser::skipToNextSection(int index, const QDateTime &current, const QStringRef &text) const
{
Q_ASSERT(current >= getMinimum() && current <= getMaximum());

View File

@ -214,9 +214,19 @@ public:
QString *dayName = 0, int *used = 0) const;
#endif
AmPmFinder findAmPm(QString &str, int index, int *used = 0) const;
bool potentialValue(const QString &str, int min, int max, int index,
bool potentialValue(const QStringRef &str, int min, int max, int index,
const QDateTime &currentValue, int insert) const;
bool skipToNextSection(int section, const QDateTime &current, const QString &sectionText) const;
bool potentialValue(const QString &str, int min, int max, int index,
const QDateTime &currentValue, int insert) const
{
return potentialValue(QStringRef(&str), min, max, index, currentValue, insert);
}
bool skipToNextSection(int section, const QDateTime &current, const QStringRef &sectionText) const;
bool skipToNextSection(int section, const QDateTime &current, const QString &sectionText) const
{
return skipToNextSection(section, current, QStringRef(&sectionText));
}
QString stateName(State s) const;

View File

@ -58,6 +58,7 @@
#include <qbytearray.h>
#include <qdatetime.h>
#include <qbasicatomic.h>
#include <qendian.h>
#include <private/qsimd_p.h>
#ifndef QT_BOOTSTRAPPED
@ -112,24 +113,24 @@ static uint crc32(const Char *ptr, size_t len, uint h)
p += 8;
for ( ; p <= e; p += 8)
h2 = _mm_crc32_u64(h2, qUnalignedLoad<qlonglong>(p - 8));
h2 = _mm_crc32_u64(h2, qFromUnaligned<qlonglong>(p - 8));
h = h2;
p -= 8;
len = e - p;
if (len & 4) {
h = _mm_crc32_u32(h, qUnalignedLoad<uint>(p));
h = _mm_crc32_u32(h, qFromUnaligned<uint>(p));
p += 4;
}
# else
p += 4;
for ( ; p <= e; p += 4)
h = _mm_crc32_u32(h, qUnalignedLoad<uint>(p - 4));
h = _mm_crc32_u32(h, qFromUnaligned<uint>(p - 4));
p -= 4;
len = e - p;
# endif
if (len & 2) {
h = _mm_crc32_u16(h, qUnalignedLoad<ushort>(p));
h = _mm_crc32_u16(h, qFromUnaligned<ushort>(p));
p += 2;
}
if (sizeof(Char) == 1 && len & 1)

View File

@ -60,15 +60,6 @@ QT_BEGIN_NAMESPACE
const QListData::Data QListData::shared_null = { Q_REFCOUNT_INITIALIZE_STATIC, 0, 0, 0, { 0 } };
static int grow(int size)
{
if (size_t(size) > (MaxAllocSize - QListData::DataHeaderSize) / sizeof(void *))
qBadAlloc();
// dear compiler: don't optimize me out.
volatile int x = qAllocMore(size * sizeof(void *), QListData::DataHeaderSize) / sizeof(void *);
return x;
}
/*!
* Detaches the QListData by allocating new memory for a list which will be bigger
* than the copied one and is expected to grow further.
@ -84,12 +75,12 @@ QListData::Data *QListData::detach_grow(int *idx, int num)
Data *x = d;
int l = x->end - x->begin;
int nl = l + num;
int alloc = grow(nl);
Data* t = static_cast<Data *>(::malloc(DataHeaderSize + alloc * sizeof(void *)));
auto blockInfo = qCalculateGrowingBlockSize(nl, sizeof(void *), DataHeaderSize);
Data* t = static_cast<Data *>(::malloc(blockInfo.size));
Q_CHECK_PTR(t);
t->alloc = int(uint(blockInfo.elementCount));
t->ref.initializeOwned();
t->alloc = alloc;
// The space reservation algorithm's optimization is biased towards appending:
// Something which looks like an append will put the data at the beginning,
// while something which looks like a prepend will put it in the middle
@ -99,12 +90,12 @@ QListData::Data *QListData::detach_grow(int *idx, int num)
int bg;
if (*idx < 0) {
*idx = 0;
bg = (alloc - nl) >> 1;
bg = (t->alloc - nl) >> 1;
} else if (*idx > l) {
*idx = l;
bg = 0;
} else if (*idx < (l >> 1)) {
bg = (alloc - nl) >> 1;
bg = (t->alloc - nl) >> 1;
} else {
bg = 0;
}
@ -126,7 +117,7 @@ QListData::Data *QListData::detach_grow(int *idx, int num)
QListData::Data *QListData::detach(int alloc)
{
Data *x = d;
Data* t = static_cast<Data *>(::malloc(DataHeaderSize + alloc * sizeof(void *)));
Data* t = static_cast<Data *>(::malloc(qCalculateBlockSize(alloc, sizeof(void*), DataHeaderSize)));
Q_CHECK_PTR(t);
t->ref.initializeOwned();
@ -146,7 +137,7 @@ QListData::Data *QListData::detach(int alloc)
void QListData::realloc(int alloc)
{
Q_ASSERT(!d->ref.isShared());
Data *x = static_cast<Data *>(::realloc(d, DataHeaderSize + alloc * sizeof(void *)));
Data *x = static_cast<Data *>(::realloc(d, qCalculateBlockSize(alloc, sizeof(void *), DataHeaderSize)));
Q_CHECK_PTR(x);
d = x;
@ -158,12 +149,12 @@ void QListData::realloc(int alloc)
void QListData::realloc_grow(int growth)
{
Q_ASSERT(!d->ref.isShared());
int alloc = grow(d->alloc + growth);
Data *x = static_cast<Data *>(::realloc(d, DataHeaderSize + alloc * sizeof(void *)));
auto r = qCalculateGrowingBlockSize(d->alloc + growth, sizeof(void *), DataHeaderSize);
Data *x = static_cast<Data *>(::realloc(d, r.size));
Q_CHECK_PTR(x);
d = x;
d->alloc = alloc;
d->alloc = int(uint(r.elementCount));
}
void QListData::dispose(Data *d)

View File

@ -46,9 +46,29 @@
available on all platforms (MSVC 2008, for example), we #define them to the
Qt equivalents.
*/
#ifdef uint64_t
#undef uint64_t
#endif
#define uint64_t QT_PREPEND_NAMESPACE(quint64)
#ifdef uint32_t
#undef uint32_t
#endif
#define uint32_t QT_PREPEND_NAMESPACE(quint32)
#ifdef uint8_t
#undef uint8_t
#endif
#define uint8_t QT_PREPEND_NAMESPACE(quint8)
#ifdef int_least16_t
#undef int_least16_t
#endif
#define int_least16_t QT_PREPEND_NAMESPACE(qint16)
// Header from rfc6234 with 1 modification:

View File

@ -724,26 +724,4 @@ void qDumpCPUFeatures()
puts("");
}
/*!
\internal
\fn T qUnalignedLoad(const void *ptr)
\since 5.6.1
Loads a \c{T} from address \a ptr, which may be misaligned.
Use of this function avoid the undefined behavior that the C++ standard
otherwise attributes to unaligned loads.
*/
/*!
\internal
\fn void qUnalignedStore(void *ptr, T t)
\since 5.6.1
Stores \a t to address \a ptr, which may be misaligned.
Use of this function avoid the undefined behavior that the C++ standard
otherwise attributes to unaligned stores.
*/
QT_END_NAMESPACE

View File

@ -581,7 +581,7 @@ static int ucstrncmp(const QChar *a, const uchar *c, int l)
// we'll read uc[offset..offset+7] (16 bytes) and c[offset..offset+7] (8 bytes)
if (uc + offset + 7 < e) {
// same, but we're using an 8-byte load
__m128i chunk = _mm_cvtsi64_si128(qUnalignedLoad<long long>(c + offset));
__m128i chunk = _mm_cvtsi64_si128(qFromUnaligned<long long>(c + offset));
__m128i secondHalf = _mm_unpacklo_epi8(chunk, nullmask);
__m128i ucdata = _mm_loadu_si128((const __m128i*)(uc + offset));
@ -1757,10 +1757,13 @@ void QString::resize(int size, QChar fillChar)
void QString::reallocData(uint alloc, bool grow)
{
size_t blockSize;
if (grow) {
if (alloc > (uint(MaxAllocSize) - sizeof(Data)) / sizeof(QChar))
qBadAlloc();
alloc = qAllocMore(alloc * sizeof(QChar), sizeof(Data)) / sizeof(QChar);
auto r = qCalculateGrowingBlockSize(alloc, sizeof(QChar), sizeof(Data));
blockSize = r.size;
alloc = uint(r.elementCount);
} else {
blockSize = qCalculateBlockSize(alloc, sizeof(QChar), sizeof(Data));
}
if (d->ref.isShared() || IS_RAW_DATA(d)) {
@ -1774,7 +1777,7 @@ void QString::reallocData(uint alloc, bool grow)
Data::deallocate(d);
d = x;
} else {
Data *p = static_cast<Data *>(::realloc(d, sizeof(Data) + alloc * sizeof(QChar)));
Data *p = static_cast<Data *>(::realloc(d, blockSize));
Q_CHECK_PTR(p);
d = p;
d->alloc = alloc;
@ -2343,8 +2346,7 @@ QString &QString::remove(QChar ch, Qt::CaseSensitivity cs)
*/
QString &QString::replace(int pos, int len, const QString &after)
{
QString copy = after;
return replace(pos, len, copy.constData(), copy.length());
return replace(pos, len, after.constData(), after.length());
}
/*!

View File

@ -47,6 +47,8 @@
#include <qdebug.h>
#include "qlocale_tools_p.h"
#include <algorithm>
QT_BEGIN_NAMESPACE
@ -376,39 +378,126 @@ static QDate calculatePosixDate(const QByteArray &dateRule, int year)
}
}
static QTime parsePosixTime(const QByteArray &timeRule)
// returns the time in seconds, INT_MIN if we failed to parse
static int parsePosixTime(const char *begin, const char *end)
{
// Format "HH:mm:ss", put check parts count just in case
QList<QByteArray> parts = timeRule.split(':');
int count = parts.count();
if (count == 3)
return QTime(parts.at(0).toInt(), parts.at(1).toInt(), parts.at(2).toInt());
else if (count == 2)
return QTime(parts.at(0).toInt(), parts.at(1).toInt(), 0);
else if (count == 1)
return QTime(parts.at(0).toInt(), 0, 0);
return QTime(2, 0, 0);
// Format "hh[:mm[:ss]]"
int hour, min = 0, sec = 0;
// Note that the calls to qstrtoll do *not* check the end pointer, which
// means they proceed until they find a non-digit. We check that we're
// still in range at the end, but we may have read from past end. It's the
// caller's responsibility to ensure that begin is part of a
// null-terminated string.
bool ok = false;
hour = qstrtoll(begin, &begin, 10, &ok);
if (!ok || hour < 0)
return INT_MIN;
if (begin < end && *begin == ':') {
// minutes
++begin;
min = qstrtoll(begin, &begin, 10, &ok);
if (!ok || min < 0)
return INT_MIN;
if (begin < end && *begin == ':') {
// seconds
++begin;
sec = qstrtoll(begin, &begin, 10, &ok);
if (!ok || sec < 0)
return INT_MIN;
}
}
// we must have consumed everything
if (begin != end)
return INT_MIN;
return (hour * 60 + min) * 60 + sec;
}
static int parsePosixOffset(const QByteArray &timeRule)
static QTime parsePosixTransitionTime(const QByteArray &timeRule)
{
// Format "hh[:mm[:ss]]"
int value = parsePosixTime(timeRule.constBegin(), timeRule.constEnd());
if (value == INT_MIN) {
// if we failed to parse, return 02:00
return QTime(2, 0, 0);
}
return QTime::fromMSecsSinceStartOfDay(value * 1000);
}
static int parsePosixOffset(const char *begin, const char *end)
{
// Format "[+|-]hh[:mm[:ss]]"
QList<QByteArray> parts = timeRule.split(':');
int count = parts.count();
if (count == 3) {
int hour = parts.at(0).toInt();
int sign = hour >= 0 ? -1 : 1;
return sign * ((qAbs(hour) * 60 * 60) + (parts.at(1).toInt() * 60) + parts.at(2).toInt());
} else if (count == 2) {
int hour = parts.at(0).toInt();
int sign = hour >= 0 ? -1 : 1;
return sign * ((qAbs(hour) * 60 * 60) + (parts.at(1).toInt() * 60));
} else if (count == 1) {
int hour = parts.at(0).toInt();
int sign = hour >= 0 ? -1 : 1;
return sign * (qAbs(hour) * 60 * 60);
// note that the sign is inverted because POSIX counts in hours West of GMT
bool negate = true;
if (*begin == '+') {
++begin;
} else if (*begin == '-') {
negate = false;
++begin;
}
return 0;
int value = parsePosixTime(begin, end);
if (value == INT_MIN)
return value;
return negate ? -value : value;
}
static inline bool asciiIsLetter(char ch)
{
ch |= 0x20; // lowercases if it is a letter, otherwise just corrupts ch
return ch >= 'a' && ch <= 'z';
}
// Returns the zone name, the offset (in seconds) and advances \a begin to
// where the parsing ended. Returns a zone of INT_MIN in case an offset
// couldn't be read.
static QPair<QString, int> parsePosixZoneNameAndOffset(const char *&pos, const char *end)
{
static const char offsetChars[] = "0123456789:";
QPair<QString, int> result = qMakePair(QString(), INT_MIN);
const char *nameBegin = pos;
const char *nameEnd;
Q_ASSERT(pos < end);
if (*pos == '<') {
nameBegin = pos + 1; // skip the '<'
nameEnd = nameBegin;
while (nameEnd < end && *nameEnd != '>') {
// POSIX says only alphanumeric, but we allow anything
++nameEnd;
}
pos = nameEnd + 1; // skip the '>'
} else {
nameBegin = pos;
nameEnd = nameBegin;
while (nameEnd < end && asciiIsLetter(*nameEnd))
++nameEnd;
pos = nameEnd;
}
if (nameEnd - nameBegin < 3)
return result; // name must be at least 3 characters long
// zone offset, form [+-]hh:mm:ss
const char *zoneBegin = pos;
const char *zoneEnd = pos;
if (zoneEnd < end && (zoneEnd[0] == '+' || zoneEnd[0] == '-'))
++zoneEnd;
while (zoneEnd < end) {
if (strchr(offsetChars, char(*zoneEnd)) == NULL)
break;
++zoneEnd;
}
result.first = QString::fromUtf8(nameBegin, nameEnd - nameBegin);
if (zoneEnd > zoneBegin)
result.second = parsePosixOffset(zoneBegin, zoneEnd);
pos = zoneEnd;
return result;
}
static QVector<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArray &posixRule,
@ -425,58 +514,45 @@ static QVector<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArra
// POSIX Format is like "TZ=CST6CDT,M3.2.0/2:00:00,M11.1.0/2:00:00"
// i.e. "std offset dst [offset],start[/time],end[/time]"
// See http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
// See the section about TZ at http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html
QList<QByteArray> parts = posixRule.split(',');
QString name = QString::fromUtf8(parts.at(0));
QString stdName;
QString stdOffsetString;
QString dstName;
QString dstOffsetString;
bool parsedStdName = false;
bool parsedStdOffset = false;
for (int i = 0; i < name.size(); ++i) {
if (name.at(i).isLetter()) {
if (parsedStdName) {
parsedStdOffset = true;
dstName.append(name.at(i));
} else {
stdName.append(name.at(i));
QPair<QString, int> stdZone, dstZone;
{
const QByteArray &zoneinfo = parts.at(0);
const char *begin = zoneinfo.constBegin();
stdZone = parsePosixZoneNameAndOffset(begin, zoneinfo.constEnd());
if (stdZone.second == INT_MIN) {
stdZone.second = 0; // reset to UTC if we failed to parse
} else if (begin < zoneinfo.constEnd()) {
dstZone = parsePosixZoneNameAndOffset(begin, zoneinfo.constEnd());
if (dstZone.second == INT_MIN) {
// if the dst offset isn't provided, it is 1 hour ahead of the standard offset
dstZone.second = stdZone.second + (60 * 60);
}
} else {
parsedStdName = true;
if (parsedStdOffset)
dstOffsetString.append(name.at(i));
else
stdOffsetString.append(name.at(i));
}
}
int utcOffset = parsePosixOffset(stdOffsetString.toUtf8());
// If only the name part then no transitions
if (parts.count() == 1) {
QTimeZonePrivate::Data data;
data.atMSecsSinceEpoch = lastTranMSecs;
data.offsetFromUtc = utcOffset;
data.standardTimeOffset = utcOffset;
data.offsetFromUtc = stdZone.second;
data.standardTimeOffset = stdZone.second;
data.daylightTimeOffset = 0;
data.abbreviation = stdName;
data.abbreviation = stdZone.first;
result << data;
return result;
}
// If not populated the total dst offset is 1 hour
int dstOffset = utcOffset + (60 * 60);
if (!dstOffsetString.isEmpty())
dstOffset = parsePosixOffset(dstOffsetString.toUtf8());
// Get the std to dst transtion details
QList<QByteArray> dstParts = parts.at(1).split('/');
QByteArray dstDateRule = dstParts.at(0);
QTime dstTime;
if (dstParts.count() > 1)
dstTime = parsePosixTime(dstParts.at(1));
dstTime = parsePosixTransitionTime(dstParts.at(1));
else
dstTime = QTime(2, 0, 0);
@ -485,25 +561,25 @@ static QVector<QTimeZonePrivate::Data> calculatePosixTransitions(const QByteArra
QByteArray stdDateRule = stdParts.at(0);
QTime stdTime;
if (stdParts.count() > 1)
stdTime = parsePosixTime(stdParts.at(1));
stdTime = parsePosixTransitionTime(stdParts.at(1));
else
stdTime = QTime(2, 0, 0);
for (int year = startYear; year <= endYear; ++year) {
QTimeZonePrivate::Data dstData;
QDateTime dst(calculatePosixDate(dstDateRule, year), dstTime, Qt::UTC);
dstData.atMSecsSinceEpoch = dst.toMSecsSinceEpoch() - (utcOffset * 1000);
dstData.offsetFromUtc = dstOffset;
dstData.standardTimeOffset = utcOffset;
dstData.daylightTimeOffset = dstOffset - utcOffset;
dstData.abbreviation = dstName;
dstData.atMSecsSinceEpoch = dst.toMSecsSinceEpoch() - (stdZone.second * 1000);
dstData.offsetFromUtc = dstZone.second;
dstData.standardTimeOffset = stdZone.second;
dstData.daylightTimeOffset = dstZone.second - stdZone.second;
dstData.abbreviation = dstZone.first;
QTimeZonePrivate::Data stdData;
QDateTime std(calculatePosixDate(stdDateRule, year), stdTime, Qt::UTC);
stdData.atMSecsSinceEpoch = std.toMSecsSinceEpoch() - (dstOffset * 1000);
stdData.offsetFromUtc = utcOffset;
stdData.standardTimeOffset = utcOffset;
stdData.atMSecsSinceEpoch = std.toMSecsSinceEpoch() - (dstZone.second * 1000);
stdData.offsetFromUtc = stdZone.second;
stdData.standardTimeOffset = stdZone.second;
stdData.daylightTimeOffset = 0;
stdData.abbreviation = stdName;
stdData.abbreviation = stdZone.first;
// Part of the high year will overflow
if (year == 292278994 && (dstData.atMSecsSinceEpoch < 0 || stdData.atMSecsSinceEpoch < 0)) {
if (dstData.atMSecsSinceEpoch > 0) {

View File

@ -52,7 +52,7 @@
//
#include "QtCore/qglobal.h"
#include <limits>
#include <limits.h>
QT_BEGIN_NAMESPACE
@ -88,11 +88,19 @@ Q_DECL_CONSTEXPR inline int fromOct(uint c) Q_DECL_NOTHROW
// We typically need an extra bit for qNextPowerOfTwo when determining the next allocation size.
enum {
MaxAllocSize = (1 << (std::numeric_limits<int>::digits - 1)) - 1
MaxAllocSize = INT_MAX
};
struct CalculateGrowingBlockSizeResult {
size_t size;
size_t elementCount;
};
// implemented in qbytearray.cpp
int Q_CORE_EXPORT qAllocMore(int alloc, int extra) Q_DECL_NOTHROW;
size_t Q_CORE_EXPORT Q_DECL_CONST_FUNCTION
qCalculateBlockSize(size_t elementCount, size_t elementSize, size_t headerSize = 0) Q_DECL_NOTHROW;
CalculateGrowingBlockSizeResult Q_CORE_EXPORT Q_DECL_CONST_FUNCTION
qCalculateGrowingBlockSize(size_t elementCount, size_t elementSize, size_t headerSize = 0) Q_DECL_NOTHROW ;
QT_END_NAMESPACE

View File

@ -736,7 +736,7 @@ typename QVector<T>::iterator QVector<T>::erase(iterator abegin, iterator aend)
const int itemsUntouched = abegin - d->begin();
// FIXME we could do a proper realloc, which copy constructs only needed data.
// FIXME we ara about to delete data maybe it is good time to shrink?
// FIXME we are about to delete data - maybe it is good time to shrink?
// FIXME the shrink is also an issue in removeLast, that is just a copy + reduce of this.
if (d->alloc) {
detach();
@ -756,7 +756,11 @@ typename QVector<T>::iterator QVector<T>::erase(iterator abegin, iterator aend)
}
} else {
destruct(abegin, aend);
memmove(abegin, aend, (d->size - itemsToErase - itemsUntouched) * sizeof(T));
// QTBUG-53605: static_cast<void *> masks clang errors of the form
// error: destination for this 'memmove' call is a pointer to class containing a dynamic class
// FIXME maybe use std::is_polymorphic (as soon as allowed) to avoid the memmove
memmove(static_cast<void *>(abegin), static_cast<void *>(aend),
(d->size - itemsToErase - itemsUntouched) * sizeof(T));
}
d->size -= itemsToErase;
}

View File

@ -3025,10 +3025,14 @@ void QXmlStreamWriterPrivate::checkIfASCIICompatibleCodec()
{
#ifndef QT_NO_TEXTCODEC
Q_ASSERT(encoder);
// assumes ASCII-compatibility for all 8-bit encodings
QChar space = QLatin1Char(' ');
const QByteArray bytes = encoder->fromUnicode(&space, 1);
isCodecASCIICompatible = (bytes.count() == 1);
// test ASCII-compatibility using the letter 'a'
QChar letterA = QLatin1Char('a');
const QByteArray bytesA = encoder->fromUnicode(&letterA, 1);
const bool isCodecASCIICompatibleA = (bytesA.count() == 1) && (bytesA[0] == 0x61) ;
QChar letterLess = QLatin1Char('<');
const QByteArray bytesLess = encoder->fromUnicode(&letterLess, 1);
const bool isCodecASCIICompatibleLess = (bytesLess.count() == 1) && (bytesLess[0] == 0x3C) ;
isCodecASCIICompatible = isCodecASCIICompatibleA && isCodecASCIICompatibleLess ;
#else
isCodecASCIICompatible = true;
#endif
@ -3790,7 +3794,8 @@ void QXmlStreamWriter::writeStartDocument(const QString &version)
#ifdef QT_NO_TEXTCODEC
d->write("iso-8859-1");
#else
d->write(d->codec->name().constData(), d->codec->name().length());
const QByteArray name = d->codec->name();
d->write(name.constData(), name.length());
#endif
}
d->write("\"?>");
@ -3813,7 +3818,8 @@ void QXmlStreamWriter::writeStartDocument(const QString &version, bool standalon
#ifdef QT_NO_TEXTCODEC
d->write("iso-8859-1");
#else
d->write(d->codec->name().constData(), d->codec->name().length());
const QByteArray name = d->codec->name();
d->write(name.constData(), name.length());
#endif
}
if (standalone)

View File

@ -49,7 +49,7 @@
****************************************************************************/
//! [0]
QClipboard *clipboard = QApplication::clipboard();
QClipboard *clipboard = QGuiApplication::clipboard();
QString originalText = clipboard->text();
...
clipboard->setText(newText);

View File

@ -289,6 +289,12 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int
format = QImage::Format_Mono;
}
if (depth != 32) {
ncols = bi.biClrUsed ? bi.biClrUsed : 1 << nbits;
if (ncols < 1 || ncols > 256) // sanity check - don't run out of mem if color table is broken
return false;
}
if (bi.biHeight < 0)
h = -h; // support images with negative height
@ -296,19 +302,15 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int
image = QImage(w, h, format);
if (image.isNull()) // could not create image
return false;
}
if (depth != 32) {
ncols = bi.biClrUsed ? bi.biClrUsed : 1 << nbits;
if (ncols < 1 || ncols > 256) // sanity check - don't run out of mem if color table is broken
return false;
image.setColorCount(ncols);
if (ncols)
image.setColorCount(ncols); // Ensure valid QImage
}
image.setDotsPerMeterX(bi.biXPelsPerMeter);
image.setDotsPerMeterY(bi.biYPelsPerMeter);
if (ncols > 0) { // read color table
image.setColorCount(ncols);
uchar rgb[4];
int rgb_len = t == BMP_OLD ? 3 : 4;
for (int i=0; i<ncols; i++) {

View File

@ -284,7 +284,7 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St
if (pm.isNull()) {
int idx = pixmaps.count();
while (--idx >= 0) {
if (pe == &pixmaps[idx]) {
if (pe == &pixmaps.at(idx)) {
pixmaps.remove(idx);
break;
}

Some files were not shown because too many files have changed in this diff Show More