summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-11-30 12:57:22 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2017-11-30 12:57:22 +0000
commitc35342ffeba10deecb2d8c0ce30a3a1a4ec1ee8d (patch)
tree0b7782b3d8973d20ee4db36f768367b94e3d3394 /src/corelib/tools
parent7200572b393534a2f503b810180276d2ae809c7a (diff)
parent87204c856ae3d8495c41af998ac196a12fe1c779 (diff)
Merge "Merge remote-tracking branch 'origin/5.10' into dev" into refs/staging/dev
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qlocale.cpp23
-rw-r--r--src/corelib/tools/qsimd.cpp26
-rw-r--r--src/corelib/tools/qtimezoneprivate_tz.cpp23
3 files changed, 24 insertions, 48 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index c85dcb4358..179784c7ba 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -3809,17 +3809,18 @@ QString QLocale::toCurrencyString(double value, const QString &symbol, int preci
/*!
\since 5.10
- Converts a size in bytes to a human-readable localized string, expressed in
- a unit for which the numeric portion is at least 1 but as low as
- possible. For example if \a bytes is 16384, \a precision is 2, and \a format
- is \c DataSizeIecFormat (the default), this function returns "16.00 KiB";
- for 1330409069609 bytes it returns "1.21 GiB"; and so on. If \a format is \c
- DataSizeIecFormat or \c DataSizeTraditionalFormat, the given number of bytes
- is divided by a power of 1024, with result less than 1024; for \c
- DataSizeSIFormat, it is divided by a power of 1000, with result less than
- 1000. DataSizeIecFormat uses the new IEC standard quantifiers Ki, Mi and so
- on, whereas DataSizeSIFormat uses and DataSizeTraditionalFormat abuses the
- older SI quantifiers k, M, etc.
+ Converts a size in bytes to a human-readable localized string, comprising a
+ number and a quantified unit. The quantifier is chosen such that the number
+ is at least one, and as small as possible. For example if \a bytes is
+ 16384, \a precision is 2, and \a format is \l DataSizeIecFormat (the
+ default), this function returns "16.00 KiB"; for 1330409069609 bytes it
+ returns "1.21 GiB"; and so on. If \a format is \l DataSizeIecFormat or
+ \l DataSizeTraditionalFormat, the given number of bytes is divided by a
+ power of 1024, with result less than 1024; for \l DataSizeSIFormat, it is
+ divided by a power of 1000, with result less than 1000.
+ \c DataSizeIecFormat uses the new IEC standard quantifiers Ki, Mi and so on,
+ whereas \c DataSizeSIFormat uses the older SI quantifiers k, M, etc., and
+ \c DataSizeTraditionalFormat abuses them.
*/
QString QLocale::formattedDataSize(qint64 bytes, int precision, DataSizeFormats format)
{
diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp
index 4c6f08c774..25340f2d02 100644
--- a/src/corelib/tools/qsimd.cpp
+++ b/src/corelib/tools/qsimd.cpp
@@ -652,32 +652,6 @@ Q_CORE_EXPORT QBasicAtomicInteger<unsigned> qt_cpu_features[2] = { Q_BASIC_ATOMI
void qDetectCpuFeatures()
{
-#if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL)
-# if Q_CC_GNU < 403
- // GCC 4.2 (at least the one that comes with Apple's XCode, on Mac) is
- // known to be broken beyond repair in dealing with the inline assembly
- // above. It will generate bad code that could corrupt important registers
- // like the PIC register. The behaviour of code after this function would
- // be totally unpredictable.
- //
- // For that reason, simply forego the CPUID check at all and return the set
- // of features that we found at compile time, through the #defines from the
- // compiler. This should at least allow code to execute, even if none of
- // the specialized code found in Qt GUI and elsewhere will ever be enabled
- // (it's the user's fault for using a broken compiler).
- //
- // This also disables the runtime checking that the processor actually
- // contains all the features that the code required. Qt 4 ran for years
- // like that, so it shouldn't be a problem.
-
- qt_cpu_features[0].store(minFeature | quint32(QSimdInitialized));
-#ifndef Q_ATOMIC_INT64_IS_SUPPORTED
- qt_cpu_features[1].store(minFeature >> 32);
-#endif
-
- return;
-# endif
-#endif
quint64 f = detectProcessorFeatures();
QByteArray disable = qgetenv("QT_NO_CPU_FEATURE");
if (!disable.isEmpty()) {
diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp
index bcc1285472..6a5df6272a 100644
--- a/src/corelib/tools/qtimezoneprivate_tz.cpp
+++ b/src/corelib/tools/qtimezoneprivate_tz.cpp
@@ -1050,7 +1050,18 @@ QByteArray QTzTimeZonePrivate::systemTimeZoneId() const
if (ianaId == "/etc/localtime")
ianaId.clear();
- // On Debian Etch and later /etc/localtime is real file with name held in /etc/timezone
+ // On most distros /etc/localtime is a symlink to a real file so extract name from the path
+ if (ianaId.isEmpty()) {
+ const QString path = QFile::symLinkTarget(QStringLiteral("/etc/localtime"));
+ if (!path.isEmpty()) {
+ // /etc/localtime is a symlink to the current TZ file, so extract from path
+ int index = path.indexOf(QLatin1String("/zoneinfo/"));
+ if (index != -1)
+ ianaId = path.mid(index + 10).toUtf8();
+ }
+ }
+
+ // On Debian Etch up to Jessie, /etc/localtime is a regular file while the actual name is in /etc/timezone
if (ianaId.isEmpty()) {
QFile tzif(QStringLiteral("/etc/timezone"));
if (tzif.open(QIODevice::ReadOnly)) {
@@ -1061,16 +1072,6 @@ QByteArray QTzTimeZonePrivate::systemTimeZoneId() const
}
}
- // On other distros /etc/localtime is symlink to real file so can extract name from the path
- if (ianaId.isEmpty()) {
- const QString path = QFile::symLinkTarget(QStringLiteral("/etc/localtime"));
- if (!path.isEmpty()) {
- // /etc/localtime is a symlink to the current TZ file, so extract from path
- int index = path.indexOf(QLatin1String("/zoneinfo/")) + 10;
- ianaId = path.mid(index).toUtf8();
- }
- }
-
// On some Red Hat distros /etc/localtime is real file with name held in /etc/sysconfig/clock
// in a line like ZONE="Europe/Oslo" or TIMEZONE="Europe/Oslo"
if (ianaId.isEmpty()) {