summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Remove references to QT_NO_STL from QtCoreThiago Macieira2012-04-0715-89/+5
| | | | | | | | QT_NO_STL is now no longer defined, so remove the conditionals and select the STL side. Change-Id: Ieedd248ae16e5a128b4ac287f850b3ebc8fb6181 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* qHash: always use the seed in the catch-all templateGiuseppe D'Angelo2012-04-061-1/+1
| | | | | | | | | This pertubates the results of the calls to the one-argument version of qHash through the catch-all template. Change-Id: I7037b25d545e6f1360384a83ff895f4bb62ed195 Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Add test for qHash(QByteArray)Giuseppe D'Angelo2012-04-061-0/+4
| | | | | | | Two equal QByteArrays must return the same hash. Change-Id: Iddd45b0c420213ca2b82bbcb164367acb6104ec8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add test for qHash(QString) / qHash(QStringRef)Giuseppe D'Angelo2012-04-061-0/+8
| | | | | | | Two equal strings / stringrefs must return the same hash. Change-Id: I2af9a11ab721ca25f4039048a7e5f260e6ff0148 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix compilation with MinGW.Marcel Krems2012-04-052-2/+8
| | | | | Change-Id: I494c84e8e6889a7d7bb3b29669337483732d02c2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLatin1String: add qHash overloadGiuseppe D'Angelo2012-04-052-0/+7
| | | | | | | | | It was never introduced in Qt 4, probably because of the implicit conversion to QString (that is, adding the qHash overload for QLatin1String in Qt 4 would have been a BIC). Change-Id: I2ebc8e73a85be497866820e0ca416dd11167bb53 Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Enable variadic macros for MSVC >= 2005João Abecasis2012-04-051-0/+4
| | | | | Change-Id: I8793ea0f6e3a640276b073321d29373b2ed18d63 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Fix unittest for QStandardPaths::enableTestModeDavid Faure2012-04-051-5/+5
| | | | | | | | | | | It was confusing DataLocation and GenericDataLocation, and the same for CacheLocation and GenericCacheLocation. The test was passing in the api_changes branch because these were giving the same result (empty app name), but the QCoreApplication::applicationName fix in master makes these different, so the bug in the test showed up after merging. Change-Id: I80ef6883c96cfd02b8c277d9d686717028d396bb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add zero-termination checks to QString and QByteArray testsJoão Abecasis2012-04-053-1/+119
| | | | | | | | | | | | | | This uses an alternative approach to the testing formerly introduced in 4ef5a626. Zero-termination tests are injected into all QCOMPARE/QTEST invocations. This makes such testing more thorough and widespread, and gets seamlessly extended by future tests. It also fixes an issue uncovered by the test where using a past-the-end position with QString::insert(pos, char), could move uninitialized data and clobber the null-terminator. Change-Id: I7392580245b419ee65c3ae6f261b6e851d66dd4f Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Revert "Add tests to verify QByteArray's zero termination"João Abecasis2012-04-051-123/+5
| | | | | | | | | | | | | The approach used to verify for zero-termination is too intrusive and requires additional maintenance work to ensure new zero-termination tests are added with new functionality. Zero-termination testing will be re-established in a subsequent commit. This reverts commit 4ef5a6269c1465662ea3872596ba284a13cce25e. Change-Id: I862434a072f447f7f0c4bbf8f757ba216212db3c Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Make QLocale::toULongLong return the proper type: qulonglongThiago Macieira2012-04-052-4/+2
| | | | | | | | Task-number: QTBUG-25143 Change-Id: Ia8fd588c25d11fe31acd57fd34a90d51dace248c Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: John Layt <jlayt@kde.org>
* Get rid of QKeyEventExThiago Macieira2012-04-055-85/+62
| | | | | | | | | | | | | | This class was added when we needed more information in QKeyEvent but couldn't extend it. And we couldn't use the d pointer because the copy constructor and copy assignment operators in QEvent were implicit. That is now fixed. But since this is Qt 5, we can change QKeyEvent to include the extra information. Task-number: QTBUG-25070 Change-Id: Iba4ac3378ca70583fcaa8caf96bca8ef75e30701 Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
* Remove macro _POSIX_ from Win32 special fileDebao Zhang2012-04-052-2/+0
| | | | | | | | | | | | | | | | | | Macro _POSIX_ doesn't used by this two files. And it will casued compile errors under VS2005/VS2008/VS2010 such as: Error 19 error C3861: ‘_fileno’: identifier not found c:\Dev\Builds\Qt\qt-everywhere-opensource-src-4.8.1\src\corelib\io\qfsfileengine_win.cpp 443 Error 20 error C3861: ‘_fileno’: identifier not found c:\Dev\Builds\Qt\qt-everywhere-opensource-src-4.8.1\src\corelib\io\qfsfileengine_win.cpp 468 Error 21 error C3861: ‘_fileno’: identifier not found c:\Dev\Builds\Qt\qt-everywhere-opensource-src-4.8.1\src\corelib\io\qfsfileengine_win.cpp 607 when we don't use precompiled headers. And this error will triggered when we reomve QT_NO_STL from QtCore. Because stdio.h declares fileno instead of _fileno when _POSIX_ is defined. Change-Id: I9d9031578dac7b7c5f7b77098839723a4bc8bfdf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Don't allocate space for null when using fromRawDataJoão Abecasis2012-04-052-2/+2
| | | | | | | | In this case we only need to allocate space for the "header" data. Change-Id: I059627e47a5bae7a02c82d837c826a6ed0fd20fd Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Simplify conditionalsJoão Abecasis2012-04-052-2/+2
| | | | | | | | | | | alloc >= size is an invariant of both QString and QByteArray, unless string data is immutable (e.g., when using fromRawData()), in which case alloc will be 0, regardless of size, That's what needs to be checked here. Change-Id: Ief9e6a52a1d5ea1941d23ed3c141edfd15d2a6a7 Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Rename realloc -> reallocDataJoão Abecasis2012-04-054-27/+26
| | | | | | | | 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-054-22/+22
| | | | | | | | | | | | | | | 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>
* Drop nullary overload of private QString::reallocJoão Abecasis2012-04-052-12/+8
| | | | | | Change-Id: I196ec038ab7b648287e310525681f2d218059b51 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-049-27/+45
| | | | | | | | | 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-049-76/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-047-56/+195
| | | | | | | | | | | | | | | | | | | | | | | 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-033-4/+31
| | | | | | | | | | | | | 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-033-2901/+1644
| | | | | | | | | | | | 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-035-6/+125
| | | | | | | | | | | | | | | | | | | | | | 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-0320-0/+181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0211-207/+58
| | | | | | | | | | | | | | 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-022-15/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-023-2/+115
| | | | | | | | | | | | | | 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-024-8/+21
| | | | | | | | | | | | | | | 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-023-1/+103
| | | | | | | | | | | | | 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-3113-43/+50
| | | | | | | | | | | | | | | | | | 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>
* Add tests to verify QByteArray's zero terminationJoão Abecasis2012-03-301-5/+123
| | | | | | | | | | | | | | | | For data allocated and maintained by QByteArray, there's a guarantee that data() is null-terminated. This holds true even for null and empty, where logically the terminating character should never be dereferenced. For tests that modify or generate QByteArrays, this ensures the invariant is kept. In the toFromHex() text, const-ness of temporary variables was dropped to enable the test macro to be used, as the qualification didn't add much to the test otherwise. Change-Id: I7ee52e79e3a9df7de18c743f3698dab688e6bf0e Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@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-302-16/+6
| | | | | | | | 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>
* Move the #include "tst_qurlinternal.moc" up to workaround a bugThiago Macieira2012-03-301-2/+1
| | | | | | | | | | | I don't know if the bug is in moc or in qmake. But it bails out trying to parse the .cpp file after the tst_QUrlInternal::nameprep_testsuite_data function. If the #include is placed above, it works. If it's placed below, it doesn't. Change-Id: Ide554aa5aa3f1999e29604ba6d25ccdb09f6ef28 Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>