diff options
42 files changed, 363 insertions, 340 deletions
diff --git a/mkspecs/common/solaris.conf b/mkspecs/common/solaris.conf new file mode 100644 index 0000000000..23e26debff --- /dev/null +++ b/mkspecs/common/solaris.conf @@ -0,0 +1,33 @@ +# +# qmake configuration for common solaris +# + +QMAKE_PLATFORM += solaris + +include(unix.conf) + +QMAKE_CFLAGS_THREAD = -D_REENTRANT +QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD +QMAKE_LFLAGS_GCSECTIONS = -Wl,-z,ignore + +QMAKE_LFLAGS_REL_RPATH = -Wl,-z,origin +QMAKE_REL_RPATH_BASE = $ORIGIN + +QMAKE_INCDIR_X11 = /usr/X11/include +QMAKE_INCDIR_OPENGL = /usr/X11/include/mesa + +QMAKE_LIBS = +QMAKE_LIBS_DYNLOAD = -ldl +QMAKE_LIBS_X11 = -lXext -lX11 -lresolv -lsocket -lnsl +QMAKE_LIBS_NIS = +QMAKE_LIBS_OPENGL = -lGL +QMAKE_LIBS_THREAD = -lpthread -lrt +QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl + +QMAKE_AR = ar cq +QMAKE_OBJCOPY = objcopy +QMAKE_NM = nm -P +QMAKE_RANLIB = + +QMAKE_STRIP = strip +QMAKE_STRIPFLAGS_LIB += diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf index 119dc53d20..9719241612 100644 --- a/mkspecs/features/moc.prf +++ b/mkspecs/features/moc.prf @@ -57,7 +57,7 @@ defineReplace(mocCmdBase) { msvc: RET += --compiler-flavor=msvc isEmpty(MOC_PREDEF_FILE): RET += $$join(QMAKE_COMPILER_DEFINES, " -D", -D) - else: RET += --include $$moc_predefs.output + else: RET += --include $$shell_quote($$moc_predefs.output) RET += $$incvar $$QMAKE_MOC_OPTIONS return($$RET) diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 761b037e22..78731595b0 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -718,7 +718,8 @@ defineTest(qtConfTest_compile) { isEmpty(host): host = false test_dir = $$QMAKE_CONFIG_TESTS_DIR/$$test - test_out_dir = $$shadowed($$test_dir) + test_base_out_dir = $$shadowed($$QMAKE_CONFIG_TESTS_DIR) + test_out_dir = $$test_base_out_dir/$$test !isEmpty($${1}.pro): \ test_dir = $$test_dir/$$eval($${1}.pro) test_cmd_base = "$$QMAKE_CD $$system_quote($$system_path($$test_out_dir)) &&" @@ -779,7 +780,7 @@ defineTest(qtConfTest_compile) { QMAKE_MAKE = "$$QMAKE_MAKE clean && $$QMAKE_MAKE" mkpath($$test_out_dir)|error() - write_file($$test_out_dir/.qmake.cache)|error() + write_file($$test_base_out_dir/.qmake.cache)|error() # add possible command line args qmake_args += $$qtConfPrepareArgs($$eval($${1}.args)) $$eval($${1}.literal_args) diff --git a/mkspecs/solaris-g++-64/qmake.conf b/mkspecs/solaris-g++-64/qmake.conf index 91ffb9193e..f509555ad9 100644 --- a/mkspecs/solaris-g++-64/qmake.conf +++ b/mkspecs/solaris-g++-64/qmake.conf @@ -1,79 +1,21 @@ # -# qmake configuration for solaris-g++64 -# -# The X11 header files used to be broken on Solaris until patches were -# released in early 2001 for Solaris 2.6, 7, and 8. On Solaris 2.5.1 -# or non-patched systems -fpermissive works around the incompatibility -# between GCC 2.95 or better and Solaris - but we still get warnings -# because we don't use -isystem. -# -# From the standards(5) manual page: -# The XNS4 specification is safe for use only in ILP32 (32-bit) -# environments and should not be used for LP64 (64-bit) -# application environments. Use XNS5, which has LP64-clean -# interfaces that are portable across ILP32 and LP64 environments. -# [...] -# For platforms supporting the LP64 (64-bit) programming environment -# where the SC5.0 Compilers have been installed, SUSv2-conforming LP64 -# applications using XNS5 library calls should be built with command -# lines of the form: -# c89 $(getconf XBS5_LP64_OFF64_CFLAGS) -D_XOPEN_SOURCE=500 \ -# $(getconf XBS5_LP64_OFF64_LDFLAGS) foo.c -o foo \ -# $(getconf XBS5_LP64_OFF64_LIBS) -lxnet -# So it appears that _XOPEN_SOURCE=500 should be defined when building -# 64-bit applications (on Solaris 7 and better). But then __EXTENSIONS__ -# should be defined as well to recover all the default system interface. +# qmake configuration for solaris-g++-64 # MAKEFILE_GENERATOR = UNIX -QMAKE_PLATFORM = solaris - -include(../common/unix.conf) +CONFIG += incremental +QMAKE_INCREMENTAL_STYLE = sublib -QMAKE_COMPILER = gcc +include(../common/solaris.conf) -QMAKE_CC = gcc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -m64 -D_XOPEN_SOURCE=500 -D__EXTENSIONS__ -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 = -D_REENTRANT +QMAKE_CFLAGS = -m64 +QMAKE_LFLAGS = -m64 -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_LIBDIR_X11 = /usr/X11/lib/64 +QMAKE_LIBDIR_OPENGL = /usr/X11/lib/64 -QMAKE_INCDIR = /usr/sfw/include -QMAKE_LIBDIR = /usr/sfw/lib/64 -QMAKE_INCDIR_X11 = /usr/openwin/include -QMAKE_LIBDIR_X11 = /usr/openwin/lib/64 -QMAKE_INCDIR_OPENGL = /usr/openwin/include -QMAKE_LIBDIR_OPENGL = /usr/openwin/lib/64 +include(../common/gcc-base.conf) -QMAKE_LINK = g++ -QMAKE_LINK_SHLIB = g++ -QMAKE_LINK_C = gcc -QMAKE_LINK_C_SHLIB = gcc -QMAKE_LFLAGS = -m64 -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -g QMAKE_LFLAGS_SHLIB = -shared QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB QMAKE_LFLAGS_SONAME = -h$$LITERAL_WHITESPACE @@ -81,17 +23,9 @@ QMAKE_LFLAGS_THREAD = QMAKE_LFLAGS_NOUNDEF = -z defs QMAKE_LFLAGS_RPATH = -Wl,-R, -QMAKE_LIBS = -QMAKE_LIBS_DYNLOAD = -ldl -QMAKE_LIBS_X11 = -lXext -lX11 -lresolv -lsocket -lnsl -QMAKE_LIBS_NIS = -QMAKE_LIBS_OPENGL = -lGL -QMAKE_LIBS_THREAD = -lpthread -lrt -QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl +include(../common/g++-base.conf) -QMAKE_AR = ar cq -QMAKE_OBJCOPY = objcopy -QMAKE_NM = nm -P -QMAKE_RANLIB = +QMAKE_LFLAGS_RELEASE = +QMAKE_LFLAGS_DEBUG = -g load(qt_config) diff --git a/mkspecs/solaris-g++/qmake.conf b/mkspecs/solaris-g++/qmake.conf index 594646353d..7c6c9d04a4 100644 --- a/mkspecs/solaris-g++/qmake.conf +++ b/mkspecs/solaris-g++/qmake.conf @@ -1,62 +1,18 @@ # # qmake configuration for solaris-g++ # -# The X11 header files used to be broken on Solaris until patches were -# released in early 2001 for Solaris 2.6, 7, and 8. On Solaris 2.5.1 -# or non-patched systems -fpermissive works around the incompatibility -# between GCC 2.95 or better and Solaris - but we still get warnings -# because we don't use -isystem. -# MAKEFILE_GENERATOR = UNIX -QMAKE_PLATFORM = solaris - -include(../common/unix.conf) +CONFIG += incremental +QMAKE_INCREMENTAL_STYLE = sublib -QMAKE_COMPILER = gcc +include(../common/solaris.conf) -QMAKE_CC = gcc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -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 = -D_REENTRANT +QMAKE_LIBDIR_X11 = /usr/X11/lib +QMAKE_LIBDIR_OPENGL = /usr/X11/lib -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 +include(../common/gcc-base.conf) -QMAKE_INCDIR = /usr/sfw/include -QMAKE_LIBDIR = /usr/sfw/lib -QMAKE_INCDIR_X11 = /usr/openwin/include -QMAKE_LIBDIR_X11 = /usr/openwin/lib -QMAKE_INCDIR_OPENGL = /usr/openwin/include -QMAKE_LIBDIR_OPENGL = /usr/openwin/lib - -QMAKE_LINK = g++ -QMAKE_LINK_SHLIB = g++ -QMAKE_LINK_C = gcc -QMAKE_LINK_C_SHLIB = gcc -QMAKE_LFLAGS = -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -g QMAKE_LFLAGS_SHLIB = -shared QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB QMAKE_LFLAGS_SONAME = -h$$LITERAL_WHITESPACE @@ -64,17 +20,9 @@ QMAKE_LFLAGS_THREAD = QMAKE_LFLAGS_NOUNDEF = -z defs QMAKE_LFLAGS_RPATH = -Wl,-R, -QMAKE_LIBS = -QMAKE_LIBS_DYNLOAD = -ldl -QMAKE_LIBS_X11 = -lXext -lX11 -lresolv -lsocket -lnsl -QMAKE_LIBS_NIS = -QMAKE_LIBS_OPENGL = -lGL -QMAKE_LIBS_THREAD = -lpthread -lrt -QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl +include(../common/g++-base.conf) -QMAKE_AR = ar cq -QMAKE_OBJCOPY = objcopy -QMAKE_NM = nm -P -QMAKE_RANLIB = +QMAKE_LFLAGS_RELEASE = +QMAKE_LFLAGS_DEBUG = -g load(qt_config) diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index 982e432171..ed1668d54e 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -14,7 +14,7 @@ OBJS=project.o option.o property.o main.o ioutils.o proitems.o \ QOBJS=qtextcodec.o qutfcodec.o qstring.o qstring_compat.o qstringbuilder.o qtextstream.o qiodevice.o \ qringbuffer.o qdebug.o qmalloc.o qglobal.o \ qarraydata.o qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlist.o qfiledevice.o qfile.o \ - qfilesystementry.o qfilesystemengine.o qfsfileengine.o qfsfileengine_iterator.o qregexp.o qvector.o \ + qfilesystementry.o qfilesystemengine.o qfsfileengine.o qfsfileengine_iterator.o qregexp.o \ qbitarray.o qdir.o qdiriterator.o quuid.o qhash.o qfileinfo.o qdatetime.o qstringlist.o \ qabstractfileengine.o qtemporaryfile.o qmap.o qmetatype.o qsettings.o qsystemerror.o \ qvariant.o qvsnprintf.o qlocale.o qlocale_tools.o qlinkedlist.o qnumeric.o \ @@ -62,7 +62,7 @@ DEPEND_SRC = \ $(SOURCE_PATH)/src/corelib/io/qabstractfileengine.cpp \ $(SOURCE_PATH)/src/corelib/io/qfsfileengine_iterator.cpp \ $(SOURCE_PATH)/src/corelib/io/qfsfileengine.cpp $(SOURCE_PATH)/src/corelib/tools/qlist.cpp \ - $(SOURCE_PATH)/src/corelib/tools/qvector.cpp $(SOURCE_PATH)/src/corelib/tools/qbitarray.cpp \ + $(SOURCE_PATH)/src/corelib/tools/qbitarray.cpp \ $(SOURCE_PATH)/src/corelib/io/qdiriterator.cpp \ $(SOURCE_PATH)/src/corelib/io/qdir.cpp $(SOURCE_PATH)/src/corelib/plugin/quuid.cpp \ $(SOURCE_PATH)/src/corelib/io/qfileinfo.cpp $(SOURCE_PATH)/src/corelib/tools/qdatetime.cpp \ @@ -375,9 +375,6 @@ qtemporaryfile.o: $(SOURCE_PATH)/src/corelib/io/qtemporaryfile.cpp qregexp.o: $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp -qvector.o: $(SOURCE_PATH)/src/corelib/tools/qvector.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qvector.cpp - qbitarray.o: $(SOURCE_PATH)/src/corelib/tools/qbitarray.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/tools/qbitarray.cpp diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index f2e9be5728..559870ff0e 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -108,7 +108,6 @@ QTOBJS= \ qtextstream.obj \ qdatastream.obj \ quuid.obj \ - qvector.obj \ qsettings.obj \ qvariant.obj \ qsettings_win.obj \ diff --git a/qmake/qmake.pri b/qmake/qmake.pri index 288d99d8a2..c0f7250bcf 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -68,7 +68,6 @@ bootstrap { #Qt code qlibraryinfo.cpp \ qsystemerror.cpp \ qvariant.cpp \ - qvector.cpp \ qvsnprintf.cpp \ qxmlstream.cpp \ qxmlutils.cpp \ diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index d7849d4699..1c806e0774 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -77,6 +77,7 @@ #define QT_NO_SYSTEMLOCALE #define QT_FEATURE_slog2 -1 #define QT_FEATURE_syslog -1 +#define QT_FEATURE_temporaryfile 1 #define QT_NO_THREAD #define QT_FEATURE_timezone -1 #define QT_FEATURE_topleveldomain -1 diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 153d7466ed..f8c58c6b3e 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -3974,7 +3974,10 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) { Q_ASSERT_X(cb >= 0, "QInternal::activateCallback()", "Callback id must be a valid id"); - QInternal_CallBackTable *cbt = global_callback_table(); + if (!global_callback_table.exists()) + return false; + + QInternal_CallBackTable *cbt = &(*global_callback_table); if (cbt && cb < cbt->callbacks.size()) { QList<qInternalCallback> callbacks = cbt->callbacks[cb]; bool ret = false; diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 52a78ad1c4..41a4d7a1ba 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -1007,10 +1007,9 @@ qint64 QIODevice::read(char *data, qint64 maxSize) #endif const bool sequential = d->isSequential(); - const bool keepDataInBuffer = sequential && d->transactionStarted; - // Short circuit for getChar() - if (maxSize == 1 && !keepDataInBuffer) { + // Short-cut for getChar(), unless we need to keep the data in the buffer. + if (maxSize == 1 && !(sequential && d->transactionStarted)) { int chint; while ((chint = d->buffer.getChar()) != -1) { if (!sequential) @@ -1031,43 +1030,67 @@ qint64 QIODevice::read(char *data, qint64 maxSize) } CHECK_MAXLEN(read, qint64(-1)); + CHECK_READABLE(read, qint64(-1)); + + const qint64 readBytes = d->read(data, maxSize); + +#if defined QIODEVICE_DEBUG + printf("%p \treturning %lld, d->pos == %lld, d->buffer.size() == %lld\n", this, + readBytes, d->pos, d->buffer.size()); + if (readBytes > 0) + debugBinaryString(data - readBytes, readBytes); +#endif + + return readBytes; +} + +/*! + \internal +*/ +qint64 QIODevicePrivate::read(char *data, qint64 maxSize, bool peeking) +{ + Q_Q(QIODevice); + + const bool buffered = (openMode & QIODevice::Unbuffered) == 0; + const bool sequential = isSequential(); + const bool keepDataInBuffer = sequential + ? peeking || transactionStarted + : peeking && buffered; + const qint64 savedPos = pos; qint64 readSoFar = 0; bool madeBufferReadsOnly = true; bool deviceAtEof = false; char *readPtr = data; + qint64 bufferPos = (sequential && transactionStarted) ? transactionPos : Q_INT64_C(0); forever { // Try reading from the buffer. qint64 bufferReadChunkSize = keepDataInBuffer - ? d->buffer.peek(data, maxSize, d->transactionPos) - : d->buffer.read(data, maxSize); + ? buffer.peek(data, maxSize, bufferPos) + : buffer.read(data, maxSize); if (bufferReadChunkSize > 0) { - if (keepDataInBuffer) - d->transactionPos += bufferReadChunkSize; - else if (!sequential) - d->pos += bufferReadChunkSize; + bufferPos += bufferReadChunkSize; + if (!sequential) + pos += bufferReadChunkSize; +#if defined QIODEVICE_DEBUG + printf("%p \treading %lld bytes from buffer into position %lld\n", q, + bufferReadChunkSize, readSoFar); +#endif readSoFar += bufferReadChunkSize; data += bufferReadChunkSize; maxSize -= bufferReadChunkSize; -#if defined QIODEVICE_DEBUG - printf("%p \treading %lld bytes from buffer into position %lld\n", this, - bufferReadChunkSize, readSoFar - bufferReadChunkSize); -#endif - } else { - CHECK_READABLE(read, qint64(-1)); } if (maxSize > 0 && !deviceAtEof) { qint64 readFromDevice = 0; // Make sure the device is positioned correctly. - if (sequential || d->pos == d->devicePos || seek(d->pos)) { + if (sequential || pos == devicePos || q->seek(pos)) { madeBufferReadsOnly = false; // fix readData attempt - if ((maxSize >= d->readBufferChunkSize || (d->openMode & Unbuffered)) - && !keepDataInBuffer) { + if ((!buffered || maxSize >= readBufferChunkSize) && !keepDataInBuffer) { // Read big chunk directly to output buffer - readFromDevice = readData(data, maxSize); + readFromDevice = q->readData(data, maxSize); deviceAtEof = (readFromDevice != maxSize); #if defined QIODEVICE_DEBUG - printf("%p \treading %lld bytes from device (total %lld)\n", this, + printf("%p \treading %lld bytes from device (total %lld)\n", q, readFromDevice, readSoFar); #endif if (readFromDevice > 0) { @@ -1075,24 +1098,24 @@ qint64 QIODevice::read(char *data, qint64 maxSize) data += readFromDevice; maxSize -= readFromDevice; if (!sequential) { - d->pos += readFromDevice; - d->devicePos += readFromDevice; + pos += readFromDevice; + devicePos += readFromDevice; } } } else { // Do not read more than maxSize on unbuffered devices - const qint64 bytesToBuffer = (d->openMode & Unbuffered) - ? qMin(maxSize, qint64(d->readBufferChunkSize)) - : qint64(d->readBufferChunkSize); + const qint64 bytesToBuffer = (buffered || readBufferChunkSize < maxSize) + ? qint64(readBufferChunkSize) + : maxSize; // Try to fill QIODevice buffer by single read - readFromDevice = readData(d->buffer.reserve(bytesToBuffer), bytesToBuffer); + readFromDevice = q->readData(buffer.reserve(bytesToBuffer), bytesToBuffer); deviceAtEof = (readFromDevice != bytesToBuffer); - d->buffer.chop(bytesToBuffer - qMax(Q_INT64_C(0), readFromDevice)); + buffer.chop(bytesToBuffer - qMax(Q_INT64_C(0), readFromDevice)); if (readFromDevice > 0) { if (!sequential) - d->devicePos += readFromDevice; + devicePos += readFromDevice; #if defined QIODEVICE_DEBUG - printf("%p \treading %lld from device into buffer\n", this, + printf("%p \treading %lld from device into buffer\n", q, readFromDevice); #endif continue; @@ -1108,7 +1131,7 @@ qint64 QIODevice::read(char *data, qint64 maxSize) } } - if ((d->openMode & Text) && readPtr < data) { + if ((openMode & QIODevice::Text) && readPtr < data) { const char *endPtr = data; // optimization to avoid initial self-assignment @@ -1140,14 +1163,18 @@ qint64 QIODevice::read(char *data, qint64 maxSize) break; } -#if defined QIODEVICE_DEBUG - printf("%p \treturning %lld, d->pos == %lld, d->buffer.size() == %lld\n", this, - readSoFar, d->pos, d->buffer.size()); - debugBinaryString(data - readSoFar, readSoFar); -#endif + // Restore positions after reading + if (keepDataInBuffer) { + if (peeking) + pos = savedPos; // does nothing on sequential devices + else + transactionPos = bufferPos; + } else if (peeking) { + seekBuffer(savedPos); // unbuffered random-access device + } - if (madeBufferReadsOnly && d->isBufferEmpty()) - readData(data, 0); + if (madeBufferReadsOnly && isBufferEmpty()) + q->readData(data, 0); return readSoFar; } @@ -1759,27 +1786,7 @@ bool QIODevicePrivate::putCharHelper(char c) */ qint64 QIODevicePrivate::peek(char *data, qint64 maxSize) { - Q_Q(QIODevice); - - if (transactionStarted) { - const qint64 savedTransactionPos = transactionPos; - const qint64 savedPos = pos; - - qint64 readBytes = q->read(data, maxSize); - - // Restore initial position - if (isSequential()) - transactionPos = savedTransactionPos; - else - seekBuffer(savedPos); - return readBytes; - } - - q->startTransaction(); - qint64 readBytes = q->read(data, maxSize); - q->rollbackTransaction(); - - return readBytes; + return read(data, maxSize, true); } /*! @@ -1787,26 +1794,17 @@ qint64 QIODevicePrivate::peek(char *data, qint64 maxSize) */ QByteArray QIODevicePrivate::peek(qint64 maxSize) { - Q_Q(QIODevice); - - if (transactionStarted) { - const qint64 savedTransactionPos = transactionPos; - const qint64 savedPos = pos; + QByteArray result(maxSize, Qt::Uninitialized); - QByteArray result = q->read(maxSize); + const qint64 readBytes = read(result.data(), maxSize, true); - // Restore initial position - if (isSequential()) - transactionPos = savedTransactionPos; + if (readBytes < maxSize) { + if (readBytes <= 0) + result.clear(); else - seekBuffer(savedPos); - return result; + result.resize(readBytes); } - q->startTransaction(); - QByteArray result = q->read(maxSize); - q->rollbackTransaction(); - return result; } @@ -1844,7 +1842,12 @@ bool QIODevice::getChar(char *c) */ qint64 QIODevice::peek(char *data, qint64 maxSize) { - return d_func()->peek(data, maxSize); + Q_D(QIODevice); + + CHECK_MAXLEN(peek, qint64(-1)); + CHECK_READABLE(peek, qint64(-1)); + + return d->peek(data, maxSize); } /*! @@ -1866,7 +1869,13 @@ qint64 QIODevice::peek(char *data, qint64 maxSize) */ QByteArray QIODevice::peek(qint64 maxSize) { - return d_func()->peek(maxSize); + Q_D(QIODevice); + + CHECK_MAXLEN(peek, QByteArray()); + CHECK_MAXBYTEARRAYSIZE(peek); + CHECK_READABLE(peek, QByteArray()); + + return d->peek(maxSize); } /*! diff --git a/src/corelib/io/qiodevice_p.h b/src/corelib/io/qiodevice_p.h index 76bec89ef2..71a326dd53 100644 --- a/src/corelib/io/qiodevice_p.h +++ b/src/corelib/io/qiodevice_p.h @@ -171,6 +171,7 @@ public: void setReadChannelCount(int count); void setWriteChannelCount(int count); + qint64 read(char *data, qint64 maxSize, bool peeking = false); virtual qint64 peek(char *data, qint64 maxSize); virtual QByteArray peek(qint64 maxSize); diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index febf22639c..32639759e4 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -149,12 +149,23 @@ static QString cleanPath(const QString &_path) Q_DECLARE_TYPEINFO(QResourceRoot, Q_MOVABLE_TYPE); -Q_GLOBAL_STATIC_WITH_ARGS(QMutex, resourceMutex, (QMutex::Recursive)) - typedef QList<QResourceRoot*> ResourceList; -Q_GLOBAL_STATIC(ResourceList, resourceList) +struct QResourceGlobalData +{ + QMutex resourceMutex{QMutex::Recursive}; + ResourceList resourceList; + QStringList resourceSearchPaths; +}; +Q_GLOBAL_STATIC(QResourceGlobalData, resourceGlobalData) + +static inline QMutex *resourceMutex() +{ return &resourceGlobalData->resourceMutex; } -Q_GLOBAL_STATIC(QStringList, resourceSearchPaths) +static inline ResourceList *resourceList() +{ return &resourceGlobalData->resourceList; } + +static inline QStringList *resourceSearchPaths() +{ return &resourceGlobalData->resourceSearchPaths; } /*! \class QResource @@ -870,6 +881,9 @@ Q_CORE_EXPORT bool qRegisterResourceData(int version, const unsigned char *tree, Q_CORE_EXPORT bool qUnregisterResourceData(int version, const unsigned char *tree, const unsigned char *name, const unsigned char *data) { + if (resourceGlobalData.isDestroyed()) + return false; + QMutexLocker lock(resourceMutex()); if ((version == 0x01 || version == 0x02) && resourceList()) { QResourceRoot res(version, tree, name, data); diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index a936457bce..0ac49c5019 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -305,12 +305,13 @@ void qRemovePostRoutine(QtCleanUpFunction p) static void qt_call_pre_routines() { - QStartUpFuncList *list = preRList(); - if (!list) + if (!preRList.exists()) return; + #ifndef QT_NO_THREAD QMutexLocker locker(&globalPreRoutinesMutex); #endif + QVFuncList *list = &(*preRList); // Unlike qt_call_post_routines, we don't empty the list, because // Q_COREAPP_STARTUP_FUNCTION is a macro, so the user expects // the function to be executed every time QCoreApplication is created. @@ -320,16 +321,10 @@ static void qt_call_pre_routines() void Q_CORE_EXPORT qt_call_post_routines() { - QVFuncList *list = 0; - QT_TRY { - list = postRList(); - } QT_CATCH(const std::bad_alloc &) { - // ignore - if we can't allocate a post routine list, - // there's a high probability that there's no post - // routine to be executed :) - } - if (!list) + if (!postRList.exists()) return; + + QVFuncList *list = &(*postRList); while (!list->isEmpty()) (list->takeFirst())(); } diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index aff2991ed1..96cf5371f9 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -617,40 +617,34 @@ bool QLibrary::isLibrary(const QString &fileName) { #if defined(Q_OS_WIN) return fileName.endsWith(QLatin1String(".dll"), Qt::CaseInsensitive); -#else +#else // Generic Unix QString completeSuffix = QFileInfo(fileName).completeSuffix(); if (completeSuffix.isEmpty()) return false; const QVector<QStringRef> suffixes = completeSuffix.splitRef(QLatin1Char('.')); -# if defined(Q_OS_DARWIN) - - // On Mac, libs look like libmylib.1.0.0.dylib - const QStringRef &lastSuffix = suffixes.at(suffixes.count() - 1); - const QStringRef &firstSuffix = suffixes.at(0); - - bool valid = (lastSuffix == QLatin1String("dylib") - || firstSuffix == QLatin1String("so") - || firstSuffix == QLatin1String("bundle")); - - return valid; -# else // Generic Unix QStringList validSuffixList; -# if defined(Q_OS_HPUX) +# if defined(Q_OS_HPUX) /* See "HP-UX Linker and Libraries User's Guide", section "Link-time Differences between PA-RISC and IPF": "In PA-RISC (PA-32 and PA-64) shared libraries are suffixed with .sl. In IPF (32-bit and 64-bit), the shared libraries are suffixed with .so. For compatibility, the IPF linker also supports the .sl suffix." */ validSuffixList << QLatin1String("sl"); -# if defined __ia64 +# if defined __ia64 validSuffixList << QLatin1String("so"); -# endif -# elif defined(Q_OS_AIX) +# endif +# elif defined(Q_OS_AIX) validSuffixList << QLatin1String("a") << QLatin1String("so"); -# elif defined(Q_OS_UNIX) +# elif defined(Q_OS_DARWIN) + // On Apple platforms, dylib look like libmylib.1.0.0.dylib + if (suffixes.last() == QLatin1String("dylib")) + return true; + + validSuffixList << QLatin1String("so") << QLatin1String("bundle"); +# elif defined(Q_OS_UNIX) validSuffixList << QLatin1String("so"); -# endif +# endif // Examples of valid library names: // libfoo.so @@ -669,9 +663,7 @@ bool QLibrary::isLibrary(const QString &fileName) if (i != suffixPos) suffixes.at(i).toInt(&valid); return valid; -# endif #endif - } typedef const char * (*QtPluginQueryVerificationDataFunction)(); diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index a14c193bad..e6c70ecb55 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -96,7 +96,7 @@ void qt_create_tls() { if (qt_current_thread_data_tls_index != TLS_OUT_OF_INDEXES) return; - static QMutex mutex; + static QBasicMutex mutex; QMutexLocker locker(&mutex); qt_current_thread_data_tls_index = TlsAlloc(); } @@ -166,7 +166,7 @@ void QAdoptedThread::init() static QVector<HANDLE> qt_adopted_thread_handles; static QVector<QThread *> qt_adopted_qthreads; -static QMutex qt_adopted_thread_watcher_mutex; +static QBasicMutex qt_adopted_thread_watcher_mutex; static DWORD qt_adopted_thread_watcher_id = 0; static HANDLE qt_adopted_thread_wakeup = 0; diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index be53c51c48..f6164e2297 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -230,12 +230,39 @@ // SSE4.2 intrinsics #if defined(__SSE4_2__) || (defined(QT_COMPILER_SUPPORTS_SSE4_2) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) #include <nmmintrin.h> + +# if defined(__SSE4_2__) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS) +// POPCNT instructions: +// All processors that support SSE4.2 support POPCNT +// (but neither MSVC nor the Intel compiler define this macro) +# define __POPCNT__ 1 +# endif #endif // AVX intrinsics #if defined(__AVX__) || (defined(QT_COMPILER_SUPPORTS_AVX) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) // immintrin.h is the ultimate header, we don't need anything else after this #include <immintrin.h> + +# if defined(__AVX__) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS) +// AES, PCLMULQDQ instructions: +// All processors that support AVX support AES, PCLMULQDQ +// (but neither MSVC nor the Intel compiler define these macros) +# define __AES__ 1 +# define __PCLMUL__ 1 +# endif + +# if defined(__AVX2__) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS) +// F16C & RDRAND instructions: +// All processors that support AVX2 support F16C & RDRAND: +// (but neither MSVC nor the Intel compiler define these macros) +# define __F16C__ 1 +# define __RDRND__ 1 +# endif +#endif + +#if defined(__AES__) || defined(__PCLMUL__) +# include <wmmintrin.h> #endif #define QT_FUNCTION_TARGET_STRING_SSE2 "sse2" @@ -255,7 +282,10 @@ #define QT_FUNCTION_TARGET_STRING_AVX512IFMA "avx512ifma" #define QT_FUNCTION_TARGET_STRING_AVX512VBMI "avx512vbmi" -#define QT_FUNCTION_TARGET_STRING_F16C "f16c" +#define QT_FUNCTION_TARGET_STRING_AES "aes,sse4.2" +#define QT_FUNCTION_TARGET_STRING_PCLMUL "pclmul,sse4.2" +#define QT_FUNCTION_TARGET_STRING_POPCNT "popcnt" +#define QT_FUNCTION_TARGET_STRING_F16C "f16c,avx" #define QT_FUNCTION_TARGET_STRING_RDRAND "rdrnd" #define QT_FUNCTION_TARGET_STRING_BMI "bmi" #define QT_FUNCTION_TARGET_STRING_BMI2 "bmi2" diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.qdoc index 0ea47b1a1a..0ea47b1a1a 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.qdoc diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 4c215474fa..b93ec824ed 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -110,7 +110,6 @@ SOURCES += \ tools/qtextboundaryfinder.cpp \ tools/qtimeline.cpp \ tools/qunicodetools.cpp \ - tools/qvector.cpp \ tools/qvsnprintf.cpp \ tools/qversionnumber.cpp diff --git a/src/gui/configure.json b/src/gui/configure.json index 6d0848c9f0..08e50db906 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -520,7 +520,7 @@ }, "libinput-axis-api": { "label": "axis API in libinput", - "condition": "tests.libinput_axis_api", + "condition": "features.libinput && tests.libinput_axis_api", "output": [ "privateFeature" ] }, "lgmon": { @@ -614,8 +614,7 @@ "eglfs": { "label": "EGLFS", "section": "Platform plugins", - "autoDetect": "!config.android && !config.win32", - "condition": "features.egl", + "condition": "!config.android && !config.darwin && !config.win32 && features.egl", "output": [ "privateFeature" ] }, "eglfs_brcm": { diff --git a/src/platformsupport/eglconvenience/qeglstreamconvenience.cpp b/src/platformsupport/eglconvenience/qeglstreamconvenience.cpp index 1e90f849f5..5c336f0553 100644 --- a/src/platformsupport/eglconvenience/qeglstreamconvenience.cpp +++ b/src/platformsupport/eglconvenience/qeglstreamconvenience.cpp @@ -103,6 +103,11 @@ void QEGLStreamConvenience::initialize(EGLDisplay dpy) stream_consumer_gltexture = reinterpret_cast<PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC>(eglGetProcAddress("eglStreamConsumerGLTextureExternalKHR")); stream_consumer_acquire = reinterpret_cast<PFNEGLSTREAMCONSUMERACQUIREKHRPROC>(eglGetProcAddress("eglStreamConsumerAcquireKHR")); stream_consumer_release = reinterpret_cast<PFNEGLSTREAMCONSUMERRELEASEKHRPROC>(eglGetProcAddress("eglStreamConsumerReleaseKHR")); + create_stream_attrib_nv = reinterpret_cast<PFNEGLCREATESTREAMATTRIBNVPROC>(eglGetProcAddress("eglCreateStreamAttribNV")); + set_stream_attrib_nv = reinterpret_cast<PFNEGLSETSTREAMATTRIBNVPROC>(eglGetProcAddress("eglSetStreamAttribNV")); + query_stream_attrib_nv = reinterpret_cast<PFNEGLQUERYSTREAMATTRIBNVPROC>(eglGetProcAddress("eglQueryStreamAttribNV")); + acquire_stream_attrib_nv = reinterpret_cast<PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC>(eglGetProcAddress("eglStreamConsumerAcquireAttribNV")); + release_stream_attrib_nv = reinterpret_cast<PFNEGLSTREAMCONSUMERRELEASEATTRIBNVPROC>(eglGetProcAddress("eglStreamConsumerReleaseAttribNV")); has_egl_stream = strstr(extensions, "EGL_KHR_stream"); has_egl_stream_producer_eglsurface = strstr(extensions, "EGL_KHR_stream_producer_eglsurface"); diff --git a/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h b/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h index 8c802a0ca1..c3d3070210 100644 --- a/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h +++ b/src/platformsupport/eglconvenience/qeglstreamconvenience_p.h @@ -148,6 +148,14 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay #define EGL_PLATFORM_X11_KHR 0x31D5 #endif +#ifndef EGL_NV_stream_attrib +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMATTRIBNVPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEATTRIBNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); +#endif + QT_BEGIN_NAMESPACE class QEGLStreamConvenience @@ -160,6 +168,11 @@ public: PFNEGLQUERYDEVICESEXTPROC query_devices; PFNEGLQUERYDEVICESTRINGEXTPROC query_device_string; PFNEGLCREATESTREAMKHRPROC create_stream; + PFNEGLCREATESTREAMATTRIBNVPROC create_stream_attrib_nv; + PFNEGLSETSTREAMATTRIBNVPROC set_stream_attrib_nv; + PFNEGLQUERYSTREAMATTRIBNVPROC query_stream_attrib_nv; + PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC acquire_stream_attrib_nv; + PFNEGLSTREAMCONSUMERRELEASEATTRIBNVPROC release_stream_attrib_nv; PFNEGLDESTROYSTREAMKHRPROC destroy_stream; PFNEGLSTREAMATTRIBKHRPROC stream_attrib; PFNEGLQUERYSTREAMKHRPROC query_stream; diff --git a/src/platformsupport/fontdatabases/basic/basic.pri b/src/platformsupport/fontdatabases/basic/basic.pri index c50dba3ce2..0617bf74d7 100644 --- a/src/platformsupport/fontdatabases/basic/basic.pri +++ b/src/platformsupport/fontdatabases/basic/basic.pri @@ -1,9 +1,9 @@ HEADERS += \ $$PWD/qbasicfontdatabase_p.h \ - $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft_p.h + $$PWD/qfontengine_ft_p.h SOURCES += \ $$PWD/qbasicfontdatabase.cpp \ - $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft.cpp + $$PWD/qfontengine_ft.cpp -QMAKE_USE += freetype +QMAKE_USE_PRIVATE += freetype diff --git a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp index 60ddc9fa23..0826b0f2fb 100644 --- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp @@ -49,8 +49,7 @@ #include <QtCore/QtEndian> #undef QT_NO_FREETYPE -#include <QtGui/private/qfontengine_ft_p.h> -#include <QtGui/private/qfontengine_p.h> +#include <QtFontDatabaseSupport/private/qfontengine_ft_p.h> #include <ft2build.h> #include FT_TRUETYPE_TABLES_H diff --git a/src/gui/text/qfontengine_ft.cpp b/src/platformsupport/fontdatabases/basic/qfontengine_ft.cpp index 03e72546eb..03e72546eb 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/platformsupport/fontdatabases/basic/qfontengine_ft.cpp diff --git a/src/gui/text/qfontengine_ft_p.h b/src/platformsupport/fontdatabases/basic/qfontengine_ft_p.h index 47f13eb274..3b751eae3e 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/platformsupport/fontdatabases/basic/qfontengine_ft_p.h @@ -126,13 +126,7 @@ private: QFontEngine::Holder hbFace; }; -// If this is exported this breaks compilation of the windows -// plugin as qfontengine_ft_p.h/.cpp are also compiled there -#ifndef Q_OS_WIN -class Q_GUI_EXPORT QFontEngineFT : public QFontEngine -#else class QFontEngineFT : public QFontEngine -#endif { public: diff --git a/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri b/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri index 6458464870..671d6be237 100644 --- a/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri +++ b/src/platformsupport/fontdatabases/fontconfig/fontconfig.pri @@ -3,4 +3,4 @@ HEADERS += $$PWD/qfontconfigdatabase_p.h \ SOURCES += $$PWD/qfontconfigdatabase.cpp \ $$PWD/qfontenginemultifontconfig.cpp -QMAKE_USE += fontconfig +QMAKE_USE_PRIVATE += fontconfig diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 65bc494e91..2c5ce3e87d 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -40,6 +40,8 @@ #include "qfontconfigdatabase_p.h" #include "qfontenginemultifontconfig_p.h" +#include <QtFontDatabaseSupport/private/qfontengine_ft_p.h> + #include <QtCore/QList> #include <QtCore/QElapsedTimer> #include <QtCore/QFile> @@ -49,7 +51,6 @@ #include <qpa/qplatformintegration.h> #include <qpa/qplatformservices.h> -#include <QtGui/private/qfontengine_ft_p.h> #include <QtGui/private/qguiapplication_p.h> #include <QtGui/private/qhighdpiscaling_p.h> diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig.cpp index 7574f9f9e6..2fbcb6216e 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig.cpp @@ -39,7 +39,7 @@ #include "qfontenginemultifontconfig_p.h" -#include <QtGui/private/qfontengine_ft_p.h> +#include <QtFontDatabaseSupport/private/qfontengine_ft_p.h> QT_BEGIN_NAMESPACE diff --git a/src/platformsupport/fontdatabases/mac/coretext.pri b/src/platformsupport/fontdatabases/mac/coretext.pri index 06f1971696..f73e22eb1a 100644 --- a/src/platformsupport/fontdatabases/mac/coretext.pri +++ b/src/platformsupport/fontdatabases/mac/coretext.pri @@ -2,9 +2,9 @@ HEADERS += $$PWD/qcoretextfontdatabase_p.h $$PWD/qfontengine_coretext_p.h OBJECTIVE_SOURCES += $$PWD/qfontengine_coretext.mm $$PWD/qcoretextfontdatabase.mm qtConfig(freetype) { - QMAKE_USE += freetype - HEADERS += $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft_p.h - SOURCES += $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft.cpp + QMAKE_USE_PRIVATE += freetype + HEADERS += basic/qfontengine_ft_p.h + SOURCES += basic/qfontengine_ft.cpp } uikit: \ diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 6466db59ce..2b9e928266 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -53,7 +53,7 @@ #include <QtCore/QSettings> #include <QtCore/QtEndian> #ifndef QT_NO_FREETYPE -#include <QtGui/private/qfontengine_ft_p.h> +#include <QtFontDatabaseSupport/private/qfontengine_ft_p.h> #endif QT_BEGIN_NAMESPACE diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp index 7cfebf0436..65947ab7da 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp @@ -40,6 +40,8 @@ #include "qwindowsfontdatabase_ft_p.h" #include "qwindowsfontdatabase_p.h" +#include <QtFontDatabaseSupport/private/qfontengine_ft_p.h> + #include <ft2build.h> #include FT_TRUETYPE_TABLES_H @@ -47,7 +49,6 @@ #include <QtCore/QDirIterator> #include <QtCore/QSettings> #include <QtCore/QRegularExpression> -#include <QtGui/private/qfontengine_ft_p.h> #include <QtGui/QGuiApplication> #include <QtGui/QFontDatabase> diff --git a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp index 9f4b182ece..eb5a38855e 100644 --- a/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/winrt/qwinrtfontdatabase.cpp @@ -39,11 +39,12 @@ #include "qwinrtfontdatabase_p.h" +#include <QtFontDatabaseSupport/private/qfontengine_ft_p.h> + #include <QtCore/QCoreApplication> #include <QtCore/QFile> #include <QtCore/QUuid> -#include <QtGui/private/qfontengine_ft_p.h> #include <dwrite_1.h> #include <wrl.h> using namespace Microsoft::WRL; diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 68d69f3765..3024e15eca 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -43,7 +43,11 @@ #include "qwindowsscreen.h" #include "qwindowsintegration.h" #include "qwindowsnativeinterface.h" -#include "qwindowsglcontext.h" +#if QT_CONFIG(dynamicgl) +# include "qwindowsglcontext.h" +#else +# include "qwindowsopenglcontext.h" +#endif #ifdef QT_NO_CURSOR # include "qwindowscursor.h" #endif diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp index d91e502b96..0416215870 100644 --- a/src/sql/kernel/qsqldatabase.cpp +++ b/src/sql/kernel/qsqldatabase.cpp @@ -313,7 +313,7 @@ void QSqlDatabasePrivate::disable() /*! \class QSqlDatabase - \brief The QSqlDatabase class represents a connection to + \brief The QSqlDatabase class handles a connection to a database. \ingroup database @@ -332,18 +332,17 @@ void QSqlDatabasePrivate::disable() Create a connection (i.e., an instance of QSqlDatabase) by calling one of the static addDatabase() functions, where you specify \l{SQL Database Drivers#Supported Databases} {the driver or type - of driver} to use (i.e., what kind of database will you access?) + of driver} to use (depending on the type of database) and a connection name. A connection is known by its own name, \e{not} by the name of the database it connects to. You can have multiple connections to one database. QSqlDatabase also supports the concept of a \e{default} connection, which is the unnamed connection. To create the default connection, don't pass the connection name argument when you call addDatabase(). - Subsequently, when you call any static member function that takes - the connection name argument, if you don't pass the connection - name argument, the default connection is assumed. The following - snippet shows how to create and open a default connection to a - PostgreSQL database: + Subsequently, the default connection will be assumed if you call + any static member function without specifying the connection name. + The following snippet shows how to create and open a default connection + to a PostgreSQL database: \snippet sqldatabase/sqldatabase.cpp 0 @@ -374,27 +373,50 @@ void QSqlDatabasePrivate::disable() referenced by other QSqlDatabase objects. Use contains() to see if a given connection name is in the list of connections. - Once a connection is established, you can call tables() to get the - list of tables in the database, call primaryIndex() to get a - table's primary index, and call record() to get meta-information - about a table's fields (e.g., field names). + \table + \header + \li {2,1}Some utility methods: + \row + \li tables() + \li returns the list of tables + \row + \li primaryIndex() + \li returns a table's primary index + \row + \li record() + \li returns meta-information about a table's fields + \row + \li transaction() + \li starts a transaction + \row + \li commit() + \li saves and completes a transaction + \row + \li rollback() + \li cancels a transaction + \row + \li hasFeature() + \li checks if a driver supports transactions + \row + \li lastError() + \li returns information about the last error + \row + \li drivers() + \li returns the names of the available SQL drivers + \row + \li isDriverAvailable() + \li checks if a particular driver is available + \row + \li registerSqlDriver() + \li registers a custom-made driver + \endtable \note QSqlDatabase::exec() is deprecated. Use QSqlQuery::exec() instead. - If the driver supports transactions, use transaction() to start a - transaction, and commit() or rollback() to complete it. Use - \l{QSqlDriver::} {hasFeature()} to ask if the driver supports - transactions. \note When using transactions, you must start the + \note When using transactions, you must start the transaction before you create your query. - If an error occurs, lastError() will return information about it. - - Get the names of the available SQL drivers with drivers(). Check - for the presence of a particular driver with isDriverAvailable(). - If you have created your own custom driver, you must register it - with registerSqlDriver(). - \sa QSqlDriver, QSqlQuery, {Qt SQL}, {Threads and the SQL Module} */ @@ -963,9 +985,9 @@ QString QSqlDatabase::userName() const } /*! - Returns the connection's password. If the password was not set - with setPassword(), and if the password was given in the open() - call, or if no password was used, an empty string is returned. + Returns the connection's password. An empty string will be returned + if the password was not set with setPassword(), and if the password + was given in the open() call, or if no password was used. */ QString QSqlDatabase::password() const { @@ -1045,7 +1067,7 @@ QStringList QSqlDatabase::tables(QSql::TableType type) const /*! Returns the primary index for table \a tablename. If no primary - index exists an empty QSqlIndex is returned. + index exists, an empty QSqlIndex is returned. \sa tables(), record() */ @@ -1071,8 +1093,9 @@ QSqlRecord QSqlDatabase::record(const QString& tablename) const /*! Sets database-specific \a options. This must be done before the - connection is opened or it has no effect (or you can close() the - connection, call this function and open() the connection again). + connection is opened, otherwise it has no effect. Another possibility + is to close the connection, call QSqlDatabase::setConnectOptions(), + and open() the connection again. The format of the \a options string is a semicolon separated list of option names or option=value pairs. The options depend on the diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 0e0fe7932e..507b5260cd 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -80,7 +80,6 @@ SOURCES += \ ../../corelib/tools/qstringbuilder.cpp \ ../../corelib/tools/qstring_compat.cpp \ ../../corelib/tools/qstringlist.cpp \ - ../../corelib/tools/qvector.cpp \ ../../corelib/tools/qvsnprintf.cpp \ ../../corelib/xml/qxmlutils.cpp \ ../../corelib/xml/qxmlstream.cpp \ diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp index a06d01be67..c66a6d5673 100644 --- a/src/widgets/kernel/qformlayout.cpp +++ b/src/widgets/kernel/qformlayout.cpp @@ -1551,24 +1551,19 @@ QFormLayout::TakeRowResult QFormLayout::takeRow(int row) { Q_D(QFormLayout); - const int storageIndex = storageIndexFromLayoutItem(d->m_matrix, d->m_things.value(row)); - if (Q_UNLIKELY(storageIndex == -1)) { + if (Q_UNLIKELY(!(uint(row) < uint(d->m_matrix.rowCount())))) { qWarning("QFormLayout::takeRow: Invalid row %d", row); return TakeRowResult(); } - int storageRow, dummy; - QFormLayoutPrivate::ItemMatrix::storageIndexToPosition(storageIndex, &storageRow, &dummy); - Q_ASSERT(d->m_matrix(storageRow, dummy)); - - QFormLayoutItem *label = d->m_matrix(storageRow, 0); - QFormLayoutItem *field = d->m_matrix(storageRow, 1); + QFormLayoutItem *label = d->m_matrix(row, 0); + QFormLayoutItem *field = d->m_matrix(row, 1); Q_ASSERT(field); d->m_things.removeOne(label); d->m_things.removeOne(field); - d->m_matrix.removeRow(storageRow); + d->m_matrix.removeRow(row); invalidate(); diff --git a/tests/auto/corelib/kernel/qelapsedtimer/BLACKLIST b/tests/auto/corelib/kernel/qelapsedtimer/BLACKLIST new file mode 100644 index 0000000000..f6a49f032c --- /dev/null +++ b/tests/auto/corelib/kernel/qelapsedtimer/BLACKLIST @@ -0,0 +1,2 @@ +[elapsed] +windows diff --git a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp index 42fed1191b..16177bb0b7 100644 --- a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp +++ b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp @@ -302,15 +302,10 @@ void tst_QLibrary::isLibrary_data() QTest::newRow(".sl") << QString("mylib.sl") << sl_VALID; QTest::newRow(".so") << QString("mylib.so") << so_VALID; QTest::newRow(".so+version") << QString("mylib.so.0") << so_VALID; - - // special tests: -#ifndef Q_OS_MAC QTest::newRow("version+.so") << QString("libc-2.7.so") << so_VALID; QTest::newRow("version+.so+version") << QString("liboil-0.3.so.0.1.0") << so_VALID; -#else - QTest::newRow("version+.so") << QString("libc-2.7.so") << false; - QTest::newRow("version+.so+version") << QString("liboil-0.3.so.0.1.0") << false; -#endif + + // special tests: #ifdef Q_OS_MAC QTest::newRow("good (libmylib.1.0.0.dylib)") << QString("libmylib.1.0.0.dylib") << true; QTest::newRow("good (libmylib.dylib)") << QString("libmylib.dylib") << true; diff --git a/tests/auto/corelib/thread/qwaitcondition/BLACKLIST b/tests/auto/corelib/thread/qwaitcondition/BLACKLIST new file mode 100644 index 0000000000..3ff336576b --- /dev/null +++ b/tests/auto/corelib/thread/qwaitcondition/BLACKLIST @@ -0,0 +1,2 @@ +[wakeOne] +windows diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp index d8239b5a28..c324a4bd56 100644 --- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp +++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp @@ -757,13 +757,14 @@ void tst_QFormLayout::removeRow() layout->removeRow(1); - QVERIFY(!w1); - QCOMPARE(layout->count(), 1); + QVERIFY(w1); + QVERIFY(!w2); + QCOMPARE(layout->count(), 2); QCOMPARE(layout->rowCount(), 1); layout->removeRow(0); - QVERIFY(!w2); + QVERIFY(!w1); QCOMPARE(layout->count(), 0); QCOMPARE(layout->rowCount(), 0); } @@ -863,17 +864,19 @@ void tst_QFormLayout::takeRow() QVERIFY(w2); QVERIFY(result.fieldItem); - QVERIFY(result.labelItem); - QCOMPARE(layout->count(), 1); + QVERIFY(!result.labelItem); + QCOMPARE(layout->count(), 2); QCOMPARE(layout->rowCount(), 1); + QCOMPARE(result.fieldItem->widget(), w2.data()); result = layout->takeRow(0); QVERIFY(w1); QVERIFY(result.fieldItem); - QVERIFY(!result.labelItem); + QVERIFY(result.labelItem); QCOMPARE(layout->count(), 0); QCOMPARE(layout->rowCount(), 0); + QCOMPARE(result.fieldItem->widget(), w1.data()); result = layout->takeRow(0); diff --git a/tests/benchmarks/corelib/io/qiodevice/main.cpp b/tests/benchmarks/corelib/io/qiodevice/main.cpp index b106a9fd3d..de4660a253 100644 --- a/tests/benchmarks/corelib/io/qiodevice/main.cpp +++ b/tests/benchmarks/corelib/io/qiodevice/main.cpp @@ -39,6 +39,8 @@ class tst_qiodevice : public QObject private slots: void read_old(); void read_old_data() { read_data(); } + void peekAndRead(); + void peekAndRead_data() { read_data(); } //void read_new(); //void read_new_data() { read_data(); } private: @@ -86,6 +88,36 @@ void tst_qiodevice::read_old() } } +void tst_qiodevice::peekAndRead() +{ + QFETCH(qint64, size); + + QString name = "tmp" + QString::number(size); + + { + QFile file(name); + file.open(QIODevice::WriteOnly); + file.seek(size); + file.write("x", 1); + file.close(); + } + + QBENCHMARK { + QFile file(name); + file.open(QIODevice::ReadOnly); + + QByteArray ba(size / 1024, Qt::Uninitialized); + while (!file.atEnd()) { + file.peek(ba.data(), ba.size()); + file.read(ba.data(), ba.size()); + } + } + + { + QFile file(name); + file.remove(); + } +} QTEST_MAIN(tst_qiodevice) |