From 41675da88e507d03a36aa34b264818a6bba43391 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 19 Oct 2023 15:57:11 +0200 Subject: [PATCH] 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 (cherry picked from commit b80be2a68446d52ef5d255c002d0c5a60fb5c03a) Reviewed-by: Qt Cherry-pick Bot --- examples/corelib/serialization/convert/debugtextdumper.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/corelib/serialization/convert/debugtextdumper.cpp b/examples/corelib/serialization/convert/debugtextdumper.cpp index dfe3e5624a9..be0bbc66ee5 100644 --- a/examples/corelib/serialization/convert/debugtextdumper.cpp +++ b/examples/corelib/serialization/convert/debugtextdumper.cpp @@ -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