summaryrefslogtreecommitdiffstats
path: root/src/corelib/mimetypes
Commit message (Collapse)AuthorAgeFilesLines
...
* MimeDatabase::mimeTypeForFileNameAndData: Do not open file unnecessarilyEike Ziller2022-02-231-4/+4
| | | | | | | | | | If the file extension already matches uniquely, we do not need to do any actual file operation. Pick-to: 6.3 Change-Id: Ide8b82eefbcd13348b78b28b66230a91e1e3c5d8 Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtCore: includemocsMarc Mutz2022-01-271-0/+2
| | | | | | | | | | | | | | | This leaves moc_qnamespace.cpp in mocs_compilation.cpp. Including moc files directly into their classes' TU tends to improve codegen and enables extended compiler warnings, e.g. about unused private functions or fields. Pick-to: 6.3 6.2 5.15 Change-Id: Ifdff378c74828e12ec770cb2f453dab3a880e2a5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QtCore: replace qSwap with std::swap/member-swap where possibleMarc Mutz2022-01-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qSwap() is a monster that looks for ADL overloads of swap() and also detects the noexcept of the wrapped swap() function, so it should only be used when the argument type is unknown. In the vast majority of cases, the type is known to be efficiently std::swap()able or to have a member-swap. Call either of these. For the common case of pointer types, circumvent the expensive trait checks on std::swap() by providing a hand-rolled qt_ptr_swap() template, the advantage being that it can be unconditionally noexcept, removing all type traits instantiations. Don't document it, otherwise we'd be unable to pick it to 6.2. Effects on Clang -ftime-trace of a PCH'ed libQt6Gui.so build: before: **** Template sets that took longest to instantiate: [...] 27766 ms: qSwap<$> (9073 times, avg 3 ms) [...] 2806 ms: std::swap<$> (1229 times, avg 2 ms) (30572ms) after: **** Template sets that took longest to instantiate: [...] 5047 ms: qSwap<$> (641 times, avg 7 ms) [...] 3371 ms: std::swap<$> (1376 times, avg 2 ms) [qt_ptr_swap<$> does not appear in the top 400, so < 905ms] (< 9323ms) As a drive-by, remove superfluous inline keywords and template ornaments. Task-number: QTBUG-97601 Pick-to: 6.3 6.2 Change-Id: I88f9b4e3cbece268c4a1238b6d50e5712a1bab5a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Remove unused .qrc filesJoerg Bornemann2022-01-171-5/+0
| | | | | | | | Task-number: QTBUG-94446 Change-Id: I136d8b4ab070a832866aa50b5701fc6bd863df8a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix pattern type matchingJarek Kobus2021-12-281-4/+4
| | | | | | | | | Amends 3c747aafa44ac2d0b314a002d2672227bf6513e5 Pick-to: 6.3 6.2 5.15 Change-Id: I2753b627c269cbb50009ef5e9c2ffa274e0ccf5c Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Alex Richardson <arichardson.kde@gmail.com>
* QMimeDatabasePrivate: deduplicate QStandardPaths usesIgor Kushnir2021-12-211-2/+7
| | | | | Change-Id: I81dc76ddcf2aaa8aa6fdca504384ed72ad27f344 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMimeDatabasePrivate: deduplicate QStringLiteralIgor Kushnir2021-12-212-13/+23
| | | | | | | | | | | | | | | | | | | | defaultMimeType() cannot be moved out of the class and defined in qmimedatabase.cpp, because it is called from QMimeType::isDefault() in qmimetype.cpp. Return m_defaultMimeType constant by reference rather than by value from the inline helper function. This eliminates useless copying of QString when calling code needs only a reference, and so improves performance. Even though m_defaultMimeType is initialized with a QStringLiteral and its QArrayDataPointer has d == nullptr, QArrayDataPointer's ref() and deref() still have to compare d with nullptr to decide that no reference count manipulation is needed. Compilers might be unable to reorder these checks with surrounding code because they guard reference count manipulation. Branch misprediction could further harm performance. Optimizing these checks out can be difficult for compilers. Change-Id: I3ffa0fdc5ad948452301dd9688073b5323a7983b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMimeDatabasePrivate: construct QString from QStringLiteralIgor Kushnir2021-12-211-16/+16
| | | | | | | | | In the changed code no QLatin1String overloads exist, so replacing QLatin1String with QStringLiteral improves performance by eliminating allocations. Change-Id: I77530fe72c309b0609f40b1dc34189bd3454c813 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QMimeDatabasePrivate: pass QLatin1String to QStringBuilderIgor Kushnir2021-12-211-2/+2
| | | | | | | | This should be more efficient than passing QStringLiteral. Change-Id: Ia96633c9db6cb287dd9c196e739047b8a46abb4d Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMimeDatabasePrivate: remove Release-only fallbackIgor Kushnir2021-12-211-4/+3
| | | | | | | | | | When mimeTypeForFile()'s `mode` argument equals none of MatchMode enumerators, an assertion fails or the default MIME type's name is returned if assertions are disabled. Simplify and optimize this code by assuming MatchDefault in the unsupported-mode case. Change-Id: Iada36e0c96c378aefaa3a9d4a170222f764e94b6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMimeDatabasePrivate: remove unused output parameterIgor Kushnir2021-12-212-15/+6
| | | | | | | | | mimeTypeForFileNameAndData()'s output parameter int *priorityPtr (named differently "accuracyPtr" in the definition) is never used by its callers. Remove it to shorten the code and slightly improve performance. Change-Id: Ibc3d169501e89584b4318074ccb780580dc70fb6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMimeDatabasePrivate: remove duplicate file-opening codeIgor Kushnir2021-12-211-5/+1
| | | | | | | | | Don't open the file in mimeTypeForFile(), because mimeTypeForData() opens a closed device in the same ReadOnly mode. mimeTypeForData() also returns mimeTypeForName(defaultMimeType()) when the opening fails. Change-Id: If0b03e2bef3c1b1a2093157e005373adc4e289ed Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMimeDatabasePrivate: remove pessimizing const qualifierIgor Kushnir2021-12-211-1/+1
| | | | | | | | mimeTypeForData() returns its local `QMimeType result` variable by value. Make this variable mutable to allow moving from it. Change-Id: Ic76e8382a5cacecc02e834a55f1ea86593c60674 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMimeDatabasePrivate: remove duplicate else-if branchIgor Kushnir2021-12-211-5/+2
| | | | | | | | | In mimeTypeForFileExtension(), the `else if (matchCount == 1)` branch differs from the `else` branch only in a comment. Remove the branch with duplicate code, adjust the comment and simplify the `if` condition. Change-Id: Ib97a057880373ab3ab9b585e688b38fe1f542ba2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMimeDatabase::mimeTypeForFile: don't create QFileInfo on UNIXIgor Kushnir2021-12-202-68/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When mode != MatchExtension is passed to QMimeDatabase::mimeTypeForFile(const QString &fileName, MatchMode mode) const a QFileInfo object is always created and used to check QFileInfo::isDir(). Replace this expensive approach with a very cheap (bitmask) S_ISDIR check under Q_OS_UNIX. QT_STAT is already called for other reasons, so we just reuse its result in the S_ISDIR check. Extract almost all code from QMimeDatabase::mimeTypeForFile(const QString &, MatchMode) const; QMimeDatabase::mimeTypeForData(QIODevice *) const; QMimeDatabase::mimeTypeForFile(const QFileInfo &, MatchMode) const into QMimeDatabasePrivate::mimeTypeForFileExtension(const QString &); QMimeDatabasePrivate::mimeTypeForData(QIODevice *); QMimeDatabasePrivate::mimeTypeForFile(const QString &, const QFileInfo *, QMimeDatabase::MatchMode) respectively. This refactoring is a less convoluted and more efficient alternative to adding more mutex-unlocking hacks. The existing QMutexLocker::unlock() calls are thereby eliminated. The following table contains the average results of the benchmark tst_QMimeDatabase::benchMimeTypeForFile() on my GNU/Linux system before and at this commit. The numbers denote milliseconds per iteration. This commit does not measurably affect performance when mode == MatchExtension, therefore the MatchExtension section contains a single column with results common to both commits (it is interesting to compare benchmark results across match modes). data row tag before at MatchDefault: archive 0.012 0.010 OpenDocument Text 0.012 0.010 existent archive with extension 0.022 0.018 existent C with extension 0.016 0.012 existent text file with extension 0.017 0.012 existent C w/o extension 0.072 0.067 existent patch w/o extension 0.10 0.10 existent archive w/o extension 0.064 0.060 MatchExtension: archive 0.0081 OpenDocument Text 0.0076 existent archive with extension 0.012 existent C with extension 0.0075 existent text file with extension 0.0076 existent C w/o extension 0.0122 existent patch w/o extension 0.0091 existent archive w/o extension 0.0091 MatchContent: archive 0.0098 0.0078 OpenDocument Text 0.0098 0.0078 existent archive with extension 0.051 0.047 existent C with extension 0.051 0.047 existent text file with extension 0.053 0.049 existent C w/o extension 0.058 0.054 existent patch w/o extension 0.099 0.095 existent archive w/o extension 0.054 0.050 Change-Id: I01b37c9645f0d8d35fd1a6ea1c7a99be2faeeb73 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: David Faure <david.faure@kdab.com>
* Optimize QMimeDatabase::mimeTypeForFile(f, MatchDefault)Igor Kushnir2021-12-061-52/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Open the file only if matching on content is needed. Use QFileInfo::filePath() instead of QFileInfo::absoluteFilePath() in QMimeDatabase::mimeTypeForFile(). filePath() does much less work, and so is faster. Thiago Macieira helpfully explained in a review comment why the absolute path is not useful for correctness here: "Nothing needs absolute paths within the same application that would resolve the relative path to absolute. You only need an absolute path if you're communicating with another application that may be in a different directory." QMimeDatabase::mimeTypeForFile() checks fileInfo.isDir(), so the fileName.endsWith(QLatin1Char('/')) check in QMimeDatabasePrivate::mimeTypeForFileNameAndData() was redundant when called from this function. The other two callers of that function now check this condition before opening IO devices. This improves performance of the two QMimeDatabase::mimeTypeForFileNameAndData() overloads in the corner case. Refactor and optimize QMimeDatabasePrivate::findByFileName() and its usages. Previously each caller constructed a QFileInfo object and passed QFileInfo::fileName() into this function. Now the callers simply pass an absolute or relative path to a file into this function, which then uses QFileSystemEntry::fileName() to exclude the path. Constructing QFileInfo is relatively expensive, so this change slightly improves performance. Optimize QMimeDatabasePrivate::loadProviders() by calling static QFileInfo::exists() instead of constructing a QFileInfo object and calling the non-static QFileInfo::exists() overload. Note that the QFileInfo object was always created, even if QFileInfo::exists() under an `if` and an `#if` was never called. The following table contains the average results of the added benchmark tst_QMimeDatabase::benchMimeTypeForFile() on my GNU/Linux system before and at this commit. The numbers denote milliseconds per iteration. data row tag before at MatchDefault: archive 0.029 0.016 OpenDocument Text 0.029 0.015 existent archive with extension 0.039 0.025 existent C with extension 0.033 0.020 existent text file with extension 0.033 0.020 existent C w/o extension 0.076 0.074 existent patch w/o extension 0.11 0.105 existent archive w/o extension 0.069 0.066 MatchExtension: archive 0.012 0.0115 OpenDocument Text 0.0115 0.011 existent archive with extension 0.017 0.016 existent C with extension 0.011 0.011 existent text file with extension 0.011 0.011 existent C w/o extension 0.016 0.0155 existent patch w/o extension 0.013 0.012 existent archive w/o extension 0.013 0.012 MatchContent: archive 0.019 0.012 OpenDocument Text 0.019 0.012 existent archive with extension 0.053 0.051 existent C with extension 0.056 0.0545 existent text file with extension 0.058 0.056 existent C w/o extension 0.0605 0.059 existent patch w/o extension 0.10 0.099 existent archive w/o extension 0.057 0.054 Change-Id: Idb541656e073a2c4822ace3f4da412f29f2351f8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: David Faure <david.faure@kdab.com>
* Fix internal mimetypes db on Windows when compressed by an external toolHannah von Reth2021-11-091-0/+1
| | | | | | | | | Ensure to use binary encoding when handling the output of the compression tool. With out this change \r are dropped and the compressed file is corrupted. Change-Id: Iaf9b1fc015a376682f793aff079f45d03b201aec Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Optimize mime type matchingJarek Kobus2021-10-143-36/+92
| | | | | | | | | | | | | | | | | | Don't count "*", don't search for "[" and for "?" inside m_pattern on every call to matchFileName(). Do it once, when constructing the MimeGlobPattern. Fix matching the pattern for names without any wildcard: index of question mark should be -1, not just different from 0. This shortens loading a Qt6 project in Creator by about 500 ms. Pick-to: 6.2 5.15 Change-Id: Ifa40c2cec4aba07a0312ef36877e571a8c8fb151 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Faure <david.faure@kdab.com>
* corelib: Fix typos in source code commentsJonas Kvinge2021-10-121-1/+1
| | | | | | Pick-to: 6.2 Change-Id: Ic78afb67143112468c6f84677ac88f27a74b53aa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QMimeBinaryProvider: cache comments and globPatternsAlexander Volkov2021-06-173-54/+62
| | | | | | | | Avoid multiple re-reads of xml files, for example in dolphin, which displays MIME type comments as file types. Change-Id: Ia124930e2a1fdc99d8a4d160f2288a00f55e0e8e Reviewed-by: David Faure <david.faure@kdab.com>
* Canonical type conversionHou Lei2021-03-021-1/+1
| | | | | | | Avoid C-style casts when possible. Change-Id: I623d7bc62bd0e48a5e0493c892d6ad9b11b0ca0c Reviewed-by: David Faure <david.faure@kdab.com>
* QMimeDatabase/xml: support both 'xmlstarlet' and 'xml' for minifying XMLKai Köhne2021-01-251-0/+4
| | | | | | | | | | | | | Commit 370324f6e2f3 changed the call to 'xml' to 'xmlstarlet' because some Linux distributions do not provide a binary called xml. Anyhow, the official Windows packages of xmlstarlet only provide 'xml.exe'. Therefore just check for both. Pick-to: 5.15 6.0 Change-Id: I4381b256850e4101b760df21f2b0baffb4414620 Reviewed-by: Eric Lemanissier <eric.lemanissier@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove the qmake project filesJoerg Bornemann2021-01-071-55/+0
| | | | | | | | | | | | | | | | Remove the qmake project files for most of Qt. Leave the qmake project files for examples, because we still test those in the CI to ensure qmake does not regress. Also leave the qmake project files for utils and other minor parts that lack CMake project files. Task-number: QTBUG-88742 Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Update shared-mime-info to the 2.1 release, adjust implementationDavid Faure2021-01-054-7050/+8878
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The spec hasn't changed, but I made the same mistake in xdgmime (the reference implementation) and in Qt: when multiple globs match, and the result from magic sniffing is unrelated to any of those globs, then I used the magic result, but that's wrong, globs have priority and one of them should be picked up. This is now fixed in xdgmime (https://gitlab.freedesktop.org/xdg/xdgmime/-/merge_requests/3) and in the expected results in shared-mime-info (https://gitlab.freedesktop.org/xdg/shared-mime-info/-/merge_requests/99) which this commit is also tested against. This change also optimizes QMimeBinaryProvider::addFileNameMatches to have the same logic as xdgmime for glob matching: literals > extensions > other globs As soon as one category matches, we can stop there. This makes no difference in the overall results, in practice. The user bug report (against the Qt implementation, actually) is https://gitlab.freedesktop.org/xdg/shared-mime-info/-/issues/138 as well as https://bugs.kde.org/show_bug.cgi?id=411718 Pick-to: 6.0 5.15 Change-Id: Ia0a34080427daff43c732609443ee6df8f41447c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use (new) erase()/erase_if() algorithmsMarc Mutz2020-12-051-1/+1
| | | | | Change-Id: I45c18fd45c20b226e44d16315e3ebb6c305d4ab0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix compilation when using -no-mimetype-databaseHelio Chissini de Castro2020-10-211-0/+4
| | | | | | Change-Id: I4f706a26d73f61e4a6022338e0fc0be48627e4a1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: David Faure <david.faure@kdab.com>
* Whitespace cleanup in corelib/ mimetypes, plugin and threadAllan Sandfeld Jensen2020-10-211-2/+3
| | | | | | | Done with selective application of clang-format Change-Id: Iee6bf2426de81356b6d480629ba972f980b6d93d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Centralize the implementation of move assignment operatorsGiuseppe D'Angelo2020-10-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment we have two main strategies for dealing with move assignment in Qt: 1) move-and-swap, used by "containers" (in the broad sense): containers, but also smart pointers and similar classes that can hold user-defined types; 2) pure swap, used by containers that hold only memory (e.g. QString, QByteArray, ...) as well as most implicitly shared datatypes. Given the fact that a move assignment operator's code is just boilerplate (whether it's move-and-swap or pure swap), provide two _strictly internal_ macros to help write them, and apply the macros across corelib and gui, porting away from the hand-rolled implementations. The rule of thumb when porting to the new macros is: * Try to stick to the existing code behavior, unless broken * if changing, then follow this checklist: * if the class does not have a move constructor => pure swap (but consider ADDING a move constructor, if possible!) * if the class does have a move constructor, try to follow the criteria above, namely: * if the class holds only memory, pure swap; * if the class may hold anything else but memory (file handles, etc.), then move and swap. Noteworthy details: * some operators planned to be removed in Qt 6 were not ported; * as drive-by, some move constructors were simplified to be using qExchange(); others were outright broken and got fixed; * some contained some more interesting code and were not touched. Change-Id: Idaab3489247dcbabb6df3fa1e5286b69e1d372e9 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-09-231-1/+1
| | | | | | | | | | | Modify special case locations to use the new API as well. Clean up some stale .prev files that are not needed anymore. Clean up some project files that are not used anymore. Task-number: QTBUG-86815 Change-Id: I9947da921f98686023c6bb053dfcc101851276b5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QMimeDatabase: fix handling of glob-deleteallDavid Faure2020-09-224-17/+26
| | | | | | | | | | | | | | | | Binary provider: It was not possible to remove the first glob in a local override, because the mainPattern handling would re-add the first glob back. XML provider: It didn't support glob-deleteall. Also, the order of the providers was wrong. We want to pick local overrides first, the internal DB has to go last in the list. Fixes: QTBUG-85436 Pick-to: 5.15 Change-Id: I9a4523f37cd962c730df9a6ed992bd01c075bf03 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMimeDatabase: fix performance regression when using the internal XMLDavid Faure2020-09-183-3/+26
| | | | | | | | | That XML was parsed over and over again, because the QMimeXMLProvider was re-created instead of re-used. Pick-to: 5.15 Change-Id: I07ff005d3f238afc1490b69a58cf4815e67d418c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Port the QXmlStream API from QStringRef to QStringViewKarsten Heimrich2020-08-193-11/+11
| | | | | | | | | | | | | | This gives some source incompatibilities, most of them can be handled by using auto instead of QStringRef explicitly. [ChangeLog][Important API changes] QXmlStream now uses QStringView insteead of QStringRef in it's API. Using auto forvariables returning a QStringRef in Qt 5 should lead to code that can be used against both Qt versions. Fixes: QTBUG-84317 Change-Id: I6df3a9507276f5d16d044a6bdbe0e4810cf99440 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* Use QList instead of QVector in corelibJarek Kobus2020-06-251-1/+1
| | | | | | | | | | Applied to headers only. Source file to be changed separately. Omitted statemachine for now to avoid conflicts. Omitted qmetatype.h for now - to be handled later. Task-number: QTBUG-84469 Change-Id: I317376037a62467c313467d92955ad0b7473aa97 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QMimeDatabase/zlib: fix build with z_const macro emptyThiago Macieira2020-06-231-1/+1
| | | | | | | | | | | The next_in pointer in z_stream is defined as "z_const Bytef *" but z_const is actually an empty macro in most builds. Since our data is read-only constexpr, we need this const_cast to compile. Fixes: QTBUG-84457 Pick-to: 5.15 Change-Id: Ied637aece2a7427b8a2dfffd1612a01ae46f7c1a Reviewed-by: David Faure <david.faure@kdab.com>
* Port Q_STATIC_ASSERT(_X) to static_assertGiuseppe D'Angelo2020-06-191-3/+3
| | | | | | | | | | | | | | | | | There is no reason for keep using our macro now that we have C++17. The macro itself is left in for the moment being, as well as its detection logic, because it's needed for C code (not everything supports C11 yet). A few more cleanups will arrive in the next few patches. Note that this is a mere search/replace; some places were using double braces to work around the presence of commas in a macro, no attempt has been done to fix those. tst_qglobal had just some minor changes to keep testing the macro. Change-Id: I1c1c397d9f3e63db3338842bf350c9069ea57639 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QMimeDatabase/zstd: use -T1 instead of --single-threadThiago Macieira2020-06-121-1/+1
| | | | | | | | | | | | Some older versions of the command-line tool don't have --single-thread but do have -T1. They're slightly different according to the documentation, but it's not important to us. What we want is to make sure we consume a single CPU during build. Fixes: QTBUG-84792 Pick-to: 5.15 Change-Id: Ied637aece2a7427b8a2dfffd16129fe88a0466ee Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Port mimetypes away from QStringRefLars Knoll2020-06-117-8/+8
| | | | | | Task-number: QTBUG-84319 Change-Id: I2bed1149df7f11495fd9dc3577828c0790b17dab Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* QMimeType::suffixForFileName shouldn't lowercase the file suffixDavid Faure2020-06-014-16/+27
| | | | | | | | | | | | | It was returning a lowercased suffix because it was extracting it from the pattern (*.txt) rather than from the filename ("README.TXT"). This broke expectations on the application side, since this method is documented to return a suffix from the given filename. Ref: https://bugs.kde.org/show_bug.cgi?id=402388 Change-Id: I7dae13db31280249d3f592fa9592c4067804e22d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QMimeDatabase/xml: use xmlstarlet instead of xmlEric Lemanissier2020-05-261-2/+2
| | | | | | | | some distributions (eg Ubuntu) don't provide xml executable, but only xmlstarlet executable Change-Id: Icc801ded8d4ec1ec4d1dab93289a2365f8cd9cbd Pick-to: 5.15 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add a QRegularExpression::fromWildcard() convenience methodLars Knoll2020-05-061-1/+1
| | | | | | | | | Simplify constructing QRegularExpression objects from a glob pattern. Change-Id: I06f60b1dfea3da969e2474dedd44b6ca5d456d7d Reviewed-by: Simon Hausmann <hausmann@gmail.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QMimeDatabase: remove unused QSet includeMarc Mutz2020-05-051-1/+0
| | | | | Change-Id: Id69ef8f09baf276cc0de8d8b9534cd370608531b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Don't use a QTextStream to read lines from a fileLars Knoll2020-05-021-5/+6
| | | | | | | | QFile::readLine() can do the same at a fraction of the cost of QTextStream. Change-Id: I8c542756bcbd893dfa76d03e76e3ce0810aa2871 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtCore: fix a few more char/int/uint -> QChar conversionsMarc Mutz2020-04-301-1/+1
| | | | | | | | They were masked by all QChar ctors being made explicit, except the char16_t one, which was left as the only viable choice. Change-Id: I5632795f3c7dd1de3830285d5446d9b994613466 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change qHash() to work with size_t instead of uintLars Knoll2020-04-092-3/+3
| | | | | | | | | | | This is required, so that QHash and QSet can hold more than 2^32 items on 64 bit platforms. The actual hashing functions for strings are still 32bit, this will be changed in a follow-up commit. Change-Id: I4372125252486075ff3a0b45ecfa818359fe103b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-03-111-2/+5
|\ | | | | | | Change-Id: Ibee5acec72a1a1769d4bc5f23f56c7dc8d4cf3cb
| * Mimetypes: Build fix for Android builds on WindowsCristian Adam2020-03-101-2/+5
| | | | | | | | | | | | | | | | | | | | | | Due to Android's multi-abi the build will fail due to concurrent access: cmd /c C:\Projects\Qt\repo\qtbase\src\corelib\mimetypes\mime\generate.bat C:\Projects\Qt\repo\qtbase\src\corelib\mimetypes\mime\packages\freedesktop.org.xml > .rcc\qmimeprovider_database.cpp The process cannot access the file because it is being used by another process. Change-Id: I647e0a6d8aa03cf116b08a1dce6e61e8882661f4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devLars Knoll2020-03-042-5/+10
|\| | | | | | | Change-Id: I99ee6f8b4bdc372437ee60d1feab931487fe55c4
| * QMimeXMLProvider: fix another issue with -no-mimetype-databaseThiago Macieira2020-03-032-5/+10
| | | | | | | | | | | | | | | | | | | | | | The compiler must emit the destructor for the members of a class in an inline constructor, in case the constructor throws. This won't work in Qt 5.15 due to QList requiring knowing whether QMimeMagicRuleMatcher is trivial or not. Another solution would be to use QVector. Fixes: QTBUG-82547 Change-Id: Ia8b65350cd5d49debca9fffd15f79db872ed7c0c Reviewed-by: David Faure <david.faure@kdab.com>
* | Merge remote-tracking branch 'origin/5.15' into devLars Knoll2020-02-281-1/+1
|\| | | | | | | Change-Id: I469b0501cc65fc5ce4d797a69ae89405cc69c7f8
| * QMimeXMLProvider: add missing semi-colon in the #else caseThiago Macieira2020-02-271-1/+1
| | | | | | | | | | | | Fixes: QTBUG-82547 Change-Id: Ia8b65350cd5d49debca9fffd15f74e22c0536805 Reviewed-by: David Faure <david.faure@kdab.com>