Commit 501a0bce authored by Nikolai Kosjar's avatar Nikolai Kosjar

Utils: Remove superseded readFileUTF8 overload

Superseded by the version added in commit c1225ea3.

Change-Id: I7cd8186b613b31e235d045f28e2b0f339784b59e
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent deb43b4c
......@@ -271,39 +271,6 @@ TextFileFormat::ReadResult
return result;
}
TextFileFormat::ReadResult TextFileFormat::readFileUTF8(const QString &fileName,
QByteArray *plainText, QString *errorString)
{
QByteArray data;
try {
Utils::FileReader reader;
if (!reader.fetch(fileName, errorString))
return TextFileFormat::ReadIOError;
data = reader.data();
} catch (const std::bad_alloc &) {
*errorString = QCoreApplication::translate("Utils::TextFileFormat", "Out of memory.");
return TextFileFormat::ReadMemoryAllocationError;
}
TextFileFormat format = TextFileFormat::detect(data);
if (!format.codec)
format.codec = QTextCodec::codecForLocale();
if (format.codec->name() == "UTF-8") {
if (format.hasUtf8Bom)
data.remove(0, 3);
*plainText = data;
return TextFileFormat::ReadSuccess;
}
QString target;
if (!format.decode(data, &target)) {
*errorString = QCoreApplication::translate("Utils::TextFileFormat", "An encoding error was encountered.");
return TextFileFormat::ReadEncodingError;
}
*plainText = target.toUtf8();
return TextFileFormat::ReadSuccess;
}
TextFileFormat::ReadResult TextFileFormat::readFileUTF8(const QString &fileName,
const QTextCodec *defaultCodec,
QByteArray *plainText, QString *errorString)
......
......@@ -76,8 +76,6 @@ public:
static ReadResult readFile(const QString &fileName, const QTextCodec *defaultCodec,
QString *plainText, TextFileFormat *format, QString *errorString,
QByteArray *decodingErrorSample = 0);
static ReadResult readFileUTF8(const QString &fileName, QByteArray *plainText,
QString *errorString); // TODO: Remove this version.
static ReadResult readFileUTF8(const QString &fileName, const QTextCodec *defaultCodec,
QByteArray *plainText, QString *errorString);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment