summaryrefslogtreecommitdiffstats
path: root/src/gui/text
Commit message (Collapse)AuthorAgeFilesLines
* Remove Q_STATIC_GLOBALxxx_OPERATOR macrosThiago Macieira2015-01-115-21/+17
| | | | | | | | | | These macros existed for working around an RVCT compiler bug, but since we stopped trying to work around it, the macros are no longer necessary. Change-Id: I76cc88d863b41f74f60cd9975dcc1959778c2740 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Merge "Merge remote-tracking branch 'origin/5.4' into dev" into refs/staging/devSimon Hausmann2014-12-303-34/+14
|\
| * Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-12-293-34/+14
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/tools/qbytearray.cpp src/gui/kernel/qplatformsystemtrayicon.cpp src/gui/kernel/qplatformsystemtrayicon.h src/plugins/platforms/xcb/xcb-plugin.pro Change-Id: I00355d3908b678af8a61c38f9e814a63df808c79
| | * QRawFont: improve the thread-safety checksGiuseppe D'Angelo2014-12-231-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 384388f2 introduced some checks, and used an assignment in an assert; that sets off compiler warnings about expressions with side effects into an assertion. Hence, that code needs to be reworked a bit. Unfortunately, there's no single define we can use to know if assertions are enabled or not in Qt, so simply use QT_NO_DEBUG to enable/disable those checks. The actual "thread" data member is kept around to avoid break ABI depending on debugging flags. Change-Id: I8b07e7ff6f81359d6b0653a1d9cc2b720541d1b9 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
| | * Remove unused code from QFontEngineFT.Rafael Roquetto2014-12-182-33/+0
| | | | | | | | | | | | | | | | | | | | | | | | This method is not being called anywhere. Change-Id: Ia32e8b48d324e4848db666de4d274a260d22b06d Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* | | Set the minimum required FreeType version to 2.1.10Konstantin Ritt2014-12-291-50/+19
| | | | | | | | | | | | | | | | | | | | | | | | ...and get rid of workarounds for older versions, which also makes the code more readable. Change-Id: I087110c5f60cd664dad241776e1a0df901989c75 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | | Minor improvement to Qt-HB bridging codeKonstantin Ritt2014-12-291-12/+12
| | | | | | | | | | | | | | | | | | | | | Replace C-style cast with static_cast for casts from void*. Change-Id: I4d6c602037e70afe2746a179a31fea4c5043c3d5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | | Report font tables are R/O blobsKonstantin Ritt2014-12-291-1/+1
| | | | | | | | | | | | | | | | | | | | | There is no point in modifying font tables, so mark them RO for clarity. Change-Id: I8ddbda9ace9c5a0eeabc0c5e5f64558060b5ee69 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | | [Docs] Don't propose using deprecated QFont:: rawName()/setRawName()Konstantin Ritt2014-12-291-8/+4
|/ / | | | | | | | | Change-Id: I333417b1340a56d782316c2c3628f63a504153ab Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | [QFont] Don't build datastream helpers with QT_NO_DATASTREAMKonstantin Ritt2014-12-241-3/+1
| | | | | | | | | | Change-Id: Id70491c07f5cf13d5f78ec0fc94ffd2b3134ff20 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* | Make it obvious we never expect QFontDatabase::Any to be supportedKonstantin Ritt2014-12-231-1/+1
| | | | | | | | | | | | | | | | | | This also unbreaks matching for scripts not covered by qt_script_for_writing_system(). Change-Id: Iddf015281a57a9dbae2e09f0408359441b020df8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* | Re-use cached font engines when request only differs in scriptKonstantin Ritt2014-12-231-2/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When looking for engine of non-Common script and lookup in the font cache failed, first check if we have already loaded that engine for the same request but different script. In general, this gives an arbitrary font engine a chance to be re-used multiple times when request only differs in script, which saves a LOT of memory (~10MB on my win7, after scrolling the QFontComboBox'es list). Change-Id: I9c752ce65c27142237a0ed74b33742b6a8d90a24 Reviewed-by: Pierre Rossi <pierre.rossi@theqtcompany.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* | [QFontDatabasePrivate] Drop unused `fallbackFamilies` memberKonstantin Ritt2014-12-231-5/+1
| | | | | | | | | | | | | | | | It is probably a refactoring left-over. Change-Id: Ic6f1e1a87c8603f600cd1736cf12c03ef0188074 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
* | [QFontDatabase] Don't look for best foundry twiceKonstantin Ritt2014-12-231-1/+1
| | | | | | | | | | | | | | | | | | In case the foundry name was empty and foundry lookup has failed, don't look for *any* foundry since it does exactly the same as previous call. Change-Id: I2a81949df06c31e1ae6999a6bbbe973408d4b814 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Pierre Rossi <pierre.rossi@theqtcompany.com>
* | Simplify QFontDatabase::load() a bitKonstantin Ritt2014-12-211-19/+15
| | | | | | | | | | | | Change-Id: Iaf7db1eb542db1ea0f2ca6c83282961bf4341243 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Merge remote-tracking branch 'origin/5.4' into devSimon Hausmann2014-12-183-34/+44
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.h src/platformsupport/platformcompositor/qopenglcompositor.cpp src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp tests/auto/gui/kernel/qwindow/tst_qwindow.cpp Change-Id: I5422868500be695584a496dbbbc719d146bc572d
| * Fix possibly corrupted log clusters when using custom tab stopsEskil Abrahamsen Blomfeldt2014-12-151-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The calculateTabWidth() can trigger shaping of the item, which can cause the layout data to be reallocated, so we need to update the local pointers to it, like we do when we explicitly invoke the shaper. [ChangeLog][Text] Fixed problems with text layout when using custom tab stops. Task-number: QTBUG-43126 Change-Id: Ifaeeeb4bfb1a55e6638b12b444f53d2679d3d1e6 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
| * Make QRawFont usage safer in a multi-threaded environmentKonstantin Ritt2014-12-133-34/+39
| | | | | | | | | | | | | | | | | | | | QFontEngine must be accessed amd deleted only in a thread in which it was instantiated, so we remember that thread and check if it hasn't been changed every time we access the engine. Change-Id: I28bc0394ced9cbd437dc950d35ffcbd99cfa7152 Reviewed-by: Pierre Rossi <pierre.rossi@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | [QStaticTextItem] Drop unused membersKonstantin Ritt2014-12-142-41/+8
| | | | | | | | | | | | | | | | | | The QStaticTextItem's `chars` and `numChars` members are never used, even when set. In fact, there is nothing useful we can do with the input string in the absence of clusters mapping. Change-Id: I81fcbce3e575f4d0dcfc2515286d512b858f592b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | QTextDocument QRegExp search cleanupSamuel Gaist2014-12-121-10/+6
| | | | | | | | | | | | | | Code cleanup and improvement Change-Id: Id4eac84dd31976797403c9acfa40c8d3337c6988 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | QTextDocument QRegularExpression search cleanupSamuel Gaist2014-12-121-9/+6
| | | | | | | | | | | | | | Code cleanup and improvement Change-Id: I04109e6eaa24e90e24ba89957adca32281d077dc Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Add QFont::Weight enum valuesPierre Rossi2014-12-126-44/+82
| | | | | | | | | | | | | | | | | | | | And try to make good use of them in order to match the QFont request more closely. Task-number: QTBUG-38482 Change-Id: I768dfa8828e370d77a1c17ecf4796d750b3edd9b Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.4' into devSimon Hausmann2014-12-102-8/+16
|\| | | | | | | | | | | | | | | Conflicts: doc/global/template/style/online.css mkspecs/android-g++/qmake.conf Change-Id: Ib39ea7bd42f5ae12e82a3bc59a66787a16bdfc61
| * Fix loading of web fonts with broken hinting bytecodeAllan Sandfeld Jensen2014-12-042-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Fira Sans font by the Mozilla Foundation has bytecode that goes into an infinite loop. Fortunately FreeType catches the case, but we fail to render any glyphs and spends too long trying the bytecode on every glyph. This patch instead switches the font to auto-hinting when this error is encountered. Task-number: QTBUG-41034 Change-Id: Icd044b41396a06fb435bc189cdbd71d703107de6 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
| * FreeType: Fix font rendering with fonts with embedded bitmapsSérgio Martins2014-12-041-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only reproduced with Windows font Calibri. This font has both outline (vector) and bitmap glyphs. QFontEngine_FT has an hack to get metrics from EBLC table, but this might fail, resulting in a 0 ascender and descender, meaning QFontMetrics::height() will be 0, meaning totally broken text. This patch checks for that failure, and fallbacks to the outline metrics instead of the bitmap ones. Task-number: QTBUG-42898 Change-Id: If33fc3404d0c7f84557f8c4a5ae71b30f78d60a7 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
| * QFontEngine_FT: Don't check for null after dereferencing.Sérgio Martins2014-12-021-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | Must have been a copy paste mistake, the check is used in other places to make sure we don't unlockFace() without a lockFace(), but here we're certain lockFace() was called first. Makes Coverity happy. Change-Id: I679129727b29a40d780f4fa903f44f7cbc9ec8cf Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
| * Fix build due to source incompatible change with FreeType 2.5.4Sérgio Martins2014-12-021-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=b3500af717010137046ec4076d1e1c0641e33727 ../gui/text/qfontengine_ft.cpp: In member function ‘QFontEngineFT::Glyph* QFontEngineFT::loadGlyph(QFontEngineFT::QGlyphSet*, uint, QFixed, QFontEngine::GlyphFormat, bool) const’: ../gui/text/qfontengine_ft.cpp:1126:39: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] for (int x = 0; x < slot->bitmap.width; x++) { Change-Id: Idb58f9e5895aac8c02163870d7c7d4a49237086b Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* | Fix regression introduced by 8e3fdf13543f43d7a4cb4fa41fKonstantin Ritt2014-12-091-1/+6
| | | | | | | | | | | | Task-number: QTBUG-42963 Change-Id: Iaf2677a967ef424a3b781cdb2d3194d0e0e55333 Reviewed-by: aavit <eirik.aavitsland@theqtcompany.com>
* | Add Q_DECL_OVERRIDE in the src subdirectoryOlivier Goffart2014-12-0310-140/+140
| | | | | | | | | | | | | | | | | | | | Done automatically with clang-modernize on linux (But does not add Q_DECL_OVERRIDE to the function that are marked as inline because it a compilation error with MSVC2010) Change-Id: I2196ee26e3e6fe20816834ecea5ea389eeab3171 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix assertion introduced in 8e3fdf13543f43d7a4cb4fa41f7279f9a5d274d3Konstantin Ritt2014-11-291-4/+4
| | | | | | | | | | | | | | | | It is clear from the commit itself that `m_engines[1]` isn't accessible after `m_engines.resize(1)`. Change-Id: I7b3977cca3f3aeaabadb5ff4f3e52a418022123c Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
* | Use special value SMOOTH_SCALABLE where appropriateKonstantin Ritt2014-11-291-3/+2
| | | | | | | | | | | | | | | | It is the same as USHRT_MAX but mentioning a special value makes the code more readable. Change-Id: I91063e472a6130ceb47f866344709786e4b05f20 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | QTextDocument: Don't use QRegExp for string search overloadsSamuel Gaist2014-11-271-8/+68
| | | | | | | | | | | | | | | | | | Currently both find function with QString input uses QRegExp under the hood. This patch aims to use only QString search facility to allow the proper disabling of QRegExp Change-Id: I3525fd0e969eced635f3d98feb54eb6a05950d8f Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-11-275-106/+38
|\| | | | | | | Change-Id: Id20053d261b4fbbcc0ac8ba49dd3ef2253fa4b95
| * Deprecate implementations of functions deprecated in headersShawn Rutledge2014-11-272-1/+4
| | | | | | | | | | | | | | | | | | If you build with configure -DQT_NO_DEPRECATED this will avoid some build errors. Change-Id: If2b2e57b6919091f3f077ebc2aeca0c3fd2421aa Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
| * QDistanceField: a zero glyph index means the glyph was not foundShawn Rutledge2014-11-251-1/+1
| | | | | | | | | | | | | | | | | | | | In qt_fontHasNarrowOutlines, if we proceed to call alphaMapForGlyph when the glyph does not exist, there will be a failed assertion. The docs for FT_Get_Char_Index say that zero means the glyph was not found. Change-Id: I371e9a2797a34fa3ebeae44531af51e24dadad79 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
| * [QStaticText] Fix potential font engine leakingKonstantin Ritt2014-11-251-3/+8
| | | | | | | | | | | | | | | | Never assume the engine is still cached but rather delete it if we are the last consumer. Change-Id: I4e3c796d45c53f42722a437482d71e2dae14cad2 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
| * Get rid of some duplicate code in QFontEngineFTEskil Abrahamsen Blomfeldt2014-11-251-101/+25
| | | | | | | | | | | | | | | | | | | | | | This removes some code duplication in the QFontEngineFT and it also removes the condition that loadTransformedGlyphSet() will return 0 if the font is too large to be cached, since this is handled by setting outline_drawing on the glyph set which will fall back to painter paths. Change-Id: I2fe6a963e854cdd7c6015154547dc06325cbe3b0 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Add missing QT_NO_REGEXP guard to search functionsSamuel Gaist2014-11-262-0/+5
| | | | | | | | | | Change-Id: I651243ad5dcdd0dcef20f12f37769bf8c45ae3c5 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | QFontDatabase: Fall back to "Any" writing system if none matchesUlf Hermann2014-11-261-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The scriptForWritingSystem array has significantly fewer entries than QChar::Script. It can easily happen that we don't find a writing system for a given script. In that case, just assume any writing system can be used. This fixes an out-of-bounds array access resulting from the writing system index being one-past-end if std::find doesn't find a match. Change-Id: Ic277be1dad71af42d479e70e0b4bf29a7dc8d0a7 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
* | Merge QFontEngineMultiBasicImpl and QFontEngineMultiKonstantin Ritt2014-11-265-135/+110
| | | | | | | | | | | | | | Minor refactoring also improves the behavior and the code readability. Change-Id: Id89dd224f4132a4c0dfbc16f414ef42cc8d8a4da Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-11-2410-55/+130
|\| | | | | | | | | | | | | | | | | | | | | | | 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 failure to build QtQuick with LTOThiago Macieira2014-11-232-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | The presence of the inline QTestFontEngine's constructor causes a linker failure because QFontEngineBox isn't exported. I'd say this is a compiler bug (GCC 4.9), but it's an easy workaround and a difficult testcase. typeinfo for QTestFontEngine: error: undefined reference to 'typeinfo for QFontEngineBox' vtable for QTestFontEngine: error: undefined reference to 'QFontEngineBox::glyphIndex(unsigned int) const' Change-Id: I84829d111616977d6f3fcbbb48509d1c7d4f5fa6 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
| * Merge remote-tracking branch 'origin/5.4.0' into 5.4Frederik Gladhorn2014-11-215-15/+9
| |\ | | | | | | | | | Change-Id: I95f235a66ce2e9b1fa435c0f911c6f7e811755f0
| | * Fix hb_face leaking in QFontEngineFTKonstantin Ritt2014-11-153-8/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since HarfBuzz-old's HB_Face doesn't support ref-counting, it is impossible to keep the same behavior as for NG's ref-counted hb_face when we're going to reparent the data of unknown type in QFontEngineFT. We should either not release the object returned by harfbuzzFace(), or introduce ref-counting for HB-old's HB_Face. Stop referencing HB-NG's objects on access for now and thus avoid a need to release them manually. Task-number: QTBUG-42674 Change-Id: Ia21e7ba9c17185796b0dd98c2c27d02566f2a701 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
| | * Revert "Fix fallbacks for adapted common script"Eskil Abrahamsen Blomfeldt2014-11-133-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts 1dd9a0af4f577ccb5578cea562a98686c8e290e6. It was a band-aid for a change in the unicode itemizing algorithm which caused the script of a script item to become unreliable. This change has since been reverted, so the band-aid is no longer needed, and it also causes problems for WebKit on Windows when it ends up preferring Arial Unicode MS as the font for Uchen script, even though the font does not support this script. The autotest from the reverted commit is kept in place and still passes. [ChangeLog][Text] Fixed regression when rendering Uchen text in WebKit on Windows. Change-Id: I488c84703bb55a050d90092c6bf9e5c70a9e31c2 Task-number: QTBUG-41372 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
| * | Enable transformations for Qt Quick in FT engineEskil Abrahamsen Blomfeldt2014-11-202-11/+67
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Qt Quick (or in Qt Widgets when setting QT_NO_FT_CACHE to 1 or when using OpenGL engine), the alphaRGBMapForGlyph() will be used to get glyphs, because we need to keep our own cache. Transforms was not supported in this code path, instead it was turned off in supportsTransformations(). This patch enables transformations in the alphaRGBMapForGlyph() and alphaMapForGlyph() code paths as well, since this is needed for proper rendering with QT_DEVICE_PIXEL_RATIO. Change-Id: I7d6b79918f7c0bcc051a8343b16b315bfbba59cf Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
| * Fix loading 2x images in Rich Text DocumentsMihailNaydenov2014-11-071-26/+41
| | | | | | | | | | | | | | | | | | There are some issues preventing 2x images from loading, mainly incorrect testing for exist() by passing an url, which always reports ‘false’. Task-number: QTBUG-36383 Change-Id: I1e8e5a91b01f1a4ddd3559c2e860db5bc41908ce Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
| * Fix justification in multi fontengine glyphrunsAllan Sandfeld Jensen2014-10-281-2/+4
| | | | | | | | | | | | | | | | | | | | QTextLine::glyphRuns was not handling justification when splitting glyphRuns due to multiple font-engines. This patch adds the missing justification. Task-number: QTBUG-41901 Change-Id: I02d24218630506da21531a6499784dff2eecdf6f Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
| * fix crash when dropping a file into an empty QTextEditJoerg Bornemann2014-10-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | Since commit be0bfe09ee4b99e9ab45c6898949b5d144e77a29 we return -1 in QTextEngine::findItem if the item cannot be found. Calling code must be prepared for this case. Otherwise we run into an out-of-bounds vector access later on. Task-number: QTBUG-42103 Change-Id: Ie338cd1fc3cf0ce1e8edfa59dead635669020a33 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* | Make the empty Q_ASSERT still check its argument for validityThiago Macieira2014-11-011-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>