summaryrefslogtreecommitdiffstats
path: root/src/corelib/codecs/qtextcodec.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Make QTextDecoder use our qt_from_latin1 codeThiago Macieira2014-02-221-5/+5
| | | | | | | | | | | | Disassembly shows the Intel compiler does expand to SIMD, but a much worse code than ours. Clang 3.4 does generate a compact SIMD version, probably of the same quality as our hand-written code. And GCC 4.7 through 4.9 don't generate SIMD at all. So let's use the most efficient version. Change-Id: I418e201a774ac0df1fb2b7a7d9589df7c9b655db Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-2/+2
| | | | | | | | | | | | | | | | | 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>
* Ensure that the user codecs are listed in QTextCodec::availableCodecsThiago Macieira2013-07-211-4/+4
| | | | | | | | | Codecs registered by creating new QTextCodec instances should be listed there. Task-number: QTBUG-32500 Change-Id: I56c00e0d6bbfef55a6cbd571bcf9aa2cf333ef3a Reviewed-by: David Faure <david.faure@kdab.com>
* Remove use of 'register' from Qt.Stephen Kelly2013-06-171-2/+2
| | | | | | | | | | It is deprecated and clang is starting to warn about it. Patch mostly generated by clang itself, with some careful grep and sed for the platform-specific parts. Change-Id: I8058e6db0f1b41b33a9e8f17a712739159982450 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix regression when pasting into QTextEdit from Firefox.Mitch Curtis2013-05-231-1/+3
| | | | | | | | | | Return the codec if one was found by QTextCodec::codecForUtfText, instead of returning the default (UTF-8). Task-number: QTBUG-31293 Change-Id: I95e3260376c00537006b7fbfdc3df5850e1ba657 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Introducing the Qt Android portPaul Olav Tvete2013-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | | Based on the Necessitas project by Bogdan Vatra. Contributors to the Qt5 project: BogDan Vatra <bogdan@kde.org> Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> hjk <hjk121@nokiamail.com> Oswald Buddenhagen <oswald.buddenhagen@digia.com> Paul Olav Tvete <paul.tvete@digia.com> Robin Burchell <robin+qt@viroteck.net> Samuel Rødal <samuel.rodal@digia.com> Yoann Lopes <yoann.lopes@digia.com> The full history of the Qt5 port can be found in refs/old-heads/android, SHA-1 249ca9ca2c7d876b91b31df9434dde47f9065d0d Change-Id: Iff1a7b2dbb707c986f2639e65e39ed8f22430120 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Correctly detect HTML 5 charset attribute in QTextCodec::codecForHtml()Mitch Curtis2013-02-121-15/+17
| | | | | | | | | | | | | | | | | | | | | | | | | QTextCodec::codecForHtml currently fails to detect the charset for this HTML: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=9,chrome=1"> <title>Test</title> </head> This patch makes the detection of charsets more flexible, allowing for the use of the HTML 5 charset attribute as well more terminator characters ("'", and ">"). I also added a *_data function for the unit tests. Task-number: QTBUG-5451 Change-Id: I69fe4a04582f0d845cbbe9140a86a950fb7dc861 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Denis Dzyubenko <denis@ddenis.info>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Avoid warnings about an unreachable codeKonstantin Ritt2012-10-101-2/+2
| | | | | Change-Id: I57c2967db4c1bd2c39ecb3eac9b18eb7455c6a50 Reviewed-by: Lars Knoll <lars.knoll@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>
* checkForCodecs is not used when QT_LOCALE_IS_UTF8 is definedJiang Jiang2012-09-021-1/+1
| | | | | | Change-Id: I3d82863cbd123dbf73eb8f5721ef9294e6365de6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Doc: Add \inmodule QtCore to all QtCore class doc bodiesThiago Macieira2012-08-231-0/+3
| | | | | Change-Id: I19100755c97cc155c76a859e19940e9f9222d34e Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Make the "\internal" qdoc command stand on its own lineLaszlo Papp2012-08-151-2/+4
| | | | | | | | | | The qdoc manual currently claims that the command must stand on its own line. The change follows the consistency with the rest and how the example looks like inside the qdoc manual for this command. Change-Id: I6b653dc95cf9d84e4adf32220dace5d313678419 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Make sure codecForLocale returns a valid codec in bootstrap modeJan-Arve Saether2012-08-061-1/+1
| | | | | | | | | This was a regression caused by acbfb4d777474aadd2813614108, causing for instance qdoc to crash. Change-Id: Id8daa19d467c4f1729e5a5a203a388f16ec4a6de Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* ICU: lock the mutex before calling an Unlocked functionThiago Macieira2012-08-041-0/+2
| | | | | | | | | | | | | The QIcuCodec::defaultCodecUnlocked function is not thread-safe because it calls codecForNameUnlocked. In turn, that one accesses and even modifies a QHash stored in the QCoreGlobalData singleton, which is what makes it non-threadsafe. In order to call the Unlocked function, we need to lock the mutex first. Change-Id: I915570110229f4c0929986aa26731244317ef6ab Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* ICU: Mark which functions are threadsafe and which ones aren'tThiago Macieira2012-08-041-3/+10
| | | | | | | | | | | | | Mark the thread-safe functions with the \threadsafe doc marker. This includes public API, which should be thread-safe anyway. The thread-unsafe functions are marked "\nonreentrant" already. In addition, I renamed the functions that must be called with locked mutexes to Unlocked, following the convention in other libraries like libdbus-1. Change-Id: Ibd93d1266149767f546c8e82959b73c138008469 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Small doc fixes about the list of supported codecs.Lars Knoll2012-07-311-3/+3
| | | | | Change-Id: I98b8ec9d5de9e69f1bb6187b4d820d61f7ce03e5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Do not preload any codecs anymore when using ICULars Knoll2012-07-311-23/+26
| | | | | | | | | When using ICU we can now avoid pre loading any codecs at startup. Instead QTextCodecs will always be created lazily when first asked for. Change-Id: Ic668f2824700896d2eca7d0de54f978404826163 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use ICU instead of iconv/windows codecs for the localeLars Knoll2012-07-311-13/+12
| | | | | | | | With ICU there's no need to use the windows locale or iconv codecs anymore as locale codecs. Change-Id: I50c94a97ed6acbf4c6f05b2a88593a57ebfa8342 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make codecForLocale atomicLars Knoll2012-07-311-36/+35
| | | | | Change-Id: I8017b1c2aa1df8d613e83919a945fd5f320713d6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* ICU code page conversion supportLars Knoll2012-07-311-7/+46
| | | | | | | | | | | | | Use ICU to do code page conversion instead of the builtin text codecs. With this QTextCodec simply becomes a wrapper around ICU's ucnv_* methods. We only keep our own codecs for UTF-*, ISO-8859-1, ISO-8859-15 for performance reasons, and for TSCII and iscii-* because they aren't supported by ICU. Change-Id: I4fc49eba55cf772b9772c6dac606a47a44346a60 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Disable iconv on utf-8 based platformsLars Knoll2012-07-311-1/+1
| | | | | | | | | There's no need to use iconv on Mac, iOS, Android or QNX, as all these platforms are fully utf-8 based. Change-Id: I2a03c8dea72ad91f6ec83da0a838de20e46babef Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Use utf-8 as the locale codec where it makes senseLars Knoll2012-07-311-6/+8
| | | | | | | | | Use utf8 as the fallback codec in case we can't determine something else instead of latin1. Also use utf8 for Mac, iOS, Android and QNX. Change-Id: I15dc85d2406b1ebdfacff25f45f8b6854c52b97e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove encoding detection according to LANGLars Knoll2012-07-311-142/+0
| | | | | | | | | This code is left over from the 90's, and should not get used anymore. In all relevant cases we will use UTF-8 or iconv nowadays. Change-Id: Ie3776f671de33f782fa77f6359bf6e105bd9c1b8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move the text codec list to qcoreglobaldata.Lars Knoll2012-07-311-193/+89
| | | | | | | | | | | This removes some global statics in QTextCodec and makes the code better to maintain in the longer term. Remove QT_NO_THREAD defines around mutexes as this isn't required in Qt 5 anymore. Change-Id: I15ede75f53b16f134f4053f3188c4b47e86fcd8a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Move the windows locale codec into it's own fileLars Knoll2012-07-231-217/+8
| | | | | | | | | Simple cleanup, that will make it easier to refactor the code to use ICU. Change-Id: I7486f36d27b8c521cf970327eb94b2236338d4ec Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
* Remove the font codecsLars Knoll2012-06-251-15/+0
| | | | | | | | These codecs have only been used for XLFD based fonts. These are not supported anymore by Qt 5. Change-Id: I7dc083f2efcd42363b144b24bd62c169d83390cf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* disable codecs for asian language when QT_NO_BIG_CODECS definedTasuku Suzuki2012-06-141-20/+15
| | | | | Change-Id: I45025b13bacc5f63946b02a87c742beff1946c0b Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* QtCore: remove \link usagesGiuseppe D'Angelo2012-05-291-2/+2
| | | | | Change-Id: I0de764b51a972de0b6eb2bf3c04d2b190f581f52 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Avoid using iconv for text conversion where possibleLars Knoll2012-05-161-34/+27
| | | | | | | | | | | | Try to use a builtin codec as codecForLocale() if possible first. Fall back and instantiate the iconv codec only if that failed. In addition, make sure we initialize the locale correctly before we try to setup the codec. Change-Id: I86d635f9d11e8ff93093f162e79fb37f3d85731b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add Android to conditionals around langinfo.h usage.Robin Burchell2012-05-041-3/+5
| | | | | | | | Despite being mandated by POSIX, Android does not support this. Change-Id: I3da42ff9b3336cb6657692a9eb70dd3118ac1756 Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Prepare for building modular QtCore docs.Casper van Donderen2012-04-191-3/+3
| | | | | | | | | | | | 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>
* Fixes mismatching delete operatorRafael Roquetto2012-03-091-1/+1
| | | | | | Change-Id: Ib6640daa0fdd12f98f9d7e257c226e0abdcf31dc Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Fixes potential memory leak in qtextcodec.cppNick Ratelle2012-03-081-17/+9
| | | | | Change-Id: I56c0a1a6cc261bd15653bc4cbb94daed1f8aa811 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Remove codecForTr().Robin Burchell2012-03-061-37/+0
| | | | | | | | | | Similarly to change id I2f429fa7ef93bd75bb93a7f64c56db15b7283388, the capability to arbitrarily alter the encoding of literals is very destructive, especially in a world with libraries and plugins. Change-Id: If0d4cd8dcf89792e39c1984cbde6b036cebfc02f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Merge remote-tracking branch 'origin/api_changes'Lars Knoll2012-03-041-3/+3
|\ | | | | | | | | | | | | | | | | | | Conflicts: dist/changes-5.0.0 mkspecs/features/qt_module_config.prf qmake/project.cpp qmake/property.cpp Change-Id: I6e4af40743a9aeff8ed18533a48036e332acc296
| * Merge master -> api_changesRohan McGovern2012-02-291-29/+1
| |\ | | | | | | | | | | | | | | | Includes fixes for tst_qfiledialog2, tst_qtextedit autotests on mac. Change-Id: I49cac26894d31291a8339ccc1eb80b6a940f0827
| * | QByteArray: deprecate QT_NO_CAST_FROM_BYTEARRAY-protected operatorsMarc Mutz2012-02-261-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QByteArray::operator const {char,void}*() implicit conversions are a source of subtle bugs, so they right- fully can be disabled with QT_NO_CAST_FROM_BYTEARRAY. const char *d = qstring.toLatin1(); // implicit conversion while ( d ) // oops: d points to freed memory // ... But almost no-one ever enabled this macros in the wild and many were bitten by these implicit conversions, so this patch deprecates them. I would have liked to remove them completely, but there are just too many occurrences even in Qt itself to hope to find all conditionally-compiled code that uses these. Also fixes all code that needs to compile under QT_NO_DEPRECATED (in qmake/, src/tools/). I984706452db7d0841620a0f64e179906123f3849 separately deals with the bulk of changes in src/ and examples/. Depends on I5ea1ad3c96d9e64167be53c0c418c7b7dba51f68. Change-Id: I8d47e6c293c80f61c6288c9f8d42fda41afe2267 Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | | Remove the usage of deprecated qdoc macros.Casper van Donderen2012-03-021-43/+43
| |/ |/| | | | | | | | | | | | | | | | | | | 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 custom text codec for C strings.Robin Burchell2012-02-221-29/+1
|/ | | | | | | | | | This setting is extremely harmful, as code cannot know whether or not to expect it. It also made the behaviour of QString::fromAscii and ::toAscii unintuitive, and caused a lot of people to make mistakes with it. Change-Id: I2f429fa7ef93bd75bb93a7f64c56db15b7283388 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Windows: Fix inclusion of <windows.h>Friedemann Kleint2012-02-011-2/+5
| | | | | | | | | | | | | - Always use <qt_windows.h> as the last file to be included. - Remove it from some headers, use Qt::HANDLE instead of HANDLE. - Clean up #ifdef, use Q_OS_WIN for Windows/Windows CE. - Add NOMINMAX to qt_windows.h to avoid problems with the min/max macros. - Remove <windows.h> from qplatformdefs.h (VS2005) Change-Id: Ic44e2cb3eafce38e1ad645c3bf85745439398e50 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@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>
* remove obsolete codec plugin loading codeMark Brand2012-01-201-85/+2
| | | | | | Change-Id: I1f3dbb5c10009413f701947b1b89ed3dbc94bf3d Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* move plugin text codecs to QtCoreMark Brand2012-01-201-7/+7
| | | | | | | | | | | | | | | | | | | | Having plugin text codecs adds considerable complexity to configuring Qt. The plugin interface is designed for optional features, but text codecs tend to be used for essential functions. A dramatic example is loading a codec plugin from a file whose path needs to be converted by the codec. Codec plugins can also be a nuisance to builders of applications linking to static Qt. This is because the application might need to explicilty import the static codec plugins which are actually dependencies of QtCore. For these reasons, it has been decided not to have text codec plugins any longer. Change-Id: Ic6c80a9c949bd42e881e932d1edae23fe4fe4c88 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* build and load text codecs regardless of iconv and platformMark Brand2012-01-201-9/+5
| | | | | | | | | | | | | | Otherwise applications linking to static Qt may have to import the static plugins to avoid linking failure even if they do not use the codecs, which is a nuisance. Also, this is preparation for moving these codecs into QtCore proper. Change-Id: I71f3bbb0bac6261983143d0578757b34997d1364 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge the makeEncoder/Decoder overloads.Lars Knoll2012-01-161-23/+0
| | | | | | Change-Id: I9fdeeafe08dd70c0ab9ce26a2fce3b8d803ca280 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* remove symbian support vestiges from text codecsMark Brand2012-01-141-36/+5
| | | | | | | Change-Id: I7b577d360cb9c7225da108ee56fd927a91a04dee Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Remove all non-inline of qMalloc/qFree/qRealloc.Robin Burchell2012-01-061-1/+1
| | | | | | | | | | | | 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>