Make Converter::saveFile() consistently error on unexpected options

Have the text dumper do the same as all the others, instead of
ignoring unknown options.

Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: I3c1dcbeda19e679be562110e44c5f566dfcc79ce
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit b80be2a68446d52ef5d255c002d0c5a60fb5c03a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Edward Welbourne 2023-10-19 15:57:11 +02:00 committed by Qt Cherry-pick Bot
parent 8a4fd01bf3
commit 41675da88e

View File

@ -80,7 +80,10 @@ QVariant DebugTextDumper::loadFile(QIODevice *f, const Converter *&outputConvert
void DebugTextDumper::saveFile(QIODevice *f, const QVariant &contents,
const QStringList &options) const
{
Q_UNUSED(options);
if (!options.isEmpty()) {
qFatal("Unknown option '%s' to debug text output. This format has no options.",
qPrintable(options.first()));
}
QString s = dumpVariant(contents);
s[s.size() - 1] = u'\n'; // replace the comma with newline