summaryrefslogtreecommitdiffstats
path: root/src/corelib/mimetypes
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* | Merge remote-tracking branch 'origin/dev' into merge-devLeander Beernaert2020-01-247-14/+367
|\ \ | | | | | | | | | Change-Id: I31b761cfd5ea01373c60d02a5da8c33398d34739
| * | Merge remote-tracking branch 'origin/5.15' into devLiang Qi2020-01-047-11/+364
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qvector.h Make QVector(DataPointer dd) public to be able to properly merge 5b4b437b30b320e2cd7c9a566999a39772e5d431 from 5.15 into dev. src/widgets/kernel/qapplication.cpp tests/auto/tools/moc/allmocs_baseline_in.json Done-With: Christian Ehrlicher <ch.ehrlicher@gmx.de> Change-Id: I929ba7c036d570382d0454c2c75f6f0d96ddbc01
| | * MIME: Make the internal database direct content, not a Qt resourceThiago Macieira2019-12-107-11/+364
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This saves us from having to bootstrap rcc in regular (non-cross) compilations, as it can now link to QtCore. Actually un-bootstrapping rcc is left as an exercise for the reader. This commit discovered that MSVC cannot handle constexpr arrays bigger than 256 kB, at which point it simply starts claiming that the constant expressions using it are not constexpr. ICC has a similar problem at 64 kB, but it tells you why ("note: type "const unsigned char [65537]" too large for constant-expression evaluation"). Note also that this requires gzip or zstd to be in PATH for compression to happen. RCC linked to zlib, which is always present due to the bundled copy. gzip's presence is not likely to be a problem on Unix systems, but could be for Windows users, especially MSVC ones. If gzip is not present, QtCore's size will increase by about 1910 kB of read-only (sharable) data. Change-Id: I2b1955a995ad40f3b89afffd15a3e65a94670242 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| * | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2019-12-092-3/+3
| |\| | | | | | | | | | Change-Id: Ia24cc8b86def0d9d9c17d6775cc519e491b860b1
| | * Tidy nullptr usageAllan Sandfeld Jensen2019-12-062-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Fix qmimedatabase testsLeander Beernaert2020-01-101-1/+1
| | | | | | | | | | | | | | | | | | Change-Id: I89fbd0d277746b594199a6c1992f35a789b90049 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Regenerate src/*Alexandru Croitor2019-11-141-1/+1
| | | | | | | | | | | | | | | | | | Change-Id: I0314b4faa1e4860e86198eea4189987e527dfec2 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Merge remote-tracking branch 'origin/dev' into wip/cmakeAlexandru Croitor2019-10-141-2/+2
|\| | | | | | | | | | | Change-Id: I4a78428a8ea273b6960792e3b8043f816fa37fcf
| * | Use same condition for QT_USE_MMAP as in qresource.cppTobias Hunger2019-10-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Consistently use the same condition to decide whether or not to set QT_USE_MMAP. Change-Id: Ica83d40c8051a8957d875334b821037b25fa8677 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Add special case handling for corelib mimetypes resourcesLeander Beernaert2019-07-181-0/+21
|/ / | | | | | | | | | | | | | | | | | | | | | | | | We have to treat the resources from mimetypes in corelibs specially as they are reused for two test cases. Since we no longer use the qrc files, we have wrapped the relevant code in a function that can be called for every target that depends on it. This change also corrects formatting for the generate CMake code regarding resource commands. Change-Id: I50a05c81151d75aefc9ca165f5ffeb9f5cd77162 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/dev' into wip/qt6Simon Hausmann2019-06-262-12/+16
|\| | | | | | | Change-Id: I4ea2b77cc201daed94fbe321f146dfd20365a534
| * QMimeType: towards re-entrancy: do not cache iconName made from mimetype nameMarc Mutz2019-06-161-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | To not write into a shared object without mutex protection. If the stored icon name is empty, just calculate a new one on each call. Task-number: QTBUG-45684 Change-Id: I01dfb6697b5275e69451da91fdc7346f40bc424e Reviewed-by: David Faure <david.faure@kdab.com>
| * QMimeType: make deep const breakages explicitMarc Mutz2019-06-161-9/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | QExplicitlySharedDataPointer is propagating const in my tree, and I will be proposing this for inclusion into Qt 6, so proactively fix the breakage here. QMimeType is known to be non-reentrant (QTBUG-45684), and this patch doesn't fix it. Change-Id: If68b148c44439d76ab1d95e8db93b90d12650e51 Reviewed-by: David Faure <david.faure@kdab.com>
| * Remove a few usages of deprecated APIShawn Rutledge2019-06-131-1/+1
| | | | | | | | | | | | Change-Id: I94bad0b8d3891c6b4a55178836cfff2a4312e330 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/dev' into wip/qt6Alexandru Croitor2019-06-062-1/+7
|\| | | | | | | Change-Id: Iac12a37fa6536ebe30e6548f7c54ec0c402c9f5d
| * QtCore: use qUtf16Printable and %ls, qErrnoWarning()Marc Mutz2019-05-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | ... instead of qPrintable(), %s, and explicit qt_error_string(). Saves 2KiB in text size on optimized Linux AMD64 GCC 9.1 builds. Change-Id: I98b6717da1ed1b678f01167d704a96f10da47966 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Fix corelib build without feature.regularexpressionTasuku Suzuki2019-05-221-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I208d6cb7f57a74873fae3a36fe094a92d287c2f0 Reviewed-by: David Faure <david.faure@kdab.com>
* | Bump version to Qt 6Lars Knoll2019-05-141-0/+1
|/ | | | | | | | | | | | | | | | | | Needed to disable QT_NO_UNSHARABLE_CONTAINERS, as this triggers asserts. QMetaType also has some Qt 6 specific code disabled to get things to compile. Fix various details in autotests to accommodate for the changes with Qt 6. Add a workaround for black lists on macos, where QSysInfo::productType() now returns 'macos' and not 'osx' anymore. Change-Id: Ie26afb12a2aac36521472715934a7e34639ea4d0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove handling of missing Q_COMPILER_RVALUE_REFSAllan Sandfeld Jensen2019-05-011-19/+0
| | | | | | | | Remove remaining handling of missing support for rvalue refs. Change-Id: I78bab8bccfeeb9c76f464f345874364a37e4840a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove handling of missing Q_COMPILER_RVALUE_REFSAllan Sandfeld Jensen2019-04-082-4/+0
| | | | | Change-Id: I7bc6c455fbae4cdad584c76773299a6d8cd40c82 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace Q_DECL_NOEXCEPT with noexcept in corelibAllan Sandfeld Jensen2019-04-035-8/+8
| | | | | | | In preparation of Qt6 move away from pre-C++11 macros. Change-Id: I44126693c20c18eca5620caab4f7e746218e0ce3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.13' into devLiang Qi2019-03-312-1/+3
|\ | | | | | | | | | | | | Conflicts: src/corelib/configure.json Change-Id: I93ac67f3bf4844bc7c691183e94bceb922b7b919
| * QMimeDatabase: allow building without our internal copyThiago Macieira2019-03-262-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Saves 234kB of read-only data (when compressed with zstd) in QtCore, plus one load-time execution. With Zlib, the size was 315 kB. [ChangeLog][QtCore][QMimeDatabase] Added configure option -no-mimetype-database that tells Qt not to bundle its own copy of the XDG MIME database. If this option is passed, QMimeDatabase will only work if there's a system copy in $XDG_DATA_DIRS/mime. This option is useful for Linux distributions that ensure the data is always present. Change-Id: I1004b4b819774c4c9296fffd158e69c490e88fb6 Reviewed-by: David Faure <david.faure@kdab.com>
* | Fix warnings when compiling with QT_NO_XMLSTREAMJędrzej Nowacki2019-03-042-1/+3
|/ | | | | | | | Some of function arguments were unused. Change-Id: I29e8e4acbed87836044cac4f0b7ac59168181f5a Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QMimeGlobPattern: update use of wildcardToRegularExpresionSamuel Gaist2019-01-261-1/+1
| | | | | | | | | | | Following the update of qtbase because of QTBUG-72539, the code using wildcardToRegularExpression must be updated as anchoredPattern is not needed anymore. Task-number: QTBUG-72539 Change-Id: I4989b42c737eb17d65c6b1d3cefab3ffd2163bfc Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use QRegularExpression instead of QRegExpLars Knoll2018-12-141-3/+3
| | | | | Change-Id: I14abbf81a9d0fb72f75417da06b6456b8f1a20a2 Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
* Use Q_DISABLE_COPY_MOVE for private classesFriedemann Kleint2018-12-122-2/+2
| | | | | Change-Id: I3cfcfba892ff4a0ab4e31f308620b445162bb17b Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* RCC: introduce compression algorithm "best"Thiago Macieira2018-12-111-1/+1
| | | | | | | | | | | | | | | | | | | This compression algorithm is permitted in the XML sources, which instructs RCC to apply the best compression algorithm it has available. If we have Zstandard available, that's its level 19 (levels 20 and up are experimental). If not, we apply zlib compression level 9. And apply this technique for the XDG MIME database that is built-in to QtCore. Payload size Compr. time Previously 313916 17.9ms Zlib -9 310899 53.6ms Zstd -14 253364 63.3ms (plus 4.0 ms on L1 heuristic check) Zstd -19 230647 642.5ms Change-Id: I343f2beed55440a7ac0bfffd1562de44dbaf09cd Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add a few qAsConst() to range-for to prevent detachmentsSergio Martins2018-12-101-2/+2
| | | | | | | | | | | places indicated by clazy As a drive-by, fixed minor styling issues in the affected lines. Change-Id: I88d3fc0c8573cde0e61f19a18dd9ea697ee40c34 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Luca Beldi <v.ronin@yahoo.it> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QMimeDatabasePrivate: Match shared-mime-info behavior betterAlbert Astals Cid2018-11-131-1/+1
| | | | | | | | | | | | * Take into account alias when resolving inheritance FAIL! : tst_QMimeDatabase::findByFile(sqlite3.kexi) Compared values are not the same Actual (resultMimeTypeName.toLower()): "application/vnd.sqlite3" Expected (mimeTypeName.toLower()) : "application/x-kexiproject-sqlite3" Loc: [/home/tsdgeos/qt/qtbase_dev/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/../tst_qmimedatabase.cpp(841)] Change-Id: Ie5b095669979efef0b1de4175723190ea1f4d5a0 Reviewed-by: David Faure <david.faure@kdab.com>
* QMimeDatabase: update freedesktop.org.xml to shared-mime-info 1.10Albert Astals Cid2018-11-131-1465/+2952
| | | | | | | | Including https://gitlab.freedesktop.org/xdg/shared-mime-info/commit/4f7ad5ec448d38137ddc4de5624215ba0f8ebfa9 to make appimage not ambiguous Change-Id: I8db13fc785b267c09667ef38430bf98135c7f0d6 Reviewed-by: David Faure <david.faure@kdab.com>
* Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-11-063-3/+4
|\ | | | | | | Change-Id: Id1e4664d3c942226b76e2c3b338df3116ff89297