diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-09-30 18:22:39 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-09-30 18:22:39 (GMT) |
commit | 6d20831a82a6a19ea841720e339f5f86623a9dc2 (patch) | |
tree | 4f089f08f2d1ece4196ef0ac545263995f918f78 /src/corelib | |
parent | 74d391adfd907d80ae35abe25fe346b2b4d649f9 (diff) | |
parent | 30769c79fa18cd14fe1cdb7d0eca95a5daca77a0 (diff) | |
download | Qt-6d20831a82a6a19ea841720e339f5f86623a9dc2.zip Qt-6d20831a82a6a19ea841720e339f5f86623a9dc2.tar.gz Qt-6d20831a82a6a19ea841720e339f5f86623a9dc2.tar.bz2 |
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.cpp | 52 | ||||
-rw-r--r-- | src/corelib/plugin/qsystemlibrary.cpp | 5 | ||||
-rw-r--r-- | src/corelib/plugin/qsystemlibrary_p.h | 4 |
3 files changed, 37 insertions, 24 deletions
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index c9fbec8..83e1f0c 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 eeb142b..1b8d8fe 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 3251a3c..8000a61 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 |