Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/5.11' into dev
Browse files Browse the repository at this point in the history
Change-Id: Ib58433da04bffb5dfab5486b80f17f39cc4145fa
  • Loading branch information
Qt Forward Merge Bot committed May 4, 2018
2 parents aadc294 + 43ea15d commit ba2b7b8
Show file tree
Hide file tree
Showing 18 changed files with 232 additions and 234 deletions.
2 changes: 1 addition & 1 deletion src/3rdparty/freetype/LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Introduction
encourage you to use the following text:

"""
Portions of this software are copyright <year> The FreeType
Portions of this software are copyright © <year> The FreeType
Project (www.freetype.org). All rights reserved.
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,21 @@ private void copyAsset(String source, String destination)
destinationFile.createNewFile();

AssetManager assetsManager = m_context.getAssets();
InputStream inputStream = assetsManager.open(source);
OutputStream outputStream = new FileOutputStream(destinationFile);
copyFile(inputStream, outputStream);
InputStream inputStream = null;
OutputStream outputStream = null;
try {
inputStream = assetsManager.open(source);
outputStream = new FileOutputStream(destinationFile);
copyFile(inputStream, outputStream);
catch (Exception e) {
e.printStackTrace();
} finally {
if (inputStream != null)
inputStream.close();

inputStream.close();
outputStream.close();
if (outputStream != null)
outputStream.close();
}
}

private static void createBundledBinary(String source, String destination)
Expand All @@ -377,12 +386,21 @@ private static void createBundledBinary(String source, String destination)

destinationFile.createNewFile();

InputStream inputStream = new FileInputStream(source);
OutputStream outputStream = new FileOutputStream(destinationFile);
copyFile(inputStream, outputStream);
InputStream inputStream = null;
OutputStream outputStream = null;
try {
inputStream = new FileInputStream(source);
outputStream = new FileOutputStream(destinationFile);
copyFile(inputStream, outputStream);
catch (Exception e) {
e.printStackTrace();
} finally {
if (inputStream != null)
inputStream.close();

inputStream.close();
outputStream.close();
if (outputStream != null)
outputStream.close();
}
}

private boolean cleanCacheIfNecessary(String pluginsPrefix, long packageVersion)
Expand All @@ -391,12 +409,15 @@ private boolean cleanCacheIfNecessary(String pluginsPrefix, long packageVersion)

long cacheVersion = 0;
if (versionFile.exists() && versionFile.canRead()) {
DataInputStream inputStream = null;
try {
DataInputStream inputStream = new DataInputStream(new FileInputStream(versionFile));
inputStream = new DataInputStream(new FileInputStream(versionFile));
cacheVersion = inputStream.readLong();
inputStream.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
if (inputStream != null)
inputStream.close();
}
}

Expand Down Expand Up @@ -431,9 +452,16 @@ private void extractBundledPluginsAndImports(String pluginsPrefix, String libsDi

versionFile.createNewFile();

DataOutputStream outputStream = new DataOutputStream(new FileOutputStream(versionFile));
outputStream.writeLong(packageVersion);
outputStream.close();
DataOutputStream outputStream = null;
try {
outputStream = new DataOutputStream(new FileOutputStream(versionFile));
outputStream.writeLong(packageVersion);
catch (Exception e) {
e.printStackTrace();
} finally {
if (outputStream != null)
outputStream.close();
}
}

{
Expand Down
1 change: 1 addition & 0 deletions src/corelib/kernel/qabstracteventdispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class Q_CORE_EXPORT QAbstractEventDispatcher : public QObject
QT_DEPRECATED inline void registerTimer(int timerId, int interval, QObject *object)
{ registerTimer(timerId, interval, Qt::CoarseTimer, object); }
#endif
// ### Qt6: change interval range to qint64 (or use QDeadlineTimer)
int registerTimer(int interval, Qt::TimerType timerType, QObject *object);
virtual void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object) = 0;
virtual bool unregisterTimer(int timerId) = 0;
Expand Down
8 changes: 3 additions & 5 deletions src/corelib/serialization/qjson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ int Value::usedStorage(const Base *b) const

bool Value::isValid(const Base *b) const
{
int offset = 0;
int offset = -1;
switch (type) {
case QJsonValue::Double:
if (latinOrIntValue)
Expand All @@ -345,14 +345,12 @@ bool Value::isValid(const Base *b) const
break;
}

if (!offset)
if (offset == -1)
return true;
if (offset + sizeof(uint) > b->tableOffset)
if (offset + sizeof(uint) > b->tableOffset || offset < (int)sizeof(Base))
return false;

int s = usedStorage(b);
if (!s)
return true;
if (s < 0 || s > (int)b->tableOffset - offset)
return false;
if (type == QJsonValue::Array)
Expand Down
2 changes: 1 addition & 1 deletion src/corelib/serialization/qjson_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ static inline void copyString(char *dest, const QString &str, bool compress)


/*
Base is the base class for both Object and Array. Both classe work more or less the same way.
Base is the base class for both Object and Array. Both classes work more or less the same way.
The class starts with a header (defined by the struct below), then followed by data (the data for
values in the Array case and Entry's (see below) for objects.
Expand Down
3 changes: 3 additions & 0 deletions src/corelib/serialization/qjsondocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ QJsonDocument QJsonDocument::fromRawData(const char *data, int size, DataValidat
return QJsonDocument();
}

if (size < (int)(sizeof(QJsonPrivate::Header) + sizeof(QJsonPrivate::Base)))
return QJsonDocument();

QJsonPrivate::Data *d = new QJsonPrivate::Data((char *)data, size);
d->ownsData = false;

Expand Down
5 changes: 2 additions & 3 deletions src/corelib/tools/qsimd_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,8 @@
// AVX intrinsics
# if defined(__AVX__) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS) && (defined(Q_CC_INTEL) || defined(Q_CC_MSVC))
// AES, PCLMULQDQ instructions:
// All processors that support AVX support AES, PCLMULQDQ
// (but neither MSVC nor the Intel compiler define these macros)
# define __AES__ 1
// All processors that support AVX support PCLMULQDQ
// (but neither MSVC nor the Intel compiler define this macro)
# define __PCLMUL__ 1
# endif

Expand Down
4 changes: 1 addition & 3 deletions src/network/ssl/qsslsocket_openssl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@ bool QSslSocketBackendPrivate::importPkcs12(QIODevice *device,
if (!key->d->fromEVP_PKEY(pkey)) {
qCWarning(lcSsl, "Unable to convert private key");
q_OPENSSL_sk_pop_free(reinterpret_cast<OPENSSL_STACK *>(ca),
reinterpret_cast<void (*)(void *)>(q_OPENSSL_sk_free));
reinterpret_cast<void (*)(void *)>(q_X509_free));
q_X509_free(x509);
q_EVP_PKEY_free(pkey);
q_PKCS12_free(p12);
Expand All @@ -1448,8 +1448,6 @@ bool QSslSocketBackendPrivate::importPkcs12(QIODevice *device,
*caCertificates = QSslSocketBackendPrivate::STACKOFX509_to_QSslCertificates(ca);

// Clean up
// TODO: verify ASAP, in the past we had sk_pop_free with q_OPENSSL_sk_free
// which seems to be blatantly wrong and even crashes with 1.1.
q_OPENSSL_sk_pop_free(reinterpret_cast<OPENSSL_STACK *>(ca),
reinterpret_cast<void (*)(void *)>(q_X509_free));

Expand Down
11 changes: 5 additions & 6 deletions src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
Original file line number Diff line number Diff line change
Expand Up @@ -437,16 +437,15 @@ static void getFontDescription(CTFontDescriptorRef font, FontDescription *fd)
{
CTFontDescriptorRef descriptor = static_cast<CTFontDescriptorRef>(usrPtr);

if (NSURL *url = descriptorAttribute<NSURL>(descriptor, kCTFontURLAttribute)) {
if (NSValue *fontDataValue = descriptorAttribute<NSValue>(descriptor, (CFStringRef)kQtFontDataAttribute)) {
QByteArray *fontData = static_cast<QByteArray *>(fontDataValue.pointerValue);
return QFontEngineFT::create(*fontData, fontDef.pixelSize,
static_cast<QFont::HintingPreference>(fontDef.hintingPreference));
} else if (NSURL *url = descriptorAttribute<NSURL>(descriptor, kCTFontURLAttribute)) {
Q_ASSERT(url.fileURL);
QFontEngine::FaceId faceId;
faceId.filename = QString::fromNSString(url.path).toUtf8();
return QFontEngineFT::create(fontDef, faceId);

} else if (NSValue *fontDataValue = descriptorAttribute<NSValue>(descriptor, (CFStringRef)kQtFontDataAttribute)) {
QByteArray *fontData = static_cast<QByteArray *>(fontDataValue.pointerValue);
return QFontEngineFT::create(*fontData, fontDef.pixelSize,
static_cast<QFont::HintingPreference>(fontDef.hintingPreference));
}
Q_UNREACHABLE();
}
Expand Down
Loading

0 comments on commit ba2b7b8

Please sign in to comment.