summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qiodevice.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Containers: add max_size()Giuseppe D'Angelo2024-02-271-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One more method for STL compatibility. This one is particularly subtle as it's required by the `reservable-container` concept: https://eel.is/c++draft/ranges#range.utility.conv.general-3 Without this concept, ranges::to won't reserve() before copying the elements (out of a sized range which isn't a common_range). Implementation notes: there were already a couple of constants denoting the maximum QByteArray and QString size. Centralize that implementation in QTypedArrayData, so that QList can use it too. The maximum allocation size (private constant) needs a even more central place so that even QVLA can use it. Lacking anything better, I've put it in qcontainerfwd.h. Since our containers aren't allocator-aware, I can make max_size() a static member, and replace the existing constants throughout the rest of qtbase. (I can't kill them yet as they're used by other submodules.) [ChangeLog][QtCore][QList] Added max_size(). [ChangeLog][QtCore][QString] Added max_size(). [ChangeLog][QtCore][QByteArray] Added max_size(). [ChangeLog][QtCore][QVarLengthArray] Added max_size(). Change-Id: I176142e31b998f4f787c96333894b8f6653eb70d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QIODevice: mark checkWarnMessage() as Q_DECL_COLD_FUNCTIONMarc Mutz2023-10-191-0/+1
| | | | | | | | | | | | | | | | | It's only called in exceptional circumstances, so the compiler should optimize it for size, not speed, and paths leading up to calls to this functions should be automatically marked as [[unlikely]]. Marking the function as cold accomplishes both. GCC 11 seems to have had this figured out by itself, possibly backtracking from the unconditional qWarning() in the first line of the function, but it did have a (very small) effect on Clang 15, so leave it in, if only as documentation. Pick-to: 6.6 6.5 6.2 Change-Id: Ie8e9049300825a3aae2f9678a2907ceea0b21d1c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix some narrowing conversion warningsAhmad Samir2023-04-081-1/+1
| | | | | | | | | ioctl call for FIONREAD takes an int arg, it won't work correctly otherwise. Cast the return of the read() call to int, because it won't read more than buffSize (which is an int). Change-Id: I130202a732684257bbb0e79c9358b60a61010c46 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtMiscUtils: add isAsciiPrintable() helperAhmad Samir2023-03-181-7/+5
| | | | | | | | | | | | | | | | | | | | | | - isAsciiPrintable: borrowed the logic from isPrintable(uchar) in qdebug.cpp, now isPrintable(uchar) calls isAsciiPrintable - Replace ::isspace() with ascii_isspace() from qlocale_p.h Functions from ctype.h have a couple of issues: - they're locale-dependent, which isn't what's required here, the code is only interested in ASCII - their args should be representable as uchar or EOF otherwise it's undefined behavior An Early-Warning could use something like: grep -rP "\b(isalnum|isalpha|isblank|iscntrl|isdigit|islower|isgraph|\ "isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper)\b" Pick-to: 6.5 Task-number: QTBUG-111262 Change-Id: I1f47f41bd56735297078ff0d0ddc2ebf999abf8b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QIODevice: fix narrowing conversions in debugBinaryStringMarc Mutz2022-09-071-18/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The debugBinaryString() function is a hexedit-like pretty-printer which prints in increments of 16 octets, so it can go forever. The old code had an overload set (QByteArray) and (ptr, qint64 size), but made the (ptr, n) overload construct a QByteArray to call the QBA overload. That's a narrowing conversion right there, except it can't trigger because no machine can hold that much memory. But it may warn. The code inside went on with further narrowing conversions to int, this time, which does have an effect on 64-bit. Granted, you'd wait a long time for this inefficient pretty-printer to write out more than 16Mi lines of hex dump, but it's wrong nonetheless, because narrowing conversions work with modulo arithmetic and not saturation arithmetic, so passing a buffer of INT_MAX + 1 size would print nothing, which would probably cause some time lost hunting unrelated bugs. So, fix the whole thing as follows: - remove the QBA overload, it was never called - loop over the full range of up to LLONG_MAX characters; if developers pass too much data, that's SEP - remove the narrowing casts to qsizetype at the call sites (avoids modulo arithmetic) As a drive-by, make the function static, and to get compilers to actually see all this, make it [[maybe_unused]] instead of ifdef'ing out. Not picking back, as it's debug-only code. Task-number: QTBUG-103525 Change-Id: I8b06466365d8c57b14535d8752428a614f244297 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QtCore: Replace remaining uses of QLatin1String with QLatin1StringViewSona Kurazyan2022-03-261-1/+1
| | | | | | | Task-number: QTBUG-98434 Change-Id: Ib7c5fc0aaca6ef33b93c7486e99502c555bf20bc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QtCore: replace QLatin1String/QLatin1Char with _L1/u'' where applicableSona Kurazyan2022-03-251-8/+10
| | | | | | | | | | | As a drive-by, did also minor refactorings/improvements. Task-number: QTBUG-98434 Change-Id: I81964176ae2f07ea63674c96f47f9c6aa046854f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
* QIODevice::readAll: allow reading from a huge non-sequential devicesThiago Macieira2022-02-171-3/+4
| | | | | | | | | | | | | | | | | | | | | | On 32-bit systems, the non-sequential device could be pointing to a device of 2 GB or more in size. If so, we should allow reading up to the limit (2 GB - overhead), like we do for sequential devices in the block above. It could also happen on 64-bit systems, but the chance that you do have a file bigger than 8 EB is remote. [ChangeLog][QtCore][QIODevice] Changed readAll() handling of large non-sequential devices like files that are bigger than the maximum QByteArray size (on 32-bit systems, just under 2 GB). Previously, readAll() always returned empty; now it will attempt to read from the device. Task-number: QTBUG-100546 Pick-to: 6.3 Change-Id: I74249c52dc02478ba93cfffd16d1a14ac92c77bb Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QIODevice::read: don't truncate to int(readBytes)Thiago Macieira2022-02-161-8/+8
| | | | | | | | | | | QByteArray in Qt 6 *can* hold more than 2GB-overhead of data. Untestable. Fixes: QTBUG-100546 Pick-to: 6.2 6.3 Change-Id: I74249c52dc02478ba93cfffd16d1a0ab398efe9c Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Make QRingBuffer a move-only typeMarc Mutz2021-12-161-5/+9
| | | | | | | | | | | | There's no sense in copying a ring buffer. Moving is enough. This marks an important step on the way to preventing accidental copies of ring buffer content, because the 'QList buffers' member can now no longer be implicitly shared. While the compiler will still emit the code for detach()ing, it will now never be executed. Pick-to: 6.3 Change-Id: I968bfe3e50c46720ed4baca55c99c1f9c518f653 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* corelib: Fix typos in documentationJonas Kvinge2021-10-121-1/+1
| | | | | | Pick-to: 5.15 6.2 Change-Id: I64d63af708bc6ddaabd12450eb3089e5077f849e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QIODevice: allow subclasses to enforce unbuffered modeAlex Trotsenko2021-08-011-9/+16
| | | | | | | | | | | | | | | For subclasses that implement alternative buffering (such as QLocalSocket), it would be useful to bypass the QIODevice's internal buffer, even if the QIODeviceBase::Unbuffered flag is not set when opened. By setting the readBufferChunkSize member to 0 in their constructors, these classes now unconditionally switch the base class to unbuffered mode, while still reporting buffering with openMode() function. Change-Id: I351bc57ac0ccb45c81f8c6be15f1745131aa26ba Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QIODevice: rework validation policy for read() functionsAlex Trotsenko2021-08-011-57/+78
| | | | | | | | | | | - avoid calls to private and virtual functions, if the device is not open; - avoid repetitive checks in loops; - add missing checks in readLine() overloads; - remove check against unsuccessful resize(). Change-Id: I973d5931163b25db1c09c7c3b66f29ea90bb1b29 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QIODevice: fix converting OpenMode flag in debug outputAlex Trotsenko2021-07-311-3/+3
| | | | | | | | | | | | | Suppress error: src\corelib\io\qiodevice.cpp(791): error C2440: '<function-style-cast>': cannot convert from 'QIODeviceBase::OpenMode' to 'quint32' Pick-to: 6.1 6.2 Change-Id: I6b6e94790942d3af62bc2f38afad97c0b3c80817 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Clarify readLine() behavior on sequential devicesAlex Trotsenko2021-07-061-1/+6
| | | | | | | | | | QIODevice::readLine() can also return partial lines, which was not properly documented. Add an autotest for QLocalSocket to illustrate and test this behavior. Pick-to: 6.2 Change-Id: Ia2c1c438cc68d2672d34881e11fdf7837232f3b4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QLocalSocket/Win: avoid double buffering on writeAlex Trotsenko2021-06-091-3/+1
| | | | | | | | | As QWindowsPipeWriter now maintains a chunk queue, there is no need to use the internal QIODevice buffer and wait for the previous operation to complete. Change-Id: Id4d54edfe920aeb4a534980cb0cc85a56c067a70 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QIODevice: code tidiesGiuseppe D'Angelo2021-05-161-1/+1
| | | | | | | Turn an implicit conversion into a call to QFlags::testAnyFlag. Change-Id: Idbd80bb6a9b5d84952b76d8d7544f617fe693b91 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Documentation: Fix broken links to QIODeviceBase::OpenModeFriedemann Kleint2021-04-211-6/+6
| | | | | | | | | | Previously, QIODeviceBase was not visible in the documentation and the links from QIODevice::open() were broken. Fix by fully qualifying the arguments. Pick-to: 6.1 6.0 Change-Id: I43960ac2ff436251cc3bfad862d82f937b9bd4b1 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Fix various documentation issuesTopi Reinio2021-03-161-2/+10
| | | | | | | | | | - Document QIODeviceBase - Document QPointerEvent::points - Fix linking issues Task-number: QTBUG-90662 Change-Id: Ib123d5708953b22e01f95c82626b39a49fff95b2 Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
* Whitespace cleanup in corelib/iov6.0.0-beta2Allan Sandfeld Jensen2020-10-201-2/+2
| | | | | | | | | Selective application of clang-format to follow our coding style where it is significantly off. Change-Id: I0ff4ed146fe53922691d5473d0c236f31d478a04 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix allocated memory of QByteArray returned by QIODevice::readLineKai Koehne2020-10-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | If the maxSize argument is 0 (the default), QIODevice::readLine will allocate a QByteArray with the size of the next chunk of data, which may be quite large. Before returning, it then resizes the byte array to the actual size that was read. But since change 6b884d2aa129, QByteArray::resize() does no longer shrink the capacity. This means that the returned QByteArray keeps it's maximum size as allocated memory. This can lead to excessive memory consumption, especially if the returned QByteArray's are stored for further processing in the client code. Fix this by explicitly calling QByteArray::squeeze() before returning. [ChangeLog][QtCore][QIODevice] Fixes a regression in Qt 5.15 causing QByteArray's that are returned by QIODevice::readLine() to consume large amounts of memory. Fixes: QTBUG-87010 Pick-to: 5.15 Change-Id: I1f95fc4098849e900680fc945238bfeda881022c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix some qdoc warnings: function parameter namesVolker Hilsheimer2020-09-221-1/+1
| | | | | | | In QTextDocument and QTextFormat, standardize language a bit. Change-Id: I7c81ecc7a32e36ec32214e6b5386a2827cfcbc3f Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QIODevicePrivate: rearrange class membersAlex Trotsenko2020-08-241-16/+0
| | | | | | | | | | | | | | As this class is a subject of the library hook data, there must be a solid understanding of the member's alignment and padding across different architectures. By reordering the layout, this patch provides a clearer way of adding new members to the class. Bump the TypeInformationVersion field in qtHookData, to notify the Qt Creator developers that the offset of QFilePrivate::fileName was changed and dumpers should be adapted. Change-Id: Ied8b69bdeb9da50ff05aba2107bc75509674b18e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QIODevice: implement a "zero-copy" strategy for buffered writesAlex Trotsenko2020-08-201-2/+30
| | | | | | | | | | | | | | | | | | | | | | | | It works as follows: - user calls write(const QByteArray &); - this function keeps a pointer to the chunk and calls a regular write(data, len); - write(data, len) calls a virtual writeData(); - subclass calls a new QIODevicePrivate::write(); - QIODevicePrivate::write() makes a shallow copy of the byte array. Proposed solution is fully compatible with existing subclasses. By replacing a call to d->writeBuffer.append() with d->write(), subclasses can improve their performance. Bump the TypeInformationVersion field in qtHookData, to notify the Qt Creator developers that the offset of QFilePrivate::fileName was changed and dumpers should be adapted. Change-Id: I24713386cc74a9f37e5223c617e4b1ba97f968dc Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Disentangle QIODevice dependenciesLars Knoll2020-08-151-1/+1
| | | | | | | | | | | | | | | | | Move the QIODevice::OpenMode enum into a base class, so that we can remove the full QIODevice (and thus QObject) dependency from qdatastream.h and qtextstream.h. This is required so that we can include QDataStream in qmetatype.h without getting circular dependencies. As a nice side effect, QDataStream and QTextStream can now inherit QIODeviceBase and provide the OpenMode enum directly in their class scope. Change-Id: Ifa68b7b1d8d95687ed032f6c9206f92e63bfacdf Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* De-inline QIODevice::write(const QByteArray &)Alex Trotsenko2020-08-131-2/+6
| | | | | | | | | | | Since QRingBuffer is used as a temporary store for data to be written to a buffered device, we can implement a "zero-copy" strategy between the user-space code and QIODevice's internal write buffer. As a first step, we should have an entry point, where we can implement a possible solution. Change-Id: I1c658c13accc98c65a802be943688359cc9f9917 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Introduce QIODevice::skipData()Alex Trotsenko2020-08-111-8/+17
| | | | | | | | | | | | | | | | | | | QIODevice::skip() called a virtual QIODevicePrivate::skip() to implement an efficient skipping on I/O devices for the internal subclasses. The user subclasses cannot inherit QIODevicePrivate, so this functionality was not externally accessible. This patch replaces QIODevicePrivate::skip() with a virtual protected QIODevice::skipData(). While the basic implementation simply discards the data by reading into a dummy buffer, users can reimplement this function to improve the performance in their subclasses. [ChangeLog][QtCore][QIODevice] Added virtual protected skipData(). Now, subclasses can implement device-specific skipping of data. Change-Id: I9522f7f7ab9d03ac06e972a525f8ec2fa909a617 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add ; to Q_UNUSEDLars Schmertmann2020-07-071-1/+1
| | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Merge remote-tracking branch 'origin/5.14' into 5.15Qt Forward Merge Bot2020-02-041-1/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf examples/widgets/widgets/imageviewer/imageviewer.cpp src/corelib/text/qchar.cpp src/corelib/time/qdatetime.cpp Change-Id: I9762f5c4ff650799219729d6aee79ac07ce9024a
| * Fix 'the the' typo in commentsLinus Jahn2020-02-021-1/+1
| | | | | | | | | | Change-Id: I00fcb1c2374e7ca168b6240f9d41c0323fb0867c Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | Doc/QtBase: replace some 0 with \nullptrChristian Ehrlicher2020-01-261-1/+1
| | | | | | | | | | | | | | | | | | Replace some 'is 0' or 'are 0' where 0 referes to a nullptr with 'is \nullptr' and 'are \nullptr' Change-Id: Ida9af2971924377efe2f49f435d79e109de2bdf4 Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
* | Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-1/+1
|/ | | | | | | | | | | 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>
* Move away from using 0 as a pointer constantAllan Sandfeld Jensen2019-06-071-1/+1
| | | | | | | | | Cleans up most of corelib to use nullptr or default enums where appropriate. Change-Id: Ifcaac14ecdaaee730f87f10941db3ce407d71ef9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix can not -> cannotRobert Loehning2019-02-251-1/+1
| | | | | Change-Id: Ie9992f67ca59aff662a4be046ace08640e7c2714 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Add since 5.11 markers to two QFile enumsAlbert Astals Cid2018-10-291-2/+2
| | | | | Change-Id: Iaa015046cdcece10c28437da40fcd6cdc9d55eb3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Actually truncate when asked toEdward Welbourne2018-07-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | On Unix, we wouldn't even *try* to truncate if the file was open for appending. The combination may be an eccentric choice but - at least when it's combined with reading - I can imagine use-cases for it; and we should (at least try to) deliver what we're asked for, even if we can't think why anyone would want it. So actually enable truncation when asked to. Amended some tests to check this works and corrected the QIODevice documentation of mode flags (which misdescribed the special case that implies Truncate). Removed special-case code, to apply truncate when writing but not reading, since it's been made redundant by the pre-processing of mode done in QFSFileEngine::processOpenModeFlags(). [ChangeLog][QtCore][QFile] When opening a file, if Truncate is asked for, or implied by other flags, it shall be attempted, regardless of what other options are selected. We previously did this on Windows; now we do so also on Unix (even when appending). Task-number: QTBUG-13470 Change-Id: I1e08d02cfbae102725fccbbc3aab5c7bf8830687 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add QIODevice::NewOnly and QIODevice::ExistingOnly OpenMode flagsd3fault2018-01-171-0/+17
| | | | | | | | | | | | | | | | When QFile::open is called with the NewOnly flag, the call will fail if the file already exists. As usual, if the file does not exist, it will be created. Like QTemporaryFile, there is a guarantee from the operating system that you are not accidentally creating a new file on top of an older file. When QFile::open is called with the ExistingOnly flag, the call will fail if the file does not exist. The ExistingOnly flag only provides new functionality when used with the WriteOnly flag. For ReadOnly it provides no change in functionality, as ReadOnly by itself already never creates. Task-number: QTBUG-52244 Change-Id: I8e3206728f245f95172c225bf297023fb078fc6d Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Correct \since value for QIODevice::skipAndy Shaw2017-11-291-1/+1
| | | | | | Change-Id: I9a2f18263a8bc0a0de8978792dbb1f285acc0ccd Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QIODevice: do not clear error string on closeAlex Trotsenko2017-11-161-1/+1
| | | | | | | | | Keeping a description of the last device error is a more informative to the user than forcing the string to 'Unknown error'. Change-Id: Ie98fe1c94f24279fb633ce950bbe16450b0efdbd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Introduce QIODevice::skip()Alex Trotsenko2017-08-271-0/+122
| | | | | | | | | | [ChangeLog][QtCore][QIODevice] Added skip() method to improve performance in read operations. Change-Id: I79068a3e9df108756abe37ba3d431e27e7413621 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtCore: include mocsThiago Macieira2017-05-051-0/+4
| | | | | | | | | | | | | | | | | | | Compilation and link times in CPU seconds with GCC 7, using precompiled headers (not including moc, rcc, uic, etc. steps or headersclean): Before After Debug -O0 198,1 180,3 Debug -Og 240,7 229,2 Release -O3 267,1 249,2 Release LTO 239,4 229,8 QtCore required a little manual adjusting because some files are bootstrapped into moc itself and into qmake. Change-Id: I84e363d735b443cb9beefffd14b8b57c10e7da36 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Improve QIODevice::peek() performance on buffered devicesAlex Trotsenko2017-02-091-44/+39
| | | | | | | | | | | | | | Since 5.7, QIODevice::peek() implementation is based on transaction mechanism. While technically it's correct, seeking backward on a buffered random-access device clears the internal buffer that affects the performance of reading. To solve the problem, this patch implements peek mode directly inside the reading procedure. Task-number: QTBUG-56032 Change-Id: Ic5269f76e44c491a0309e13aba87fa7cf7b9259f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Refactor QIODevice::read()Alex Trotsenko2017-02-091-36/+50
| | | | | | | | | Move device-dependent part of the code into the private function for further reusing by peek() procedure. Task-number: QTBUG-56032 Change-Id: Iedceafe4b0bab109ca5c64ad274d779efe87c27b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-10-061-9/+10
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/mac/default_pre.prf mkspecs/features/qpa/genericunixfontdatabase.prf mkspecs/features/uikit/default_post.prf mkspecs/features/uikit/resolve_config.prf mkspecs/macx-ios-clang/features/default_post.prf mkspecs/macx-ios-clang/features/resolve_config.prf src/corelib/io/qiodevice.cpp Change-Id: I6f210f71f177a3c3278a4f380542195e14e4b491
| * QIODevice: add CHECK_MAXBYTEARRAYSIZE macroAlex Trotsenko2016-10-011-10/+10
| | | | | | | | | | | | | | | | | | It unifies handling of QByteArray's size limit in read(), readLine() and will be used in a follow-up change which optimizes the performance of QIODevice::peek() function. Change-Id: Idb9fbbe14d9632ee267d2a0e47c8a88603c024a2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-161-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/global/qglobal.cpp src/corelib/tools/qstring.cpp src/network/socket/qabstractsocket.cpp src/network/socket/qnativesocketengine_unix.cpp src/plugins/platforms/eglfs/api/qeglfsglobal.h Change-Id: Id5dfdbd30fa996f9b4b66a0b030b7d3b8c0ef288
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-131-1/+1
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/io/qsettings.cpp src/corelib/itemmodels/qstringlistmodel.cpp tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp Change-Id: I1c6c306ef42c3c0234b19907914b19da706b4a03
| | * Doc: Change instances of '(Mac) OS X' to 'macOS'Topi Reinio2016-08-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of version 10.12 (Sierra), the name of Apple's desktop operating system will be macOS. Change the occurrences where the Mac platform is discussed to use a macro \macos, which expands to 'macOS'. This helps with adapting to future renaming. Update the instructions on mac-specific Q_OS_* macro usage. Add a \target for the old 'Qt for OS X' topic to keep links working for other documentation modules that try to link with the old name. Change-Id: Id33fb0cd985df702a4ae4efb4c5fd428e77d9b85 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | | Introduce SCTP sockets supportAlex Trotsenko2016-07-271-0/+12
| | | | | | | | | | | | | | | | | | | | | Add protocol-specific code and the QSctpServer, QSctpSocket classes. Change-Id: Ie9a1d87bd1fda866a2405043d1c15c12ded5a96e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>