aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/messages.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-11-24 14:24:10 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-11-24 17:03:50 +0000
commitd5bc255aa50a9181a3258b17c07b8da0890cb035 (patch)
treefa23ebf8519acf8c3fb010fc3312148ef445f6e8 /sources/shiboken6/ApiExtractor/messages.cpp
parent0a00958b083008dea340ef78b0f235ca49b7d22c (diff)
shiboken6: Refactor writing out files
Write the buffer directly to the file instead of reopening the text stream on it (which has unclear encoding semantics). Add error handling on this occasion. Change-Id: Ifd478f96a73dbc21e441fed8b8e543f07b6fa00b Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken6/ApiExtractor/messages.cpp')
-rw-r--r--sources/shiboken6/ApiExtractor/messages.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/sources/shiboken6/ApiExtractor/messages.cpp b/sources/shiboken6/ApiExtractor/messages.cpp
index 2e72b95bc..d0fec85b6 100644
--- a/sources/shiboken6/ApiExtractor/messages.cpp
+++ b/sources/shiboken6/ApiExtractor/messages.cpp
@@ -540,6 +540,15 @@ QString msgCannotOpenForWriting(const QFile &f)
.arg(QDir::toNativeSeparators(f.fileName()), f.errorString());
}
+QString msgWriteFailed(const QFile &f, qsizetype size)
+{
+ QString result;
+ QTextStream(&result) << "Failed to write " << size << "bytes to '"
+ << QDir::toNativeSeparators(f.fileName()) << "': "
+ << f.errorString();
+ return result;
+}
+
// generator.cpp
QString msgCannotUseEnumAsInt(const QString &name)