Commit Graph

241 Commits

Author SHA1 Message Date
Liang Qi
b9585277e7 Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts:
	src/corelib/tools/qlinkedlist.h
	src/plugins/platforms/wasm/qwasmintegration.cpp
	src/plugins/platforms/wasm/qwasmscreen.cpp

Change-Id: Iefca7f9f4966bdc20e7052aca736874861055738
2020-02-18 09:26:53 +01:00
Edward Welbourne
1c0b69eac5 Only read the first BOM as a BOM; the rest are ZWNBS !
QUtf32::convertToUnicode() was forgetting to set headerdone when it
dealt with the header (for contrast, Utf16::convertToUnicode() does).

Fixes: QTBUG-62011
Change-Id: Ia254782ce0967a6cf9ce0e81eb06d41521150eed
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-02-14 19:13:37 +01:00
Allan Sandfeld Jensen
ece0c0a5e7 Tidy nullptr usage
Move away from using 0 as pointer literal.

Done using clang-tidy. This is not complete as
run-clang-tidy can't handle all of qtbase in one go.

Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-12-06 12:13:20 +01:00
Thiago Macieira
31e94dc96c QGb18030Codec: fix out-of-bounds access when decoding surrogate pairs
This is already the second surrogate of the pair, there's no need to +
+i.

Fixes: QTBUG-80268
Change-Id: Ia2aa807ffa8a4c798425fffd15d9a48ee0ca8ed7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-11-26 05:08:28 +01:00
Marc Mutz
a6ffdbe30c QTextCodec: try to work around an ICC 19 bug
ICC 19 barfs on the TextCodecsMutexLocker class because it doesn't
have a user-provided default ctor:

  ../../corelib/codecs/qtextcodec.cpp(543): error #854: const variable locker requires an initializer -- class TextCodecsMutexLocker has no user-provided default constructor
  [...]

But the class doesn't have members that would delete the
implictly-declared default ctor, so no user-provided default ctor
should be necessary:

The only member is the result of qt_unique_lock(), which is
std::unique_lock, which does have a default ctor.

We conclude that this is a compiler bug, and work around it with the
introduction of a user-provided default ctor.

Fix brace placement as a drive-by.

Fixes: QTBUG-78844
Change-Id: I1f5a326afd68138fbebad506ba9aa1926f1afb85
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-10-07 08:18:53 +02:00
Liang Qi
6a36fe904c Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts:
	src/corelib/codecs/qicucodec.cpp
	src/dbus/qdbusserver.cpp
	src/gui/painting/qbezier.cpp
	src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
	src/plugins/printsupport/cups/qppdprintdevice.cpp

Change-Id: I2703128bb64baf5580fbc2c2061b55b0f0611d2a
2019-09-04 07:03:54 +02:00
Allan Sandfeld Jensen
7595a02b57 Fix building with -no-feature-codecs
Change-Id: Ifce31a5ef07101f5ef8aabbc81b42eee47153961
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-08-20 11:54:49 +02:00
Tasuku Suzuki
8240c24866 Fix build without feature.codecs
Change-Id: I7113928c686319f132e6306f6925da009e8f41b1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-08-20 02:44:10 +09:00
Marc Mutz
743fdd3fe7 QTextCodec: port to QRecursiveMutex
Write a local mutex locker for DRY. Use qt_unique_lock(Mutex*) because
we do not intend to add a QRecursiveMutexLocker and by Qt 6, the
current work-around where QMutexLocker works for QRecursiveMutex, too,
will be gone.

Could have used qt_scoped_lock, because no premature unlock() calls
are present, but it turns out the code attempts to take the mutex
after it's destroyed by Q_GLOBAL_STATIC, so we need QMutexLocker
compat, thus qt_unique_lock(Mutex*) instead of qt_scoped_lock(Mutex&).

Need to use decltype and using because auto doesn't work for NSDMs.

Change-Id: I8b0f8a3067f0a412279d075cb959105e485789cd
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-08-13 17:26:07 +02:00
Thiago Macieira
a5da01c044 Remove useless null pointer checks
Cache can't be null, since it's a member of an extant object.

Change-Id: Id98140e1c2f0426cabbefffd157ed3cdd62a8bba
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2019-07-16 17:34:56 -08:00
Qt Forward Merge Bot
77d126ccb5 Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
	configure.pri

Also required s/solid\.color/solidColor/ in a couple of places in:
	src/gui/painting/qpaintengine_raster.cpp

Change-Id: I29937f63e9779deb6dac7ae77e2948d06ebc0319
2019-07-12 12:23:29 +02:00
Marc Mutz
60ca2f5f7c Be less laissez-faire with implicit conversions to QChar
QChar currently is convertible from nearly every integral type. This
is bad code hygiene and should be fixed come Qt 6.

The present patch is the result of compile fixes from marking these
constructors explicit. As is clear from the distribution of fixes,
only low-level string handling code used these implicit conversions,
an indication that they're not in widespread use elsewhere.

Change-Id: Ief5336f21e6d181e03ab92893b3d13a14adc7cb0
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-07-09 07:09:44 +02:00
Marc Mutz
fc95af3621 QSimpleTextCodec: fix load memory order of atomic pointer
The pointer value is not the only data we're interested in, but
instead points to indirect data, so we need a release fence on store
(present) and a corresponding acquire fence on load (was missing).

Change-Id: I51f8251c0c7f4056192880430f2be5e0836dbed6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 6f84829031)
(cherry picked from commit 4cc6e1419294a729e53d698bace2254903c1429b)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-07-08 18:52:43 +00:00
Marc Mutz
6f84829031 QSimpleTextCodec: fix load memory order of atomic pointer
The pointer value is not the only data we're interested in, but
instead points to indirect data, so we need a release fence on store
(present) and a corresponding acquire fence on load (was missing).

Change-Id: I51f8251c0c7f4056192880430f2be5e0836dbed6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-06-21 22:56:50 +02:00
Giuseppe D'Angelo
34fe9232db Port from QAtomic::load() to loadRelaxed()
Semi-automated, just needed ~20 manual fixes:

$ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)load\(\)/$1loadRelaxed\(\)/g' -i \{\} +
$ find \( -iname \*.cpp -or -iname \*.h \) -exec perl -pe 's/(\.|->)store\(/$1storeRelaxed\(/g' -i \{\} +

It can be easily improved (e.g. for store check that there are no commas
after the opening parens). The most common offender is QLibrary::load,
and some code using std::atomic directly.

Change-Id: I07c38a3c8ed32c924ef4999e85c7e45cf48f0f6c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2019-06-20 20:48:59 +02:00
Christian Ehrlicher
69f6cab0af Doc: replace even more null/0/nullptr with \nullptr macro
Try to replace all wordings like '.. to 0' with '.. to \nullptr'. Also
checked for 'null pointer' and similar.

Change-Id: I73341f59ba51e0798e816a8b1a532c7c7374b74a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-05-08 12:48:32 +00:00
Qt Forward Merge Bot
f80b7995f3 Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: Ia7328524f2cd9d5995ac8705f0fe0bf570b2e831
2019-04-04 01:00:07 +02:00
Venugopal Shivashankar
05d9195669 Doc: Use the \nullptr macro instead of 0
This enables overriding the macro so that it translates
to 'None' in the Qt for Python context.

Change-Id: Ib3cecf57eeb0405a1929309b71e9f012a07f11cf
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2019-04-02 08:14:07 +00:00
Allan Sandfeld Jensen
b4ead57250 Move away from using 0 as a pointer constant
Cleans up most of corelib to use nullptr or default enums
where appropriate.

Change-Id: Ifcaac14ecdaaee730f87f10941db3ce407d71ef9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-06-07 17:19:16 +02:00
Christian Ehrlicher
fed9fa1714 Doc: replace 0 with \nullptr in documentation
Replace some more 0 with \nullptr.

Change-Id: I2af91bf3712eef5161b11da0c44614bc039ade03
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-03-13 10:57:25 +00:00
Alessandro Portale
e1d42a40a2 Add missing "override" specifiers
Annotate this function with 'override' or (rarely) 'final'
[modernize-use-override]

Change-Id: If31ab03b46f885e4984ba3aaaf1ad8d46aae9d9c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2019-02-13 12:23:48 +00:00
Liang Qi
980567b3a3 Merge remote-tracking branch 'origin/5.12' into dev
Conflicts:
	src/android/templates/AndroidManifest.xml
	tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp

Change-Id: I4c9679e3a8ebba118fbf4772301ff8fde60455b9
2019-01-26 08:35:40 +01:00
Liang Qi
0e96b5fe48 Merge remote-tracking branch 'origin/5.12' into 5.12.1
Conflicts:
	src/widgets/kernel/qtooltip.cpp

Change-Id: Ic2f9a425359050eb56b3a4e5162cf5e3447058c8
2019-01-08 09:34:24 +01:00
Liang Qi
03039979b5 Merge remote-tracking branch 'origin/5.12' into dev
Also blacklist tst_QRawFont::unsupportedWritingSystem() and
tst_QGlyphRun::mixedScripts() on windows for now.

 Conflicts:
	qmake/generators/makefile.cpp
	src/corelib/itemmodels/qstringlistmodel.cpp
	src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h
	tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp
	tests/auto/gui/text/qglyphrun/BLACKLIST
	tests/auto/gui/text/qrawfont/BLACKLIST

Task-number: QTBUG-72836
Change-Id: I10fea1493f0ae1a5708e1e48d0a4d7d6b76258b9
2019-01-04 07:33:14 +01:00
Nico Vertriest
9636a43abc Doc: Update page Tamil Script Code for Information Interchange
Task-number: QTBUG-56668
Change-Id: I173d73ef5e9b08e865cb75fa03849665fcda652e
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2019-01-02 09:42:59 +00:00
Oswald Buddenhagen
52934d74be configure: modernize iconv use
use library objects for all variants, and inline the tests.

Change-Id: I029f9a6655a783dab4a22abf601aadbb484c03af
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2018-12-19 19:22:16 +00:00
David Schulz
9ce4260d23 QWindowsLocalCodec::convertToUnicode(): Fix remaining char conversion
Prevent passing a zero argument to the cbMultiByte parameter of
MultiByteToWideChar. According to the documentation this will always
fail.

This is triggered when calling convertToUnicode with a state having
remainingChars of one and a length of one. The remaining chars will be
completed and the length will be reduced to zero before the actual
convert.

Adding an early return after the completion to prevent calling
MultiByteToWideChar with the invalid zero argument.

Fixes: QTCREATORBUG-21622
Change-Id: Ic6a433dd929e97b1681583cb1b9a347afaa9a09f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-12-13 05:36:03 +00:00
Qt Forward Merge Bot
ad4f359f80 Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I0fe623517af28e408b642c879efd59f633ab63ac
2018-12-13 01:00:11 +01:00
Thiago Macieira
2c6ec2c653 Fix tautological compare in error checking
size is size_t, so it's never less than zero.

Fixes: QTBUG-72286
Change-Id: Idd0c85a4e7b64f9c9c7dfffd156d404d0de5ed8d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2018-12-12 16:30:20 +00:00
Edward Welbourne
4da0c669d3 QTextCodec::codecForLocale(): clarify and update documentation
Change-Id: If3eec8cfc90cadcbd418807891ccf19b796f4006
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-12-06 19:13:35 +00:00
Lars Knoll
b98c43ea60 Compile with QT_STRICT_ITERATORS defined
This will be the only options for Qt 6, so make sure the code compiles now.

Change-Id: I23f791d1efcbd0bd33805bb4563d40460954db43
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-11-26 07:04:24 +00:00
Liang Qi
bc07958f92 Merge remote-tracking branch 'origin/5.11' into 5.12
Conflicts:
	.qmake.conf
	qmake/Makefile.unix
	src/gui/text/qtextdocument.cpp
	src/gui/text/qtextdocument.h

Change-Id: Iba26da0ecbf2aa4ff4b956391cfb373f977f88c9
2018-11-09 10:34:33 +01:00
Thiago Macieira
99baa0d440 Optimize QTextCodec::codecForUtfText a little
Instead of doing byte comparisons, let the compiler do 16- and 32-bit
comparisons on its own.

Change-Id: If7e743cf8476463880ccfffd155f8629991b0b87
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-11-08 15:19:55 +00:00
Thiago Macieira
66a2d15907 QTextCodec: update the docs for codecForUtfText
It can detect the standard UTF codecs, but not non-standard like
UTF-7[1], UTF-9 or UTF-18[2].

[1] https://tools.ietf.org/html/rfc2152
[2] https://tools.ietf.org/html/rfc4042

Fixes: QTBUG-67188
Change-Id: If7e743cf8476463880ccfffd155f853dc947421a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2018-11-08 15:19:53 +00:00
Thiago Macieira
570ef11c28 QUtf8Codec: Use one 32-byte load instead of two 16-byte ones on AVX2
The number of instructions is the same. But if the CPU can issue
32-byte-wide loads, this will be faster. For CPUs that would do two
16-byte loads, this is no worse than current code.

Change-Id: I8f261579aad648fdb4f0fffd1553d060b4fc852f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2018-11-08 15:19:50 +00:00
Liang Qi
825f988156 Modernize the "textcodec" feature
Also clean up QTextCodec usage in qmake build and some includes
of qtextcodec.h.

Change-Id: I0475b82690024054add4e85a8724c8ea3adcf62a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-11-07 13:19:54 +00:00
Edward Welbourne
ceeecbae51 Update various qt_attribution.json files
Marking various as final because no upstream is known or available.
Listing versions of others, where I was able to discover them.
Updated a stale link (that helpfully redirected).

Task-number: QTBUG-70008
Change-Id: Id00f34827133c560735c68793b4f1353f2b2ca85
Reviewed-by: Tobias Koenig <tobias.koenig@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2018-11-02 13:48:35 +00:00
Liang Qi
ccf26f6a88 Merge remote-tracking branch 'origin/5.11' into 5.12
Conflicts:
	src/plugins/platformthemes/platformthemes.pro
	src/printsupport/kernel/qplatformprintdevice.cpp

Change-Id: Iac01729ad954bb1c7af5867d982eb243b2139ee6
2018-10-17 10:35:28 +02:00
Liang Qi
9c8ca26a48 Modernize the "codecs" feature
Change-Id: Idee19112581bff64a2e0b8e331dd3d779aca165b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-10-12 14:26:27 +00:00
Liang Qi
4e7b58629a Modernize the "big_codecs" feature
Change-Id: Ic23f4a1f81a21711cd81aaa2942b493aca5b38b8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2018-10-12 14:26:22 +00:00
Thiago Macieira
7e1a0c0739 Add tests for decoding too-short UTF-8 sequences
We were handling this properly, but not testing them. I guess we weren't
testing because the condition is a valid intermediate state, so
hasFailure() is correct it returning false.

Testing inspired by the bug reported in
https://github.com/intel/tinycbor/issues/137

Change-Id: Ib47c56818178458a88b4fffd1554ecfdd0af637e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-09-25 22:14:07 +00:00
Morten Johan Sørvig
29c0377f07 WebAssembly for QtBase
This is the squashed diff from wip/webassembly to dev.

Done-with: Peng Wu <peng.wu@intopalo.com>
Done-with: Sami Enne <sami.enne@intopalo.com>
Done-with: Morten Johan Sørvig <morten.sorvig@qt.io>
Started-by: Andrew Knight <andrew.knight@intopalo.com>
Change-Id: I6562433c0a38d6ec49ab675e0f104f2665f3392d
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2018-08-30 06:48:33 +00:00
Alessandro Portale
01e57909d4 Add a few overrides in Qt Core
Clang-tidy says:
  warning: annotate this function with 'override' or (rarely) 'final'
  [modernize-use-override]

Change-Id: Ic2304cf35f4132ba1f55714493db93836f8b413d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-08-05 18:56:58 +00:00
Thiago Macieira
e79b56e504 Improve the UTF-16 and UTF-32 codecs with <qendian.h>
This is just the low-hanging fruit. Those algorithms could be much
further improved, but they are so seldom-used that it's not worth it.

Change-Id: I6a540578e810472bb455fffd15332b2a7a1ac901
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2018-07-04 03:04:43 +00:00
Igor Mironchik
03ab94b0e7 Deregister QTextCodec on destruction
QTextCodec automatically deregisters on destruction now.

[ChangeLog][QtCore][QTextCodec] QTextCodec automatically
deregisters on destruction now.

Task-number: QTBUG-56203
Change-Id: Ic9a66c512642c9913aa27ea5167b9f7341e7f0fe
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-05-26 18:50:24 +00:00
Thiago Macieira
1e95a07a5c QString: insert a number of 8-character SIMD loops
We don't have _mm_cvtsi64_si128() (the REX.W expansion of MOVD [0F 6E]),
but we do have _mm_loadl_epi64(), the SSE2 expansion of the MMX MOVQ at
opcode 0F 7E. Ditto for _mm_cvtsi128_si64() and _mm_storel_epi64(). And
those work even in 32-bit mode. By doing this, we can reduce the tail
unrolled loops by half, reducing code size.

I'm not adding these new SIMD sections to -Os builds.

Change-Id: Ib48364abee9f464c96c6fffd152e405310ef67be
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2018-05-15 23:07:11 +00:00
Thiago Macieira
40ccf98188 QUtf8: add AVX2 code for isValidUtf8
Change-Id: I5d0ee9389a794d80983efffd152d2beca86c5779
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2018-05-15 23:04:56 +00:00
Thiago Macieira
a16d0074b9 QUtf8: Add some UTF-8 text operation functions
The first, isValidUtf8(), as the name says, returns true if the string
is valid UTF-8. As a bonus, it also returns whether it's valid US-ASCII.

The other two are meant to compare an UTF-8 string to either a Latin1
one or an UTF-8 one, without memory allocation.

Change-Id: Ic38ec929fc3f4bb795dafffd150ad0d63e28cd32
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-02-03 21:31:57 +00:00
Jake Petroules
cd542a82b0 Remove references to obsolete platforms
ultrix and reliant have not seen a release since 1995. dgux not since
2001. bsdi not since 2003. irix not since 2006. osf not since 2010.
dynix... unclear, but no later than 2002. symbian needs no mention.
All considered obsolete, all gone.

sco and unixware are effectively obsolete. Remove them until someone
expresses a real need.

Change-Id: Ia3d9d370016adce9213ae5ad0ef965ef8de2a3ff
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2017-11-05 06:33:53 +00:00
Kevin Funk
58c14c4a7e Replace Q_NULLPTR with nullptr where possible
Remaining uses of Q_NULLPTR are in:
src/corelib/global/qcompilerdetection.h
  (definition and documentation of Q_NULLPTR)
tests/manual/qcursor/qcursorhighdpi/main.cpp
  (a test executable compilable both under Qt4 and Qt5)

Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-09-19 11:53:55 +00:00