summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qtimezoneprivate_tz.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QTimeZone: don't use QSet, use sorted QListMarc Mutz2015-02-171-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | QSet, as a node-based container, requires one memory allocation per element inserted. QList, as a contiguous-memory container (at least in the case of a QByteArray payload), requires one memory allocation per container. The higher lookup speed might still speak for using QSet, but there are only two uses of the sets: 1. Checking for existence (or lack thereof) of timezone names. For this, first generating a container full of data just to check for existence of one item of data is extremely wasteful. The QTZPrivate API should be extended to allow said lookup to be performed on the native data store instead. That leaves 2. Returning a sorted(!) list(!) from the public QTimeZone API. There is no reason why, during the construction of those sorted lists, the data should be held in a set. Instead, the well-known technique of first cramming everything into a result container, which is subsequently sorted and has its duplicates removed, can be used here. Saves more than 8K of text size on AMD64 stripped release builds. Change-Id: I71c2298e94e02d55b0c9fb6f7ebeaed79a1fe2db Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Pass params of shareable type by const-ref rather than by valueKonstantin Ritt2015-02-131-1/+1
| | | | | | | | ...where passing them by value was not intentional. Change-Id: Ifd5036d57b41fddeeacfbd3f5890881605b80647 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTzTimeZonePrivate: replace an inefficient QList with QVector (IV)Marc Mutz2015-02-121-17/+17
| | | | | | | | | | | | | | The QTimeZonePrivate::Data type is larger than void*, so holding them in QLists is horribly inefficient. In addition, this type is held elsewhere in QVector, so do that here, too. As well as being faster, also saves 1.3K of text size on optimized AMD64 builds. Change-Id: I1ecf3ee0d955f6b19d2269204e2febc2ba2a9d9d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTzTimeZonePrivate: replace an inefficient QList with QVector (III)Marc Mutz2015-02-121-15/+16
| | | | | | | | | | | | | | The implementation-private QTzType type is larger than void*, so holding them in QLists is horribly inefficient. Fix by holding it in QVector instead (it was already marked as a primitive type before). Text size grows by ca. 0.5K, but of course we got rid of all those pesky heap allocations. Change-Id: I3b70ed36fa9947b695ffc87c6f6199daa13cb7cd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTzTimeZonePrivate: replace an inefficient QList with QVector (II)Marc Mutz2015-02-121-13/+12
| | | | | | | | | | | | | | | | | | The implementation-private QTzTransition type is larger than void*, so holding them in QLists is horribly inefficient. Fix by declaring it as a primitive types (it just contains various integers) and holding it in QVector instead. Also optimize parseTzTransitions() by preallocating the expected number of transitions and streaming directly into the container, resizing to the number of successful read items on error. Saves roughly 0.5K in text size, too. Change-Id: Iadec7a7b0721893e477e1778c9fb54afd6e49544 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update copyright headersJani Heikkinen2015-02-111-6/+6
| | | | | | | | | | | | | | | | | | 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>
* Don't use QStringLiteral in comparisonsMarc Mutz2014-10-091-2/+2
| | | | | | | | | | | | | | For QLatin1String, operator== is overloaded, so comparing to a latin-1 (C) string literal is efficient, since strlen() is comparatively fast. OTOH, QStringLiteral, when not using RVO, litters the code with QString dtor calls, which are not inline. Worse, absent lambdas, it even allocates memory. So, just compare using QLatin1String instead. Change-Id: I7af3bf3a67c55dae33ffaf9922d004fa168a3f9c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-18/+10
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Add missing #include <qdatastream.h> or <qiodevice.h>Thiago Macieira2014-08-071-0/+1
| | | | | | | Lots of code depended on an indirect includes from qstringlist.h. Change-Id: I33d0dce33d64302d6c0e49180cc1249b90ab27c5 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Reduce QtCoreLib size by not repeating "UTC" string too often.Jędrzej Nowacki2014-07-251-1/+1
| | | | | | | | It is a minor reduction, in release build it is ~200 bytes Change-Id: I4f7972c95769f2e0ca1ddc935ff7a0a6b4379e2a Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* QTimeZone - Change from Olson ID to IANA IDJohn Layt2014-01-111-22/+22
| | | | | | | | Complete changes from using Olsen/Olson in the code to IANA. Completes a change started in 5.2 release branch on the public occurrences. Change-Id: Ib077fcda2c77eef6f04ec28901d8d2d7210b8c72 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Mark QTzType as Q_PRIMITIVE_TYPE.Sérgio Martins2014-01-081-0/+2
| | | | | | | | sizeof(QTzType) == sizeof(void*) on my platform, so it will benefit from the type info classification. Change-Id: I07146372da4381dba72da3718bc9c0b76a22b4fb Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* QTimeZone - Fix TZ file abbreviationsJohn Layt2013-11-211-98/+161
| | | | | | | | | | | | | | | | Fix parsing of TZ file abbreviations, to correctly return cases where POSIX rule doesn't have separate DST rules, and where abbreviation is a sub-string of another abbreviation, otherwise any toString() call will crash. Add test to exercise all available time zones, especially useful for TZ file to confirm all file format variations dealt with. Fix parsing of Version 3 of TZ file, and ICU display name, to allow all files generated from release 2013f to pass, otherwise isValid() call will crash. Task-number: QTBUG-34061 Change-Id: Ie0b6abc218adff1c8967eb33fdb0762041d2305f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTimeZone - Fix finding Linux System Time ZoneJohn Layt2013-10-151-2/+2
| | | | | | | Extract the correct length sub-string from the /etc/sysconfig/clock file Change-Id: I37b4f625a51b172ed11ecefbd1b7dc562c5bb89d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix warning about uninitialized variableLars Knoll2013-09-251-1/+1
| | | | | | Change-Id: I9c1a04556d4c77183d7025ca33314e7dfbf953ab Reviewed-by: John Layt <jlayt@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTimeZone - Add TZ File BackendJohn Layt2013-09-221-0/+917
Add a backend for TZ Files. If available uses ICU for the display names and translations, otherwise the abbreviation is used. Change-Id: I58c777462810b1a76ea7bd95886836b70b8a3db5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>