summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Clean up constructors for "statics" in QString and QByteArrayJoão Abecasis2012-04-047-71/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Document that the order of results from QAIM::match are not relevant.Stephen Kelly2012-04-041-1/+3
| | | | | | | This will allow fixing of QTBUG-10160 in Qt 5.1. Change-Id: I1ea7579cb4227f9940847c62d5a520c7cee3b0c5 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Merge one static function into anotherThiago Macieira2012-04-041-13/+5
| | | | | | | | One static function was only being used by the other, so just merge them and reduce the work for the compiler. Change-Id: Ia7a1c46ace6254633450632fae7ab35816ff13bf Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* Add missing #include <stdio.h> for _filenoThiago Macieira2012-04-041-0/+1
| | | | | | | | | | | | ..\..\corelib\io\qfsfileengine_win.cpp(443) : error C3861: '_fileno': identifier not found ..\..\corelib\io\qfsfileengine_win.cpp(468) : error C3861: '_fileno': identifier not found ..\..\corelib\io\qfsfileengine_win.cpp(602) : error C3861: '_fileno': identifier not found ..\..\corelib\io\qfsfileengine_win.cpp(847) : error C3861: '_fileno': identifier not found ..\..\corelib\io\qfsfileengine_win.cpp(909) : error C3861: '_fileno': identifier not found Change-Id: Ib6bed4814fce162e3065848c835f4774f0cbad01 Reviewed-by: Debao Zhang <dbzhang800@gmail.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* QHash security fix (1.5/2): qHash two arguments overload supportGiuseppe D'Angelo2012-04-044-54/+92
| | | | | | | | | | | | | | | | | | | | | | | Algorithmic complexity attacks against hash tables have been known since 2003 (cf. [1, 2]), and they have been left unpatched for years until the 2011 attacks [3] against many libraries / (reference) implementations of programming languages. This patch adds a qHash overload taking two arguments: the value to be hashed, and a uint to be used as a seed for the hash function itself (support the global QHash seed was added in a previous patch). The seed itself is not used just yet; instead, 0 is passed. Compatibility with the one-argument qHash(T) implementation is kept through a catch-all template. [1] http://www.cs.rice.edu/~scrosby/hash/CrosbyWallach_UsenixSec2003.pdf [2] http://perldoc.perl.org/perlsec.html#Algorithmic-Complexity-Attacks [3] http://www.ocert.org/advisories/ocert-2011-003.html Task-number: QTBUG-23529 Change-Id: I1d0a84899476d134db455418c8043a349a7e5317 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Stop relying on QHash orderingGiuseppe D'Angelo2012-04-031-0/+9
| | | | | | | | | | | | | tst_rcc and tst_qdom rely on specific QHash orderings inside rcc and QDom respectively (see QTBUG-25078 and QTBUG-25071). A workaround is added to make them succeed: QDom checks for all possible orderings, and rcc initializes the hash seed to 0 if the QT_RCC_TEST environment variable is set. Change-Id: I5ed6b50602fceba731c797aec8dffc9cc1d6a1ce Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Reorganize unicode string support in QStringJoão Abecasis2012-04-031-23/+24
| | | | | | | | | | | | | Cleaned up preprocessor code to have a single definition for QStaticStringData. A new qunicodechar typedef is introduced representing a 2-byte integral type that can be used to represent a UTF-16 codepoint. When QT_NO_UNICODE_LITERAL is not defined, QT_UNICODE_LITERAL converts a US-ASCII string literal into a (native endian) UTF-16 string literal of qunicodechar type. Change-Id: I04822c4cdc0b240bc0fe113aba897348b7316932 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove the sectionAutoResize signal.Stephen Kelly2012-04-032-15/+2
| | | | | | | | | Despite being documented, it was never emitted, and I can't find any use of it in the history either. Change-Id: If89b401004d14ef068ada6a4099bef9dc47936c9 Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* QLocale: Merge month name data storage to save 50KB memoryJohn Layt2012-04-032-2889/+1641
| | | | | | | | | | | | Month Names and Standalone Month Names are stored separately, but for majority of locales the names are the same and so storage is duplicated. By storing both sets of names in the same array 50KB is saved in libQtCore.so on Linux. Depends on change Ic84bbc82 in branch api_review for CLDR 1.9.1 Change-Id: I83224ebc2180ee6de69797fa50d38348acc94107 Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
* QHash security fix (1/2): add global QHash seedGiuseppe D'Angelo2012-04-033-6/+115
| | | | | | | | | | | | | | | | | | | | | | Algorithmic complexity attacks against hash tables have been known since 2003 (cf. [1, 2]), and they have been left unpatched for years until the 2011 attacks [3] against many libraries / (reference) implementations of programming languages. This patch adds a global integer, to be used as a seed for the hash function itself. The seed is randomly initialized the first time a QHash detaches from shared_null. Right now the seed is not used at all -- another patch will modify qHash to make use of it. [1] http://www.cs.rice.edu/~scrosby/hash/CrosbyWallach_UsenixSec2003.pdf [2] http://perldoc.perl.org/perlsec.html#Algorithmic-Complexity-Attacks [3] http://www.ocert.org/advisories/ocert-2011-003.html Task-number: QTBUG-23529 Change-Id: I7519e4c02b9c2794d1c14079b01330eb356e9c65 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove old comment restored by mistakeThiago Macieira2012-04-031-3/+0
| | | | | Change-Id: I1b24556110fe035c96091c5b1c5ecc00830093fc Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Add a remainingTime() method to the public interface of the QTimer classLaszlo Papp2012-04-0315-0/+160
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It is an extension coming from the use case when you, for instance, need to implement a countdown timer in client codes, and manually maintain a dedicated variable for counting down with the help of yet another Timer. There might be other use cases as well. The returned value is meant to be in milliseconds, as the method documentation says, since it is reasonable, and consistent with the rest (ie. the interval accessor). The elapsed time is already being tracked inside the event dispatcher, thus the effort is only exposing that for all platforms supported according to the desired timer identifier, and propagating up to the QTimer public API. It is done by using the QTimerInfoList class in the glib and unix dispatchers, and the WinTimeInfo struct for the windows dispatcher. It might be a good idea to to establish a QWinTimerInfo (qtimerinfo_win{_p.h,cpp}) in the future for resembling the interface for windows with the glib/unix management so that it would be consistent. That would mean abstracting out a base class (~interface) for the timer info classes. Something like that QAbstractTimerInfo. Test: Build test only on (Arch)Linux, Windows and Mac. I have also run the unit tests and they passed as well. Change-Id: Ie37b3aff909313ebc92e511e27d029abb070f110 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Remove duplicated template code.Jędrzej Nowacki2012-04-034-112/+61
| | | | | | | | | | | | Unify TypeDefinitions specializations. I'm not aware of any reason why QVariant should have a separate set of supported types during bootstrapping phase. It would cause only crashes. As a side effect the patch reduces size of core and gui libraries. Change-Id: I5140d9d3daee39a0171bc718bf46dab6b28085ec Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Don't use qstrlen if string is not nullJoão Abecasis2012-04-031-5/+5
| | | | | Change-Id: I4f9aec21af2ce24a1d27c6d140764e371bce5017 Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* QSqlDriver functions made virtualMatt Newell2012-04-0210-207/+48
| | | | | | | | | | | | | | Certain QSqlDriver functions were marked to be made virtual in Qt5. subscribeToNotification, unsubscribeFromNotification, subscribedToNotifications, isIdentifierEscaped, and stripDelimiters. This patch makes them virtual and removes the no longer needed Implementation counterpart functions. It also updates the relevant drivers. This patch has no regressions on the tests in tests/auto/sql/kernel/, tested with sqlite and postgres. Change-Id: Ia2e1c18dfb803531523a456eb4e710031048e594 Reviewed-by: Mark Brand <mabrand@mabrand.nl>
* Deprecate QItemSelectionModel::intersect().Stephen Kelly2012-04-022-4/+7
| | | | | | | It is already obsolete since the beginning of time (Qt 4.5). Change-Id: Ia2f9d934f0c0bd2038d693a29d1315867a526dfe Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* QUuid: mark as Q_PRIMITIVE_TYPEMarc Mutz2012-04-021-1/+1
| | | | | | | | | | | | | | Commit 01674860ac85a42eb152092c6e99f7ad03346977 marked QUuid as Q_MOVABLE_TYPE, but it's even primitive: Every bit pattern represents a valid QUuid object (if not a valid UUID), and memcpy() can be used to obtain a valid, independent copy of the object. It might not be a POD, but its close enough. Change-Id: I0fd2d11472590688a91e9ee424732e4d5ba15df8 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
* Introduce QArrayDataPointer::needsDetachJoão Abecasis2012-04-021-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | While QArrayDataPointer offers generic detach() functionality, this is only useful for operations that may modify data, but don't otherwise affect the container itself, such as non-const iteration, front() and back(). For other modifying operations, users of the API typically need to decide whether a detach is needed based on QArrayData's requirements (is data mutable? is it currently shared?) and its own (do we have spare capacity for growth?). Now that data may be shared, static or otherwise immutable (e.g., fromRawData) it no longer suffices to check the ref-count for isShared(). This commit adds needsDetach() which, from the point-of-view of QArrayData(Pointer), answers the question: 'Can contained data and associated metadata be changed?'. This fixes QArrayDataPointer::setSharable for static data (e.g., Q_ARRAY_LITERAL), previously it only catered to shared_null. SimpleVector is also fixed since it wasn't checking Mutability and it needs to because it supports fromRawData(). Change-Id: I3c7f9c85c83dfd02333762852fa456208e96d5ad Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Introduce QArrayDataOps::truncateJoão Abecasis2012-04-021-0/+20
| | | | | | | | | | | | | | This enables a truncating resize() to be implemented. It is similar to destroyAll(), but updates the size() as it goes, so it is safe to use outside a container's destructor (and doesn't necessarily destroy all elements). The appendInitialize test was repurposed and now doubles as an additional test for QArrayDataOps as well as exercising SimpleVector's resize(). Change-Id: Iee94a685c9ea436c6af5b1b77486734a38c49ca1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Introduce QArrayData::detachCapacityJoão Abecasis2012-04-022-1/+8
| | | | | | | | | | | | | | | This follows QArrayData::detachFlags's lead. Given the (known) size for a detached container, the function helps determine capacity, ensuring the capacityReserved flag is respected. This further helps aggregating behaviour on detach in QArrayData itself. SimpleVector was previously using qMax(capacity(), newSize), but there's no reason to pin the previous capacity value if reserve() wasn't requested. It now uses detachCapacity(). Change-Id: Ide2d99ea7ecd2cd98ae4c1aa397b4475d09c8485 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Introduce QArrayDataOps::appendInitializeJoão Abecasis2012-04-021-0/+23
| | | | | | | | | | | | | Adds given number of default-initialized elements at end of array. For POD types, initialization is reduced to a single memset call. Other types get default constructed in place. As part of adding a test for the new functionality the arrayOps test was extended to verify objects are being constructed and assigned as desired. Change-Id: I9fb2afe0d92667e76993313fcd370fe129d72b90 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add missing include on 32-bit buildsJoão Abecasis2012-04-021-3/+1
| | | | | | | | | Commit cc3ff3c1 introduced uncoditional use of _BitScanForward on Windows, so adapt include conditions to match use of function. Change-Id: I46ea4212ea3a01d9c4ecb19377b21e9b0f16e179 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove all calls to, and deprecate qMalloc, qRealloc and qFree.Robin Burchell2012-03-3111-39/+46
| | | | | | | | | | | | | | | | | | 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>
* Make numerus unsignedJoão Abecasis2012-03-301-6/+5
| | | | | | | It's the index number of the translation to be used. Change-Id: I959c6aaa1aad09e74286d201ea356bfc4409f02a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Pre-validate numerus rules: fail early, fail gracefullyJoão Abecasis2012-03-301-17/+80
| | | | | Change-Id: Ibb3d27b9ff3d2f356a7c5c98b98686342f001f8f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Verify presence of "magic cookie" before more expensive readsJoão Abecasis2012-03-301-5/+15
| | | | | | | | | | Moved this simple sanitation out of do_load as it will prevent us from loading misplaced (or misfound) files into memory in the first place. We'll still load anything minimally looking like a translation file. Change-Id: Ia138be010979d4a66d330f7414fce3df20727e68 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Use unsigned variable for size and indexJoão Abecasis2012-03-301-2/+2
| | | | | | | | rulesSize is passed from unsigned variable numerusRulesLength, so don't bring sign bit into equation; array index variable i also made unsigned. Change-Id: I0cb4e8483272c1e60339298149fb118215aa2183 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Fix comments out of touch with realityJoão Abecasis2012-03-301-3/+3
| | | | | Change-Id: Id060626b0bb6c28f4e67c9b3c7a0fbc456f7dcc6 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Revert to Qt4 behaviour that QUrl().isValid() == falseThiago Macieira2012-03-301-13/+3
| | | | | | | | There are probably lots of places that rely on that behaviour, so go back to what it was. Change-Id: I4d1503a0ee105a50cdfaab52d9a5862a02c70757 Reviewed-by: David Faure <faure@kde.org>
* Fix the license headers for the files in the new-qurl branchThiago Macieira2012-03-305-9/+10
| | | | | Change-Id: I469fed8b72111905e31553d0c82e62ced4009d75 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* De-inline qHash(const QUrl&) and improveThiago Macieira2012-03-302-5/+22
| | | | | | | | Make it a friend and access the internals to have better performance. Change-Id: I3bbf0b0faa5363278b7b3871d6b6fb5f2225a5f4 Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Fix QUrl operator== and operator<Thiago Macieira2012-03-302-20/+46
| | | | | | | | | | | Don't crash when either side is null but not both sides. Also make sure operator< is working properly and satisfies the basic conditions of a type (such as that if A < B, then !(B < A)). Change-Id: Idd9e9fc593e1a7781d9f4f2b13a1024b643926fd Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Disallow spaces in URLs when parsing in StrictMode.Thiago Macieira2012-03-301-1/+1
| | | | | Change-Id: I16de68aff2b9e84cc800734c5875aaee9a2ea565 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Reimplement the StrictMode URL parsingThiago Macieira2012-03-302-22/+121
| | | | | | | | | | | | | | | | The strict mode check is now implemented after the tolerant parser has finished, and only if the tolerant parser has not found any errors. We catch the use of disallowed characters (control characters plus a few not permitted anywhere) and broken percent encodings. We do not catch the use of Unicode characters, as they are permitted in IRIs. In the tests, remove the old errorString test since it makes little sense. Change-Id: I8261a2ccad031ad68fc6377a206e59c9db89fb38 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Re-introduce support for QUrl::errorString()Thiago Macieira2012-03-302-91/+119
| | | | | | | | | | | | Note that QUrl can only remember one error. If the URL contains more than one error condition, only the latest (in whichever parsing order URL decides to use) will be reported. I don't want too keep too much data in QUrlPrivate for validation, so let's use 4 bytes only. Change-Id: I2afbf80734d3633f41f779984ab76b3a5ba293a2 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Port to the new QUrl APIThiago Macieira2012-03-3010-25/+25
| | | | | | | | | | | | | | The use of any broken-down components of the query now needs QUrlQuery. The QUrl constructor and toString() are now rehabilitated and the preferred forms. Use toEncoded() and fromEncoded() now only when we need to store data in a QByteArray or the data comes from a QByteArray anyway. Change to toString() or the constructor if the data was in a QString. Change-Id: I9d761a628bef9c70185a48e927a61779a1642342 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Add QUrl::setQuery overload with QUrlQueryThiago Macieira2012-03-303-3/+18
| | | | | Change-Id: I0cba92b6bf7f848f1918383b380c0444b8bead3a Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* QUrl: optimise setHost for the common caseThiago Macieira2012-03-301-5/+6
| | | | | Change-Id: Ib667557268ebf75cb796ddd716b337ca24b466ad Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* QUrl: Always lowercase the schemeThiago Macieira2012-03-301-2/+16
| | | | | Change-Id: I8d467014d22384f1be15fdd746e20b1153a82a4e Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Long live the new QUrl implementation.Thiago Macieira2012-03-307-1906/+1226
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also say hello to QUrl's constructor and QUrl::toString being allowed again. QUrl operates now on UTF-16 encoded data, where a Unicode character matches its UTF-8 percent-encoded form (as per RFC 3987). The data may exist in different levels of encoding, but it is always in encoded form (a percent is always "%25"). For that reason, the previously dangerous methods are no longer dangerous. The QUrl parser is much more lenient now. Instead of blindly following the grammar from RFC 3986, we try to use common-sense. Hopefully, this will also mean the code is faster. It also operates on QStrings and, for the common case, will not perform any memory allocations it doesn't keep (i.e., it allocates only for the data that is stored in QUrlPrivate). The Null/Empty behaviour that fragments and queries had in Qt4 are now extended to the scheme, username, password and host parts. This means QUrl can remember the difference between "http://@example.com" and "http://example.com". Missing from this commit: - more unit tests, for the new functionality - the implementation of the StrictMode parser - errorString() support - normalisation Change-Id: I6d340b19c1a11b98a48145152513ffec58fb3fe3 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Move some of qurl.cpp into other files for ease of maintenanceThiago Macieira2012-03-306-3244/+3422
| | | | | | | | The parsing code is now in qurlparser.cpp, whereas the IDNA related code is in qurlidna.cpp. Change-Id: I0b32c0bf0ee6c2f08dc3200c44af3c9d1504a3df Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Forward the methods dealing with the break down of query to QUrlQueryThiago Macieira2012-03-303-532/+37
| | | | | | | | | | | | Now that QUrlQuery exists, these methods are no longer necessary in QUrl itself. Manipulation of the items should be done using the new class. They are now implemented using a temporary QUrlQuery. This is hardly efficient but it works. Change-Id: I34820b3101424593d0715841a2057ac3f74d74f0 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Long live QUrlQueryThiago Macieira2012-03-303-0/+864
| | | | | | | | | | | | | | | | | | | This class is meant to replace the QUrl functionality that handled key-value pairs in the query part of an URL. We therefore split the URL parsing code from the code dealing with the pairs: QUrl now only needs to deal with one encoded string, without knowing what it is. Since it doesn't know how to decode the query, QUrl also becomes limited in what it can decode. Following the letter of the RFC, queries will not encode "gen-delims" nor "sub-delims" nor the plus sign (+), thus allowing the most common delimiters options to remain unchanged. QUrlQuery has some undefined behaviour when it comes to empty query keys. It may drop them or keep them; it may merge them, etc. Change-Id: Ia61096fe5060b486196ffb8532e7494eff58fec1 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Refactor the URL recoder a littleThiago Macieira2012-03-301-77/+80
| | | | | | | | | | | | | Change it to operate on QChar pointers, which gains a little in performance. This also avoids unnecessary detaching in the QString source. In addition, make the output be appended to an existing QString. This will be useful later when we're reconstructing a URL from its components. Change-Id: I7e2f64028277637bd329af5f98001ace253a50c7 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove the tolerant parsing function and make the recoder tolerantThiago Macieira2012-03-301-106/+95
| | | | | | | | | | | | | | | The reason for this change is that the strict parser made little sense to exist. What would the recoder do if it was passed an invalid string? I believe that the tolerant recoder is more efficient than the correcting code followed by the strict recoder. This makes the recoder more complex and probably a little less efficient, but it's better in the common case (tolerant that doesn't need fixes) and in the worst case (needs fixes). Change-Id: I68a0c9fda6765de05914cbd6ba7d3cea560a7cd6 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Add the code that recodes URLs.Thiago Macieira2012-03-303-0/+518
| | | | | | | | | | | | | | | This one function is an all-in-one: - UTF-8 encoder - UTF-8 decoder - percent encoder - percent decoder The next step is add the ability to modify the behaviour, by telling the function what else it must encode or decode and what it should leave untouched. Change-Id: I997eccfd2f9ad8487305670b18d6c806f4cf6717 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Mark QUrl::{to,from}Punycode as deprecated since 5.0Thiago Macieira2012-03-302-87/+86
| | | | | | | | | | | | | | | | | | These functions are now aliases to {to,from}Ace, which are usually what you want. The original functions from Qt 4.0 had the wrong semantics and wrong name. The new ones from Qt 4.2 execute the ACE processing from IDNA (specifically, the ToASCII and ToUnicode operations described in the RFC). But so as not to be without tests, export the tests in unit testing environment and test the punycode roundtrip. Note that the tst_QUrl::idna_test_suite test tests *only* the Punycode roundtrip, not the nameprepping. Change-Id: I9b95b4bd07b4425344a5c6ef5cce7cfcb9846d3e Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: David Faure <faure@kde.org>
* Move the QByteArray-based percent-encoding activities to QByteArrayThiago Macieira2012-03-301-9/+8
| | | | | | | | | | Copy the unit tests that related to percent-encoding to tst_qbytearray.cpp and use public functions to execute QUrl::fromPercentEncoded and QUrl::toPercentEncoded. Change-Id: I6639ea566d82dabeb91280177a854e89e18f6f8d Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: David Faure <faure@kde.org>
* Make QArrayData::shared_null zero terminated.Jędrzej Nowacki2012-03-292-6/+13
| | | | | | | This is expected by QByteArray and QString Change-Id: Ib668b144bdc0d2c793018c8f8d794f249eaf935c Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Remove compression support from moc.Jędrzej Nowacki2012-03-291-1/+1
| | | | | | | | Moc doesn't compress anything so it doesn't have to link against zlib. In practice it is a build fix for a bug exposed by previous patches. Change-Id: I0debfccc903b3addd7c16be8421a51b6be9ceb2f Reviewed-by: João Abecasis <joao.abecasis@nokia.com>