From b80be2a68446d52ef5d255c002d0c5a60fb5c03a 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.6 6.5 Task-number: QTBUG-111228 Change-Id: I3c1dcbeda19e679be562110e44c5f566dfcc79ce Reviewed-by: Ivan Solovev --- 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 16f974a719..2415e32f44 100644 --- a/examples/corelib/serialization/convert/debugtextdumper.cpp +++ b/examples/corelib/serialization/convert/debugtextdumper.cpp @@ -81,7 +81,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