summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qbytearray.h
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* QtCore: add some more Q_DECL_NOTHROWMarc Mutz2015-01-211-5/+5
| | | | | | | | | | | QtCore now builds with no -Wnoexcept warnings (that doesn't mean there aren't tons of functions that should be marked noexcept, just that all conditionally noexcept functions aren't noexcept(false) just because of a forgotten noexcept elsewhere). Change-Id: I10dacb6b9c9d41d3595fe2f306356d62d3d91c76 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QtCore: mark some operations nothrowMarc Mutz2015-01-101-3/+4
| | | | | | | | | | | | This shotgun-surgery approach is motivated by trying to get a clean(er) build for -Wnoexcept on GCC, so it is expected that for any class touched here, there will be more operations that can be marked nothrow. But they don't show up in conditional noexcept clauses, yet, so they are deferred to some later commit. Change-Id: I0eb10d75a26c361fb22cf785399e83b434bdf233 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-12-291-0/+3
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.cpp src/gui/kernel/qplatformsystemtrayicon.cpp src/gui/kernel/qplatformsystemtrayicon.h src/plugins/platforms/xcb/xcb-plugin.pro Change-Id: I00355d3908b678af8a61c38f9e814a63df808c79
| * Make sure we don't try to ask QByteArray to allocate too muchThiago Macieira2014-12-201-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QFile::readAll could be asked to read a file that is over 1 GB in size and thus cause an assertion: ASSERT failure in qAllocMore: "Requested size is too large!", ... The idea behind the existing code was correct, but the value was wrong. It prevented overflow of the integer size request, but didn't prevent overflowing the storage size. Change-Id: I072e6e419f47b639454f3fd96deb0f88d03e960c Reviewed-by: Martin Smith <martin.smith@digia.com>
* | Add rvalue-ref qualified {QString,QByteArray}::{simplified,trimmed}Thiago Macieira2014-11-021-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Of the const overloads that return a QString or a QByteArray, this is one that gains the most benefit. It happens often in constructs like: QByteArray s = x.readLine().trimmed(); After this change, 41 out of 103 calls to trimmed become rvalue in Qt and 272 out of 441 in Qt Creator. For simplified, the numbers are 27 out of 69 in Qt and 10 out of 19 in Qt Creator. Other candidates are left, right, and mid, but there are exactly zero uses of left, right and mid on an xvalue QString or QByteArray in Qt. I'm being lazy and using qstring_compat.cpp to store the QByteArray compat methods. Change-Id: I4e410fc1adc4c761bb07cc3d43b348a65befa9f6 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/5.4' into devOswald Buddenhagen2014-09-291-19/+11
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.cpp src/gui/image/qimage.cpp src/gui/image/qppmhandler.cpp src/gui/kernel/qguiapplication.cpp src/gui/painting/qpaintengine_raster.cpp Change-Id: I7c1a8e7ebdfd7f7ae767fdb932823498a7660765
| * Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | | | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* | Add rvalue-ref qualified overload of QByteArray::to{Upper,Lower}Thiago Macieira2014-08-191-0/+25
|/ | | | | | | | | | | | | | Those operations aren't very common with QByteArray but this is easy to optimize. Qt Qt Creator const & && const & && toLower 34 10 0 1 toUpper 3 1 0 0 Change-Id: I2097955f4c889ea5a21903c35ddbc0ff27bf62c5 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Add some missing STL typedefs and functions to QStringRef and QByteArrayThiago Macieira2014-08-081-0/+4
| | | | | | | | | These will be needed in some template code that is to come. Change-Id: I5b93f4320313f7b15a6404de2c98f85485735fda Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Introduce std::string conversion to QByteArrayAllan Sandfeld Jensen2014-06-251-0/+10
| | | | | | | | | | | | | Add conversion methods similar to those in QString to QByteArray. This is often more useful than the QString version since std::string like QByteArray are byte arrays. [ChangeLog][QtCore][QByteArray] Added convenience methods to convert directly to and from std::string. Change-Id: I92c29d4bb1d9e06a667dd9cdd936970e2d272006 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QtCore: Use Q_REQUIRED_RESULT in many more placesDavid Faure2014-04-111-20/+20
| | | | | | | | | | | | gcc doesn't yet warn when a non-POD return datatype is unused, but clang does, at least. This detected two bugs in qtbase due to the bad QDate method naming, and will help application developers to avoid this trap too. Change-Id: I106c1a32d2c6fc8d02f57beb7b61940605c80d76 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Fix capacity reservation for shared QByteArrayThiago Macieira2014-04-051-1/+1
| | | | | | | | | | | | We can squeeze, but not by discarding elements. Make sure the size of the object stays intact after changing the reserved capacity. I've also added unit tests for other containers, just to be sure. Task-number: QTBUG-37750 Change-Id: I5135b095943b7589423c51cebcb52af792468e61 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Add Objective-C specific type converters to QByteArraySamuel Gaist2014-03-081-0/+18
| | | | | | | | | | | | | | This patch adds the Objective-C NSData/CDataRef converters to QByteArray This will replace the current converters offered in QMacExtras [ChangeLog][QtCore][Objective-C] Added NSData/CDataRef converters for QByteArray Change-Id: I7a0f14bee4271798db345f3c5efd26ac671a3ea4 Reviewed-by: Jake Petroules <jake.petroules@petroules.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Base64: Implement the "base64url" encoding and the stripping of '='Thiago Macieira2013-09-141-2/+15
| | | | | | | | | The "base64url" encoding is defined in RFC 4648, which is the newest version of Base64. There are also a few situations where the ending '=' is not desired. Change-Id: I9bb9fa55817b57d125189e4e795d6fde97caea6d Reviewed-by: Richard J. Moore <rich@kde.org>
* QByteArray: Remove some reinterpret_cast<>.Friedemann Kleint2013-07-301-1/+1
| | | | | | | | | | Fix warning: QByteArray(QByteArrayDataPtr dd) constructor warning C4946: reinterpret_cast used between related classes: 'QArrayData' and 'QTypedArrayData<T>'. Task-number: QTBUG-32559 Change-Id: I06356902f79ed6bf784127ff0c3a97d3263a25da Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-291-4/+0
| | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Speed up and fix QByteArray::setNum()hjk2012-12-301-2/+2
| | | | | | | | | | | | Going through QLocale and QString is not really needed. This also makes the result of the conversion of negative numbers in bases other than 10 independent of the architecture and implements the documented behavior of treating them as unsigned types. Change-Id: Ibc231dc5241deb5cbadd9796484a8b5f79c29410 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Prevent an overflow warning in assertions.Christian Kandeler2012-09-291-2/+2
| | | | | | | | | | | | | | | | | | Functions like QByteArray::at() assert the given index: Q_ASSERT(i >= 0 && i < size(); These functions typically get inlined. Now if the index is e.g. size() - 2, then gcc will emit an ugly warning in client code ("assuming signed overflow does not occur when assuming that (X - c) > X is always false"). This can be easily prevented by casting both sides of the second comparison in the assertion to their unsigned type. The explicit comparison to zero is then no longer necessary, since that condition is tested implicitly by the other comparison due to unsigned arithmetic. Change-Id: Ic7244e1fa5da00a47d1fe0ed56fb81c23d444dfe Reviewed-by: hjk <qthjk@ovi.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Q_DECLARE_SHARED: mark the type movableMarc Mutz2012-07-101-1/+0
| | | | | | | | | | All implicitly shared classes are by definition movable, so this patch adds Q_DECLARE_TYPEINFO(Type, Q_MOVABLE_TYPE) to Q_DECLARE_SHARED. Change-Id: Idf8989ae1a7ed6d1ac13fccb7eaef7395a875350 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Compile.Morten Sorvig2012-06-141-1/+1
| | | | | | | | | Expressions containing "reinterpret_cast" are not constant expressions according to C++11 rules. Change-Id: Id97729f184983e5bdda180b99cfbe27e2768e09e Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Don't use gcc extension for QByteArrayLiteral neitherLars Knoll2012-06-121-16/+0
| | | | | | | | | This extension doesn't work for e.g. default arguments in function declarations. Change-Id: I32b7afa6e01b6af55fb2409179b4fd94cb04cd8d Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Implement the move constructor for containers.Olivier Goffart2012-05-111-0/+1
| | | | | | | | | | | | | | | This changes all the containers that uses QtPrivate::RefCount (QMap already had one), and QVariant In Qt 4.8, it was pointless to have the move constructor because we did not have quick way to re-initialize a null container. (shared_null still needed to be refcounted) But now that we have RefCount, and that the shared_null do not have reference count, we can implement a fast move constructor that do not generate code to increment the reference count. Change-Id: I2bc3c6ae96983f08aa7b1c7cb98d44a89255160b Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Reuse QArray initializer macro in QByteArrayJędrzej Nowacki2012-05-041-1/+1
| | | | | Change-Id: Ieb12ee290846dce88f2ea9fbf943103899337e0f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace QByteArrayData class by typedef.Jędrzej Nowacki2012-05-041-20/+1
| | | | | | | | | | | | | QByteArrayData was binary compatible with QArrayData, but we do not need a separate class, QArrayData should be sufficient. Preferably we would use QTypedArrayData<char> but it is not POD, therefore it can not be initialized with {} syntax. Change-Id: I1edd7b4f236b06d8f2dbfd8a37a3f5699b6a2c07 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Make QStringLiteral and QByteArrayLiteral always return the real typesThiago Macieira2012-04-231-6/+7
| | | | | | | | | | | | | | | | | | | Up until now, the macros would return an internal type that contained the pointer to the data. This breaks code that tried to use the macros with operators, like QStringBuilder but also when writing: QStringList() << QStringLiteral("a") << QStringLiteral("b"); This change seems to work fine now and I can also verify that this works: const auto str = QStringLiteral("Hello"); Even though it creates a QString, which is non-POD and non-constexpr. Change-Id: Iaf82af9bea4245513a1128ea54f9d2d3d785fb09 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Merge "Merge remote-tracking branch 'origin/master' into api_changes" into ↵Sergio Ahumada2012-04-171-1/+1
|\ | | | | | | refs/staging/api_changes
| * Merge remote-tracking branch 'origin/master' into api_changesLars Knoll2012-04-161-1/+1
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/corelib/io/qurl.cpp src/gui/kernel/qwindow.cpp src/tools/moc/generator.cpp src/widgets/kernel/qwidget_qpa.cpp src/widgets/styles/qstyle.h src/widgets/widgets/qtabbar.cpp tests/auto/corelib/codecs/utf8/tst_utf8.cpp Change-Id: Ia457228d6f684ec8184e13e8fcc9d25857b1751e
| | * Bump some Qt 5 to-do's to Qt 6.Jason McDonald2012-04-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Source-incompatible changes are no longer desirable for Qt 5, so these items must wait until at least Qt 6. Task-number: QTBUG-23524 Change-Id: I0b9ae5f6f3a792e0169a4b0d3aefbdcb744acd2f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | | Make reallocData use QArrayData::AllocationOptionsJoão Abecasis2012-04-161-11/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Growth computations are deferred to QArrayData::allocate, except in the case of realloc as that functionality is currently lacking in QArrayData. Since that sits in library code, anyway, it can be changed later to use a future QArrayData::reallocate. As it is, reallocData is becoming a model for QArrayData::reallocate and what it can offer to containers of POD/movable types. Change-Id: I045483f729114be43e4818149d1be1b333bcbe13 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Migrate QByteArray over QArrayData.Jędrzej Nowacki2012-04-161-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the time being QByteArrayData keeps its independent existence, for the sake of other modules. Once they have been ported to use the new initializer macros it can be changed to: struct QByteArrayData { QArrayData array; }; Extra braces can then be added to the macros. With respect to source compatibility, the only concern is with other modules, as QByteArrayData has already changed in incompatible ways with Qt 4.x Done-with: João Abecasis Change-Id: I044e2a680317431777a098feec8839a90a3d3da3 Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Make QByteArray and QString keep track of terminating nullJoão Abecasis2012-04-161-3/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In conceptual terms, this change increments the Data::alloc member by one for all strings allocated and maintained by these classes. Instances initialized with fromRawData retain 0 as the member value, so they are treated as immutable. This brings QByteArray and QString closer to QVector, making it possible for them to reference and share the same data in memory, in the future. It also brings them closer to QArrayData. In practical terms all comparisons to the alloc member were changed to take into account that it also tracks the terminating null character. Aside from the increment in the alloc member, there should be no user visible changes. Change-Id: I618f49022a9b1845754500c8f8706c72a68b9c7d Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Make reallocData() take (unsigned) size, including nullJoão Abecasis2012-04-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | The parameter represents an allocation size and unsigned matches the Q*Data::alloc member it ultimately represents (even if they currently differ in accounting for the null). There's still work up for grabs to ensure we avoid integer overflows when growing. Change-Id: Ib092fec37ec2ceed37bebfdc52e2de27b336328f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Rename realloc -> reallocDataJoão Abecasis2012-04-051-4/+4
| | | | | | | | | | | | | | | | This avoids confusion with standard ::realloc. Change-Id: Ibeccf2f702ec37161033febf4f3926bee8f7aea6 Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Move growth computation to re-allocation functionJoão Abecasis2012-04-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Callers of QByteArray/QString::realloc() are still responsible for the heuristics and decide whether to provide the "grow" hint, but computation is centralized there. With this change we also ensure growth takes into account the terminating null. Previously, calls to qAllocMore took into account header and string size, for left out the null, meaning we ended up allocating ("nice-size" + Null). Change-Id: Iad1536e7706cd2d446daee96859db9b01c5f9680 Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Introduce initializer macros for QString- and QByteArrayDataJoão Abecasis2012-04-041-4/+13
| | | | | | | | | | | | | | | | | | This enables easier updating of those structs, by reducing the amount of code that needs to be fixed. The common (and known) use cases are covered by the two macros being introduced in each case. Change-Id: I44981ca9b9b034f99238a11797b30bb85471cfb7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Clean up constructors for "statics" in QString and QByteArrayJoão Abecasis2012-04-041-15/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were two constuctors offering essentially the same functionality. One taking the QStatic*Data<N> struct, the other what essentially amounts to a pointer wrapper of that struct. The former was dropped and the latter untemplatized and kept, as that is the most generic and widely applicable. The template parameter in the wrapper was not very useful as it essentially duplicated information that already maintained in the struct, and there were no consistency checks to ensure they were in sync. In this case, using a wrapper is preferred over the use of naked pointers both as a way to make explicit the transfer of ownership as well as to avoid unintended conversions. By using the reference count (even if only by calling deref() in the destructor), QByteArray and QString must own their Data pointers. Const qualification was dropped from the member variable in these wrappers as it causes some compilers to emit warnings on the lack of constructors, and because it isn't needed there. To otherwise reduce noise, QStatic*Data<N> gained a member function to directly access the const_cast'ed naked pointer. This plays nicely with the above constructor. Its use also allows us to do further changes in the QStatic*Data structs with fewer changes in remaining code. The function has an assert on isStatic(), to ensure it is not inadvertently used with data that requires ref-count operations. With this change, the need for the private constructor taking a naked Q*Data pointer is obviated and that was dropped too. In updating QStringBuilder's QConcatenable specializations I noticed they were broken (using data, instead of data()), so a test was added to avoid this happening again in the future. An unnecessary ref-count increment in QByteArray::clear was also dropped. Change-Id: I9b92fbaae726ab9807837e83d0d19812bf7db5ab Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Remove all calls to, and deprecate qMalloc, qRealloc and qFree.Robin Burchell2012-03-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Callers should just call the standard allocation functions directly. Adding an extra function call onto all basic memory management for the sake of making it instrumentable in rare cases isn't really fair to everyone else. What's more, this wasn't completely reliable, as not everything was using them in a number of places. Memory management can still be overridden using tricks like LD_PRELOAD if needed. Their aligned equivilents cannot be deprecated, as no standard equivilents exist, although investigation into posix_memalign(3) is a possibility for the future. Change-Id: Ic5f74b14be33f8bc188fe7236c55e15c36a23fc7 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | Merge master into api_changesKent Hansen2012-03-191-0/+6
|\| | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qvector.h tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp Change-Id: I877256e95f3788e617437f4e9661a88047f38cd6
| * containers: add C++11-style c{begin,end}() as alias for const{Begin,End}()Marc Mutz2012-03-171-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C++11 adds cbegin()/cend() functions for the same reason Qt has constBegin()/constEnd(). This patch adds these functions to the Qt containers with the same implementation as constBegin()/constEnd(). It also fixes the return types in the documentation of existing constFind() functions (documentation only). C++11 only adds cbegin()/cend() (and crbegin()/crend(), which Qt doesn't have). In particular, it doesn't add cfind(), so I didn't supply these, even though Qt comes with constFind(). This is a forward-port of https://qt.gitorious.org/qt/qt/merge_requests/1365. Change-Id: Ida086b64246b24e25254eafbcb06c8e33388502b Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Undeprecate operator casts on QByteArray.Stephen Kelly2012-03-161-4/+8
| | | | | | | | | | | | | | | | This reverts part of commit 8397a44bedf542b53284674c87268819f4911d31. Change-Id: I1d2ec018167faeb23a9343b209bb0ff2d8db311d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | Merge remote-tracking branch 'origin/api_changes' into containtersJoão Abecasis2012-03-081-8/+4
|\| | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qmetaobject.cpp src/corelib/kernel/qvariant.cpp src/tools/moc/moc.h Change-Id: I2cd3d95b41d2636738c6b98064864941e3b0b4e6
| * QByteArray: deprecate QT_NO_CAST_FROM_BYTEARRAY-protected operatorsMarc Mutz2012-02-261-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QByteArray::operator const {char,void}*() implicit conversions are a source of subtle bugs, so they right- fully can be disabled with QT_NO_CAST_FROM_BYTEARRAY. const char *d = qstring.toLatin1(); // implicit conversion while ( d ) // oops: d points to freed memory // ... But almost no-one ever enabled this macros in the wild and many were bitten by these implicit conversions, so this patch deprecates them. I would have liked to remove them completely, but there are just too many occurrences even in Qt itself to hope to find all conditionally-compiled code that uses these. Also fixes all code that needs to compile under QT_NO_DEPRECATED (in qmake/, src/tools/). I984706452db7d0841620a0f64e179906123f3849 separately deals with the bulk of changes in src/ and examples/. Depends on I5ea1ad3c96d9e64167be53c0c418c7b7dba51f68. Change-Id: I8d47e6c293c80f61c6288c9f8d42fda41afe2267 Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | Merge remote-tracking branch 'gerrit/master' into containersJoão Abecasis2012-02-211-1/+1
|\| | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.h Change-Id: I03b1f3e05c9b7a45130887c522fcd9b7aa387129
| * Fix typo in QByteArray(QConstByteArrayData) constructorKent Hansen2012-02-201-1/+1
| | | | | | | | | | | | | | There is no "str" member in QConstByteArrayData, it should be "ba". Change-Id: Ife76460e9332733480c1ceded21e78388656092d Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* | Change meaning of offset in QByteArrayDataJoão Abecasis2012-02-211-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It used to be an index into the first element in 'd' that came after 'offset'. It is now the byte offset from the beginning of the QByteArrayData structure. By no longer using an actual array to access characters, we also steer clear of GCC bug #43247: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43247 This aligns this data structure with QArrayData. The intention is to have QVector, QString and QByteArray share the same memory layout and possibly code. Change-Id: I8546e5f51cd2161ba09bd4ada174b7f5e6f09db7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Remove constructors taking implicit string sizesJoão Abecasis2012-02-141-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Constructors taking explicit sizes got a default -1 size argument that triggers length calculation from nul-terminated strings. This imposes a slight change in behavior: negative size arguments would previously be ignored and generate an empty string whereas with this patch we expect to see a nul-terminated string. On the other hand, keeping the previous behavior could effectively hide errors in user code and I can't find a good reason to support it. Documentation for the constructors was updated and made more consistent between the classes. Change-Id: I738ac3298cffe3221c8a56e85ba2102623e7b67d Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | Merge remote-tracking branch 'gerrit/master' into containersJoão Abecasis2012-02-051-12/+11
|\| | | | | | | | | | | | | Conflicts: src/corelib/tools/qstring.cpp Change-Id: I23d214bf33c2badfae1876da3cc7d6d8f6e635fb