summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-06-23 13:13:51 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-06-23 13:13:51 (GMT)
commit164728f711136356a6c3482f762321b01c9d82dd (patch)
treeef76a64523ff99b1160eb7c8885a0d84c810f735
parentdfcaa6b67c1df879b08dd6952a7cfd60d93ff543 (diff)
parent59bd3bcd961fb3198dc9ba24996f7f9af67aeda3 (diff)
downloadQt-164728f711136356a6c3482f762321b01c9d82dd.zip
Qt-164728f711136356a6c3482f762321b01c9d82dd.tar.gz
Qt-164728f711136356a6c3482f762321b01c9d82dd.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Add a function that returns the D-Bus local machine ID Add an SSE4.2 even simpler version of toLatin1
-rw-r--r--src/corelib/tools/qstring.cpp23
-rw-r--r--src/dbus/qdbus_symbols_p.h2
-rw-r--r--src/dbus/qdbusconnection.cpp21
-rw-r--r--src/dbus/qdbusconnection.h2
-rw-r--r--tests/auto/qstring/tst_qstring.cpp4
5 files changed, 52 insertions, 0 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index f8f4bdc..ee45cfd 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -3580,6 +3580,28 @@ static inline __m128i mergeQuestionMarks(__m128i chunk)
{
const __m128i questionMark = _mm_set1_epi16('?');
+# ifdef __SSE4_2__
+ // compare the unsigned shorts for the range 0x0100-0xFFFF
+ // note on the use of _mm_cmpestrm:
+ // The MSDN documentation online (http://technet.microsoft.com/en-us/library/bb514080.aspx)
+ // says for range search the following:
+ // For each character c in a, determine whether b0 <= c <= b1 or b2 <= c <= b3
+ //
+ // However, all examples on the Internet, including from Intel
+ // (see http://software.intel.com/en-us/articles/xml-parsing-accelerator-with-intel-streaming-simd-extensions-4-intel-sse4/)
+ // put the range to be searched first
+ //
+ // Disassembly and instruction-level debugging with GCC and ICC show
+ // that they are doing the right thing. Inverting the arguments in the
+ // instruction does cause a bunch of test failures.
+
+ const int mode = _SIDD_UWORD_OPS | _SIDD_CMP_RANGES | _SIDD_UNIT_MASK;
+ const __m128i rangeMatch = _mm_cvtsi32_si128(0xffff0100);
+ const __m128i offLimitMask = _mm_cmpestrm(rangeMatch, 2, chunk, 8, mode);
+
+ // replace the non-Latin 1 characters in the chunk with question marks
+ chunk = _mm_blendv_epi8(chunk, questionMark, offLimitMask);
+# else
// SSE has no compare instruction for unsigned comparison.
// The variables must be shiffted + 0x8000 to be compared
const __m128i signedBitOffset = _mm_set1_epi16(0x8000);
@@ -3603,6 +3625,7 @@ static inline __m128i mergeQuestionMarks(__m128i chunk)
// merge offLimitQuestionMark and correctBytes to have the result
chunk = _mm_or_si128(correctBytes, offLimitQuestionMark);
# endif
+# endif
return chunk;
}
#endif
diff --git a/src/dbus/qdbus_symbols_p.h b/src/dbus/qdbus_symbols_p.h
index 8b46e6a..a59c08a 100644
--- a/src/dbus/qdbus_symbols_p.h
+++ b/src/dbus/qdbus_symbols_p.h
@@ -301,6 +301,8 @@ DEFINEFUNC(void , dbus_get_version , (int *major_version_p,
int *minor_version_p,
int *micro_version_p),
(major_version_p, minor_version_p, micro_version_p), )
+DEFINEFUNC(char* , dbus_get_local_machine_id , (void), (), return)
+
/* dbus-pending-call.h */
DEFINEFUNC(dbus_bool_t , dbus_pending_call_set_notify, (DBusPendingCall *pending,
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
index 58c1caa..0b4133c 100644
--- a/src/dbus/qdbusconnection.cpp
+++ b/src/dbus/qdbusconnection.cpp
@@ -1124,6 +1124,27 @@ void QDBusConnectionPrivate::setBusService(const QDBusConnection &connection)
}
/*!
+ \since 4.8
+ Returns the local machine ID as known to the D-Bus system. Each
+ node or host that runs D-Bus has a unique identifier that can be
+ used to distinguish it from other hosts if they are sharing
+ resources like the filesystem.
+
+ Note that the local machine ID is not guaranteed to be persistent
+ across boots of the system, so this identifier should not be
+ stored in persistent storage (like the filesystem). It is
+ guaranteed to remain constant only during the lifetime of this
+ boot session.
+*/
+QByteArray QDBusConnection::localMachineId()
+{
+ char *dbus_machine_id = q_dbus_get_local_machine_id();
+ QByteArray result = dbus_machine_id;
+ q_dbus_free(dbus_machine_id);
+ return result;
+}
+
+/*!
\namespace QDBus
\inmodule QtDBus
diff --git a/src/dbus/qdbusconnection.h b/src/dbus/qdbusconnection.h
index 19418d6..4bdd055 100644
--- a/src/dbus/qdbusconnection.h
+++ b/src/dbus/qdbusconnection.h
@@ -176,6 +176,8 @@ public:
static void disconnectFromBus(const QString &name);
static void disconnectFromPeer(const QString &name);
+ static QByteArray localMachineId();
+
static QDBusConnection sessionBus();
static QDBusConnection systemBus();
diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp
index c19b168..b26121c 100644
--- a/tests/auto/qstring/tst_qstring.cpp
+++ b/tests/auto/qstring/tst_qstring.cpp
@@ -3475,6 +3475,10 @@ void tst_QString::toLatin1Roundtrip_data()
static const ushort unicode6[] = { 0x180, 0x1ff, 0x8001, 0x8080, 0xfffc };
QTest::newRow("non-latin1b") << QByteArray("?????") << QString::fromUtf16(unicode6, 5) << questionmarks;
+
+ static const ushort unicode7[] = { 'H', 'e', 'l', 'l', 'o', 0x100, 0x17f, 0x180, 0x8080, 0xfffc };
+ static const ushort unicode7q[] = { 'H', 'e', 'l', 'l', 'o', '?', '?', '?', '?', '?' };
+ QTest::newRow("mixed") << QByteArray("Hello?????") << QString::fromUtf16(unicode7, 10) << QString::fromUtf16(unicode7q, 10);
}
void tst_QString::toLatin1Roundtrip()