summaryrefslogtreecommitdiff
path: root/src/corelib
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-10-01 12:40:29 +0200
committerQt Continuous Integration System <qt-info@nokia.com>2010-10-01 12:40:29 +0200
commitc6398b785588486c5fc52cb1d71000c0815d995e (patch)
tree32bf37b9a594462a60e59e85afcf763513a43109 /src/corelib
parent33b76a659b2f44fa7038e375bbfb4cfd449ae617 (diff)
parentfc944ca0cde725d263b8f28651058b3f90815de9 (diff)
downloadqt4-tools-c6398b785588486c5fc52cb1d71000c0815d995e.tar.gz
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: (24 commits) Stabilize tst_QGraphicsWidget::QT_BUG_13865_doublePaintWhenAddingASubItem Fixed accessing freed memory in raster engine. Build fix for -qtnamespace. Fixed parsing of SVGs with absolute font sizes. Moving QPdf::stripSpecialCharacter to fontengine Revert "Fix (implement!) hfw/wfh in QGridLayoutEngine" Fixed a layout issue where you could get NaN as dimensions QTextCodec: Fix valgrind warning when using QTextCodec in destructions functions Fix double painting when adding an item into a linear layout Fixed antialiased rasterization bug in raster engine. Fixed potential crash when loading corrupt GIFs. Work around an ATI driver problem with mutli-sampled pbuffers. tst_qstatemachine.cpp: fix compilation with Sun Studio Fixed regression in clipping.qps autotest on 64-bit. Fixed crash when using Qt::WA_DeleteOnClose on a QPrintDialog on Mac. Fixed performance regression in curve stroking. Don't disable texture_from_pixmap on GLX/X11 by default. Avoid creating copy of an image in memory when storing as png Doc update for the support of MSVC 2010 64-bit fix documentation of drawText(int, int, int, int, ... ...
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/codecs/qtextcodec.cpp52
-rw-r--r--src/corelib/plugin/qsystemlibrary.cpp5
-rw-r--r--src/corelib/plugin/qsystemlibrary_p.h4
3 files changed, 37 insertions, 24 deletions
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index c9fbec870b..83e1f0cfef 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -110,6 +110,10 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QTextCodecFactoryInterface_iid, QLatin1String("/codecs")))
#endif
+//Cache for QTextCodec::codecForName and codecForMib.
+typedef QHash<QByteArray, QTextCodec *> QTextCodecCache;
+Q_GLOBAL_STATIC(QTextCodecCache, qTextCodecCache)
+
static char qtolower(register char c)
{ if (c >= 'A' && c <= 'Z') return c + 0x20; return c; }
@@ -181,7 +185,6 @@ static QTextCodec *createForMib(int mib)
}
static QList<QTextCodec*> *all = 0;
-static int clearCaches = 0; // flags specifying if caches should be invalided: 0x1 codecForName, 0x2 codecForMib
#ifdef Q_DEBUG_TEXTCODEC
static bool destroying_is_ok = false;
#endif
@@ -1007,7 +1010,9 @@ QTextCodec::~QTextCodec()
QMutexLocker locker(textCodecsMutex());
#endif
all->removeAll(this);
- clearCaches = 0x1 | 0x2;
+ QTextCodecCache *cache = qTextCodecCache();
+ if (cache)
+ cache->clear();
}
}
@@ -1037,32 +1042,33 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name)
if (!validCodecs())
return 0;
- static QHash <QByteArray, QTextCodec *> cache;
- if (clearCaches & 0x1) {
- cache.clear();
- clearCaches &= ~0x1;
+ QTextCodecCache *cache = qTextCodecCache();
+ QTextCodec *codec;
+ if (cache) {
+ codec = cache->value(name);
+ if (codec)
+ return codec;
}
- QTextCodec *codec = cache.value(name);
- if (codec)
- return codec;
for (int i = 0; i < all->size(); ++i) {
QTextCodec *cursor = all->at(i);
if (nameMatch(cursor->name(), name)) {
- cache.insert(name, cursor);
+ if (cache)
+ cache->insert(name, cursor);
return cursor;
}
QList<QByteArray> aliases = cursor->aliases();
for (int y = 0; y < aliases.size(); ++y)
if (nameMatch(aliases.at(y), name)) {
- cache.insert(name, cursor);
+ if (cache)
+ cache->insert(name, cursor);
return cursor;
}
}
codec = createForName(name);
- if (codec)
- cache.insert(name, codec);
+ if (codec && cache)
+ cache->insert(name, codec);
return codec;
}
@@ -1081,20 +1087,18 @@ QTextCodec* QTextCodec::codecForMib(int mib)
if (!validCodecs())
return 0;
- static QHash <int, QTextCodec *> cache;
- if (clearCaches & 0x2) {
- cache.clear();
- clearCaches &= ~0x2;
- }
- QTextCodec *codec = cache.value(mib);
- if (codec)
- return codec;
+ QByteArray key = "MIB: " + QByteArray::number(mib);
+ QTextCodecCache *cache = qTextCodecCache();
+ QTextCodec *codec;
+ if (cache)
+ codec = cache->value(key);
QList<QTextCodec*>::ConstIterator i;
for (int i = 0; i < all->size(); ++i) {
QTextCodec *cursor = all->at(i);
if (cursor->mibEnum() == mib) {
- cache.insert(mib, cursor);
+ if (cache)
+ cache->insert(key, cursor);
return cursor;
}
}
@@ -1106,8 +1110,8 @@ QTextCodec* QTextCodec::codecForMib(int mib)
if (!codec && mib == 1000)
return codecForMib(1015);
- if (codec)
- cache.insert(mib, codec);
+ if (codec && cache)
+ cache->insert(key, codec);
return codec;
}
diff --git a/src/corelib/plugin/qsystemlibrary.cpp b/src/corelib/plugin/qsystemlibrary.cpp
index eeb142bbfc..1b8d8fea75 100644
--- a/src/corelib/plugin/qsystemlibrary.cpp
+++ b/src/corelib/plugin/qsystemlibrary.cpp
@@ -77,6 +77,9 @@
in the documentation for LoadLibrary for Windows CE at MSDN.
(http://msdn.microsoft.com/en-us/library/ms886736.aspx)
*/
+
+QT_BEGIN_NAMESPACE
+
#if defined(Q_OS_WINCE)
HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirectory /* = true */)
{
@@ -134,3 +137,5 @@ HINSTANCE QSystemLibrary::load(const wchar_t *libraryName, bool onlySystemDirect
}
#endif //Q_OS_WINCE
+
+QT_END_NAMESPACE
diff --git a/src/corelib/plugin/qsystemlibrary_p.h b/src/corelib/plugin/qsystemlibrary_p.h
index 3251a3c2b3..8000a6131a 100644
--- a/src/corelib/plugin/qsystemlibrary_p.h
+++ b/src/corelib/plugin/qsystemlibrary_p.h
@@ -47,6 +47,8 @@
#include <qt_windows.h>
#include <QtCore/qstring.h>
+QT_BEGIN_NAMESPACE
+
class QSystemLibrary
{
public:
@@ -101,6 +103,8 @@ private:
bool m_didLoad;
};
+QT_END_NAMESPACE
+
#endif //Q_OS_WIN
#endif //QSYSTEMLIBRARY_P_H