SyncEngine: keep a static pointer to the codec
authorOlivier Goffart <ogoffart@woboq.com>
Wed, 21 Oct 2015 14:01:44 +0000 (16:01 +0200)
committerOlivier Goffart <ogoffart@woboq.com>
Wed, 21 Oct 2015 14:38:26 +0000 (16:38 +0200)
The QTextCodec for UTF-8 is not going to change during the application life time.
So no need to look it up for every file

src/libsync/syncengine.cpp

index 0588364bb7097622d68c843b9634020f12f3a65b..7b8f3e144f6ecc1558c6193560124f27181e8a4d 100644 (file)
@@ -298,7 +298,7 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote )
     if( ! file ) return -1;
 
     QTextCodec::ConverterState utf8State;
-    QTextCodec *codec = QTextCodec::codecForName("UTF-8");
+    static QTextCodec *codec = QTextCodec::codecForName("UTF-8");
     Q_ASSERT(codec);
     QString fileUtf8 = codec->toUnicode(file->path, qstrlen(file->path), &utf8State);
     QString renameTarget;