From f7c68f6baf104729e8d2fb3a0693b3c59928f8d3 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 19 Aug 2013 15:47:51 +0200 Subject: C++: change working-copy to work on UTF-8 encoded QByteArrays. These not only take less space than UTF-16 encoded QStrings, but due to the caching in the CppEditorSupport also take less time to build. This patch also fixes a number of possible encoding issues, where files and constant strings were (falsely) assumed to be UTF-8. Change-Id: Ib6f91c9a94ebed5b5dfbd4eb2998825c62c72784 Reviewed-by: Nikolai Kosjar Reviewed-by: hjk --- src/plugins/cpptools/cpprefactoringchanges.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/cpptools/cpprefactoringchanges.cpp') diff --git a/src/plugins/cpptools/cpprefactoringchanges.cpp b/src/plugins/cpptools/cpprefactoringchanges.cpp index 11111f1c2f..9bc68f57e1 100644 --- a/src/plugins/cpptools/cpprefactoringchanges.cpp +++ b/src/plugins/cpptools/cpprefactoringchanges.cpp @@ -109,7 +109,7 @@ CppRefactoringFileConstPtr CppRefactoringChanges::fileNoEditor(const QString &fi { QTextDocument *document = 0; if (data()->m_workingCopy.contains(fileName)) - document = new QTextDocument(data()->m_workingCopy.source(fileName)); + document = new QTextDocument(QString::fromUtf8(data()->m_workingCopy.source(fileName))); CppRefactoringFilePtr result(new CppRefactoringFile(document, fileName)); result->m_data = m_data; @@ -144,7 +144,7 @@ Document::Ptr CppRefactoringFile::cppDocument() const { if (!m_cppDocument || !m_cppDocument->translationUnit() || !m_cppDocument->translationUnit()->ast()) { - const QString source = document()->toPlainText(); + const QByteArray source = document()->toPlainText().toUtf8(); const QString name = fileName(); const Snapshot &snapshot = data()->m_snapshot; -- cgit v1.2.1