summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Update the error codes in QtDBusThiago Macieira2012-04-164-32/+33
| | | | | | | | | | | Change the old com.trolltech ones to org.qtproject and introduce Use the alternate domain name for the Qt Project because the dash character is not valid in interface and error names. Task-number: QTBUG-23274 Change-Id: Iac1699e70525d67f983c10560932acff6b2ecde6 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Mark tst_qabstractitemmodel as insignificant after QHash randomizationGiuseppe D'Angelo2012-04-152-2/+3
| | | | | | | | | | | | | | | | | The testChildrenLayoutsChanged fails randomly. This happens rarely, f.i. wasn't spotted by CI when QHash randomization itself was merged; but is indeed reproducible by running the test a few times in a row. This is now blocking api_merges integration, and I have no idea how to fix it. This patch marks the test as insignificant for now (the bug tracking this test failure is QTBUG-25325), and switches the failing tests from QVERIFY(a == b) to a proper QCOMPARE (so that the expected values do show up in the build logs). Change-Id: I16f0e28bcbb06dbac2e7169f4676a19ccf626a92 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* QHash security fix (2/2): enable QHash random seedGiuseppe D'Angelo2012-04-141-1/+1
| | | | | | | | | | | | | | | | | | 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 makes qHash use the QHash seed introduced in the previous commits, thus truly randomizing bucketing in QHash. [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: Ibee9cf6aa820af5d777fcde478647665c728052a Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* QHash: remove optimization for QHash<int, T>Giuseppe D'Angelo2012-04-141-1/+14
| | | | | | | | | | | | | | QHash employs an optimization for int/uints, squashing the hash value and the key value inside an union. This obviously works iff qHash(int k) = k. If the hash value gets salted, the hash table is corrupted. This patch removes that optimization by means of a #if 0, so if further research finds out that we want those 4 bytes back it's pretty simple to revert. Change-Id: If273f0bf2ff007f4f2f7c46d2aab364a3b455cf1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QHash: fix key() testGiuseppe D'Angelo2012-04-141-4/+4
| | | | | | | | | The key returned by QHash::key is an arbitrary one that maps to the given value. The test instead relied on it being a specific one. Change-Id: I090351797e8b52036d78160fd810518a11e8107d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qHash: qHash(T*) two arguments supportGiuseppe D'Angelo2012-04-141-2/+2
| | | | | Change-Id: I1b78914fe9c6ee9251d68af1f2e95f1e3e0f1db5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* qHash: two arguments support for simple integer types (and QChar)Giuseppe D'Angelo2012-04-141-16/+16
| | | | | | Change-Id: I24bed73422fb1d2e90cf3dd4e5375e249b3dcac4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Removed QXmlStreamReader::readElementText overloadThorbjørn Lindeijer2012-04-142-13/+2
| | | | | | | | | The version without argument was kept for binary compatibility when the configurable ReadElementTextBehaviour was introduced. It is now dropped in favour of using a default argument value. Change-Id: Ic08c41d5a5aad9f22df7fc37a2d53ffbc6df1fe9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSharedPointer: hash autotest fixGiuseppe D'Angelo2012-04-131-1/+2
| | | | | | | | | | | | | The hash autotest is wrong: it assumed that the iterator on the hash would reach the end after iterating on two elements with identical key. But three elements were added to that hash, and the third one can appear after the other two. That code path is left for the map test only. Change-Id: I51de7987e2b132b6caff7bb4bac6a57fb7fcb530 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSharedPointer: qHash two arguments supportGiuseppe D'Angelo2012-04-131-3/+3
| | | | | | Change-Id: I800de3fd9769e4829018360c25a8cf2ee2e2e08b Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add unit test for BackgroundRequestAttributeShane Kearns2012-04-131-1/+47
| | | | | Change-Id: I807953cac3d23825461f9ae860badbd148835330 Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* QLayoutItem - make controlTypes a virtual function.Thorbjørn Lund Martsum2012-04-135-13/+32
| | | | | | | | | Just implementing the ### Qt5 suggestion about making controlTypes a virtual function. Change-Id: Ic1db47fe488f089de965438e456e9b48e0b96f32 Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Style: Don't put an else after a return.Stephen Kelly2012-04-131-2/+1
| | | | | Change-Id: I41d031d92489e5539f293c30a6257310f2a1c657 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Re-add the Qt 4 compatibility methods for QUrl encoded query itemsThiago Macieira2012-04-122-0/+48
| | | | | | | | I forgot to re-add those when I re-added the non-encoded (QString) forms. Change-Id: I9d635d40106273177df2c332f09d66415efc15a3 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Ensure proper handling of empty-but-present URL componentsThiago Macieira2012-04-122-8/+30
| | | | | | | | | | | | | | | | The new QUrl is able to distinguish a URL component that is empty from one that is absent. The previous one already had that capability for the port, fragment and query, and the new one extends that to the username, password and path. The path did not need this handling because its delimiter from the authority it part of the path. For example, a URL with no username is one where it's set to QString() (null). A URL like "http://:kde@kde.org" is understood as an empty-but-present username, for which toString(RemovePassword) will return "http://@kde.org", keeping the empty-but-present username. Change-Id: I2d97a7656f3f1099e3cf400b199e68e4c480d924 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Remove QPaintBufferSignalProxy and QPaintBufferResource.Robin Burchell2012-04-122-89/+0
| | | | | | | Nothing seems to use these... Change-Id: I58b3e5f8536e43b3076da0a86d9093a6e11b947a Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Remove 'using' of QPaintEngineEx methods from QRasterPaintEngine.Robin Burchell2012-04-121-7/+0
| | | | | | | | drawEllipse() and the drawPolygon() overloads are all reimplemented, so there is no point having this here. Change-Id: I343cea0dd0fff2ed6a27be2a19459056e929f9d8 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Remove unused QIntRect.Robin Burchell2012-04-121-13/+0
| | | | | | | I can't find any uses of this anywhere, in either Qt 4 or Qt 5. Change-Id: Ibf747b57b4afdd81e11631e87a80dcab5ac12f69 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Address Qt 5 to-do comments related to QFileSystemModel.Jason McDonald2012-04-123-9/+7
| | | | | | | | | | | | | | | - QFileSystemModel::rmdir() and QFileSystemModel::remove() changed to non-const -- they don't change the object, but they do change the file system, and the Qt way is to be non-const if having side-effects on external entities. - The comment on incompatibility between entryList and QFileInfo will not be fixed as doing so is likely to break existing code. - The comment on removing the internal resolvedSymLinks variable has been removed, as the variable is still used. Task-number: QTBUG-25088 Change-Id: I20456e4d116076403d9c4d4692ee05c178a1ed17 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Address Qt 5 to-do comment for QColorDialog.Jason McDonald2012-04-123-15/+27
| | | | | | | | | | | - change customColor() to return QColor instead of QRgb. - change setCustomColor() and setStandardColor() to take a QColor instead of QRgb. - add missing standardColor() getter method. Task-number: QTBUG-25087 Change-Id: Ic6adb2031ef47f5e9b15fa3560a5322e6847c0bb Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* make QStringList::sort() to take a Qt::CaseSensitivity paramKonstantin Ritt2012-04-123-8/+39
| | | | | | | | Task-number: QTBUG-12892 Change-Id: I402e6fb12ff24ac26c5a8103bf81547946f9cc58 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Fix warning introduced in "Adjust a double leading slash..."Thiago Macieira2012-04-121-1/+1
| | | | | Change-Id: Id89fd3983123c0ba302c493b54437dd75e419e01 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Make QBoxLayout::insertItem() public.Jason McDonald2012-04-121-3/+1
| | | | | | | | | | This commit addresses a Qt 5 to-do comment in the code. The method was already protected (so could already be made public by sub-classing), and already has documentation in qboxlayout.cpp. Task-number: QTBUG-25098 Change-Id: I5b51d34be8180becb63b8ad291879620f265bbec Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Prefer QCOMPARE to QVERIFY, as it gives better outputJoão Abecasis2012-04-121-1/+1
| | | | | | Done-by: Jędrzej Nowacki Change-Id: Ic1c8fd5b8acede52b45e5ea16b14fb5bae78f171 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Readd a bunch of tests that had got removed in the QUrl portingThiago Macieira2012-04-111-6/+40
| | | | | | | | | | Most of the tests were removed while QUrl::toEncoded or fromEncoded were deprecated in the development process. Since they aren't deprecated in the end, bring them back. Change-Id: Ibdb6cd3c4b83869150724a8e327a03a2cd22580d Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Change the component formatting enum values so the default is zeroThiago Macieira2012-04-118-76/+111
| | | | | | | | | | | | | | | | | | | | | | By having the default value equal to zero, we follow the principle of least surprise. For example, if we had url.path() and we refactored to url.path(QUrl::DecodeSpaces) Then instead of ensuring spaces are decoded, we make spaces the only thing encoded (unicode, delimiters and reserved characters are encoded). Besides, modifying the default can only be used to encode something that wasn't encoded previously, so having the enums as Encode makes more sense. As a side-effect, toEncoded() does not support any extra encoding options. Change-Id: I2624ec446e65c2d979e9ca2f81bd3db22b00bb13 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Allow {} to remain decoded in URLs in the path and queryThiago Macieira2012-04-113-9/+23
| | | | | | | | | | | | | | | | | | This allows things like http://example.com/{1234-5678}?id={abcd-ef01}. But do not allow it in other parts of the URL. I could allow it in the fragment, but in the username and password it would be too ugly. In order to do that, make DecodeReserved use two bits and have PrettyDecoded set only one of them. That way, toString(PrettyDecoded) can be distinguished from toString(PrettyDecoded | DecodeReserved), just as path(PrettyDecoded) can be distinguished from path(PrettyDecoded & ~DecodeDelimiters). Also, take the opportunity to avoid decoding the reserved characters in the query. Keep them encoded as they should be. Change-Id: I1604a0c8015c6b03dc2fbf49ea9d1dbed96fc186 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Introduce QUrl::DecodeReserved and reorder the enumsThiago Macieira2012-04-113-8/+130
| | | | | | | | DecodeReserved applies to all characters between 0x21 and 0x7E that aren't unreserved, a delimiter, or the percent sign itself. Change-Id: Ie64bddb6b814dfa3bb8380e3aa24de1bb3645a65 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Merge QUrl::DecodeAllDelimiters and QUrl::DecodeUnambiguousDelimitersThiago Macieira2012-04-117-31/+26
| | | | | | | | | | | | | | | | | | | There's little value in having the DecodeUnambiguousDelimiters option since neither QUrl nor QUrlQuery can return values that are ambiguous in that particular context, ever. This option could be used to encode a character if, when placed in a URL, it would need to be encoded. Such cases are hash (#) or question marks (?) in the path component, or slashes (/) and at signs (@) in the userinfo. However, we don't need two enums for that, since there are no other characters that can appear in either form. Still, leave two bits for this enum. In the future, if we want to split the gen-delims from the sub-delims, we are able to. Change-Id: If5416b524680eb67dd4abbe7d072ca0ef7218506 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Add a big test for QUrl encoding principlesThiago Macieira2012-04-111-0/+233
| | | | | | | | | | This tests how QUrl encodes and decodes certain characters and leaves some other ones alone. It also tests that the output of toString() (in whichever encoding was being tested) is also parsed again to be exactly the same as the previously decoded form. Change-Id: Ie358d001f8b903409db61db48bde1ea679241a60 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Fix the handling of ambiguous delimiters in the query part of a URLThiago Macieira2012-04-114-45/+62
| | | | | | | | | | | This is the same fix as the previous commit did for the other components of the URL. But we're also changing how we handle the "[]" characters in a query: previously the handling was like for other sub-delims; now, they're always decoded, assuming that the RFC had a mistake and they were meant to be decoded. Change-Id: If4b1c3df8f341cb114f2cc4860de22f8bf0be743 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Make QUrl handle ambiguous delimiters correctlyThiago Macieira2012-04-113-89/+134
| | | | | | | | | | | | | | | | | | | Refactor the way that QUrl stores and returns the components of the URL so that ambiguous delimiters (gen-delims that could change the meaning of the parsing) are interpreted correctly. Previously, QUrl called "unambiguous" the form found in a full URL, even though each item in isolation could have more characters decoded. Now, instead, store only the fully decoded form. To recreate the compound forms (the full URL, as well as the user info and the authority), we need to do more processing. This commit applies to the user name, password, path and fragment only. The scheme, host and port do not need this work because they are special; the query is handled separately. Change-Id: I5907ba9b8fe048fff23c128be95668c22820663a Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Fix error reporting in QNetworkReplyHttpImplPrivateShane Kearns2012-04-111-6/+18
| | | | | | | | | | | | | | When errors are detected synchronously in _q_startOperation, they were not reported. This is because unlike the generic QNetworkReplyImpl the function is called directly rather than using a queued connection. In order to report errors, use the _q_error and _q_finished slots so that signals are emitted after returning to the event loop i.e. after the application had a chance to connect the QNetworkReply Change-Id: I8a7bbe79a934f4634fb4e0572ebb5479dfc5f489 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Add unit test for usagePoliciesShane Kearns2012-04-112-1/+32
| | | | | Change-Id: I749268d81521d84ffc709014963a0f34fbf6d74c Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Add autotest interface to get session from QNAMShane Kearns2012-04-112-0/+12
| | | | | | Change-Id: I7d8ea41299408377042a9f0d0a672e1a6fb57e7d Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Check background requests are allowed before startingShane Kearns2012-04-112-5/+26
| | | | | | | | | | | | | | | | | | | If background requests are not allowed, don't even attempt to start the network session, just fail the request immediately. After this change, a QNAM with mixed requests queued should behave as follows when background requests are disabled: - background requests at head of the queue fail - first foreground request starts the session and succeeds - remaining background requests fail - remaining foreground requests succeed If policy is changed on the fly, then running background requests are not aborted. However queued background requests won't be started. Change-Id: Ic9aba1eb59ca41b166a08d2ed09418e1b6af6b60 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Define usagePolicies API in QNetworkSessionShane Kearns2012-04-115-2/+75
| | | | | | | | | | | | | This allows the system to publish usage restrictions to applications related to the network in use. Currently there is only one restriction defined: NoBackgroundTrafficPolicy, which means that non user initiated traffic should be avoided (e.g. background downloads). For example this policy could be applied to save battery or data transfer charges. Change-Id: I49e26c0f3650d2b92f4ec51981aae9435b717b49 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Use NetworkSessionFailedError in QNetworkReplyShane Kearns2012-04-113-5/+16
| | | | | | | | | Switched the error code. Republish the error string from the bearer plugin if possible. Change-Id: I9e4ac7a9914fbf2e87fe8fd3a5175deda6d933d2 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Define QNetworkReply::BackgroundRequestNotAllowedErrorShane Kearns2012-04-112-0/+4
| | | | | | | | | | This error will be used when background network requests are not allowed according to the current policy of the bearer plugin. For example, to save power when battery is low on a portable device. Change-Id: I866e115f8fdd046134da99ea895b7c1df0375f26 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Define QNetworkReply::NetworkSessionFailed errorShane Kearns2012-04-112-0/+4
| | | | | | | | | This is to replace the UnknownNetworkError which occurs when the internal QNetworkSession fails to start (e.g. no usable WLAN available) Change-Id: I2b14577c22e0acf8ff07be7e932f0dfe9ac89c33 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Set ConnectInBackground based on requestShane Kearns2012-04-111-1/+4
| | | | | | | | | | | | | | Set the QNetworkSession attribute to match the QNetworkRequest that triggered it. Currently if there are a mix of normal and background requests queued and background connections are not allowed by policy: - background requests at the head of the queue should fail - first foreground request should successfully start a connection - remaining requests succeed regardless of background attribute Change-Id: If0e3ec0b8a5096e3d7cd6df85884c6f53172d233 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Define BackgroundRequestAttributeShane Kearns2012-04-112-0/+9
| | | | | | | | | This is so that the ConnectInBackground flag can be set on the QNetworkSession internal to QNAM according to pending requests. Change-Id: If0cc62f5117ed8febbbda7b7f6de62b11b274258 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
* Move QVectorPath::polygonFlags to its own class.Robin Burchell2012-04-112-11/+10
| | | | | | | | Who can say why it was put in QPaintEngineEx's header, but it certainly doesn't belong there. Change-Id: Ieb3b977affcf4b240f621d13b72bdc0e8f8138b9 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Move QRectVectorPath into the .cpp of the only file actually using it.Robin Burchell2012-04-112-48/+48
| | | | | Change-Id: I2778b5142ee574f44a9f9489a2752265c6a6c170 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* unite QString::normalized() overloadsKonstantin Ritt2012-04-112-26/+12
| | | | | Change-Id: I27545e599a1831728e491a9fad1e52fa255535fc Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Deprecate qMemCopy/qMemSet in favour of their stdlib equivilents.Robin Burchell2012-04-1131-61/+48
| | | | | | | | | | | | | | | | | | Just like qMalloc/qRealloc/qFree, there is absolutely no reason to wrap these functions just to avoid an include, except to pay for it with worse runtime performance. On OS X, on byte sizes from 50 up to 1000, calling memset directly is 28-15% faster(!) than adding an additional call to qMemSet. The advantage on sizes above that is unmeasurable. For qMemCopy, the benefits are a little more modest: 16-7%. Change-Id: I98aa92bb765aea0448e3f20af42a039b369af0b3 Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: John Brooks <john.brooks@dereferenced.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Mark QObject::disconnect overload constOlivier Goffart2012-04-112-4/+4
| | | | | | | | | Consistency with the non-static connect overload Task-number: QTBUG-23622 Task-number: QTBUG-1772 Change-Id: Ic09df9cca1feaabb6b5cf335f04a0d6d4bbf011f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make reallocData() take (unsigned) size, including nullJoão Abecasis2012-04-114-38/+38
| | | | | | | | | | | | 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>
* Adjust a double leading slash in the path for FTP to /%2FThiago Macieira2012-04-102-2/+16
| | | | | | | | | | | | | | | Some FTP implementations (currently not including QNAM) strip the first slash off the path in an FTP URL so that the path in the URL is relative to the login path (the user's home directory). To reach the root directory, another slash is necessary, hence the double slash. In anticipation of future URL normalisation, which Qt 4 could do, "//" could be rendered to "/", so this extra slash should be "%2F". This operation is done only in QUrl::fromUserInput. Change-Id: If9619ef6b546a3f4026cb26b74a7a5a865123609 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Add early-clobbers to the output variables in CPUIDThiago Macieira2012-04-101-3/+3
| | | | | | | | | | | | | | | Without those early-clobbers, the compiler might decide to schedule a register that is also used as output. The existing early clobber in the tmp variable was there so the compiler wouldn't use a register scheduled as input (especially EAX). To be honest, I'm not convinced that the compiler should be allowed to do this. That means that two output variables are scheduled to the same register... still, this fixes a problem found with GCC 4.2 (at least the Mac one). Change-Id: I6cd4676284e9a83d6aac4b439c6e58e347c40106 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>