diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2022-08-24 09:30:08 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2022-08-29 13:20:35 +0200 |
commit | ef8cd39b28779bab692225abc1cde1522fc9a176 (patch) | |
tree | 309773fd823dd9c46dfe49f80ede47558eb527f1 /tools | |
parent | cc89f62851ce1b9f859e9bc43415d4ce7e3a36e2 (diff) |
qmltyperegistrar: Fix file inclusion and writing to stdout
Apparently if you write #include into a raw string literal, the file is
included right there, as part of the string. We don't want this.
Therefore, write the #include as regular string.
Furthermore, drop some dead code, and make sure we actually write to
stdout if no -o option is given.
Amends commit dbe42f643532ef8f639fb063f4a99d92e0f6f732.
Change-Id: Ia4074dd486bdf9430acec4ac2564f9e654b5e3a8
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qmltyperegistrar/qmltyperegistrar.cpp | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/tools/qmltyperegistrar/qmltyperegistrar.cpp b/tools/qmltyperegistrar/qmltyperegistrar.cpp index 324b0a960c..f590af9a62 100644 --- a/tools/qmltyperegistrar/qmltyperegistrar.cpp +++ b/tools/qmltyperegistrar/qmltyperegistrar.cpp @@ -12,15 +12,6 @@ using namespace Qt::Literals; -struct ScopedPointerFileCloser -{ - static inline void cleanup(FILE *handle) - { - if (handle) - fclose(handle); - } -}; - int main(int argc, char **argv) { // Produce reliably the same output for the same input by disabling QHash's random seeding. @@ -146,8 +137,6 @@ int main(int argc, char **argv) parser.isSet(followForeignVersioningOption)); typeRegistrar.setTypes(processor.types(), processor.foreignTypes()); - QScopedPointer<FILE, ScopedPointerFileCloser> outputFile; - if (parser.isSet(outputOption)) { // extract does its own file handling QString outputName = parser.value(outputOption); @@ -159,7 +148,7 @@ int main(int argc, char **argv) QTextStream output(&file); typeRegistrar.write(output); } else { - QTextStream output(stdin); + QTextStream output(stdout); typeRegistrar.write(output); } |