summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qtranslator.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.4' into devSimon Hausmann2014-12-101-8/+12
|\ | | | | | | | | | | | | | | Conflicts: doc/global/template/style/online.css mkspecs/android-g++/qmake.conf Change-Id: Ib39ea7bd42f5ae12e82a3bc59a66787a16bdfc61
| * Fix warnings by MSVC 64 in qtranslator.cpp.Friedemann Kleint2014-12-051-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | kernel\qtranslator.cpp(880) : warning C4267: 'initializing' : conversion from 'size_t' to 'const uint', possible loss of data kernel\qtranslator.cpp(881) : warning C4267: 'initializing' : conversion from 'size_t' to 'const uint', possible loss of data kernel\qtranslator.cpp(882) : warning C4267: 'initializing' : conversion from 'size_t' to 'const uint', possible loss of data kernel\qtranslator.cpp(975) : warning C4267: 'initializing' : conversion from 'size_t' to 'const int', possible loss of data Task-number: QTBUG-39757 Change-Id: I54f130e1d83ecc1623ab3c7b9b4fb14de6351625 Reviewed-by: Albert Astals Cid <albert.astals@canonical.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
| * Don't make invalid assumptions about memcmp()Albert Astals Cid2014-12-041-8/+12
| | | | | | | | | | | | | | | | In qtranslator.cpp match() Task-number: QTBUG-39757 Change-Id: I49e3ccc0ce900564bbe14609bfda47688382d5f3 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-11-241-3/+2
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qiodevice.cpp src/plugins/bearer/linux_common/qofonoservice_linux.cpp src/plugins/bearer/linux_common/qofonoservice_linux_p.h src/plugins/platforms/android/qandroidplatformtheme.cpp src/tools/bootstrap/bootstrap.pro src/widgets/styles/qmacstyle_mac.mm Change-Id: Ia02aab6c4598ce74e9c30bb4666d5e2ef000f99b
| * Fix incorrect documentation from QTranslator::loadAki Koskinen2014-11-051-3/+2
| | | | | | | | | | | | Task-number: QTBUG-27506 Change-Id: I1b2d4ed2242efd52258c7f587c2121f9dde18a0d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* | Make the empty Q_ASSERT still check its argument for validityThiago Macieira2014-11-011-0/+1
|/ | | | | | | | | | | | | | | | | | | | | With the side-effect that variables and functions in the argument are now "used". This means we don't need to #ifndef functions only used in assertions: the compiler will eliminate them by dead code elimination. Due to the mandatory short-circuiting of the condition, no functions will ever be called and this expands to no more code than before. On the negative side, because we won't get warnings for unused variables initialized outside the Q_ASSERT, non-inlineable calls will not be elminated by dead code elimination, so they will remain in release code without warnings. Because of the expanded code now in Q_ASSERT, the Intel compiler's optimizer gets thrown: it complains that the non-void function is failing to return anything, so I had to add two return statements. Change-Id: I1bb79c9637a2771ef1ec093f901b8d2443788bd6 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Doc: Fix description of QTranslator::translate()Kai Koehne2014-10-231-0/+5
| | | | | | | | | | | If the translations are incomplete it's actually not ensured that a translation without disambiguation is used: lrelease will drop the disambiguation from one of the identical messages if there is no message which actually has no disambiguation ... Task-number: QTBUG-30471 Change-Id: I1787f5c401a7afb964acbf8a8609ba328c8140a9 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Doc: recommend using QLocale for loading translationsLeena Miettinen2014-04-161-0/+6
| | | | | | | | | | | Users can choose to use different UI languages and regional settings on their devices. QTranslator::load(const QLocale &) function uses QLocale::uiLanguages() and not to the locale name, which refers to the formatting of dates and numbers. Change-Id: Iec6327dd1e91d913176499b23482d725b9d0a8aa Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-5/+5
| | | | | | | | | | | | | | | | | Default values should have mark-up to denote that they are code. This commit changes: -"property is true" to "property is \c true". -"Returns true" to "Returns \c true". -"property is false" to "property is \c false". -"returns true" to "returns \c true". -"returns false" to "returns \c false". src/3rdparty and non-documentation instances were ignored. Task-number: QTBUG-33360 Change-Id: Ie87eaa57af947caa1230602b61c5c46292a4cf4e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Doc: QTranslator::translate() isn't an overload anymoreDavid Faure2013-06-191-2/+0
| | | | | | Change-Id: Ib50044da48be3fb4f43300aa285e15403bd8d65e Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QtBase: Doc: Replacing link with snippet in QTranslator.David Schulz2012-12-051-3/+3
| | | | | | | | Because the linguist examples are moved to qttools module, a link to the hellotr example broke. Change-Id: I2aeefc143578618396f5be38ed1d52afdd1f7436 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
* QTranslator: Use resource memory instead of copying itThomas McGuire2012-11-021-35/+66
| | | | | | | | | Previously, translations in resource files were loaded through QFile and the data was copied. Now, simply use the resource memory in-place. Change-Id: I55a06c1e7bb15c169cc69b908b3021136beac9d2 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Add parameter documentation.Frederik Gladhorn2012-10-161-1/+1
| | | | | Change-Id: I8ce85bbb286c3cb844ef600daa5e99432ee55b74 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Core: Fix gcc warning about signed/unsigned integer comparisonKai Koehne2012-09-181-1/+1
| | | | | | | Fix warning: 'comparison between signed and unsigned integer expressions' Change-Id: I5ce2857115137f9a06eddc74fda55ae49e37d345 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Add \inmodule QtCore to all QtCore class doc bodiesThiago Macieira2012-08-231-0/+1
| | | | | Change-Id: I19100755c97cc155c76a859e19940e9f9222d34e Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Misc documentation fixes triggered by qdoc errors/warningsShawn Rutledge2012-08-201-3/+3
| | | | | Change-Id: I6ca3b138114fe957a09e8ec2f22273865635fc8b Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
* Fix more qdoc errorsLars Knoll2012-08-201-6/+6
| | | | | Change-Id: Ieed340068327f37ea0f549d24ea49235994118f4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix a couple of qdoc errorsLars Knoll2012-08-181-1/+0
| | | | | Change-Id: I79f689e08ed4a496052529af38fca72c3d4e04cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Enable modularization of translation files.Jan-Arve Saether2012-07-121-17/+60
| | | | | | | | | | | | | | | | | This is accomplished by introducing dependencies to catalogs. This requires one API change: QTranslator::load(const uchar *, int); changes to QTranslator::load(const uchar*, int len, const QString &directory = QString()); Since now, even the load from memory might need a directory if the memory block contains a qm file with dependencies. Change-Id: I781f333d07f53bb431d0a7b5fa1abe282dc4d338 Task-number: QTBUG-26138 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Doc: Prepare for building modular QtCore docs.Casper van Donderen2012-04-191-1/+1
| | | | | | | | | | | | This change fixes most qdoc errors in QtCore. There are about 900 left. The main thing this change does is moving documentation from qtcore from /doc/src to /src/corelib/doc. Other issues resolved are mis-use of qdoc commands. Change-Id: I002d01edfb13575e8bf27ce91596a577a92562d1 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Jerome Pasion <jerome.pasion@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>
* Clean up and make robust the file loading codeJoão Abecasis2012-03-281-37/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The used_mmap variable was set to true the first time an mmap operation was successful, but it was never reset back to false. While that can be a good indicator that future calls might succeed it is not a guarantee. Not properly resetting could mean we'd unmap memory allocated with new, instead of deleting it. Since that variable is only used inside defined(QT_USE_MMAP) blocks, its declaration is scoped the same way. While mmap is still handled "by hand", use QFile for the other operations. Calling mmap here is less than ideal, as it prevents use of other memory mapping methods, such as native Windows APIs, but is less intrusive as it allows QTranslator to retain control over lifetime of the map. Using QFile for remaining operations reduces the number of filesystem operations. The file size is now checked to be minimally sane (<4GB), the limit of the 32-bit variable that will hold mapping's length. Translation files should be expected to be much smaller in practice, but there isn't a sane hard-limit. The file format is broken down to sections, each of which has a 32-bit length. Finally, when loading a file fails, release resources immediately, instead of delaying to next load attempt or the destructor. Change-Id: I5cc1b626a99d229e8861eb0fbafc42b928b6a122 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Fail when no translations found, reset pointers on failureJoão Abecasis2012-03-281-0/+14
| | | | | | | We don't want to be using or trusting partial loads. Change-Id: I3934d6cf54cd99eaab2fa7aee9a0e9968d9f3c13 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Use Big-Endian conversion functions from qendian.hJoão Abecasis2012-03-281-6/+4
| | | | | | | | These avoids repeating code and documents that the underlying format is compacted big-endian. Change-Id: I5a2dc0084945d99368183203a0a9b7c116874620 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Remove unused argumentJoão Abecasis2012-03-281-7/+1
| | | | | | | | | The mode argument (third argument to (_)open) is only used when (_)O_CREAT is also specified. As we're opening the file read-only it is unused and unnecessary. Change-Id: Icc16edec5a7d44c57ad02865048c56114c39d4bc Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* There's no need to check pre-validated inputJoão Abecasis2012-03-281-8/+6
| | | | | | | | elfHash and friends are used solely from do_translate, which already checks for null strings. There's no need to do it again here. Change-Id: I90a16d2623ca753a444e53952539001988568bdb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Use accumulating hash, instead of allocating intermediate stringJoão Abecasis2012-03-281-4/+17
| | | | | Change-Id: Ie93ac8df3066159ad11ff7f68c7ba85e7f5aa8bc Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Avoid overflow in boundary checkJoão Abecasis2012-03-271-1/+1
| | | | | Change-Id: I4f397795a65d5d6ea237a6751588a8dc6be15bdc Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Remove the usage of deprecated qdoc macros.Casper van Donderen2012-03-021-28/+28
| | | | | | | | | | | 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>
* Remove Symbian specific code from QtCore.Xizhi Zhu2012-01-301-2/+2
| | | | | Change-Id: I131303e28a12dccb96de3de4ca0073b389a9bbae Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* 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>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove stale documentation and fix qdoc errors.Casper van Donderen2011-10-111-6/+0
| | | | | | | Change-Id: I51bb0c52eb32d9d672d115f31b16d414f81708e2 Reviewed-on: http://codereview.qt-project.org/6433 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
* merge translate() overloadsOswald Buddenhagen2011-09-211-21/+4
| | | | | | | | Change-Id: I58f0d2c2ec6da751860a90096c49c662658643c1 Reviewed-on: http://codereview.qt-project.org/5164 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com> Reviewed-by: hjk <qthjk@ovi.com>
* Remove the remaining QT3_SUPPORT code in corelibLars Knoll2011-06-291-12/+0
| | | | | | | Change-Id: I6641c62d75d2034a46ea7cc869ae65285ae8b8f4 Reviewed-on: http://codereview.qt.nokia.com/866 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Liang Qi <liang.qi@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
* Doc: Applied pending fixes to API documentation.David Boddie2011-05-231-4/+4
|
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+979
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