summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/Qt5CoreConfigExtras.cmake.in2
-rw-r--r--src/corelib/global/qlibraryinfo.cpp4
-rw-r--r--src/corelib/io/qfilesystemengine_unix.cpp6
-rw-r--r--src/corelib/io/qprocess.cpp2
-rw-r--r--src/corelib/io/qprocess_win.cpp1
-rw-r--r--src/corelib/io/qtemporarydir.cpp5
-rw-r--r--src/corelib/io/qtextstream.cpp5
-rw-r--r--src/corelib/io/qurl_mac.mm8
-rw-r--r--src/corelib/kernel/qcoreevent.cpp2
-rw-r--r--src/corelib/kernel/qobject.cpp5
-rw-r--r--src/corelib/kernel/qtcore_eval.cpp6
-rw-r--r--src/corelib/tools/qline.cpp2
-rw-r--r--src/corelib/tools/qpair.h4
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h2
-rw-r--r--src/corelib/xml/qxmlstream.cpp41
-rw-r--r--src/corelib/xml/qxmlstream_p.h12
16 files changed, 61 insertions, 46 deletions
diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
index 9bda70ec07..4387bedc44 100644
--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
+++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
@@ -66,14 +66,12 @@ list(APPEND Qt5Core_INCLUDE_DIRS ${_qt5_corelib_extra_includes})
set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_qt5_corelib_extra_includes})
set(_qt5_corelib_extra_includes)
-!!IF !isEmpty(CMAKE_ADD_FPIE_FLAGS)
# Targets using Qt need to use the POSITION_INDEPENDENT_CODE property. The
# Qt5_POSITION_INDEPENDENT_CODE variable is used in the # qt5_use_module
# macro to add it.
set(Qt5_POSITION_INDEPENDENT_CODE True)
set_property(TARGET Qt5::Core PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE \"ON\")
set(Qt5Core_EXECUTABLE_COMPILE_FLAGS \"-fPIE\")
-!!ENDIF
!!IF !isEmpty(QT_NAMESPACE)
list(APPEND Qt5Core_DEFINITIONS -DQT_NAMESPACE=$$QT_NAMESPACE)
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index dc04f898f7..b47015cbc9 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2014 Intel Corporation
** Contact: http://www.qt-project.org/legal
**
@@ -622,7 +622,7 @@ extern "C" void qt_core_boilerplate();
void qt_core_boilerplate()
{
printf("This is the QtCore library version " QT_BUILD_STR "\n"
- "Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).\n"
+ "Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).\n"
"Contact: http://www.qt-project.org/legal\n"
"\n"
"Build date: %s\n"
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
index feb86d2895..10326dea06 100644
--- a/src/corelib/io/qfilesystemengine_unix.cpp
+++ b/src/corelib/io/qfilesystemengine_unix.cpp
@@ -83,13 +83,13 @@ static bool isPackage(const QFileSystemMetaData &data, const QFileSystemEntry &e
if (suffix.length() > 0) {
// First step: is the extension known ?
- CFStringRef extensionRef = QCFString::toCFStringRef(suffix);
- CFStringRef uniformTypeIdentifier = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extensionRef, NULL);
+ QCFType<CFStringRef> extensionRef = QCFString::toCFStringRef(suffix);
+ QCFType<CFStringRef> uniformTypeIdentifier = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extensionRef, NULL);
if (UTTypeConformsTo(uniformTypeIdentifier, kUTTypeBundle))
return true;
// Second step: check if an application knows the package type
- CFStringRef path = QCFString::toCFStringRef(entry.filePath());
+ QCFType<CFStringRef> path = QCFString::toCFStringRef(entry.filePath());
QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(0, path, kCFURLPOSIXPathStyle, true);
UInt32 type, creator;
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index a7d521fc6c..408f07f00e 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1043,9 +1043,9 @@ bool QProcessPrivate::_q_processDied()
return false;
#endif
#ifdef Q_OS_WIN
- drainOutputPipes();
if (processFinishedNotifier)
processFinishedNotifier->setEnabled(false);
+ drainOutputPipes();
#endif
// the process may have died before it got a chance to report that it was
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index ee6b7e13f4..9e60daa5b4 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -785,6 +785,7 @@ bool QProcessPrivate::waitForFinished(int msecs)
void QProcessPrivate::findExitCode()
{
DWORD theExitCode;
+ Q_ASSERT(pid);
if (GetExitCodeProcess(pid->hProcess, &theExitCode)) {
exitCode = theExitCode;
crashed = (exitCode == 0xf291 // our magic number, see killProcess
diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp
index 5e0def74ee..5f0c500183 100644
--- a/src/corelib/io/qtemporarydir.cpp
+++ b/src/corelib/io/qtemporarydir.cpp
@@ -128,8 +128,11 @@ static char *q_mkdtemp(char *templateName)
QFile::ReadOwner |
QFile::WriteOwner |
QFile::ExeOwner, error);
- if (error.error() != 0)
+ if (error.error() != 0) {
+ if (!QFileSystemEngine::removeDirectory(fileSystemEntry, false))
+ qWarning() << "Unable to remove unused directory" << templateNameStr;
continue;
+ }
return templateName;
}
}
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index f870fb11e3..fa455c0e8c 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -1574,11 +1574,10 @@ QString QTextStream::readAll()
the stream contains lines longer than this, then the lines will be
split after \a maxlen characters and returned in parts.
- If \a maxlen is 0, the lines can be of any length. A common value
- for \a maxlen is 75.
+ If \a maxlen is 0, the lines can be of any length.
The returned line has no trailing end-of-line characters ("\\n"
- or "\\r\\n"), so calling QString::trimmed() is unnecessary.
+ or "\\r\\n"), so calling QString::trimmed() can be unnecessary.
If the stream has read to the end of the file, \l {QTextStream::readLine()}{readLine()}
will return a null QString. For strings, or for devices that support it,
diff --git a/src/corelib/io/qurl_mac.mm b/src/corelib/io/qurl_mac.mm
index c235365ad8..4468bf0f2b 100644
--- a/src/corelib/io/qurl_mac.mm
+++ b/src/corelib/io/qurl_mac.mm
@@ -54,7 +54,13 @@ QUrl QUrl::fromCFURL(CFURLRef url)
CFURLRef QUrl::toCFURL() const
{
- return CFURLCreateWithString(0, toString(FullyEncoded).toCFString(), 0);
+ CFURLRef url = 0;
+ CFStringRef str = toString(FullyEncoded).toCFString();
+ if (str) {
+ url = CFURLCreateWithString(0, str, 0);
+ CFRelease(str);
+ }
+ return url;
}
QUrl QUrl::fromNSURL(const NSURL *url)
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index 93ab90fb94..9e8ec250fc 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -539,7 +539,7 @@ QTimerEvent::~QTimerEvent()
\a child.
\a type can be QEvent::ChildAdded, QEvent::ChildRemoved,
- QEvent::ChildPolished, or QEvent::ChildRemoved.
+ or QEvent::ChildPolished.
\sa child()
*/
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 0a8369acbf..b29376e851 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -3711,13 +3711,14 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
} else if (callFunction && c->method_offset <= receiver->metaObject()->methodOffset()) {
//we compare the vtable to make sure we are not in the destructor of the object.
locker.unlock();
+ const int methodIndex = c->method();
if (qt_signal_spy_callback_set.slot_begin_callback != 0)
- qt_signal_spy_callback_set.slot_begin_callback(receiver, c->method(), argv ? argv : empty_argv);
+ qt_signal_spy_callback_set.slot_begin_callback(receiver, methodIndex, argv ? argv : empty_argv);
callFunction(receiver, QMetaObject::InvokeMetaMethod, method_relative, argv ? argv : empty_argv);
if (qt_signal_spy_callback_set.slot_end_callback != 0)
- qt_signal_spy_callback_set.slot_end_callback(receiver, c->method());
+ qt_signal_spy_callback_set.slot_end_callback(receiver, methodIndex);
locker.relock();
} else {
const int method = method_relative + c->method_offset;
diff --git a/src/corelib/kernel/qtcore_eval.cpp b/src/corelib/kernel/qtcore_eval.cpp
index eb1019534c..2ee8c20bc3 100644
--- a/src/corelib/kernel/qtcore_eval.cpp
+++ b/src/corelib/kernel/qtcore_eval.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
static const char boilerplate_supported_but_time_limited[] =
"\nQt %1 Evaluation License\n"
- "Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).\n"
+ "Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).\n"
"This trial version may only be used for evaluation purposes\n"
"and will shut down after 120 minutes.\n"
"Registered to:\n"
@@ -57,7 +57,7 @@ static const char boilerplate_supported_but_time_limited[] =
static const char boilerplate_supported[] =
"\nQt %1 Evaluation License\n"
- "Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).\n"
+ "Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).\n"
"This trial version may only be used for evaluation purposes\n"
"Registered to:\n"
" Licensee: %2\n\n"
diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp
index 4561f831c8..9feb697aad 100644
--- a/src/corelib/tools/qline.cpp
+++ b/src/corelib/tools/qline.cpp
@@ -334,7 +334,7 @@ QDataStream &operator>>(QDataStream &stream, QLine &line)
or a null line.
The intersect() function determines the IntersectType for this
- line and a given line, while the angle() function returns the
+ line and a given line, while the angleTo() function returns the
angle between the lines. In addition, the unitVector() function
returns a line that has the same starting point as this line, but
with a length of only 1, while the normalVector() function returns
diff --git a/src/corelib/tools/qpair.h b/src/corelib/tools/qpair.h
index 33f8c81e68..4cba0a8421 100644
--- a/src/corelib/tools/qpair.h
+++ b/src/corelib/tools/qpair.h
@@ -56,7 +56,9 @@ struct QPair
{ first = p.first; second = p.second; return *this; }
#ifdef Q_COMPILER_RVALUE_REFS
template <typename TT1, typename TT2>
- Q_DECL_CONSTEXPR QPair(QPair<TT1, TT2> &&p) : first(std::move(p.first)), second(std::move(p.second)) {}
+ Q_DECL_CONSTEXPR QPair(QPair<TT1, TT2> &&p)
+ // can't use std::move here as it's not constexpr in C++11:
+ : first(static_cast<TT1 &&>(p.first)), second(static_cast<TT2 &&>(p.second)) {}
template <typename TT1, typename TT2>
Q_DECL_RELAXED_CONSTEXPR QPair &operator=(QPair<TT1, TT2> &&p)
{ first = std::move(p.first); second = std::move(p.second); return *this; }
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index 061c7a5a2d..a18b2c28a1 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -412,6 +412,7 @@ public:
# ifdef QT_SHAREDPOINTER_TRACK_POINTERS
internalSafetyCheckAdd(result.d, result.value);
# endif
+ result.enableSharedFromThis(result.data());
return result;
}
#else
@@ -432,6 +433,7 @@ public:
internalSafetyCheckAdd(result.d, result.value);
# endif
result.d->setQObjectShared(result.value, true);
+ result.enableSharedFromThis(result.data());
return result;
}
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index fe3c4049ad..f79c8e65fa 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -64,6 +64,8 @@ QT_BEGIN_NAMESPACE
#include "qxmlstream_p.h"
+enum { StreamEOF = ~0U };
+
/*!
\enum QXmlStreamReader::TokenType
@@ -903,7 +905,7 @@ inline uint QXmlStreamReaderPrivate::filterCarriageReturn()
++readBufferPos;
return peekc;
}
- if (peekc == 0) {
+ if (peekc == StreamEOF) {
putChar('\r');
return 0;
}
@@ -912,13 +914,13 @@ inline uint QXmlStreamReaderPrivate::filterCarriageReturn()
/*!
\internal
- If the end of the file is encountered, 0 is returned.
+ If the end of the file is encountered, ~0 is returned.
*/
inline uint QXmlStreamReaderPrivate::getChar()
{
uint c;
if (putStack.size()) {
- c = atEnd ? 0 : putStack.pop();
+ c = atEnd ? StreamEOF : putStack.pop();
} else {
if (readBufferPos < readBuffer.size())
c = readBuffer.at(readBufferPos++).unicode();
@@ -937,7 +939,7 @@ inline uint QXmlStreamReaderPrivate::peekChar()
} else if (readBufferPos < readBuffer.size()) {
c = readBuffer.at(readBufferPos).unicode();
} else {
- if ((c = getChar_helper()))
+ if ((c = getChar_helper()) != StreamEOF)
--readBufferPos;
}
@@ -961,7 +963,8 @@ bool QXmlStreamReaderPrivate::scanUntil(const char *str, short tokenToInject)
int pos = textBuffer.size();
int oldLineNumber = lineNumber;
- while (uint c = getChar()) {
+ uint c;
+ while ((c = getChar()) != StreamEOF) {
/* First, we do the validation & normalization. */
switch (c) {
case '\r':
@@ -1007,9 +1010,9 @@ bool QXmlStreamReaderPrivate::scanString(const char *str, short tokenToInject, b
{
int n = 0;
while (str[n]) {
- ushort c = getChar();
+ uint c = getChar();
if (c != ushort(str[n])) {
- if (c)
+ if (c != StreamEOF)
putChar(c);
while (n--) {
putChar(ushort(str[n]));
@@ -1137,7 +1140,7 @@ inline int QXmlStreamReaderPrivate::fastScanLiteralContent()
{
int n = 0;
uint c;
- while ((c = getChar())) {
+ while ((c = getChar()) != StreamEOF) {
switch (ushort(c)) {
case 0xfffe:
case 0xffff:
@@ -1182,8 +1185,8 @@ inline int QXmlStreamReaderPrivate::fastScanLiteralContent()
inline int QXmlStreamReaderPrivate::fastScanSpace()
{
int n = 0;
- ushort c;
- while ((c = getChar())) {
+ uint c;
+ while ((c = getChar()) != StreamEOF) {
switch (c) {
case '\r':
if ((c = filterCarriageReturn()) == 0)
@@ -1216,7 +1219,7 @@ inline int QXmlStreamReaderPrivate::fastScanContentCharList()
{
int n = 0;
uint c;
- while ((c = getChar())) {
+ while ((c = getChar()) != StreamEOF) {
switch (ushort(c)) {
case 0xfffe:
case 0xffff:
@@ -1279,8 +1282,8 @@ inline int QXmlStreamReaderPrivate::fastScanContentCharList()
inline int QXmlStreamReaderPrivate::fastScanName(int *prefix)
{
int n = 0;
- ushort c;
- while ((c = getChar())) {
+ uint c;
+ while ((c = getChar()) != StreamEOF) {
switch (c) {
case '\n':
case ' ':
@@ -1396,7 +1399,7 @@ inline int QXmlStreamReaderPrivate::fastScanNMTOKEN()
{
int n = 0;
uint c;
- while ((c = getChar())) {
+ while ((c = getChar()) != StreamEOF) {
if (fastDetermineNameChar(c) == NotName) {
putChar(c);
return n;
@@ -1452,7 +1455,7 @@ void QXmlStreamReaderPrivate::putReplacementInAttributeValue(const QString &s)
}
}
-ushort QXmlStreamReaderPrivate::getChar_helper()
+uint QXmlStreamReaderPrivate::getChar_helper()
{
const int BUFFER_SIZE = 8192;
characterOffset += readBufferPos;
@@ -1476,7 +1479,7 @@ ushort QXmlStreamReaderPrivate::getChar_helper()
}
if (!nbytesread) {
atEnd = true;
- return 0;
+ return StreamEOF;
}
#ifndef QT_NO_TEXTCODEC
@@ -1484,7 +1487,7 @@ ushort QXmlStreamReaderPrivate::getChar_helper()
if (nbytesread < 4) { // the 4 is to cover 0xef 0xbb 0xbf plus
// one extra for the utf8 codec
atEnd = true;
- return 0;
+ return StreamEOF;
}
int mib = 106; // UTF-8
@@ -1517,7 +1520,7 @@ ushort QXmlStreamReaderPrivate::getChar_helper()
if(lockEncoding && decoder->hasFailure()) {
raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content."));
readBuffer.clear();
- return 0;
+ return StreamEOF;
}
#else
readBuffer = QString::fromLatin1(rawReadBuffer.data(), nbytesread);
@@ -1531,7 +1534,7 @@ ushort QXmlStreamReaderPrivate::getChar_helper()
}
atEnd = true;
- return 0;
+ return StreamEOF;
}
QStringRef QXmlStreamReaderPrivate::namespaceForPrefix(const QStringRef &prefix)
diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h
index 7ff65e1718..087d64fce8 100644
--- a/src/corelib/xml/qxmlstream_p.h
+++ b/src/corelib/xml/qxmlstream_p.h
@@ -944,7 +944,7 @@ public:
short token;
- ushort token_char;
+ uint token_char;
uint filterCarriageReturn();
inline uint getChar();
@@ -955,7 +955,7 @@ public:
void putStringLiteral(const QString &s);
void putReplacement(const QString &s);
void putReplacementInAttributeValue(const QString &s);
- ushort getChar_helper();
+ uint getChar_helper();
bool scanUntil(const char *str, short tokenToInject = -1);
bool scanString(const char *str, short tokenToInject, bool requireSpace = true);
@@ -1068,7 +1068,7 @@ bool QXmlStreamReaderPrivate::parse()
documentVersion.clear();
documentEncoding.clear();
#ifndef QT_NO_TEXTCODEC
- if (decoder->hasFailure()) {
+ if (decoder && decoder->hasFailure()) {
raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content."));
readBuffer.clear();
return false;
@@ -1099,8 +1099,8 @@ bool QXmlStreamReaderPrivate::parse()
if (token == -1 && - TERMINAL_COUNT != action_index[act]) {
uint cu = getChar();
token = NOTOKEN;
- token_char = cu;
- if (cu & 0xff0000) {
+ token_char = cu == ~0U ? cu : ushort(cu);
+ if ((cu != ~0U) && (cu & 0xff0000)) {
token = cu >> 16;
} else switch (token_char) {
case 0xfffe:
@@ -1119,7 +1119,7 @@ bool QXmlStreamReaderPrivate::parse()
break;
}
// fall through
- case '\0': {
+ case ~0U: {
token = EOF_SYMBOL;
if (!tagsDone && !inParseEntity) {
int a = t_action(act, token);