summaryrefslogtreecommitdiffstats
path: root/src/corelib/codecs/qicucodec.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-08-03 11:40:35 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-04 00:52:14 +0200
commit4e542d958a8fa81c91e55c1358e15c84e34d15de (patch)
tree0dae9c119fad275a0f3a062b1b3920edf1eda77d /src/corelib/codecs/qicucodec.cpp
parent0715e1e6c2d38776cd9d5661639ce517f685fa6f (diff)
ICU: Mark which functions are threadsafe and which ones aren't
Mark the thread-safe functions with the \threadsafe doc marker. This includes public API, which should be thread-safe anyway. The thread-unsafe functions are marked "\nonreentrant" already. In addition, I renamed the functions that must be called with locked mutexes to Unlocked, following the convention in other libraries like libdbus-1. Change-Id: Ibd93d1266149767f546c8e82959b73c138008469 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/corelib/codecs/qicucodec.cpp')
-rw-r--r--src/corelib/codecs/qicucodec.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/corelib/codecs/qicucodec.cpp b/src/corelib/codecs/qicucodec.cpp
index 221d130321..b591a3d50d 100644
--- a/src/corelib/codecs/qicucodec.cpp
+++ b/src/corelib/codecs/qicucodec.cpp
@@ -52,8 +52,6 @@
QT_BEGIN_NAMESPACE
-extern QMutex *qTextCodecsMutex();
-
static void qIcuCodecStateFree(QTextCodec::ConverterState *state)
{
ucnv_close(static_cast<UConverter *>(state->d));
@@ -376,7 +374,7 @@ static QTextCodec *loadQtCodec(const char *name)
return 0;
}
-
+/// \threadsafe
QList<QByteArray> QIcuCodec::availableCodecs()
{
QList<QByteArray> codecs;
@@ -412,6 +410,7 @@ QList<QByteArray> QIcuCodec::availableCodecs()
return codecs;
}
+/// \threadsafe
QList<int> QIcuCodec::availableMibs()
{
QList<int> mibs;
@@ -424,7 +423,7 @@ QList<int> QIcuCodec::availableMibs()
return mibs;
}
-QTextCodec *QIcuCodec::defaultCodec()
+QTextCodec *QIcuCodec::defaultCodecUnlocked()
{
QCoreGlobalData *globalData = QCoreGlobalData::instance();
if (!globalData)
@@ -438,13 +437,13 @@ QTextCodec *QIcuCodec::defaultCodec()
#else
const char *name = ucnv_getDefaultName();
#endif
- c = codecForName(name);
+ c = codecForNameUnlocked(name);
globalData->codecForLocale.storeRelease(c);
return c;
}
-QTextCodec *QIcuCodec::codecForName(const char *name)
+QTextCodec *QIcuCodec::codecForNameUnlocked(const char *name)
{
// backwards compatibility with Qt 4.x
if (!qstrcmp(name, "CP949"))
@@ -525,11 +524,11 @@ QTextCodec *QIcuCodec::codecForName(const char *name)
}
-QTextCodec *QIcuCodec::codecForMib(int mib)
+QTextCodec *QIcuCodec::codecForMibUnlocked(int mib)
{
for (int i = 0; i < mibToNameSize; ++i) {
if (mibToName[i].mib == mib)
- return codecForName(mibToNameTable + mibToName[i].index);
+ return codecForNameUnlocked(mibToNameTable + mibToName[i].index);
}
return 0;
}