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.6 6.5
Task-number: QTBUG-111228
Change-Id: I3c1dcbeda19e679be562110e44c5f566dfcc79ce
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
Edward Welbourne 2023-10-19 15:57:11 +02:00
parent 4389b0c429
commit b80be2a684

View File

@ -81,7 +81,10 @@ QVariant DebugTextDumper::loadFile(QIODevice *f, const Converter *&outputConvert
void DebugTextDumper::saveFile(QIODevice *f, const QVariant &contents, void DebugTextDumper::saveFile(QIODevice *f, const QVariant &contents,
const QStringList &options) const 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); QString s = dumpVariant(contents);
s[s.size() - 1] = u'\n'; // replace the comma with newline s[s.size() - 1] = u'\n'; // replace the comma with newline