OSDN Git Service

optimize QIcuCodec::allMibs()
authorIvailo Monev <xakepa10@laimg.moc>
Tue, 14 Jul 2020 16:22:07 +0000 (16:22 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Tue, 14 Jul 2020 16:22:07 +0000 (16:22 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/core/codecs/qicucodec.cpp

index f6f3ac0..49b35fc 100644 (file)
@@ -1112,9 +1112,10 @@ QList<int> QIcuCodec::allMibs()
 {
     QList<int> allmibs;
 
-    foreach(const QByteArray &name, QIcuCodec::allCodecs()) {
+    for (int i = 0; i < ucnv_countAvailable(); i++) {
+        const char *name = ucnv_getAvailableName(i);
         for (qint16 i = 0; i < MIBTblSize; i++) {
-            if (ucnv_compareNames(name.constData(), MIBTbl[i].name) == 0) {
+            if (ucnv_compareNames(name, MIBTbl[i].name) == 0) {
                 allmibs.append(MIBTbl[i].mib);
             }
         }