summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qhash.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix compilation with MinGW.Marcel Krems2012-04-051-1/+1
| | | | | Change-Id: I494c84e8e6889a7d7bb3b29669337483732d02c2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLatin1String: add qHash overloadGiuseppe D'Angelo2012-04-051-0/+6
| | | | | | | | | 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>
* QHash security fix (1.5/2): qHash two arguments overload supportGiuseppe D'Angelo2012-04-041-45/+83
| | | | | | | | | | | | | | | | | | | | | | | 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>
* QHash security fix (1/2): add global QHash seedGiuseppe D'Angelo2012-04-031-5/+108
| | | | | | | | | | | | | | | | | | | | | | 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>
* Merge master into api_changesKent Hansen2012-03-191-1/+19
|\ | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qvector.h tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp Change-Id: I877256e95f3788e617437f4e9661a88047f38cd6
| * containers: add C++11-style c{begin,end}() as alias for const{Begin,End}()Marc Mutz2012-03-171-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C++11 adds cbegin()/cend() functions for the same reason Qt has constBegin()/constEnd(). This patch adds these functions to the Qt containers with the same implementation as constBegin()/constEnd(). It also fixes the return types in the documentation of existing constFind() functions (documentation only). C++11 only adds cbegin()/cend() (and crbegin()/crend(), which Qt doesn't have). In particular, it doesn't add cfind(), so I didn't supply these, even though Qt comes with constFind(). This is a forward-port of https://qt.gitorious.org/qt/qt/merge_requests/1365. Change-Id: Ida086b64246b24e25254eafbcb06c8e33388502b Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | Merge remote-tracking branch 'origin/api_changes' into containtersJoão Abecasis2012-03-081-3/+3
|\| | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qmetaobject.cpp src/corelib/kernel/qvariant.cpp src/tools/moc/moc.h Change-Id: I2cd3d95b41d2636738c6b98064864941e3b0b4e6
| * Remove the usage of deprecated qdoc macros.Casper van Donderen2012-03-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | QDoc now has support for Doxygen style commands for italics, bold and list items. This change applies that change in QDoc to the actual documentation. Task-number: QTBUG-24578 Change-Id: I519bf9c29b14092e3ab6067612f42bf749eeedf5 Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | Merge remote-tracking branch 'gerrit/master' into containersJoão Abecasis2012-02-291-1/+1
|\| | | | | | | Change-Id: I97ba222435ff50a9e5422e6f2c73e4bb8d1b865c
| * QHash: more robust use of qDebug()Marc Mutz2012-02-211-1/+1
| | | | | | | | | | | | | | | | I'm sure 'line' can't contain anything resembling a format string, but better safe than sorry. Change-Id: I0aa0f4a5a03d97b18d6a866c27fa721fcbe0f77b Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
* | Merge remote-tracking branch 'gerrit/master' into containersJoão Abecasis2012-02-051-2/+2
|\| | | | | | | | | | | | | Conflicts: src/corelib/tools/qstring.cpp Change-Id: I23d214bf33c2badfae1876da3cc7d6d8f6e635fb
| * Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | | | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
| * Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | | | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* | Merge remote-tracking branch 'gerrit/master' into containersJoão Abecasis2012-01-161-3/+3
|\| | | | | | | Change-Id: I2d358b912f1055ee6021d13de2f66fd459aaa355
| * Remove all non-inline of qMalloc/qFree/qRealloc.Robin Burchell2012-01-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | We're trying to deprecate these, so don't use them anymore. The inline uses of these have been left intact, for the moment. Inline code will need to create their own non-inline allocation methods (for future-proofing to allow alterations in how e.g. individual containers allocate) Change-Id: I1071a487c25e95b7bb81a3327b20c5481fb5ed22 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
| * Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | | | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* | Retire the generic Q_REFCOUNT_INITIALIZER macroJoão Abecasis2012-01-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This was only being used to initialize static read-only RefCount instances, where the value is hard-wired to -1. Instead of allowing initialization with arbitrary values (which for a reference count can be error prone) the intent of the macro is made explicit with its replacement Q_REFCOUNT_INITIALIZE_STATIC. Change-Id: I5b0f3f1eb58c3d010e49e9259ff4d06cbab2fd35 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | Get rid of assignment operators in RefCountJoão Abecasis2012-01-041-1/+1
|/ | | | | | | | | | | | , and make it strictly a POD struct. Since this operator was only being used to set the initial (owned) value of the reference count, the name of the function introduced here to replace it makes that use case explicit. Change-Id: I2feadd2ac35dcb75ca211471baf5044a5f57cd62 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove stale documentation.Casper van Donderen2011-10-181-10/+0
| | | | | Change-Id: I85139e0334b648bee0d18129cef9387dcc6c3222 Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
* Update QHash for Qt 5Bradley T. Hughes2011-09-261-19/+4
| | | | | | | | | | | Dealt with all necessary changes that are marked in the code: removing methods left only for binary compatibility with earlier Qt 4 versions and other methods marked for removal. Change-Id: I47109ccd9ed40addc345416be9e172570723955e Reviewed-on: http://codereview.qt-project.org/4534 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Make QHashData::shared_null constBradley T. Hughes2011-09-261-2/+2
| | | | | | | | | | Similar to QLinkedList QList, QMap, QVector, QByteArray and QString, keep the shared_null in shareable memory and never modify it. Change-Id: Ia8b72ef0288575bed658153d9d54434580988bda Reviewed-on: http://codereview.qt-project.org/4533 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+1914
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12