summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstring.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.5' into devSimon Hausmann2015-06-031-3/+109
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qnamespace.qdoc src/corelib/io/qwindowspipereader.cpp src/corelib/io/qwindowspipereader_p.h src/corelib/statemachine/qstatemachine.cpp src/corelib/statemachine/qstatemachine_p.h src/plugins/platforms/xcb/qxcbconnection.h tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/auto/tools/qmake/tst_qmake.cpp tests/manual/touch/main.cpp Change-Id: I917d694890e79ee3da7d65134b5b085e23e0dd62
| * Doc: added doc to undocumented functionsNico Vertriest2015-05-181-3/+109
| | | | | | | | | | | | | | Task-number: QTBUG-36985 Change-Id: Ia98654f88cf5da77245b3fcd903b860d12862fc2 Reviewed-by: Martin Smith <martin.smith@digia.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* | Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-04-221-6/+6
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/statemachine/qstatemachine.cpp src/corelib/statemachine/qstatemachine_p.h src/gui/painting/qdrawhelper.cpp src/plugins/platforms/xcb/qxcbnativeinterface.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/plugins/platforms/xcb/qxcbwindow.h src/testlib/qtestblacklist.cpp src/tools/qdoc/node.cpp src/tools/qdoc/node.h tests/auto/gui/painting/qcolor/tst_qcolor.cpp Change-Id: I6c78b7b162001712d5774293f501b06b4ff32684
| * Merge remote-tracking branch 'origin/5.4' into 5.5Liang Qi2015-04-151-6/+6
| |\ | | | | | | | | | Change-Id: I004854a25ebbf12b1fda88900162fe7878716c58
| | * Doc: Fix using Apple-related terminology in Qt CoreAlexander Volkov2015-03-311-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the name "OS X" instead of "Mac OS X", "Mac OS" and "OSX", and mention iOS. Replace "Carbon Preferences API" by "CFPreferences API" in the QSettings documentation. Change-Id: Ia7f9fb874276c7c445a1649df521b96ff43daa0c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* | | Remove <qhash.h> where it's not usedMarc Mutz2015-04-201-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | To avoid source-incompatibilites, wrap in QT_DEPRECATED_SINCE(5, 5) in public headers. Change-Id: I6117e8a6b11200d2f1a0a94a0e87d5c27538218e Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-04-081-2/+2
|\| | | | | | | | | | | Change-Id: I04f9f2749f68c0cb5a427b8d84e43b44bb143e4d
| * | docs: QString contains characters, not itemsMarc Mutz2015-04-071-2/+2
| | | | | | | | | | | | | | | Change-Id: I479a731780dfce81e138d1aca950385437266763 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-04-061-6/+0
|\| | | | | | | | | | | Change-Id: If9fd98525b6b4ca07e5e006fc98bf372a73b8a21
| * | Removed unused code on QT_STRING_UCS4 macroThiago Macieira2015-04-051-6/+0
| | | | | | | | | | | | | | | | | | | | | This isn't defined or used anywhere else. Change-Id: I9a75ad8521ae4e5cbbe5ffff13d2356883b82dbc Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | | QString::section: scope a variable betterMarc Mutz2015-04-051-2/+1
| | | | | | | | | | | | | | | | | | | | | Improves code clarity. Change-Id: If77eb644b1505c84783c907333526a4f08bb75a9 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | Optimize QString::section(QString)Marc Mutz2015-04-051-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The port from split() to splitRef() speeds up typical section() calls (where the separator is included) by ca. 1/3. The complete truth includes that section() calls where the separator is not found seem to have gotten twice slower. But that's a corner-case. Change-Id: I7e957cb65fccfd095ac522d523aef3464425e4e4 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | | Optimize QString::section(QReg*Exp*)Marc Mutz2015-04-021-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of creating lots of temporary QString objects, use QStringRefs. Together with the two other (micro) optimizations before, this speeds up section() by up to 2x (section_regex(IPv6)). No test has become slower. Change-Id: I514667004f82ddc1518fe3ee699ec5fbf96bb82f Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | | Add missing QString::prepend(QStringRef)/(const QChar*,int) overloadsMarc Mutz2015-04-021-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QString::append(QStringRef) exists, and so should prepend(). QString::append(const QChar *,int) exists, and so should prepend(). [ChangeLog][QtCore][QString] Added prepend(QStringRef) and prepent(const QChar *, int) overloads. Change-Id: I3eca41045f7c481be473507e23e92690f3ed7ba3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | | Add QString::insert() overloads for QStringRef, const char*, QByteArrayMarc Mutz2015-04-021-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The corresponding QString::append() overloads exists, and so should insert(). [ChangeLog][QtCore][QString] Added insert(int, QStringRef), insert(int, const char*) and insert(int, QByteArray). Change-Id: I1cf43fe8908319e2a57415945718b72e69ca0fb3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | | Merge remote-tracking branch 'origin/5.5' into devSimon Hausmann2015-03-161-9/+9
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/xcb/qxcbnativeinterface.cpp src/plugins/platforms/xcb/qxcbnativeinterface.h Change-Id: I31b38ba439b9341d51a01c0fd54bea33f7410076
| * | QString: Don't force unrolling of the tail loop if optimizing for sizeThiago Macieira2015-03-151-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is quite good if space isn't a constraint: the unrolling ensures faster execution and limits the number of iterations. But it's long. Both Clang and GCC set the predefined macro __OPTIMIZE_SIZE__ if -Os is in effect. ICC does not; MSVC is untested but there are no macros for this effect listed in its documentation. Change-Id: I1a800c709d3543699131ffff13c48919a9a79ec3 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
| * | Doc: corrected doc QString::operator[]Nico Vertriest2015-03-091-2/+2
| | | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-43337 Change-Id: I379dfe3f6909de5a63a67261834ea0edff875f9d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Martin Smith <martin.smith@digia.com>
* | | QString: further optimize multiArgMarc Mutz2015-03-141-53/+122
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This improves the previous algorithm in two aspects: 1. It parses the format string in a single pass instead of two, as was previously the case, storing all the information the result construction pass needs in a pair<QStringRef, int>. This alone would slow the algorithm down, but without it, it's hard to make the following work: 2. It avoids reallocations by calculating the size of the result and using the Qt::Uninitialized QString ctor. This speeds up the following test case QString str("%1 %2 %3 %4 %5 %6 %7 %8 %9 foo %10 %11 bar"); // not timed // (arguments converted to QString outside loop) str = str.arg("one", "2", "3", "4", "5", "6", "7", "8", "9"); str = str.arg("ahoy", "there"); from tst_qstring, which heavily favors the previous result construction loop due to the tiny (but non-zero) amount of verbatim text in between placeholders, by 25%: Qt 5.4: 1.50µs no map: 0.77µs (7b5ba56b0ab55fcaf79fbf9aad70bf767c938e15) this change: 0.58µs Change-Id: I41ec86b7a21b4b25b3bc669ff2e3b2cc73513597 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix MSVC 2013/64bit warnings about conversion from 'size_t' to 'int'.Friedemann Kleint2015-02-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | tools\qstring.cpp(243) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data io\qdebug.cpp(287) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data io\qdebug.cpp(292) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data io\qdebug.cpp(305) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data io\qdebug.cpp(312) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data Change-Id: I20b92b0783f4859e9da83364b4ec86dd8bbd1c4c Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
* | QString: optimize number() and setNum()Marc Mutz2015-02-121-63/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, number() was implemented in terms of setNum(). That makes no sense whatsoever. It creates a temporary value which requires the function to have an exception table and an unwinding trampoline. It also introduces a default constructor (in number()) and a copy assignment (in setNum()), which breaks the chain of RVOs originating in the QLocaleData functions. Instead, implement setNum() in terms of number(). This makes setNum() such a premature pessimisation that it's probably best to deprecate it in the near future. There are not many users of it in qtbase left, and it just pollutes the QString interface. Effects on Linux GCC 4.9 stripped release builds: text -708B data +-0B relocs +-0 Change-Id: I015c9ddb1ba9c98c2c55e38e54ef7894954ac4ca Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Long live QString::asprintf()!Marc Mutz2015-02-121-13/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | asprintf() is a GNU extension that prints into a string it allocates internally. Arguably, that's a better name for QString::sprintf() since it also allocates memory internally. The main problem with QString::sprintf() isn't that it's dangerous to use (it is), but that it's not static. It also returns a reference instead of by-value, breaking RVO. There is a comment about removing this function completely in Qt 6.0, but it remains the only printf-style function in Qt that can allocate the target string, so it's vital for logging, e.g., and the recommended replacement code (http://linux.die.net/man/3/vsnprintf) is a nightmare. So this patch adds static (v)asprintf() methods to replace it. Further patches will fix up all in-tree callers and finally deprecate the old (v)sprintf(). Test coverage is provided through the existing tests of sprintf(), which is implemented in terms of asprintf(). Arguably, the in-tree callers show that QByteArray would benefit from having an asprintf(), too, as most of the in-tree code works around its lack with calls to to{Latin1,Local8Bit}() after using the QString version. [ChangeLog][QtCore][QString] Added asprintf(), vasprintf(). Change-Id: I8510f8d67c22230653ec0f1c252c01bc95f3c386 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | 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>
* | Centralize use of __attribute__((noinline))Marc Mutz2015-01-291-5/+1
| | | | | | | | | | | | | | | | | | | | There are currently only two users, but I have patches in the pipeline which mark some other function noinline, so proavtively centralize the ifdef'ery involved. Change-Id: I1f02351fdc903d4e026089e12b8a976ed6a8d603 Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | QString: optimize multiArg()Marc Mutz2015-01-291-18/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function used a QMap<int,int> to map the %n's to the index in the args array. By way of construction, the key was sorted in ascending order while the values, initially all -1, were later reassigned to be 0...map.size()-1, ie. std::iota(). The only information this data structure stores is therefore the sorted %n's. For that, a sorted vector is a vastly superior data structure. Go one step further and use QVarLengthArray to avoid allocating any memory for the common case of just a few placeholders. As an artifact of the underlying refactoring, the management of that data structure has been moved to a separate class, ArgMapper. Runtime for the following test from tst_qstring: QString str("%1 %2 %3 %4 %5 %6 %7 %8 %9 foo %10 %11 bar"); // not timed str = str.arg("one", "2", "3", "4", "5", "6", "7", "8", "9"); str = str.arg("ahoy", "there"); went down from 2.2us to 1.5us. Change-Id: Ic552615fbac646b78ba05eb4e3215e63d202fd94 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QString: reduce template bloatMarc Mutz2015-01-291-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reduce the number of (non-regex) splitString instantiations from six to two by: - Passing separators by (const QChar*, int) and using qFindString() instead of indexOf() - Passing QString as QStringRef when the output is QVector<QStringRef>. Doing so also allows to drop the MidMethod template parameter since QString::midRef() is no longer being used. (Somewhat disappointing) effects on Linux GCC 4.9 stripped release builds: text -500B data +-0B relocs +-0 Change-Id: Id89e2814d5f7da5170181d863167517943c2e0cd Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add conversion functions for C++11 u16string and u32stringAllan Sandfeld Jensen2015-01-241-4/+44
| | | | | | | | | | | | | | | | | | | | | | The patch adds convenience functions for working on C++11's new char width specific unicode strings u16string and u32string. [ChangeLog][QtCore][QString] Added methods for convenient conversion to and from std::u16string and std::u32string. Change-Id: I67c082e4755c592d61daaaaa70c8867ef0b23dcb Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | QtCore: add some more Q_DECL_NOTHROWMarc Mutz2015-01-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-11-271-2/+2
|\| | | | | | | Change-Id: Id20053d261b4fbbcc0ac8ba49dd3ef2253fa4b95
| * Clarify QString::clear()Allan Sandfeld Jensen2014-11-271-2/+2
| | | | | | | | | | | | | | | | QString::clear() sets the string to the null QString, not just an empty one. Change-Id: Ie6f070f9f2e464105a7b87376e6dad90b5e4d2f2 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-11-241-35/+52
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qiodevice.cpp src/plugins/bearer/linux_common/qofonoservice_linux.cpp src/plugins/bearer/linux_common/qofonoservice_linux_p.h src/plugins/platforms/android/qandroidplatformtheme.cpp src/tools/bootstrap/bootstrap.pro src/widgets/styles/qmacstyle_mac.mm Change-Id: Ia02aab6c4598ce74e9c30bb4666d5e2ef000f99b
| * Merge remote-tracking branch 'origin/5.4.0' into 5.4Frederik Gladhorn2014-11-211-15/+12
| |\ | | | | | | | | | Change-Id: I95f235a66ce2e9b1fa435c0f911c6f7e811755f0
| | * Merge remote-tracking branch 'origin/5.4' into 5.4.0Oswald Buddenhagen2014-11-101-3/+2
| | |\ | | | | | | | | | | | | Change-Id: I85e3dfa62f217b76447276dd7cce6b9eac3a144e
| | * \ Merge remote-tracking branch 'origin/5.3' into 5.4.0Oswald Buddenhagen2014-11-101-15/+12
| | |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/xcb/qxcbwindow.cpp Change-Id: Iad9ef6bf7d6111efba8232a7d9b46bb9974912f5
| | | * | Fix QString::sprintf documentationKai Koehne2014-11-051-15/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QString::sprintf does actually support all length modifiers, including %lld. The format string is also parsed as UTF-8. What's worthwile to mention, though, is that %lc and %ls is at odds with the standard, since wchar_t isn't necessarily 16 bits wide. Change-Id: I30cd22ec5b42035824dd98e3cdcc79d7adcc953a Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | | | Fix QString::section() behavior on negative and out-of-range indexesAlex Trotsenko2014-11-201-18/+39
| | |_|/ | |/| | | | | | | | | | | | | | Change-Id: I3bff6ba73b15ee810bb11b2902d11244c3205b2a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | | Doc: updated documentation QString::toDoubleNico Vertriest2014-11-061-3/+2
| |/ / | | | | | | | | | | | | | | | Task-number: QTBUG-35543 Change-Id: I60d5cc253e6d6a24e9b031758e16a547a9a07443 Reviewed-by: Martin Smith <martin.smith@digia.com>
* | | Add rvalue-ref qualified {QString,QByteArray}::{simplified,trimmed}Thiago Macieira2014-11-021-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 devFrederik Gladhorn2014-10-201-1/+1
|\| | | | | | | | | | | Change-Id: If7e51514ed6832750e3ad967e4d322ccf920d2bb
| * | Make QStringRef::right() consistent with QString::right()Eskil Abrahamsen Blomfeldt2014-10-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation was inconsistent with QString::right(), and did not return the N rightmost characters but actually did the same as QString::mid(N) (returning the rightmost size - N characters.) Since this function is fairly recent (Qt 5.2), is documented to behave the same as QString::right(), and since these APIs are meant to be interchangeable, this needs to be fixed, even though it changes behavior. [ChangeLog][Important Behavior Changes] Changed QStringRef::right() to be consistent with QString::right(). The function now returns the N right-most characters, like the documentation already claimed. Change-Id: I2d1cd6d958dfa9354aa09f16bd27b1ed209c2d11 Task-number: QTBUG-41858 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* | | Check for integer overflows in places where qAllocMore is usedUlf Hermann2014-10-171-1/+4
| | | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-41230 Change-Id: I5e932c2540c0bd67f13fab3ae20975d459f82c08 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | | Add a macro to disable only some 8 bit/16 bit string conversionshjk2014-10-021-6/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an opt-in trade-off between type safety and user code convenience. QT_NO_CAST_FROM_ASCII is highly beneficial to avoid unintended conversions from 8 bit data with potentially "unsuitable" encodings to QString. However, it has the undesirable side-effect to require user code to wrap character and string literals in QLatin1Char(...) and QLatin1String(...) or use similar construction, cluttering the code significantly. This patch introduces a QT_RESTRICTED_CAST_FROM_ASCII macro that works almost as QT_NO_CAST_FROM_ASCII, except that it enables the QChar(char) constructor and adds an additional QString(const char (&ch)[N]) constructor that matches C++ string literals, but no arbitrary character pointers. This avoids a significant share of the need to clutter the user code by only a slight relaxation of the type-safety. [ChangeLog][QtCore][QString] Added QT_RESTRICTED_CAST_FROM_ASCII macro as less intrusive alternative to QT_NO_CAST_FROM_ASCII. Change-Id: Iac72f1f90f81fbcae9bfb1fe68b0fec6ffb36c50 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Kai Koehne <kai.koehne@digia.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | | Merge remote-tracking branch 'origin/5.4' into devOswald Buddenhagen2014-09-291-32/+17
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | Doc: corrected autolink errors qtbase/corelib/toolsNico Vertriest2014-09-241-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Also corrected some minor language/spelling issues Task-number: QTBUG-40362 Change-Id: I00d76521fc9beb4e7a4a83ff6dc3334a055a7148 Reviewed-by: Topi Reiniö <topi.reinio@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
| * | Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-09-231-8/+2
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The isAlwaysAskOption was removed in 38621713150b663355ebeb799a5a50d8e39a3c38 so manually removed code in src/plugins/bearer/connman/qconnmanengine.cpp Conflicts: src/corelib/global/qglobal.h src/corelib/tools/qcollator_macx.cpp src/corelib/tools/qstring.cpp src/gui/kernel/qwindow.cpp src/gui/kernel/qwindow_p.h src/gui/text/qtextengine.cpp src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h src/plugins/platforms/android/qandroidinputcontext.cpp src/plugins/platforms/xcb/qglxintegration.cpp src/plugins/platforms/xcb/qglxintegration.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/testlib/qtestcase.cpp src/testlib/qtestlog.cpp src/widgets/dialogs/qfiledialog.cpp src/widgets/kernel/qwindowcontainer.cpp tests/auto/corelib/tools/qcollator/tst_qcollator.cpp tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp Change-Id: Ic5d4187f682257a17509f6cd28d2836c6cfe2fc8
| | * Correct QString::toStdString documentation on encodingJohn Brooks2014-09-051-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This statement was left from when toAscii was used, instead of toUtf8. There is no loss of information when converting to UTF-8. Change-Id: Iad92977af319b324cbf06f1a24712b31a7836622 Reviewed-by: Louai Al-Khanji <louai.al-khanji@digia.com> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Micro-optimize qt_section_chunk ctorMarc Mutz2014-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | Use C++11 move semantics, and the ctor-init-list. Change-Id: I1a5faa83ef552e8d98ce994edf967770a73cab0e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-09-011-0/+88
|\| | | | | | | | | | | Change-Id: I2811ff0b9d4097f0be60ff16e9664a5060cff23e
| * | Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-08-121-0/+88
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Manually included changes from 3a347a4e70e5a10ee92dd2578316c926a399e894 in src/opengl/qgl.cpp. Conflicts: src/opengl/qgl_qpa.cpp src/plugins/platforms/android/androidjnimain.cpp Change-Id: Ic26b58ee587d4884c9d0fba45c5a94b5a45ee929