summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-02-23 06:43:41 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-02-23 06:43:41 (GMT)
commit3db40b0be40c946f547f238ed3f0af813892115e (patch)
treeced28fa59d5d99e26635776264d7dfef28c395b6
parent127df63bbce367e7e2d77ae9f219feb5a4a2560e (diff)
parent57cc5c50df4fc3673c948e8a55b4bab991e9cb7f (diff)
downloadQt-3db40b0be40c946f547f238ed3f0af813892115e.zip
Qt-3db40b0be40c946f547f238ed3f0af813892115e.tar.gz
Qt-3db40b0be40c946f547f238ed3f0af813892115e.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/berlin-staging-1 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/berlin-staging-1: clean up x11 desktop detection avoid double reallocations in inserting operations create temporaries more intelligently do not protect against self-assignment in QList::replace() make queues to which only lists are appended not blow the memory optimize queue-like structures remove more pointless recalculations Fix compilation with namespace. Fix compilation with namespace.
-rw-r--r--src/corelib/tools/qlist.cpp91
-rw-r--r--src/corelib/tools/qlist.h155
-rw-r--r--src/declarative/qml/qml.h4
-rw-r--r--src/gui/kernel/qapplication_x11.cpp116
-rw-r--r--src/gui/kernel/qt_x11_p.h5
-rw-r--r--src/gui/text/qstatictext.h4
-rw-r--r--src/multimedia/base/qmediaserviceprovider.cpp4
-rw-r--r--src/multimedia/playback/qmediaplayer.cpp7
-rw-r--r--src/multimedia/qml/qsoundeffect.cpp2
-rw-r--r--src/multimedia/qml/qsoundeffect_qsound_p.cpp2
-rw-r--r--src/multimedia/qml/wavedecoder_p.cpp4
11 files changed, 236 insertions, 158 deletions
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp
index ac0dc46..6f5bb9b 100644
--- a/src/corelib/tools/qlist.cpp
+++ b/src/corelib/tools/qlist.cpp
@@ -66,6 +66,53 @@ static int grow(int size)
return x;
}
+/*!
+ * Detaches the QListData by allocating new memory for a list which will be bigger
+ * than the copied one and is expected to grow further.
+ * *idx is the desired insertion point and is clamped to the actual size of the list.
+ * num is the number of new elements to insert at the insertion point.
+ * Returns the old (shared) data, it is up to the caller to deref() and free().
+ * For the new data node_copy needs to be called.
+ *
+ * \internal
+ */
+QListData::Data *QListData::detach_grow(int *idx, int num)
+{
+ Data *x = d;
+ int l = x->end - x->begin;
+ int nl = l + num;
+ int alloc = grow(nl);
+ Data* t = static_cast<Data *>(qMalloc(DataHeaderSize + alloc * sizeof(void *)));
+ Q_CHECK_PTR(t);
+
+ t->ref = 1;
+ t->sharable = true;
+ t->alloc = alloc;
+ // The space reservation algorithm's optimization is biased towards appending:
+ // Something which looks like an append will put the data at the beginning,
+ // while something which looks like a prepend will put it in the middle
+ // instead of at the end. That's based on the assumption that prepending
+ // is uncommon and even an initial prepend will eventually be followed by
+ // at least some appends.
+ int bg;
+ if (*idx < 0) {
+ *idx = 0;
+ bg = (alloc - nl) >> 1;
+ } else if (*idx > l) {
+ *idx = l;
+ bg = 0;
+ } else if (*idx < (l >> 1)) {
+ bg = (alloc - nl) >> 1;
+ } else {
+ bg = 0;
+ }
+ t->begin = bg;
+ t->end = bg + nl;
+ d = t;
+
+ return x;
+}
+
#if QT_VERSION >= 0x050000
# error "Remove QListData::detach(), it is only required for binary compatibility for 4.0.x to 4.2.x"
#endif
@@ -180,22 +227,30 @@ void QListData::realloc(int alloc)
d->begin = d->end = 0;
}
-// ensures that enough space is available to append one element
-void **QListData::append()
+// ensures that enough space is available to append n elements
+void **QListData::append(int n)
{
Q_ASSERT(d->ref == 1);
- if (d->end == d->alloc) {
- int n = d->end - d->begin;
- if (d->begin > 2 * d->alloc / 3) {
+ int e = d->end;
+ if (e + n > d->alloc) {
+ int b = d->begin;
+ if (b - n >= 2 * d->alloc / 3) {
// we have enough space. Just not at the end -> move it.
- ::memcpy(d->array + n, d->array + d->begin, n * sizeof(void *));
- d->begin = n;
- d->end = n * 2;
+ e -= b;
+ ::memcpy(d->array, d->array + b, e * sizeof(void *));
+ d->begin = 0;
} else {
- realloc(grow(d->alloc + 1));
+ realloc(grow(d->alloc + n));
}
}
- return d->array + d->end++;
+ d->end = e + n;
+ return d->array + e;
+}
+
+// ensures that enough space is available to append one element
+void **QListData::append()
+{
+ return append(1);
}
// ensures that enough space is available to append the list
@@ -209,7 +264,7 @@ void **QListData::append(const QListData& l)
int n = l.d->end - l.d->begin;
if (n) {
if (e + n > d->alloc)
- realloc(grow(e + l.d->end - l.d->begin));
+ realloc(grow(e + n));
::memcpy(d->array + d->end, l.d->array + l.d->begin, n*sizeof(void*));
d->end += n;
}
@@ -219,15 +274,7 @@ void **QListData::append(const QListData& l)
// ensures that enough space is available to append the list
void **QListData::append2(const QListData& l)
{
- Q_ASSERT(d->ref == 1);
- int e = d->end;
- int n = l.d->end - l.d->begin;
- if (n) {
- if (e + n > d->alloc)
- realloc(grow(e + n));
- d->end += n;
- }
- return d->array + e;
+ return append(l.d->end - l.d->begin);
}
void **QListData::prepend()
@@ -253,11 +300,11 @@ void **QListData::insert(int i)
Q_ASSERT(d->ref == 1);
if (i <= 0)
return prepend();
- if (i >= d->end - d->begin)
+ int size = d->end - d->begin;
+ if (i >= size)
return append();
bool leftward = false;
- int size = d->end - d->begin;
if (d->begin == 0) {
if (d->end == d->alloc) {
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 5364e8e..3a29e13 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -52,6 +52,7 @@
#endif
#include <new>
+#include <limits.h>
#include <string.h>
QT_BEGIN_HEADER
@@ -73,6 +74,7 @@ struct Q_CORE_EXPORT QListData {
enum { DataHeaderSize = sizeof(Data) - sizeof(void *) };
Data *detach(int alloc);
+ Data *detach_grow(int *i, int n);
Data *detach(); // remove in 5.0
Data *detach2(); // remove in 5.0
Data *detach3(); // remove in 5.0
@@ -80,6 +82,7 @@ struct Q_CORE_EXPORT QListData {
static Data shared_null;
Data *d;
void **erase(void **xi);
+ void **append(int n);
void **append();
void **append(const QListData &l);
void **append2(const QListData &l); // remove in 5.0
@@ -95,6 +98,25 @@ struct Q_CORE_EXPORT QListData {
inline void **end() const { return d->array + d->end; }
};
+//////////////////////////////////////////////////////////////////////////////////
+//
+// QtPodForSize and QtPodForType are internal and may change or go away any time.
+// We mean it.
+//
+//////////////////////////////////////////////////////////////////////////////////
+template <int N> struct QtPodForSize {
+ // This base type is rather obviously broken and cannot be made
+ // working due to alignment constraints.
+ // This doesn't matter as far as QList is concerned, as we are
+ // using this type only for QTypeInfo<T>::isLarge == false.
+ typedef struct { } Type;
+};
+template <> struct QtPodForSize<1> { typedef quint8 Type; };
+template <> struct QtPodForSize<2> { typedef quint16 Type; };
+template <> struct QtPodForSize<4> { typedef quint32 Type; };
+template <> struct QtPodForSize<8> { typedef quint64 Type; };
+template <class T> struct QtPodForType : QtPodForSize<sizeof(T)> { };
+
template <typename T>
class QList
{
@@ -333,6 +355,7 @@ public:
#endif
private:
+ Node *detach_helper_grow(int i, int n);
void detach_helper(int alloc);
void detach_helper();
void free(QListData::Data *d);
@@ -480,9 +503,8 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::reserve(int alloc)
template <typename T>
Q_OUTOFLINE_TEMPLATE void QList<T>::append(const T &t)
{
- detach();
- if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
- Node *n = reinterpret_cast<Node *>(p.append());
+ if (d->ref != 1) {
+ Node *n = detach_helper_grow(INT_MAX, 1);
QT_TRY {
node_construct(n, t);
} QT_CATCH(...) {
@@ -490,13 +512,24 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::append(const T &t)
QT_RETHROW;
}
} else {
- const T cpy(t);
- Node *n = reinterpret_cast<Node *>(p.append());
- QT_TRY {
- node_construct(n, cpy);
- } QT_CATCH(...) {
- --d->end;
- QT_RETHROW;
+ if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
+ Node *n = reinterpret_cast<Node *>(p.append());
+ QT_TRY {
+ node_construct(n, t);
+ } QT_CATCH(...) {
+ --d->end;
+ QT_RETHROW;
+ }
+ } else {
+ typedef typename QtPodForType<T>::Type PodNode;
+ PodNode cpy = *reinterpret_cast<const PodNode *>(&t);
+ Node *n = reinterpret_cast<Node *>(p.append());
+ QT_TRY {
+ node_construct(n, *reinterpret_cast<const T *>(&cpy));
+ } QT_CATCH(...) {
+ --d->end;
+ QT_RETHROW;
+ }
}
}
}
@@ -504,9 +537,8 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::append(const T &t)
template <typename T>
inline void QList<T>::prepend(const T &t)
{
- detach();
- if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
- Node *n = reinterpret_cast<Node *>(p.prepend());
+ if (d->ref != 1) {
+ Node *n = detach_helper_grow(0, 1);
QT_TRY {
node_construct(n, t);
} QT_CATCH(...) {
@@ -514,13 +546,24 @@ inline void QList<T>::prepend(const T &t)
QT_RETHROW;
}
} else {
- const T cpy(t);
- Node *n = reinterpret_cast<Node *>(p.prepend());
- QT_TRY {
- node_construct(n, cpy);
- } QT_CATCH(...) {
- ++d->begin;
- QT_RETHROW;
+ if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
+ Node *n = reinterpret_cast<Node *>(p.prepend());
+ QT_TRY {
+ node_construct(n, t);
+ } QT_CATCH(...) {
+ ++d->begin;
+ QT_RETHROW;
+ }
+ } else {
+ typedef typename QtPodForType<T>::Type PodNode;
+ PodNode cpy = *reinterpret_cast<const PodNode *>(&t);
+ Node *n = reinterpret_cast<Node *>(p.prepend());
+ QT_TRY {
+ node_construct(n, *reinterpret_cast<const T *>(&cpy));
+ } QT_CATCH(...) {
+ ++d->begin;
+ QT_RETHROW;
+ }
}
}
}
@@ -528,9 +571,8 @@ inline void QList<T>::prepend(const T &t)
template <typename T>
inline void QList<T>::insert(int i, const T &t)
{
- detach();
- if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
- Node *n = reinterpret_cast<Node *>(p.insert(i));
+ if (d->ref != 1) {
+ Node *n = detach_helper_grow(i, 1);
QT_TRY {
node_construct(n, t);
} QT_CATCH(...) {
@@ -538,13 +580,24 @@ inline void QList<T>::insert(int i, const T &t)
QT_RETHROW;
}
} else {
- const T cpy(t);
- Node *n = reinterpret_cast<Node *>(p.insert(i));
- QT_TRY {
- node_construct(n, cpy);
- } QT_CATCH(...) {
- p.remove(i);
- QT_RETHROW;
+ if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
+ Node *n = reinterpret_cast<Node *>(p.insert(i));
+ QT_TRY {
+ node_construct(n, t);
+ } QT_CATCH(...) {
+ p.remove(i);
+ QT_RETHROW;
+ }
+ } else {
+ typedef typename QtPodForType<T>::Type PodNode;
+ PodNode cpy = *reinterpret_cast<const PodNode *>(&t);
+ Node *n = reinterpret_cast<Node *>(p.insert(i));
+ QT_TRY {
+ node_construct(n, *reinterpret_cast<const T *>(&cpy));
+ } QT_CATCH(...) {
+ p.remove(i);
+ QT_RETHROW;
+ }
}
}
}
@@ -554,12 +607,7 @@ inline void QList<T>::replace(int i, const T &t)
{
Q_ASSERT_X(i >= 0 && i < p.size(), "QList<T>::replace", "index out of range");
detach();
- if (QTypeInfo<T>::isLarge || QTypeInfo<T>::isStatic) {
- reinterpret_cast<Node *>(p.at(i))->t() = t;
- } else {
- const T cpy(t);
- reinterpret_cast<Node *>(p.at(i))->t() = cpy;
- }
+ reinterpret_cast<Node *>(p.at(i))->t() = t;
}
template <typename T>
@@ -622,6 +670,36 @@ Q_OUTOFLINE_TEMPLATE T QList<T>::value(int i, const T& defaultValue) const
}
template <typename T>
+Q_OUTOFLINE_TEMPLATE typename QList<T>::Node *QList<T>::detach_helper_grow(int i, int c)
+{
+ Node *n = reinterpret_cast<Node *>(p.begin());
+ QListData::Data *x = p.detach_grow(&i, c);
+ QT_TRY {
+ node_copy(reinterpret_cast<Node *>(p.begin()),
+ reinterpret_cast<Node *>(p.begin() + i), n);
+ } QT_CATCH(...) {
+ qFree(d);
+ d = x;
+ QT_RETHROW;
+ }
+ QT_TRY {
+ node_copy(reinterpret_cast<Node *>(p.begin() + i + c),
+ reinterpret_cast<Node *>(p.end()), n + i);
+ } QT_CATCH(...) {
+ node_destruct(reinterpret_cast<Node *>(p.begin()),
+ reinterpret_cast<Node *>(p.begin() + i));
+ qFree(d);
+ d = x;
+ QT_RETHROW;
+ }
+
+ if (!x->ref.deref())
+ free(x);
+
+ return reinterpret_cast<Node *>(p.begin() + i);
+}
+
+template <typename T>
Q_OUTOFLINE_TEMPLATE void QList<T>::detach_helper(int alloc)
{
Node *n = reinterpret_cast<Node *>(p.begin());
@@ -730,8 +808,9 @@ Q_OUTOFLINE_TEMPLATE typename QList<T>::iterator QList<T>::erase(typename QList<
template <typename T>
Q_OUTOFLINE_TEMPLATE QList<T> &QList<T>::operator+=(const QList<T> &l)
{
- detach();
- Node *n = reinterpret_cast<Node *>(p.append2(l.p));
+ Node *n = (d->ref != 1)
+ ? detach_helper_grow(INT_MAX, l.size())
+ : reinterpret_cast<Node *>(p.append2(l.p));
QT_TRY{
node_copy(n, reinterpret_cast<Node *>(p.end()), reinterpret_cast<Node *>(l.p.begin()));
} QT_CATCH(...) {
diff --git a/src/declarative/qml/qml.h b/src/declarative/qml/qml.h
index 7972305..163d198 100644
--- a/src/declarative/qml/qml.h
+++ b/src/declarative/qml/qml.h
@@ -55,8 +55,6 @@
QT_BEGIN_HEADER
-QT_MODULE(Declarative)
-
#define QML_DECLARE_TYPE(TYPE) \
Q_DECLARE_METATYPE(TYPE *) \
Q_DECLARE_METATYPE(QmlListProperty<TYPE>)
@@ -88,6 +86,8 @@ QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
+QT_MODULE(Declarative)
+
#if defined(Q_OS_SYMBIAN)
#define QML_DEFINE_INTERFACE(INTERFACE) \
static int defineInterface##INTERFACE = qmlRegisterInterface<INTERFACE>(#INTERFACE);
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 34865b5..c6e192b 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -208,11 +208,8 @@ static const char * x11_atomnames = {
"_MOTIF_WM_HINTS\0"
"DTWM_IS_RUNNING\0"
- "KDE_FULL_SESSION\0"
- "KWIN_RUNNING\0"
- "KWM_RUNNING\0"
- "GNOME_BACKGROUND_PROPERTIES\0"
"ENLIGHTENMENT_DESKTOP\0"
+ "_DT_SAVE_MODE\0"
"_SGI_DESKS_MANAGER\0"
// EWMH (aka NETWM)
@@ -626,8 +623,6 @@ static int qt_x_errhandler(Display *dpy, XErrorEvent *err)
|| err->resourceid == XA_RGB_DEFAULT_MAP
|| err->resourceid == ATOM(_NET_SUPPORTED)
|| err->resourceid == ATOM(_NET_SUPPORTING_WM_CHECK)
- || err->resourceid == ATOM(KDE_FULL_SESSION)
- || err->resourceid == ATOM(KWIN_RUNNING)
|| err->resourceid == ATOM(XdndProxy)
|| err->resourceid == ATOM(XdndAware))) {
// Perhaps we're running under SECURITY reduction? :/
@@ -2222,87 +2217,36 @@ void qt_init(QApplicationPrivate *priv, int,
X11->desktopEnvironment = DE_UNKNOWN;
X11->desktopVersion = 0;
- // See if the current window manager is using the freedesktop.org spec to give its name
- Window windowManagerWindow = XNone;
- Atom typeReturned;
- int formatReturned;
- unsigned long nitemsReturned;
- unsigned long unused;
- unsigned char *data = 0;
- if (XGetWindowProperty(QX11Info::display(), QX11Info::appRootWindow(),
- ATOM(_NET_SUPPORTING_WM_CHECK),
- 0, 1024, False, XA_WINDOW, &typeReturned,
- &formatReturned, &nitemsReturned, &unused, &data)
- == Success) {
- if (typeReturned == XA_WINDOW && formatReturned == 32)
- windowManagerWindow = *((Window*) data);
- if (data)
- XFree(data);
-
- if (windowManagerWindow != XNone) {
- QString wmName;
- Atom utf8atom = ATOM(UTF8_STRING);
- if (XGetWindowProperty(QX11Info::display(), windowManagerWindow, ATOM(_NET_WM_NAME),
- 0, 1024, False, utf8atom, &typeReturned,
- &formatReturned, &nitemsReturned, &unused, &data)
- == Success) {
- if (typeReturned == utf8atom && formatReturned == 8)
- wmName = QString::fromUtf8((const char*)data);
- if (data)
- XFree(data);
- if (wmName == QLatin1String("KWin"))
- X11->desktopEnvironment = DE_KDE;
- if (wmName == QLatin1String("Metacity"))
- X11->desktopEnvironment = DE_GNOME;
- }
- }
- }
-
- // Running a different/newer/older window manager? Try some other things
- if (X11->desktopEnvironment == DE_UNKNOWN){
- Atom type;
- int format;
- unsigned long length, after;
- uchar *data = 0;
-
- QString session = QString::fromLocal8Bit(qgetenv("DESKTOP_SESSION"));
- if (session == QLatin1String("kde")) {
- X11->desktopEnvironment = DE_KDE;
- } else if (session == QLatin1String("gnome") || session == QLatin1String("xfce")) {
- X11->desktopEnvironment = DE_GNOME;
- } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(DTWM_IS_RUNNING),
- 0, 1, False, AnyPropertyType, &type, &format, &length,
- &after, &data) == Success && length) {
- // DTWM is running, meaning most likely CDE is running...
- X11->desktopEnvironment = DE_CDE;
- } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(),
- ATOM(GNOME_BACKGROUND_PROPERTIES), 0, 1, False, AnyPropertyType,
- &type, &format, &length, &after, &data) == Success && length) {
- X11->desktopEnvironment = DE_GNOME;
- } else if (!qgetenv("GNOME_DESKTOP_SESSION_ID").isEmpty()) {
- X11->desktopEnvironment = DE_GNOME;
- } else if ((XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(KDE_FULL_SESSION),
- 0, 1, False, AnyPropertyType, &type, &format, &length, &after, &data) == Success
- && length)
- || (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(KWIN_RUNNING),
- 0, 1, False, AnyPropertyType, &type, &format, &length,
- &after, &data) == Success
- && length)
- || (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(KWM_RUNNING),
- 0, 1, False, AnyPropertyType, &type, &format, &length,
- &after, &data) == Success && length)) {
- X11->desktopEnvironment = DE_KDE;
- } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(_SGI_DESKS_MANAGER),
- 0, 1, False, XA_WINDOW, &type, &format, &length, &after, &data) == Success
- && length) {
- X11->desktopEnvironment = DE_4DWM;
- }
- if (data)
- XFree((char *)data);
+ Atom type;
+ int format;
+ unsigned long length, after;
+ uchar *data = 0;
+
+ if (!qgetenv("KDE_FULL_SESSION").isEmpty()) {
+ X11->desktopEnvironment = DE_KDE;
+ X11->desktopVersion = qgetenv("KDE_SESSION_VERSION").toInt();
+ } else if (!qgetenv("GNOME_DESKTOP_SESSION_ID").isEmpty() // Deprecated for some reason.
+ || qgetenv("DESKTOP_SESSION") == "gnome") { // De-facto-standardized by GNOME.
+ X11->desktopEnvironment = DE_GNOME;
+ } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(_DT_SAVE_MODE),
+ 0, 2, False, XA_STRING, &type, &format, &length,
+ &after, &data) == Success
+ && !strcmp(reinterpret_cast<char *>(data), "xfce4")) {
+ // Pretend that xfce4 is gnome, as it uses the same libraries.
+ // The detection above is stolen from xdg-open.
+ X11->desktopEnvironment = DE_GNOME;
+ } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(DTWM_IS_RUNNING),
+ 0, 1, False, AnyPropertyType, &type, &format, &length,
+ &after, &data) == Success && length) {
+ // DTWM is running, meaning most likely CDE is running...
+ X11->desktopEnvironment = DE_CDE;
+ } else if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(), ATOM(_SGI_DESKS_MANAGER),
+ 0, 1, False, XA_WINDOW, &type, &format, &length, &after, &data) == Success
+ && length) {
+ X11->desktopEnvironment = DE_4DWM;
}
-
- if (X11->desktopEnvironment == DE_KDE)
- X11->desktopVersion = QString::fromLocal8Bit(qgetenv("KDE_SESSION_VERSION")).toInt();
+ if (data)
+ XFree((char *)data);
#if !defined(QT_NO_STYLE_GTK)
if (X11->desktopEnvironment == DE_GNOME) {
diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h
index b2ce754..167557b 100644
--- a/src/gui/kernel/qt_x11_p.h
+++ b/src/gui/kernel/qt_x11_p.h
@@ -564,11 +564,8 @@ struct QX11Data
_MOTIF_WM_HINTS,
DTWM_IS_RUNNING,
- KDE_FULL_SESSION,
- KWIN_RUNNING,
- KWM_RUNNING,
- GNOME_BACKGROUND_PROPERTIES,
ENLIGHTENMENT_DESKTOP,
+ _DT_SAVE_MODE,
_SGI_DESKS_MANAGER,
// EWMH (aka NETWM)
diff --git a/src/gui/text/qstatictext.h b/src/gui/text/qstatictext.h
index 1e59944..00d42e0 100644
--- a/src/gui/text/qstatictext.h
+++ b/src/gui/text/qstatictext.h
@@ -97,10 +97,10 @@ private:
friend class QStaticTextPrivate;
};
-Q_DECLARE_METATYPE(QStaticText)
-
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QStaticText)
+
QT_END_HEADER
#endif // QSTATICTEXT_H
diff --git a/src/multimedia/base/qmediaserviceprovider.cpp b/src/multimedia/base/qmediaserviceprovider.cpp
index 8d1e0fa..eb97e16 100644
--- a/src/multimedia/base/qmediaserviceprovider.cpp
+++ b/src/multimedia/base/qmediaserviceprovider.cpp
@@ -48,7 +48,7 @@
#include "qmediapluginloader_p.h"
#include <QtMultimedia/qmediaplayer.h>
-
+QT_BEGIN_NAMESPACE
class QMediaServiceProviderHintPrivate : public QSharedData
{
@@ -594,6 +594,8 @@ QMediaServiceProvider *QMediaServiceProvider::defaultServiceProvider()
#endif
}
+QT_END_NAMESPACE
+
/*!
\class QMediaServiceProviderPlugin
\preliminary
diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp
index 5f50fdb..0684bd1 100644
--- a/src/multimedia/playback/qmediaplayer.cpp
+++ b/src/multimedia/playback/qmediaplayer.cpp
@@ -947,9 +947,10 @@ QStringList QMediaPlayer::supportedMimeTypes(Flags flags)
Such playback service can be used for beeps, ringtones, etc.
*/
-#include "moc_qmediaplayer.cpp"
-
QT_END_NAMESPACE
-QT_END_NAMESPACE
+QT_END_HEADER
+
+#include "moc_qmediaplayer.cpp"
+
diff --git a/src/multimedia/qml/qsoundeffect.cpp b/src/multimedia/qml/qsoundeffect.cpp
index f0c9659..df9af7b 100644
--- a/src/multimedia/qml/qsoundeffect.cpp
+++ b/src/multimedia/qml/qsoundeffect.cpp
@@ -52,6 +52,7 @@
#include "qsoundeffect_qsound_p.h"
#endif
+QT_BEGIN_NAMESPACE
/*!
\qmlclass SoundEffect QSoundEffect
@@ -250,3 +251,4 @@ void QSoundEffect::repeat()
}
}
+QT_END_NAMESPACE
diff --git a/src/multimedia/qml/qsoundeffect_qsound_p.cpp b/src/multimedia/qml/qsoundeffect_qsound_p.cpp
index 33f5bd4..0292d26 100644
--- a/src/multimedia/qml/qsoundeffect_qsound_p.cpp
+++ b/src/multimedia/qml/qsoundeffect_qsound_p.cpp
@@ -65,6 +65,7 @@
#include "qsoundeffect_qsound_p.h"
+QT_BEGIN_NAMESPACE
QSoundEffectPrivate::QSoundEffectPrivate(QObject* parent):
QObject(parent),
@@ -221,3 +222,4 @@ void QSoundEffectPrivate::unloadSample()
m_sound = 0;
}
+QT_END_NAMESPACE
diff --git a/src/multimedia/qml/wavedecoder_p.cpp b/src/multimedia/qml/wavedecoder_p.cpp
index 5fc5a96..b7d6101 100644
--- a/src/multimedia/qml/wavedecoder_p.cpp
+++ b/src/multimedia/qml/wavedecoder_p.cpp
@@ -44,6 +44,8 @@
#include <QtCore/qtimer.h>
#include <QtCore/qendian.h>
+QT_BEGIN_NAMESPACE
+
WaveDecoder::WaveDecoder(QIODevice *s, QObject *parent):
QIODevice(parent),
haveFormat(false),
@@ -134,3 +136,5 @@ void WaveDecoder::handleData()
emit formatKnown();
}
}
+
+QT_END_NAMESPACE