Compare commits

...

314 Commits
dev ... 5.12

Author SHA1 Message Date
Kai Köhne
8c47a86eec Replace CopyrightFile entry in libjpeg qt_attribution.json
CopyrightFile is only supported by qtattributionsscanner since
version Qt 6. This amends commit 804288cab3

Pick-to: 5.15
Change-Id: I57fa7f9cfb32ed98a26306bf88f7d02ef46224cf
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2021-12-07 08:34:31 +00:00
Tor Arne Vestbø
1d5a2e924b macOS: Compute NSWindow background color without checking styleMask
The check for styleMask == NSWindowStyleMaskBorderless to decide whether
to clear the NSWindow background was broken, as NSWindowStyleMaskBorderless
has the value 0, but is only supposed to be compared to its companion
NSWindowStyleMaskTitled (with value 1). A window can perfectly well be
NSWindowStyleMaskBorderless and NSWindowStyleMaskMiniaturizable e.g.,
so by comparing directly to NSWindowStyleMaskBorderless instead of
masking to the first bit first we ended up making miniaturizable
windows non-translucent.

We now check the Qt::FramelessWindowHint directly, and also whether
the window is opaque. Ideally we'd have QWindow flags that could
plumb WA_NoSystemBackground from Qt Widgets, as well as a background
color property on QWindow to control the system background, but
in the meantime we'll have to use the FramelessWindowHint heuristic.

The QWidget docs have been updated to reflect this.

Task-number: QTBUG-95042
Change-Id: I0d40eecace60883c205ebb8c76cef1092cdf1144
(cherry picked from commit 2f6d572dad031d2757a0f307cba56ae7b01c390a)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-11-01 13:06:30 +00:00
Liang Qi
13811a19d6 xcb: avoid to use invalid pointers
Task-number: QTBUG-96399
Change-Id: I33909940b501cb13f78981c43f3aef9fc9d1d52d
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit e0938223c4b5966b94893276ba36c9b0493168c7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-10-22 21:30:19 +00:00
Eirik Aavitsland
81998f50d0 Refix for avoiding huge number of tiny dashes
Previous fix hit too widely so some valid horizontal and vertical
lines were affected; the root problem being that such lines have an
empty control point rect (width or height is 0). Fix by caculating in
the pen width.

Change-Id: I7a436e873f6d485028f6759d0e2c6456f07eebdc
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 84aba80944a2e1c3058d7a1372e0e66676411884)
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-10-22 10:48:25 +02:00
Eirik Aavitsland
9378ba2ae8 Improve fix for avoiding huge number of tiny dashes
Some pathological cases were not caught by the previous fix.

Fixes: QTBUG-95239
Change-Id: I0337ee3923ff93ccb36c4d7b810a9c0667354cc5
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
(cherry picked from commit 6b400e3147dcfd8cc3a393ace1bd118c93762e0c)
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-10-22 10:48:21 +02:00
Eirik Aavitsland
7f345f2a1c Avoid processing-intensive painting of high number of tiny dashes
When stroking a dashed path, an unnecessary amount of processing would
be spent if there is a huge number of dashes visible, e.g. because of
scaling. Since the dashes are too small to be indivdually visible
anyway, just replace with a semi-transparent solid line for such
cases.

Change-Id: I9e9f7861257ad5bce46a0cf113d1a9d7824911e6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit f4d791b330d02777fcaf02938732892eb3167e9b)
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2021-10-22 10:48:16 +02:00
Jani Heikkinen
5a620689c4 Bump version
Change-Id: Ia05e0d77e8998cae8c0149b9e112b646d4f6ae57
2021-10-04 11:41:46 +03:00
Samuel Thibault
4a6a0e13ea Accessibility Linux: Fix caps lock state
Currently in QSpiApplicationAdaptor::eventFilter, the
ATSPI_MODIFIER_SHIFTLOCK flag (actually capslock modifier) only set when the
capslock key is kept pressed, not when the capslock modifier is enabled.

Orca however really needs to know the capslock modifier state, to be able to
properly determine whether to enable/disable capslock when the user presses
double-capslock.

Task-number: QTBUG-84225
Change-Id: I98ab8b7261c5560ebad49410b1358b2279080ec8
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit 6802065da8706f1fc298a56b9f66ab8a815400d3)
2021-09-30 15:06:56 +02:00
Andy Shaw
a268e8c4f7 SQLite: Update SQLite to v3.36.0
[ChangeLog][QtSQL][SQLite] Updated SQLite to v3.36.0

Change-Id: I05cde47b757455dfd438405bfba1818c7f6eec00
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b919fc8fd038bd04a88717269dce1fdf443af442)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-09-30 07:10:10 +00:00
Thiago Macieira
b3e0cdedc6 MySQL: treat the MYSQL_FIELD as read-only
The MariaDB-connector-c version 3.2 and MariaDB server version 10.6
cooperate to avoid re-transferring the query metadata, so the fact that
we were modifying it was causing it to improperly decode the DATETIME
data types into string, as we had asked. We ended up with a 7-byte
string that was actually the date binary-encoded.

References:
 - https://jira.mariadb.org/browse/MDEV-26271
 - https://github.com/MythTV/mythtv/issues/373
 - https://bugs.kde.org/show_bug.cgi?id=440296

Fixes: QTBUG-95639
Change-Id: I4a40ccbd3321467a8429fffd169afdbb26cf29f6
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 549ee216fd5bf2b3810e940bcbd4bbd8c64ac73f)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-09-29 10:46:19 -07:00
Thiago Macieira
ab4e78b435 QNetworkInterface: disable Netlink-based Linux support on Android
Android 11's SELinux rules block the RTM_GETLINK requests that
qnetworkinterface_linux.cpp needs to make. So disable this completely
and fall back on the older rimplementation. Bionic has some workarounds
in their getifaddrs() implementation to make this work.

Fixes: QTBUG-86394
Change-Id: I87447a0ecdee4dc7b506fffd163180c2b1db7835
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit e33d40a88476e8a9d4f950fb285c75d0c1a92a2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit c07eff7d9477a5a098c76fb2107d9f902c2999ac)
2021-09-29 07:35:43 +00:00
Eirik Aavitsland
daaf3a2eba Update the COPYRIGHT.txt file
With the contents from src/jversion.h

Change-Id: I3d4d2b40b3ed6576655b97b1709ee42c9c81ebe7
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit fbd3b00e0b342b9291ee5cb60d3611e3878c6a7a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-09-28 15:07:12 +00:00
Eirik Aavitsland
ec2f36c6b2 Update bundled libjpeg-turbo to version 2.1.1
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 2.1.1

Change-Id: I22a273018229aa35a175f9e903fa605a3eb55c32
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit a6a3b1e79cf9bd54434ccdb0851fe49f12004152)
2021-09-28 06:19:05 +00:00
Kai Köhne
508c39a3ae Fix license information for libjpeg-turbo
Fix the license metadata in that libjpeg contains parts under three
different bsd-like licenses. Also, do include the IJG, zlib
license texts in the metadata.

[ChangeLog][Third-Party Code] Clarified that libjpeg-turbo is actually
covered by three licenses, not only IJG.

Change-Id: I6c4e3e8577bdf83e7e73474b34b0553cbe1d9b6d
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 467b39d52c9ab59b1e7518330fbb51d5543ada50)
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2021-09-27 14:37:43 +00:00
Edward Welbourne
c364f22ac9 Fix corner case in QTimeZonePrivate::dataForLocalTime()
If the local time for which we want data is after the last known
transition, the two transitions we get to bracket it are the last
known and an invalid one. The code checked the former was valid, but
neglected to check the latter, leading to nonsense arithmetic later in
the function. In this situation we unequivocally want the last known
transition, so the problem is easily solved.

Fixes: QTBUG-96152
Change-Id: I6fc830ce538e8a572093cd8dfe832e10689bf904
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit b656cea5deccab352b7c4c56d7023f5108578654)
2021-09-23 10:11:35 +02:00
Edward Welbourne
e69ebaccf0 Make clear why QTestLog::addB?XFail() don't add to counters
This reverts commit 904617dfb83f39a6a379635b64fea6fcd00f241a and makes
clear to future readers why that wouldn't be a sensible change.
Update the test's data, eliminating a case of duplicate counting that
was caused by the reverted commit.

Task-number: QTBUG-95661
Change-Id: Ice6d3ab06ca171e0d6eb0fac757f1ab774e229f0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 7af79ba09148dbfe5c1fc8b130d564dcca7ae4b3)
2021-09-23 10:11:28 +02:00
Liang Qi
73fc1f93e8 xcb: add a timeout control when reading INCR property
For the first call of QXcbClipboard::clipboardReadProperty()
inside of clipboardReadIncrementalProperty() in getSelection(),
it will get a XCB_NONE reply before the contents arrived via
property change. Then we give a chance to read more.

Manually tested with following setups:
* examples/widgets/mainwindows/application with gvim(gtk3)
* examples/widgets/widgets/imageviewer with GIMP 2.10.18(based on
gtk2) and GIMP 2.99.6(based on gtk3 via flatpak)

Fixes: QTBUG-56595
Done-With: JiDe Zhang <zhangjide@uniontech.com>
Change-Id: Ib45f08464d39ad79137b1da99808c89b7dca2d08
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 02248eea5562c1df39ee23f195011afacc6759b0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-08-10 12:22:15 +00:00
Marc Mutz
1d8bcfbb55 QXpmHandler: actually limit characters-per-pixel to four
The following code assumed, and all comments indicated, that the cpp
variable was limited to a max of 4. Yet, as coded, cpp could be five,
in which case the XPM would be corrupt, as the header suggested five
characters-per-pixel while the data was formatted in only four.

Add a warning and error out when we encounter this situation.

[ChangeLog][QtGui][QImage] Instead of writing a corrupt file, rejects
to write XPM files with more than 64^4 colors (more than four
characters per pixel) now.

Change-Id: I458873cf7d179ab2e2dacd4c17dc837d640591a9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 71334c324e702c434d446e5fc329294c97b8516d)
2021-08-06 19:29:44 +00:00
Timur Pocheptsov
ada43d3d8c tst_QSslCertificate::verify - remove QSKIP
And re-generate certificates.

Fixes: QTBUG-95429
Change-Id: Id970a0a9315d146d6dd1e66c9cff9b7d75657e2d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit e7ab17ade170a8fbc5061fffe5334b26cdc54ed3)
2021-08-06 18:48:03 +02:00
Mike Achtelik
472548264f Android: Fix unnecessary clipboard data access
Android 12 introduced a notification which is shown to the user each
time the app accesses the clipboard via getPrimaryClip.
Currently this notification is triggered, even if we just want to check,
if some clipboard data exists.
So lets not get the actual data and instead use getPrimaryClipDescription
to check for the existence of the correct mime type in the clipboard.

Change-Id: I4800f5545ab46b7f6cade0ce9d78c04b50ae96cf
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 5a7f4c1f4964a4bf6595002478fbcd474cedd8a6)
2021-08-05 20:24:16 +02:00
Marc Mutz
419505ab01 QXpmHandler: fix re-entrancy bug in xpm_color_name
The xpm_color_name() function returned a pointer to a function-static
buffer. This is infamously non-reentrant, and an actual problem,
because we explicitly allow QImage operations (incl. saving to an
.xpm) from non-GUI-threads.

Fix by using the CSS pattern (Caller-Supplied Storage; also used in
the QAnyStringView(char32_t) and QAnyStringView(QStringBuilder) ctors)
to force the caller to allocate storage in its own stack frame. As a
consequence, we re-gain re-entrancy, but the returned pointer is now
only valid until the end of the full-expression, which isn't a problem,
as all callers immediately pass the result to a consumer (asprintf() or
QByteArray).

[ChangeLog][QtGui][QImage] Fixed a race condition when concurrently
writing .xpm files.

Change-Id: I36d7173d53839a52f5cdf58324474c1b32c71f33
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 73fabadcee71af858388fb245fccf4e96d4ead4e)
2021-08-05 11:05:04 +00:00
Timur Pocheptsov
5fa5013ddf tst_QSslCertificate::verify - skip auto-test
as a temporary fix for suddenly expired certificates situation (to
be regenerated).

Task-number: QTBUG-95429
Change-Id: I00ad11cfd8824eeeffa2991dfcda6a7899726953
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8d0e4a2e5c3627e2fd88f14ccc8b349668012685)
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-08-05 11:04:53 +00:00
Tor Arne Vestbø
1ea0397356 macOS: Don't mangle QByteArray settings with @ prefix by decoding as UTF-8
QSettings encodes QVariants as @Type(data) strings. If that data contains
a null-byte, we write the string as UTF-8 encoded CFData. When reading it
back we look for a @ prefix, and then pass it as UTF-8 through stringToVariant.

The problem arises then the user writes raw QByteArrays with a @ prefix.
We can detect this situation by checking the result of stringToVariant,
and if it's just a simple conversion of the string into a QVariant, we
know that stringToVariant hit its fallback path due to not finding any
embedded variants.

If that's the case, we return the raw bytes as a QByteArray.

Change-Id: I4ac5c35d0a6890ebea983b9aca0a3a36b0143de2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3eac6079d9a02fbedd3740186eaaf21134dc45c2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-07-12 23:00:01 +00:00
Liang Qi
0db58b62ee opengl: fix a typo in QOpenGLPaintDevice::dotsPerMeterY()
Fixes: QTBUG-95005
Change-Id: I88ab9b757a5cfee520e07ac6280e31f9211342f0
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 85831bcfe6ce36740c524d641ada79c65aadd89b)
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2021-07-06 20:44:47 +02:00
Marc Mutz
c5e45d735c QVarLengthArray: fix aliasing error in insert(it, n, v)
Taking the copy after the resize is completely pointless: the copy is
there to ensure that `t`, being a reference potentially aliasing an
element in [begin(), end()[ before the resize(), isn't invalidated by
the resize(), so it must be taken before resize().

Add a comment so the next rewrite doesn't cause this to be mixed up
again.

[ChangeLog][QtCore][QVarLengthArray] Fixed an aliasing bug affecting
insertions of objects aliasing existing elements.

Change-Id: I26bc449fa99bf8d09a19147a12a69ac4314cc61d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
(cherry picked from commit 6e57e41f9aef5ccfa122c10bc6253d47dafd93d2)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-06-29 08:11:07 +00:00
Tor Arne Vestbø
4034daa12e Enable glyph cache workaround for Apple M-family of GPUs
Without the workaround, and when using a Core GL profile, we hit a code
path in QSGOpenGLDistanceFieldGlyphCache::resizeTexture() that produced
corrupt glyphs on M1 hardware.

We fix this by enabling the workaround, so that the user doesn't have to
set QT_ENABLE_GLYPH_CACHE_WORKAROUND themselves.

None-Core contexts do not have this problem, but the logic in
QOpenGLContext does not account for recreated contexts with different
formats, so we can't limit the workaround to Core formats only.

With the unified memory architecture of the M1 hardware, the workaround
should have limited negative effects.

In Qt 6 this is not a problem, since Qt Declarative effectively always
uses the workaround code-path, but it's worth recording the fact that
we need the workaround.

Fixes: QTBUG-89379
Change-Id: Icfd8b8b23c0dcda3fea8663d81d0e225134eec5e
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit aeeaa7d253239b4b45e419bcad5cfde5c5714080)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-06-19 13:42:04 +00:00
Morten Johan Sørvig
069d509718 macOS: Allow programatically minimizing frameless windows
NSWindowStyleMaskMiniaturizable also controls programatic
minimize, in addition to the window decoration button.

Fixes: QTBUG-65637
Change-Id: Iac5fb483433441173d770f4fcfb9e93440b9fe6a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 556fbbea6e96c07c6cbd552c4179e5717e799acf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-09 14:22:21 +00:00
Tor Arne Vestbø
5333d5d8c5 qmake: Switch to using Xcode's new build system
Now that inputs (81152194) and outputs (3f0858ed) are explicitly set for
the preprocess stage we can enable the new build system.

Using the legacy build system will produce a build error in Xcode 13,
but the build will succeed:

  error: The Legacy Build System will be removed in a future release.
  You can configure the selected build system and this deprecation
  message in File > Project Settings.

Fixes: QTBUG-71035
Change-Id: I108d2103872255d10de2ff5161eef892065da1c4
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 3d7bdf0d61699cb7fdfcef7fe7b546e3167723b2)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-08 15:28:57 +00:00
Giuseppe D'Angelo
07b690bcdb SQLite driver: fix crash when binding a QByteArray/QString
Passing SQLITE_STATIC to sqlite3_bind_*() means that ownership
of the data stays in the caller, i.e. SQLite itself doesn't make a copy;
such data must be therefore be kept valid until sqlite3_step() is called.

The code in the SQLite driver uses that option to avoid copying byte
array or string data. But, unlike what the comments in the code say, we
do NOT keep the QByteArray/QString alive long enough: they're contained
by a temporary QVariant object which gets destroyed at the end of the
loop that binds each argument.

Luckily the fix is simple: since that QVariant is just a copy of the
QVariants used as bound parameters, and these are held in a container
(which lives long enough), simply create a reference to the container's
elements rather than a copy. This ensures that the data is alive by
the time sqlite3_step() is called.

This problem doesn't normally appear because of implicit sharing of
QByteArray/QString. When the QVariant is copied, the inner element
is just a shallow copy. Getting the pointer to the data, and destroying
the QVariant, does not destroy the data (it's kept alive by the
QByteArray/QString inside the *copied-from* QVariant).

Of course there's a catch: if the *copied-from* QVariant contains a
QString created via fromRawData, then everything blows up. In this case,

1. the copied QVariant is created (which bumps the QString refcount)¹
2. the QString inside of it is accessed directly (via
QVariant::constData)
3. utf16() is called on that string, which detaches it (!)
4. the result of utf16() is passed to SQLite, with SQLITE_STATIC
5. the copied QVariant is destroyed; this destroys the inner QString,
which, being detached, deallocates the data too early.
6. sqlite3_step() is called, kaboom.

(The copied-from QVariant still has the string created by fromRawData.)

¹ Note that QString uses the Small QVariant Optimization, so the QString
object itself into the QVariant is copied, it's not just a *QVariant*
refcount increase.

Change-Id: Idcdb192809f1f8f79b4a901e1247f933eb06e854
Fixes: QTBUG-94070
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 0f38259cb3aee5cce5a2af99af3f69712c9f1123)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-06-01 10:57:32 +00:00
Allan Sandfeld Jensen
c35d186774 Cherry-pick upstream patch for non-gcc/clang/msvc compilers
Fix build w/ non-GCC-compatible Un*x/Arm compilers

Fixes: QTBUG-93779
Change-Id: Ib52e9ded6e2814c7998d6cd798e945da0f87f7a1
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 4341f6763b8a737ebc07bb78ead22bc05a1a515b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-18 15:11:26 +00:00
Andy Shaw
d2adbb338c iOS: Accessibility: Set the correct traits for EditableText
Since the correct accessibility traits for EditableText are not
available as a direct enum value, then we depend on the defaults for a
UITextField to give us this information.

Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Fixes: QTBUG-93494
Change-Id: If428414aec5ce571f0f8c0ecccffdbaf1c908120
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 08cd5580df382af5ddfe1c0c44bc9dd68e4cd1e7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-14 10:49:23 +00:00
Andy Shaw
3ae80cfa8e SQLite: Update SQLite to v3.35.5
[ChangeLog][QtSQL][SQLite] Updated SQLite to v3.35.5

Change-Id: I7e1f5a4b6eb48d9f6105d7f08b35a2c62fc79660
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 75d8623752e67a39e2ee04e5233dc502e63a17f1)
2021-05-14 07:22:14 +02:00
Eirik Aavitsland
e071eb1302 Avoid overflowing QFixed in text layout
Fixes: QTBUG-89172
Change-Id: Icb78c8eeb1dbe4c5d4c6476beebafc0115a91e8c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 36ccbee34e89d185918a2925444dac11211e5c60)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-10 19:33:31 +00:00
Eirik Aavitsland
781b55b24e Gracefully reject requests for absurd font sizes
Avoid overflows.

Fixes: QTBUG-89899
Change-Id: Ic1a83c1704fe20be3d032358dc91ee8e751f2281
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 679750684087cad7a48921c4174a53cdf4855049)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-10 19:33:25 +00:00
Eirik Aavitsland
eeedebf33e Update bundled libjpeg-turbo to version 2.1.0
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 2.1.0

Change-Id: I82a58609120923c18f6031fec7d597138ec473ee
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 127f617387c00139dddbfc9438ab032e24559566)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-10 19:33:18 +00:00
Eirik Aavitsland
29b0669784 QVnc: clip requested screen region to available screen image
Avoid potential oob memory access.

Fixes: QTBUG-91770
Change-Id: I34fff1cf8dec5275572a027288b0e8310359d9f8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit c494c1e8754ed13b409133196d9db00bf7e0f2b5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-10 11:18:05 +00:00
Eirik Aavitsland
19fedbafb5 Simplify bundled libjpeg build
Move the config headers of the bundled libjpeg back into its source
directory, where they originally live, to avoid having to trick with
the include path to find them.
The goal is unification across maintained Qt branches, making version
updates simpler.

Change-Id: I5b574446bbd264b0a1cb3efceb4c1cb7203cac7d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 5df88b85c6e61409c5c759e78f32edaac7b2022f)
2021-05-10 13:17:23 +02:00
Andy Shaw
d55a3eb57e iOS: Accessibility: Don't cut off the last character from the text value
The second parameter is the position of the first character not to be
returned when calling text(). So it needs to be passed the length of
the text, otherwise the last character is cut off.

Task-number: QTBUG-93494
Change-Id: I7dd8324b3939220de125ba819b7b77588b21bd4b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 5c29f981fa069907678f961cf58ecefd64bf268b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-05-07 18:59:13 +00:00
Christoph Keller
8edba37d54 Explicitly set input files for qtpreprocess
This fixes build errors with Xcode 10.
Xcode 10 build system (a.k.a "New Build System") needs to know the input files
in order to build a correct dependency graph. Especially when a build is not run
for the first time and files changed in-between.

Task-number: QTBUG-71035
Change-Id: If8fbad3a1915add9b35c79131b03cdbe6b7ac06d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 8115219407fdbe7c01e97c76ccf3aa48b1fd8f78)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-12 12:44:25 +00:00
Christoph Keller
e3d8eddb3a Only embed launch screen when building an app
Xcode's new build system checks duplicated entries when building. Qmake wants to embed
the launch screen for all types of configurations (static libraries etc.) which makes Xcode bail
out with "Multiple commands produce LaunchScreen.storyboard".

Task-number: QTBUG-71035
Change-Id: I5c028e687f16e046b12156c1a8a89540deba4d3b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 9c24ad3b94cb8c67468e947f02dd1f9aaf246085)
2021-04-08 11:42:41 +02:00
Nikolay Avtomonov
68af1067ac Explicitly set output files for qtpreprocess
This fixes build error with XCode 10.
XCode 10 build system (a.k.a "New Build System") requires all the files
that are generated by scripts and used later on build to be explicitly
defined as output files.

Task-number: QTBUG-71035
Change-Id: Ibec39eee53b0cb3acecf592f1ca53c04b9975cad
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 3f0858ed10d249acb942597b4065080411281b87)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-07 20:33:46 +00:00
Eirik Aavitsland
f464d4f75a Update bundled libjpeg-turbo to version 2.0.6
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 2.0.6

Change-Id: I3e308d241853edf3c1d616955cda203220a258d8
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit ede0082f861146d441df641d93f815dbe63a9076)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-04-06 12:03:10 +00:00
Eirik Aavitsland
5d33ae6d94 Update bundled libjpeg-turbo to version 2.0.6
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 2.0.6

Change-Id: I3e308d241853edf3c1d616955cda203220a258d8
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit ede0082f861146d441df641d93f815dbe63a9076)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-23 07:20:17 +00:00
Eirik Aavitsland
f95f872818 Avoid undefined color values in corrupt xpm image
Issue reported by Codechecker.

Change-Id: I1a5aa2203fb31e0ce3b630a11e450925aee81fb0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit f651e6a26cb59f7b7c7671cded8a10b9f98f5c71)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-12 11:42:13 +00:00
Liang Qi
e41cb4db84 xcb: unset old states and set new ones for window
This partly reverts a02959bb5b43a3f9d881e5213ceedf535202b6a1.

Fixes: QTBUG-87078
Change-Id: I69e18ad3c0a8d142b2e1f5ab87990addc97d9df1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit f61b140482d9578c07410a5979379e44e05352e5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-03-08 10:52:48 +00:00
Igor Kushnir
b427721f58 xcb: fix thread synchronization in QXcbEventQueue::waitForNewEvents() again
This patch amends a41701904e880f58e19b352ade1931d6cd1a7112

If peeking into the event queue looking for a clipboard event fails,
QXcbClipboard::waitForClipboardEvent() calls queue->peek for the second
time to "process other clipboard events, since someone is probably
requesting data from us". QXcbEventQueue::peek() in turn calls
QXcbEventQueue::flushBufferedEvents(). This second flushing can acquire
a waited-for clipboard event. The issue was that the code in
waitForNewEvents() ignored this possibility and assumed that there were
no clipboard events before or at its current m_flushedTail. If there
were no more events on the X11 connection after tailBeforeFlush,
the waitForNewEvents() in waitForClipboardEvent() blocked execution
for 5 seconds and eventually timed out.

The fix is to remember QXcbEventQueue::m_flushedTail just after looking
for and not finding a clipboard event in the queue. And then wait for
more events via QWaitCondition in waitForNewEvents() only if there were
no more events after the remembered m_flushedTail.

Fixes: QTBUG-75319
Change-Id: I4919c5b9b9227b3a8a29a11e7094f97960b3a121
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
(cherry picked from commit f2d22d5a5126e7a73da620a60847fc124f724333)
Reviewed-by: Liang Qi <liang.qi@qt.io>
2021-03-05 22:19:14 +02:00
Ville Voutilainen
e23409738e Android: make calling exit() conditional on an environment variable
Task-number: QTBUG-82617
Task-number: QTBUG-85449
Task-number: QTBUG-83043
Change-Id: I5ac67b5d57550e5a1f816e5db01f4aab31127283
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 6e0ce4ee8005d36ee5d080212b8d83b42ebcae17)
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
2021-03-04 12:40:33 +00:00
Eirik Aavitsland
20e5aba3b9 Avoid int overflow in QImage rotate90/180/270
Fixes: QTBUG-91223
Change-Id: Ice53c80d695a5ffdf9162df84e7c9b1e43106bae
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 8daa94431341afece6beb052e6224d215f8507b7)
2021-02-24 17:44:27 +01:00
Morten Johan Sørvig
78224fdaa7 Blacklist failing tests on macOS 10.14
These tests fail locally, and have been reported to
fail on the CI system.

Change-Id: Ia76bb15c288af4171ebe47b3c30f3651a63df3f2
Task-number: QTBUG-75786
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 17affdfbcbb1774dd71782d63889689909fb4bff)
Reviewed-by: Liang Qi <liang.qi@qt.io>
2021-02-18 08:30:59 +02:00
Robert Loehning
cafda99d2c QSslCertificate: Guard against accessing empty QByteArray
Fixes oss-fuzz issue 29276.

Change-Id: I57b0c26e5377bd6b82d9f044ae1d1d13acec996a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit ce90248882b73b4b816a8550710279e3e55ab64c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-01-11 21:20:43 +00:00
Timur Pocheptsov
701735f8d7 QSslCertificate(OpenSSL) - harden protection against nullpointers
An invalid (as input data) certificate may have non-zero number of invalid (nullptr)
extensions (if OpenSSL failed to parse them, for example).

Fixes: QTBUG-89547
Change-Id: I4b93ac9f482f850f02d01b0aea10560dc11b688d
Reviewed-by: Lars Schmertmann <lars.schmertmann@governikus.de>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
(cherry picked from commit f31997448838902eb5237b567f0c80f423f2406e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2021-01-07 22:31:24 +00:00
Alexander Volkov
a4a8ab2c38 QStandardPaths: Don't change permissions of XDG_RUNTIME_DIR
Conform to the XDG Base Directory Specification:
"If, when attempting to write a file, the destination directory
is non-existent an attempt should be made to create it with
permission 0700. If the destination directory exists already
the permissions should not be changed."

At the same time the spec states about XDG_RUNTIME_DIR that
"its Unix access mode MUST be 0700", so don't consider the
directory with wrong permissions correct and use a fallback.

Task-number: QTBUG-68338
Change-Id: I03c6b35b3f7d5ceb8e6326695bfc8207da92ea67
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 68de00e0d4f2c574162a6e033d41786e3757d25d)
2020-12-31 18:12:56 +03:00
Piotr Mikolajczyk
f4caf0d0e5 Android: KEYCODE_MEDIA_PLAY_PAUSE translated right
KEYCODE_MEDIA_PLAY_PAUSE was incorrectly translated to Qt.Key_MediaPlay.
This patch changes it to Qt.Key_MediaTogglePlayPause.

Fixes: QTBUG-66448
Change-Id: Icd2747857bc479228bfdffcd8ab8fdef7b79e918
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 096b4590d5aefc16b9c68611fdc1463b4c173f80)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-12-21 11:31:47 +00:00
Thiago Macieira
ab5a5764b2 QStandardPaths/Unix: improve the XDG_RUNTIME_DIR creation/detection
First, use QT_MKDIR instead of QFileSystemEngine::createDirectory(), as
the latter can't create a directory with the right permissions. That
would allow an attacker to briefly obtain access to the runtime dir
between the mkdir() and chmod() system calls.

Second, make sure that if the target already exists that it is a
directory and not a symlink (even to a directory). If it is a symlink
that belongs to another user, it can be changed to point to another
place, which we won't like.

And as a bonus, we're printing more information to the user in case
something went wrong. Sample outputs:

 QStandardPaths: runtime directory '/root' is not owned by UID 1000, but a directory permissions 0700 owned by UID 0 GID 0

 QStandardPaths: runtime directory '/dev/null' is not a directory, but a character device, socket or FIFO permissions 0666 owned by UID 0 GID 0

 QStandardPaths: runtime directory '/etc/passwd' is not a directory, but a regular file permissions 0644 owned by UID 0 GID 0

 QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-tjmaciei'
 QStandardPaths: runtime directory '/tmp/runtime-tjmaciei' is not a directory, but a symbolic link to a directory permissions 0755 owned by UID 1000 GID 100

Change-Id: Iea47e0f8fc8b40378df7fffd16248b663794c613
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit ad5a65b6a2bfca1658634e380559d14ea1e904a4 plus a lot of others)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-12-07 17:26:53 +00:00
Piotr Mikolajczyk
7b2ebe5fa6 Android: Kill calls to deprecated func in API 29
Since API 29 functions:
 - getExternalStoragePublicDirectory
 - getExternalStorageDirectory
are deprecated and no longer return directly accessible path.

This patch replaces calls to those with suggested call to
Context.getExternalFilesDir(String)

Task-number: QTBUG-87803
Change-Id: I36bc5d5b72a80017996445af0d577aacf5e112d3
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit e1440dd7bc1a5da9a536f88b9733d04ec8fa6e61)
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2020-12-07 14:35:06 +01:00
Allan Sandfeld Jensen
5e548d3592 Fix QImage::setPixelColor on RGBA64_Premultiplied
QColors were not premultiplied before being set.

Change-Id: Id3765b6932a72374ddfd788fae4bb628a4edf0b7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 0c19e3f703a7c3fd59e6db8a9d4ac7091674b552)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-12-04 16:28:20 +00:00
Fabian Vogt
751892a21c widgets: Avoid crash in QScroller
Quoting c6a32751 in okular[1]:

QScrollerPrivate::setDpiFromWidget() before Qt 5.14 crashes
when the target widget does not intersect a physical screen,
because QDesktopWidget returns screen index `-1` in this case,
which leads to an out-of-range read from QApplication::screens(),
which leads to a segfault when reading from an invalid QScreen* pointer.

[1] https://invent.kde.org/graphics/okular/-/commit/c6a32751

Fixes: QTBUG-88288
Change-Id: Ia572bf0207aa6d8ca2a209d22daa36b962e6de7d
Reviewed-by: Fabian Vogt <fabian@ritter-vogt.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-12-04 09:12:56 +01:00
Eirik Aavitsland
a34a352682 Cosmetic stroker: avoid overflows for non-finite coordinates
int overflows are usually avoided by clipping the qreal coordinates to
the device rect. However the clip function did not handle inf or nan
coordinates, so such values would be passed on. Fix by treating any
line with such coordinates a fully clipped away, i.e. rejecting it,
since it cannot be meaningfully stroked anyway.
Fixes oss-fuzz issue 25330.

Change-Id: I4646172fc7a7e0a3a5f5cf03ce10ff0fb56b0d03
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
(cherry picked from commit cfad8a352ae151dd413af1bdea08e25d56309963)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-12-01 22:15:51 +00:00
Giuseppe D'Angelo
0943ad0241 Containers: call constructors even for primitive types
Trivial types are automatically classified as Q_PRIMITIVE_TYPE,
but it doesn't mean that they can be initialized with memset(0)
(notably, pointers to data members on Itanium ABIs are initialized
with -1, not 0).

Drop that kind of optimization, and always value-initialize
objects in containers. Fix the documentation to match as well.

This is a rework of f6f68409a40beaa5f034c411dd7e296c7828d8fd and
82b13880b994ff9b87710e0729e32035ab3b63a4 in Qt 6.

[ChangeLog][QtCore][QTypeInfo] The semantics of Q_PRIMITIVE_TYPE
have been slightly changed. Qt now value-initializes types
marked as primitive (which, by default, include trivial types)
instead of simply using memset(0), which is wrong in some corner
cases.

Change-Id: Ib61396be883424e2f03a9f3bbce1eaddce6aa731
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 76671a57b5418ec98fe2c94a963728ac3306dc82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-12-01 21:41:51 +00:00
Timur Pocheptsov
28b015342d QMacStyle - remove vertical adjustment for inactive tab
While it worked as expected with beta, with final release this thing
looks wrong again, especially in the dark mode.

Change-Id: I6857344de897e0f39d9d8e66431635dbe2f4d077
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit abee4cdd5925a8513f51784754fca8fa35031732)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-12-01 00:48:51 +00:00
Sheng Mao
fb61cd8df8 Let QXcbConnection::getTimestamp properly exit when X server quits
QXcbConnection::getTimestamp uses dummy events to get timestamp from
X server. However, in some cases, X server shuts down while client tries
to get timestamp. In this case, QXcbConnection::getTimestamp keeps
getting null event and thus falls into indefinite loop.

This fix checks if xcb connection is still valid and use a special
xcb_timestamp_t value, CurrentTime (0L), as returned value.
CurrentTime should not be generated by X server and if getTimestamp
returns this value, it means an "exception" case is triggered.

This fix is introduced because in kwin_x11 (KDE project), X server can
exit on logout. kwin_x11 should handle disconnection from X server.
But the indefinite loop prevents kwin_x11 to process disconnection
event and therefore kwin_x11 cannot quit properly.

Fixes: QTBUG-88435
Change-Id: Iaf7ef3f8a35fa8389d22a608e3c49041bf90e1b9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit dbd1c8b047700bb6d0adae848d6cbb89fa2fcfff)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-12-01 00:48:39 +00:00
Allan Sandfeld Jensen
0c43162109 Limit pen width to maximal 32767
Fixes oss-fuzz 25195

Change-Id: I8c68cf71f6702d8b1b1a2ddda3284c14f02d7972
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit c7a335817e909951bfd142018f855645b4a46168)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-11-27 16:40:54 +00:00
Robert Loehning
a4fa3cce0b Limit value in setFontWeightFromValue()
QFont::setWeight() just accepts values between 0 and 900 anyway.

Fixes: oss-fuzz-24986
Change-Id: Ic65139a7821be3a12c65444d010736f03c8b74f5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit ccc205bf38ffbe60180a069939a4aff01e7734e5)
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-24 16:46:11 +00:00
Giuseppe D'Angelo
c4748f909c QStackedLayout: fix a memory leak
A layout takes ownership of the QLayoutItem passed to addItem.

Change-Id: Iea3c64453f3cbf4f1b5660e505c1a35dca537833
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1fcc882d7ca564f17e49b8d51adc43eb5b97c57b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-11-23 22:45:28 +00:00
Allan Sandfeld Jensen
e2c0cc9bb3 Avoid integer overflow and division by zero
Restrain patterns to sensible lengths and values.

[ChangeLog][QCosmeticStroker] Pen patterns are restrained to a
maximum length and values of 1024, fixing oss-fuzz issue 25310.

Change-Id: If062f8336ff5ad113258391b0d70b8ac6f42c4b3
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 1ff25785ff93d0bd3d597e3a65a261bdbfa13c3b)
2020-11-23 18:11:16 +01:00
Tor Arne Vestbø
00326c9dc1 macOS: Upgrade supported SDK to 11.0
Testing seems to indicate building against the 11.0 SDK works fine,
and doesn't opt in to any new behaviors on Big Sur that Qt isn't
ready for.

Change-Id: I7da11cf25f2be7443c94ba7a4e9cd99dc1034455
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit a07c9a1a70ce755140dd31f55c6acd72270f4ddd)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-11-23 12:00:24 +00:00
Mitch Curtis
93eb4b4453 Doc: explain how to create a test touch device for use with touchEvent
Change-Id: Ib60eb0754449da7c50f8632ebd5228ddbe8389f1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 5861e06568c44c58aecacdf26fd7938240348956)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-11-20 18:05:11 +00:00
Tor Arne Vestbø
eaad8fe730 macOS: Propagate device-pixel-ratio of system tray icon
When preparing a system tray icon on a system with a retina screen,
we end up creating a full-height icon of height 44. If there's also
a 1x screen available, macOS will scale down this image for us when
presenting the icon on the 1 screen, but the downscale will fail to
preserve the aspect ratio of the original image on Big Sur.

Telling macOS which device-pixel-ratio the image has seems to fix
this, and is the right thing to do in any case.

Fixes: QTBUG-88600
Change-Id: Ic31def94d073da1b256bbfcaf5905f92c169f43d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit a6aaa2b7071b7666a807b450dc5738742f3cc9e0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-11-20 18:05:08 +00:00
Tor Arne Vestbø
a778580339 widgets: Don't report new focus object during clearFocus() unless needed
We do not unconditionally clear focus_child like the existing comment
said. We only do it if the focus_child was the widget that is clearing
focus. So in many cases we'll end up with the same focus object as
before. We can not report that as a focusObjectChanged to the window,
as that will potentially trigger a reset or cancel of the current
input method for the (unchanged) focus object.

Fixes: QTBUG-86976
Change-Id: I54367e46eda7a94d967f58960bd926c195dc09cc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 7d5ba1c17ecbb620731ff7322fd278c3ce496dad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-11-20 18:04:42 +00:00
Tor Arne Vestbø
c5d904639d macOS: Account for Big Sur always enabling layer backed views
Previous versions of macOS (Mojave and Catalina) enabled layer backing
only when the application's build SDK was 10.14 or above, to provide
an opt-out workaround for applications that were not ready for layer
backing. This seems to no longer be the case, as Big Sur will enable
layer backing regardless of the SDK version used.

Tested by passing -Wl,-sdk_version -Wl,10.13 -v -mlinker-version=519
during linking, to simulate what the effects of linking to the 10.13
would be. Also confirmed by real-world use of the 10.13 SDK via Xcode
9.

Change-Id: I867edc001b6709ba0ad0fd70918bd9b77d317cf8
Fixes: QTBUG-87014
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 2cae34354bd41ae286258c7a6b3653b746e786ae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-11-19 14:21:06 +00:00
Alexander Volkov
a904254e0b xcb: Avoid use-after-free in QXcbConnection::initializeScreens()
Extend the scope of the resources variable to avoid its
destruction while it's still in use.

Fixes: QTBUG-88512
Change-Id: I3298aabc871ff455bd1203ec276e7600d3e151ef
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit 86b8c5c3f32c245795e9eab2a74e4b6982e5a496)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-11-18 15:42:20 +00:00
Giuseppe D'Angelo
d81e160055 QRectF/QPointF/QSizeF: document that operator== and != are fuzzy
This has been the case for a _very_ long time, and I can't
believe this hasn't been documented anywhere.

Change-Id: Ib157edf14e87a6f546c155496f70a760ab218cca
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit cca62a7360a117880eea5821fd7403d68a1431c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-11-18 05:08:03 +00:00
Alexander Kartashov
940414aff1 QMutex: order reads from QMutexPrivate::waiters and QBasicMutex::d_ptr in QBasicMutex::lockInternal()
Threads that unlock and lock a mutex at the same time perform the following
operations:

Thread 1                               Thread 2
--------                               --------

 QBasicMutex::lockInternal()            QBasicMutex::unlockInternal()

  d_ptr.testAndSetOrdered(..., d)        d = d_ptr.loadAcquire()

  d->waiters.loadRelaxed();         (1)
                                         d->waiters.fetchAndAddRelease() (2)
                                         d_ptr.testAndSetRelease(d, 0)   (3)
                                         d->derefWaiters()               (4)
  d->waiters.testAndSetRelaxed(...) (5)
  if (d != d_ptr.loadAcquire())     (6)

  d->wait()

The operation (1) isn't serialized with the operation (6) so its memory
effect may be observed before the effect of the operation (1). However,
if memory effects are observed in the following order: (6) -> (1) -> (2)
-> (3) -> (4) -> (5) then Thread 1 doesn't notice that Thread 2 updates
d_ptr and goes to sleep with d pointing to a stale object, this object
isn't reachable since d_ptr is zeroed so Thread 1 cannot be woken up.

The patch adds the "acquire" barrier into the operation (1) so that it
cannot be reordered with the operation (6).

Fixes: QTBUG-88247
Change-Id: I1d0c405c0bf5080ec1815d351b9b4b75efeab21a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d08e3b6de16118becaada17a58aed4042f400a5a)
2020-11-18 07:07:54 +02:00
Mitch Curtis
a9922920c6 Link to qAlpha in qRgb() and qRgba() docs
Change-Id: I5a3b8573123e82f4c8c92fa7a2e1af06e2e84eb2
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit 418389c3ed925b2da3538d808ceeb53727978a8c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-11-18 05:07:47 +00:00
Florian Bruhin
340c54f834 Fix x-height name in stylesheet docs
The *height* of an x being called "ex width" makes no sense.

Also, it seems like this measurement is typically called "x-height"
rather than "ex height", see e.g. https://en.wikipedia.org/wiki/X-height

Change-Id: Id8e2c1aa9be1a4a60e667a076486777d34f1e76d
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit befa3729db0d1010694bd1bb4cbadd36ff5c49fb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-11-18 00:41:26 +00:00
Timur Pocheptsov
4d6832d03f QMacStyle: fix tab widget rendering
This patch-set combines two recent patches for Big Sur (hiding 'disclose'
button on a NSPopUpButton) and adjusting for (now) visible button's round
corners. Since it makes little sense to only partially fix the thing, we
also backport another change (not so recent, missed 5.12 in the past) that
corrects clipping (where we are trying to cut NSBox'es frame, which otherwise
is semi-visible through semi-transparent buttons in the 'Dark' theme).

Task-number: QTBUG-86513
Change-Id: Ieea5a47ba3073eb564594039895cf70a0a34e7be
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-11-11 12:30:46 +01:00
Giuseppe D'Angelo
06799b58dd Q_PRIMITIVE_TYPE: improve the documentation
A key piece of information missing from Q_PRIMITIVE_TYPE
documentation is that for them value initialization must equal
memset()ting with zeroes. A type like QPoint is primitive
because `QPoint p;` is initialized to (0, 0), but a type like
QSize is movable (and NOT primitive) because `QSize s;` is
actually initialized to (-1, -1). Amend the docs.

Change-Id: I121684810da46be5d0579c7d3de945149390a32a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit b8b75cdcfa71189c7726607be7b66d0ddeaae372)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-11-10 09:31:54 +00:00
Jani Heikkinen
531a53c796 Bump version
Change-Id: Ia07ff236f308c6256507900836ffc38f5e64094f
2020-11-06 09:11:40 +02:00
Anton Kudryavtsev
435f853ae3 macOS + FreeType: fix crash with non printable unicode
Task-number: QTBUG-84096
Change-Id: Ia60b7094ef9e82cf24f5a8b7995000ae65bb379a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit ebfd0b14aadc8d7e1415fa6a698038dffd251cb0)
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
2020-11-05 17:33:59 +03:00
Robert Loehning
208979ed01 Revert changes in strto(u)ll.c to avoid integer overflows
Found in oss-fuzz issue 26045.

Change-Id: Id9eac1b4f67ad9bbe2d92dd69cd03338a6ced74e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2096400d6e8249e49df049f9600073fb2219c97a)
2020-11-05 15:31:31 +01:00
Tasuku Suzuki
76962609d0 Fix gui build without feature.highdpiscaling
(cherry picked from commit b75e6e00b7c41b46179b69b0f1bcfc8d497cb59b)
Change-Id: Ic206cb6fa1b9fae1db9923ef6596852e93b3cbe5
Fixes: QTBUG-87659
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2020-11-02 10:14:43 +00:00
Antti Kokko
1eb30c274b Add changes file for Qt 5.12.10
Change-Id: I49118e7699a158bc799aee3005ccdb740916d887
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit d43c6f1bada49b8c0a90feb96a7b8297f9f1ab05)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-10-28 13:14:36 +00:00
Edward Welbourne
5b96d64dce Fix locale look-up when language is unspecified
Looking up a locale with unspecified language got the C locale, due to
taking a short-cut that would make sense if no locale were found for a
specified language. Stop assuming the language was specified.

Task-number: QTBUG-74287
Change-Id: I8b3c232da584fb187ebb6c190729c377d0083808
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit e69b81101c6e09d1c1b81d50ea868a8625c9f248)
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2020-10-28 13:19:42 +02:00
Ahmad Samir
36c7513106 QLayout docs: explain better what the QWidget ctor arg does
Make it clear in the docs that an alternative to calling QWidget::setLayout()
is to pass the parent widget to the Q*BoxLayout constructor. This basically
just copies the relevant bits from the the docs of QWidget and Q*Layout.

Change-Id: Id196dcdf9a876d9141aa145f23a83c45f8cda5f8
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 1e904ab342c1aaabbef67cbcc25cf3de9e35e755)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-10-27 14:23:25 +00:00
Edward Welbourne
36cc28470f Deal with {und,ov}erflow issues in QLine's length handling
Use std::hypot() instead of sqrt() of a sum of squares.
This ensures length() can't be zero when isNull() is false.
Use length() in QLine::setLength() rather than duplicating that.

Clarify and expand some documentation; isNull() never said what
constituted validity, nor did unitVector() mention that is should not
be used on a line for which isNull() is true. Make clear that lines of
denormal length cannot be rescaled accurately.

Given that we use fuzzy comparison to determine equality of
end-points, isNull() can be false for a line with displacements less
than sqrt(numeric_limits<qreal>::denorm_min()) between the coordinates
of its end-points (as long as these are not much bigger); squaring
these would give zero, hence a zero length, where using hypot() avoids
the underflow and gives a non-zero length. Having a zero length for a
line with isNull() false would lead to problems in setLength(), which
uses an isNull() pre-test, protecting a call to unitVector().

(It was already possible for a null line to have non-zero length; this
now arises in more cases.)

Reworked QLine::setLength() to allow for the possibility that the unit
vector it computes as transient may not have length exactly one.
Add tests against {ov,und}erflow and divide-by-zero problems in QLine.

Picked version for 5.12 needed to adapt the test to simulate 5.15 and
later's QCOMPARE(act, exp) effectively testing qFuzzyIsNull(exp) ?
qFuzzyIsNull(act) : qFuzzyCompare(act, exp) where 5.12 just uses plain
qFuzzyCompare().

Change-Id: I7b71d66b872ccc08a64e941acd36b45b0ea15fab
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
(cherry picked from commit 1c591fd9246ca776304a3c370dd2578bd886feac)
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-27 16:21:37 +02:00
Erik Verbruggen
a6699dd0df Fix race in QFseventsFileSystemWatcher destructor
The race goes like this:
1) We destruct QFseventsFileSystemWatcher, which calls FSEventStreamStop
   and FSEventStreamInvalidate/FSEventStreamRelease
2) The FSEvent* calls will happen on the same thread as the destructor
   is being called on, which will be different to the thread that the
   FSEvent* events are popping out on.
3) So, there could be a case where we are in the middle of processing an
   event, but the QFseventsFileSystemWatcher has already died.

The fix is to dispatch the stop/invalidate/release on the queue
associated with the stream.

Patch by Matt Galloway!

Fixes: QTBUG-85594
Change-Id: Ie168bbe91e55c5559632b37bc008e11597e4fdaf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 6533d1a47309956e8acda90eb4c41d245e817c93)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-10-26 16:37:00 +00:00
Kai Koehne
47a842ee0c Fix included license text for PCRE2 - Stack-less Just-In-Time Compiler
[ChangeLog][Third-Party Code] Changed license text of
"PCRE2 - Stack-less Just-In-Time Compiler" component. The documentation
(incorrectly) included the generic PCRE2 license so far.

Change-Id: I7b36a640ba83fb6087fe28d77f9435af13f8c84d
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit ae18502151fff72885237897f1ffff79166e536c)
2020-10-26 10:36:45 +01:00
Tor Arne Vestbø
168438dc31 Pass -arch when running toolchain configure test on Apple platforms
Clang doesn't automatically switch architecture just because we're
passing an iPhoneOS sysroot. In the past this resulted in a warning
about trying to link an x86_64 binary to arm64 libraries, but with
Xcode 12 this is now a hard error.

Fixes: QTBUG-86718
Change-Id: I7e9d2ca513d276029fc2a6cfe694a35fe41c39b3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit ac43986aa5d07685cc61a5dbc00d76abf0cd1017)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-10-21 08:44:10 +00:00
Andy Shaw
f411be7a4a sqlite: Upgrade to 3.33.0
[ChangeLog][QtSQL][sqlite] Upgraded to v3.33.0

Change-Id: I379d8c62b449d4c6b04e5154c8c1a86761e5466e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a9982e64eb5108e5c4b51a4e5738c08eff6d07e7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-10-17 12:13:52 +00:00
Jani Heikkinen
8b0e639697 Bump version
Change-Id: I071c06a4011a4f9c01efb841ae30008c9edc22aa
2020-10-14 10:27:45 +03:00
Kai Koehne
991fb57e78 Fix copyright year of tinycbor
[ChangeLog][Third-Party Code] Fix aggregated copyright information of TinyCBOR
component to reflect the years in the individual source files. Note that this
is not same as the Copyright year in the upstream MIT license text.

Change-Id: I238d973d937fbfc3a81627c4c65491fbb5cb3c30
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 7c12c8d113b9a7eae00e06ba75a6c6cce0d97d3d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-10-12 15:07:58 +00:00
David Skoland
489c983864 Improve QWizard visuals for macOS dark mode
This did not account for macOS dark mode, with hardcoded white,
but now it correctly updates the colors from palette whenever
the theme is changed.

Additionally changed some bool checks to make sure the code
runs on macOS theme updates.

Do note that this change affects Qt Maintenance Tool (in a
good way).

Change-Id: I6fb92d3f6c15a7ff83d0d8a30cf82477b6aba126
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
(cherry picked from commit 62fed23fefef0738ef55a17f96efd49e30313152)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-10-12 13:48:09 +00:00
Mitch Curtis
259b7638fc Link to qAlpha in qRgb() and qRgba() docs
Change-Id: I5a3b8573123e82f4c8c92fa7a2e1af06e2e84eb2
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
(cherry picked from commit 418389c3ed925b2da3538d808ceeb53727978a8c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-10-12 13:03:59 +00:00
Robert Loehning
f575ed4b15 Avoid heap-buffer-overflow
[ChangeLog][QCosmeticStroker] Avoid a heap-buffer-overflow found by oss-
fuzz as issue 25243.

Change-Id: I36112f183241679e172ad1ee531e1b929d6f3815
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 1d778a59f781ecf822c9e3f7777b680fea2c4e62)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-10-12 10:19:18 +00:00
Robert Loehning
4ef7856603 Avoid overflows in variantHash()
Fixes: oss-fuzz-24702
Change-Id: I876bac9e2c276693e59802dfeeea2229a873ee34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e0da5159dc4f53fcf725ef6e3aa4e04862bcbae0)
2020-10-08 18:24:09 +02:00
Shawn Rutledge
5508942081 Blacklist tst_QWidget::windowState on WinRT
Task-number: QTBUG-75270
Change-Id: Icf1089b4d3681bc6a42be9c095acb5315dd67781
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
(cherry picked from commit 7718b708983cfcbd6fcb0e3b89519b2f8a02942d)
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2020-10-07 11:23:25 +02:00
Liang Qi
d8f1611961 Revert "Blacklist tst_QWindow::exposeEventOnShrink_QTBUG54040"
This reverts commit b1ef104866f78ae5bbc1214ae524bad4120ef0e2.

This test is BPASS on openSUSE_42_3 for 5.12 and PASS on openSUSE_15_1
for 5.15.

Change-Id: Ia1d81ed38491c27c01f270623c5082663f4da699
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
(cherry picked from commit be7d46f5e2b8b4109bcb1ef1f5e765e87354aa9b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-10-04 14:52:52 +00:00
Robert Loehning
5c370569e5 Avoid heap-buffer-overflow
[ChangeLog][QOutlineMapper] Avoid heap-buffer-overflow

Fixes: oss-fuzz-24615
Change-Id: Ia67e1fb830850d04f068d8b5c009687f3deff156
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 74146e0102d367c5e7a3567ad6bf8a46548d55de)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-09-25 21:54:18 +00:00
Christoph Schleifenbaum
504cdf2f47 QFontEngine: Do not call getSfntTable with uninitalized value
On FreeType font engine this results in a call to FT_Load_Sfnt_Table
with a pointer to an uninitialized value passed in as FT_ULong* length,
crashing. Instead initialize value to 0.

Change-Id: I50d6df3b2296a05640d939e862bc50adb0fec921
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit e041f5459660eaa7108fa5888e77e64f7d1b3d1d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-09-24 12:39:20 +00:00
Tor Arne Vestbø
1c4e727c52 macOS: Don't assume NSSlider is never flipped
We need to take into account the possibility that the slider is flipped,
otherwise we end up with inverted rects, as noticed in Big Sur.

The logic to use the ticks as input to whether the bar rect should be
inverted didn't make sense.  If the graphics context has been flipped,
then we should reflect that through the slider.

Change-Id: I3574027c14807460affb42a9763211981c4ed528
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit e4f647e2720612d030e4a2240a00500054bbda99)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-09-23 22:21:00 +00:00
Robert Loehning
92fe1eba0a QXmlStreamReader: Don't resize readBuffer to a size it already has
Resizing it to 0 will cause it to allocate memory. This will then
cause append() to copy the data from the other string instead of
using copy on write.

Task-number: oss-fuzz-24347
Change-Id: I581bd109f9b973e1c70b7b41b1f610a2ad5725b8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 3e3fdbe831f24365780383b3c45a3d53f23ba435)
2020-09-22 16:08:57 +00:00
Robert Loehning
7624144005 QTextHtmlParserNode: Avoid extreme values for font's pixelsize
They currently cause an integer-overflow in variantHash().

Fixes: oss-fuzz-24702
Change-Id: Ibee4413ca766c8ade9aeff2f2052b82cb9f7d213
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 0bd770fb875d5391dd78df95542c25bd15051938)
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-09-22 08:23:05 +00:00
Eirik Aavitsland
69eade9854 Gif decoder: fix read error caused by ub check
The recently added check to avoid negative-bitshift ub ignored that
the algorithm will sometimes use a negative bitcount value as a
flag. This caused reading failure for some frames.

Fixes: QTBUG-86702
Change-Id: I4c247a7eb6102f9b51cc8ac708c60db80d609e38
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit f1c1f444811643acda66aaeb21a9e73a8e60e830)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-09-21 10:50:53 +00:00
Kai Koehne
d04c436ab1 Doc: Improve WinTab license information
Do categorize the license as LCS-Telegraphics License. Although SPDX
doesn't know about the license (yet), DejaCode does:

https://enterprise.dejacode.com/licenses/public/lcs-telegraphics/

So it's more helpful for the user to give the license a name, then
to just call it 'Custom'.

[ChangeLog][Third-Party Code] Changed classification of the wintab
license from "Custom" to "LCS-Telegraphics License"

Change-Id: Iba7538f67b43ceca2e599fc1ede520962d4a7e43
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 29ed90a147d0b4f65cc0a447e533af9338c6bdf4)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-09-20 02:41:11 +00:00
Ahmad Samir
6e03d17f2f QDir: add note to docs about isAbsolutePath(":foo") returning true
As can be seen in the _q_resolveEntryAndCreateLegacyEngine_recursive method
in QFileSystemEngine, paths starting with ':' are treated as QResources,
which means that from QFileInfo's POV they're "not relative", which is why
QDir::isAbsolutePath would return true.

Change-Id: I701d08ce43ea707bc34c928e39bea0b83597a4b6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 0da5726a43b21d1532720c8cd3c687cc2373cd2b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-09-20 02:40:29 +00:00
Friedemann Kleint
0692398b0b Fix a double deletion in QDomAttr::setNodeValue()
Check the reference count before deleting. Patch
as contributed on bug report.

Fixes: QTBUG-86547
Change-Id: I2cb197e3eeda7ade2442c23f6b4f1ae6ff2ff810
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit af22ccf5605c6b7b20b845fb2b4003d3f56d8bc9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-09-19 10:56:06 +00:00
Eirik Aavitsland
fa7a839530 xpm handler: fix read error caused by off-by-one in overflow check
The recently introduced overflow check for 8 bit images was too
aggressive, causing the last pixel on each line to be rejected.

As a driveby, add the same (fixed) overflow check also for 32bit
images.

Fixes: QTBUG-86691
Change-Id: I62e4d5884e314f1171cb5a3e2c48657ce7259676
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 6f2c7469f86785e6ba81fe0280210ef7275099de)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-09-18 12:28:11 +00:00
Tor Arne Vestbø
0d7248345d macOS: Don't assume we will get didBecomeKey for non-Qt NSWindows
The optimization resulted in losing out on window focus changes when
for example a native file dialog was shown, resulting in the cursor
blinking both in the parent window, and in the native file dialog.

Change-Id: I9c1f9df20fbc5c4b80f906ded70d9a2658b70438
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 5fbb17c39785ed2c80219c9c0ea97879e371d490)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-09-14 20:41:55 +00:00
Mitch Curtis
7a7996beb5 Doc: explain how to blacklist QML tests on certain platforms
Change-Id: Icd505175805820c64593d7eb8f580a51008e2e1a
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
(cherry picked from commit a4e4436e852c600a7ecd13b83fc487164dbc5ad7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-09-11 07:48:28 +00:00
Eirik Aavitsland
80c3d4a20a Make clang-format ignore formatting of third party code
Change-Id: I865f86a1f9967971c4e525e634279a26ce11f688
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit 7d27316d9fe736fd863dbd389571ee7906d6e559)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-09-10 06:58:27 +00:00
Eirik Aavitsland
12994284f4 Avoid potential ub in corrupt bmp file
biHeight may be int_min, in which case qAbs<int>() will not work.

Fixes: oss-fuzz-22997
Change-Id: Ic07d5aa0b4e4f2b6395e1a12d742e31b5282fdfc
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 6f909a5178296855cdd53b053ced9c551a2474a6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-09-10 06:58:16 +00:00
Eirik Aavitsland
3d697e4a45 Update bundled libjpeg-turbo to version 2.0.5
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 2.0.5

Change-Id: I9d4c403fbc998243c32d1bf1f1fbaf53270ffb9c
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit e22c0368d8c4e2512b143e18264b1fb99856e343)
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-09-10 06:58:03 +00:00
Eirik Aavitsland
329af94573 Update bundled libjpeg-turbo to version 2.0.4
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 2.0.4

Change-Id: I7f74af0dc774a2172ff59713613a706e80d5b2cb
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit c3b6d09caef755171c8cd113e83b8f6f6f54cb7d)
2020-09-08 09:34:24 +00:00
Andy Shaw
ee55cd6b0c Cocoa: Translate the buttons used for the native font and color dialogs
Use the QPlatformDialogHelper standard buttons to get the translated
button text as then this will already have been translated for those
loading a translation.

Fixes: QTBUG-85725
Change-Id: Ia42d93aeb6e1b5c0528564a6c960a35f6710c8eb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit ade59ea316dc17ff6c25fb10939a03008a70c11b)
2020-09-05 02:11:05 +02:00
Edward Welbourne
f919d9a2da Fix crash on serializing default-constructed QTimeZone
The serialization code neglected to check against null.  Sinze zones
are saved either by IANA ID or in our special OffsetFromUtc format,
representing an invalid zone by a string that cannot possibly be a
valid IANA ID will do.

Fixes: QTBUG-86019
Change-Id: I6882026403d00f8b254aab34c645f1cf8f9fcc2d
Reviewed-by: Taylor Braun-Jones <taylor@braun-jones.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 14f3f419b0864944d75283a850dc0ce141feaf0e)
2020-09-03 10:14:23 +02:00
Robert Loehning
5cbebeda54 QBezier: Don't try calculating a unit vector when length is null
It's undefined and causes a division by zero.

Fixes: oss-fuzz-24273
Change-Id: I3d34d5c43cccff9255abaf87af265ddea3fe6d95
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 7fa5fdae5c4f4c83acb74ff8cd65eacfa567a727)
Reviewed-by: hjk <hjk@qt.io>
2020-08-25 10:18:15 +00:00
Tor Arne Vestbø
224f91fb29 xcb: Fix flushing of native subwindows when not using shared memory
When using X-forwarding we're not using shared memory for the backing
store image, and end up in a code path where we first copy the updated
parts of the backing store from our client side image over to the server,
and then flush those parts from the server-side image to the window.

The problem was that this code path didn't account for the possibility
that we'd flush a sub-window at an offset, and would end up uploading
the sub-window local region directly, without applying the offset.

This problem was revealed when 79bf1b7e348d started being smarter
about what regions we flush and to what windows when we have sub
windows.

Fixes: QTBUG-81723
Change-Id: I1c9c8bc53c088cdc1ae8b892e17930f4a468ccad
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
(cherry picked from commit 81e09ae404b632a92e1e4c27f5875bdf027c5401)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-08-25 08:31:38 +00:00
Gatis Paeglis
f0cf48d81e qwsi: revert parts of 00ae1e6b7bf6efa5f5e57d37844e44d521604fb6
We actually do not need this "mode" in qwsi API. I think while
writing the patch from 00ae1e6b7b I got confused by focusing
on my test application. We can't know what the native event
filter will filter out, therefore it makes sense that we
unconditionally do filtering at qwsi level as well for user input
vs other events in QWindowSystemInterface::sendWindowSystemEvents().

Change-Id: Idb23152a24bf3ba3b91804427a6e78f991969c29
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 7318328c2d658f6ca2e9443c6e3e3b0a179e9811)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-08-24 09:00:08 +00:00
Nicolas Guichard
259021703b QGuiApplication: fix handling of spontaneous events' modifiers
QtQuickTest synthetized events can have modifiers, but those modifiers
were not accessible globally, from QGuiApplication::keyboardModifiers
for instance.
eg. calling QML's TestCase::mouseClick with modifiers triggering a call
to QGuiApplication::keyboardModifiers did not give the expected result.

QtTest synthesised events can also have modifiers and those were
correctly handled by QApplication to set modifiers globally.

This fix moves the handling code from QApplication::notify to
QGuiApplicationPrivate::maybeSimulateModifiers and calls this function
from QGuiApplication::notify too.

The definite fix would be to do as suggested in the comment attached to
the moved code:
> Qt Test should not call qapp->notify(), but rather route the events
> through the proper QPA interface. This is required to properly
> generate all other events such as enter/leave etc.

Change-Id: I734e5bbc82232b13828b1a1f82e06ee8eb695417
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 4b1ffab8ad95eda737fde015c243442a28de8e23)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-08-20 19:44:10 +00:00
Andy Shaw
c0eb13e0fb Doc: Mention no_testcase_installs which can be used to prevent install
Change-Id: If8044a339cab754d427fd7626dd6813c7cc99e56
Fixes: QTBUG-85827
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit e1971c60f1b878467a5f3956a0eebd96a69832ae)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-08-20 09:38:51 +00:00
Tor Arne Vestbø
7ba34cbcb0 Handle simulator platforms when parsing LC_BUILD_VERSION load command
Task-number: QTBUG-85764
Change-Id: Ie46bee0937908e2dfedfa3532394dde015abf891
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3911be61602695ed65e33e54bee38ee8bcd92539)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-08-19 15:11:45 +02:00
Tor Arne Vestbø
77a02f18cd Resolve SDK and deployment target OS from load command
Change-Id: Icce79186645f173b7f9be8ee6da0abed25cf3da0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 4e74bb48234f41c9d6306c7a3cd6835c2cd42348)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-08-19 15:11:44 +02:00
Andy Shaw
d721300fe0 Android: Don't pause when in multi window mode
When the application is in multi window mode then when pausing it should
not suspend the application as it can still be visible in the
background.

Change-Id: I03a561459b2aa04c808b7d4220cd3e558671dd17
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 33c24b9b9d0c6ae1899cec2e01bad9df01ca05f6)
2020-08-19 05:41:22 +00:00
Thiago Macieira
46214c96af QtPrivate::isLatin1: fix SSE2 non-SSE4.1 code
The implementation was broken. The "high" in PUNPCKHBW's "unpack high
data" means the high 64-bit of the 128-bit, not the high byte of a 16-
bit word. This never worked. It always passed for me because I don't
build non-SSE4.2 code (too old, no longer relevant).

So just use the working version of simdTestMask.

Change-Id: I35a1b4d0a19a43149daefffd16284542f0de3fa3
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit 9422b5ebc3592f4687650a84131e736219308b9f)
2020-08-17 17:21:02 -07:00
Thiago Macieira
11740acbca QByteArray::toDouble: fix buffer overflow reads on fromRawData()
If Qt was not compiled with libdouble-conversion, sscanf() requires
null-termination, which fromRawData() does not require. This could be
fixed by making QByteArray pass a reallocated copy if it is operating on
raw data, but fixing qt_asciiToDouble() means we catch all cases and we
optimize for the common case of not-horribly-long strings.

Fixes: QTBUG-85580
Change-Id: Iea47e0f8fc8b40378df7fffd16246f6163b01442
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit efd3c7bf2427c8237857e56ecd51b8da3ce43a6e)
2020-08-17 04:23:02 -07:00
Eirik Aavitsland
58af0a3db5 Allow smooth curve stroking for very wide lines
The earlier limit set on the curve threshold turned out to be too
strict, leading to visibly bad rendering in reasonable use cases.
Ref. 5322998a0ba80b1e095340245ddb00aaf5947be9

As a drive-by, add a missing fixed-to-real conversion. (This is a
no-op in a default build, where qfixed==qreal.)

Fixes: QTBUG-85193
Change-Id: I7cc3543d7aa4e90643b275686372400879decef2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 4db44bc32f9a08e89391aa3d99a01060a4f10737)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-08-12 07:15:53 +00:00
Tor Arne Vestbø
caa68b9c53 macOS: Fix crash when re-using backingstore for re-created QWindow
The observer we add for the NSWindow of the backingstore window
will not be valid once that window is destroyed, but we may get
last minute notifications for it still, in which case our platform
window is gone.

This patch fixes the immediate crash, but reveals a more fundamental
problem of assuming the platform window that's alive during construction
is the one that will always be used with the backingstore. This is not
the case when for example QtWidgets opens a combo box, and reuses the
backingstore for the widget each time the combobox popup is shown.

Fixes: QTBUG-85915
Change-Id: Ia66a45d003882602ac29476aabf2d58b0ac33c1e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit abb985a4032a337581aa885e1ac547287244b695)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-08-07 12:07:03 +00:00
Tor Arne Vestbø
25e0e6273d Add QOperatingSystemVersion support for macOS Big Sur
Change-Id: Ide57f675b20b08210f301da5177df45d008423c4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 19d32f0a5fc8b12e03a84ab6e18845337fd3b70f)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-08-05 22:15:39 +02:00
Tor Arne Vestbø
512c2cf2fb Teach QMacVersion to deal with 32-bit Mach-O headers
Change-Id: I7946aa35722bc76326e2d6cf0820353c4ba13fad
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit b6de6a96990577f8041ba1520bd0f2766be6027c)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-08-05 22:15:33 +02:00
Allan Sandfeld Jensen
35ecd0b69d Fix buffer overflow in XBM parser
Avoid parsing over the buffer limit, or interpreting non-hex
as hex.

This still leaves parsing of lines longer than 300 chars
unreliable

Change-Id: I1c57a7e530c4380f6f9040b2ec729ccd7dc7a5fb
Reviewed-by: Robert Loehning <robert.loehning@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit c562c1fc19629fb505acd0f6380604840b634211)
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2020-08-04 20:41:43 +02:00
Robert Loehning
a2b1ab0e6e Sanitize lengthValue in CSS parser
Limit the LengthData to the integer range before rounding it, taking
into account that qRound() substracts 1 from negative values.

Fixes: oss-fuzz-23220
Change-Id: I1b4383f3c33aac22746831002b2c74fc134faf77
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 188501fe27899cdc6a1aacf0d8c1a11144bd564a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-07-31 13:08:24 +00:00
Robert Loehning
df65a30d5c Check returns of hex2int in get_hex_rgb
Avoids undefined behavior when trying to shift negative values.

Fixes: oss-fuzz-21860
Fixes: oss-fuzz-23968
Change-Id: I879c97624e3f8ba9cf01e0a3a682379cd8c4a199
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3094bcc3c5a30635289f534884965d39ac35a11a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-07-31 13:08:24 +00:00
Robert Loehning
5b2f753884 Fix buffer overflow
Fixes: oss-fuzz-23988
Change-Id: I4efdbfc3c0a96917c0c8224642896088ade99f35
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit e80be8a43da78b9544f12fbac47e92c7f1f64366)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-07-31 13:08:24 +00:00
Robert Loehning
b7f2057ab1 Multiply instead of shifting
The shift operator is undefined for negative values.

Fixes: oss-fuzz-23735
Change-Id: Ib4bad0bf2135f9ddc95f6d7de64d935a02b4791e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
(cherry picked from commit fd0c9fcaccbbb284f00c3403152bd3faf5940888)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-07-31 13:08:24 +00:00
Andy Shaw
a3b2230780 sqlite: Upgrade to 3.32.3
[ChangeLog][QtSQL][sqlite] Upgraded to v3.32.3

Change-Id: I3c00fb6b0bd7daa3465b38ac6536b82d0b16596f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 777d6a546d6c4d5985f37c38714462d32fbe5155)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-07-31 13:08:23 +00:00
Tor Arne Vestbø
00b6af34a4 Disable PCRE2 JIT on macOS ARM64
It's already disabled for many other ARM platforms, and upstream
support for Apple Silicon is still pending, so we disable it for
now. See: https://bugs.exim.org/show_bug.cgi?id=2618

Fixes: QTBUG-85528
Change-Id: I42b6e5efaa07c9b832cd05a47436eb86a214e9bf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 2f8df4d1a87df9dd67913b016171dac20839d16e)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-07-13 09:28:06 +00:00
Andy Shaw
d4e2c39dae Mark gradlew with Unix eol endings as it is a script
Since this could end up being copied from a Windows machine to another
when it is part of a project using Android then we should make sure the
line endings are preserved to be on the safe side. This avoids a strange
problem when deploying due to gradle failing to run.

Change-Id: Ie170461a351c9279092b58d4e8353b81cc8561d3
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit c92528b6cc502a541d5b55daf27c2d78d883d26a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-07-10 12:04:51 +00:00
Tor Arne Vestbø
a0adcb7bd9 Treat -xplatform or -device-option as being a cross compilation
Task-number: QTBUG-85279
Change-Id: I623108be2cba1dad28c5b692c2b5836a68144854
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 26eb4e63e0195d49ebfa765e9ae1522a1971464d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-07-09 08:56:26 +00:00
Tor Arne Vestbø
3fe33f5143 macOS: Exclude 32-bit builds by checking pointer size
Task-number: QTBUG-85279
Change-Id: I984ec21b9c5ed5e2bd02b3a8b52bbeb72953e454
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 17b1c7e6b38e6d544d290089aff8288a23511738)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-07-08 19:23:35 +00:00
Tor Arne Vestbø
1184b79381 macOS: Don't assume platform has objc_msgSendSuper_stret
It's not used on arm64, and the template magic is not enough to
avoid compilation failures due to references to the undefined
function.

Task-number: QTBUG-85279
Change-Id: Iac94f59a863c7be1860b51def0fc2de2d8812cf8
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit b10f8ba3506c6c8c941826aee0225192aa4cd1af)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-07-08 19:23:24 +00:00
Volker Hilsheimer
d6bda220f7 Skip proxy widgets that can't take focus when (back)tabbing
Fixes regression introduced in b4981f9d4ca914c6ecaa49bfdd69e51806a3671a,
due to which it was possible to back-tab into a widget even though it or
its focusProxy had a NoFocus policy.

As a drive-by, split the complicated if-statement up a bit for improved
readability.

Change-Id: Ib0ac2604076e812e340b11534c23ae8ae958d082
Fixes: QTBUG-76924
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 0dbd2dd86389c0705dbe9f518aed12f609ed09a1)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-07-01 10:41:27 +02:00
Thiago Macieira
9115c84103 Adapt to MSVC difference in behavior in initializing non-aggregates
Testcase:

 struct A
 {
     A() = default;
     constexpr A(int v) :i(v) {}
     int i;
 };
 extern const A y[1] = {};

In our case, A = std::atomic<int> and y = shared_null.

With GCC, ICC, and Clang that "y" variable is value-initialized at
static initialization time, and no dynamic initialization code is
generated. However, with MSVC, because A is not an aggregate, the
default constructor isn't constexpr (it leaves A::i uninitialized) so
"y" must be dynamically initialized. That leads to Static Initialization
Order Fiasco.

This seems to be a regression in the MSVC 2019 16.6 STL:
https://github.com/microsoft/STL/issues/661

The solution is simple: call the constexpr constructor.

Code is different in 6.0 so sending separately from 5.x.

Fixes: QTBUG-71548
Task-number: QTBUG-59721
Change-Id: I3d4f433ff6e94fd390a9fffd161b4a7e8c1867b1
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit b619f2a26ea2ab56e18a3f9a8b635f96fc479563)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-06-29 21:29:27 -07:00
Mike Krus
4bb4512649 Fix UITouch event handling on tvOS
On tvOS touchesEnded: occasionally gets called with touches that have
not been passed via the touchesBegan:. When this happens previously
cached touch event (that HAVE been passed to touchesBegan:) are no
longer valid.
This causes a crash when testing if new touches contain old ones (since
NSSet dereferences the needle which is no longer valid).

Fix uses the unique (unsigned int) hash that UIKIT assigns to the
UITouch instance so cached copies are never accessed.

Furthermore, tvOS only supports single touch so now just clearing cache
when touch has ended.

Task-number: QTBUG-84383
Change-Id: I7592cdde74ce834285e7b14196171f6b57736cc8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 428115340bee4357d6821eee78e1fff0ae910712)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-06-29 20:45:42 +00:00
Tor Arne Vestbø
122a9512fc macOS: Add a few more local autorelease pools to QCocoaGLContext
Prevents buildup of autoreleased NSViews (drawables) in the outer pool
of the main runloop, which may not drain as often as we wish.

Change-Id: Ifcf7317c50ec243e0d957bf4a19aab8bf34d5dd6
Fixes: QTBUG-84762
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 15456efa20eb302ad2bc130d0d18db7d2fe58f4d)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-06-25 19:58:32 +00:00
Allan Sandfeld Jensen
43f2244581 Avoid converting supersized QRectF to QRect
Check that the sizes are even representable when checking if clipping is
necessary.

Fixes oss-fuzz 23630

Change-Id: I95d6873d28b0e4f47aae7666f7ee96b745dc997b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 177c0ef204e35938f3fef7bd7be5425d6804ec82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-06-25 11:30:53 +00:00
Vikke Matikainen
90c85b880e Android: Fix android accessibility not being set active
Android platform event of activating accessibility might be received,
before the platform plugin is initialized, thus disregarding the activation
step.

This change saves the activation event state and defers setting it in
platform integration.

Fixes: QTBUG-77320
Change-Id: I06aab76159d1de0e72c0c535dbe80c2858f8e79b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b1433a6988d79c162ab5bed116be1ffeedca2ea9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-06-21 12:28:07 +00:00
Qt Forward Merge Bot
96e08d2de6 Merge "Merge remote-tracking branch 'origin/5.12.9' into 5.12" 2020-06-17 13:35:33 +02:00
Qt Forward Merge Bot
58ac181a8d Merge remote-tracking branch 'origin/5.12.9' into 5.12
Change-Id: Ibd1b3739e257535a3009907a3622fdf8f74321d3
2020-06-17 13:35:20 +02:00
Shawn Rutledge
3a29996548 Always show a submenu on its parent menu's screen, if possible
Amends c068edcecf6876c7b57abbe302ad8b1347e4445e with another
nullptr check.

Fixes: QTCREATORBUG-24195
Task-number: QTBUG-76162
Change-Id: Ifaafe9b45fafaae220da54bbf3bc7a568e7953f9
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2020-06-17 09:16:55 +02:00
Antti Kokko
823ed71e22 Add changes file for Qt 5.12.9
Change-Id: I8dfebce4f5fa0eb888feed599f89759511b3fc34
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-06-11 08:31:44 +02:00
Miika Pernu
1e42f022cc Fix to crash in QWindow::event when delete this called on closeEvent
Starting from Qt 5.11 QWindow::event is called after QDialog::closeEvent
which would cause a crash if "delete this" was called on closeEvent.  The commit
that changed this was e0b5ff4ad583befbecbcbe462998e3ed80899531. Added
a check before QWindow::event call utilizing QPointer to prevent the
function call in case object is destroyed by a user in close event handler.

Change-Id: I64a4a0f3271714e55bf7e806177f0d8b39b67fa3
Fixes: QTBUG-84222
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 036c3c19e7da5f1a280750d3c68a0cff38678029)
(cherry picked from commit 710777d5d32ef13f2037cfe58e40ff2343355759)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-06-10 04:08:19 +00:00
Tor Arne Vestbø
f7f5919558 macOS: Respect window type when determining main window status
Fixes: QTBUG-84405
Change-Id: I3fc6b15b07a81e7e7e417a5767c2853083c13516
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 1cd7cbf6179692fc824dc3ba15580372493a4355)
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2020-06-10 04:08:10 +00:00
Miika Pernu
710777d5d3 Fix to crash in QWindow::event when delete this called on closeEvent
Starting from Qt 5.11 QWindow::event is called after QDialog::closeEvent
which would cause a crash if "delete this" was called on closeEvent.  The commit
that changed this was e0b5ff4ad583befbecbcbe462998e3ed80899531. Added
a check before QWindow::event call utilizing QPointer to prevent the
function call in case object is destroyed by a user in close event handler.

Change-Id: I64a4a0f3271714e55bf7e806177f0d8b39b67fa3
Fixes: QTBUG-84222
Pick-to: 5.12.9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 036c3c19e7da5f1a280750d3c68a0cff38678029)
2020-06-09 05:12:04 +00:00
Eirik Aavitsland
66cc65b92b Gif decoder: Harden handling of corrupt files
Fix potential UB for corrupt files.

Change-Id: If5d1b859a03b09e3479a6a7adaaf3432958126b4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 8edf11d51059b2ecb42dbf45f037d88e5b2beab6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-06-09 02:21:26 +00:00
Tor Arne Vestbø
e54112b467 macOS: Respect window type when determining main window status
Fixes: QTBUG-84405
Change-Id: I3fc6b15b07a81e7e7e417a5767c2853083c13516
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 1cd7cbf6179692fc824dc3ba15580372493a4355)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-06-06 02:15:17 +00:00
Paul Wicking
b11508aa54 Merge 5.12 into 5.12.9
Change-Id: I604e23045b115966e06d966f25724b3f72b313d8
2020-06-05 14:34:32 +02:00
Andy Shaw
c74799fa59 Update the qt_attribution.json for SQLite
This got forgotten when SQLite was upgraded to v3.32.1, so this amends
e10e989ce83027f2f620bb6948be4948f3c91e76

Change-Id: I75799b6c55bc39c4cc050b5eb18a99d9f197410c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 542e7da817b1b0204ab6e8fdac802949e161cce5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-06-05 01:22:17 +00:00
Andy Shaw
c86c028efd sqlite: Upgrade to 3.32.1
The patches applied are now removed as they are all included in v3.32.1

[ChangeLog][QtSQL][sqlite] Upgraded to v3.32.1

Change-Id: Ib5b26fb36d7ca49c1108a96097a48fe5b797f291
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 915549f6ed02581242cb98c474a622288ca0fb35)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-06-04 08:07:38 +00:00
Rolf Eike Beer
22b82fbb96 QVncScreen: fix crash on disconnect client did not request cursor
Change-Id: I758c79d87bd239b6fde9bae4e97c5b31450fa813
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit c4b172b7f0158fccf6d0ac1a72081d0749410b1b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-06-04 06:50:20 +00:00
Albert Astals Cid
47fed5b007 Do not fully initialize QIconLoader when setting the fallback theme
We need this because without this patch you get bugs both
if you call QIcon::setFallbackThemeName before creating the QGuiApplication and
if you call QIcon::setFallbackThemeName after creating QGuiApplication

Why do you get a bug if you call QIconLoader::setFallbackThemeName
before creating the QGuiApplication:
 * QIcon::setFallbackThemeName calls QIconLoader::instance
 * QIconLoader::instance calls QIconLoader::ensureInitialized
 * QIconLoader::ensureInitialized calls systemThemeName
 * systemThemeName asks the current QPlatformTheme for its
   QPlatformTheme::SystemIconThemeName
 * But since we're calling this before creating the QGuiApplication
   there is no current QPlatformTheme yet, so systemThemeName
   is set to empty, which is obviously not what we want

Why do you get a bug if you call QIconLoader::setFallbackThemeName
after creating the QGuiApplication:
 * QGuiApplicationPrivate::init calls
   QGuiApplicationPrivate::createPlatformIntegration
 * QGuiApplicationPrivate::createPlatformIntegration sets the
   current QPlatformTheme and at the end of the very same function
   uses QIcon::fromTheme
 * Since we haven't called QIconLoader::setFallbackThemeName yet
   there is at least one icon lookup that doesn't take
   the fallback theme we would like to have into account

This patch makes it so calling QIconLoader::setFallbackThemeName
before creating the QGuiApplication works.

The only thing we want to do from QIcon::setFallbackThemeName is set
the internal m_userFallbackTheme, it doesn't care about doing
further initialization of QIconLoader, if it's done, great it's done,
if it is not initialized yet, great it will be initialized later
when someone actually tries to use the QIconloader.

So it's OK for ensureInitialized() to return early if there is no
platform theme yet, because it will be called again later.

Fixes: QTBUG-74252
Change-Id: I65268fc3d3d0bd282d76c76cf75e495bcc9d1a30
Done-with: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit add92a551cf601b5c9e074046326f95ccc38062e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-06-03 01:42:02 +00:00
Eirik Aavitsland
33c98d8fff bmp/ico decoder: fail early for unsupported bit depths
All the normal bit depths are supported, so no point in trying to go
through the decoding code path for others. Avoids wide bitshift
warning for claimed depths > 32.

Change-Id: I61b72dbbf9558ca28db46f8168339f8174e56997
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit 6a2224fd58414a78957104dd654f697c4b2eaa1d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-06-02 09:21:20 +00:00
Eirik Aavitsland
26dc7f012a gif image handler: check for out of range image size
Make the decoder fail early to avoid spending time and memory on
attempting to decode a corrupt image file.

Change-Id: Ic556d4fbcb6b542fc110d10e48dac1a880e60697
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 2b7b75f721b6786a6dc35e2f9b693bb2e2dfac01)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-06-02 09:21:11 +00:00
Eirik Aavitsland
e1e032d083 Gif decoder: avoid undefined values in enum
The gif standard allocates 3 bits for the disposal method, but values
4-7 are unused.

Change-Id: I0f70b3f87b4cd8e98140c3da476702a22ebe93a9
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit 30571068b203a9d950030b31ee84f08f2f6fc04d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-05-30 13:36:46 +00:00
Rainer Keller
3315a400fc Protect global variable g_pointIdMap with mutexes
The evdev touch handler is thread based and calls
QWindowSystemInterface::handleTouchEvent. The global variable
in qwindowsysteminterface.cpp is used without being protected by mutexes
which causes data loss and crashes when multiple touch screens are used.

Fixes: QTBUG-63584
Change-Id: I8b5bb04cc517fab96ac428b2bd2bc128b2ca1a54
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 23d73208524d3ab2166121d08594da88e6b4460b)
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2020-05-26 14:27:20 +00:00
Friedemann Kleint
232bd0a05f Direct Write Font Engine: Fix leaking IDWriteFontFace instances
Patch as contributed on bug report.

Fixes: QTBUG-84265
Change-Id: I73d73cf7d1b46944767750bf0f0c727c7b00b1d7
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit 26100ccb83ec9c4a2ee192170f1952956dd569d1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-05-20 18:27:28 +00:00
Thiago Macieira
c6aec7eda3 QLinkedListData: Move Q_CORE_EXPORT from class to shared_null
This makes no difference for the IA-64 C++ ABI nor for MSVC until MSVC
2019 16.6. But it does with 16.6, where the std::atomic constructor
becomes non-trivial, which makes QtPrivate::RefCount non-trivial, which
makes QLinkedListData non-trivial.

Before this change:

User code \ Qt		MSVC <=16.5	MSVC >=16.6
MSVC <=16.5		works		works
MSVC >=16.6		fails		works

With this change, they should all work. The list of symbols exported
should not change either, so linking against a Qt compiled with MSVC
<=16.5 should continue to work.

[ChangeLog][MSVC] Fixed a compatibility issue found when linking code
compiled with version 16.6 to a Qt compiled with 16.5.

Fixes: QTBUG-81727
Change-Id: If79a52e476594446baccfffd15ee771397467f8b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
(cherry picked from commit 7af5619836cb3bd2eca87fd10b81674c9e201e76)
Reviewed-by: Simon Hausmann <hausmann@gmail.com>
2020-05-20 17:16:05 +00:00
Andy Shaw
d9b7b0f159 Windows: Update the hasFrame setting when changing window flags
Since changing the window flags can make it frameless or have a frame
then it should ensure that the hasFrame setting is updated accordingly
when the window flags do.

Change-Id: I7bf4995d7967623b117426d8750e63fa97967e2c
Fixes: QTBUG-84029
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 60ec350bc79d562c0611bc31e8655729272c31d6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2020-05-19 12:36:57 +00:00
Friedemann Kleint
36c55eb7eb QNetworkReply: Fix SSL configuration handling
Use QT_CONFIG consistently and enclose
sslConfigurationImplementation(), setSslConfigurationImplementation()
and ignoreSslErrorsImplementation() within QT_CONFIG as well.

This enables a build of Qt for Python with -no-feature-ssl.

Fixes: PYSIDE-1302
Change-Id: Ia699293ab73a5dc86d8dcf95aa5f6369334d36a2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 5436a6f3e0a9e7ef7ed51fc5b304e1f81eaed960)
2020-05-18 11:45:54 +00:00
BogDan Vatra
8e3b83ad55 Fix llvm-strip/readobj parameters
Change-Id: I3add593d8ad8791d694f157849e72dd26a6dc4ca
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2020-05-18 11:19:07 +03:00
Allan Sandfeld Jensen
2fbcca719e Avoid format conversion in backing store texture upload
Use glPixelStorei where possible

Fixes: QTBUG-84189
Change-Id: Iadf039b5c6d8e7b6bb11d031a94683343dee0dc6
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 01b2ea83aa0e8e1d624f6c25d78bb5184cd35483)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-05-15 20:55:59 +00:00
Thiago Macieira
5a1f9cf8c3 Fix crash when running QtCore: Stack is misaligned on x86-64
When our ELF entry point function is started by the kernel, the stack is
aligned at 16 bytes. However, the stack is expected to be off by 8, due
to a preceding CALL instruction which didn't exist. This cauases a crash
further down as the compiler may generate aligned stack access.

Change-Id: I1496b069cc534f1a838dfffd15c9dc4ef9e3869e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 932805807123833bb8f5ae9abda7e946f48d9f0c)
2020-04-30 09:56:32 -08:00
Shawn Rutledge
4220aa7870 Always open a submenu on the same screen where the parent menu is
We've seen submenus opening on different screens in different scenarios,
but probably there's never a sensible reason to do that.
QWidgetPrivate::setScreenForPoint() can often give incorrect results
in multi-screen desktop configurations; this is a way of avoiding that.

Task-number: QTBUG-76162
Change-Id: I895696c6858ad953258c84b21117beea4c4fc01d
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit c068edcecf6876c7b57abbe302ad8b1347e4445e)
2020-04-27 22:37:25 +02:00
Alexandru Croitor
ad5186479a Bump version
Change-Id: Ib39025190448a4292cc278cdda536824bf1ab560
2020-04-22 16:30:37 +02:00
Andy Shaw
ad74e4597d sqlite: Fix CVE-2020-11656
This was taken from d09f8c3621d5f7f8 and b64674919f673602 in SQLite,
ref: https://www3.sqlite.org/cgi/src/info/d09f8c3621d5f7f8
https://www.sqlite.org/cgi/src/info/b64674919f673602

[ChangeLog][QtSQL][sqlite] Fixed CVE-2020-11656

Fixes: QTBUG-83652
Change-Id: I99bd59dc10b753ff19822c902dff1fc339d330a8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3e6089b695489d5ba513723230a54b4b5e8349ae)
2020-04-21 07:16:39 +00:00
Andy Shaw
7d95572211 sqlite: Fix CVE-2020-11655
This was taken from 4a302b42c7bf5e11 in SQLite, ref:
https://www3.sqlite.org/cgi/src/info/4a302b42c7bf5e11

[ChangeLog][QtSQL][sqlite] Fixed CVE-2020-11655

Task-number: QTBUG-83652
Change-Id: I5ead78d9ee63aa0f12f1c1014c79373728569f30
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 441ea6be15f68f46ecee2365a7e7ee7dd6f11ff3)
2020-04-21 07:16:29 +00:00
Timur Pocheptsov
36a8bdbc84 OpenSSL: handle SSL_shutdown's errors properly
Do not call SSL_shutdown on a session that is in handshake state (SSL_in_init(s)
returns 1). Also, do not call SSL_shutdown if a session encountered a fatal
error (SSL_ERROR_SYSCALL or SSL_ERROR_SSL was found before). If SSL_shutdown
was unsuccessful (returned code != 1), we have to clear the error(s) it queued.
Unfortunately, SSL_in_init was a macro in OpenSSL 1.0.x. We have to
resolve SSL_state to implement SSL_in_init.

Fixes: QTBUG-83450
Change-Id: I6326119f4e79605429263045ac20605c30dccca3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 8907635da59c2ae0e8db01f27b24a841b830e655)
(cherry picked from commit 8ddffc6ba4f38bb8dbeb0cf61b6b10ee73505bbb)
2020-04-17 12:34:52 +02:00
Joerg Bornemann
5ddec6ba08 macOS: Fix CONFIG+=separate_debug_info for custom QMAKE_BUNDLE_EXTENSION
The code that sets up QMAKE_RESOLVED_BUNDLE did not take QMAKE_BUNDLE_EXTENSION
into account. The logic is the same as in UnixMakefileGenerator::init().

Fixes: QTBUG-83222
Change-Id: I8fc4f16b399303394f2106e5c1071347ace93d4a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 12d5608a2521bd10313b44c6c56d68b9a0a680cc)
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2020-04-15 06:20:10 +00:00
Joerg Bornemann
c81a339866 Fix path replacement on install for header module prl files
For prefix builds the prl files of header modules still contained the
absolute path of the install prefix instead of $$[QT_INSTALL_LIBS]. This
was, because the QMAKE_PRL_INSTALL_REPLACE variable was only filled for
'lib' TEMPLATE projects. Header modules, however, have the 'aux'
template.

Fixes: QTBUG-82871
Change-Id: I90f248967f1bff41423d871a977ae91c78015bbd
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 2bf5e2edbb67d6bc0ad021f79c2ff3939a174669)
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2020-04-15 06:19:11 +00:00
Qt Forward Merge Bot
7d7afe1d2b Merge "Merge remote-tracking branch 'origin/5.12.8' into 5.12" 2020-04-14 12:27:22 +02:00
Qt Forward Merge Bot
6bd2457765 Merge remote-tracking branch 'origin/5.12.8' into 5.12
Change-Id: I3c060326bf24f31dda0fd6dd9ebf278da4c2fe46
2020-04-14 12:27:02 +02:00
Kimmo Ollila
edf5c7a346 Refactor OpenWFD QPA plugin for INTEGRITY Snapdragon 820 ADP
Add wfdBindSourceToPipeline call to enable vsync and also call
OpenWFD resource cleanup APIs in destroyNativeWindow.

Change-Id: I5dd5cbf66c0863624ec848f11a32c232fbe32cff
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
2020-04-14 11:45:13 +03:00
Thiago Macieira
2161414cdf CBOR support: prevent overflowing QByteArray's max allocation
QByteArray doesn't like it.

Apply the same protection to QString, which we know uses the same
backend but uses elements twice as big. That means it can contain
slightly more than half as many elements, but exact half will suffice
for our needs.

Change-Id: Iaa63461109844e978376fffd15f9d4c7a9137856
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 783d574b932288b61f915b28d5b7b9c5a979f58e)
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-04-10 14:46:10 -03:00
Thiago Macieira
67f54c1ebe QCborValue: apply a simple optimization to avoid unnecessary allocations
If the map or array is known to be empty, we don't need to allocate a
QCborContainerPrivate.

Change-Id: Ief61acdfbe4d4b5ba1f0fffd15fe212b6a6e77c3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit f581b041199ba7c825fbffd9110727360d1f2668)
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-04-10 14:46:02 -03:00
Thiago Macieira
07e8390b45 QCborValue::fromCbor: Apply a recursion limit to decoding
A simple 16k file can produce deep enough recursion in Qt to cause stack
overflow. So prevent that.

I tested 4096 recursions just fine on my Linux system (8 MB stack), but
decided 1024 was sufficient, as this code will also be run on embedded
systems that could have smaller stacks.

[ChangeLog][QtCore][QCborValue] fromCbor() now limits decoding to at
most 1024 nested maps, arrays, and tags to prevent stack overflows. This
should be sufficient for most uses of CBOR. An API to limit further or
to relax the limit will be provided in 5.15. Meanwhile, if decoding more
is required, QCborStreamReader can be used (note that each level of map
and array allocates memory).

Change-Id: Iaa63461109844e978376fffd15fa0fbefbf607a2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 02d595946faa7a21f6aa4109227f7e90db20ae7a)
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-04-10 14:45:53 -03:00
Thiago Macieira
be28eb44a8 QCborValue: create a wrapper to set the QCborStreamReader error state
The next commit will need to do so from outside QCborContainerPrivate,
where QCborStreamReader::d can't be accessed (private).

Change-Id: Iaa63461109844e978376fffd15fa0f6f04081bf2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit b7da66132bdd196c4f0b0e0fdf53f9e3b9a8bdaf)
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2020-04-10 14:45:41 -03:00
Topi Reinio
7ea9f0d3bb Doc: Adjust offline style for the litehtml rendering engine
Qt Creator now has the option to use the litehtml backend as a
replacement for the QTextBrowser-based help viewer.

Fix a few issues that the offline style has with the litehtml renderer:

- Fall back to using an unordered list for the navigation bar.
- Remove the background image for #buildversion and adjust font size.
- Adjust the generated padding around code snippets.

Keep the script that switches the offline-simple.css style to the
full offline style (offline.css) for JavaScript-enabled browsers.
The litehtml backend in Qt Creator will handle this switch internally.

With these changes, the generated offline documentation looks
acceptable when rendered with QTextBrowser, litehtml, or desktop
web browsers.

Fixes: QTBUG-82567
Change-Id: I86b179b1985b7ef54feddab30cb227b28021efe5
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
(cherry picked from commit 0b5a1100ff5ab4fb696e0efc9bc5e8f266cf40ae)
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2020-04-03 13:25:39 +02:00
Friedemann Kleint
afb3289548 Windows QPA: Prospective fix for crash occurring when changing screen during session lock
Check on currentScreen in QWindowsWindow::checkForScreenChanged().

Fixes: QTBUG-80436
Change-Id: I19e34b9e2c32c9cfc8e5e5b758783c0ab89d5556
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 6c23f006e07b774b0eef863cccd36a992274ca32)
2020-04-02 05:50:54 +01:00
Mike Achtelik
08d6cb7673 Handle exceptions when accessing android clipboard
In some circumstances android throws an exception or returns null,
when trying to access the clipboard.

Fixes: QTBUG-80689
Change-Id: I92c134e2a002fc648ff966e15a19eb3307c428a1
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
(cherry picked from commit 287b570ad5c00eb491f86eab0c4b8d3f6d96f666)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-03-31 04:57:33 +01:00
Antti Kokko
ca0dedf9ea Add changes file for Qt 5.12.8
Change-Id: I22227e4e671e509d6208f30220c00f026a09eb13
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-03-31 04:57:25 +01:00
André Klitzing
7593cbc474 Fix build with macOS 10.15 and deployment 10.12
io/qfilesystemengine_unix.cpp:1420:9: error: 'futimens' is only available on macOS 10.13 or newer [-Werror,-Wunguarded-availability-new]
     if (futimens(fd, ts) == -1) {
         ^~~~~~~~
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/sys/stat.h:396:9: note: 'futimens' has been marked as being introduced in macOS 10.13 here, but the deployment target is macOS 10.12.0
 int     futimens(int __fd, const struct timespec __times[2]) __API_AVAILABLE(macosx(10.13), ios(11.0), tvos(11.0), watchos(4.0));
         ^
 io/qfilesystemengine_unix.cpp:1420:9: note: enclose 'futimens' in a __builtin_available check to silence this warning
     if (futimens(fd, ts) == -1) {
         ^~~~~~~~

Change-Id: Ib52adf7b1ec4f1057d8cb260a00da509429cfaed
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 2f030c2cf3fe368be217c0e0b157e050d1c27afc)
2020-03-31 04:57:17 +01:00
Tor Arne Vestbø
c92ca4a41f iOS: Remove assert when doing GL rendering in the background
Fixes: QTBUG-76961
Change-Id: If2212601dbb867dd7ceb826b867bb24d302f86df
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit b7aaee002677caf411190bbc6ea7f18a28a71360)
2020-03-31 04:57:09 +01:00
Tor Arne Vestbø
6a60192ac0 Pass SDK root to the linker as -isysroot, not -Wl,-syslibroot
The former option to clang will result in more options to the linker,
such as the newly introduced -platform_version, which writes the
SDK version to the resulting binary. By using the syslibroot flag
directly we were missing the platform version, and binaries were
left without an SDK version set, resulting in failed validation
of the binary. Going with the clang driver gives us the right
behavior for free.

Fixes: QTBUG-83100
Change-Id: I98bc9ba644dae4bcc7a6a88481556bae185ce5fa
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-03-31 03:57:00 +00:00
André Klitzing
2f030c2cf3 Fix build with macOS 10.15 and deployment 10.12
io/qfilesystemengine_unix.cpp:1420:9: error: 'futimens' is only available on macOS 10.13 or newer [-Werror,-Wunguarded-availability-new]
     if (futimens(fd, ts) == -1) {
         ^~~~~~~~
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/sys/stat.h:396:9: note: 'futimens' has been marked as being introduced in macOS 10.13 here, but the deployment target is macOS 10.12.0
 int     futimens(int __fd, const struct timespec __times[2]) __API_AVAILABLE(macosx(10.13), ios(11.0), tvos(11.0), watchos(4.0));
         ^
 io/qfilesystemengine_unix.cpp:1420:9: note: enclose 'futimens' in a __builtin_available check to silence this warning
     if (futimens(fd, ts) == -1) {
         ^~~~~~~~

Change-Id: Ib52adf7b1ec4f1057d8cb260a00da509429cfaed
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-03-26 19:11:18 +01:00
Alexander Volkov
6cfb6519b3 xcb: Add support for XdndActionList property
This allows to pass and receive possible drop actions from other
processes, including GTK applications.

Fixes: QTBUG-75744
Change-Id: I944edc6fa00f8801a25912e70eb104a647a9fc0e
Reviewed-by: JiDe Zhang <zccrs@live.com>
Reviewed-by: Liang Qi <liang.qi@qt.io>
(cherry picked from commit cc1d891b8ed1c4f23183e4b06f46e5840a993e35)
2020-03-26 15:41:32 +03:00
Janne Koskinen
017a18f58d Add option to select build target for Integrity
From 11.7.6 onwards you need to select if your build is rel/dbg/chk/cov.
Added env variable where you can add which build target to configure.

Task-number: QTBUG-74716
Change-Id: I9ab3dd6177c5c5fa1da6aa7556784fa86d0d0348
Reviewed-by: Timo Aarnipuro <timo.aarnipuro@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
2020-03-25 13:09:43 +02:00
Janne Koskinen
f1cff873c9 Add missing libraries for S820 reference board
New BSP requires additional libraries

Change-Id: Ic5c3286751c4bd12113dad261037e03f3b2fd12f
Reviewed-by: Timo Aarnipuro <timo.aarnipuro@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
2020-03-25 13:09:43 +02:00
Lars Knoll
f432c08882 Add an expansion limit for entities
Recursively defined entities can easily exhaust all available
memory. Limit entity expansion to a default of 4096 characters to
avoid DoS attacks when a user loads untrusted content.

[ChangeLog][QtCore][QXmlStream] QXmlStreamReader does now
limit the expansion of entities to 4096 characters. Documents where
a single entity expands to more characters than the limit are not
considered well formed. The limit is there to avoid DoS attacks through
recursively expanding entities when loading untrusted content. Qt 5.15
will add methods that allow changing that limit.

Fixes: QTBUG-47417
Change-Id: I94387815d74fcf34783e136387ee57fac5ded0c9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit fd4be84d23a0db4186cb42e736a9de3af722c7f7)
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2020-03-25 05:10:58 +00:00
Tor Arne Vestbø
ce2d68ebe1 macOS: Flush sublayers via separate IOSurface backingstores
Flushing sublayers via QImage copies of the root IOSurface was causing
performance regressions due to the constant allocations of new images
each frame.

We now re-use the QCALayerBackingStore implementation for sublayers,
which gives a dynamic swap-chain.

We're still paying the CPU cost of the copy from the root backingstore
to the layered backingstores, as well as the memory cost, but at least
improves the situation.

We do not try to be smart and paint directly into the sublayers,
as that would leave the root backingstore stale, potentially causing
glitches when views are repositioned. Investigating this is left
for future work.

Fixes: QTBUG-82986
Change-Id: I758a3d8e1e40e2ed4fe6bc590a4a5a988d87a3a7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-03-25 06:10:08 +01:00
Timur Pocheptsov
02f8657ca2 q_getTimeFromASN1: fix invalid access
No sanitizer is needed, just looking at the code is enough.
It was wrong.

Change-Id: I9df417c137d6b3361c3161865e099a8be40860de
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit ad68ecf1d967f8e60c19c28a2bc23daf15389076)
2020-03-19 19:09:16 +00:00
Sona Kurazyan
2c6524167e Try to stabilize flaky test cases of tst_qsequentialanimationgroup
Use QTRY_COMPARE in the flaky tests instead of waiting.

Change-Id: Ic18fc5fde3fa47f3b3ef21e6acd876bd6990981d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 0ae6803d3956cf59801bbcc52143b95de9fc96d1)
2020-03-12 14:16:53 +00:00
Timur Pocheptsov
85908c9c27 Fix 'out of process' autotests
We are, arguably, not testing QProcess and its ability to start or finish,
we test QUdpSocket. If, for some reason (as we discovered on some
specific machines recently) the process does not start or does not produce
any output (canReadLine), we QSKIP instead of failing. Also, all those
QCOMPARE will bypass the part there we stop processes - so must be
RAII-protected.

Fixes: QTBUG-82717
Change-Id: Idfb0d4a483d753f336b3827875eeaf51c79270e2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit c668fd940d0c610324254d5aa5aab6e0769f78a6)
2020-03-12 10:15:20 +00:00
Timur Pocheptsov
e9ae7cf31f TCP socket auto-test: reduce flakyness
increaseReadBufferSize has several cases, surprisingly, subsequent
runs can be affected by close notification from the previous tests,
and then they ... break the expected logic test (by resetting
read buffer size and trying to read as much as possible).
Ah, and as it often happens with our auto-test - a client
socket leaked if some of COMPARE/VERIFY failed. unique_ptr
to rescue.

Fixes: QTBUG-82776
Change-Id: I9dc79072fdefc08417274dc341b88fca70c54dae
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2020-03-12 02:27:04 +01:00
Andy Shaw
cf92591348 Fix CVE-2020-9327 in SQLite
This was taken from abc473fb8fb99900 in SQLite, ref:
https://www.sqlite.org/cgi/src/info/abc473fb8fb99900

Fixes: QTBUG-82533
Change-Id: I9840e29f19a0b861229987f5b59d8585ba2e55dc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
(cherry picked from commit 2c1b4e37b936f64d6b52e2bc10ff97184a714b9a)
2020-03-09 13:57:26 +00:00
JiDe Zhang
283d9b01dc xcb: Fix logic for minimized state
When _NET_WM_STATE_HIDDEN is not contains in the _NET_WM_STATE
window property, the window should not be considered to be minimized

According to
https://specifications.freedesktop.org/wm-spec/1.3/ar01s05.html
_NET_WM_STATE_HIDDEN should be set by the Window Manager to indicate
that a window would not be visible on the screen if its desktop/viewport
were active and its coordinates were within the screen bounds. The
canonical example is that minimized windows should be in the
_NET_WM_STATE_HIDDEN state. Pagers and similar applications should use
_NET_WM_STATE_HIDDEN instead of WM_STATE to decide whether to display a
window in miniature representations of the windows on a desktop.

For mutter/GNOME Shell, without _NET_WM_STATE_HIDDEN, window manager
will not reply XCB_ICCCM_WM_STATE_ICONIC settings in WM_CHANGE_STATE
client message.

Task-number: QTBUG-76147
Task-number: QTBUG-76354
Task-number: QTBUG-68864
Done-With: Liang Qi <liang.qi@qt.io>
Change-Id: Ic9d26d963979b7f0ef4d1cf322c54ef8c40fa004
Reviewed-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 4f370d36ec5caa02f78545ceee5704d94edf0530)
2020-03-09 14:23:35 +01:00
Paul Lemire
d2c5aa90e5 Fix QShaderGenerator ES 3+ version declaration
The QShaderGenerator would use #version 300 es even if ES 3.1 or 3.2
was specified.

Change-Id: I2296ce8e01c732dd64dc1db40caeae83520bd3d3
Reviewed-by: Mike Krus <mike.krus@kdab.com>
2020-03-09 09:39:46 +02:00
Liang Qi
70600c8c7d Revert "Blacklist tst_QWindow::isActive on Ubuntu"
This reverts commit c6ee1899eaa50dae56c07b6c4b3490cc5aeb60e6.

It has been BPASSed since 2019-10-11 based on status in grafana.
See also 6c136973fd9b82420c818668086abe93f534993d, which has
unblacklisted this in 5.14 and later.

Task-number: QTBUG-67768
Change-Id: Id8f44169ba1e4ecef170c9cd00c363d1bf521283
Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
2020-03-07 08:41:18 +01:00
Dimitrios Apostolou
19aa8de06c Blacklist test that times out on windows
It seems something is going on with infrastructure and all windows VMs are
slower. Blacklisting until we figure it out.

Task-number: QTBUG-82717
Change-Id: Icab430125747df0a2d0ea4da8093a33ae75c5f13
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-03-06 17:41:16 +01:00
Volker Hilsheimer
66b3562651 Try again to make QDeadlineTimer test robust against context switches
Instead of comparing to absolute values, compare the result from
QDeadlineTimer with the reference clock types from std::chrono. Pass
the test as long as we are within 10% of that reference.

In addition, handle the case where QTest::qSleep sleeps for more than
10% longer or shorter than what is requested, and if so, abort the
test.

Change-Id: If8b77aea55a8c5c53e96427b2fff2f78281d0f82
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 4a1de178c9cc891560f38d64d89074799b0fa0e1)
Reviewed-by: Liang Qi <liang.qi@qt.io>
2020-03-06 17:40:55 +01:00
Volker Hilsheimer
423ddcb232 Fix flaky QElapsedTimer::elapsed test case
Much of this test case was testing that the machine it runs on didn't
take more than an expected amount of time, which is an assumption that
won't hold in a virtual environment where the hypervisor might decide
to not allocate any CPU time to the machine at certain times.

Instead, take the samples that we want to compare with once, then
use them as reference for further comparisons.

Also, split the test in two, with the comparison operators and msecsTo
test moved into a separate test function.

Change-Id: I7db12b8e02552f4d63af933c1b0fee9d62b591eb
Fixes: QTBUG-58713
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 715468df40e4ce97da04f327b6e34d535ff9b97d)
Reviewed-by: Liang Qi <liang.qi@qt.io>
2020-03-06 17:40:28 +01:00
Volker Hilsheimer
aa5911d34d Make QDeadlineTimer test more resilient against VM starvation
Flaky fails in this test suggest that the VM on which the
test is executed does not get CPU resources allocated for enough time
to make this test pass. This change makes the test more resilient by
taking the measurements as quickly as possible.

In addition, use a sanity-check based on std::chrono APIs to abort the
test completely if we see that the clock has advanced too far to make
the following tests meaningful.

Change-Id: Ie6ac4ffb52f20e7774014f8222c9cd8f54d8a263
Fixes: QTBUG-64517
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 8b9a02537300507d21d58ac7d3db4fe1a2f2fe62)
2020-03-06 17:40:11 +01:00
Nicolas Guichard
8c8f4c8c48 QShaderGenerator: Allow more expressions in input nodes
Currently QShaderGenerator will crash when encountering some expressions
in input nodes.

For example, this node prototype would make it crash:
"VERTEX_COLOR": {
  "outputs": ["color", "alpha"],
  "rules": [
    "headerSnippets": ["in vec4 vertexColor;"],
    "substitution": "vec3 $color = vertexColor.rgb;
                     float $alpha = vertexColor.a;"
  ]
}

Change-Id: I37abb8099d376843a4cb13228140467dc1b8f60c
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
(cherry picked from commit f9086ebd0198c53e8a811af47e0ff0c84d78eb30)
2020-02-28 06:54:38 +00:00
Mårten Nordheim
157be588f7 Replace usage of std::result_of with decltype
It's slated for removal in c++20

Fixes: QTBUG-82240
Change-Id: I7b35c151413b131ca49b2c09b6382efc3fc8ccb6
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit fb6acf08bbd7a68d027282251747620b942bd1d6)
2020-02-22 13:58:53 +00:00
Nicolas Guichard
34369b5e90 QShaderGraph: don't generate statements with undefined inputs
This fixes the shader generation for graphs like this one:

                 Function0 ------> Output0
            (with unbound input)

   Input ------> Function1 ------> Output1

With those graphs, createStatements will not return any statement for
nodes Function0 and Output0.

Change-Id: Iec32aa51623e176b03ae23e580f06d14df80a194
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
(cherry picked from commit 7981dbfaf371a368fbd69e935768b310f42a0e5a)
2020-02-21 12:47:28 +00:00
Nicolas Guichard
b150901525 QShaderGenerator: Don't crash when a node has multiple outputs
It was already possible to declare a node prototype with multiple
outputs, but trying to assign to all those outputs was not possible and
instead resulted in a crash.

It is now possible to declare nodes like this without crashing:
"SEPERATE_XYZ": {
  "inputs": ["vector"],
  "outputs": ["x", "y", "z"],
  "rules": [
    {
        "substitution": "float $x = $vector.x;
                         float $y = $vector.y;
                         float $z = $vector.z;"
    }
  ]
}

Change-Id: I748e77e84c9120dc688c573eee33dc13c6bfbace
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
(cherry picked from commit 39994e0705f11afc45e20872b95fb3a6e684c913)
2020-02-21 12:47:25 +00:00
Nicolas Guichard
c2827e617c Fix QShaderGenerator crashing when a node port name prefixed another one
QShaderGenerator didn't handle substitutions like
`vec4 $color = mix($color1, $color2, $fac);`

Note that `$color` is a prefix to `$color1` and `$color2`. For the
substitution `QByteArray::replace` was used so if `$color` was handled
first and replaced by `v1`, `$color1` and `$color2` were never correctly
replaced and instead became `v11` and `v12` which caused a crash later
on.

Change-Id: Idaf800fdac468f33c323eb722701da5f8eb918d6
(cherry picked from commit 49dbe760e4e0d8a781b5336efdce4748a7d73a33)
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2020-02-20 06:43:03 +01:00
Nicolas Guichard
27493cc4f2 QShaderGraph: Fix statement creation for graphs with dangling branches
For graphs like this one:

Input ----> Function1 ----> Output
      \
       ---> Function2
         (unbound output)

We would have generated only 2 statements, for Function1 and Output.

This change fixes this by treating Function2 like an output.
Therefore it generates 4 statements: Input, Function1, Output and
Function2.

Change-Id: Iaada40b9b949d771806dd47efad4f7ef2a775b48
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2020-02-18 12:10:10 +01:00
Tor Arne Vestbø
0912459c9d macOS: Skip NSOpenGLContext flush if window exposed size is out of sync
Some clients such as QOpenGLWidget will end up drawing and flushing
during the resize event, which for GL will result in an immediate update
on the screen. The problem is that the underlying Core Animation layer,
and the window's frame, has not been visually updated yet to the new
size, so we end up drawing "ahead" of what the window server is showing
the user.

Ideally we'd be able to present the GL drawing in a transaction, in sync
with the drawing of the window frame, but this API is only available for
CAMetalLayer and CAEAGLLayer.

As a workaround we detect when the exposed size is out of sync with the
window geometry, and skip the flush until the exposed size has caught
up. We know this will happen eventually as AppKit will always ask us
to display after a resize.

Change-Id: I1739ac8878b3fc6820a55dd017ddd170fd5f55d6
Fixes: QTBUG-79139
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit f39230fcac4de01f26945bde16c3a10c5ac74afb)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2020-02-17 12:14:38 +01:00
Tor Arne Vestbø
66e06b2963 macOS: Tag sub-layer images with color space on flush
Failing to tag the image results in costly CPU-based color-space
conversions.

Change-Id: Ib65547f4b99b83e10d3603c27388f50eb4d3840c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit c3c5a58f654537059366ecd3fe9811716bc202d2)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-02-12 11:07:37 +01:00
Konstantin Ritt
abeee81577 Android: release semaphore when the pending runnable causes an exception
Change-Id: Ide727dd5ceb987bdd4a093e6ee4f9c6b980f5ded
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2020-02-12 12:21:43 +03:00
Andy Shaw
3ba1122a02 sqlite: Update to v3.31.1
Since the patches applied previously are no longer required, we have
removed those too.

[ChangeLog][QtSQL][sqlite] Updated to v3.31.1

Change-Id: Ia80c31683a8cf92cfd114b6da32460ddcf38d502
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit eb45c37be7e32a20612b23f54a830ea0c4db7119)
2020-02-11 09:02:36 +00:00
Giuseppe D'Angelo
4b71f1c590 QXmlStreamReader: early return in case of malformed attributes
There's no point at keep raising errors after encountering the
first malformed attribute.

(cherry picked from commit 4d8a515a230ca9864a94830fd376a1d3ecbe6886)
Change-Id: I1c5e8caf92b09c91ec8c37eb72c72f2f937013e6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2020-02-10 14:15:19 +01:00
Thiago Macieira
52c0c4efcc QLockFile: Disable flock() on QNX
It appears it's not implemented.

[ChangeLog][QtCore][QLockFile] Suppressed the warning on QNX that said
'setNativeLocks failed: "Function not implemented"'. There is no
difference in behavior: Qt will continue not to be able to apply an OS-
level file lock, which means the lock could be accidentally stolen by
buggy software. Correct software using QLockFile should not be affected.

Fixes: QTBUG-81701
Change-Id: If79a52e476594446baccfffd15ee35bbac6c6e47
Reviewed-by: David Faure <david.faure@kdab.com>
(cherry picked from commit 9ede07613dc5b7759f398d5a8839b2ffdb4675a2)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-02-10 13:26:41 +02:00
Timur Pocheptsov
0cf046cc7c Fix symbol resolving for OPENSSL_NO_NEXPROTONEG
Our ALPN-related definitions were conditioned both on OPENSSL_NO_NEXTPROTONEG
and OpenSSL version (since ALPN first was introduced in 1.0.2), but
resolving was only under version check, not OPENSSL_NO_NEXTPROTONEG.
This went unnoticed for many years, and was found only recently with
OpenSSL built with no-nexprotoneg.

Fixes: QTBUG-81762
Change-Id: I7afca0b2034a234a19b5bcdefd3ce26f4202cddb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit e5408b62bdcee1abbc595eb581abcb540396ca4c)
2020-02-07 14:24:05 +00:00
Thiago Macieira
67a9c600ad Fix build: disable the HWRNG in bootstrapped mode
qmake build fails:
qrandom.o: in function `QRandomGenerator::SystemGenerator::generate(unsigned int*, unsigned int*)':
/home/tjmaciei/src/qt/qt5/qtbase/src/corelib/global/qrandom.cpp:333: undefined reference to `qRandomCpu(void*, long long)'

Fixes: QTBUG-78937
Change-Id: Ib5d667bf77a740c28d2efffd15cb4236f765917c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 4f88e0bbd1c014adc6db7a37e4754446c4c8f529)
2020-02-04 01:58:40 -08:00
Qt Forward Merge Bot
44879f8cde Merge remote-tracking branch 'origin/5.12.7' into 5.12
Change-Id: Ie152ac565d56ca4ae29998ee034ba4b8b5b8e234
2020-01-31 12:00:26 +01:00
Joerg Bornemann
8a3fde00bf Fix qt5_make_output_file macro for paths containing dots
Commit 89bd5a7e broke CMake projects that use dots in their build
paths, because the used regular expression matches the directory part
of the path as well.

The regex wants to achieve the same as get_filename_component(...
NAME_WLE) which is available since CMake 3.14. Re-implement the
NAME_WLE functionality for older CMake versions by using multiple
get_filename_component calls.

Fixes: QTBUG-81715
Task-number: QTBUG-80295
Change-Id: I2ef053300948f6e1b2c0c5eafac35105f193d4e6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2020-01-29 12:51:12 +01:00
Alexandru Croitor
322ffe643c Bump version 2020-01-28 11:56:56 +01:00
Antti Kokko
1bf5d3af1a Add changes file for Qt 5.12.7
Change-Id: I09407d3a542fe73e7788785b4d8ff952cbbfb9ed
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2020-01-24 07:54:31 +02:00
Andy Shaw
3f31b643b1 Fix CVE-2019-19880 in SQLite
Fixes: QTBUG-81565
Change-Id: I6bf2364e696315e5262d1abfa2f0b6947f14a33b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit f59ef938ce384b80819bcea660cf8626ff1789e7)
2020-01-24 05:54:04 +00:00
Thiago Macieira
eb192256e7 QLibrary/Unix: do not attempt to load a library relative to $PWD
I added the code in commit 5219c37f7c98f37f078fee00fe8ca35d83ff4f5d to
find libraries in a haswell/ subdir of the main path, but we only need
to do that transformation if the library is contains at least one
directory seprator. That is, if the user asks to load "lib/foo", then we
should try "lib/haswell/foo" (often, the path prefix will be absolute).

When the library name the user requested has no directory separators, we
let dlopen() do the transformation for us. Testing on Linux confirms
glibc does so:

$ LD_DEBUG=libs /lib64/ld-linux-x86-64.so.2 --inhibit-cache ./qml -help |& grep Xcursor
   1972475:     find library=libXcursor.so.1 [0]; searching
   1972475:       trying file=/usr/lib64/haswell/avx512_1/libXcursor.so.1
   1972475:       trying file=/usr/lib64/haswell/libXcursor.so.1
   1972475:       trying file=/usr/lib64/libXcursor.so.1
   1972475:     calling init: /usr/lib64/libXcursor.so.1
   1972475:     calling fini: /usr/lib64/libXcursor.so.1 [0]

Fixes: QTBUG-81272
Change-Id: I596aec77785a4e4e84d5fffd15e89689bb91ffbb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit e6f1fde24f77f63fb16b2df239f82a89d2bf05dd)
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2020-01-23 21:53:55 -08:00
Sona Kurazyan
4c8f2e881e Un-deprecate QSignalMapper
From the comments on QTBUG-73407 and the last comments on
29bcbeab90210da80234529905d17280374f9684, it seems like there are still
use-cases when QSignalMapper is useful.

Change-Id: I8402286cb8a395a4601cda8a4cdda51f19aef073
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b6688a4d4939b15713ffd8702253433032879fcb)
2020-01-23 16:12:40 +01:00
Tor Arne Vestbø
e2f35fa684 QWidget: React to platform surface being created or destroyed
The platform window may create or destroy its surface from other entry
points than the QWidget API, in which case QWidget needs to sync up
its own state to match. In particular WA_WState_Created and the winId
needs to be recomputed.

Fixes: QTBUG-69289
Fixes: QTBUG-77350
Fixes: QTBUG-80859
Change-Id: I769e58ead3c2efcf8c451c363108848feade9388
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit 009abcd7b66738bece6cf354776dfb2ef401636b)
Reviewed-by: Liang Qi <liang.qi@qt.io>
2020-01-23 13:45:56 +01:00
Kari Oikarinen
9d43d55b21 Merge 5.12 into 5.12.7
Change-Id: Ibc8bb93b238b79c7beacbb69ed2f691333af3af4
2020-01-23 11:53:12 +02:00
Rolf Eike Beer
303e9168eb eglfs: find correct framebuffer index even if device node is symlink
Using the Vivante driver on a board with different device trees I found the need
to let udev point me to the framebuffer actually connected to HDMI by adding a
symlink. Since the extraction of the framebuffer index failed and always
returned 0 the GUI still always showed up on the first framebuffer.

Change-Id: Ib4aa0fdd6e85d296c17fd977921cbc78e52dcdcf
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit dd23313d66846022894b56ad25b6c2c0fdb54762)
2020-01-22 18:10:11 +01:00
Andy Shaw
5e32c51b7a Fix CVE-2019-19646 in SQLite
Task-number: QTBUG-81020
Change-Id: I7176db20d4a44b1fb443a6108675f719e9643343
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3b697f496303bd005ae9d1d2c974efeed259d8a3)
2020-01-21 05:49:37 +00:00
Jani Heikkinen
182868f4d0 Bump copyright year
Change-Id: I9468ef21a2cf03cf07c38f012a2aa9bae6d02a03
Reviewed-by: Johanna Äijälä <johanna.aijala@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit 1e42c97cf055ac20352d20150e2786c14565ea2b)
Reviewed-by: Akseli Salovaara <akseli.salovaara@qt.io>
2020-01-20 08:17:46 +00:00
Jani Heikkinen
b84e1f0526 Update enterprise license agreement v4.2.1
Task-number: QTBUG-80661
Change-Id: Ic730a83465dffa2b1076c03a47d6f97a3a9a53a5
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit 860d10247425937de1dd48976e3677ced0f509d2)
2020-01-19 06:58:50 +00:00
Pasi Petäjäjärvi
a649475339 Add touch input device mapping support via QT_QPA_EGLFS_KMS_CONFIG
To be feature parity with evdev touch which already supports this

Change-Id: Ie7f9c868ea888725b24c3855106e1c0c0ba943a9
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 6224130cc821b0ef0dbdda80837e872c7996b916)
2020-01-18 09:37:31 +02:00
Thiago Macieira
567837a742 QObject: make the connectedSignals member use QAtomicInteger
The bitfield is always mutated under a mutex lock, so there's no need
for atomic bit operations. This is needed because there's one
outstanding access (in isSignalConnected()) that is done outside the
mutex.

Not needed in 5.14 because commit a5a859e721e7a1d0c5a3ec6abe2db55d9144bb36
removed the bit field altogether.

Fixes: QTBUG-81376
Patch-By: Chris Thornton
Change-Id: Idc3fae4d0f614c389d27fffd15ea1d372968f8f1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2020-01-15 13:26:00 -08:00
Tor Arne Vestbø
07c33ab76f Guard against null-nativeParent in QWidgetBackingStore::markDirtyOnScreen
The back port in 1e310b5a4508f removed the check in two of the call sites
for this function, that in 5.14 were handled elsewhere, but for 5.12 caused
us to not guard against null-nativeParent windows anymore.

Change-Id: I698c5a0b6a54bbee37b533fcafa75129768c5db1
Fixes: QTBUG-81315
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2020-01-15 15:45:23 +01:00
Jani Heikkinen
bdccc51bc1 Fix configure after updating qt license file
License file (LICENSE.QT-LICENSE-AGREEMENT-4.0) was recently updated to
version 4.2 and that broke the configure.

Remove qt license file version number from file name to avoid configure
update need when license file is updated

Change-Id: I77b4a4e7c6e590bbbce79d1c86cbcfb965841eae
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit a5cbff60f063d271500e31eba5bd236741d2367b)
Reviewed-by: Akseli Salovaara <akseli.salovaara@qt.io>
2020-01-15 05:18:32 +00:00
Jani Heikkinen
044ac31b24 Update Qt enterprise license agreement file to version 4.2
Change-Id: I4c42f92bda472aad5b0a0ebb92c6a982f1f64714
Reviewed-by: Akseli Salovaara <akseli.salovaara@qt.io>
(cherry picked from commit 0b2f13924263ad37e1654a856deb26601d09c4b4)
2020-01-15 05:18:25 +00:00
Morten Johan Sørvig
3f23d27dd5 Use QPointer for QWindow pointers in QGuiApplication
Guard against stale pointers; Use QPointer instead of
raw pointers for QGuiApplicationPrivate state variables.

Change-Id: Ie4f980f13dafe9729c1898b8fac7d26a87d2ca59
Fixes: QTBUG-80355
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2020-01-14 15:11:42 +00:00
Andy Shaw
cb5f69882e Fix CVE-2019-19645 in SQLite
Task-number: QTBUG-81020
Change-Id: I58b1dd9e7a90ba998c3af7f25a4627d8bdd70970
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 1e89c132e1280276e1d3a82ec3464afec8c14c3a)
2020-01-13 21:51:09 +00:00
Alexander Volkov
3271df912b QKeySequence: Add missing names for multimedia keys
Task-number: QTBUG-40030
Change-Id: Ib34bcbf42d6dd1206209c2d76444fd8c777278fe
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
(cherry picked from commit fcbf15c97bac91a889eccaa0cfad10093fd052f0)
2020-01-13 16:00:21 +03:00
Andy Shaw
1253069f65 Fix CVE-2019-19603 in SQLite
This includes the patch needed to fix this CVE and a supporting one to
include a new function added that it depends on.

Task-number: QTBUG-80903
Change-Id: Ic7639d50c89a3ee7d45426588c3ab0efd0eebb72
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit a75d238b3194ae4973be7f6ce0508a526d4aa49e)
2020-01-12 12:45:59 +01:00
Thiago Macieira
5839535c9f ucstrncmp: Fix UBSan report of array overflowing
The expression "a + offset + N" will eventually calculate an address
past the end of a, since we are comparing to end. That's undefined
behavior. Instead, calculate end - a and compare that to offset + N.

This commit subtracts "a" from both sides of the inequalities and swaps
the two sides to make them obey Qt coding style. Testing with GCC 9
(which is the only one I care about) shows the compiler generates the
same code.

Fixes: QTBUG-81218
Change-Id: Id84da383373844f3a4b0fffd15e7c1ab904daccd
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
(cherry picked from commit 64359ad710756e7cca5ca553521b2aada18fb0fe)
2020-01-11 07:33:11 -08:00
Andy Shaw
440a6ac65f Fix CVE-2019-19242 in SQLite
Task-number: QTBUG-80903
Change-Id: I78a72a574da5cf3503950afe47146ae6424f00c6
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit dcef0b96eef04c4e17c2e51ea71aea1f78625864)
2020-01-10 08:03:46 +01:00
Joerg Bornemann
ed54545d0d Fix dependency resolution for extra compilers in VS projects
De-duplicate the code that calls the extra compiler's depend_command by
using the central function callExtraCompilerDependCommand. This one
actually tries to resolve dependencies unlike the removed code that
blindly resolved relative paths to the build directory.

This fixes dependencies reported by uic which need to be resolved
against what is in DEPENDPATH.

Fixes: QTBUG-80579
Change-Id: If482e50ff3eff716fefffee82004acc076b3a547
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit 9d7ed92f6e63cd2d1a1388874e54b37b5cfd01b7)
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2020-01-09 19:44:09 +01:00
Joerg Bornemann
96df877ebc De-duplicate code for calling extra compiler depend_command
Flesh out copy-and-pasted code into a function and adjust the coding
style on the go.

This refactoring is needed for a subsequent fix.

Change-Id: I9b8a87d6dd5c33cc1ed9f613fe85daca52309369
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
(cherry picked from commit af7e0e735777d7f7d1606049e5261106a092665a)
2020-01-09 19:44:04 +01:00
Andy Shaw
9c80104cfd sqlite: Update to v3.30.1
Since the patch applied previously is no longer required, we have
removed that too.

[ChangeLog][QtSQL][sqlite] Updated to v3.30.1

Fixes: QTBUG-79416
Change-Id: Ifc3fcc6e1768f80e97a5e0ab4b2aeabddf2ced9d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
(cherry picked from commit 11acbc2c9928603dae6b4e2f1ca8b745e766f92b)
2020-01-08 12:36:12 +00:00
Qt Forward Merge Bot
3dd88d367f Merge "Merge remote-tracking branch 'origin/5.12.6' into 5.12" 2020-01-08 09:52:30 +01:00
Qt Forward Merge Bot
9eac4b1faf Merge remote-tracking branch 'origin/5.12.6' into 5.12
Change-Id: Idcbf469ddcd6824f97a56c5e3a2e5fcc1d9706cf
2020-01-07 11:51:48 +01:00
Tor Arne Vestbø
0b4bfe1757 macOS: Skip uninitialized buffers in IOSurface backingstore
Task-number: QTBUG-80972
Change-Id: Ifb8eb84d6b802556ccd52ac129a91e142e265a81
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 77f1d0bfa542e166deaa196b3b3b854d33a3a1b7)
2020-01-07 11:40:04 +01:00
Tor Arne Vestbø
25e20ae39e macOS: Handle missing color space information in IOSurface backingstore
Fixes: QTBUG-80972
Change-Id: Iab3f1a9cf03251340e5f32bcc73103428e93282d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 105e662221cc90d5002e06c97febf50c5c601336)
2020-01-07 11:40:00 +01:00
Tor Arne Vestbø
2a0186420c macOS: Don't throw away backingstore buffers when backing properties change
Clients such as QtWidgets that do their own dirty tracking will assume
they can just flush in response to the expose event, without repainting
anything. Since we have no way at the moment to inform these clients that
the backingstore content might be invalid we can't just throw it away.

It turns out that to pick up changes in color spaces we can just tag
the existing buffers with the new color space, so we don't need to
throw it away. And for the older surface-backed mode we tag the color
space on flush, so we didn't need to invalidate anything in the first
place.

Fixes: QTBUG-80844
Task-number: QTBUG-77749
Change-Id: Icb1ceb178894bb43887cdf03fb855d2d614b5ab0
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 7ac4e55cb979dff890f1575e771e5f2def9e3131)
(squashed in commit c027d9b61e15)
2020-01-07 11:39:57 +01:00
Michal Klocek
28b138cbc2 Add check for global share context for QOpenGLWidget initialize
Fixes: QTBUG-78863
Change-Id: I678f66a2057fb9c98863e19eb09042306e72f68a
(cherry picked from commit ce2fc51914f809369d5096e7a0621229dd9eaef9)
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2019-12-19 16:44:57 +02:00
Andy Shaw
277b8dde1a Fix CVE-2019-19244 in SQLite
Fixes: QTBUG-80635
Change-Id: I718349e28ec76ea164dd50f2a985f2074dd6bdbd
Reviewed-by: Jesus Fernandez <jsfdez@gmail.com>
(cherry picked from commit a7108ec6cfb6411e40a4012f3e6d3b5d5fb9631d)
2019-12-11 14:24:13 +00:00
Alexander Volkov
7110eb7ca1 Avoid crash in menu that was previously shown as submenu
Reset sloppyState for the previous submenu, so that if it
will be shown as a menu, it will not use an incorrect pointer.

Fixes: QTBUG-80528
Change-Id: If2ba8c3a664983ee76eb90d2c9a8096e2bd0a4e6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 8339ce2155752eb8fa0f49f3fe4b24f9643ae463)
2019-12-10 14:29:06 +03:00
Laszlo Agocs
d96bbd999f Fix depth in renderText()
Fixes: QTBUG-31156
Change-Id: I3cbb3f9c5dfbcb182dbe283b0bf0f05a031970a5
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit c625d923853d01ad668dd3e8ebd55b7e5a6bcdb8)
2019-12-09 12:32:51 +01:00
Lars Schmertmann
b8e404f6d0 Remove dead code to fix a lint warning
Obsolete SDK_INT Version Check
------------------------------
This check flags version checks that are not necessary,
because the minSdkVersion (or surrounding known API level)
is already at least as high as the version checked for.

The mindSdkVersion in templates/AndroidManifest.xml is 16 for Qt 5.12
and androiddeployqt also ensures that the minSdkVersion is not below 16.

Change-Id: Ifdb6f773dccdb75c35119df833c976b7b76b3356
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
2019-12-06 14:22:05 +01:00
Volker Hilsheimer
13bbb1d9b9 Fix sizeHint of QProgressDialog to have enough space for window margins
Some styles, notably QMacStyle, use different margins for widgets and
for windows. For these margins to be returned correctly, we have to
tell the style that we want them for a toplevel widget. This was
done correctly when laying out the dialog, but not when calculating the
sizeHint, leading to a default size of the dialog that was too small
to fit the text.

As a drive-by, change variable names in the sizeHint method to be a
bit more readable.

Change-Id: Ib4168c7be176fa816241ebcc5f9235db4a7f982f
Fixes: QTBUG-80272
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-12-03 17:05:57 +01:00
Tor Arne Vestbø
6cddd0e8cf iOS: Guard against request for textInputView without focus window
Change-Id: I7b8df07fffef1cc948f6720685234540a20ccc81
Fixes: QTBUG-79316
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 9ac156c90b92a981f70929e081c64083b14e9a57)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-12-03 09:18:32 +00:00
Liang Qi
1e5566c2e9 Revert "Fix build with -no-feature-printer"
This reverts commit de8bd9ec6b21e3b43b08c4c2588b5116a7ca8ece.

We need to keep the empty printsupport library for ios at least.

Fixes: QTBUG-79124
Task-number: QTBUG-80323
Change-Id: I543a76a897eec2c9bc51a3f2d080be3a9cc07871
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-12-02 13:18:37 +01:00
Kai Koehne
13c19db171 Fix regression in how "pkg-config --static" output is handled
Change a1ea49878927dfe2 did replace different pkg-config calls for
-L, -l arguments to one. Anyhow, it also removed the eval() call that
ensured that the return string was split by whitespace, meaning that
paths couldn't resolve anymore properly if multiple arguments were
returned.

Fixes: QTBUG-79668
Change-Id: I4091fea6891ef79836e05f8e87ffa9d69863a8f5
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 99e43db7cea1c838993c151d2d40fc2874a94256)
2019-11-27 11:40:46 +00:00
Tor Arne Vestbø
1e6a680f83 CoreText: Modernize style hint fallback lookup
The DefaultFontFallbacks.plist system file that we used for looking up
style fallbacks does not exists in macOS 10.15, nor did it ever exists
on iOS. Instead of relying on this file, we hard-code a set of default
families, that we then look up the fallbacks for.

The result of QFont::defaultFamily() on macOS is now:

  QFont::Helvetica --> "Helvetica"
  QFont::Times --> "Times New Roman"
  QFont::Courier --> "American Typewriter"
  QFont::OldEnglish --> ""
  QFont::System --> "Lucida Grande"
  QFont::AnyStyle --> "Lucida Grande"
  QFont::Cursive --> "Apple Chancery"
  QFont::Monospace --> "Menlo"
  QFont::Fantasy --> "Zapfino"

And on iOS:

  QFont::Helvetica --> "Helvetica"
  QFont::Times --> "Times New Roman"
  QFont::Courier --> "American Typewriter"
  QFont::OldEnglish --> ""
  QFont::System --> "Helvetica"
  QFont::AnyStyle --> "Helvetica"
  QFont::Cursive --> ""
  QFont::Monospace --> "Menlo"
  QFont::Fantasy --> "Zapfino"

Fixes: QTBUG-78240
Change-Id: Ie9bc13c9c1031d89f024199e4736a046c568a48d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
(cherry picked from commit 7f0faddf9fe25adc0a3e0827e21c030d6a7a1035)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-11-27 11:38:27 +00:00
Alexey Edelev
89bd5a7e73 Replace get_filename_component usage with REGEX_REPLACE
Replace get_filename_component usage with custom string
REGEX_REPLACE to avoid cutting non-ending suffices while
moc generation

Fixes: QTBUG-80295
Change-Id: I8cdb729370c6d884f6638d172ee523fdc2df5404
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2019-11-27 09:58:28 +01:00
Laszlo Agocs
a5a37a7529 eglfs: kms: Read page flip events on a dedicated thread
Task-number: QTBUG-74953
Change-Id: I9a630c9245d8b0afe40ade9199cf4f1d358275da
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
(cherry picked from commit 14bb413309092adc53e8451daff5690c4698c07d)
2019-11-26 14:37:05 +01:00
Laszlo Agocs
5705133066 eglfs: kms: Make threaded atomic drm work
The atomic modesetting support was not prepared for page flips being
issued from different (per-screen) threads.

This could be seen with the threaded render loop of Qt Quick: having a
QQuickWindow per screen means having a dedicated render thread for each
screen. QKmsDevice used simply instance variables to keep track of the
request. This leads to the commit failing with EBUSY sooner or later.

Make the atomic request and related variables thread local.

This prevents failing drmModeAtomicCommit() with 2 or more screens and
the threaded render loop. It does not fix other potential issues when
waiting for page flips to complete, that is to be tackled separately.

Task-number: QTBUG-74953
Change-Id: I2dac10d5e9bdc0cb556ac78c9643c96d40d692e4
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
(cherry picked from commit 5bd48047de4abecc47187d938c5e6ed8b8304aaf)
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-11-26 14:37:01 +01:00
Andy Shaw
d1b009cbbb Remove the unregistered recognizer from the main list
This amends 1320b2f64412f0d86bd09c66c22df845e13a94a1 to keep the
behavior of removing from the main list but without re-introducing the
memory leak.

Fixes: QTBUG-77770
Change-Id: I91fa6cb71fab8d60baa35417fdb34322af11dbbb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
(cherry picked from commit 7d73d4b9a93b3132c1a24aa3ae77f0a307e821fd)
2019-11-15 15:03:13 +00:00
Andre de la Rocha
2812f0861c Windows QPA: Fix close button not working on Windows 7
A previous change modified hit testing in the non-client area of
fixed-size windows, in order to prevent showing a resize cursor when
the windows are not resizable (QTBUG-77220). The change assigned
HTCAPTION for any point over the entire title bar, including the top
bar buttons, which on Windows 7 classic or basic desktop caused these
buttons to become unresponsive. The present fix changes this behavior
to redefine only the outer sizing frame, while letting the rest of the
title bar be handled by DefWindowProc().

Fixes: QTBUG-78262
Change-Id: Id6e821a805c8333a67988f87c3727bed0c93290e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit a8ec52d5e76bc769ed63be1ad543be8f687e5dac)
2019-11-13 12:48:33 +01:00
Olivier Goffart
52b739776d Do not load plugin from the $PWD
I see no reason why this would make sense to look for plugins in the current
directory. And when there are plugins there, it may actually be wrong

Change-Id: I5f5aa168021fedddafce90effde0d5762cd0c4c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit bf131e8d2181b3404f5293546ed390999f760404)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2019-11-13 10:46:36 +01:00
Andy Shaw
f0b93f7a4b iOS: Account for UITextInteraction when building against 12.x or lower
In iOS 13.0 we can handle UITextInteraction as normal, but in lower
versions it is not available to utilize at compile time. So we have to
check for the other types instead and return if it is not one of those.

Change-Id: Icbc5558e677ed40c03f30a174e2d79b87f489f68
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 3916b8a28bc9c55e10f4de611ed76e17017494aa)
2019-11-08 15:57:07 +00:00
Frederik Gladhorn
fa2323e37b Bump version 2019-11-07 13:06:44 +01:00
Kari Oikarinen
1930af194c Merge 5.12 into 5.12.6
Change-Id: I281538c2c9fc5d97a4b65d8add80e4eb1407ab7d
2019-11-07 09:27:42 +02:00
Antti Kokko
f73cd386c3 Add changes file for Qt 5.12.6
Change-Id: Iff5f92f9d947a8b557aab87a36b3a91e335d1a4b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-11-06 11:55:06 +01:00
Joerg Bornemann
515e9a1427 Ignore non-existent .ui file dependencies
Commit 80dea664 broke .ui files with global includes that are not part
of the project, because we blindly added every file path that falls
out of 'uic -d' as dependency.

Introduce the extra compiler CONFIG flag dep_existing_only to bring
back the old behavior that ignores non-existent dependencies and set
it for uic.

Change-Id: I6eaa82817c932a98ebac6d08115a9815d4b9dd21
Fixes: QTBUG-78144
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
(cherry picked from commit 90779d96adfa51a3fc00b6c0d93168b4bbfcf983)
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-11-06 08:03:39 +00:00
Andy Shaw
40b33adb7a Ensure that child windows are visible again when showing their parent
When a window is closed, then it will cause the child windows to be
closed as well as a result. Therefore in order to ensure that they are
shown again as a result, we need to remove the WA_WState_ExplicitShowHide
attribute if the widget was not already hidden before. This enables us to
test for this attribute when calling showChildren(), so that if the
window has a windowHandle then we can make sure that this widget is shown
again.

Fixes: QTBUG-73021
Change-Id: I1186242b889899dfcd38d782a67567348e2055ee
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit ccd3bf0871b81dfc09bb469b161f32dfb47ee53e)
2019-10-31 08:53:41 +00:00
Frederik Gladhorn
15f29c3a24 Bump version 2019-10-30 15:26:06 +01:00
Eirik Aavitsland
7bbbfc38ce Update bundled libjpeg-turbo to version 2.0.3
[ChangeLog][Third-Party Code] libjpeg-turbo was updated to version 2.0.3

Squashed cherry pick of:
e14e8427faae670c662efede723edc2db4c875cb
97e78b0e1f0396cdee0319bafaf8ce1d6eb74f64
f3dbe98dca58731ff98dff3cc9111a8252f8e1e6

Change-Id: I9f9b8b3a913fd5843759c0610f43b22c5bee67dc
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-10-30 11:04:01 +01:00
Andy Shaw
c6d07c5418 Only call ShowCaret if Windows 10 1709 or later is used
This amends cc873ec23a98ac32d10ac5fa569792fde2f6b2c8 which worked around
a problem that was showing up on earlier versions of Windows. This
extends the workaround up to Windows 10 1703 as the problem was still
occurring up to that version.

Fixes: QTBUG-79143
Change-Id: Ib7eace17fb8e3817c556e2bcd462e37834b1cbcf
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
(cherry picked from commit be73bdc5d2491d036e5a6334dada453ed808dbc0)
2019-10-30 08:14:22 +00:00
Ville Voutilainen
a4a5b4288e Fix a -Wclass-memaccess problem in qjson
qtbase/src/corelib/serialization/qjson_p.h:230:38: error: ‘void* memcpy(void*, const void*, size_t)’ copying an object of type ‘QJsonPrivate::qle_ushort’ {aka ‘class QSpecialInteger<QLittleEndianStorageType<short unsigned int> >’} with ‘private’ member ‘QSpecialInteger<QLittleEndianStorageType<short unsigned int> >::val’ from an array of ‘const class QChar’; use assignment or copy-initialization instead [-Werror=class-memaccess]
  230 |           str.length()*sizeof(ushort));
      |                                      ^

Change-Id: Ie58e7fe4bae3003227364012ad56ab23bd560d8c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
(cherry picked from commit 9367d966e6c10c95b92f2b55e2cead7e85d80cfe)
2019-10-28 13:52:49 +03:00
Eskil Abrahamsen Blomfeldt
8476ac456e Revert "Release left button before showing the popup context menu"
This partially reverts commit 5e8b16f0e4247cc978b08480450526cfa3b25029.
Releasing the mouse button synthetically made it impossible
to use tap and hold gestures. When investigating, it seems
that other changes have fixed the original issue that
5e8b16f0e4247cc978b08480450526cfa3b25029 was meant to address,
so this is no longer needed.

[ChangeLog][Android] Fixed regression that made it impossible for an
application to use the tap-and-hold gesture.

Fixes: QTBUG-72408
Change-Id: I53f687d047a4ad0fdf3c8c96a00ed1b11d09f047
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
(cherry picked from commit d3398207d0384e786f466662fa40c6fb86844fb6)
2019-10-25 14:29:57 +02:00
Friedemann Kleint
cb90cdbd65 Windows/MinGW: Fix posted events timer not stopping
Specify the type of the enum value SendPostedEventsWindowsTimerId
to be UINT_PTR to work with the g++ interpretation of enumeration
signedness and use the correct type for the returned timer id.

Fixes: QTBUG-78491
Change-Id: I7b3f306d3f60da7a21500ece5243ac90854ccf1a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d35de9e1b250ce46739dcb6afb9ae8a0247195c7)
2019-10-24 11:29:50 +02:00
Eskil Abrahamsen Blomfeldt
e1e4b1b780 Remove DirectWrite warning when loading bitmap fonts
We use DirectWrite to determine whether a font is a color font
or not, so all fonts go through DirectWrite initially. However,
the load call will fail for bitmap fonts, causing us to output
lots of pointless warnings each time such a font was in use.

Instead, we only output this warning if we actually plan to
load the font through DirectWrite later. If the load fails,
we can assume it is not a color font and do not need to output
any warning for this.

[ChangeLog][Windows][Text] Removed confusing DirectWrite warning
when loading bitmap fonts.

Task-number: QTBUG-57180
Change-Id: Iaac8117745ef05a1dff23b346dbe0c6dbfb315f7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
(cherry picked from commit c4a524f3a129ad9ab6d08cd8de2dc917e3d78fc5)
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2019-10-21 13:56:27 +00:00
Tor Arne Vestbø
197dfcd36f macOS: Optionally flush sub-layers via sub-image copies of the backingstore
When we're flushing the backingstore to sub-views with their own layers
we don't want to pay the cost of uploading the whole backingstore to the
GPU in the case where we're dealing with a discrete GPU.

To work around this we make a copy of the appropriate part of the surfcace.

This results in additional copies of the data, and will need further
investigation to limit these.

Task-number: QTBUG-77447
Change-Id: I318ae80e433dd7b0a55fd5a598b19f114d8bd28e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit eaf4911db29a82b3d94826a8ff09afe075a2b636)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-10-18 13:42:51 +02:00
Andy Shaw
45237fa54c iOS: Account for when the older SDK is used when building
Since the pre-built versions of Qt at this point are still built against
the iOS 12.x SDKs, then we need to account for this in order to have the
workaround implemented in e00d888daefbfbd5f17e0772421773f8e295087b still
working when deployed to an iOS 13 based device.

Change-Id: I649a453c549ee272de64624d68f9382276fcba64
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 631efee29371246ba1a1d9d007b23ca08b867191)
2019-10-18 11:40:28 +00:00
Joerg Bornemann
f470cc2da9 Fix assert in VS project generator
We must check whether outputs or inputVars are non-empty before
accessing them.

This amends commit 68866b1a.

Task-number: QTBUG-79178
Change-Id: Iecf6dc705bac9bef5133ae2e5ceeace5f859f175
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit d3d5eadf2432ddc874eabbb2d2f56c4b9ff8830f)
2019-10-16 13:31:34 +02:00
Volker Hilsheimer
31f07f3114 Fix for compilers that don't allow casting nullptr_t to an integer
Visual Studio 14.0 toolchain at least seems to be broken enough to
somehow interpret the cast from nullptr to a quintptr as being
ill-formed, inspite of it being valid C++.

Change-Id: Ifb29be3af82764cb31fa65409f7e1000ea419498
Fixes: QTBUG-79080
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2019-10-14 20:07:27 +02:00
Timur Pocheptsov
28798478ba DTLS auto-test(s) - fix a buggy logic with pending datagrams
Fixes: QTBUG-79128
Change-Id: Ifebd5b056541b7732b15b5cf063ad22ab754a64c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-10-11 02:32:37 +00:00
Edward Welbourne
1fd2124de7 Include likely-adjusted uiLanguages for the system locale
QLocale::uiLanguages() on the system locale uses whatever the system
locale's query(QSystemLocale::UILanguages,...) returns. On Android,
this is just a list of locales. However, for non-system locales, we
also include some results of removing likely sub-tags from the locale
name, where equivalent. Thus zh-CN would also get zh and zh-Hans-CN
added to it; however, if the system locale is zh-Hans-CN, the shorter
forms are omitted. So post-process the system locale list in the same
way, albeit tweaked to avoid duplicates and rearranged so that we can
insert likely-adjusted entries between what they adjust and what
followed it.

Added QLocalePrivate::rawName() in the process, since it looks likely
to be useful in other contexts (and I needed its value): it just joins
such tags as are non-Any. This, however, uses QByteArrayList, so added
that (it's small) to the bootstrap library and qmake.

This follows up on commit 8796e3016fae1672e727e2fa4e48f671a0c667ba.

[ChangeLog][QtCore][QLocale] The system locale's UI languages list now
includes, as for that of an ordinary locale, the results of adding
likely sub-tags from each locale name, and of removing some, where
this doesn't change which locale is specified. This gives searches for
translation files a better chance of finding a suitable file.

Fixes: QTBUG-75413
Change-Id: Iaafd79aac6a0fdd5f44aed16e445e84a2267c9da
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 0118e2e9151ae3e1e1cd72f24e8c129eaa69dc4f)
2019-10-10 19:11:00 +00:00
Thiago Macieira
f2e9505aa1 Filesystem: avoid crashes on exit in case the locale codec is null
On exit, QLocale::codecForLocale() can return null as the codec may have
already been destroyed. In that case, pretend that Latin1 was the
locale, so any file name is acceptable. This matches QString:

    QTextCodec *codec = QTextCodec::codecForLocale();
    if (codec)
        return codec->toUnicode(str, size);
 #endif // textcodec
    return fromLatin1(str, size);

Note that if we're wrong and the locale was *not* Latin1, files that you
had a name to may not be encoded or decoded the same way.

Fixes: QTBUG-78446
Change-Id: Iece6e011237e4ab284ecfffd15c54077728a17ca
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 70e6e9fe590590f602dee230a64870365d9301aa)
2019-10-09 20:08:48 +02:00
Shawn Rutledge
41e59afc41 evdevtouch: Report stationary touchpoints that include pressure changes
Task-number: QTBUG-77142
Change-Id: I35446092679573df51891302155c896a3bb6fc1c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit ee9bc61cd906505271bad887664c15b9397906ab)
2019-10-09 08:52:40 +00:00
Dmitry Kazakov
d1646b37b1 Fix QRandomGenerator initialization on AMD CPUs
Some AMD CPUs (e.g. AMD A4-6250J and AMD Ryzen 3000-series) have a
failing random generation instruction, which always returns
0xffffffff, even when generation was "successful".

This code checks if hardware random generator generates four consecutive
equal numbers. If it does, then we probably have a failing one and
should disable it completely.

Change-Id: I38c87920ca2e8cce4143afbff5e453ce3845d11a
Fixes: QTBUG-69423
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
(cherry picked from commit 5839714d986f28412c9f9ed4801d1bf9378f7b51)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-10-08 21:21:47 +02:00
Andy Shaw
4a9292f169 Ensure all children of a widget get updated when a stylesheet changes
Before, only the direct children would get an update when the
stylesheet changed, any children below that would be unchanged.

Fixes: QTBUG-77006
Change-Id: Id668eaae74a8289d78d66644f077e6a3302960cd
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
(cherry picked from commit 9b6179cf957c32e0c02547d510dfee2088f02340)
2019-10-08 08:24:58 +00:00
Tor Arne Vestbø
2465184351 iOS: Prevent UIKit from adding UITextInteraction to our view
It's added automatically when some languages such as Japanese are
the active input language/keyboard, which results in UIKit triggering
the edit menu for any tap in the UI, regardless of whether it hits
the focus object or not.

Adopting the protocol is a much larger effort and needs to be
coordinated so that we still support text interaction on iOS
versions pre 13.0.

Even with this patch the UITextSelectionView will still blink
its own cursor, which doesn't seem to sync up with the UITextInput
protocol's view of where the cursor is.

Fixes: QTBUG-78496
Change-Id: I61500ad7ab9c8577f71188c0c99ead39465e3839
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit e00d888daefbfbd5f17e0772421773f8e295087b)
2019-10-07 16:59:15 +02:00
Andy Shaw
f7d44cc6da Fix CVE-2019-16168 in SQLite
v3.29.0 is the latest and there is no indication as to when the next
release is so we will apply this separately for now and it can be
reverted once it is in a release that we ship with.

This patch is taken from https://www.sqlite.org/src/info/98357d8c1263920b

Change-Id: I82d398b093b67842a4369e3220c01e7eea30763a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
(cherry picked from commit c3faeb852866a2fc8ae9cd6f8cf91947bd42b538)
2019-10-07 05:51:38 +00:00
Andy Shaw
ee932d3ed5 sqlite: Update to v3.29.0
[ChangeLog][QtSQL][sqlite] Updated to v3.29.0

Change-Id: Ibf61c829dcd24dc8cdf00f5b57078255b0ad5ef1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
(cherry picked from commit f88476569a8608d0f8257fcf3c426cbc68de6d7c)
2019-10-07 05:51:10 +00:00
Tor Arne Vestbø
1304b6705e Xcode: Ensure there's always a CFBundle[Short]Version[String] set
Leaving it empty resulted in errors from Xcode when compiling the app.

Task-number: QTBUG-25309
Task-number: QTBUG-74872
Change-Id: I61b0f47d754c5f5b181a6f918283d990458cc78d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 1d1ed017119df2cd28a9e21aee0a8cece5282250)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-09-27 15:41:16 +02:00
Shawn Rutledge
52889ded67 Add QQuickMultiPointTouchArea as a friend of QTouchEvent
QQuickMultiPointTouchArea needs to understand whether a stationary
touchpoint has relevant property changes, to decide whether to emit its
updated() signal. Amends 217dd1b3b03cd40b4bb926631464c684f7f84a69

Task-number: QTBUG-77142
Change-Id: I85e031820bef9d687369b7d67a57c67fe2875b4b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit bc35941dbbf6cbd09805a2217ecb062c565855ad)
2019-09-25 16:13:53 +02:00
Shawn Rutledge
d570f19652 Mark stationary touch points as updated if pressure or velocity changes
This is to inform Qt Quick when a stationary touchpoint is delivered
that it is because of a changed property. Qt Quick still needs to avoid
delivering item-customized events (with only the touch points that occur
inside the item) that contain only stationary touch points without
changed properties. To be able to check this private flag,
QQuickPointerTouchEvent needs to be a friend.

Task-number: QTBUG-77142
Change-Id: I6ee0dffbbeca9e513c77227b757252e2eec6a4ef
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 217dd1b3b03cd40b4bb926631464c684f7f84a69)
2019-09-25 16:13:46 +02:00
Andy Shaw
e8b3593ecb Move DialogButtonBoxLayout case to be before MouseDoubleClickDistance
This amends 9be66cb282dee1ce4380602a2f3caf5abfd144cf so that the
DialogButtonBoxLayout case is moved to be before the
MouseDoubleClickDistance one in case the fallthrough is triggered.

Change-Id: I843dad6b55ccffe6b6c275cd75587f04659e512f
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
(cherry picked from commit 54d3059ccfe6df0a375d2addac4ad41333122b8d)
2019-09-24 07:16:25 +00:00
Daniel Smith
cc1dc42c1f Update lancelot tests to use non-system-specific host info collection
Change the lancelot baseline test runner to use generic text files for
host info data collection. This also avoids relying on QProcess and
scraping the bash scripts output from stdout.

Fixes: QTBUG-71836
Change-Id: I88a46c99dbb11f71afc18cae5a6d2fbebcbe76c5
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 651dd26403052f98397783927ad02e008acf0552)
2019-09-23 11:51:26 +00:00
Shawn Rutledge
19ab8bf7e7 evdevtouch: Add fallback definition of ABS_MT_PRESSURE; fix alignment
Fixes: QTBUG-78298
Change-Id: Ib6acb1fdca551a84aba5dec2f28cf784a212692c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit 15e1c159868774b0b3c532a09281d45798b0f5d8)
2019-09-20 15:11:35 +02:00
Tor Arne Vestbø
1e310b5a45 widgets: Mark widgets as needing flush during painting
Except for the case of syncing in response to an expose event,
where the platform asked us to flush a specific region, we
should strive to only flush parts that have been repainted.

And we should flush those parts to their nearest native child,
instead of unconditionally flushing the root/top level widget
as well.

By allowing drawWidget to schedule the flush we automatically
flush the minimal region, to the right widgets.

(manually cherry-picked from commit 79bf1b7e348d186934b14c417859a48bf9b3a06c)

Task-number: QTBUG-77447
Change-Id: I1a8fa703c0b7172655271e2a8f5eca694cb14129
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2019-09-20 11:45:41 +00:00
Shawn Rutledge
9a322dfdea macOS dark mode: set the link color
Fixes: QTBUG-71740
Change-Id: I49f49338c7f3a28845de63c2a6bf2dc8495dd108
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 117175a2f2ecab990f65eefd32b42be22f9aa3ce)
2019-09-19 17:03:06 +02:00
Edward Welbourne
b207332b93 Doc-fix: correct some misinformation about QDateTime's handling of DST
Tidy up QDateTime::offsetFromUtc's doc, in the process. We don't take
DST into account for dates before the epoch; that should be mentioned
when saying we take DST into account. Also, referring to *this as the
"current" time begs to be misunderstood.

The \class comment also misleadingly claimed that we don't take into
account any changes to time-zone before DST; where, in fact, we only
ignore DST changes before 1970, not changes to standard offset.
(Conflict resolution also pulled in a typo-fix from 5.14.)

Change-Id: I090e668edf0338c825f5afcc67f894579a129c46
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
(cherry picked from commit c6bde29e143b1fadac97f656ba6c3059135d4a11)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2019-09-19 11:30:02 +02:00
Edward Welbourne
3a71e387d9 MS TZ data: avoid calculating a date in year 0
There is no year 0 in the proleptic Gregorian calendar, so QDate()
won't be happy if asked for a date in it. Tweak scanning of the data
we get from MS-Win so as to avoid a date calculation that could
otherwise happen in year 0 when constructing
QDateTime(QDate(1, 1, 1), QTime(0, 0, 0), QTimeZone("Australia/Sydney")).

Added a test for this case, which Oliver Wolff has kindly verified
does reproduce the assertion failure. However, Coin is unable to
reproduce, as all its MS builds are configured with -release, so
Q_ASSERT() does nothing. (The relevant code then skips over year 0,
albeit for the wrong reasons, and gets the right results, albeit
inefficiently, leaving no other symptom by which to detect the
problem.)

Fixes: QTBUG-78051
Change-Id: Ife8a7470e5bd450bc421e89b3f1e1211756fc889
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 8286daba038d3c90d2bc06785ffcf9c0c603cb83)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-09-19 11:29:46 +02:00
Kai Koehne
4ddc50c0cd configure: Do use pkg-config --libs for static libs
This ensures that also linker commands like -pthread are returned.

Fixes: QTBUG-77159
Change-Id: If9ab3797ccfb52c6b96a4ab120c59fd8896d5466
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-09-19 06:59:13 +00:00
Kai Koehne
6bffb8e3e1 Update hints on how to link to OpenSSL
The traditional way to fix building against a custom OpenSSL is to set the
OPENSSL_LIBS environment variable.

Anyhow, since Qt 5.6 there's a more generic way to configure
linking against external libraries by configuring the <LIB>_INCDIR, <LIB>_LIBDIR,
<LIB>_PREFIX, <LIB>_LIBS, <LIB>_LIBS_DEBUG and <LIB>_LIBS_RELEASE
qmake variables at configure time. Using these have following advantages:

- Can handle different libs for a -debug-and-release build
- Can be used also for other libs than just openssl

So let's try to promote this.

Also update any examples for OpenSSL 1.1.

Change-Id: I24dbccdd87d0fc50bf31c6afe7aa692d4b810fb7
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-09-19 08:58:44 +02:00
Tor Arne Vestbø
52ad1de1f6 macOS: Keep default NSWindow background unless window is frameless
The logic was changed in ee82f8661 to only draw a window background
when the window was textured, and otherwise ask for a clear window
background. This has an unfortunate side-effect on macOS 10.15 that
the window's title bar will be partially transparent and reflect the
content under the window, with a blur effect.

It also inadvertently broke the use-case of setting the NSWindow
background color explicitly.

With this patch we're back to the behavior before ee82f8661, and
users who still want to have a non-borderless window with a clear
background can still do this by setting the background color to
the clear color manually.

Task-number: QTBUG-77637
Change-Id: I8a11bc46e6393b29a37f002ea123a987048106b9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 4534522ff0f189418d828fd29b9d417b5a1b5d27)
2019-09-16 13:50:20 +02:00
Allan Sandfeld Jensen
c7b3c5a082 Handle robustness with OpenGL < 4.0
We need to have the right idea of robustness, so check for extension.

Fixes: QTBUG-78107
Change-Id: I26987269e5c50bee20e2e3cc6d75f91a6c9af25e
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
(cherry picked from commit bc34784d053ebf9b0d167e9398052fcc80d8af87)
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2019-09-13 11:45:18 +02:00
Alexandru Croitor
afec5935ea CMake: Fix usage of debug frameworks on macOS
If an app wants use a debug framework of Qt, it is still expected that
the app should link against the release version, and just set
DYLD_IMAGE_SUFFIX=_debug when running the app.

This was not the case before, where the CMake Config files told CMake
to link explicitly against the debug libraries. This caused crashes
due to the Qt plugin loader mechanism still trying to find a release
platform plugin, which in turn would load release libraries, and thus
the application would end up loading both debug and release plugins.

Make sure the Config files in a framework case always reference the
release libraries (even though this might be counter intuitive).
Otherwise users of the Debug Config files would always get
crashes.

Fixes: QTBUG-78131
Fixes: QTBUG-78239
Change-Id: I88b1dc421477ad186012ca67b328a891128eb568
(cherry picked from commit be21ff11b7c25e3f6682c7987052557eca48e907)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2019-09-12 23:24:01 +02:00
Shawn Rutledge
3a50e51b01 QMenu::popup(): don't change the menu's screen if called from exec()
Since b3fc5e1ea3eb4fe838ac716aaca4efaa5de5a814,
topData()->initialScreenIndex has always been short-lived: it only
remembers the screen in case the widget parent is a QDesktopScreenWidget
(gotten from QDesktopWidget::screen()), only until the window is
created.  Then it is reset.  In the case of exec() we need to avoid
calling setScreen() twice, because that would set the screen once, then
forget which screen it was supposed to be on, then set the screen again
when exec() calls popup().  This is achieved by using the stored
eventLoop pointer to detect that popup() is being called from exec(),
and avoid calling setScreen() a second time in popup(), because exec()
already needed to call createWinId() before it created the event loop.

Amends 82da8306bc1313b85632eee0faf858239261a092

Task-number: QTBUG-76162
Change-Id: I70da517b9d530630e59d103cb2a1ce11c897b2c8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Joni Poikelin <joni.poikelin@qt.io>
(cherry picked from commit 648dac1ceb40a346adf2081997f5c6166c3ad503)
2019-09-10 12:00:31 +00:00
373 changed files with 52623 additions and 24916 deletions

View File

@ -4,4 +4,4 @@ CONFIG += warning_clean
QT_SOURCE_TREE = $$PWD
QT_BUILD_TREE = $$shadowed($$PWD)
MODULE_VERSION = 5.12.5
MODULE_VERSION = 5.12.12

1331
LICENSE.QT-LICENSE-AGREEMENT Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,913 +0,0 @@
QT LICENSE AGREEMENT
Agreement version 4.0
This License Agreement ("Agreement") is a legal agreement between The Qt
Company (as defined below) and the Licensee (as defined below) for the license
of Licensed Software (as defined below). Capitalized terms used herein are
defined in Section 1.
WHEREAS:
(A). Licensee wishes to use the Licensed Software for the purpose of developing
and distributing Applications and/or Devices; and
(B). The Qt Company is willing to grant the Licensee a right to use Licensed
Software for such purpose pursuant to term and conditions of this Agreement.
NOW, THEREFORE, THE PARTIES HEREBY AGREE AS FOLLOWS:
1. DEFINITIONS
"Affiliate" of a Party shall mean an entity (i) which is directly or indirectly
controlling such Party; (ii) which is under the same direct or indirect
ownership or control as such Party; or (iii) which is directly or indirectly
owned or controlled by such Party. For these purposes, an entity shall be
treated as being controlled by another if that other entity has fifty percent
(50 %) or more of the votes in such entity, is able to direct its affairs
and/or to control the composition of its board of directors or equivalent body.
"Applications" shall mean Licensee's software products created using the
Licensed Software, which may include the Redistributables, or part
thereof.
"Contractor(s)" shall mean third party consultants, distributors and
contractors performing services to a Party under applicable contractual
arrangement.
"Customer(s)" shall mean Licensee's end users to whom Licensee, directly or
indirectly, distributes copies of the Redistributables.
"Deployment Platforms" shall mean operating systems specified in the License
Certificate, in which the Redistributables can be distributed pursuant to the
terms and conditions of this Agreement.
"Designated User(s)" shall mean the employee(s) of Licensee or Licensee's
Affiliates acting within the scope of their employment or Licensee's
Contractors acting within the scope of their services for Licensee and on
behalf of Licensee. Designated Users shall be named in the License Certificate.
"Development License" shall mean the license needed by the Licensee for each
Designated User to use the Licensed Software under the license grant described
in Section 3.1 of this Agreement.
"Development Platforms" shall mean those operating systems specified in the
License Certificate, in which the Licensed Software can be used under the
Development License, but not distributed in any form or used for any other
purpose.
"Devices" shall mean hardware devices or products that 1) are manufactured
and/or distributed by the Licensee or its Affiliates or Contractors, and
(2)(i) incorporate or integrate the Redistributables or parts thereof; or (ii)
do not incorporate or integrate the Redistributables at the time of
distribution, but where, when used by a Customer, the main user interface or
substantial functionality of such device is provided by Application(s) or
otherwise depends on the Licensed Software.
"Distribution License(s)" shall mean the license required for distribution of
Redistributables in connection with Devices pursuant to license grant described
in Section 3.3 of this Agreement.
"Distribution License Packs" shall mean set of prepaid Distribution Licenses
for distribution of Redistributables, as defined in The Qt Company's standard
price list, quote, Purchase Order confirmation or in an appendix hereto,
as the case may be.
"Intellectual Property Rights" shall mean patents (including utility models),
design patents, and designs (whether or not capable of registration), chip
topography rights and other like protection, copyrights, trademarks, service
marks, trade names, logos or other words or symbols and any other form of
statutory protection of any kind and applications for any of the foregoing as
well as any trade secrets.
"License Certificate" shall mean a certificate generated by The Qt Company for
each Designated User respectively upon them downloading the licensed Software.
License Certificate will be available under respective Designated User's Qt
Account at account.qt.io and it will specify the Designated User, the
Development Platforms, Deployment Platforms and the License Term. The terms of
the License Certificate are considered part of this Agreement and shall be
updated from time to time to reflect any agreed changes to the foregoing terms
relating to Designated User's rights to the Licensed Software.
"License Fee" shall mean the fee charged to the Licensee for rights granted
under the terms of this Agreement.
"License Term" shall mean the agreed validity period of the Development
License of the respective Designated User, during which time the
Designated User is entitled to use the Licensed Software, as set forth in the
respective License Certificate.
"Licensed Software" shall mean all versions of the
(i) Qt Toolkit (including Qt Essentials, Qt Add-Ons and Value-Add modules) as
described in http://doc.qt.io/qt-5/qtmodules.html,
(ii) Qt Creator (including Creator IDE tool) as described in
http://doc.qt.io/qtcreator/index.html,
(iii) Qt 3D Studio as described in http://doc.qt.io/qt3dstudio/index.html, and
as well as corresponding online or electronic documentation, associated media
and printed materials, including the source code, example programs and the
documentation, licensed to the Licensee under this Agreement. Licensed Software
does not include Third Party Software (as defined in Section 4), Open Source
Qt, or other software products of The Qt Company (for example Qt Safe Renderer
and Qt for Automation), unless such other software products of The Qt Company
are separately agreed in writing to be included in scope of the Licensed
Software.
"Licensee" shall mean the individual or legal entity that is party to this
Agreement, as identified on the signature page hereof.
"Licensee's Records" shall mean books and records that are likely to contain
information bearing on Licensee's compliance with this Agreement or the
payments due to The Qt Company under this Agreement, including, but not limited
to: assembly logs, sales records and distribution records.
"Modified Software" shall have the meaning as set forth in Section 2.3.
"Online Services" shall mean any services or access to systems made available
by The Qt Company to the Licensee over the Internet relating to the Licensed
Software or for the purpose of use by the Licensee of the Licensed Software or
Support. Use of any such Online Services is discretionary for the Licensee and
some of them may be subject to additional fees.
"Open Source Qt" shall mean the non-commercial Qt computer software products,
licensed under the terms of the GNU Lesser General Public License, version
2.1 or later ("LGPL") or the GNU General Public License, version 2.0 or later
("GPL"). For clarity, Open Source Qt shall not be provided nor governed under
this Agreement.
"Party" or "Parties" shall mean Licensee and/or The Qt Company.
"Redistributables" shall mean the portions of the Licensed Software set forth
in Appendix 1, Section 1 that may be distributed pursuant to the terms of this
Agreement in object code form only, including any relevant documentation.
Where relevant, any reference to Licensed Software in this Agreement shall
include and refer also to Redistributables.
"Renewal Term" shall mean an extension of previous License Term as agreed
between the Parties.
"Submitted Modified Software" shall have the meaning as set forth in
Section 2.3.
"Support" shall mean standard developer support that is provided by The Qt
Company to assist Designated Users in using the Licensed Software in
accordance with The Qt Company's standard support terms and as further
defined in Section 8 hereunder.
"Taxes" shall have the meaning set forth in Section 10.5.
"Term" shall have the meaning set forth in Section 12.
"The Qt Company" shall mean:
(i) in the event Licensee is an individual residing in the United States or a
legal entity incorporated in the United States or having its headquarters in
the United States, The Qt Company Inc., a Delaware corporation with its office
at 2350 Mission College Blvd., Suite 1020, Santa Clara, CA 95054, USA.; or
(ii) in the event the Licensee is an individual residing outside of the United
States or a legal entity incorporated outside of the United States or having
its registered office outside of the United States, The Qt Company Ltd., a
Finnish company with its registered office at Bertel Jungin aukio D3A, 02600
Espoo, Finland.
"Third Party Software " shall have the meaning set forth in Section 4.
"Updates" shall mean a release or version of the Licensed Software containing
bug fixes, error corrections and other changes that are generally made
available to users of the Licensed Software that have contracted for Support.
Updates are generally depicted as a change to the digits following the decimal
in the Licensed Software version number. The Qt Company shall make Updates
available to the Licensee under the Support. Updates shall be considered as
part of the Licensed Software hereunder.
"Upgrades" shall mean a release or version of the Licensed Software containing
enhancements and new features and are generally depicted as a change to the
first digit of the Licensed Software version number. In the event Upgrades are
provided to the Licensee under this Agreement, they shall be considered as
part of the Licensed Software hereunder.
2. OWNERSHIP
2.1 Ownership of The Qt Company
The Licensed Software is protected by copyright laws and international
copyright treaties, as well as other intellectual property laws and treaties.
The Licensed Software is licensed, not sold.
All The Qt Company's Intellectual Property Rights are and shall remain the
exclusive property of The Qt Company or its licensors respectively.
2.2 Ownership of Licensee
All the Licensee's Intellectual Property Rights are and shall remain the
exclusive property of the Licensee or its licensors respectively.
All Intellectual Property Rights to the Modified Software, Applications and
Devices shall remain with the Licensee and no rights thereto shall be granted
by the Licensee to The Qt Company under this Agreement (except as set forth in
Section 2.3 below).
2.3 Modified Software
Licensee may create bug-fixes, error corrections, patches or modifications to
the Licensed Software ("Modified Software"). Such Modified Software may break
the source or binary compatibility with the Licensed Software (including
without limitation through changing the application programming interfaces
("API") or by adding, changing or deleting any variable, method, or class
signature in the Licensed Software and/or any inter-process protocols, services
or standards in the Licensed Software libraries). To the extent that Licensee's
Modified Software so breaks source or binary compatibility with the Licensed
Software, Licensee acknowledges that The Qt Company's ability to provide
Support may be prevented or limited and Licensee's ability to make use of
Updates may be restricted.
Licensee may, at its sole and absolute discretion, choose to submit Modified
Software to The Qt Company ("Submitted Modified Software") in connection with
Licensee's Support request, service request or otherwise. In the event Licensee
does so, then, Licensee hereby grants The Qt Company a sublicensable,
assignable, irrevocable, perpetual, worldwide, non-exclusive, royalty-free and
fully paid-up license, under all of Licensee's Intellectual Property Rights, to
reproduce, adapt, translate, modify, and prepare derivative works of, publicly
display, publicly perform, sublicense, make available and distribute such
Submitted Modified Software as The Qt Company sees fit at its free and absolute
discretion.
3. LICENSES GRANTED
3.1 Development with Licensed Software
Subject to the terms of this Agreement, The Qt Company grants to Licensee a
personal, worldwide, non-exclusive, non-transferable license, valid for the
License Term, to use, modify and copy the Licensed Software by Designated Users
on the Development Platforms for the sole purposes of designing, developing,
demonstrating and testing Application(s) and/or Devices, and to provide thereto
related support and other related services to end-user Customers.
Licensee may install copies of the Licensed Software on an unlimited number of
computers provided that (i) only the Designated Users may use the Licensed
Software, and (ii) all Designated Users must have a valid Development License
to use Licensed Software.
Licensee may at any time designate another Designated User to replace a then-
current Designated User by notifying The Qt Company in writing, provided that
any Designated User may be replaced only once during any six-month period.
Upon expiry of the initially agreed License Term, the respective License Terms
shall be automatically extended to one or more Renewal Term(s), unless and
until either Party notifies the other Party in writing that it does not wish to
continue the License Term, such notification to be provided to the other Party
no less than ninety (90) days before expiry of the respective License Term.
Unless otherwise agreed between the Parties, Renewal Term shall be of equal
length with the initial Term.
Any such Renewal Term shall be subject to License Fees agreed between the
Parties or, if no advance agreement exists, subject to The Qt Company's
standard pricing applicable at the commencement date of any such Renewal Term.
3.2 Distribution of Applications
Subject to the terms of this Agreement, The Qt Company grants to Licensee a
personal, worldwide, non-exclusive, non-transferable, revocable (for cause
pursuant to this Agreement) right and license, valid for the Term, to
(i) distribute, by itself or through its Contractors, Redistributables as
installed, incorporated or integrated into Applications for execution on the
Deployment Platforms, and
(ii) grant sublicenses to Redistributables, as distributed hereunder, for
Customers solely for Customer's internal use and to the extent necessary in
order for the Customers to use the Applications for their respective intended
purposes.
Right to distribute the Redistributables as part of an Application as provided
herein is not royalty-bearing but is conditional upon the Licensee having paid
the agreed Development Licenses from The Qt Company before distributing any
Redistributables to Customers.
3.3 Distribution of Devices
Subject to the terms of this Agreement, The Qt Company grants to Licensee a
personal, worldwide, non-exclusive, non-transferable, revocable (for cause
pursuant to this Agreement) right and license, valid for the Term, to
(i) distribute, by itself or through one or more tiers of Contractors,
Redistributables as installed, incorporated or integrated, or intended to be
installed, incorporated or integrated into Devices for execution on the
Deployment Platforms, and
(ii) grant sublicenses to Redistributables, as distributed hereunder, for
Customers solely for Customer's internal use and to the extent necessary in
order for the Customers to use the Devices for their respective intended
purposes.
Right to distribute the Redistributables with Devices as provided herein is
conditional upon the Licensee having purchased and paid the appropriate amount
of Development and Distribution Licenses from The Qt Company before
distributing any Redistributables to Customers.
3.4 Further Requirements
The licenses granted above in this Section 3 by The Qt Company to Licensee are
conditional and subject to Licensee's compliance with the following terms:
(i) Licensee shall not remove or alter any copyright, trademark or other
proprietary rights notice contained in any portion of the Licensed Software;
(ii) Applications must add primary and substantial functionality to the
Licensed Software;
(iii) Applications may not pass on functionality which in any way makes it
possible for others to create software with the Licensed Software; provided
however that Licensee may use the Licensed Software's scripting and QML ("Qt
Quick") functionality solely in order to enable scripting, themes and styles
that augment the functionality and appearance of the Application(s) without
adding primary and substantial functionality to the Application(s);
(iv) Applications must not compete with the Licensed Software;
(v) Licensee shall not use The Qt Company's or any of its suppliers' names,
logos, or trademarks to market Applications, except that Licensee may use
"Built with Qt" logo to indicate that Application(s) was developed using the
Licensed Software;
(vi) Licensee shall not distribute, sublicense or disclose source code of
Licensed Software to any third party (provided however that Licensee may
appoint employee(s) of Contractors as Designated Users to use Licensed
Software pursuant to this Agreement). Such right may be available for the
Licensee subject to a separate software development kit ("SDK") license
agreement to be concluded with The Qt Company;
(vii) Licensee shall not grant the Customers a right to (i) make copies of the
Redistributables except when and to the extent required to use the Applications
and/or Devices for their intended purpose, (ii) modify the Redistributables or
create derivative works thereof, (iii) decompile, disassemble or otherwise
reverse engineer Redistributables, or (iv) redistribute any copy or portion of
the Redistributables to any third party, except as part of the onward sale of
the Device on which the Redistributables are installed;
(viii) Licensee shall not and shall cause that its Affiliates or Contractors
shall not a) in any way combine, incorporate or integrate Licensed Software
with, or use Licensed Software for creation of, any software created with or
incorporating Open Source Qt, or b) incorporate or integrate Applications
into a hardware device or product other than a Device, unless Licensee has
received an advance written permission from The Qt Company to do so. Absent
such written permission, any and all distribution by the Licensee during the
Term of a hardware device or product a) which incorporate or integrate any
part of Licensed Software or Open Source Qt; or b) where the main user
interface or substantial functionality is provided by software build with
Licensed Software or Open Source Qt or otherwise depends on the Licensed
Software or Open Source Qt, shall be considered as a Device distribution under
this Agreement and dependent on compliance thereof (including but not limited
to obligation to pay applicable License Fees for such distribution);
(ix) Licensee shall cause all of its Affiliates and Contractors entitled to
make use of the licenses granted under this Agreement, to be contractually
bound to comply with the relevant terms of this Agreement and not to use the
Licensed Software beyond the terms hereof and for any purposes other than
operating within the scope of their services for Licensee. Licensee shall be
responsible for any and all actions and omissions of its Affiliates and
Contractors relating to the Licensed Software and use thereof (including but
not limited to payment of all applicable License Fees);
(x) Except when and to the extent explicitly provided in this Section 3,
Licensee shall not transfer, publish, disclose, display or otherwise make
available the Licensed Software;
; and
(xi) Licensee shall not attempt or enlist a third party to conduct or attempt
to conduct any of the above.
Above terms shall not be applicable if and to the extent they conflict with any
mandatory provisions of any applicable laws.
Any use of Licensed Software beyond the provisions of this Agreement is
strictly prohibited and requires an additional license from The Qt Company.
4. THIRD PARTY SOFTWARE
The Licensed Software may provide links to third party libraries or code
(collectively "Third Party Software") to implement various functions. Third
Party Software does not comprise part of the Licensed Software. In some cases,
access to Third Party Software may be included in the Licensed Software. Such
Third Party Software will be listed in the ".../src/3rdparty" source tree
delivered with the Licensed Software or documented in the Licensed Software, as
such may be amended from time to time. Licensee acknowledges that use or
distribution of Third Party Software is in all respects subject to applicable
license terms of applicable third party right holders.
5. PRE-RELEASE CODE
The Licensed Software may contain pre-release code and functionality marked or
otherwise stated as "Technology Preview", "Alpha", "Beta" or similar
designation. Such pre-release code may be present in order to provide
experimental support for new platforms or preliminary versions of one or more
new functionalities. The pre-release code may not be at the level of
performance and compatibility of a final, generally available, product
offering of the Licensed Software. The pre-release parts of the Licensed
Software may not operate correctly, may contain errors and may be substantially
modified by The Qt Company prior to the first commercial product release, if
any. The Qt Company is under no obligation to make pre-release code
commercially available, or provide any Support or Updates relating thereto. The
Qt Company assumes no liability whatsoever regarding any pre-release code, but
any use thereof is exclusively at Licensee's own risk and expense.
6. LIMITED WARRANTY AND WARRANTY DISCLAIMER
The Qt Company hereby represents and warrants that it has the power and
authority to grant the rights and licenses granted to Licensee under this
Agreement.
Except as set forth above, the Licensed Software is licensed to Licensee
"as is" and Licensee's exclusive remedy and The Qt Company's entire liability
for errors in the Licensed Software shall be limited, at The Qt Company's
option, to correction of the error, replacement of the Licensed Software or
return of the applicable fees paid for the defective Licensed Software for the
time period during which the License is not able to utilize the Licensed
Software under the terms of this Agreement.
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE QT COMPANY ON BEHALF OF
ITSELF AND ITS LICENSORS, SUPPLIERS AND AFFILIATES, DISCLAIMS ALL OTHER
WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-
INFRINGEMENT WITH REGARD TO THE LICENSED SOFTWARE. THE QT COMPANY DOES NOT
WARRANT THAT THE LICENSED SOFTWARE WILL SATISFY LICENSEE'S REQUIREMENTS OR THAT
IT WILL OPERATE WITHOUT DEFECT OR ERROR OR THAT THE OPERATION THEREOF WILL BE
UNINTERRUPTED. ALL USE OF AND RELIANCE ON THE LICENSED SOFTWARE IS AT THE SOLE
RISK OF AND RESPONSIBILITY OF LICENSEE.
7. INDEMNIFICATION AND LIMITATION OF LIABILITY
7.1 Limitation of Liability
EXCEPT FOR (I) CASES OF GROSS NEGLIGENCE OR INTENTIONAL MISCONDUCT, AND (II)
BREACH OF CONFIDENTIALITY, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, IN NO
EVENT SHALL EITHER PARTY BE LIABLE TO THE OTHER PARTY FOR ANY LOSS OF PROFIT,
LOSS OF DATA, LOSS OF BUSINESS OR GOODWILL OR ANY OTHER INDIRECT, SPECIAL,
CONSEQUENTIAL, INCIDENTAL OR PUNITIVE COST, DAMAGES OR EXPENSE OF ANY KIND,
HOWSOEVER ARISING UNDER OR IN CONNECTION WITH THIS AGREEMENT. PARTIES
SPECIFICALLY AGREE THAT LICENSEE'S OBLIGATION TO PAY LICENSE AND OTHER FEES
CORRESPONDING TO ACTUAL USAGE OF LICENSED SOFTWARE HEREUNDER SHALL BE
CONSIDERED AS A DIRECT DAMAGE.
EXCEPT FOR (I) CASES OF GROSS NEGLIGENCE OR INTENTIONAL MISCONDUCT, AND (II)
BREACH OF CONFIDENTIALITY, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, IN
NO EVENT SHALL EITHER PARTY'S TOTAL AGGREGATE LIABILITY UNDER THIS AGREEMENT
EXCEED THE AGGREGATE LICENSE FEES PAID OR PAYABLE TO THE QT COMPANY FROM
LICENSEE DURING THE PERIOD OF TWELVE (12) MONTHS IMMEDIATELY PRECEDING THE
EVENT RESULTING IN SUCH LIABILITY.
THE PROVISIONS OF THIS SECTION 7 ALLOCATE THE RISKS UNDER THIS AGREEMENT
BETWEEN THE QT COMPANY AND LICENSEE AND THE PARTIES HAVE RELIED UPON THE
LIMITATIONS SET FORTH HEREIN IN DETERMINING WHETHER TO ENTER INTO THIS AGREEMENT.
7.2 Licensee's Indemnification
Licensee shall indemnify and hold harmless The Qt Company from and against any
claim, injury, judgment, settlement, loss or expense, including attorneys' fees
related to: (a) Licensee's misrepresentation in connection with The Qt Company
or the Licensed Software or breach of this Agreement, (b) the Application or
Device (except where such cause of liability is solely attributable to the
Licensed Software).
8. SUPPORT, UPDATES AND ONLINE SERVICES
Upon due payment of the agreed License Fees the Licensee will be eligible to
receive Support and Updates and to use the Online Services during the License
Term, provided, however, that in the event the License Term is longer than 36
months, Support is provided only for the first 12 months, unless the Parties
specifically otherwise agree.
Unless otherwise decided by The Company at its free and absolute discretion,
Upgrades will not be included in the Support but may be available subject to
additional fees.
From time to time The Qt Company may change the Support terms, provided that
during the respective ongoing License Term the level of Support provided by The
Qt Company may not be reduced without the consent of the Licensee.
Unless otherwise agreed, The Qt Company shall not be responsible for providing
any service or support to Customers.
9. CONFIDENTIALITY
Each Party acknowledges that during the Term of this Agreement each Party may
receive information about the other Party's business, business methods,
business plans, customers, business relations, technology, and other
information, including the terms of this Agreement, that is confidential and
of great value to the other Party, and the value of which would be
significantly reduced if disclosed to third parties ("Confidential
Information"). Accordingly, when a Party (the "Receiving Party") receives
Confidential Information from the other Party (the "Disclosing Party"), the
Receiving Party shall only disclose such information to employees and
Contractors on a need to know basis, and shall cause its employees and
employees of its Affiliates to: (i) maintain any and all Confidential
Information in confidence; (ii) not disclose the Confidential Information to a
third party without the Disclosing Party's prior written approval; and (iii)
not, directly or indirectly, use the Confidential Information for any purpose
other than for exercising its rights and fulfilling its responsibilities
pursuant to this Agreement. Each Party shall take reasonable measures to
protect the Confidential Information of the other Party, which measures shall
not be less than the measures taken by such Party to protect its own
confidential and proprietary information.
Obligation of confidentiality shall not apply to information that (i) is or
becomes generally known to the public through no act or omission of the
Receiving Party; (ii) was in the Receiving Party's lawful possession prior to
the disclosure hereunder and was not subject to limitations on disclosure or
use; (iii) is developed independently by employees or Contractors of the
Receiving Party or other persons working for the Receiving Party who have not
had access to the Confidential Information of the Disclosing Party, as proven
by the written records of the Receiving Party; (iv) is lawfully disclosed to
the Receiving Party without restrictions, by a third party not under an
obligation of confidentiality; or (v) the Receiving Party is legally compelled
to disclose, in which case the Receiving Party shall notify the Disclosing
Party of such compelled disclosure and assert the privileged and confidential
nature of the information and cooperate fully with the Disclosing Party to
limit the scope of disclosure and the dissemination of disclosed Confidential
Information to the minimum extent necessary.
The obligations under this Section 9 shall continue to remain in force for a
period of five (5) years after the last disclosure, and, with respect to trade
secrets, for so long as such trade secrets are protected under applicable trade
secret laws.
10. FEES, DELIVERY AND PAYMENT
10.1 License Fees
License Fees are described in The Qt Company's standard price list, quote or
Purchase Order confirmation or in an appendix hereto, as the case may be.
The License Fees shall not be refunded or claimed as a credit in any event or
for any reason whatsoever.
10.2 Ordering Licenses
Licensee may purchase Development Licenses and Distribution Licenses pursuant
to agreed pricing terms or, if no specific pricing terms have been agreed upon,
at The Qt Company's standard pricing terms applicable at the time of purchase.
Licensee shall submit all purchase orders for Development Licenses and
Distribution Licenses to The Qt Company by email or any other method acceptable
to The Qt Company (each such order is referred to herein as a "Purchase Order")
for confirmation, whereupon the Purchase Order shall become binding between the
Parties.
10.3 Distribution License Packs
Unless otherwise agreed, Distribution Licenses shall be purchased by way of
Distribution License Packs.
Upon due payment of the ordered Distribution License Pack(s), the Licensee will
have an account of Distribution Licenses available for installing, bundling or
integrating (all jointly "installing") the Redistributables with the Devices or
for otherwise distributing the Redistributables in accordance with this
Agreement.
Each time Licensee "installs" or distributes a copy of Redistributables, then
one Distribution License is used, and Licensee's account of available
Distribution Licenses is decreased accordingly.
Licensee may "install" copies of the Redistributables so long as Licensee has
Distribution Licenses remaining on its account.
Redistributables will be deemed to have been "installed" into a Device when one
of the following circumstances shall have occurred: a) the Redistributables
have been loaded onto the Device and used outside of the Licensee's premises or
b) the Device has been fully tested and placed into Licensee's inventory
(or sold) for the first time (i.e., Licensee will not be required to use
(or pay for) more than one Distribution License for each individual Device,
e.g. in a situation where a Device is returned to Licensee's inventory after
delivery to a distributor or sale to a Customer). In addition, if Licensee
includes a back-up copy of the Redistributables on a CD-ROM or other storage
medium along with the product, that backup copy of the Redistributables will
not be deemed to have been "installed" and will not require an additional
Distribution License.
10.4 Payment Terms
License Fees and any other charges under this Agreement shall be paid by
Licensee no later than thirty (30) days from the date of the applicable invoice
from The Qt Company.
The Qt Company will submit an invoice to Licensee after the date of this
Agreement and/or after The Qt Company receives a Purchase Order from
Licensee.
A late payment charge of the lower of (a) one percent per month; or (b) the
interest rate stipulated by applicable law, shall be charged on any unpaid
balances that remain past due.
The Qt Company shall have the right to suspend, terminate or withhold grants
of all rights to the Licensed Software hereunder, including but not limited to
the Developer License, Distribution License, and Support, should Licensee fail
to make payment in timely fashion.
10.5 Taxes
All License Fees and other charges payable hereunder are gross amounts but
exclusive of any value added tax, use tax, sales tax and other taxes, duties or
tariffs ("Taxes"). Such applicable Taxes shall be paid by Licensee, or, where
applicable, in lieu of payment of such Taxes, Licensee shall provide an
exemption certificate to The Qt Company and any applicable authority.
11 RECORD-KEEPING AND REPORTING OBLIGATIONS; AUDIT RIGHTS
11.1 Licensee's Record-keeping
Licensee shall at all times maintain accurate and up-to-date written records of
Licensee's activities related to the use of Licensed Software and distribution
of Redistributables. The records shall be adequate to determine Licensee's
compliance with the provisions of this Agreement and to demonstrate the number
of Designated Users and Redistributables distributed by Licensee. The records
shall conform to good accounting practices reasonably acceptable to The Qt
Company.
Licensee shall, within thirty (30) days from receiving The Qt Company's request
to that effect, deliver to The Qt Company a report on Licensee's usage of
Licensed Software, such report to copies of Redistributables distributed by
Licensee during that calendar quarter, and also detailing the number of
undistributed copies of Redistributables made by Licensee and remaining in its
account contain information, in sufficient detail, on (i) amount of users
working with Licensed Software, (ii) copies of Redistributables distributed by
Licensee during that calendar quarter, (iii) number of undistributed copies of
Redistributables and corresponding number of unused Distribution Licenses
remaining on Licensee's account, and (iv) any other information as The Qt
Company may reasonably require from time to time.
11.2. The Qt Company's Audit Rights
The Qt Company or an independent auditor acting on behalf of The Qt Company's,
may, upon at least five (5) business days' prior written notice and at its
expense, audit Licensee with respect to the use of the Redistributables, but
not more frequently than once during each 6-month period. Such audit may be
conducted by mail, electronic means or through an in-person visit to Licensee's
place of business. Any such in-person audit shall be conducted during regular
business hours at Licensee's facilities and shall not unreasonably interfere
with Licensee's business activities. The Qt Company or the independent auditor
acting on behalf of The Qt Company shall be entitled to inspect Licensee's
Records. All such Licensee's Records and use thereof shall be subject to an
obligation of confidentiality under this Agreement.
If an audit reveals that Licensee is using the Licensed Software beyond scope
of the licenses Licensee has paid for, Licensee agrees to immediately pay The
Qt Company any amounts owed for such unauthorized use.
In addition, in the event the audit reveals a material violation of the terms
of this Agreement (underpayment of more than 5% of License Fees shall always be
deemed a material violation for purposes of this section), then the Licensee
shall pay The Qt Company's reasonable cost of conducting such audit.
12 TERM AND TERMINATION
12.1 Term
This Agreement shall enter into force upon due acceptance by both Parties and
remain in force for as long as there is any Development License(s) in force
("Term"), unless and until terminated pursuant to the terms of this Section 12.
12.2 Termination by The Qt Company
The Qt Company shall have the right to terminate this Agreement upon thirty
(30) days prior written notice if the Licensee is in material breach of any
obligation of this Agreement and fails to remedy such breach within such notice
period.
12.3 Mutual Right to Terminate
Either Party shall have the right to terminate this Agreement immediately upon
written notice in the event that the other Party becomes insolvent, files for
any form of bankruptcy, makes any assignment for the benefit of creditors, has
a receiver, administrative receiver or officer appointed over the whole or a
substantial part of its assets, ceases to conduct business, or an act
equivalent to any of the above occurs under the laws of the jurisdiction of the
other Party.
12.4 Parties' Rights and Duties upon Termination
Upon expiry or termination of the Agreement Licensee shall cease and shall
cause all Designated Users (including those of its Affiliates' and
Contractors') to cease using the Licensed Software and distribution of the
Redistributables under this Agreement.
Notwithstanding the above, in the event the Agreement expires or is terminated:
(i) as a result of The Qt Company choosing not to renew the Development
License(s) as set forth in Section 3.1, then all valid licenses possessed by
the Licensee at such date shall be extended to be valid in perpetuity under the
terms of this Agreement and Licensee is entitled to purchase additional
licenses as set forth in Section 10.2; or
(ii) for reason other than by The Qt Company pursuant to item (i) above or
pursuant to Section 12.2, then the Licensee is entitled, for a period of six
(6) months after the effective date of termination, to continue distribution of
Devices under the Distribution Licenses paid but unused at such effective date
of termination.
Upon any such termination the Licensee shall destroy or return to The Qt
Company all copies of the Licensed Software and all related materials and will
certify the same to The Qt Company upon its request, provided however that
Licensee may retain and exploit such copies of the Licensed Software as it may
reasonably require in providing continued support to Customers.
Expiry or termination of this Agreement for any reason whatsoever shall not
relieve Licensee of its obligation to pay any License Fees accrued or payable
to The Qt Company prior to the effective date of termination, and Licensee
shall immediately pay to The Qt Company all such fees upon the effective date
of termination. Termination of this Agreement shall not affect any rights of
Customers to continue use of Applications and Devices (and therein incorporated
Redistributables).
12.5 Extension in case of bankruptcy
In the event The Qt Company is declared bankrupt under a final, non-cancellable
decision by relevant court of law, and this Agreement is not, at the date of
expiry of the Development License(s) pursuant to Section 3.1, assigned to
party, who has assumed The Qt Company's position as a legitimate licensor of
Licensed Software under this Agreement, then all valid licenses possessed by
the Licensee at such date of expiry, and which the Licensee has not notified
for expiry, shall be extended to be valid in perpetuity under the terms of
this Agreement.
13. GOVERNING LAW AND LEGAL VENUE
In the event this Agreement is in the name of The Qt Company Inc., a Delaware
Corporation, then:
(i) this Agreement shall be construed and interpreted in accordance with the
laws of the State of California, USA, excluding its choice of law provisions;
(ii) the United Nations Convention on Contracts for the International Sale of
Goods will not apply to this Agreement; and
(iii) any dispute, claim or controversy arising out of or relating to this
Agreement or the breach, termination, enforcement, interpretation or validity
thereof, including the determination of the scope or applicability of this
Agreement to arbitrate, shall be determined by arbitration in San Francisco,
USA, before one arbitrator. The arbitration shall be administered by JAMS
pursuant to JAMS' Streamlined Arbitration Rules and Procedures. Judgment on the
Award may be entered in any court having jurisdiction. This Section shall not
preclude parties from seeking provisional remedies in aid of arbitration from a
court of appropriate jurisdiction.
In the event this Agreement is in the name of The Qt Company Ltd., a Finnish
Company, then:
(i) this Agreement shall be construed and interpreted in accordance with the
laws of Finland, excluding its choice of law provisions;
(ii) the United Nations Convention on Contracts for the International Sale of
Goods will not apply to this Agreement; and
(iii) any disputes, controversy or claim arising out of or relating to this
Agreement, or the breach, termination or validity thereof shall be shall be
finally settled by arbitration in accordance with the Arbitration Rules of
Finland Chamber of Commerce. The arbitration tribunal shall consist of one (1),
or if either Party so requires, of three (3), arbitrators. The award shall be
final and binding and enforceable in any court of competent jurisdiction. The
arbitration shall be held in Helsinki, Finland and the process shall be
conducted in the English language. This Section shall not preclude parties from
seeking provisional remedies in aid of arbitration from a court of appropriate
jurisdiction.
14. GENERAL PROVISIONS
14.1 No Assignment
Except in the case of a merger or sale of substantially all of its corporate
assets, Licensee shall not be entitled to assign or transfer all or any of its
rights, benefits and obligations under this Agreement without the prior written
consent of The Qt Company, which shall not be unreasonably withheld or delayed.
The Qt Company shall be entitled to freely assign or transfer any of its
rights, benefits or obligations under this Agreement.
14.2 No Third Party Representations
Licensee shall make no representations or warranties concerning the Licensed
Software on behalf of The Qt Company. Any representation or warranty Licensee
makes or purports to make on The Qt Company's behalf shall be void as to The
Qt Company.
14.3 Surviving Sections
Any terms and conditions that by their nature or otherwise reasonably should
survive termination of this Agreement shall so be deemed to survive.
14.4 Entire Agreement
This Agreement, the exhibits hereto, the License Certificate and any applicable
Purchase Order constitute the complete agreement between the Parties and
supersedes all prior or contemporaneous discussions, representations, and
proposals, written or oral, with respect to the subject matters discussed
herein.
In the event of any conflict or inconsistency between this Agreement and any
Purchase Order, the terms of this Agreement will prevail over the terms of the
Purchase Order with respect to such conflict or inconsistency.
Parties specifically acknowledge and agree that this Agreement prevails over
any click-to-accept or similar agreements the Designated Users may need to
accept online upon download of the Licensed Software, as may be required by
The Qt Company's applicable processes relating to Licensed Software.
14.5 Modifications
No modification of this Agreement shall be effective unless contained in a
writing executed by an authorized representative of each Party. No term or
condition contained in Licensee's Purchase Order shall apply unless expressly
accepted by The Qt Company in writing.
14.6 Force Majeure
Except for the payment obligations hereunder, neither Party shall be liable to
the other for any delay or non-performance of its obligations hereunder in the
event and to the extent that such delay or non-performance is due to an event
of act of God, terrorist attack or other similar unforeseeable catastrophic
event that prevents either Party for fulfilling its obligations under this
Agreement and which such Party cannot avoid or circumvent ("Force Majeure
Event"). If the Force Majeure Event results in a delay or non-performance of a
Party for a period of three (3) months or longer, then either Party shall have
the right to terminate this Agreement with immediate effect without any
liability (except for the obligations of payment arising prior to the event of
Force Majeure) towards the other Party.
14.7 Notices
Any notice given by one Party to the other shall be deemed properly given and
deemed received if specifically acknowledged by the receiving Party in writing
or when successfully delivered to the recipient by hand, fax, or special
courier during normal business hours on a business day to the addresses
specified for each Party on the signature page. Each communication and document
made or delivered by one Party to the other Party pursuant to this Agreement
shall be in the English language.
14.8 Export Control
Licensee acknowledges that the Redistributables may be subject to export
control restrictions under the applicable laws of respective countries.
Licensee shall fully comply with all applicable export license restrictions
and requirements as well as with all laws and regulations relating to the
Redistributables and exercise of licenses hereunder and shall procure all
necessary governmental authorizations, including without limitation, all
necessary licenses, approvals, permissions or consents, where necessary for the
re-exportation of the Redistributables, Applications and/or Devices.
14.9 No Implied License
There are no implied licenses or other implied rights granted under this
Agreement, and all rights, save for those expressly granted hereunder, shall
remain with The Qt Company and its licensors. In addition, no licenses or
immunities are granted to the combination of the Licensed Software with any
other software or hardware not delivered by The Qt Company under this Agreement.
14.10 Attorney Fees
The prevailing Party in any action to enforce this Agreement shall be entitled
to recover its attorney's fees and costs in connection with such action.
14.11 Severability
If any provision of this Agreement shall be adjudged by any court of competent
jurisdiction to be unenforceable or invalid, that provision shall be limited or
eliminated to the minimum extent necessary so that this Agreement shall
otherwise remain in full force and effect and enforceable.
IN WITNESS WHEREOF, the Parties hereto, intending to be legally bound hereby,
have caused this Agreement to be executed by Licensee's authorized
representative installing the Licensed Software and accepting the terms
hereof in connection therewith.
Appendix 1
1. Parts of the Licensed Software that are permitted for distribution in
object code form only ("Redistributables") under this Agreement:
- The Licensed Software's Qt Essentials and Qt Add-on libraries
- The Licensed Software's configuration tool ("qtconfig")
- The Licensed Software's help tool ("Qt Assistant")
- The Licensed Software's internationalization tools ("Qt Linguist", "lupdate",
"lrelease")
- The Licensed Software's QML ("Qt Quick") launcher tool ("qmlscene" or
"qmlviewer")
- The Licensed Software's installer framework
2. Parts of the Licensed Software that are not permitted for distribution
include, but are not limited to:
- The Licensed Software's source code and header files
- The Licensed Software's documentation
- The Licensed Software's documentation generation tool ("qdoc")
- The Licensed Software's tool for writing makefiles ("qmake")
- The Licensed Software's Meta Object Compiler ("moc")
- The Licensed Software's User Interface Compiler ("uic")
- The Licensed Software's Resource Compiler ("rcc")
- The Licensed Software's parts of the IDE tool ("Qt Creator")
- The Licensed Software's parts of the Design tools ("Qt 3D Studio" or
"Qt Quick Designer")
- The Licensed Software's Emulator

File diff suppressed because it is too large Load Diff

5
configure vendored
View File

@ -271,12 +271,9 @@ macSDKify()
val=$(echo $sdk_val $(echo $val | cut -s -d ' ' -f 2-))
echo "$var=$val"
;;
QMAKE_CFLAGS=*|QMAKE_CXXFLAGS=*)
QMAKE_CFLAGS=*|QMAKE_CXXFLAGS=*|QMAKE_LFLAGS=*)
echo "$line -isysroot $sysroot $version_min_flag"
;;
QMAKE_LFLAGS=*)
echo "$line -Wl,-syslibroot,$sysroot $version_min_flag"
;;
*)
echo "$line"
;;

View File

@ -61,6 +61,8 @@ defineTest(qtConfCommandline_sanitize) {
# callbacks
defineReplace(qtConfFunc_crossCompile) {
!isEmpty(config.input.xplatform): return(true)
!isEmpty(config.input.device-option): return(true)
!isEmpty(config.input.sysroot): return(true)
spec = $$[QMAKE_SPEC]
!equals(spec, $$[QMAKE_XSPEC]): return(true)
@ -72,7 +74,7 @@ defineReplace(qtConfFunc_licenseCheck) {
hasOpenSource = true
else: \
hasOpenSource = false
exists($$QT_SOURCE_TREE/LICENSE.QT-LICENSE-AGREEMENT-4.0): \
exists($$QT_SOURCE_TREE/LICENSE.QT-LICENSE-AGREEMENT): \
hasCommercial = true
else: \
hasCommercial = false
@ -202,7 +204,7 @@ defineReplace(qtConfFunc_licenseCheck) {
affix = either
}
} else {
theLicense = $$cat($$QT_SOURCE_TREE/LICENSE.QT-LICENSE-AGREEMENT-4.0, lines)
theLicense = $$cat($$QT_SOURCE_TREE/LICENSE.QT-LICENSE-AGREEMENT, lines)
theLicense = $$first(theLicense)
showWhat = "Type '?' to view the $${theLicense}."
}
@ -229,7 +231,7 @@ defineReplace(qtConfFunc_licenseCheck) {
} else: equals(val, n)|equals(val, no) {
return(false)
} else: equals(commercial, yes):equals(val, ?) {
licenseFile = $$QT_SOURCE_TREE/LICENSE.QT-LICENSE-AGREEMENT-4.0
licenseFile = $$QT_SOURCE_TREE/LICENSE.QT-LICENSE-AGREEMENT
} else: equals(commercial, no):equals(val, l) {
licenseFile = $$QT_SOURCE_TREE/LICENSE.LGPL3
} else: equals(commercial, no):equals(val, g):$$gpl2Ok {

109
dist/changes-5.12.10 vendored Normal file
View File

@ -0,0 +1,109 @@
Qt 5.12.10 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.12.9.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
https://doc.qt.io/qt-5.12/index.html
The Qt version 5.12 series is binary compatible with the 5.11.x series.
Applications compiled for 5.11 will continue to run with 5.12.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Important Behavior Changes *
****************************************************************************
****************************************************************************
* Library *
****************************************************************************
- [oss-fuzz-24347] QXmlStreamReader: No longer resizes readBuffer to a size
it already has. When resizing it to 0 it will cause it to allocate memory.
This will then cause append() to copy the data from the other string instead
of using copy on write.
- [oss-fuzz-24702] QTextHtmlParserNode: Fixed an integer-overflow in variantHash() due
to extreme values for the font's pixelsize.
- [QTBUG-86702] Gif decoder: fixed a read error caused by a ub check
The recently added check to avoid negative-bitshift ub ignored that
the algorithm will sometimes use a negative bitcount value as a flag.
This caused a reading failure for some frames.
- [QTBUG-86547] Fixed a double deletion in QDomAttr::setNodeValue()
- [QTBUG-86691] xpm handler: fixed read error caused by off-by-one in overflow check
The recently introduced overflow check for 8 bit images was too
aggressive, causing the last pixel on each line to be rejected. This is also
fixed for 32bit images.
- [oss-fuzz-22997] Avoided a potential ub in a corrupt bmp file
- [QTBUG-85725] Cocoa: Translated the buttons used for the native font and
color dialogs
- [QTBUG-86019] Fixed crash when serializing default-constructed QTimeZone
- [oss-fuzz-24273] QBezier: No longer calculates a unit vector when length is null to
prevent a divide by zero.
- [QTBUG-81723] xcb: Fixed flushing of native subwindows when not using shared memory
When using X-forwarding shared memory is not used for the backing
store image, and ended up in a code path where we first copied the updated
parts of the backing store from our client side image over to the
server, and then flush those parts from the server-side image to the
window.
- [QTBUG-85764] Fixed starting of iOS applications on Big Sur
- [QTBUG-85580] QByteArray::toDouble: fixed buffer overflow reads on fromRawData()
- [QTBUG-85193] Allowed smooth curve stroking for very wide lines to ensure they
are rendered better.
- [QTBUG-85915] macOS: Fixed crash when re-using the backing store for a
re-created QWindow. This was triggered when reopening a QComboBox after
switching from one screen to another.
- [oss-fuzz-23220] Sanitized the lengthValue in CSS parser by limiting the
LengthData to the integer range before rounding it, taking into account
that qRound() substracts 1 from negative values.
- [oss-fuzz-21860] Checked return values of hex2int in get_hex_rgb
- [oss-fuzz-23988] Fixed buffer overflow
- [oss-fuzz-23735] Multiplied instead of shifting for negative values
- [QTBUG-85528] Disabled PCRE2 JIT on macOS ARM64
- [QTBUG-85279] macOS: Excluded 32-bit builds by checking pointer size
- [QTBUG-85279] Fixed compilation of Qt on Apple Silicon (arm64)
- [QTBUG-76924] Prevented the setting of focus on a proxy widget that does
not take focus
- [QTBUG-71548] Worked around a regression in the MSVC 2019 6.6 STL triggered
when building qttranslations.
- [QTBUG-84383] Fixed UITouch event handling on tvOS to prevent a crash
when touchesEnd: could be called with touches that were not included in
touchesBegain:.
- [QTBUG-84762] macOS: Ensured QCocoaGLContext cleans up more often to
release unneeded NSViews
- [QTBUG-77320] Android: Accessibility is now activated when appropriate
- [QTCREATORBUG-24195] Now always shows a submenu on its parent menu's screen
QCosmeticStroker
----------------
- [oss-fuzz-25243] Avoided a heap-buffer-overflow
QOutlineMapper
--------------
- [oss-fuzz-24615] Avoided a heap-buffer-overflow
QtSQL
-----
- sqlite was updated to version 3.33.0
Third-Party Code
----------------
- Fix aggregated copyright information of TinyCBOR component to reflect the
years in the individual source files. Note that this is not same as the
Copyright year in the upstream MIT license text.
- Changed classification of the wintab license from "Custom" to
"LCS-Telegraphics License"
- libjpeg-turbo was updated to version 2.0.5

53
dist/changes-5.12.6 vendored Normal file
View File

@ -0,0 +1,53 @@
Qt 5.12.6 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.12.0 through 5.12.5.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
https://doc.qt.io/qt-5/index.html
The Qt version 5.12 series is binary compatible with the 5.11.x series.
Applications compiled for 5.11 will continue to run with 5.12.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* QtCore *
****************************************************************************
- QLocale:
* The system locale's UI languages list now includes, as for that of an
ordinary locale, the results of adding likely sub-tags from each
locale name, and of removing some, where this doesn't change which
locale is specified. This gives searches for translation files a
better chance of finding a suitable file.
****************************************************************************
* Windows *
****************************************************************************
- Text:
* [QTBUG-57180] Removed confusing DirectWrite warning when loading
bitmap fonts.
****************************************************************************
* Android *
****************************************************************************
- Fixed regression that made it impossible for an application to use the
tap-and-hold gesture.
****************************************************************************
* Third-Party Code *
****************************************************************************
- libjpeg-turbo was updated to version 2.0.3
- QtSQL
* Updated sqlite to v3.29.0

25
dist/changes-5.12.7 vendored Normal file
View File

@ -0,0 +1,25 @@
Qt 5.12.7 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.12.0 through 5.12.6.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
https://doc.qt.io/qt-5/index.html
The Qt version 5.12 series is binary compatible with the 5.11.x series.
Applications compiled for 5.11 will continue to run with 5.12.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* QtSQL *
****************************************************************************
- sqlite:
* Updated to v3.30.1

70
dist/changes-5.12.8 vendored Normal file
View File

@ -0,0 +1,70 @@
Qt 5.12.8 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.12.0 through 5.12.7.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
https://doc.qt.io/qt-5/index.html
The Qt version 5.12 series is binary compatible with the 5.11.x series.
Applications compiled for 5.11 will continue to run with 5.12.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* QtCore *
****************************************************************************
- QLockFile:
* Suppressed the warning on QNX that said 'setNativeLocks failed:
"Function not implemented"'. There is no difference in behavior: Qt
will continue not to be able to apply an OS- level file lock, which
means the lock could be accidentally stolen by buggy software. Correct
software using QLockFile should not be affected.
- QXmlStream:
* QTBUG-47417: QXmlStreamReader does now limit the expansion of
entities to 4096 characters. Documents where a single entity
expands to more characters than the limit are not considered well
formed. The limit is there to avoid DoS attacks through
recursively expanding entities when loading untrusted content. Qt
5.15 will add methods that allow changing that limit.
****************************************************************************
* QtSQL *
****************************************************************************
- sqlite:
* Updated to v3.31.1
* [QTBUG-82533] Fixed CVE-2020-9327
****************************************************************************
* QtNetwork *
****************************************************************************
- QSslCertificate:
* Fix a potential heap buffer overflow when parsing certificates
- QTBUG-81762: Fix SSL symbol resolving for OPENSSL_NO_NEXPROTONEG
****************************************************************************
* Platform specific changes *
****************************************************************************
- macOS:
* QTBUG-82986: Improve performance when flushing sublayers
* QTBUG-79139: Avoid repainting OpenGL layers when resizing the window
- xcb/X11:
* QTBUG-76147, QTBUG-76354, QTBUG-68864: Fix handling of minimized state
- QNX:
* QTBUG-81701: QLockFile: Disable flock() on QNX

95
dist/changes-5.12.9 vendored Normal file
View File

@ -0,0 +1,95 @@
Qt 5.12.9 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.12.0 through 5.12.8.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
https://doc.qt.io/qt-5/index.html
The Qt version 5.12 series is binary compatible with the 5.11.x series.
Applications compiled for 5.11 will continue to run with 5.12.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Platform-specific Changes *
****************************************************************************
Linux
-----
- [QTBUG-63584] Fixed a crash in evdev when multiple touchscreens are in use.
Windows
-------
- Fixed a compatibility issue found when linking code compiled with
MSVC version 16.6 to a Qt compiled with 16.5.
- [QTBUG-80436] Fixed a crash when changing screen during session lock.
- [QTBUG-84265] Direct Write Font engine: Fix a memory leak
macOS
-----
- [QTBUG-84405] Respect window type when determining main window status
****************************************************************************
* QtCore *
****************************************************************************
- QCborValue:
* fromCbor() now limits decoding to at most 1024 nested maps, arrays,
and tags to prevent stack overflows. This should be sufficient for
most uses of CBOR. An API to limit further or to relax the limit will
be provided in 5.15. Meanwhile, if decoding more is required,
QCborStreamReader can be used (note that each level of map and array
allocates memory).
****************************************************************************
* QtSQL *
****************************************************************************
- sqlite:
* Updated to v3.32.1 which includes fixes for CVE-2020-11655 and
CVE-2020-11656
****************************************************************************
* QtNetwork *
****************************************************************************
- [QTBUG-83450] OpenSSL: handle SSL_shutdown's errors properly
****************************************************************************
* QtGui *
****************************************************************************
- QIcon:
* [QTBUG-74252] If you call QIcon::setFallbackThemeName(), do it before
creating a QGuiApplication. We fixed a race condition which was
preventing loading the first icon from the fallback theme.
- QImage:
* [oss-fuzz 22557] Fixed undefined behavior in bmp/ico decoder
* [oss-fuzz 22741] Fixed crash in gif decoder
- [QTBUG-84189] Avoid format conversion when uploading textures for the
backing store
****************************************************************************
* QtWidgets *
****************************************************************************
- QWidgetWindow:
* [QTBUG-84222] Fixed crash in QWidgetWindow::event() when
handling closeEvent.
- QMenu:
* [QTBUG-76162] A submenu now always opens on the same screen as
the parent menu.

View File

@ -3,7 +3,7 @@
dita.metadata.default.author = Qt Project
dita.metadata.default.permissions = all
dita.metadata.default.publisher = Qt Project
dita.metadata.default.copyryear = 2019
dita.metadata.default.copyryear = 2020
dita.metadata.default.copyrholder = The Qt Company Ltd
dita.metadata.default.audience = programmer

View File

@ -78,7 +78,7 @@ HTML.footer += \
" <ul id=\"menu-footer-submenu\" class=\"right clearfix\"><li id=\"menu-item-1795\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-1795\"><a title=\"Sign into your account.\" href=\"https://account.qt.io/login\">Sign In</a></li>\n" \
" <li id=\"menu-item-10375\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-10375\"><a href=\"mailto:feedback@theqtcompany.com?Subject=Feedback%20about%20doc.qt.io%20site\">Feedback</a></li>\n" \
" <li id=\"menu-item-1494\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1494\"><a href=\"http://qt.io/contact-us/\">Contact us</a></li>\n" \
" <li id=\"menu-item-4472\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-4472\"><a href=\"http://qt.io/about-us/\">© 2019 The Qt Company</a></li>\n" \
" <li id=\"menu-item-4472\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-4472\"><a href=\"http://qt.io/about-us/\">© 2020 The Qt Company</a></li>\n" \
" </ul>\n" \
"</div>\n" \
"</div>\n" \

View File

@ -8,7 +8,7 @@ HTML.footer = \
"</div>\n" \
"<div class=\"footer\">\n" \
" <p>\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2019 The Qt Company Ltd.\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2020 The Qt Company Ltd.\n" \
" Documentation contributions included herein are the copyrights of\n" \
" their respective owners.<br/>" \
" The documentation provided herein is licensed under the terms of the" \

View File

@ -19,27 +19,11 @@ HTML.headerstyles = \
" }, 0);\n" \
" </script>\n"
HTML.postheader = \
"<body>\n" \
"<div class=\"header\" id=\"qtdocheader\">\n"\
" <div class=\"main\">\n" \
" <div class=\"main-rounded\">\n" \
" <div class=\"navigationbar\">\n" \
" <table><tr>\n"
HTML.postpostheader = \
" </tr></table>\n"\
" </div>\n" \
" </div>\n" \
"<div class=\"content\">\n" \
"<div class=\"line\">\n" \
"<div class=\"content mainContent\">\n"
HTML.navigationseparator = \
"<span class=\"naviSeparator\"> &#9702; </span>\n"
# Add some padding around code snippets, as we cannot
# currectly style them for QTextBrowser using only CSS.
codeindent = 2
codeprefix = "\n\n"
codesuffix = "\n\n"
codeindent = 1
codeprefix = "\n"
codesuffix = "\n"

View File

@ -5,7 +5,7 @@
HTML.footer = \
" </div>\n" \
" <p class=\"copy-notice\">\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2019 The Qt Company Ltd.\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2020 The Qt Company Ltd.\n" \
" Documentation contributions included herein are the copyrights of\n" \
" their respective owners. " \
" The documentation provided herein is licensed under the terms of the" \

View File

@ -297,11 +297,14 @@ table.buildversion {
#buildversion {
font-style: italic;
font-size: small;
float: right;
margin-right: 5px;
}
#buildversion a {
background: none;
}
/*
/* table of content

View File

@ -17,8 +17,16 @@ os_directory = $$(INTEGRITY_DIR)
isEmpty(os_directory): \
error("This qmakespec requires $INTEGRITY_DIR to be set")
QMAKE_CC = cxintarm64 -bsp $$bsp_name -os_dir $$os_directory -non_shared
QMAKE_CXX = cxintarm64 -bsp $$bsp_name -os_dir $$os_directory -non_shared
iy_build_target = $$(INTEGRITY_BUILD_TARGET)
isEmpty(iy_build_target): \
message("This qmakespec requires $INTEGRITY_BUILD_TARGET to be set [dbg|rel|chk|cov] for Integrity versions 11.7.6 and higher")
start_name = $$(INTEGRITY_DIR)/libs/$$(INTEGRITY_BSP)/$$(INTEGRITY_BUILD_TARGET)
rtos_name= libs/$$(INTEGRITY_BSP)/$$(INTEGRITY_BUILD_TARGET)
QMAKE_CC = cxintarm64 -bsp $$bsp_name -os_dir $$os_directory -non_shared -startfile_dir=$$start_name --rtos_library_directory=$$rtos_name --rtos_library_directory=libs/arm64/$$iy_build_target
QMAKE_CXX = cxintarm64 -bsp $$bsp_name -os_dir $$os_directory -non_shared -startfile_dir=$$start_name --rtos_library_directory=$$rtos_name --rtos_library_directory=libs/arm64/$$iy_build_target
QMAKE_LINK = $$QMAKE_CXX
QMAKE_AR = $$QMAKE_CXX -archive -o

View File

@ -7,8 +7,9 @@ QMAKE_MAC_SDK = macosx
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.12
QMAKE_APPLE_DEVICE_ARCHS = x86_64
QT_MAC_SDK_VERSION_MIN = 10.13
QT_MAC_SDK_VERSION_MAX = 10.15
QT_MAC_SDK_VERSION_MAX = 11.0
device.sdk = macosx
device.target = device

View File

@ -35,7 +35,7 @@ isEmpty(gl_lib_directory): \
QMAKE_INCDIR += $$(QC_MULTIMEDIA_INC_DIR)
QMAKE_LIBS_EGL += -lESXEGL_Adreno -lESXGLESv2_Adreno -ladreno_utils -lGSLUser -lOSUser -lpanel -livfs -lposix -lpmem -ltzbsp -lpaged_alloc -lglnext-llvm -lopenwfd -lplanedef -lmmosallibrary
QMAKE_LIBS_EGL += -lESXEGL_Adreno -lESXGLESv2_Adreno -ladreno_utils -lGSLUser -lOSUser -lpanel -livfs -lposix -lpmem -ltzbsp -lpaged_alloc -lglnext-llvm -lopenwfd -lplanedef -lmmosallibrary -lmmosalrfs -llogger -lnet -lsocket -lrfs_client -lshm_client -lmmapext
QMAKE_LIBS_OPENGL_ES2 += $${QMAKE_LIBS_EGL}
QMAKE_CFLAGS += -DINTEGRITY

View File

@ -228,7 +228,8 @@ mac {
CMAKE_PRL_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.prl
} else {
qt_framework {
CMAKE_LIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}.framework/$${CMAKE_QT_STEM}_debug
# Intentionally there is no '_debug' infix for framework builds.
CMAKE_LIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}.framework/$${CMAKE_QT_STEM}
CMAKE_LIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.framework/$${CMAKE_QT_STEM}
CMAKE_BUILD_IS_FRAMEWORK = "true"
} else {

View File

@ -97,21 +97,22 @@ macx-xcode {
qmake_pkginfo_typeinfo.value = "????"
QMAKE_MAC_XCODE_SETTINGS += qmake_pkginfo_typeinfo
!isEmpty(VERSION) {
l = $$split(VERSION, '.') 0 0 # make sure there are at least three
VER_MAJ = $$member(l, 0, 0)
VER_MIN = $$member(l, 1, 1)
VER_PAT = $$member(l, 2, 2)
unset(l)
bundle_version = $$VERSION
isEmpty(bundle_version): bundle_version = 1.0.0
qmake_full_version.name = QMAKE_FULL_VERSION
qmake_full_version.value = $${VER_MAJ}.$${VER_MIN}.$${VER_PAT}
QMAKE_MAC_XCODE_SETTINGS += qmake_full_version
l = $$split(bundle_version, '.') 0 0 # make sure there are at least three
VER_MAJ = $$member(l, 0, 0)
VER_MIN = $$member(l, 1, 1)
VER_PAT = $$member(l, 2, 2)
unset(l)
qmake_short_version.name = QMAKE_SHORT_VERSION
qmake_short_version.value = $${VER_MAJ}.$${VER_MIN}
QMAKE_MAC_XCODE_SETTINGS += qmake_short_version
}
qmake_full_version.name = QMAKE_FULL_VERSION
qmake_full_version.value = $${VER_MAJ}.$${VER_MIN}.$${VER_PAT}
QMAKE_MAC_XCODE_SETTINGS += qmake_full_version
qmake_short_version.name = QMAKE_SHORT_VERSION
qmake_short_version.value = $${VER_MAJ}.$${VER_MIN}
QMAKE_MAC_XCODE_SETTINGS += qmake_short_version
!isEmpty(QMAKE_XCODE_DEBUG_INFORMATION_FORMAT) {
debug_information_format.name = DEBUG_INFORMATION_FORMAT
@ -196,7 +197,7 @@ macx-xcode {
-isysroot$$xcodeSDKInfo(Path, $$sdk)
QMAKE_XARCH_LFLAGS_$${arch} = $$version_min_flags \
-Xarch_$${arch} \
-Wl,-syslibroot,$$xcodeSDKInfo(Path, $$sdk)
-isysroot$$xcodeSDKInfo(Path, $$sdk)
QMAKE_XARCH_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS_$${arch})
QMAKE_XARCH_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS_$${arch})
@ -217,7 +218,7 @@ macx-xcode {
version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
QMAKE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
QMAKE_LFLAGS += -Wl,-syslibroot,$$QMAKE_MAC_SDK_PATH $$version_min_flag
QMAKE_LFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
}
# Enable precompiled headers for multiple architectures

View File

@ -25,7 +25,8 @@ contains(TEMPLATE, .*lib) {
if(!host_build|!cross_compile):qtConfig(reduce_exports): CONFIG += hide_symbols
unix:qtConfig(reduce_relocations): CONFIG += bsymbolic_functions
qtConfig(separate_debug_info): CONFIG += separate_debug_info
}
contains(TEMPLATE, .*lib)|contains(TEMPLATE, aux) {
!isEmpty(_QMAKE_SUPER_CACHE_): \
rplbase = $$dirname(_QMAKE_SUPER_CACHE_)/[^/][^/]*
else: \

View File

@ -821,9 +821,9 @@ defineTest(qtConfLibrary_pkgConfig) {
!qtConfResolveLibs($${1}.libs, $$libs): \
return(false)
contains($${1}.libs, ".*\\.$${QMAKE_EXTENSION_STATICLIB}$") {
qtRunLoggedCommand("$$pkg_config --static --libs-only-L $$args", libpaths)|return(false)
qtRunLoggedCommand("$$pkg_config --static --libs-only-l $$args", libs)|return(false)
eval(libs = $$libpaths $$libs)
qtRunLoggedCommand("$$pkg_config --static --libs $$args", libs)|return(false)
# Split by space
eval(libs = $$libs)
!qtConfResolveLibs($${1}.libs, $$libs): \
return(false)
}

View File

@ -1,4 +1,4 @@
QMAKE_TARGET_COMPANY = The Qt Company Ltd.
isEmpty(QMAKE_TARGET_PRODUCT): QMAKE_TARGET_PRODUCT = Qt5
isEmpty(QMAKE_TARGET_DESCRIPTION): QMAKE_TARGET_DESCRIPTION = C++ Application Development Framework
QMAKE_TARGET_COPYRIGHT = Copyright (C) 2019 The Qt Company Ltd.
QMAKE_TARGET_COPYRIGHT = Copyright (C) 2020 The Qt Company Ltd.

View File

@ -36,7 +36,11 @@ win32 {
plugin_target = $$QMAKE_PLUGIN_BUNDLE_NAME
else: \
plugin_target = $$TARGET
QMAKE_RESOLVED_BUNDLE = $${QMAKE_RESOLVED_TARGET}$${plugin_target}.plugin
isEmpty(QMAKE_BUNDLE_EXTENSION): \
plugin_ext = .plugin
else: \
plugin_ext = $$QMAKE_BUNDLE_EXTENSION
QMAKE_RESOLVED_BUNDLE = $${QMAKE_RESOLVED_TARGET}$${plugin_target}$${plugin_ext}
!shallow_bundle: \
QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_BUNDLE}/Contents/MacOS/$${TARGET}
else: \
@ -46,7 +50,11 @@ win32 {
framework_target = $$QMAKE_FRAMEWORK_BUNDLE_NAME
else: \
framework_target = $$TARGET
QMAKE_RESOLVED_BUNDLE = $${QMAKE_RESOLVED_TARGET}$${framework_target}.framework
isEmpty(QMAKE_BUNDLE_EXTENSION): \
framework_ext = .framework
else: \
framework_ext = $$QMAKE_BUNDLE_EXTENSION
QMAKE_RESOLVED_BUNDLE = $${QMAKE_RESOLVED_TARGET}$${framework_target}$${framework_ext}
!shallow_bundle {
TEMP_VERSION = $$section(VERSION, ., 0, 0)
isEmpty(TEMP_VERSION):TEMP_VERSION = A

View File

@ -182,6 +182,10 @@ isEmpty($${target_prefix}.INCDIRS) {
# UIKit simulator platforms will see the device SDK's sysroot in
# QMAKE_DEFAULT_*DIRS, because they're handled in a single build pass.
darwin {
# Clang doesn't pick up the architecture from the sysroot, and will
# default to the host architecture, so we need to manually set it.
cxx_flags += -arch $$QMAKE_APPLE_DEVICE_ARCHS
uikit:macx-xcode: \
cxx_flags += -isysroot $$sdk_path_device.value
else: \

View File

@ -9,7 +9,7 @@ uic.depend_command = $$QMAKE_UIC_DEP -d ${QMAKE_FILE_IN}
uic.output = $$UI_DIR/$${QMAKE_MOD_UIC}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_H)}
uic.input = FORMS
uic.variable_out = GENERATED_FILES
uic.CONFIG += no_link target_predeps dep_lines
uic.CONFIG += no_link target_predeps dep_lines dep_existing_only
uic.name = UIC ${QMAKE_FILE_IN}
silent:uic.commands = @echo uic ${QMAKE_FILE_IN} && $$uic.commands
QMAKE_EXTRA_COMPILERS += uic

View File

@ -28,7 +28,7 @@ macx-xcode {
device_family.value = $$QMAKE_APPLE_TARGETED_DEVICE_FAMILY
QMAKE_MAC_XCODE_SETTINGS += device_family
ios {
equals(TEMPLATE, app):ios {
# Set up default 4-inch iPhone/iPod launch image so that our apps
# support the full screen resolution of those devices.
qmake_launch_image = Default-568h@2x.png

View File

@ -2,8 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<false/>
</dict>

View File

@ -27,7 +27,7 @@ QOBJS = \
qjsonarray.o qjson.o qjsondocument.o qjsonobject.o qjsonparser.o qjsonvalue.o \
qmetatype.o qsystemerror.o qvariant.o \
quuid.o \
qarraydata.o qbitarray.o qbytearray.o qbytearraymatcher.o \
qarraydata.o qbitarray.o qbytearray.o qbytearraylist.o qbytearraymatcher.o \
qcryptographichash.o qdatetime.o qhash.o qlinkedlist.o qlist.o \
qlocale.o qlocale_tools.o qmap.o qregexp.o qringbuffer.o \
qstringbuilder.o qstring_compat.o qstring.o qstringlist.o qversionnumber.o \
@ -108,6 +108,7 @@ DEPEND_SRC = \
$(SOURCE_PATH)/src/corelib/tools/qarraydata.cpp \
$(SOURCE_PATH)/src/corelib/tools/qbitarray.cpp \
$(SOURCE_PATH)/src/corelib/tools/qbytearray.cpp\
$(SOURCE_PATH)/src/corelib/tools/qbytearraylist.cpp \
$(SOURCE_PATH)/src/corelib/tools/qbytearraymatcher.cpp \
$(SOURCE_PATH)/src/corelib/tools/qcryptographichash.cpp \
$(SOURCE_PATH)/src/corelib/tools/qdatetime.cpp \
@ -307,6 +308,9 @@ qarraydata.o: $(SOURCE_PATH)/src/corelib/tools/qarraydata.cpp
qbytearray.o: $(SOURCE_PATH)/src/corelib/tools/qbytearray.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qbytearraylist.o: $(SOURCE_PATH)/src/corelib/tools/qbytearraylist.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<
qvsnprintf.o: $(SOURCE_PATH)/src/corelib/tools/qvsnprintf.cpp
$(CXX) -c -o $@ $(CXXFLAGS) $<

View File

@ -71,6 +71,7 @@ QTOBJS= \
qfsfileengine_iterator.obj \
qarraydata.obj \
qbytearray.obj \
qbytearraylist.obj \
qvsnprintf.obj \
qbytearraymatcher.obj \
qdatetime.obj \

View File

@ -4728,6 +4728,11 @@
\li explicit_dependencies
\li The dependencies for the output only get generated from the depends
member and from nowhere else.
\row
\li dep_existing_only
\li Every dependency that is a result of .depend_command is checked for
existence. Non-existing dependencies are ignored.
This value was introduced in Qt 5.12.6.
\row
\li dep_lines
\li The output from the .depend_command is interpreted to be one file

View File

@ -783,6 +783,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
{
QString mkfile = pbx_dir + Option::dir_sep + "qt_preprocess.mak";
QFile mkf(mkfile);
ProStringList outputPaths;
ProStringList inputPaths;
if(mkf.open(QIODevice::WriteOnly | QIODevice::Text)) {
writingUnixMakefileGenerator = true;
debug_msg(1, "pbuilder: Creating file: %s", mkfile.toLatin1().constData());
@ -832,8 +834,11 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
++added;
const QString file_name = fileFixify(fn, FileFixifyFromOutdir);
const QString tmpOut = fileFixify(tmp_out.first().toQString(), FileFixifyFromOutdir);
mkt << ' ' << escapeDependencyPath(Option::fixPathToTargetOS(
QString path = escapeDependencyPath(Option::fixPathToTargetOS(
replaceExtraCompilerVariables(tmpOut, file_name, QString(), NoShell)));
mkt << ' ' << path;
inputPaths << fn;
outputPaths << path;
}
}
}
@ -844,6 +849,14 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
mkt.flush();
mkf.close();
}
// Remove duplicates from build steps with "combine"
outputPaths.removeDuplicates();
// Don't create cycles. We only have one qt_preprocess.mak which runs different compilers
// whose inputs may depend on the output of another. The "compilers" step will run all
// compilers anyway
inputPaths.removeEach(outputPaths);
mkfile = fileFixify(mkfile);
QString phase_key = keyFor("QMAKE_PBX_PREPROCESS_TARGET");
// project->values("QMAKE_PBX_BUILDPHASES").append(phase_key);
@ -854,6 +867,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
<< "\t\t\t" << writeSettings("isa", "PBXShellScriptBuildPhase", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n"
<< "\t\t\t" << writeSettings("name", "Qt Preprocessors") << ";\n"
<< "\t\t\t" << writeSettings("inputPaths", inputPaths, SettingsAsList, 4) << ";\n"
<< "\t\t\t" << writeSettings("outputPaths", outputPaths, SettingsAsList, 4) << ";\n"
<< "\t\t\t" << writeSettings("shellPath", "/bin/sh") << ";\n"
<< "\t\t\t" << writeSettings("shellScript", "make -C " + IoUtils::shellQuoteUnix(Option::output_dir)
+ " -f " + IoUtils::shellQuoteUnix(mkfile)) << ";\n"

View File

@ -1870,6 +1870,61 @@ QString MakefileGenerator::resolveDependency(const QDir &outDir, const QString &
return {};
}
void MakefileGenerator::callExtraCompilerDependCommand(const ProString &extraCompiler,
const QString &dep_cd_cmd,
const QString &tmp_dep_cmd,
const QString &inpf,
const QString &tmp_out,
bool dep_lines,
QStringList *deps,
bool existingDepsOnly,
bool checkCommandAvailability)
{
char buff[256];
QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, tmp_out, LocalShell);
if (checkCommandAvailability && !canExecute(dep_cmd))
return;
dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd);
if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) {
QByteArray depData;
while (int read_in = feof(proc) ? 0 : (int)fread(buff, 1, 255, proc))
depData.append(buff, read_in);
QT_PCLOSE(proc);
const QString indeps = QString::fromLocal8Bit(depData);
if (indeps.isEmpty())
return;
QDir outDir(Option::output_dir);
QStringList dep_cmd_deps = splitDeps(indeps, dep_lines);
for (int i = 0; i < dep_cmd_deps.count(); ++i) {
QString &file = dep_cmd_deps[i];
const QString absFile = outDir.absoluteFilePath(file);
if (absFile == file) {
// already absolute; don't do any checks.
} else if (exists(absFile)) {
file = absFile;
} else {
const QString localFile = resolveDependency(outDir, file);
if (localFile.isEmpty()) {
if (exists(file)) {
warn_msg(WarnDeprecated, ".depend_command for extra compiler %s"
" prints paths relative to source directory",
extraCompiler.toLatin1().constData());
} else if (existingDepsOnly) {
file.clear();
} else {
file = absFile; // fallback for generated resources
}
} else {
file = localFile;
}
}
if (!file.isEmpty())
file = fileFixify(file);
}
deps->append(dep_cmd_deps);
}
}
void
MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
{
@ -1984,6 +2039,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
}
t << endl;
}
const bool existingDepsOnly = config.contains("dep_existing_only");
QStringList tmp_dep = project->values(ProKey(*it + ".depends")).toQStringList();
if (config.indexOf("combine") != -1) {
if (tmp_out.contains(QRegExp("(^|[^$])\\$\\{QMAKE_(?!VAR_)"))) {
@ -1999,44 +2055,8 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
deps += findDependencies(inpf);
inputs += Option::fixPathToTargetOS(inpf, false);
if(!tmp_dep_cmd.isEmpty() && doDepends()) {
char buff[256];
QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, tmp_out, LocalShell);
dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd);
if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) {
QByteArray depData;
while (int read_in = feof(proc) ? 0 : (int)fread(buff, 1, 255, proc))
depData.append(buff, read_in);
QT_PCLOSE(proc);
const QString indeps = QString::fromLocal8Bit(depData);
if(!indeps.isEmpty()) {
QDir outDir(Option::output_dir);
QStringList dep_cmd_deps = splitDeps(indeps, dep_lines);
for(int i = 0; i < dep_cmd_deps.count(); ++i) {
QString &file = dep_cmd_deps[i];
QString absFile = outDir.absoluteFilePath(file);
if (absFile == file) {
// already absolute; don't do any checks.
} else if (exists(absFile)) {
file = absFile;
} else {
QString localFile = resolveDependency(outDir, file);
if (localFile.isEmpty()) {
if (exists(file))
warn_msg(WarnDeprecated, ".depend_command for extra compiler %s"
" prints paths relative to source directory",
(*it).toLatin1().constData());
else
file = absFile; // fallback for generated resources
} else {
file = localFile;
}
}
if(!file.isEmpty())
file = fileFixify(file);
}
deps += dep_cmd_deps;
}
}
callExtraCompilerDependCommand(*it, dep_cd_cmd, tmp_dep_cmd, inpf,
tmp_out, dep_lines, &deps, existingDepsOnly);
}
}
for(int i = 0; i < inputs.size(); ) {
@ -2084,44 +2104,8 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
for (ProStringList::ConstIterator it3 = vars.constBegin(); it3 != vars.constEnd(); ++it3)
cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")");
if(!tmp_dep_cmd.isEmpty() && doDepends()) {
char buff[256];
QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, out, LocalShell);
dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd);
if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) {
QByteArray depData;
while (int read_in = feof(proc) ? 0 : (int)fread(buff, 1, 255, proc))
depData.append(buff, read_in);
QT_PCLOSE(proc);
const QString indeps = QString::fromLocal8Bit(depData);
if(!indeps.isEmpty()) {
QDir outDir(Option::output_dir);
QStringList dep_cmd_deps = splitDeps(indeps, dep_lines);
for(int i = 0; i < dep_cmd_deps.count(); ++i) {
QString &file = dep_cmd_deps[i];
QString absFile = outDir.absoluteFilePath(file);
if (absFile == file) {
// already absolute; don't do any checks.
} else if (exists(absFile)) {
file = absFile;
} else {
QString localFile = resolveDependency(outDir, file);
if (localFile.isEmpty()) {
if (exists(file))
warn_msg(WarnDeprecated, ".depend_command for extra compiler %s"
" prints paths relative to source directory",
(*it).toLatin1().constData());
else
file = absFile; // fallback for generated resources
} else {
file = localFile;
}
}
if(!file.isEmpty())
file = fileFixify(file);
}
deps += dep_cmd_deps;
}
}
callExtraCompilerDependCommand(*it, dep_cd_cmd, tmp_dep_cmd, inpf,
tmp_out, dep_lines, &deps, existingDepsOnly);
//use the depend system to find includes of these included files
QStringList inc_deps;
for(int i = 0; i < deps.size(); ++i) {

View File

@ -84,6 +84,11 @@ protected:
void writeExtraVariables(QTextStream &t);
void writeExtraTargets(QTextStream &t);
QString resolveDependency(const QDir &outDir, const QString &file);
void callExtraCompilerDependCommand(const ProString &extraCompiler, const QString &dep_cd_cmd,
const QString &tmp_dep_cmd, const QString &inpf,
const QString &tmp_out, bool dep_lines, QStringList *deps,
bool existingDepsOnly,
bool checkCommandAvailability = false);
void writeExtraCompilerTargets(QTextStream &t);
void writeExtraCompilerVariables(QTextStream &t);
bool writeDummyMakefile(QTextStream &t);

View File

@ -2350,33 +2350,15 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
if (!tmp_dep.isEmpty())
deps = tmp_dep;
if (!tmp_dep_cmd.isEmpty()) {
// Execute dependency command, and add every line as a dep
char buff[256];
QString dep_cmd = Project->replaceExtraCompilerVariables(
tmp_dep_cmd, inFile, out, MakefileGenerator::LocalShell);
if(Project->canExecute(dep_cmd)) {
dep_cmd.prepend(QLatin1String("cd ")
+ IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false))
+ QLatin1String(" && "));
if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) {
QString indeps;
while(!feof(proc)) {
int read_in = (int)fread(buff, 1, 255, proc);
if(!read_in)
break;
indeps += QByteArray(buff, read_in);
}
QT_PCLOSE(proc);
if(!indeps.isEmpty()) {
QStringList extradeps = indeps.split(QLatin1Char('\n'));
for (int i = 0; i < extradeps.count(); ++i) {
QString dd = extradeps.at(i).simplified();
if (!dd.isEmpty())
deps += Project->fileFixify(dd, MakefileGenerator::FileFixifyFromOutdir);
}
}
}
}
const QString dep_cd_cmd = QLatin1String("cd ")
+ IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false))
+ QLatin1String(" && ");
Project->callExtraCompilerDependCommand(extraCompilerName, dep_cd_cmd, tmp_dep_cmd,
inFile, out,
true, // dep_lines
&deps,
configs.contains("dep_existing_only"),
true /* checkCommandAvailability */);
}
for (int i = 0; i < deps.count(); ++i)
deps[i] = Option::fixPathToTargetOS(

View File

@ -1575,12 +1575,14 @@ void VcprojGenerator::initExtraCompilerOutputs()
if (!outputVar.isEmpty() && otherFilters.contains(outputVar))
continue;
QString tmp_out = project->first(outputs.first().toKey()).toQString();
QString tmp_out;
if (!outputs.isEmpty())
tmp_out = project->first(outputs.first().toKey()).toQString();
if (project->values(ProKey(*it + ".CONFIG")).indexOf("combine") != -1) {
// Combined output, only one file result
extraCompile.addFile(Option::fixPathToTargetOS(
replaceExtraCompilerVariables(tmp_out, QString(), QString(), NoShell), false));
} else {
} else if (!inputVars.isEmpty()) {
// One output file per input
const ProStringList &tmp_in = project->values(inputVars.first().toKey());
for (int i = 0; i < tmp_in.count(); ++i) {

View File

@ -68,6 +68,8 @@ public:
bool usePCH;
VCProjectWriter *projectWriter;
using Win32MakefileGenerator::callExtraCompilerDependCommand;
protected:
virtual VCProjectWriter *createProjectWriter();
bool doDepends() const override { return false; } // Never necessary

View File

@ -1,3 +1,4 @@
gradle/gradlew eol=lf
libpng/projects/cbuilder5/libpng.bpf -crlf
libpng/projects/cbuilder5/libpng.bpg -crlf
libpng/projects/cbuilder5/libpng.bpr -crlf

2
src/3rdparty/_clang-format vendored Normal file
View File

@ -0,0 +1,2 @@
# Ignore formatting of third party code.
DisableFormat: true

View File

@ -11,16 +11,22 @@ Changes:
- remove the locale_t parameter and use ascii_isspace instead of isspace_l
- fix compilation with -Wcast-qual (requires C++)
---
src/3rdparty/freebsd/strtoll.c | 27 ++++-----------------------
src/3rdparty/freebsd/strtoull.c | 27 ++++-----------------------
2 files changed, 8 insertions(+), 46 deletions(-)
src/3rdparty/freebsd/strtoll.c | 27 +++------------------------
src/3rdparty/freebsd/strtoull.c | 27 +++------------------------
2 files changed, 6 insertions(+), 48 deletions(-)
diff --git a/src/3rdparty/freebsd/strtoll.c b/src/3rdparty/freebsd/strtoll.c
index 16a8196..7b4505e 100644
index c87aefb1cd..89da83425d 100644
--- a/src/3rdparty/freebsd/strtoll.c
+++ b/src/3rdparty/freebsd/strtoll.c
@@ -32,18 +32,6 @@
@@ -1,6 +1,4 @@
/*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -34,18 +32,6 @@
* SUCH DAMAGE.
*/
@ -39,7 +45,7 @@ index 16a8196..7b4505e 100644
/*
* Convert a string to a long long integer.
*
@@ -51,15 +39,13 @@ __FBSDID("$FreeBSD$");
@@ -53,15 +39,13 @@ __FBSDID("$FreeBSD$");
* alphabets and digits are each contiguous.
*/
long long
@ -56,7 +62,7 @@ index 16a8196..7b4505e 100644
/*
* Skip white space and pick up leading +/- sign if any.
@@ -69,7 +55,7 @@ strtoll_l(const char * __restrict nptr, char ** __restrict endptr, int base,
@@ -71,7 +55,7 @@ strtoll_l(const char * __restrict nptr, char ** __restrict endptr, int base,
s = nptr;
do {
c = *s++;
@ -65,12 +71,9 @@ index 16a8196..7b4505e 100644
if (c == '-') {
neg = 1;
c = *s++;
@@ -141,13 +127,8 @@ strtoll_l(const char * __restrict nptr, char ** __restrict endptr, int base,
noconv:
errno = EINVAL;
@@ -145,11 +129,6 @@ noconv:
} else if (neg)
- acc = -acc;
+ acc = (unsigned long long) -(long long)acc;
acc = -acc;
if (endptr != NULL)
- *endptr = (char *)(any ? s - 1 : nptr);
+ *endptr = const_cast<char *>(any ? s - 1 : nptr);
@ -82,10 +85,17 @@ index 16a8196..7b4505e 100644
- return strtoll_l(nptr, endptr, base, __get_locale());
-}
diff --git a/src/3rdparty/freebsd/strtoull.c b/src/3rdparty/freebsd/strtoull.c
index dc40e0e..1eb9257 100644
index 58a9b23b56..cf151691ad 100644
--- a/src/3rdparty/freebsd/strtoull.c
+++ b/src/3rdparty/freebsd/strtoull.c
@@ -32,18 +32,6 @@
@@ -1,6 +1,4 @@
/*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -34,18 +32,6 @@
* SUCH DAMAGE.
*/
@ -104,7 +114,7 @@ index dc40e0e..1eb9257 100644
/*
* Convert a string to an unsigned long long integer.
*
@@ -51,15 +39,13 @@ __FBSDID("$FreeBSD$");
@@ -53,15 +39,13 @@ __FBSDID("$FreeBSD$");
* alphabets and digits are each contiguous.
*/
unsigned long long
@ -121,7 +131,7 @@ index dc40e0e..1eb9257 100644
/*
* See strtoq for comments as to the logic used.
@@ -67,7 +53,7 @@ strtoull_l(const char * __restrict nptr, char ** __restrict endptr, int base,
@@ -69,7 +53,7 @@ strtoull_l(const char * __restrict nptr, char ** __restrict endptr, int base,
s = nptr;
do {
c = *s++;
@ -130,12 +140,9 @@ index dc40e0e..1eb9257 100644
if (c == '-') {
neg = 1;
c = *s++;
@@ -119,13 +105,8 @@ strtoull_l(const char * __restrict nptr, char ** __restrict endptr, int base,
noconv:
errno = EINVAL;
@@ -123,11 +107,6 @@ noconv:
} else if (neg)
- acc = -acc;
+ acc = (unsigned long long) -(long long)acc;
acc = -acc;
if (endptr != NULL)
- *endptr = (char *)(any ? s - 1 : nptr);
+ *endptr = const_cast<char *>(any ? s - 1 : nptr);
@ -147,5 +154,5 @@ index dc40e0e..1eb9257 100644
- return strtoull_l(nptr, endptr, base, __get_locale());
-}
--
2.1.4
2.25.1

View File

@ -127,7 +127,7 @@ qt_strtoll(const char * nptr, char **endptr, int base)
noconv:
errno = EINVAL;
} else if (neg)
acc = (unsigned long long) -(long long)acc;
acc = -acc;
if (endptr != NULL)
*endptr = const_cast<char *>(any ? s - 1 : nptr);
return (acc);

View File

@ -105,7 +105,7 @@ qt_strtoull(const char * nptr, char **endptr, int base)
noconv:
errno = EINVAL;
} else if (neg)
acc = (unsigned long long) -(long long)acc;
acc = -acc;
if (endptr != NULL)
*endptr = const_cast<char *>(any ? s - 1 : nptr);
return (acc);

View File

@ -5,7 +5,6 @@ gcc: QMAKE_CFLAGS_WARN_ON += -Wno-unused-parameter -Wno-main
INCLUDEPATH += \
$$PWD/libjpeg \
$$PWD/libjpeg/src
SOURCES += \

View File

@ -14,7 +14,7 @@ libjpeg-turbo is covered by three compatible BSD-style open source licenses:
This license covers the TurboJPEG API library and associated programs, as
well as the build system.
- The zlib License, which is listed below
- The [zlib License](https://opensource.org/licenses/Zlib)
This license is a subset of the other two, and it covers the libjpeg-turbo
SIMD extensions.
@ -66,7 +66,7 @@ best of our understanding.
2. If your binary distribution includes or uses the TurboJPEG API, then
your product documentation must include the text of the Modified BSD
License.
License (see below.)
**Origin**
- Clause 2 of the Modified BSD License
@ -91,7 +91,8 @@ best of our understanding.
The Modified (3-clause) BSD License
===================================
Copyright (C)\<YEAR\> \<AUTHOR\>. All Rights Reserved.
Copyright (C)2009-2021 D. R. Commander. All Rights Reserved.<br>
Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
@ -118,28 +119,6 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
The zlib License
================
Copyright (C) \<YEAR\>, \<AUTHOR\>.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Why Three Licenses?
===================

34
src/3rdparty/libjpeg/ijg-license.txt vendored Normal file
View File

@ -0,0 +1,34 @@
The authors make NO WARRANTY or representation, either express or implied,
with respect to this software, its quality, accuracy, merchantability, or
fitness for a particular purpose. This software is provided "AS IS", and you,
its user, assume the entire risk as to its quality and accuracy.
This software is copyright (C) 1991-2020, Thomas G. Lane, Guido Vollbeding.
All Rights Reserved except as specified below.
Permission is hereby granted to use, copy, modify, and distribute this
software (or portions thereof) for any purpose, without fee, subject to these
conditions:
(1) If any part of the source code for this software is distributed, then this
README file must be included, with this copyright and no-warranty notice
unaltered; and any additions, deletions, or changes to the original files
must be clearly indicated in accompanying documentation.
(2) If only executable code is distributed, then the accompanying
documentation must state that "this software is based in part on the work of
the Independent JPEG Group".
(3) Permission for use of this software is granted only if the user accepts
full responsibility for any undesirable consequences; the authors accept
NO LIABILITY for damages of any kind.
These conditions apply to any software derived from or based on the IJG code,
not just to the unmodified library. If you use our work, you ought to
acknowledge us.
Permission is NOT granted for the use of any IJG author's name or company name
in advertising or publicity relating to this software or products derived from
it. This software may be referred to only as "the Independent JPEG Group's
software".
We specifically permit and encourage the use of this software as the basis of
commercial products, provided that all warranty or liability claims are
assumed by the product vendor.

View File

@ -126,6 +126,7 @@ FILES="
jdmaster.c
jdmaster.h
jdmerge.c
jdmerge.h
jdmrgext.c
jdmrg565.c
jdpostct.c
@ -164,4 +165,4 @@ for i in $FILES; do
copy_file "$i" "src/$i"
done
echo Done. $TARGET_DIR/jconfig.h and jconfigint.h may need manual updating.
echo Done. $TARGET_DIR/src/jconfig.h and jconfigint.h may need manual updating.

View File

@ -1,23 +0,0 @@
// Definitions for building in Qt source, ref. src/jconfig.h.in
#define JPEG_LIB_VERSION 80
#define LIBJPEG_TURBO_VERSION 2.0.0
#define LIBJPEG_TURBO_VERSION_NUMBER 2000000
#define C_ARITH_CODING_SUPPORTED
#define D_ARITH_CODING_SUPPORTED
#define MEM_SRCDST_SUPPORTED
#define BITS_IN_JSAMPLE 8
#define HAVE_STDDEF_H
#define HAVE_STDLIB_H
#define HAVE_UNSIGNED_CHAR
#define HAVE_UNSIGNED_SHORT

View File

@ -6,19 +6,20 @@
"Description": "The Independent JPEG Group's JPEG software",
"Homepage": "http://libjpeg-turbo.virtualgl.org/",
"Version": "2.0.0",
"License": "Independent JPEG Group License",
"LicenseId": "IJG",
"LicenseFile": "LICENSE",
"Copyright": "Copyright (C) 2009-2018 D. R. Commander
Copyright (C) 2011-2016 Siarhei Siamashka
"Version": "2.1.1",
"License": "Independent JPEG Group License and BSD 3-Clause \"New\" or \"Revised\" License and zlib License",
"LicenseId": "IJG AND BSD-3-Clause AND Zlib",
"LicenseFiles": [ "LICENSE", "ijg-license.txt", "zlib-license.txt"],
"Copyright": "Copyright (C) 2009-2021 D. R. Commander
Copyright (C) 2015, 2020 Google, Inc.
Copyright (C) 2019 Arm Limited
Copyright (C) 2015-2016, 2018 Matthieu Darbois
Copyright (C) 2011-2016 Siarhei Siamashka
Copyright (C) 2015 Intel Corporation
Copyright (C) 2015 Google, Inc.
Copyright (C) 2013-2014 Linaro Limited
Copyright (C) 2013-2014 MIPS Technologies, Inc.
Copyright (C) 2013 Linaro Limited
Copyright (C) 2009, 2012 Pierre Ossman for Cendio AB
Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)
Copyright (C) 2009 Pierre Ossman for Cendio AB
Copyright (C) 1999-2006 MIYASAKA Masaru
Copyright (C) 1991-2016 Thomas G. Lane, Guido Vollbeding"
Copyright (C) 1991-2017 Thomas G. Lane, Guido Vollbeding"
}

View File

@ -1,3 +1,441 @@
2.1.1
=====
### Significant changes relative to 2.1.0
1. Fixed a regression introduced in 2.1.0 that caused build failures with
non-GCC-compatible compilers for Un*x/Arm platforms.
2. Fixed a regression introduced by 2.1 beta1[13] that prevented the Arm 32-bit
(AArch32) Neon SIMD extensions from building unless the C compiler flags
included `-mfloat-abi=softfp` or `-mfloat-abi=hard`.
3. Fixed an issue in the AArch32 Neon SIMD Huffman encoder whereby reliance on
undefined C compiler behavior led to crashes ("SIGBUS: illegal alignment") on
Android systems when running AArch32/Thumb builds of libjpeg-turbo built with
recent versions of Clang.
4. Added a command-line argument (`-copy icc`) to jpegtran that causes it to
copy only the ICC profile markers from the source file and discard any other
metadata.
5. libjpeg-turbo should now build and run on CHERI-enabled architectures, which
use capability pointers that are larger than the size of `size_t`.
6. Fixed a regression introduced by 2.1 beta1[5] that caused a segfault in the
64-bit SSE2 Huffman encoder when attempting to losslessly transform a
specially-crafted malformed JPEG image.
2.1.0
=====
### Significant changes relative to 2.1 beta1
1. Fixed a regression introduced by 2.1 beta1[6(b)] whereby attempting to
decompress certain progressive JPEG images with one or more component planes of
width 8 or less caused a buffer overrun.
2. Fixed a regression introduced by 2.1 beta1[6(b)] whereby attempting to
decompress a specially-crafted malformed progressive JPEG image caused the
block smoothing algorithm to read from uninitialized memory.
3. Fixed an issue in the Arm Neon SIMD Huffman encoders that caused the
encoders to generate incorrect results when using the Clang compiler with
Visual Studio.
4. Fixed a floating point exception (CVE-2021-20205) that occurred when
attempting to compress a specially-crafted malformed GIF image with a specified
image width of 0 using cjpeg.
5. Fixed a regression introduced by 2.0 beta1[15] whereby attempting to
generate a progressive JPEG image on an SSE2-capable CPU using a scan script
containing one or more scans with lengths divisible by 32 and non-zero
successive approximation low bit positions would, under certain circumstances,
result in an error ("Missing Huffman code table entry") and an invalid JPEG
image.
6. Introduced a new flag (`TJFLAG_LIMITSCANS` in the TurboJPEG C API and
`TJ.FLAG_LIMIT_SCANS` in the TurboJPEG Java API) and a corresponding TJBench
command-line argument (`-limitscans`) that causes the TurboJPEG decompression
and transform functions/operations to return/throw an error if a progressive
JPEG image contains an unreasonably large number of scans. This allows
applications that use the TurboJPEG API to guard against an exploit of the
progressive JPEG format described in the report
["Two Issues with the JPEG Standard"](https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf).
7. The PPM reader now throws an error, rather than segfaulting (due to a buffer
overrun) or generating incorrect pixels, if an application attempts to use the
`tjLoadImage()` function to load a 16-bit binary PPM file (a binary PPM file
with a maximum value greater than 255) into a grayscale image buffer or to load
a 16-bit binary PGM file into an RGB image buffer.
8. Fixed an issue in the PPM reader that caused incorrect pixels to be
generated when using the `tjLoadImage()` function to load a 16-bit binary PPM
file into an extended RGB image buffer.
9. Fixed an issue whereby, if a JPEG buffer was automatically re-allocated by
one of the TurboJPEG compression or transform functions and an error
subsequently occurred during compression or transformation, the JPEG buffer
pointer passed by the application was not updated when the function returned.
2.0.90 (2.1 beta1)
==================
### Significant changes relative to 2.0.6:
1. The build system, x86-64 SIMD extensions, and accelerated Huffman codec now
support the x32 ABI on Linux, which allows for using x86-64 instructions with
32-bit pointers. The x32 ABI is generally enabled by adding `-mx32` to the
compiler flags.
Caveats:
- CMake 3.9.0 or later is required in order for the build system to
automatically detect an x32 build.
- Java does not support the x32 ABI, and thus the TurboJPEG Java API will
automatically be disabled with x32 builds.
2. Added Loongson MMI SIMD implementations of the RGB-to-grayscale, 4:2:2 fancy
chroma upsampling, 4:2:2 and 4:2:0 merged chroma upsampling/color conversion,
and fast integer DCT/IDCT algorithms. Relative to libjpeg-turbo 2.0.x, this
speeds up:
- the compression of RGB source images into grayscale JPEG images by
approximately 20%
- the decompression of 4:2:2 JPEG images by approximately 40-60% when
using fancy upsampling
- the decompression of 4:2:2 and 4:2:0 JPEG images by approximately
15-20% when using merged upsampling
- the compression of RGB source images by approximately 30-45% when using
the fast integer DCT
- the decompression of JPEG images into RGB destination images by
approximately 2x when using the fast integer IDCT
The overall decompression speedup for RGB images is now approximately
2.3-3.7x (compared to 2-3.5x with libjpeg-turbo 2.0.x.)
3. 32-bit (Armv7 or Armv7s) iOS builds of libjpeg-turbo are no longer
supported, and the libjpeg-turbo build system can no longer be used to package
such builds. 32-bit iOS apps cannot run in iOS 11 and later, and the App Store
no longer allows them.
4. 32-bit (i386) OS X/macOS builds of libjpeg-turbo are no longer supported,
and the libjpeg-turbo build system can no longer be used to package such
builds. 32-bit Mac applications cannot run in macOS 10.15 "Catalina" and
later, and the App Store no longer allows them.
5. The SSE2 (x86 SIMD) and C Huffman encoding algorithms have been
significantly optimized, resulting in a measured average overall compression
speedup of 12-28% for 64-bit code and 22-52% for 32-bit code on various Intel
and AMD CPUs, as well as a measured average overall compression speedup of
0-23% on platforms that do not have a SIMD-accelerated Huffman encoding
implementation.
6. The block smoothing algorithm that is applied by default when decompressing
progressive Huffman-encoded JPEG images has been improved in the following
ways:
- The algorithm is now more fault-tolerant. Previously, if a particular
scan was incomplete, then the smoothing parameters for the incomplete scan
would be applied to the entire output image, including the parts of the image
that were generated by the prior (complete) scan. Visually, this had the
effect of removing block smoothing from lower-frequency scans if they were
followed by an incomplete higher-frequency scan. libjpeg-turbo now applies
block smoothing parameters to each iMCU row based on which scan generated the
pixels in that row, rather than always using the block smoothing parameters for
the most recent scan.
- When applying block smoothing to DC scans, a Gaussian-like kernel with a
5x5 window is used to reduce the "blocky" appearance.
7. Added SIMD acceleration for progressive Huffman encoding on Arm platforms.
This speeds up the compression of full-color progressive JPEGs by about 30-40%
on average (relative to libjpeg-turbo 2.0.x) when using modern Arm CPUs.
8. Added configure-time and run-time auto-detection of Loongson MMI SIMD
instructions, so that the Loongson MMI SIMD extensions can be included in any
MIPS64 libjpeg-turbo build.
9. Added fault tolerance features to djpeg and jpegtran, mainly to demonstrate
methods by which applications can guard against the exploits of the JPEG format
described in the report
["Two Issues with the JPEG Standard"](https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf).
- Both programs now accept a `-maxscans` argument, which can be used to
limit the number of allowable scans in the input file.
- Both programs now accept a `-strict` argument, which can be used to
treat all warnings as fatal.
10. CMake package config files are now included for both the libjpeg and
TurboJPEG API libraries. This facilitates using libjpeg-turbo with CMake's
`find_package()` function. For example:
find_package(libjpeg-turbo CONFIG REQUIRED)
add_executable(libjpeg_program libjpeg_program.c)
target_link_libraries(libjpeg_program PUBLIC libjpeg-turbo::jpeg)
add_executable(libjpeg_program_static libjpeg_program.c)
target_link_libraries(libjpeg_program_static PUBLIC
libjpeg-turbo::jpeg-static)
add_executable(turbojpeg_program turbojpeg_program.c)
target_link_libraries(turbojpeg_program PUBLIC
libjpeg-turbo::turbojpeg)
add_executable(turbojpeg_program_static turbojpeg_program.c)
target_link_libraries(turbojpeg_program_static PUBLIC
libjpeg-turbo::turbojpeg-static)
11. Since the Unisys LZW patent has long expired, cjpeg and djpeg can now
read/write both LZW-compressed and uncompressed GIF files (feature ported from
jpeg-6a and jpeg-9d.)
12. jpegtran now includes the `-wipe` and `-drop` options from jpeg-9a and
jpeg-9d, as well as the ability to expand the image size using the `-crop`
option. Refer to jpegtran.1 or usage.txt for more details.
13. Added a complete intrinsics implementation of the Arm Neon SIMD extensions,
thus providing SIMD acceleration on Arm platforms for all of the algorithms
that are SIMD-accelerated on x86 platforms. This new implementation is
significantly faster in some cases than the old GAS implementation--
depending on the algorithms used, the type of CPU core, and the compiler. GCC,
as of this writing, does not provide a full or optimal set of Neon intrinsics,
so for performance reasons, the default when building libjpeg-turbo with GCC is
to continue using the GAS implementation of the following algorithms:
- 32-bit RGB-to-YCbCr color conversion
- 32-bit fast and accurate inverse DCT
- 64-bit RGB-to-YCbCr and YCbCr-to-RGB color conversion
- 64-bit accurate forward and inverse DCT
- 64-bit Huffman encoding
A new CMake variable (`NEON_INTRINSICS`) can be used to override this
default.
Since the new intrinsics implementation includes SIMD acceleration
for merged upsampling/color conversion, 1.5.1[5] is no longer necessary and has
been reverted.
14. The Arm Neon SIMD extensions can now be built using Visual Studio.
15. The build system can now be used to generate a universal x86-64 + Armv8
libjpeg-turbo SDK package for both iOS and macOS.
2.0.6
=====
### Significant changes relative to 2.0.5:
1. Fixed "using JNI after critical get" errors that occurred on Android
platforms when using any of the YUV encoding/compression/decompression/decoding
methods in the TurboJPEG Java API.
2. Fixed or worked around multiple issues with `jpeg_skip_scanlines()`:
- Fixed segfaults or "Corrupt JPEG data: premature end of data segment"
errors in `jpeg_skip_scanlines()` that occurred when decompressing 4:2:2 or
4:2:0 JPEG images using merged (non-fancy) upsampling/color conversion (that
is, when setting `cinfo.do_fancy_upsampling` to `FALSE`.) 2.0.0[6] was a
similar fix, but it did not cover all cases.
- `jpeg_skip_scanlines()` now throws an error if two-pass color
quantization is enabled. Two-pass color quantization never worked properly
with `jpeg_skip_scanlines()`, and the issues could not readily be fixed.
- Fixed an issue whereby `jpeg_skip_scanlines()` always returned 0 when
skipping past the end of an image.
3. The Arm 64-bit (Armv8) Neon SIMD extensions can now be built using MinGW
toolchains targetting Arm64 (AArch64) Windows binaries.
4. Fixed unexpected visual artifacts that occurred when using
`jpeg_crop_scanline()` and interblock smoothing while decompressing only the DC
scan of a progressive JPEG image.
5. Fixed an issue whereby libjpeg-turbo would not build if 12-bit-per-component
JPEG support (`WITH_12BIT`) was enabled along with libjpeg v7 or libjpeg v8
API/ABI emulation (`WITH_JPEG7` or `WITH_JPEG8`.)
2.0.5
=====
### Significant changes relative to 2.0.4:
1. Worked around issues in the MIPS DSPr2 SIMD extensions that caused failures
in the libjpeg-turbo regression tests. Specifically, the
`jsimd_h2v1_downsample_dspr2()` and `jsimd_h2v2_downsample_dspr2()` functions
in the MIPS DSPr2 SIMD extensions are now disabled until/unless they can be
fixed, and other functions that are incompatible with big endian MIPS CPUs are
disabled when building libjpeg-turbo for such CPUs.
2. Fixed an oversight in the `TJCompressor.compress(int)` method in the
TurboJPEG Java API that caused an error ("java.lang.IllegalStateException: No
source image is associated with this instance") when attempting to use that
method to compress a YUV image.
3. Fixed an issue (CVE-2020-13790) in the PPM reader that caused a buffer
overrun in cjpeg, TJBench, or the `tjLoadImage()` function if one of the values
in a binary PPM/PGM input file exceeded the maximum value defined in the file's
header and that maximum value was less than 255. libjpeg-turbo 1.5.0 already
included a similar fix for binary PPM/PGM files with maximum values greater
than 255.
4. The TurboJPEG API library's global error handler, which is used in functions
such as `tjBufSize()` and `tjLoadImage()` that do not require a TurboJPEG
instance handle, is now thread-safe on platforms that support thread-local
storage.
2.0.4
=====
### Significant changes relative to 2.0.3:
1. Fixed a regression in the Windows packaging system (introduced by
2.0 beta1[2]) whereby, if both the 64-bit libjpeg-turbo SDK for GCC and the
64-bit libjpeg-turbo SDK for Visual C++ were installed on the same system, only
one of them could be uninstalled.
2. Fixed a signed integer overflow and subsequent segfault that occurred when
attempting to decompress images with more than 715827882 pixels using the
64-bit C version of TJBench.
3. Fixed out-of-bounds write in `tjDecompressToYUV2()` and
`tjDecompressToYUVPlanes()` (sometimes manifesting as a double free) that
occurred when attempting to decompress grayscale JPEG images that were
compressed with a sampling factor other than 1 (for instance, with
`cjpeg -grayscale -sample 2x2`).
4. Fixed a regression introduced by 2.0.2[5] that caused the TurboJPEG API to
incorrectly identify some JPEG images with unusual sampling factors as 4:4:4
JPEG images. This was known to cause a buffer overflow when attempting to
decompress some such images using `tjDecompressToYUV2()` or
`tjDecompressToYUVPlanes()`.
5. Fixed an issue (CVE-2020-17541), detected by ASan, whereby attempting to
losslessly transform a specially-crafted malformed JPEG image containing an
extremely-high-frequency coefficient block (junk image data that could never be
generated by a legitimate JPEG compressor) could cause the Huffman encoder's
local buffer to be overrun. (Refer to 1.4.0[9] and 1.4beta1[15].) Given that
the buffer overrun was fully contained within the stack and did not cause a
segfault or other user-visible errant behavior, and given that the lossless
transformer (unlike the decompressor) is not generally exposed to arbitrary
data exploits, this issue did not likely pose a security risk.
6. The Arm 64-bit (Armv8) Neon SIMD assembly code now stores constants in a
separate read-only data section rather than in the text section, to support
execute-only memory layouts.
2.0.3
=====
### Significant changes relative to 2.0.2:
1. Fixed "using JNI after critical get" errors that occurred on Android
platforms when passing invalid arguments to certain methods in the TurboJPEG
Java API.
2. Fixed a regression in the SIMD feature detection code, introduced by
the AVX2 SIMD extensions (2.0 beta1[1]), that was known to cause an illegal
instruction exception, in rare cases, on CPUs that lack support for CPUID leaf
07H (or on which the maximum CPUID leaf has been limited by way of a BIOS
setting.)
3. The 4:4:0 (h1v2) fancy (smooth) chroma upsampling algorithm in the
decompressor now uses a similar bias pattern to that of the 4:2:2 (h2v1) fancy
chroma upsampling algorithm, rounding up or down the upsampled result for
alternate pixels rather than always rounding down. This ensures that,
regardless of whether a 4:2:2 JPEG image is rotated or transposed prior to
decompression (in the frequency domain) or after decompression (in the spatial
domain), the final image will be similar.
4. Fixed an integer overflow and subsequent segfault that occurred when
attempting to compress or decompress images with more than 1 billion pixels
using the TurboJPEG API.
5. Fixed a regression introduced by 2.0 beta1[15] whereby attempting to
generate a progressive JPEG image on an SSE2-capable CPU using a scan script
containing one or more scans with lengths divisible by 16 would result in an
error ("Missing Huffman code table entry") and an invalid JPEG image.
6. Fixed an issue whereby `tjDecodeYUV()` and `tjDecodeYUVPlanes()` would throw
an error ("Invalid progressive parameters") or a warning ("Inconsistent
progression sequence") if passed a TurboJPEG instance that was previously used
to decompress a progressive JPEG image.
2.0.2
=====
### Significant changes relative to 2.0.1:
1. Fixed a regression introduced by 2.0.1[5] that prevented a runtime search
path (rpath) from being embedded in the libjpeg-turbo shared libraries and
executables for macOS and iOS. This caused a fatal error of the form
"dyld: Library not loaded" when attempting to use one of the executables,
unless `DYLD_LIBRARY_PATH` was explicitly set to the location of the
libjpeg-turbo shared libraries.
2. Fixed an integer overflow and subsequent segfault (CVE-2018-20330) that
occurred when attempting to load a BMP file with more than 1 billion pixels
using the `tjLoadImage()` function.
3. Fixed a buffer overrun (CVE-2018-19664) that occurred when attempting to
decompress a specially-crafted malformed JPEG image to a 256-color BMP using
djpeg.
4. Fixed a floating point exception that occurred when attempting to
decompress a specially-crafted malformed JPEG image with a specified image
width or height of 0 using the C version of TJBench.
5. The TurboJPEG API will now decompress 4:4:4 JPEG images with 2x1, 1x2, 3x1,
or 1x3 luminance and chrominance sampling factors. This is a non-standard way
of specifying 1x subsampling (normally 4:4:4 JPEGs have 1x1 luminance and
chrominance sampling factors), but the JPEG format and the libjpeg API both
allow it.
6. Fixed a regression introduced by 2.0 beta1[7] that caused djpeg to generate
incorrect PPM images when used with the `-colors` option.
7. Fixed an issue whereby a static build of libjpeg-turbo (a build in which
`ENABLE_SHARED` is `0`) could not be installed using the Visual Studio IDE.
8. Fixed a severe performance issue in the Loongson MMI SIMD extensions that
occurred when compressing RGB images whose image rows were not 64-bit-aligned.
2.0.1
=====
### Significant changes relative to 2.0.0:
1. Fixed a regression introduced with the new CMake-based Un*x build system,
whereby jconfig.h could cause compiler warnings of the form
`"HAVE_*_H" redefined` if it was included by downstream Autotools-based
projects that used `AC_CHECK_HEADERS()` to check for the existence of locale.h,
stddef.h, or stdlib.h.
2. The `jsimd_quantize_float_dspr2()` and `jsimd_convsamp_float_dspr2()`
functions in the MIPS DSPr2 SIMD extensions are now disabled at compile time
if the soft float ABI is enabled. Those functions use instructions that are
incompatible with the soft float ABI.
3. Fixed a regression in the SIMD feature detection code, introduced by
the AVX2 SIMD extensions (2.0 beta1[1]), that caused libjpeg-turbo to crash on
Windows 7 if Service Pack 1 was not installed.
4. Fixed out-of-bounds read in cjpeg that occurred when attempting to compress
a specially-crafted malformed color-index (8-bit-per-sample) Targa file in
which some of the samples (color indices) exceeded the bounds of the Targa
file's color table.
5. Fixed an issue whereby installing a fully static build of libjpeg-turbo
(a build in which `CFLAGS` contains `-static` and `ENABLE_SHARED` is `0`) would
fail with "No valid ELF RPATH or RUNPATH entry exists in the file."
2.0.0
=====
@ -30,10 +468,11 @@ would produce a "Bogus message code" error message if the underlying bitmap and
PPM readers/writers threw an error that was specific to the readers/writers
(as opposed to a general libjpeg API error.)
4. Fixed an issue whereby a specially-crafted malformed BMP file, one in which
the header specified an image width of 1073741824 pixels, would trigger a
floating point exception (division by zero) in the `tjLoadImage()` function
when attempting to load the BMP file into a 4-component image buffer.
4. Fixed an issue (CVE-2018-1152) whereby a specially-crafted malformed BMP
file, one in which the header specified an image width of 1073741824 pixels,
would trigger a floating point exception (division by zero) in the
`tjLoadImage()` function when attempting to load the BMP file into a
4-component image buffer.
5. Fixed an issue whereby certain combinations of calls to
`jpeg_skip_scanlines()` and `jpeg_read_scanlines()` could trigger an infinite
@ -47,10 +486,10 @@ a 4:2:2 or 4:2:0 JPEG image using the merged (non-fancy) upsampling algorithms
7. The new CMake-based build system will now disable the MIPS DSPr2 SIMD
extensions if it detects that the compiler does not support DSPr2 instructions.
8. Fixed out-of-bounds read in cjpeg that occurred when attempting to compress
a specially-crafted malformed color-index (8-bit-per-sample) BMP file in which
some of the samples (color indices) exceeded the bounds of the BMP file's color
table.
8. Fixed out-of-bounds read in cjpeg (CVE-2018-14498) that occurred when
attempting to compress a specially-crafted malformed color-index
(8-bit-per-sample) BMP file in which some of the samples (color indices)
exceeded the bounds of the BMP file's color table.
9. Fixed a signed integer overflow in the progressive Huffman decoder, detected
by the Clang and GCC undefined behavior sanitizers, that could be triggered by
@ -66,7 +505,7 @@ detect actual security issues, should they arise in the future.
1. Added AVX2 SIMD implementations of the colorspace conversion, chroma
downsampling and upsampling, integer quantization and sample conversion, and
slow integer DCT/IDCT algorithms. When using the slow integer DCT/IDCT
accurate integer DCT/IDCT algorithms. When using the accurate integer DCT/IDCT
algorithms on AVX2-equipped CPUs, the compression of RGB images is
approximately 13-36% (avg. 22%) faster (relative to libjpeg-turbo 1.5.x) with
64-bit code and 11-21% (avg. 17%) faster with 32-bit code, and the
@ -170,16 +609,16 @@ algorithm that caused incorrect dithering in the output image. This algorithm
now produces bitwise-identical results to the unmerged algorithms.
12. The SIMD function symbols for x86[-64]/ELF, MIPS/ELF, macOS/x86[-64] (if
libjpeg-turbo is built with YASM), and iOS/ARM[64] builds are now private.
libjpeg-turbo is built with YASM), and iOS/Arm[64] builds are now private.
This prevents those symbols from being exposed in applications or shared
libraries that link statically with libjpeg-turbo.
13. Added Loongson MMI SIMD implementations of the RGB-to-YCbCr and
YCbCr-to-RGB colorspace conversion, 4:2:0 chroma downsampling, 4:2:0 fancy
chroma upsampling, integer quantization, and slow integer DCT/IDCT algorithms.
When using the slow integer DCT/IDCT, this speeds up the compression of RGB
images by approximately 70-100% and the decompression of RGB images by
approximately 2-3.5x.
chroma upsampling, integer quantization, and accurate integer DCT/IDCT
algorithms. When using the accurate integer DCT/IDCT, this speeds up the
compression of RGB images by approximately 70-100% and the decompression of RGB
images by approximately 2-3.5x.
14. Fixed a build error when building with older MinGW releases (regression
caused by 1.5.1[7].)
@ -210,8 +649,8 @@ write scanlines in bottom-up order.) djpeg will now exit gracefully if an
output format other than PPM/PGM, GIF, or Targa is selected along with the
`-crop` option.
4. Fixed an issue whereby `jpeg_skip_scanlines()` would segfault if color
quantization was enabled.
4. Fixed an issue (CVE-2017-15232) whereby `jpeg_skip_scanlines()` would
segfault if color quantization was enabled.
5. TJBench (both C and Java versions) will now display usage information if any
command-line argument is unrecognized. This prevents the program from silently
@ -229,9 +668,9 @@ end of a single-scan (non-progressive) image, subsequent calls to
`jpeg_consume_input()` would return `JPEG_SUSPENDED` rather than
`JPEG_REACHED_EOI`.
9. `jpeg_crop_scanlines()` now works correctly when decompressing grayscale
JPEG images that were compressed with a sampling factor other than 1 (for
instance, with `cjpeg -grayscale -sample 2x2`).
9. `jpeg_crop_scanline()` now works correctly when decompressing grayscale JPEG
images that were compressed with a sampling factor other than 1 (for instance,
with `cjpeg -grayscale -sample 2x2`).
1.5.2
@ -255,7 +694,7 @@ on PowerPC-based AmigaOS 4 and OpenBSD systems.
5. Fixed build and runtime errors on Windows that occurred when building
libjpeg-turbo with libjpeg v7 API/ABI emulation and the in-memory
source/destination managers. Due to an oversight, the `jpeg_skip_scanlines()`
and `jpeg_crop_scanlines()` functions were not being included in jpeg7.dll when
and `jpeg_crop_scanline()` functions were not being included in jpeg7.dll when
libjpeg-turbo was built with `-DWITH_JPEG7=1` and `-DWITH_MEMSRCDST=1`.
6. Fixed "Bogus virtual array access" error that occurred when using the
@ -412,10 +851,10 @@ application was linked against.
3. Fixed a couple of issues in the PPM reader that would cause buffer overruns
in cjpeg if one of the values in a binary PPM/PGM input file exceeded the
maximum value defined in the file's header. libjpeg-turbo 1.4.2 already
included a similar fix for ASCII PPM/PGM files. Note that these issues were
not security bugs, since they were confined to the cjpeg program and did not
affect any of the libjpeg-turbo libraries.
maximum value defined in the file's header and that maximum value was greater
than 255. libjpeg-turbo 1.4.2 already included a similar fix for ASCII PPM/PGM
files. Note that these issues were not security bugs, since they were confined
to the cjpeg program and did not affect any of the libjpeg-turbo libraries.
4. Fixed an issue whereby attempting to decompress a JPEG file with a corrupt
header using the `tjDecompressToYUV2()` function would cause the function to
@ -511,8 +950,8 @@ benchmarking or regression testing, SIMD-accelerated Huffman encoding can be
disabled by setting the `JSIMD_NOHUFFENC` environment variable to `1`.
13. Added ARM 64-bit (ARMv8) NEON SIMD implementations of the commonly-used
compression algorithms (including the slow integer forward DCT and h2v2 & h2v1
downsampling algorithms, which are not accelerated in the 32-bit NEON
compression algorithms (including the accurate integer forward DCT and h2v2 &
h2v1 downsampling algorithms, which are not accelerated in the 32-bit NEON
implementation.) This speeds up the compression of full-color JPEGs by about
75% on average on a Cavium ThunderX processor and by about 2-2.5x on average on
Cortex-A53 and Cortex-A57 cores.
@ -643,8 +1082,8 @@ platforms other than Windows or Linux. Oops.
7. Fixed an extremely rare bug in the Huffman encoder that caused 64-bit
builds of libjpeg-turbo to incorrectly encode a few specific test images when
quality=98, an optimized Huffman table, and the slow integer forward DCT were
used.
quality=98, an optimized Huffman table, and the accurate integer forward DCT
were used.
8. The Windows (CMake) build system now supports building only static or only
shared libraries. This is accomplished by adding either `-DENABLE_STATIC=0` or
@ -803,8 +1242,8 @@ floating point inverse DCT (using code borrowed from libjpeg v8a and later.)
The accuracy of this implementation now matches the accuracy of the SSE/SSE2
implementation. Note, however, that the floating point DCT/IDCT algorithms are
mainly a legacy feature. They generally do not produce significantly better
accuracy than the slow integer DCT/IDCT algorithms, and they are quite a bit
slower.
accuracy than the accurate integer DCT/IDCT algorithms, and they are quite a
bit slower.
8. Added a new output colorspace (`JCS_RGB565`) to the libjpeg API that allows
for decompressing JPEG images into RGB565 (16-bit) pixels. If dithering is not
@ -838,13 +1277,13 @@ and IDCT algorithms (both are used during JPEG decompression.) For unknown
reasons (probably related to clang), this code cannot currently be compiled for
iOS.
15. Fixed an extremely rare bug that could cause the Huffman encoder's local
buffer to overrun when a very high-frequency MCU is compressed using quality
100 and no subsampling, and when the JPEG output buffer is being dynamically
resized by the destination manager. This issue was so rare that, even with a
test program specifically designed to make the bug occur (by injecting random
high-frequency YUV data into the compressor), it was reproducible only once in
about every 25 million iterations.
15. Fixed an extremely rare bug (CVE-2014-9092) that could cause the Huffman
encoder's local buffer to overrun when a very high-frequency MCU is compressed
using quality 100 and no subsampling, and when the JPEG output buffer is being
dynamically resized by the destination manager. This issue was so rare that,
even with a test program specifically designed to make the bug occur (by
injecting random high-frequency YUV data into the compressor), it was
reproducible only once in about every 25 million iterations.
16. Fixed an oversight in the TurboJPEG C wrapper: if any of the JPEG
compression functions was called repeatedly with the same
@ -879,8 +1318,9 @@ entropy coding (by passing arguments of `-progressive -arithmetic` to cjpeg or
jpegtran, for instance) would result in an error, `Requested feature was
omitted at compile time`.
4. Fixed a couple of issues whereby malformed JPEG images would cause
libjpeg-turbo to use uninitialized memory during decompression.
4. Fixed a couple of issues (CVE-2013-6629 and CVE-2013-6630) whereby malformed
JPEG images would cause libjpeg-turbo to use uninitialized memory during
decompression.
5. Fixed an error (`Buffer passed to JPEG library is too small`) that occurred
when calling the TurboJPEG YUV encoding function with a very small (< 5x5)
@ -1019,9 +1459,9 @@ correct behavior of the colorspace extensions when merged upsampling is used.
upper 64 bits of xmm6 and xmm7 on Win64 platforms, which violated the Win64
calling conventions.
4. Fixed a regression caused by 1.2.0[6] whereby decompressing corrupt JPEG
images (specifically, images in which the component count was erroneously set
to a large value) would cause libjpeg-turbo to segfault.
4. Fixed a regression (CVE-2012-2806) caused by 1.2.0[6] whereby decompressing
corrupt JPEG images (specifically, images in which the component count was
erroneously set to a large value) would cause libjpeg-turbo to segfault.
5. Worked around a severe performance issue with "Bobcat" (AMD Embedded APU)
processors. The `MASKMOVDQU` instruction, which was used by the libjpeg-turbo
@ -1213,8 +1653,8 @@ cases.
2. Despite the above, the fast integer forward DCT still degrades somewhat for
JPEG qualities greater than 95, so the TurboJPEG wrapper will now automatically
use the slow integer forward DCT when generating JPEG images of quality 96 or
greater. This reduces compression performance by as much as 15% for these
use the accurate integer forward DCT when generating JPEG images of quality 96
or greater. This reduces compression performance by as much as 15% for these
high-quality images but is necessary to ensure that the images are perceptually
lossless. It also ensures that the library can avoid the performance pitfall
created by [1].

View File

@ -128,7 +128,7 @@ with respect to this software, its quality, accuracy, merchantability, or
fitness for a particular purpose. This software is provided "AS IS", and you,
its user, assume the entire risk as to its quality and accuracy.
This software is copyright (C) 1991-2016, Thomas G. Lane, Guido Vollbeding.
This software is copyright (C) 1991-2020, Thomas G. Lane, Guido Vollbeding.
All Rights Reserved except as specified below.
Permission is hereby granted to use, copy, modify, and distribute this
@ -159,19 +159,6 @@ commercial products, provided that all warranty or liability claims are
assumed by the product vendor.
The IJG distribution formerly included code to read and write GIF files.
To avoid entanglement with the Unisys LZW patent (now expired), GIF reading
support has been removed altogether, and the GIF writer has been simplified
to produce "uncompressed GIFs". This technique does not use the LZW
algorithm; the resulting GIF files are larger than usual, but are readable
by all standard GIF decoders.
We are required to state that
"The Graphics Interchange Format(c) is the Copyright property of
CompuServe Incorporated. GIF(sm) is a Service Mark property of
CompuServe Incorporated."
REFERENCES
==========
@ -223,12 +210,12 @@ https://www.iso.org/standard/54989.html and http://www.itu.int/rec/T-REC-T.871.
A PDF file of the older JFIF 1.02 specification is available at
http://www.w3.org/Graphics/JPEG/jfif3.pdf.
The TIFF 6.0 file format specification can be obtained by FTP from
ftp://ftp.sgi.com/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation scheme
found in the TIFF 6.0 spec of 3-June-92 has a number of serious problems.
IJG does not recommend use of the TIFF 6.0 design (TIFF Compression tag 6).
Instead, we recommend the JPEG design proposed by TIFF Technical Note #2
(Compression tag 7). Copies of this Note can be obtained from
The TIFF 6.0 file format specification can be obtained from
http://mirrors.ctan.org/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation
scheme found in the TIFF 6.0 spec of 3-June-92 has a number of serious
problems. IJG does not recommend use of the TIFF 6.0 design (TIFF Compression
tag 6). Instead, we recommend the JPEG design proposed by TIFF Technical Note
#2 (Compression tag 7). Copies of this Note can be obtained from
http://www.ijg.org/files/. It is expected that the next revision
of the TIFF spec will replace the 6.0 JPEG design with the Note's design.
Although IJG's own code does not support TIFF/JPEG, the free libtiff library
@ -243,14 +230,8 @@ The most recent released version can always be found there in
directory "files".
The JPEG FAQ (Frequently Asked Questions) article is a source of some
general information about JPEG.
It is available on the World Wide Web at http://www.faqs.org/faqs/jpeg-faq/
and other news.answers archive sites, including the official news.answers
archive at rtfm.mit.edu: ftp://rtfm.mit.edu/pub/usenet/news.answers/jpeg-faq/.
If you don't have Web or FTP access, send e-mail to mail-server@rtfm.mit.edu
with body
send usenet/news.answers/jpeg-faq/part1
send usenet/news.answers/jpeg-faq/part2
general information about JPEG. It is available at
http://www.faqs.org/faqs/jpeg-faq.
FILE FORMAT COMPATIBILITY

View File

@ -1,14 +1,14 @@
Background
==========
libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2,
AVX2, NEON, AltiVec) to accelerate baseline JPEG compression and decompression
on x86, x86-64, ARM, and PowerPC systems, as well as progressive JPEG
compression on x86 and x86-64 systems. On such systems, libjpeg-turbo is
generally 2-6x as fast as libjpeg, all else being equal. On other types of
systems, libjpeg-turbo can still outperform libjpeg by a significant amount, by
virtue of its highly-optimized Huffman coding routines. In many cases, the
performance of libjpeg-turbo rivals that of proprietary high-speed JPEG codecs.
libjpeg-turbo is a JPEG image codec that uses SIMD instructions to accelerate
baseline JPEG compression and decompression on x86, x86-64, Arm, PowerPC, and
MIPS systems, as well as progressive JPEG compression on x86, x86-64, and Arm
systems. On such systems, libjpeg-turbo is generally 2-6x as fast as libjpeg,
all else being equal. On other types of systems, libjpeg-turbo can still
outperform libjpeg by a significant amount, by virtue of its highly-optimized
Huffman coding routines. In many cases, the performance of libjpeg-turbo
rivals that of proprietary high-speed JPEG codecs.
libjpeg-turbo implements both the traditional libjpeg API as well as the less
powerful but more straightforward TurboJPEG API. libjpeg-turbo also features
@ -135,25 +135,24 @@ without recompiling. libjpeg-turbo does not claim to support all of the
libjpeg v7+ features, nor to produce identical output to libjpeg v7+ in all
cases (see below.)
By passing an argument of `--with-jpeg7` or `--with-jpeg8` to `configure`, or
an argument of `-DWITH_JPEG7=1` or `-DWITH_JPEG8=1` to `cmake`, you can build a
version of libjpeg-turbo that emulates the libjpeg v7 or v8 ABI, so that
programs that are built against libjpeg v7 or v8 can be run with libjpeg-turbo.
The following section describes which libjpeg v7+ features are supported and
which aren't.
By passing an argument of `-DWITH_JPEG7=1` or `-DWITH_JPEG8=1` to `cmake`, you
can build a version of libjpeg-turbo that emulates the libjpeg v7 or v8 ABI, so
that programs that are built against libjpeg v7 or v8 can be run with
libjpeg-turbo. The following section describes which libjpeg v7+ features are
supported and which aren't.
### Support for libjpeg v7 and v8 Features
#### Fully supported
- **libjpeg: IDCT scaling extensions in decompressor**<br>
- **libjpeg API: IDCT scaling extensions in decompressor**<br>
libjpeg-turbo supports IDCT scaling with scaling factors of 1/8, 1/4, 3/8,
1/2, 5/8, 3/4, 7/8, 9/8, 5/4, 11/8, 3/2, 13/8, 7/4, 15/8, and 2/1 (only 1/4
and 1/2 are SIMD-accelerated.)
- **libjpeg: Arithmetic coding**
- **libjpeg API: Arithmetic coding**
- **libjpeg: In-memory source and destination managers**<br>
- **libjpeg API: In-memory source and destination managers**<br>
See notes below.
- **cjpeg: Separate quality settings for luminance and chrominance**<br>
@ -180,19 +179,19 @@ which aren't.
NOTE: As of this writing, extensive research has been conducted into the
usefulness of DCT scaling as a means of data reduction and SmartScale as a
means of quality improvement. The reader is invited to peruse the research at
<http://www.libjpeg-turbo.org/About/SmartScale> and draw his/her own conclusions,
means of quality improvement. Readers are invited to peruse the research at
<http://www.libjpeg-turbo.org/About/SmartScale> and draw their own conclusions,
but it is the general belief of our project that these features have not
demonstrated sufficient usefulness to justify inclusion in libjpeg-turbo.
- **libjpeg: DCT scaling in compressor**<br>
- **libjpeg API: DCT scaling in compressor**<br>
`cinfo.scale_num` and `cinfo.scale_denom` are silently ignored.
There is no technical reason why DCT scaling could not be supported when
emulating the libjpeg v7+ API/ABI, but without the SmartScale extension (see
below), only scaling factors of 1/2, 8/15, 4/7, 8/13, 2/3, 8/11, 4/5, and
8/9 would be available, which is of limited usefulness.
- **libjpeg: SmartScale**<br>
- **libjpeg API: SmartScale**<br>
`cinfo.block_size` is silently ignored.
SmartScale is an extension to the JPEG format that allows for DCT block
sizes other than 8x8. Providing support for this new format would be
@ -205,7 +204,7 @@ demonstrated sufficient usefulness to justify inclusion in libjpeg-turbo.
interest in providing this feature would be as a means of supporting
additional DCT scaling factors.
- **libjpeg: Fancy downsampling in compressor**<br>
- **libjpeg API: Fancy downsampling in compressor**<br>
`cinfo.do_fancy_downsampling` is silently ignored.
This requires the DCT scaling feature, which is not supported.
@ -247,15 +246,14 @@ don't, and it allows those functions to be provided in the "official"
libjpeg-turbo binaries.
Those who are concerned about maintaining strict conformance with the libjpeg
v6b or v7 API can pass an argument of `--without-mem-srcdst` to `configure` or
an argument of `-DWITH_MEM_SRCDST=0` to `cmake` prior to building
libjpeg-turbo. This will restore the pre-1.3 behavior, in which
v6b or v7 API can pass an argument of `-DWITH_MEM_SRCDST=0` to `cmake` prior to
building libjpeg-turbo. This will restore the pre-1.3 behavior, in which
`jpeg_mem_src()` and `jpeg_mem_dest()` are only included when emulating the
libjpeg v8 API/ABI.
On Un*x systems, including the in-memory source/destination managers changes
the dynamic library version from 62.1.0 to 62.2.0 if using libjpeg v6b API/ABI
emulation and from 7.1.0 to 7.2.0 if using libjpeg v7 API/ABI emulation.
the dynamic library version from 62.2.0 to 62.3.0 if using libjpeg v6b API/ABI
emulation and from 7.2.0 to 7.3.0 if using libjpeg v7 API/ABI emulation.
Note that, on most Un*x systems, the dynamic linker will not look for a
function in a library until that function is actually used. Thus, if a program
@ -289,12 +287,13 @@ following reasons:
(and slightly faster) floating point IDCT algorithm introduced in libjpeg
v8a as opposed to the algorithm used in libjpeg v6b. It should be noted,
however, that this algorithm basically brings the accuracy of the floating
point IDCT in line with the accuracy of the slow integer IDCT. The floating
point DCT/IDCT algorithms are mainly a legacy feature, and they do not
produce significantly more accuracy than the slow integer algorithms (to put
numbers on this, the typical difference in PNSR between the two algorithms
is less than 0.10 dB, whereas changing the quality level by 1 in the upper
range of the quality scale is typically more like a 1.0 dB difference.)
point IDCT in line with the accuracy of the accurate integer IDCT. The
floating point DCT/IDCT algorithms are mainly a legacy feature, and they do
not produce significantly more accuracy than the accurate integer algorithms
(to put numbers on this, the typical difference in PNSR between the two
algorithms is less than 0.10 dB, whereas changing the quality level by 1 in
the upper range of the quality scale is typically more like a 1.0 dB
difference.)
- If the floating point algorithms in libjpeg-turbo are not implemented using
SIMD instructions on a particular platform, then the accuracy of the
@ -331,7 +330,7 @@ in a way that makes the rest of the libjpeg infrastructure happy, so it is
necessary to use the slow Huffman decoder when decompressing a JPEG image that
has restart markers. This can cause the decompression performance to drop by
as much as 20%, but the performance will still be much greater than that of
libjpeg. Many consumer packages, such as PhotoShop, use restart markers when
libjpeg. Many consumer packages, such as Photoshop, use restart markers when
generating JPEG images, so images generated by those programs will experience
this issue.
@ -342,5 +341,17 @@ The algorithm used by the SIMD-accelerated quantization function cannot produce
correct results whenever the fast integer forward DCT is used along with a JPEG
quality of 98-100. Thus, libjpeg-turbo must use the non-SIMD quantization
function in those cases. This causes performance to drop by as much as 40%.
It is therefore strongly advised that you use the slow integer forward DCT
It is therefore strongly advised that you use the accurate integer forward DCT
whenever encoding images with a JPEG quality of 98 or higher.
Memory Debugger Pitfalls
========================
Valgrind and Memory Sanitizer (MSan) can generate false positives
(specifically, incorrect reports of uninitialized memory accesses) when used
with libjpeg-turbo's SIMD extensions. It is generally recommended that the
SIMD extensions be disabled, either by passing an argument of `-DWITH_SIMD=0`
to `cmake` when configuring the build or by setting the environment variable
`JSIMD_FORCENONE` to `1` at run time, when testing libjpeg-turbo with Valgrind,
MSan, or other memory debuggers.

View File

@ -6,6 +6,25 @@ reference. Please see ChangeLog.md for information specific to libjpeg-turbo.
CHANGE LOG for Independent JPEG Group's JPEG software
Version 9d 12-Jan-2020
-----------------------
Restore GIF read and write support from libjpeg version 6a.
Thank to Wolfgang Werner (W.W.) Heinz for suggestion.
Add jpegtran -drop option; add options to the crop extension and wipe
to fill the extra area with content from the source image region,
instead of gray out.
Version 9c 14-Jan-2018
-----------------------
jpegtran: add an option to the -wipe switch to fill the region
with the average of adjacent blocks, instead of gray out.
Thank to Caitlyn Feddock and Maddie Ziegler for inspiration.
Version 9b 17-Jan-2016
-----------------------
@ -13,6 +32,13 @@ Document 'f' specifier for jpegtran -crop specification.
Thank to Michele Martone for suggestion.
Version 9a 19-Jan-2014
-----------------------
Add jpegtran -wipe option and extension for -crop.
Thank to Andrew Senior, David Clunie, and Josef Schmid for suggestion.
Version 9 13-Jan-2013
----------------------
@ -138,11 +164,6 @@ Huffman tables being used.
Huffman tables are checked for validity much more carefully than before.
To avoid the Unisys LZW patent, djpeg's GIF output capability has been
changed to produce "uncompressed GIFs", and cjpeg's GIF input capability
has been removed altogether. We're not happy about it either, but there
seems to be no good alternative.
The configure script now supports building libjpeg as a shared library
on many flavors of Unix (all the ones that GNU libtool knows how to
build shared libraries for). Use "./configure --enable-shared" to

View File

@ -48,9 +48,9 @@ rgb_ycc_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
outptr2 = output_buf[2][output_row];
output_row++;
for (col = 0; col < num_cols; col++) {
r = GETJSAMPLE(inptr[RGB_RED]);
g = GETJSAMPLE(inptr[RGB_GREEN]);
b = GETJSAMPLE(inptr[RGB_BLUE]);
r = inptr[RGB_RED];
g = inptr[RGB_GREEN];
b = inptr[RGB_BLUE];
inptr += RGB_PIXELSIZE;
/* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
* must be too; we do not need an explicit range-limiting operation.
@ -100,9 +100,9 @@ rgb_gray_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
outptr = output_buf[0][output_row];
output_row++;
for (col = 0; col < num_cols; col++) {
r = GETJSAMPLE(inptr[RGB_RED]);
g = GETJSAMPLE(inptr[RGB_GREEN]);
b = GETJSAMPLE(inptr[RGB_BLUE]);
r = inptr[RGB_RED];
g = inptr[RGB_GREEN];
b = inptr[RGB_BLUE];
inptr += RGB_PIXELSIZE;
/* Y */
outptr[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
@ -135,9 +135,9 @@ rgb_rgb_convert_internal(j_compress_ptr cinfo, JSAMPARRAY input_buf,
outptr2 = output_buf[2][output_row];
output_row++;
for (col = 0; col < num_cols; col++) {
outptr0[col] = GETJSAMPLE(inptr[RGB_RED]);
outptr1[col] = GETJSAMPLE(inptr[RGB_GREEN]);
outptr2[col] = GETJSAMPLE(inptr[RGB_BLUE]);
outptr0[col] = inptr[RGB_RED];
outptr1[col] = inptr[RGB_GREEN];
outptr2[col] = inptr[RGB_BLUE];
inptr += RGB_PIXELSIZE;
}
}

View File

@ -392,11 +392,11 @@ cmyk_ycck_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
outptr3 = output_buf[3][output_row];
output_row++;
for (col = 0; col < num_cols; col++) {
r = MAXJSAMPLE - GETJSAMPLE(inptr[0]);
g = MAXJSAMPLE - GETJSAMPLE(inptr[1]);
b = MAXJSAMPLE - GETJSAMPLE(inptr[2]);
r = MAXJSAMPLE - inptr[0];
g = MAXJSAMPLE - inptr[1];
b = MAXJSAMPLE - inptr[2];
/* K passes through as-is */
outptr3[col] = inptr[3]; /* don't need GETJSAMPLE here */
outptr3[col] = inptr[3];
inptr += 4;
/* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
* must be too; we do not need an explicit range-limiting operation.
@ -438,7 +438,7 @@ grayscale_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf,
outptr = output_buf[0][output_row];
output_row++;
for (col = 0; col < num_cols; col++) {
outptr[col] = inptr[0]; /* don't need GETJSAMPLE() here */
outptr[col] = inptr[0];
inptr += instride;
}
}
@ -497,7 +497,7 @@ null_convert(j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
inptr = *input_buf;
outptr = output_buf[ci][output_row];
for (col = 0; col < num_cols; col++) {
outptr[col] = inptr[ci]; /* don't need GETJSAMPLE() here */
outptr[col] = inptr[ci];
inptr += nc;
}
}

View File

@ -381,19 +381,19 @@ convsamp(JSAMPARRAY sample_data, JDIMENSION start_col, DCTELEM *workspace)
elemptr = sample_data[elemr] + start_col;
#if DCTSIZE == 8 /* unroll the inner loop */
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = (*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = (*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = (*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = (*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = (*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = (*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = (*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = (*elemptr++) - CENTERJSAMPLE;
#else
{
register int elemc;
for (elemc = DCTSIZE; elemc > 0; elemc--)
*workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
*workspaceptr++ = (*elemptr++) - CENTERJSAMPLE;
}
#endif
}
@ -533,20 +533,19 @@ convsamp_float(JSAMPARRAY sample_data, JDIMENSION start_col,
for (elemr = 0; elemr < DCTSIZE; elemr++) {
elemptr = sample_data[elemr] + start_col;
#if DCTSIZE == 8 /* unroll the inner loop */
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
*workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
*workspaceptr++ = (FAST_FLOAT)((*elemptr++) - CENTERJSAMPLE);
*workspaceptr++ = (FAST_FLOAT)((*elemptr++) - CENTERJSAMPLE);
*workspaceptr++ = (FAST_FLOAT)((*elemptr++) - CENTERJSAMPLE);
*workspaceptr++ = (FAST_FLOAT)((*elemptr++) - CENTERJSAMPLE);
*workspaceptr++ = (FAST_FLOAT)((*elemptr++) - CENTERJSAMPLE);
*workspaceptr++ = (FAST_FLOAT)((*elemptr++) - CENTERJSAMPLE);
*workspaceptr++ = (FAST_FLOAT)((*elemptr++) - CENTERJSAMPLE);
*workspaceptr++ = (FAST_FLOAT)((*elemptr++) - CENTERJSAMPLE);
#else
{
register int elemc;
for (elemc = DCTSIZE; elemc > 0; elemc--)
*workspaceptr++ = (FAST_FLOAT)
(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
*workspaceptr++ = (FAST_FLOAT)((*elemptr++) - CENTERJSAMPLE);
}
#endif
}

View File

@ -4,8 +4,10 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1997, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright (C) 2009-2011, 2014-2016, 2018, D. R. Commander.
* Copyright (C) 2009-2011, 2014-2016, 2018-2021, D. R. Commander.
* Copyright (C) 2015, Matthieu Darbois.
* Copyright (C) 2018, Matthias Räncker.
* Copyright (C) 2020, Arm Limited.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -34,23 +36,28 @@
* memory footprint by 64k, which is important for some mobile applications
* that create many isolated instances of libjpeg-turbo (web browsers, for
* instance.) This may improve performance on some mobile platforms as well.
* This feature is enabled by default only on ARM processors, because some x86
* This feature is enabled by default only on Arm processors, because some x86
* chips have a slow implementation of bsr, and the use of clz/bsr cannot be
* shown to have a significant performance impact even on the x86 chips that
* have a fast implementation of it. When building for ARMv6, you can
* have a fast implementation of it. When building for Armv6, you can
* explicitly disable the use of clz/bsr by adding -mthumb to the compiler
* flags (this defines __thumb__).
*/
/* NOTE: Both GCC and Clang define __GNUC__ */
#if defined __GNUC__ && (defined __arm__ || defined __aarch64__)
#if !defined __thumb__ || defined __thumb2__
#if (defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))) || \
defined(_M_ARM) || defined(_M_ARM64)
#if !defined(__thumb__) || defined(__thumb2__)
#define USE_CLZ_INTRINSIC
#endif
#endif
#ifdef USE_CLZ_INTRINSIC
#if defined(_MSC_VER) && !defined(__clang__)
#define JPEG_NBITS_NONZERO(x) (32 - _CountLeadingZeros(x))
#else
#define JPEG_NBITS_NONZERO(x) (32 - __builtin_clz(x))
#endif
#define JPEG_NBITS(x) (x ? JPEG_NBITS_NONZERO(x) : 0)
#else
#include "jpeg_nbits_table.h"
@ -65,32 +72,43 @@
* but must not be updated permanently until we complete the MCU.
*/
#if defined(__x86_64__) && defined(__ILP32__)
typedef unsigned long long bit_buf_type;
#else
typedef size_t bit_buf_type;
#endif
/* NOTE: The more optimal Huffman encoding algorithm is only used by the
* intrinsics implementation of the Arm Neon SIMD extensions, which is why we
* retain the old Huffman encoder behavior when using the GAS implementation.
*/
#if defined(WITH_SIMD) && !(defined(__arm__) || defined(__aarch64__) || \
defined(_M_ARM) || defined(_M_ARM64))
typedef unsigned long long simd_bit_buf_type;
#else
typedef bit_buf_type simd_bit_buf_type;
#endif
#if (defined(SIZEOF_SIZE_T) && SIZEOF_SIZE_T == 8) || defined(_WIN64) || \
(defined(__x86_64__) && defined(__ILP32__))
#define BIT_BUF_SIZE 64
#elif (defined(SIZEOF_SIZE_T) && SIZEOF_SIZE_T == 4) || defined(_WIN32)
#define BIT_BUF_SIZE 32
#else
#error Cannot determine word size
#endif
#define SIMD_BIT_BUF_SIZE (sizeof(simd_bit_buf_type) * 8)
typedef struct {
size_t put_buffer; /* current bit-accumulation buffer */
int put_bits; /* # of bits now in it */
union {
bit_buf_type c;
simd_bit_buf_type simd;
} put_buffer; /* current bit accumulation buffer */
int free_bits; /* # of bits available in it */
/* (Neon GAS: # of bits now in it) */
int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
} savable_state;
/* This macro is to work around compilers with missing or broken
* structure assignment. You'll need to fix this code if you have
* such a compiler and you change MAX_COMPS_IN_SCAN.
*/
#ifndef NO_STRUCT_ASSIGN
#define ASSIGN_STATE(dest, src) ((dest) = (src))
#else
#if MAX_COMPS_IN_SCAN == 4
#define ASSIGN_STATE(dest, src) \
((dest).put_buffer = (src).put_buffer, \
(dest).put_bits = (src).put_bits, \
(dest).last_dc_val[0] = (src).last_dc_val[0], \
(dest).last_dc_val[1] = (src).last_dc_val[1], \
(dest).last_dc_val[2] = (src).last_dc_val[2], \
(dest).last_dc_val[3] = (src).last_dc_val[3])
#endif
#endif
typedef struct {
struct jpeg_entropy_encoder pub; /* public fields */
@ -123,6 +141,7 @@ typedef struct {
size_t free_in_buffer; /* # of byte spaces remaining in buffer */
savable_state cur; /* Current bit buffer & DC state */
j_compress_ptr cinfo; /* dump_buffer needs access to this */
int simd;
} working_state;
@ -201,8 +220,17 @@ start_pass_huff(j_compress_ptr cinfo, boolean gather_statistics)
}
/* Initialize bit buffer to empty */
entropy->saved.put_buffer = 0;
entropy->saved.put_bits = 0;
if (entropy->simd) {
entropy->saved.put_buffer.simd = 0;
#if defined(__aarch64__) && !defined(NEON_INTRINSICS)
entropy->saved.free_bits = 0;
#else
entropy->saved.free_bits = SIMD_BIT_BUF_SIZE;
#endif
} else {
entropy->saved.put_buffer.c = 0;
entropy->saved.free_bits = BIT_BUF_SIZE;
}
/* Initialize restart stuff */
entropy->restarts_to_go = cinfo->restart_interval;
@ -287,6 +315,7 @@ jpeg_make_c_derived_tbl(j_compress_ptr cinfo, boolean isDC, int tblno,
* this lets us detect duplicate VAL entries here, and later
* allows emit_bits to detect any attempt to emit such symbols.
*/
MEMZERO(dtbl->ehufco, sizeof(dtbl->ehufco));
MEMZERO(dtbl->ehufsi, sizeof(dtbl->ehufsi));
/* This is also a convenient place to check for out-of-range
@ -334,90 +363,94 @@ dump_buffer(working_state *state)
/* Outputting bits to the file */
/* These macros perform the same task as the emit_bits() function in the
* original libjpeg code. In addition to reducing overhead by explicitly
* inlining the code, additional performance is achieved by taking into
* account the size of the bit buffer and waiting until it is almost full
* before emptying it. This mostly benefits 64-bit platforms, since 6
* bytes can be stored in a 64-bit bit buffer before it has to be emptied.
/* Output byte b and, speculatively, an additional 0 byte. 0xFF must be
* encoded as 0xFF 0x00, so the output buffer pointer is advanced by 2 if the
* byte is 0xFF. Otherwise, the output buffer pointer is advanced by 1, and
* the speculative 0 byte will be overwritten by the next byte.
*/
#define EMIT_BYTE() { \
JOCTET c; \
put_bits -= 8; \
c = (JOCTET)GETJOCTET(put_buffer >> put_bits); \
*buffer++ = c; \
if (c == 0xFF) /* need to stuff a zero byte? */ \
*buffer++ = 0; \
#define EMIT_BYTE(b) { \
buffer[0] = (JOCTET)(b); \
buffer[1] = 0; \
buffer -= -2 + ((JOCTET)(b) < 0xFF); \
}
#define PUT_BITS(code, size) { \
put_bits += size; \
put_buffer = (put_buffer << size) | code; \
}
/* Output the entire bit buffer. If there are no 0xFF bytes in it, then write
* directly to the output buffer. Otherwise, use the EMIT_BYTE() macro to
* encode 0xFF as 0xFF 0x00.
*/
#if BIT_BUF_SIZE == 64
#define CHECKBUF15() { \
if (put_bits > 15) { \
EMIT_BYTE() \
EMIT_BYTE() \
#define FLUSH() { \
if (put_buffer & 0x8080808080808080 & ~(put_buffer + 0x0101010101010101)) { \
EMIT_BYTE(put_buffer >> 56) \
EMIT_BYTE(put_buffer >> 48) \
EMIT_BYTE(put_buffer >> 40) \
EMIT_BYTE(put_buffer >> 32) \
EMIT_BYTE(put_buffer >> 24) \
EMIT_BYTE(put_buffer >> 16) \
EMIT_BYTE(put_buffer >> 8) \
EMIT_BYTE(put_buffer ) \
} else { \
buffer[0] = (JOCTET)(put_buffer >> 56); \
buffer[1] = (JOCTET)(put_buffer >> 48); \
buffer[2] = (JOCTET)(put_buffer >> 40); \
buffer[3] = (JOCTET)(put_buffer >> 32); \
buffer[4] = (JOCTET)(put_buffer >> 24); \
buffer[5] = (JOCTET)(put_buffer >> 16); \
buffer[6] = (JOCTET)(put_buffer >> 8); \
buffer[7] = (JOCTET)(put_buffer); \
buffer += 8; \
} \
}
#define CHECKBUF31() { \
if (put_bits > 31) { \
EMIT_BYTE() \
EMIT_BYTE() \
EMIT_BYTE() \
EMIT_BYTE() \
} \
}
#define CHECKBUF47() { \
if (put_bits > 47) { \
EMIT_BYTE() \
EMIT_BYTE() \
EMIT_BYTE() \
EMIT_BYTE() \
EMIT_BYTE() \
EMIT_BYTE() \
} \
}
#if !defined(_WIN32) && !defined(SIZEOF_SIZE_T)
#error Cannot determine word size
#endif
#if SIZEOF_SIZE_T == 8 || defined(_WIN64)
#define EMIT_BITS(code, size) { \
CHECKBUF47() \
PUT_BITS(code, size) \
}
#define EMIT_CODE(code, size) { \
temp2 &= (((JLONG)1) << nbits) - 1; \
CHECKBUF31() \
PUT_BITS(code, size) \
PUT_BITS(temp2, nbits) \
}
#else
#define EMIT_BITS(code, size) { \
PUT_BITS(code, size) \
CHECKBUF15() \
}
#define EMIT_CODE(code, size) { \
temp2 &= (((JLONG)1) << nbits) - 1; \
PUT_BITS(code, size) \
CHECKBUF15() \
PUT_BITS(temp2, nbits) \
CHECKBUF15() \
#define FLUSH() { \
if (put_buffer & 0x80808080 & ~(put_buffer + 0x01010101)) { \
EMIT_BYTE(put_buffer >> 24) \
EMIT_BYTE(put_buffer >> 16) \
EMIT_BYTE(put_buffer >> 8) \
EMIT_BYTE(put_buffer ) \
} else { \
buffer[0] = (JOCTET)(put_buffer >> 24); \
buffer[1] = (JOCTET)(put_buffer >> 16); \
buffer[2] = (JOCTET)(put_buffer >> 8); \
buffer[3] = (JOCTET)(put_buffer); \
buffer += 4; \
} \
}
#endif
/* Fill the bit buffer to capacity with the leading bits from code, then output
* the bit buffer and put the remaining bits from code into the bit buffer.
*/
#define PUT_AND_FLUSH(code, size) { \
put_buffer = (put_buffer << (size + free_bits)) | (code >> -free_bits); \
FLUSH() \
free_bits += BIT_BUF_SIZE; \
put_buffer = code; \
}
/* Insert code into the bit buffer and output the bit buffer if needed.
* NOTE: We can't flush with free_bits == 0, since the left shift in
* PUT_AND_FLUSH() would have undefined behavior.
*/
#define PUT_BITS(code, size) { \
free_bits -= size; \
if (free_bits < 0) \
PUT_AND_FLUSH(code, size) \
else \
put_buffer = (put_buffer << size) | code; \
}
#define PUT_CODE(code, size) { \
temp &= (((JLONG)1) << nbits) - 1; \
temp |= code << nbits; \
nbits += size; \
PUT_BITS(temp, nbits) \
}
/* Although it is exceedingly rare, it is possible for a Huffman-encoded
* coefficient block to be larger than the 128-byte unencoded block. For each
@ -428,7 +461,7 @@ dump_buffer(working_state *state)
* scanning order-- 1, 8, 16, etc.), then this will produce an encoded block
* larger than 200 bytes.
*/
#define BUFSIZE (DCTSIZE2 * 4)
#define BUFSIZE (DCTSIZE2 * 8)
#define LOAD_BUFFER() { \
if (state->free_in_buffer < BUFSIZE) { \
@ -440,6 +473,7 @@ dump_buffer(working_state *state)
#define STORE_BUFFER() { \
if (localbuf) { \
size_t bytes, bytestocopy; \
bytes = buffer - _buffer; \
buffer = _buffer; \
while (bytes > 0) { \
@ -462,20 +496,46 @@ dump_buffer(working_state *state)
LOCAL(boolean)
flush_bits(working_state *state)
{
JOCTET _buffer[BUFSIZE], *buffer;
size_t put_buffer; int put_bits;
size_t bytes, bytestocopy; int localbuf = 0;
JOCTET _buffer[BUFSIZE], *buffer, temp;
simd_bit_buf_type put_buffer; int put_bits;
int localbuf = 0;
if (state->simd) {
#if defined(__aarch64__) && !defined(NEON_INTRINSICS)
put_bits = state->cur.free_bits;
#else
put_bits = SIMD_BIT_BUF_SIZE - state->cur.free_bits;
#endif
put_buffer = state->cur.put_buffer.simd;
} else {
put_bits = BIT_BUF_SIZE - state->cur.free_bits;
put_buffer = state->cur.put_buffer.c;
}
put_buffer = state->cur.put_buffer;
put_bits = state->cur.put_bits;
LOAD_BUFFER()
/* fill any partial byte with ones */
PUT_BITS(0x7F, 7)
while (put_bits >= 8) EMIT_BYTE()
while (put_bits >= 8) {
put_bits -= 8;
temp = (JOCTET)(put_buffer >> put_bits);
EMIT_BYTE(temp)
}
if (put_bits) {
/* fill partial byte with ones */
temp = (JOCTET)((put_buffer << (8 - put_bits)) | (0xFF >> put_bits));
EMIT_BYTE(temp)
}
state->cur.put_buffer = 0; /* and reset bit-buffer to empty */
state->cur.put_bits = 0;
if (state->simd) { /* and reset bit buffer to empty */
state->cur.put_buffer.simd = 0;
#if defined(__aarch64__) && !defined(NEON_INTRINSICS)
state->cur.free_bits = 0;
#else
state->cur.free_bits = SIMD_BIT_BUF_SIZE;
#endif
} else {
state->cur.put_buffer.c = 0;
state->cur.free_bits = BIT_BUF_SIZE;
}
STORE_BUFFER()
return TRUE;
@ -489,7 +549,7 @@ encode_one_block_simd(working_state *state, JCOEFPTR block, int last_dc_val,
c_derived_tbl *dctbl, c_derived_tbl *actbl)
{
JOCTET _buffer[BUFSIZE], *buffer;
size_t bytes, bytestocopy; int localbuf = 0;
int localbuf = 0;
LOAD_BUFFER()
@ -505,53 +565,41 @@ LOCAL(boolean)
encode_one_block(working_state *state, JCOEFPTR block, int last_dc_val,
c_derived_tbl *dctbl, c_derived_tbl *actbl)
{
int temp, temp2, temp3;
int nbits;
int r, code, size;
int temp, nbits, free_bits;
bit_buf_type put_buffer;
JOCTET _buffer[BUFSIZE], *buffer;
size_t put_buffer; int put_bits;
int code_0xf0 = actbl->ehufco[0xf0], size_0xf0 = actbl->ehufsi[0xf0];
size_t bytes, bytestocopy; int localbuf = 0;
int localbuf = 0;
put_buffer = state->cur.put_buffer;
put_bits = state->cur.put_bits;
free_bits = state->cur.free_bits;
put_buffer = state->cur.put_buffer.c;
LOAD_BUFFER()
/* Encode the DC coefficient difference per section F.1.2.1 */
temp = temp2 = block[0] - last_dc_val;
temp = block[0] - last_dc_val;
/* This is a well-known technique for obtaining the absolute value without a
* branch. It is derived from an assembly language technique presented in
* "How to Optimize for the Pentium Processors", Copyright (c) 1996, 1997 by
* Agner Fog.
* Agner Fog. This code assumes we are on a two's complement machine.
*/
temp3 = temp >> (CHAR_BIT * sizeof(int) - 1);
temp ^= temp3;
temp -= temp3;
/* For a negative input, want temp2 = bitwise complement of abs(input) */
/* This code assumes we are on a two's complement machine */
temp2 += temp3;
nbits = temp >> (CHAR_BIT * sizeof(int) - 1);
temp += nbits;
nbits ^= temp;
/* Find the number of bits needed for the magnitude of the coefficient */
nbits = JPEG_NBITS(temp);
nbits = JPEG_NBITS(nbits);
/* Emit the Huffman-coded symbol for the number of bits */
code = dctbl->ehufco[nbits];
size = dctbl->ehufsi[nbits];
EMIT_BITS(code, size)
/* Mask off any extra bits in code */
temp2 &= (((JLONG)1) << nbits) - 1;
/* Emit that number of bits of the value, if positive, */
/* or the complement of its magnitude, if negative. */
EMIT_BITS(temp2, nbits)
/* Emit the Huffman-coded symbol for the number of bits.
* Emit that number of bits of the value, if positive,
* or the complement of its magnitude, if negative.
*/
PUT_CODE(dctbl->ehufco[nbits], dctbl->ehufsi[nbits])
/* Encode the AC coefficients per section F.1.2.2 */
r = 0; /* r = run length of zeros */
{
int r = 0; /* r = run length of zeros */
/* Manually unroll the k loop to eliminate the counter variable. This
* improves performance greatly on systems with a limited number of
@ -559,51 +607,46 @@ encode_one_block(working_state *state, JCOEFPTR block, int last_dc_val,
*/
#define kloop(jpeg_natural_order_of_k) { \
if ((temp = block[jpeg_natural_order_of_k]) == 0) { \
r++; \
r += 16; \
} else { \
temp2 = temp; \
/* Branch-less absolute value, bitwise complement, etc., same as above */ \
temp3 = temp >> (CHAR_BIT * sizeof(int) - 1); \
temp ^= temp3; \
temp -= temp3; \
temp2 += temp3; \
nbits = JPEG_NBITS_NONZERO(temp); \
nbits = temp >> (CHAR_BIT * sizeof(int) - 1); \
temp += nbits; \
nbits ^= temp; \
nbits = JPEG_NBITS_NONZERO(nbits); \
/* if run length > 15, must emit special run-length-16 codes (0xF0) */ \
while (r > 15) { \
EMIT_BITS(code_0xf0, size_0xf0) \
r -= 16; \
while (r >= 16 * 16) { \
r -= 16 * 16; \
PUT_BITS(actbl->ehufco[0xf0], actbl->ehufsi[0xf0]) \
} \
/* Emit Huffman symbol for run length / number of bits */ \
temp3 = (r << 4) + nbits; \
code = actbl->ehufco[temp3]; \
size = actbl->ehufsi[temp3]; \
EMIT_CODE(code, size) \
r += nbits; \
PUT_CODE(actbl->ehufco[r], actbl->ehufsi[r]) \
r = 0; \
} \
}
/* One iteration for each value in jpeg_natural_order[] */
kloop(1); kloop(8); kloop(16); kloop(9); kloop(2); kloop(3);
kloop(10); kloop(17); kloop(24); kloop(32); kloop(25); kloop(18);
kloop(11); kloop(4); kloop(5); kloop(12); kloop(19); kloop(26);
kloop(33); kloop(40); kloop(48); kloop(41); kloop(34); kloop(27);
kloop(20); kloop(13); kloop(6); kloop(7); kloop(14); kloop(21);
kloop(28); kloop(35); kloop(42); kloop(49); kloop(56); kloop(57);
kloop(50); kloop(43); kloop(36); kloop(29); kloop(22); kloop(15);
kloop(23); kloop(30); kloop(37); kloop(44); kloop(51); kloop(58);
kloop(59); kloop(52); kloop(45); kloop(38); kloop(31); kloop(39);
kloop(46); kloop(53); kloop(60); kloop(61); kloop(54); kloop(47);
kloop(55); kloop(62); kloop(63);
/* One iteration for each value in jpeg_natural_order[] */
kloop(1); kloop(8); kloop(16); kloop(9); kloop(2); kloop(3);
kloop(10); kloop(17); kloop(24); kloop(32); kloop(25); kloop(18);
kloop(11); kloop(4); kloop(5); kloop(12); kloop(19); kloop(26);
kloop(33); kloop(40); kloop(48); kloop(41); kloop(34); kloop(27);
kloop(20); kloop(13); kloop(6); kloop(7); kloop(14); kloop(21);
kloop(28); kloop(35); kloop(42); kloop(49); kloop(56); kloop(57);
kloop(50); kloop(43); kloop(36); kloop(29); kloop(22); kloop(15);
kloop(23); kloop(30); kloop(37); kloop(44); kloop(51); kloop(58);
kloop(59); kloop(52); kloop(45); kloop(38); kloop(31); kloop(39);
kloop(46); kloop(53); kloop(60); kloop(61); kloop(54); kloop(47);
kloop(55); kloop(62); kloop(63);
/* If the last coef(s) were zero, emit an end-of-block code */
if (r > 0) {
code = actbl->ehufco[0];
size = actbl->ehufsi[0];
EMIT_BITS(code, size)
/* If the last coef(s) were zero, emit an end-of-block code */
if (r > 0) {
PUT_BITS(actbl->ehufco[0], actbl->ehufsi[0])
}
}
state->cur.put_buffer = put_buffer;
state->cur.put_bits = put_bits;
state->cur.put_buffer.c = put_buffer;
state->cur.free_bits = free_bits;
STORE_BUFFER()
return TRUE;
@ -650,8 +693,9 @@ encode_mcu_huff(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
/* Load up working state */
state.next_output_byte = cinfo->dest->next_output_byte;
state.free_in_buffer = cinfo->dest->free_in_buffer;
ASSIGN_STATE(state.cur, entropy->saved);
state.cur = entropy->saved;
state.cinfo = cinfo;
state.simd = entropy->simd;
/* Emit restart marker if needed */
if (cinfo->restart_interval) {
@ -690,7 +734,7 @@ encode_mcu_huff(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
/* Completed MCU, so update state */
cinfo->dest->next_output_byte = state.next_output_byte;
cinfo->dest->free_in_buffer = state.free_in_buffer;
ASSIGN_STATE(entropy->saved, state.cur);
entropy->saved = state.cur;
/* Update restart-interval state too */
if (cinfo->restart_interval) {
@ -719,8 +763,9 @@ finish_pass_huff(j_compress_ptr cinfo)
/* Load up working state ... flush_bits needs it */
state.next_output_byte = cinfo->dest->next_output_byte;
state.free_in_buffer = cinfo->dest->free_in_buffer;
ASSIGN_STATE(state.cur, entropy->saved);
state.cur = entropy->saved;
state.cinfo = cinfo;
state.simd = entropy->simd;
/* Flush out the last data */
if (!flush_bits(&state))
@ -729,7 +774,7 @@ finish_pass_huff(j_compress_ptr cinfo)
/* Update state */
cinfo->dest->next_output_byte = state.next_output_byte;
cinfo->dest->free_in_buffer = state.free_in_buffer;
ASSIGN_STATE(entropy->saved, state.cur);
entropy->saved = state.cur;
}

View File

@ -1,8 +1,10 @@
/*
* jcinit.c
*
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1997, Thomas G. Lane.
* This file is part of the Independent JPEG Group's software.
* libjpeg-turbo Modifications:
* Copyright (C) 2020, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -19,6 +21,7 @@
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
#include "jpegcomp.h"
/*

View File

@ -492,8 +492,8 @@ prepare_for_pass(j_compress_ptr cinfo)
*/
master->pass_type = output_pass;
master->pass_number++;
/*FALLTHROUGH*/
#endif
FALLTHROUGH /*FALLTHROUGH*/
case output_pass:
/* Do a data-output pass. */
/* We need not repeat per-scan setup if prior optimization pass did it. */

23
src/3rdparty/libjpeg/src/jconfig.h vendored Normal file
View File

@ -0,0 +1,23 @@
// Definitions for building in Qt source, ref. src/jconfig.h.in
#define JPEG_LIB_VERSION 80
#define LIBJPEG_TURBO_VERSION 2.1.1
#define LIBJPEG_TURBO_VERSION_NUMBER 2001001
#define C_ARITH_CODING_SUPPORTED 1
#define D_ARITH_CODING_SUPPORTED 1
#define MEM_SRCDST_SUPPORTED 1
#define BITS_IN_JSAMPLE 8
#define HAVE_STDDEF_H 1
#define HAVE_STDLIB_H 1
#define HAVE_UNSIGNED_CHAR 1
#define HAVE_UNSIGNED_SHORT 1

View File

@ -10,16 +10,16 @@
#define LIBJPEG_TURBO_VERSION_NUMBER @LIBJPEG_TURBO_VERSION_NUMBER@
/* Support arithmetic encoding */
#cmakedefine C_ARITH_CODING_SUPPORTED
#cmakedefine C_ARITH_CODING_SUPPORTED 1
/* Support arithmetic decoding */
#cmakedefine D_ARITH_CODING_SUPPORTED
#cmakedefine D_ARITH_CODING_SUPPORTED 1
/* Support in-memory source/destination managers */
#cmakedefine MEM_SRCDST_SUPPORTED
#cmakedefine MEM_SRCDST_SUPPORTED 1
/* Use accelerated SIMD routines. */
#cmakedefine WITH_SIMD
#cmakedefine WITH_SIMD 1
/*
* Define BITS_IN_JSAMPLE as either
@ -33,38 +33,33 @@
#define BITS_IN_JSAMPLE @BITS_IN_JSAMPLE@ /* use 8 or 12 */
/* Define to 1 if you have the <locale.h> header file. */
#cmakedefine HAVE_LOCALE_H
#cmakedefine HAVE_LOCALE_H 1
/* Define to 1 if you have the <stddef.h> header file. */
#cmakedefine HAVE_STDDEF_H
#cmakedefine HAVE_STDDEF_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine HAVE_STDLIB_H
#cmakedefine HAVE_STDLIB_H 1
/* Define if you need to include <sys/types.h> to get size_t. */
#cmakedefine NEED_SYS_TYPES_H
#cmakedefine NEED_SYS_TYPES_H 1
/* Define if you have BSD-like bzero and bcopy in <strings.h> rather than
memset/memcpy in <string.h>. */
#cmakedefine NEED_BSD_STRINGS
#cmakedefine NEED_BSD_STRINGS 1
/* Define to 1 if the system has the type `unsigned char'. */
#cmakedefine HAVE_UNSIGNED_CHAR
#cmakedefine HAVE_UNSIGNED_CHAR 1
/* Define to 1 if the system has the type `unsigned short'. */
#cmakedefine HAVE_UNSIGNED_SHORT
#cmakedefine HAVE_UNSIGNED_SHORT 1
/* Compiler does not support pointers to undefined structures. */
#cmakedefine INCOMPLETE_TYPES_BROKEN
#cmakedefine INCOMPLETE_TYPES_BROKEN 1
/* Define if your (broken) compiler shifts signed values as if they were
unsigned. */
#cmakedefine RIGHT_SHIFT_IS_UNSIGNED
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
#cmakedefine __CHAR_UNSIGNED__
#endif
#cmakedefine RIGHT_SHIFT_IS_UNSIGNED 1
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */

View File

@ -8,10 +8,12 @@
#define PACKAGE_NAME "libjpeg-turbo"
#define VERSION "2.0.0"
#define VERSION "2.1.1"
#if SIZE_MAX == 0xffffffff
#define SIZEOF_SIZE_T 4
#elif SIZE_MAX == 0xffffffffffffffff
#define SIZEOF_SIZE_T 8
#endif
#define FALLTHROUGH

View File

@ -7,6 +7,9 @@
/* How to obtain function inlining. */
#define INLINE @INLINE@
/* How to obtain thread-local storage */
#define THREAD_LOCAL @THREAD_LOCAL@
/* Define to the full name of this package. */
#define PACKAGE_NAME "@CMAKE_PROJECT_NAME@"
@ -29,3 +32,13 @@
#define HAVE_BITSCANFORWARD
#endif
#endif
#if defined(__has_attribute)
#if __has_attribute(fallthrough)
#define FALLTHROUGH __attribute__((fallthrough));
#else
#define FALLTHROUGH
#endif
#else
#define FALLTHROUGH
#endif

View File

@ -4,8 +4,10 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1995-1997, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright (C) 2011, 2015, 2018, D. R. Commander.
* Copyright (C) 2011, 2015, 2018, 2021, D. R. Commander.
* Copyright (C) 2016, 2018, Matthieu Darbois.
* Copyright (C) 2020, Arm Limited.
* Copyright (C) 2021, Alex Richardson.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -43,23 +45,28 @@
* memory footprint by 64k, which is important for some mobile applications
* that create many isolated instances of libjpeg-turbo (web browsers, for
* instance.) This may improve performance on some mobile platforms as well.
* This feature is enabled by default only on ARM processors, because some x86
* This feature is enabled by default only on Arm processors, because some x86
* chips have a slow implementation of bsr, and the use of clz/bsr cannot be
* shown to have a significant performance impact even on the x86 chips that
* have a fast implementation of it. When building for ARMv6, you can
* have a fast implementation of it. When building for Armv6, you can
* explicitly disable the use of clz/bsr by adding -mthumb to the compiler
* flags (this defines __thumb__).
*/
/* NOTE: Both GCC and Clang define __GNUC__ */
#if defined __GNUC__ && (defined __arm__ || defined __aarch64__)
#if !defined __thumb__ || defined __thumb2__
#if (defined(__GNUC__) && (defined(__arm__) || defined(__aarch64__))) || \
defined(_M_ARM) || defined(_M_ARM64)
#if !defined(__thumb__) || defined(__thumb2__)
#define USE_CLZ_INTRINSIC
#endif
#endif
#ifdef USE_CLZ_INTRINSIC
#if defined(_MSC_VER) && !defined(__clang__)
#define JPEG_NBITS_NONZERO(x) (32 - _CountLeadingZeros(x))
#else
#define JPEG_NBITS_NONZERO(x) (32 - __builtin_clz(x))
#endif
#define JPEG_NBITS(x) (x ? JPEG_NBITS_NONZERO(x) : 0)
#else
#include "jpeg_nbits_table.h"
@ -169,24 +176,26 @@ INLINE
METHODDEF(int)
count_zeroes(size_t *x)
{
int result;
#if defined(HAVE_BUILTIN_CTZL)
int result;
result = __builtin_ctzl(*x);
*x >>= result;
#elif defined(HAVE_BITSCANFORWARD64)
unsigned long result;
_BitScanForward64(&result, *x);
*x >>= result;
#elif defined(HAVE_BITSCANFORWARD)
unsigned long result;
_BitScanForward(&result, *x);
*x >>= result;
#else
result = 0;
int result = 0;
while ((*x & 1) == 0) {
++result;
*x >>= 1;
}
#endif
return result;
return (int)result;
}
@ -672,7 +681,7 @@ encode_mcu_AC_first(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
emit_restart(entropy, entropy->next_restart_num);
#ifdef WITH_SIMD
cvalue = values = (JCOEF *)PAD((size_t)values_unaligned, 16);
cvalue = values = (JCOEF *)PAD((JUINTPTR)values_unaligned, 16);
#else
/* Not using SIMD, so alignment is not needed */
cvalue = values = values_unaligned;
@ -860,7 +869,7 @@ encode_mcu_AC_refine_prepare(const JCOEF *block,
#define ENCODE_COEFS_AC_REFINE(label) { \
while (zerobits) { \
int idx = count_zeroes(&zerobits); \
idx = count_zeroes(&zerobits); \
r += idx; \
cabsvalue += idx; \
signbits >>= idx; \
@ -917,7 +926,7 @@ METHODDEF(boolean)
encode_mcu_AC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
register int temp, r;
register int temp, r, idx;
char *BR_buffer;
unsigned int BR;
int Sl = cinfo->Se - cinfo->Ss + 1;
@ -937,7 +946,7 @@ encode_mcu_AC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
emit_restart(entropy, entropy->next_restart_num);
#ifdef WITH_SIMD
cabsvalue = absvalues = (JCOEF *)PAD((size_t)absvalues_unaligned, 16);
cabsvalue = absvalues = (JCOEF *)PAD((JUINTPTR)absvalues_unaligned, 16);
#else
/* Not using SIMD, so alignment is not needed */
cabsvalue = absvalues = absvalues_unaligned;
@ -968,7 +977,7 @@ encode_mcu_AC_refine(j_compress_ptr cinfo, JBLOCKROW *MCU_data)
if (zerobits) {
int diff = ((absvalues + DCTSIZE2 / 2) - cabsvalue);
int idx = count_zeroes(&zerobits);
idx = count_zeroes(&zerobits);
signbits >>= idx;
idx += diff;
r += idx;

View File

@ -6,7 +6,7 @@
* libjpeg-turbo Modifications:
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2014, MIPS Technologies, Inc., California.
* Copyright (C) 2015, D. R. Commander.
* Copyright (C) 2015, 2019, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -103,7 +103,7 @@ expand_right_edge(JSAMPARRAY image_data, int num_rows, JDIMENSION input_cols,
if (numcols > 0) {
for (row = 0; row < num_rows; row++) {
ptr = image_data[row] + input_cols;
pixval = ptr[-1]; /* don't need GETJSAMPLE() here */
pixval = ptr[-1];
for (count = numcols; count > 0; count--)
*ptr++ = pixval;
}
@ -174,7 +174,7 @@ int_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
for (v = 0; v < v_expand; v++) {
inptr = input_data[inrow + v] + outcol_h;
for (h = 0; h < h_expand; h++) {
outvalue += (JLONG)GETJSAMPLE(*inptr++);
outvalue += (JLONG)(*inptr++);
}
}
*outptr++ = (JSAMPLE)((outvalue + numpix2) / numpix);
@ -237,8 +237,7 @@ h2v1_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
inptr = input_data[outrow];
bias = 0; /* bias = 0,1,0,1,... for successive samples */
for (outcol = 0; outcol < output_cols; outcol++) {
*outptr++ =
(JSAMPLE)((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1]) + bias) >> 1);
*outptr++ = (JSAMPLE)((inptr[0] + inptr[1] + bias) >> 1);
bias ^= 1; /* 0=>1, 1=>0 */
inptr += 2;
}
@ -277,8 +276,7 @@ h2v2_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
bias = 1; /* bias = 1,2,1,2,... for successive samples */
for (outcol = 0; outcol < output_cols; outcol++) {
*outptr++ =
(JSAMPLE)((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]) + bias) >> 2);
(JSAMPLE)((inptr0[0] + inptr0[1] + inptr1[0] + inptr1[1] + bias) >> 2);
bias ^= 3; /* 1=>2, 2=>1 */
inptr0 += 2; inptr1 += 2;
}
@ -337,33 +335,25 @@ h2v2_smooth_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
below_ptr = input_data[inrow + 2];
/* Special case for first column: pretend column -1 is same as column 0 */
membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[2]) +
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[2]);
membersum = inptr0[0] + inptr0[1] + inptr1[0] + inptr1[1];
neighsum = above_ptr[0] + above_ptr[1] + below_ptr[0] + below_ptr[1] +
inptr0[0] + inptr0[2] + inptr1[0] + inptr1[2];
neighsum += neighsum;
neighsum += GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[2]) +
GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[2]);
neighsum += above_ptr[0] + above_ptr[2] + below_ptr[0] + below_ptr[2];
membersum = membersum * memberscale + neighsum * neighscale;
*outptr++ = (JSAMPLE)((membersum + 32768) >> 16);
inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
for (colctr = output_cols - 2; colctr > 0; colctr--) {
/* sum of pixels directly mapped to this output element */
membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
membersum = inptr0[0] + inptr0[1] + inptr1[0] + inptr1[1];
/* sum of edge-neighbor pixels */
neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[2]) +
GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[2]);
neighsum = above_ptr[0] + above_ptr[1] + below_ptr[0] + below_ptr[1] +
inptr0[-1] + inptr0[2] + inptr1[-1] + inptr1[2];
/* The edge-neighbors count twice as much as corner-neighbors */
neighsum += neighsum;
/* Add in the corner-neighbors */
neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[2]) +
GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[2]);
neighsum += above_ptr[-1] + above_ptr[2] + below_ptr[-1] + below_ptr[2];
/* form final output scaled up by 2^16 */
membersum = membersum * memberscale + neighsum * neighscale;
/* round, descale and output it */
@ -372,15 +362,11 @@ h2v2_smooth_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
}
/* Special case for last column */
membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[1]) +
GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[1]);
membersum = inptr0[0] + inptr0[1] + inptr1[0] + inptr1[1];
neighsum = above_ptr[0] + above_ptr[1] + below_ptr[0] + below_ptr[1] +
inptr0[-1] + inptr0[1] + inptr1[-1] + inptr1[1];
neighsum += neighsum;
neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[1]) +
GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[1]);
neighsum += above_ptr[-1] + above_ptr[1] + below_ptr[-1] + below_ptr[1];
membersum = membersum * memberscale + neighsum * neighscale;
*outptr = (JSAMPLE)((membersum + 32768) >> 16);
@ -429,21 +415,18 @@ fullsize_smooth_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
below_ptr = input_data[outrow + 1];
/* Special case for first column */
colsum = GETJSAMPLE(*above_ptr++) + GETJSAMPLE(*below_ptr++) +
GETJSAMPLE(*inptr);
membersum = GETJSAMPLE(*inptr++);
nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
GETJSAMPLE(*inptr);
colsum = (*above_ptr++) + (*below_ptr++) + inptr[0];
membersum = *inptr++;
nextcolsum = above_ptr[0] + below_ptr[0] + inptr[0];
neighsum = colsum + (colsum - membersum) + nextcolsum;
membersum = membersum * memberscale + neighsum * neighscale;
*outptr++ = (JSAMPLE)((membersum + 32768) >> 16);
lastcolsum = colsum; colsum = nextcolsum;
for (colctr = output_cols - 2; colctr > 0; colctr--) {
membersum = GETJSAMPLE(*inptr++);
membersum = *inptr++;
above_ptr++; below_ptr++;
nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
GETJSAMPLE(*inptr);
nextcolsum = above_ptr[0] + below_ptr[0] + inptr[0];
neighsum = lastcolsum + (colsum - membersum) + nextcolsum;
membersum = membersum * memberscale + neighsum * neighscale;
*outptr++ = (JSAMPLE)((membersum + 32768) >> 16);
@ -451,7 +434,7 @@ fullsize_smooth_downsample(j_compress_ptr cinfo, jpeg_component_info *compptr,
}
/* Special case for last column */
membersum = GETJSAMPLE(*inptr);
membersum = *inptr;
neighsum = lastcolsum + (colsum - membersum) + colsum;
membersum = membersum * memberscale + neighsum * neighscale;
*outptr = (JSAMPLE)((membersum + 32768) >> 16);

View File

@ -4,8 +4,8 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1995-1998, Thomas G. Lane.
* Modified 2000-2009 by Guido Vollbeding.
* It was modified by The libjpeg-turbo Project to include only code relevant
* to libjpeg-turbo.
* libjpeg-turbo Modifications:
* Copyright (C) 2020, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -17,6 +17,7 @@
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
#include "jpegcomp.h"
/* Forward declarations */

View File

@ -23,6 +23,7 @@
#include "jinclude.h"
#include "jpeglib.h"
#include "jdmaster.h"
#include "jconfigint.h"
/*
@ -308,7 +309,7 @@ jpeg_consume_input(j_decompress_ptr cinfo)
/* Initialize application's data source module */
(*cinfo->src->init_source) (cinfo);
cinfo->global_state = DSTATE_INHEADER;
/*FALLTHROUGH*/
FALLTHROUGH /*FALLTHROUGH*/
case DSTATE_INHEADER:
retcode = (*cinfo->inputctl->consume_input) (cinfo);
if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */

View File

@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1994-1996, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright (C) 2010, 2015-2018, D. R. Commander.
* Copyright (C) 2010, 2015-2020, D. R. Commander.
* Copyright (C) 2015, Google, Inc.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
@ -21,6 +21,8 @@
#include "jinclude.h"
#include "jdmainct.h"
#include "jdcoefct.h"
#include "jdmaster.h"
#include "jdmerge.h"
#include "jdsample.h"
#include "jmemsys.h"
@ -316,6 +318,10 @@ LOCAL(void)
read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
{
JDIMENSION n;
my_master_ptr master = (my_master_ptr)cinfo->master;
JSAMPLE dummy_sample[1] = { 0 };
JSAMPROW dummy_row = dummy_sample;
JSAMPARRAY scanlines = NULL;
void (*color_convert) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JDIMENSION input_row, JSAMPARRAY output_buf,
int num_rows) = NULL;
@ -325,6 +331,10 @@ read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
if (cinfo->cconvert && cinfo->cconvert->color_convert) {
color_convert = cinfo->cconvert->color_convert;
cinfo->cconvert->color_convert = noop_convert;
/* This just prevents UBSan from complaining about adding 0 to a NULL
* pointer. The pointer isn't actually used.
*/
scanlines = &dummy_row;
}
if (cinfo->cquantize && cinfo->cquantize->color_quantize) {
@ -332,8 +342,13 @@ read_and_discard_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
cinfo->cquantize->color_quantize = noop_quantize;
}
if (master->using_merged_upsample && cinfo->max_v_samp_factor == 2) {
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
scanlines = &upsample->spare_row;
}
for (n = 0; n < num_lines; n++)
jpeg_read_scanlines(cinfo, NULL, 1);
jpeg_read_scanlines(cinfo, scanlines, 1);
if (color_convert)
cinfo->cconvert->color_convert = color_convert;
@ -353,6 +368,12 @@ increment_simple_rowgroup_ctr(j_decompress_ptr cinfo, JDIMENSION rows)
{
JDIMENSION rows_left;
my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
my_master_ptr master = (my_master_ptr)cinfo->master;
if (master->using_merged_upsample && cinfo->max_v_samp_factor == 2) {
read_and_discard_scanlines(cinfo, rows);
return;
}
/* Increment the counter to the next row group after the skipped rows. */
main_ptr->rowgroup_ctr += rows / cinfo->max_v_samp_factor;
@ -382,21 +403,27 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
{
my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
my_master_ptr master = (my_master_ptr)cinfo->master;
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
JDIMENSION i, x;
int y;
JDIMENSION lines_per_iMCU_row, lines_left_in_iMCU_row, lines_after_iMCU_row;
JDIMENSION lines_to_skip, lines_to_read;
/* Two-pass color quantization is not supported. */
if (cinfo->quantize_colors && cinfo->two_pass_quantize)
ERREXIT(cinfo, JERR_NOTIMPL);
if (cinfo->global_state != DSTATE_SCANNING)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
/* Do not skip past the bottom of the image. */
if (cinfo->output_scanline + num_lines >= cinfo->output_height) {
num_lines = cinfo->output_height - cinfo->output_scanline;
cinfo->output_scanline = cinfo->output_height;
(*cinfo->inputctl->finish_input_pass) (cinfo);
cinfo->inputctl->eoi_reached = TRUE;
return cinfo->output_height - cinfo->output_scanline;
return num_lines;
}
if (num_lines == 0)
@ -445,8 +472,10 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
main_ptr->buffer_full = FALSE;
main_ptr->rowgroup_ctr = 0;
main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
upsample->next_row_out = cinfo->max_v_samp_factor;
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
if (!master->using_merged_upsample) {
upsample->next_row_out = cinfo->max_v_samp_factor;
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
}
}
/* Skipping is much simpler when context rows are not required. */
@ -458,8 +487,10 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
cinfo->output_scanline += lines_left_in_iMCU_row;
main_ptr->buffer_full = FALSE;
main_ptr->rowgroup_ctr = 0;
upsample->next_row_out = cinfo->max_v_samp_factor;
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
if (!master->using_merged_upsample) {
upsample->next_row_out = cinfo->max_v_samp_factor;
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
}
}
}
@ -494,7 +525,8 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
cinfo->output_iMCU_row += lines_to_skip / lines_per_iMCU_row;
increment_simple_rowgroup_ctr(cinfo, lines_to_read);
}
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
if (!master->using_merged_upsample)
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
return num_lines;
}
@ -506,6 +538,8 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
* decoded coefficients. This is ~5% faster for large subsets, but
* it's tough to tell a difference for smaller images.
*/
if (!cinfo->entropy->insufficient_data)
cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
(*cinfo->entropy->decode_mcu) (cinfo, NULL);
}
}
@ -535,7 +569,8 @@ jpeg_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines)
* bit odd, since "rows_to_go" seems to be redundantly keeping track of
* output_scanline.
*/
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
if (!master->using_merged_upsample)
upsample->rows_to_go = cinfo->output_height - cinfo->output_scanline;
/* Always skip the requested number of lines. */
return num_lines;

View File

@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software:
* Developed 1997-2015 by Guido Vollbeding.
* libjpeg-turbo Modifications:
* Copyright (C) 2015-2018, D. R. Commander.
* Copyright (C) 2015-2020, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -80,7 +80,7 @@ get_byte(j_decompress_ptr cinfo)
if (!(*src->fill_input_buffer) (cinfo))
ERREXIT(cinfo, JERR_CANT_SUSPEND);
src->bytes_in_buffer--;
return GETJOCTET(*src->next_input_byte++);
return *src->next_input_byte++;
}
@ -665,8 +665,16 @@ bad:
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
int coefi, cindex = cinfo->cur_comp_info[ci]->component_index;
int *coef_bit_ptr = &cinfo->coef_bits[cindex][0];
int *prev_coef_bit_ptr =
&cinfo->coef_bits[cindex + cinfo->num_components][0];
if (cinfo->Ss && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
if (cinfo->input_scan_number > 1)
prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
else
prev_coef_bit_ptr[coefi] = 0;
}
for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
if (cinfo->Ah != expected)
@ -727,6 +735,7 @@ bad:
entropy->c = 0;
entropy->a = 0;
entropy->ct = -16; /* force reading 2 initial bytes to fill C */
entropy->pub.insufficient_data = FALSE;
/* Initialize restart counter */
entropy->restarts_to_go = cinfo->restart_interval;
@ -763,7 +772,7 @@ jinit_arith_decoder(j_decompress_ptr cinfo)
int *coef_bit_ptr, ci;
cinfo->coef_bits = (int (*)[DCTSIZE2])
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
cinfo->num_components * DCTSIZE2 *
cinfo->num_components * 2 * DCTSIZE2 *
sizeof(int));
coef_bit_ptr = &cinfo->coef_bits[0][0];
for (ci = 0; ci < cinfo->num_components; ci++)

View File

@ -143,8 +143,7 @@ empty_mem_output_buffer(j_compress_ptr cinfo)
MEMCOPY(nextbuffer, dest->buffer, dest->bufsize);
if (dest->newbuffer != NULL)
free(dest->newbuffer);
free(dest->newbuffer);
dest->newbuffer = nextbuffer;

View File

@ -5,8 +5,8 @@
* Copyright (C) 1994-1997, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2010, 2015-2016, D. R. Commander.
* Copyright (C) 2015, Google, Inc.
* Copyright (C) 2010, 2015-2016, 2019-2020, D. R. Commander.
* Copyright (C) 2015, 2020, Google, Inc.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -102,6 +102,8 @@ decompress_onepass(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
/* Try to fetch an MCU. Entropy decoder expects buffer to be zeroed. */
jzero_far((void *)coef->MCU_buffer[0],
(size_t)(cinfo->blocks_in_MCU * sizeof(JBLOCK)));
if (!cinfo->entropy->insufficient_data)
cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
/* Suspension forced; update state counters and exit */
coef->MCU_vert_offset = yoffset;
@ -227,6 +229,8 @@ consume_data(j_decompress_ptr cinfo)
}
}
}
if (!cinfo->entropy->insufficient_data)
cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
/* Try to fetch the MCU. */
if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
/* Suspension forced; update state counters and exit */
@ -326,19 +330,22 @@ decompress_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
#ifdef BLOCK_SMOOTHING_SUPPORTED
/*
* This code applies interblock smoothing as described by section K.8
* of the JPEG standard: the first 5 AC coefficients are estimated from
* the DC values of a DCT block and its 8 neighboring blocks.
* This code applies interblock smoothing; the first 9 AC coefficients are
* estimated from the DC values of a DCT block and its 24 neighboring blocks.
* We apply smoothing only for progressive JPEG decoding, and only if
* the coefficients it can estimate are not yet known to full precision.
*/
/* Natural-order array positions of the first 5 zigzag-order coefficients */
/* Natural-order array positions of the first 9 zigzag-order coefficients */
#define Q01_POS 1
#define Q10_POS 8
#define Q20_POS 16
#define Q11_POS 9
#define Q02_POS 2
#define Q03_POS 3
#define Q12_POS 10
#define Q21_POS 17
#define Q30_POS 24
/*
* Determine whether block smoothing is applicable and safe.
@ -356,8 +363,8 @@ smoothing_ok(j_decompress_ptr cinfo)
int ci, coefi;
jpeg_component_info *compptr;
JQUANT_TBL *qtable;
int *coef_bits;
int *coef_bits_latch;
int *coef_bits, *prev_coef_bits;
int *coef_bits_latch, *prev_coef_bits_latch;
if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
return FALSE;
@ -366,34 +373,47 @@ smoothing_ok(j_decompress_ptr cinfo)
if (coef->coef_bits_latch == NULL)
coef->coef_bits_latch = (int *)
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
cinfo->num_components *
cinfo->num_components * 2 *
(SAVED_COEFS * sizeof(int)));
coef_bits_latch = coef->coef_bits_latch;
prev_coef_bits_latch =
&coef->coef_bits_latch[cinfo->num_components * SAVED_COEFS];
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
/* All components' quantization values must already be latched. */
if ((qtable = compptr->quant_table) == NULL)
return FALSE;
/* Verify DC & first 5 AC quantizers are nonzero to avoid zero-divide. */
/* Verify DC & first 9 AC quantizers are nonzero to avoid zero-divide. */
if (qtable->quantval[0] == 0 ||
qtable->quantval[Q01_POS] == 0 ||
qtable->quantval[Q10_POS] == 0 ||
qtable->quantval[Q20_POS] == 0 ||
qtable->quantval[Q11_POS] == 0 ||
qtable->quantval[Q02_POS] == 0)
qtable->quantval[Q02_POS] == 0 ||
qtable->quantval[Q03_POS] == 0 ||
qtable->quantval[Q12_POS] == 0 ||
qtable->quantval[Q21_POS] == 0 ||
qtable->quantval[Q30_POS] == 0)
return FALSE;
/* DC values must be at least partly known for all components. */
coef_bits = cinfo->coef_bits[ci];
prev_coef_bits = cinfo->coef_bits[ci + cinfo->num_components];
if (coef_bits[0] < 0)
return FALSE;
coef_bits_latch[0] = coef_bits[0];
/* Block smoothing is helpful if some AC coefficients remain inaccurate. */
for (coefi = 1; coefi <= 5; coefi++) {
for (coefi = 1; coefi < SAVED_COEFS; coefi++) {
if (cinfo->input_scan_number > 1)
prev_coef_bits_latch[coefi] = prev_coef_bits[coefi];
else
prev_coef_bits_latch[coefi] = -1;
coef_bits_latch[coefi] = coef_bits[coefi];
if (coef_bits[coefi] != 0)
smoothing_useful = TRUE;
}
coef_bits_latch += SAVED_COEFS;
prev_coef_bits_latch += SAVED_COEFS;
}
return smoothing_useful;
@ -412,17 +432,20 @@ decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
JDIMENSION block_num, last_block_column;
int ci, block_row, block_rows, access_rows;
JBLOCKARRAY buffer;
JBLOCKROW buffer_ptr, prev_block_row, next_block_row;
JBLOCKROW buffer_ptr, prev_prev_block_row, prev_block_row;
JBLOCKROW next_block_row, next_next_block_row;
JSAMPARRAY output_ptr;
JDIMENSION output_col;
jpeg_component_info *compptr;
inverse_DCT_method_ptr inverse_DCT;
boolean first_row, last_row;
boolean change_dc;
JCOEF *workspace;
int *coef_bits;
JQUANT_TBL *quanttbl;
JLONG Q00, Q01, Q02, Q10, Q11, Q20, num;
int DC1, DC2, DC3, DC4, DC5, DC6, DC7, DC8, DC9;
JLONG Q00, Q01, Q02, Q03 = 0, Q10, Q11, Q12 = 0, Q20, Q21 = 0, Q30 = 0, num;
int DC01, DC02, DC03, DC04, DC05, DC06, DC07, DC08, DC09, DC10, DC11, DC12,
DC13, DC14, DC15, DC16, DC17, DC18, DC19, DC20, DC21, DC22, DC23, DC24,
DC25;
int Al, pred;
/* Keep a local variable to avoid looking it up more than once */
@ -434,10 +457,10 @@ decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
if (cinfo->input_scan_number == cinfo->output_scan_number) {
/* If input is working on current scan, we ordinarily want it to
* have completed the current row. But if input scan is DC,
* we want it to keep one row ahead so that next block row's DC
* we want it to keep two rows ahead so that next two block rows' DC
* values are up to date.
*/
JDIMENSION delta = (cinfo->Ss == 0) ? 1 : 0;
JDIMENSION delta = (cinfo->Ss == 0) ? 2 : 0;
if (cinfo->input_iMCU_row > cinfo->output_iMCU_row + delta)
break;
}
@ -452,34 +475,53 @@ decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
if (!compptr->component_needed)
continue;
/* Count non-dummy DCT block rows in this iMCU row. */
if (cinfo->output_iMCU_row < last_iMCU_row) {
if (cinfo->output_iMCU_row < last_iMCU_row - 1) {
block_rows = compptr->v_samp_factor;
access_rows = block_rows * 3; /* this and next two iMCU rows */
} else if (cinfo->output_iMCU_row < last_iMCU_row) {
block_rows = compptr->v_samp_factor;
access_rows = block_rows * 2; /* this and next iMCU row */
last_row = FALSE;
} else {
/* NB: can't use last_row_height here; it is input-side-dependent! */
block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
if (block_rows == 0) block_rows = compptr->v_samp_factor;
access_rows = block_rows; /* this iMCU row only */
last_row = TRUE;
}
/* Align the virtual buffer for this component. */
if (cinfo->output_iMCU_row > 0) {
access_rows += compptr->v_samp_factor; /* prior iMCU row too */
if (cinfo->output_iMCU_row > 1) {
access_rows += 2 * compptr->v_samp_factor; /* prior two iMCU rows too */
buffer = (*cinfo->mem->access_virt_barray)
((j_common_ptr)cinfo, coef->whole_image[ci],
(cinfo->output_iMCU_row - 2) * compptr->v_samp_factor,
(JDIMENSION)access_rows, FALSE);
buffer += 2 * compptr->v_samp_factor; /* point to current iMCU row */
} else if (cinfo->output_iMCU_row > 0) {
buffer = (*cinfo->mem->access_virt_barray)
((j_common_ptr)cinfo, coef->whole_image[ci],
(cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
(JDIMENSION)access_rows, FALSE);
buffer += compptr->v_samp_factor; /* point to current iMCU row */
first_row = FALSE;
} else {
buffer = (*cinfo->mem->access_virt_barray)
((j_common_ptr)cinfo, coef->whole_image[ci],
(JDIMENSION)0, (JDIMENSION)access_rows, FALSE);
first_row = TRUE;
}
/* Fetch component-dependent info */
coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS);
/* Fetch component-dependent info.
* If the current scan is incomplete, then we use the component-dependent
* info from the previous scan.
*/
if (cinfo->output_iMCU_row > cinfo->master->last_good_iMCU_row)
coef_bits =
coef->coef_bits_latch + ((ci + cinfo->num_components) * SAVED_COEFS);
else
coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS);
/* We only do DC interpolation if no AC coefficient data is available. */
change_dc =
coef_bits[1] == -1 && coef_bits[2] == -1 && coef_bits[3] == -1 &&
coef_bits[4] == -1 && coef_bits[5] == -1 && coef_bits[6] == -1 &&
coef_bits[7] == -1 && coef_bits[8] == -1 && coef_bits[9] == -1;
quanttbl = compptr->quant_table;
Q00 = quanttbl->quantval[0];
Q01 = quanttbl->quantval[Q01_POS];
@ -487,25 +529,51 @@ decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
Q20 = quanttbl->quantval[Q20_POS];
Q11 = quanttbl->quantval[Q11_POS];
Q02 = quanttbl->quantval[Q02_POS];
if (change_dc) {
Q03 = quanttbl->quantval[Q03_POS];
Q12 = quanttbl->quantval[Q12_POS];
Q21 = quanttbl->quantval[Q21_POS];
Q30 = quanttbl->quantval[Q30_POS];
}
inverse_DCT = cinfo->idct->inverse_DCT[ci];
output_ptr = output_buf[ci];
/* Loop over all DCT blocks to be processed. */
for (block_row = 0; block_row < block_rows; block_row++) {
buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
if (first_row && block_row == 0)
if (block_row > 0 || cinfo->output_iMCU_row > 0)
prev_block_row =
buffer[block_row - 1] + cinfo->master->first_MCU_col[ci];
else
prev_block_row = buffer_ptr;
if (block_row > 1 || cinfo->output_iMCU_row > 1)
prev_prev_block_row =
buffer[block_row - 2] + cinfo->master->first_MCU_col[ci];
else
prev_prev_block_row = prev_block_row;
if (block_row < block_rows - 1 || cinfo->output_iMCU_row < last_iMCU_row)
next_block_row =
buffer[block_row + 1] + cinfo->master->first_MCU_col[ci];
else
prev_block_row = buffer[block_row - 1];
if (last_row && block_row == block_rows - 1)
next_block_row = buffer_ptr;
if (block_row < block_rows - 2 ||
cinfo->output_iMCU_row < last_iMCU_row - 1)
next_next_block_row =
buffer[block_row + 2] + cinfo->master->first_MCU_col[ci];
else
next_block_row = buffer[block_row + 1];
next_next_block_row = next_block_row;
/* We fetch the surrounding DC values using a sliding-register approach.
* Initialize all nine here so as to do the right thing on narrow pics.
* Initialize all 25 here so as to do the right thing on narrow pics.
*/
DC1 = DC2 = DC3 = (int)prev_block_row[0][0];
DC4 = DC5 = DC6 = (int)buffer_ptr[0][0];
DC7 = DC8 = DC9 = (int)next_block_row[0][0];
DC01 = DC02 = DC03 = DC04 = DC05 = (int)prev_prev_block_row[0][0];
DC06 = DC07 = DC08 = DC09 = DC10 = (int)prev_block_row[0][0];
DC11 = DC12 = DC13 = DC14 = DC15 = (int)buffer_ptr[0][0];
DC16 = DC17 = DC18 = DC19 = DC20 = (int)next_block_row[0][0];
DC21 = DC22 = DC23 = DC24 = DC25 = (int)next_next_block_row[0][0];
output_col = 0;
last_block_column = compptr->width_in_blocks - 1;
for (block_num = cinfo->master->first_MCU_col[ci];
@ -513,18 +581,39 @@ decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
/* Fetch current DCT block into workspace so we can modify it. */
jcopy_block_row(buffer_ptr, (JBLOCKROW)workspace, (JDIMENSION)1);
/* Update DC values */
if (block_num < last_block_column) {
DC3 = (int)prev_block_row[1][0];
DC6 = (int)buffer_ptr[1][0];
DC9 = (int)next_block_row[1][0];
if (block_num == cinfo->master->first_MCU_col[ci] &&
block_num < last_block_column) {
DC04 = (int)prev_prev_block_row[1][0];
DC09 = (int)prev_block_row[1][0];
DC14 = (int)buffer_ptr[1][0];
DC19 = (int)next_block_row[1][0];
DC24 = (int)next_next_block_row[1][0];
}
/* Compute coefficient estimates per K.8.
* An estimate is applied only if coefficient is still zero,
* and is not known to be fully accurate.
if (block_num + 1 < last_block_column) {
DC05 = (int)prev_prev_block_row[2][0];
DC10 = (int)prev_block_row[2][0];
DC15 = (int)buffer_ptr[2][0];
DC20 = (int)next_block_row[2][0];
DC25 = (int)next_next_block_row[2][0];
}
/* If DC interpolation is enabled, compute coefficient estimates using
* a Gaussian-like kernel, keeping the averages of the DC values.
*
* If DC interpolation is disabled, compute coefficient estimates using
* an algorithm similar to the one described in Section K.8 of the JPEG
* standard, except applied to a 5x5 window rather than a 3x3 window.
*
* An estimate is applied only if the coefficient is still zero and is
* not known to be fully accurate.
*/
/* AC01 */
if ((Al = coef_bits[1]) != 0 && workspace[1] == 0) {
num = 36 * Q00 * (DC4 - DC6);
num = Q00 * (change_dc ?
(-DC01 - DC02 + DC04 + DC05 - 3 * DC06 + 13 * DC07 -
13 * DC09 + 3 * DC10 - 3 * DC11 + 38 * DC12 - 38 * DC14 +
3 * DC15 - 3 * DC16 + 13 * DC17 - 13 * DC19 + 3 * DC20 -
DC21 - DC22 + DC24 + DC25) :
(-7 * DC11 + 50 * DC12 - 50 * DC14 + 7 * DC15));
if (num >= 0) {
pred = (int)(((Q01 << 7) + num) / (Q01 << 8));
if (Al > 0 && pred >= (1 << Al))
@ -539,7 +628,12 @@ decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
}
/* AC10 */
if ((Al = coef_bits[2]) != 0 && workspace[8] == 0) {
num = 36 * Q00 * (DC2 - DC8);
num = Q00 * (change_dc ?
(-DC01 - 3 * DC02 - 3 * DC03 - 3 * DC04 - DC05 - DC06 +
13 * DC07 + 38 * DC08 + 13 * DC09 - DC10 + DC16 -
13 * DC17 - 38 * DC18 - 13 * DC19 + DC20 + DC21 +
3 * DC22 + 3 * DC23 + 3 * DC24 + DC25) :
(-7 * DC03 + 50 * DC08 - 50 * DC18 + 7 * DC23));
if (num >= 0) {
pred = (int)(((Q10 << 7) + num) / (Q10 << 8));
if (Al > 0 && pred >= (1 << Al))
@ -554,7 +648,10 @@ decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
}
/* AC20 */
if ((Al = coef_bits[3]) != 0 && workspace[16] == 0) {
num = 9 * Q00 * (DC2 + DC8 - 2 * DC5);
num = Q00 * (change_dc ?
(DC03 + 2 * DC07 + 7 * DC08 + 2 * DC09 - 5 * DC12 - 14 * DC13 -
5 * DC14 + 2 * DC17 + 7 * DC18 + 2 * DC19 + DC23) :
(-DC03 + 13 * DC08 - 24 * DC13 + 13 * DC18 - DC23));
if (num >= 0) {
pred = (int)(((Q20 << 7) + num) / (Q20 << 8));
if (Al > 0 && pred >= (1 << Al))
@ -569,7 +666,11 @@ decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
}
/* AC11 */
if ((Al = coef_bits[4]) != 0 && workspace[9] == 0) {
num = 5 * Q00 * (DC1 - DC3 - DC7 + DC9);
num = Q00 * (change_dc ?
(-DC01 + DC05 + 9 * DC07 - 9 * DC09 - 9 * DC17 +
9 * DC19 + DC21 - DC25) :
(DC10 + DC16 - 10 * DC17 + 10 * DC19 - DC02 - DC20 + DC22 -
DC24 + DC04 - DC06 + 10 * DC07 - 10 * DC09));
if (num >= 0) {
pred = (int)(((Q11 << 7) + num) / (Q11 << 8));
if (Al > 0 && pred >= (1 << Al))
@ -584,7 +685,10 @@ decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
}
/* AC02 */
if ((Al = coef_bits[5]) != 0 && workspace[2] == 0) {
num = 9 * Q00 * (DC4 + DC6 - 2 * DC5);
num = Q00 * (change_dc ?
(2 * DC07 - 5 * DC08 + 2 * DC09 + DC11 + 7 * DC12 - 14 * DC13 +
7 * DC14 + DC15 + 2 * DC17 - 5 * DC18 + 2 * DC19) :
(-DC11 + 13 * DC12 - 24 * DC13 + 13 * DC14 - DC15));
if (num >= 0) {
pred = (int)(((Q02 << 7) + num) / (Q02 << 8));
if (Al > 0 && pred >= (1 << Al))
@ -597,14 +701,96 @@ decompress_smooth_data(j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
}
workspace[2] = (JCOEF)pred;
}
if (change_dc) {
/* AC03 */
if ((Al = coef_bits[6]) != 0 && workspace[3] == 0) {
num = Q00 * (DC07 - DC09 + 2 * DC12 - 2 * DC14 + DC17 - DC19);
if (num >= 0) {
pred = (int)(((Q03 << 7) + num) / (Q03 << 8));
if (Al > 0 && pred >= (1 << Al))
pred = (1 << Al) - 1;
} else {
pred = (int)(((Q03 << 7) - num) / (Q03 << 8));
if (Al > 0 && pred >= (1 << Al))
pred = (1 << Al) - 1;
pred = -pred;
}
workspace[3] = (JCOEF)pred;
}
/* AC12 */
if ((Al = coef_bits[7]) != 0 && workspace[10] == 0) {
num = Q00 * (DC07 - 3 * DC08 + DC09 - DC17 + 3 * DC18 - DC19);
if (num >= 0) {
pred = (int)(((Q12 << 7) + num) / (Q12 << 8));
if (Al > 0 && pred >= (1 << Al))
pred = (1 << Al) - 1;
} else {
pred = (int)(((Q12 << 7) - num) / (Q12 << 8));
if (Al > 0 && pred >= (1 << Al))
pred = (1 << Al) - 1;
pred = -pred;
}
workspace[10] = (JCOEF)pred;
}
/* AC21 */
if ((Al = coef_bits[8]) != 0 && workspace[17] == 0) {
num = Q00 * (DC07 - DC09 - 3 * DC12 + 3 * DC14 + DC17 - DC19);
if (num >= 0) {
pred = (int)(((Q21 << 7) + num) / (Q21 << 8));
if (Al > 0 && pred >= (1 << Al))
pred = (1 << Al) - 1;
} else {
pred = (int)(((Q21 << 7) - num) / (Q21 << 8));
if (Al > 0 && pred >= (1 << Al))
pred = (1 << Al) - 1;
pred = -pred;
}
workspace[17] = (JCOEF)pred;
}
/* AC30 */
if ((Al = coef_bits[9]) != 0 && workspace[24] == 0) {
num = Q00 * (DC07 + 2 * DC08 + DC09 - DC17 - 2 * DC18 - DC19);
if (num >= 0) {
pred = (int)(((Q30 << 7) + num) / (Q30 << 8));
if (Al > 0 && pred >= (1 << Al))
pred = (1 << Al) - 1;
} else {
pred = (int)(((Q30 << 7) - num) / (Q30 << 8));
if (Al > 0 && pred >= (1 << Al))
pred = (1 << Al) - 1;
pred = -pred;
}
workspace[24] = (JCOEF)pred;
}
/* coef_bits[0] is non-negative. Otherwise this function would not
* be called.
*/
num = Q00 *
(-2 * DC01 - 6 * DC02 - 8 * DC03 - 6 * DC04 - 2 * DC05 -
6 * DC06 + 6 * DC07 + 42 * DC08 + 6 * DC09 - 6 * DC10 -
8 * DC11 + 42 * DC12 + 152 * DC13 + 42 * DC14 - 8 * DC15 -
6 * DC16 + 6 * DC17 + 42 * DC18 + 6 * DC19 - 6 * DC20 -
2 * DC21 - 6 * DC22 - 8 * DC23 - 6 * DC24 - 2 * DC25);
if (num >= 0) {
pred = (int)(((Q00 << 7) + num) / (Q00 << 8));
} else {
pred = (int)(((Q00 << 7) - num) / (Q00 << 8));
pred = -pred;
}
workspace[0] = (JCOEF)pred;
} /* change_dc */
/* OK, do the IDCT */
(*inverse_DCT) (cinfo, compptr, (JCOEFPTR)workspace, output_ptr,
output_col);
/* Advance for next column */
DC1 = DC2; DC2 = DC3;
DC4 = DC5; DC5 = DC6;
DC7 = DC8; DC8 = DC9;
buffer_ptr++, prev_block_row++, next_block_row++;
DC01 = DC02; DC02 = DC03; DC03 = DC04; DC04 = DC05;
DC06 = DC07; DC07 = DC08; DC08 = DC09; DC09 = DC10;
DC11 = DC12; DC12 = DC13; DC13 = DC14; DC14 = DC15;
DC16 = DC17; DC17 = DC18; DC18 = DC19; DC19 = DC20;
DC21 = DC22; DC22 = DC23; DC23 = DC24; DC24 = DC25;
buffer_ptr++, prev_block_row++, next_block_row++,
prev_prev_block_row++, next_next_block_row++;
output_col += compptr->_DCT_scaled_size;
}
output_ptr += compptr->_DCT_scaled_size;
@ -653,7 +839,7 @@ jinit_d_coef_controller(j_decompress_ptr cinfo, boolean need_full_buffer)
#ifdef BLOCK_SMOOTHING_SUPPORTED
/* If block smoothing could be used, need a bigger window */
if (cinfo->progressive_mode)
access_rows *= 3;
access_rows *= 5;
#endif
coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,

View File

@ -5,6 +5,7 @@
* Copyright (C) 1994-1997, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2020, Google, Inc.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*/
@ -51,7 +52,7 @@ typedef struct {
#ifdef BLOCK_SMOOTHING_SUPPORTED
/* When doing block smoothing, we latch coefficient Al values here */
int *coef_bits_latch;
#define SAVED_COEFS 6 /* we save coef_bits[0..5] */
#define SAVED_COEFS 10 /* we save coef_bits[0..9] */
#endif
} my_coef_controller;

View File

@ -45,9 +45,9 @@ ycc_rgb565_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
outptr = *output_buf++;
if (PACK_NEED_ALIGNMENT(outptr)) {
y = GETJSAMPLE(*inptr0++);
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
y = *inptr0++;
cb = *inptr1++;
cr = *inptr2++;
r = range_limit[y + Crrtab[cr]];
g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
SCALEBITS))];
@ -58,18 +58,18 @@ ycc_rgb565_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
num_cols--;
}
for (col = 0; col < (num_cols >> 1); col++) {
y = GETJSAMPLE(*inptr0++);
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
y = *inptr0++;
cb = *inptr1++;
cr = *inptr2++;
r = range_limit[y + Crrtab[cr]];
g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
SCALEBITS))];
b = range_limit[y + Cbbtab[cb]];
rgb = PACK_SHORT_565(r, g, b);
y = GETJSAMPLE(*inptr0++);
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
y = *inptr0++;
cb = *inptr1++;
cr = *inptr2++;
r = range_limit[y + Crrtab[cr]];
g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
SCALEBITS))];
@ -80,9 +80,9 @@ ycc_rgb565_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
outptr += 4;
}
if (num_cols & 1) {
y = GETJSAMPLE(*inptr0);
cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2);
y = *inptr0;
cb = *inptr1;
cr = *inptr2;
r = range_limit[y + Crrtab[cr]];
g = range_limit[y + ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
SCALEBITS))];
@ -125,9 +125,9 @@ ycc_rgb565D_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
input_row++;
outptr = *output_buf++;
if (PACK_NEED_ALIGNMENT(outptr)) {
y = GETJSAMPLE(*inptr0++);
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
y = *inptr0++;
cb = *inptr1++;
cr = *inptr2++;
r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)];
g = range_limit[DITHER_565_G(y +
((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
@ -139,9 +139,9 @@ ycc_rgb565D_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
num_cols--;
}
for (col = 0; col < (num_cols >> 1); col++) {
y = GETJSAMPLE(*inptr0++);
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
y = *inptr0++;
cb = *inptr1++;
cr = *inptr2++;
r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)];
g = range_limit[DITHER_565_G(y +
((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
@ -150,9 +150,9 @@ ycc_rgb565D_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
d0 = DITHER_ROTATE(d0);
rgb = PACK_SHORT_565(r, g, b);
y = GETJSAMPLE(*inptr0++);
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
y = *inptr0++;
cb = *inptr1++;
cr = *inptr2++;
r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)];
g = range_limit[DITHER_565_G(y +
((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
@ -165,9 +165,9 @@ ycc_rgb565D_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
outptr += 4;
}
if (num_cols & 1) {
y = GETJSAMPLE(*inptr0);
cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2);
y = *inptr0;
cb = *inptr1;
cr = *inptr2;
r = range_limit[DITHER_565_R(y + Crrtab[cr], d0)];
g = range_limit[DITHER_565_G(y +
((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
@ -202,32 +202,32 @@ rgb_rgb565_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
input_row++;
outptr = *output_buf++;
if (PACK_NEED_ALIGNMENT(outptr)) {
r = GETJSAMPLE(*inptr0++);
g = GETJSAMPLE(*inptr1++);
b = GETJSAMPLE(*inptr2++);
r = *inptr0++;
g = *inptr1++;
b = *inptr2++;
rgb = PACK_SHORT_565(r, g, b);
*(INT16 *)outptr = (INT16)rgb;
outptr += 2;
num_cols--;
}
for (col = 0; col < (num_cols >> 1); col++) {
r = GETJSAMPLE(*inptr0++);
g = GETJSAMPLE(*inptr1++);
b = GETJSAMPLE(*inptr2++);
r = *inptr0++;
g = *inptr1++;
b = *inptr2++;
rgb = PACK_SHORT_565(r, g, b);
r = GETJSAMPLE(*inptr0++);
g = GETJSAMPLE(*inptr1++);
b = GETJSAMPLE(*inptr2++);
r = *inptr0++;
g = *inptr1++;
b = *inptr2++;
rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b));
WRITE_TWO_ALIGNED_PIXELS(outptr, rgb);
outptr += 4;
}
if (num_cols & 1) {
r = GETJSAMPLE(*inptr0);
g = GETJSAMPLE(*inptr1);
b = GETJSAMPLE(*inptr2);
r = *inptr0;
g = *inptr1;
b = *inptr2;
rgb = PACK_SHORT_565(r, g, b);
*(INT16 *)outptr = (INT16)rgb;
}
@ -259,24 +259,24 @@ rgb_rgb565D_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
input_row++;
outptr = *output_buf++;
if (PACK_NEED_ALIGNMENT(outptr)) {
r = range_limit[DITHER_565_R(GETJSAMPLE(*inptr0++), d0)];
g = range_limit[DITHER_565_G(GETJSAMPLE(*inptr1++), d0)];
b = range_limit[DITHER_565_B(GETJSAMPLE(*inptr2++), d0)];
r = range_limit[DITHER_565_R(*inptr0++, d0)];
g = range_limit[DITHER_565_G(*inptr1++, d0)];
b = range_limit[DITHER_565_B(*inptr2++, d0)];
rgb = PACK_SHORT_565(r, g, b);
*(INT16 *)outptr = (INT16)rgb;
outptr += 2;
num_cols--;
}
for (col = 0; col < (num_cols >> 1); col++) {
r = range_limit[DITHER_565_R(GETJSAMPLE(*inptr0++), d0)];
g = range_limit[DITHER_565_G(GETJSAMPLE(*inptr1++), d0)];
b = range_limit[DITHER_565_B(GETJSAMPLE(*inptr2++), d0)];
r = range_limit[DITHER_565_R(*inptr0++, d0)];
g = range_limit[DITHER_565_G(*inptr1++, d0)];
b = range_limit[DITHER_565_B(*inptr2++, d0)];
d0 = DITHER_ROTATE(d0);
rgb = PACK_SHORT_565(r, g, b);
r = range_limit[DITHER_565_R(GETJSAMPLE(*inptr0++), d0)];
g = range_limit[DITHER_565_G(GETJSAMPLE(*inptr1++), d0)];
b = range_limit[DITHER_565_B(GETJSAMPLE(*inptr2++), d0)];
r = range_limit[DITHER_565_R(*inptr0++, d0)];
g = range_limit[DITHER_565_G(*inptr1++, d0)];
b = range_limit[DITHER_565_B(*inptr2++, d0)];
d0 = DITHER_ROTATE(d0);
rgb = PACK_TWO_PIXELS(rgb, PACK_SHORT_565(r, g, b));
@ -284,9 +284,9 @@ rgb_rgb565D_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
outptr += 4;
}
if (num_cols & 1) {
r = range_limit[DITHER_565_R(GETJSAMPLE(*inptr0), d0)];
g = range_limit[DITHER_565_G(GETJSAMPLE(*inptr1), d0)];
b = range_limit[DITHER_565_B(GETJSAMPLE(*inptr2), d0)];
r = range_limit[DITHER_565_R(*inptr0, d0)];
g = range_limit[DITHER_565_G(*inptr1, d0)];
b = range_limit[DITHER_565_B(*inptr2, d0)];
rgb = PACK_SHORT_565(r, g, b);
*(INT16 *)outptr = (INT16)rgb;
}

View File

@ -53,9 +53,9 @@ ycc_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
input_row++;
outptr = *output_buf++;
for (col = 0; col < num_cols; col++) {
y = GETJSAMPLE(inptr0[col]);
cb = GETJSAMPLE(inptr1[col]);
cr = GETJSAMPLE(inptr2[col]);
y = inptr0[col];
cb = inptr1[col];
cr = inptr2[col];
/* Range-limiting is essential due to noise introduced by DCT losses. */
outptr[RGB_RED] = range_limit[y + Crrtab[cr]];
outptr[RGB_GREEN] = range_limit[y +
@ -93,7 +93,6 @@ gray_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
inptr = input_buf[0][input_row++];
outptr = *output_buf++;
for (col = 0; col < num_cols; col++) {
/* We can dispense with GETJSAMPLE() here */
outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col];
/* Set unused byte to 0xFF so it can be interpreted as an opaque */
/* alpha channel value */
@ -128,7 +127,6 @@ rgb_rgb_convert_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
input_row++;
outptr = *output_buf++;
for (col = 0; col < num_cols; col++) {
/* We can dispense with GETJSAMPLE() here */
outptr[RGB_RED] = inptr0[col];
outptr[RGB_GREEN] = inptr1[col];
outptr[RGB_BLUE] = inptr2[col];

View File

@ -341,9 +341,9 @@ rgb_gray_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
input_row++;
outptr = *output_buf++;
for (col = 0; col < num_cols; col++) {
r = GETJSAMPLE(inptr0[col]);
g = GETJSAMPLE(inptr1[col]);
b = GETJSAMPLE(inptr2[col]);
r = inptr0[col];
g = inptr1[col];
b = inptr2[col];
/* Y */
outptr[col] = (JSAMPLE)((ctab[r + R_Y_OFF] + ctab[g + G_Y_OFF] +
ctab[b + B_Y_OFF]) >> SCALEBITS);
@ -550,9 +550,9 @@ ycck_cmyk_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
input_row++;
outptr = *output_buf++;
for (col = 0; col < num_cols; col++) {
y = GETJSAMPLE(inptr0[col]);
cb = GETJSAMPLE(inptr1[col]);
cr = GETJSAMPLE(inptr2[col]);
y = inptr0[col];
cb = inptr1[col];
cr = inptr2[col];
/* Range-limiting is essential due to noise introduced by DCT losses. */
outptr[0] = range_limit[MAXJSAMPLE - (y + Crrtab[cr])]; /* red */
outptr[1] = range_limit[MAXJSAMPLE - (y + /* green */
@ -560,7 +560,7 @@ ycck_cmyk_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
SCALEBITS)))];
outptr[2] = range_limit[MAXJSAMPLE - (y + Cbbtab[cb])]; /* blue */
/* K passes through unchanged */
outptr[3] = inptr3[col]; /* don't need GETJSAMPLE here */
outptr[3] = inptr3[col];
outptr += 4;
}
}
@ -571,11 +571,10 @@ ycck_cmyk_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
* RGB565 conversion
*/
#define PACK_SHORT_565_LE(r, g, b) ((((r) << 8) & 0xF800) | \
(((g) << 3) & 0x7E0) | ((b) >> 3))
#define PACK_SHORT_565_BE(r, g, b) (((r) & 0xF8) | ((g) >> 5) | \
(((g) << 11) & 0xE000) | \
(((b) << 5) & 0x1F00))
#define PACK_SHORT_565_LE(r, g, b) \
((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
#define PACK_SHORT_565_BE(r, g, b) \
(((r) & 0xF8) | ((g) >> 5) | (((g) << 11) & 0xE000) | (((b) << 5) & 0x1F00))
#define PACK_TWO_PIXELS_LE(l, r) ((r << 16) | l)
#define PACK_TWO_PIXELS_BE(l, r) ((l << 16) | r)
@ -592,7 +591,7 @@ ycck_cmyk_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
/* Declarations for ordered dithering
*
* We use a 4x4 ordered dither array packed into 32 bits. This array is
* sufficent for dithering RGB888 to RGB565.
* sufficient for dithering RGB888 to RGB565.
*/
#define DITHER_MASK 0x3

View File

@ -4,7 +4,8 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1997, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright (C) 2009-2011, 2016, 2018, D. R. Commander.
* Copyright (C) 2009-2011, 2016, 2018-2019, D. R. Commander.
* Copyright (C) 2018, Matthias Räncker.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -39,24 +40,6 @@ typedef struct {
int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
} savable_state;
/* This macro is to work around compilers with missing or broken
* structure assignment. You'll need to fix this code if you have
* such a compiler and you change MAX_COMPS_IN_SCAN.
*/
#ifndef NO_STRUCT_ASSIGN
#define ASSIGN_STATE(dest, src) ((dest) = (src))
#else
#if MAX_COMPS_IN_SCAN == 4
#define ASSIGN_STATE(dest, src) \
((dest).last_dc_val[0] = (src).last_dc_val[0], \
(dest).last_dc_val[1] = (src).last_dc_val[1], \
(dest).last_dc_val[2] = (src).last_dc_val[2], \
(dest).last_dc_val[3] = (src).last_dc_val[3])
#endif
#endif
typedef struct {
struct jpeg_entropy_decoder pub; /* public fields */
@ -325,7 +308,7 @@ jpeg_fill_bit_buffer(bitread_working_state *state,
bytes_in_buffer = cinfo->src->bytes_in_buffer;
}
bytes_in_buffer--;
c = GETJOCTET(*next_input_byte++);
c = *next_input_byte++;
/* If it's 0xFF, check and discard stuffed zero byte */
if (c == 0xFF) {
@ -342,7 +325,7 @@ jpeg_fill_bit_buffer(bitread_working_state *state,
bytes_in_buffer = cinfo->src->bytes_in_buffer;
}
bytes_in_buffer--;
c = GETJOCTET(*next_input_byte++);
c = *next_input_byte++;
} while (c == 0xFF);
if (c == 0) {
@ -405,8 +388,8 @@ no_more_bytes:
#define GET_BYTE { \
register int c0, c1; \
c0 = GETJOCTET(*buffer++); \
c1 = GETJOCTET(*buffer); \
c0 = *buffer++; \
c1 = *buffer; \
/* Pre-execute most common case */ \
get_buffer = (get_buffer << 8) | c0; \
bits_left += 8; \
@ -423,7 +406,7 @@ no_more_bytes:
} \
}
#if SIZEOF_SIZE_T == 8 || defined(_WIN64)
#if SIZEOF_SIZE_T == 8 || defined(_WIN64) || (defined(__x86_64__) && defined(__ILP32__))
/* Pre-fetch 48 bytes, because the holding register is 64-bit */
#define FILL_BIT_BUFFER_FAST \
@ -557,6 +540,12 @@ process_restart(j_decompress_ptr cinfo)
}
#if defined(__has_feature)
#if __has_feature(undefined_behavior_sanitizer)
__attribute__((no_sanitize("signed-integer-overflow"),
no_sanitize("unsigned-integer-overflow")))
#endif
#endif
LOCAL(boolean)
decode_mcu_slow(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
@ -568,7 +557,7 @@ decode_mcu_slow(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
/* Load up working state */
BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
ASSIGN_STATE(state, entropy->saved);
state = entropy->saved;
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
@ -589,6 +578,14 @@ decode_mcu_slow(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
if (entropy->dc_needed[blkn]) {
/* Convert DC difference to actual value, update last_dc_val */
int ci = cinfo->MCU_membership[blkn];
/* Certain malformed JPEG images produce repeated DC coefficient
* differences of 2047 or -2047, which causes state.last_dc_val[ci] to
* grow until it overflows or underflows a 32-bit signed integer. This
* behavior is, to the best of our understanding, innocuous, and it is
* unclear how to work around it without potentially affecting
* performance. Thus, we (hopefully temporarily) suppress UBSan integer
* overflow errors for this function and decode_mcu_fast().
*/
s += state.last_dc_val[ci];
state.last_dc_val[ci] = s;
if (block) {
@ -649,11 +646,17 @@ decode_mcu_slow(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
/* Completed MCU, so update state */
BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
ASSIGN_STATE(entropy->saved, state);
entropy->saved = state;
return TRUE;
}
#if defined(__has_feature)
#if __has_feature(undefined_behavior_sanitizer)
__attribute__((no_sanitize("signed-integer-overflow"),
no_sanitize("unsigned-integer-overflow")))
#endif
#endif
LOCAL(boolean)
decode_mcu_fast(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
@ -667,7 +670,7 @@ decode_mcu_fast(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
/* Load up working state */
BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
buffer = (JOCTET *)br_state.next_input_byte;
ASSIGN_STATE(state, entropy->saved);
state = entropy->saved;
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
@ -684,6 +687,9 @@ decode_mcu_fast(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
if (entropy->dc_needed[blkn]) {
int ci = cinfo->MCU_membership[blkn];
/* Refer to the comment in decode_mcu_slow() regarding the supression of
* a UBSan integer overflow error in this line of code.
*/
s += state.last_dc_val[ci];
state.last_dc_val[ci] = s;
if (block)
@ -736,7 +742,7 @@ decode_mcu_fast(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte);
br_state.next_input_byte = buffer;
BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
ASSIGN_STATE(entropy->saved, state);
entropy->saved = state;
return TRUE;
}
@ -791,7 +797,8 @@ use_slow:
}
/* Account for restart interval (no-op if not using restarts) */
entropy->restarts_to_go--;
if (cinfo->restart_interval)
entropy->restarts_to_go--;
return TRUE;
}

View File

@ -4,7 +4,8 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1997, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright (C) 2010-2011, 2015-2016, D. R. Commander.
* Copyright (C) 2010-2011, 2015-2016, 2021, D. R. Commander.
* Copyright (C) 2018, Matthias Räncker.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -78,6 +79,11 @@ EXTERN(void) jpeg_make_d_derived_tbl(j_decompress_ptr cinfo, boolean isDC,
typedef size_t bit_buf_type; /* type of bit-extraction buffer */
#define BIT_BUF_SIZE 64 /* size of buffer in bits */
#elif defined(__x86_64__) && defined(__ILP32__)
typedef unsigned long long bit_buf_type; /* type of bit-extraction buffer */
#define BIT_BUF_SIZE 64 /* size of buffer in bits */
#else
typedef unsigned long bit_buf_type; /* type of bit-extraction buffer */
@ -228,7 +234,10 @@ slowlabel: \
s |= GET_BITS(1); \
nb++; \
} \
s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
if (nb > 16) \
s = 0; \
else \
s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
}
/* Out-of-line case for Huffman code fetching */

View File

@ -18,6 +18,7 @@
#include "jinclude.h"
#include "jdmainct.h"
#include "jconfigint.h"
/*
@ -360,7 +361,7 @@ process_data_context_main(j_decompress_ptr cinfo, JSAMPARRAY output_buf,
main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
if (*out_row_ctr >= out_rows_avail)
return; /* Postprocessor exactly filled output buf */
/*FALLTHROUGH*/
FALLTHROUGH /*FALLTHROUGH*/
case CTX_PREPARE_FOR_IMCU:
/* Prepare to process first M-1 row groups of this iMCU row */
main_ptr->rowgroup_ctr = 0;
@ -371,7 +372,7 @@ process_data_context_main(j_decompress_ptr cinfo, JSAMPARRAY output_buf,
if (main_ptr->iMCU_row_ctr == cinfo->total_iMCU_rows)
set_bottom_pointers(cinfo);
main_ptr->context_state = CTX_PROCESS_IMCU;
/*FALLTHROUGH*/
FALLTHROUGH /*FALLTHROUGH*/
case CTX_PROCESS_IMCU:
/* Call postprocessor using previously set pointers */
(*cinfo->post->post_process_data) (cinfo,

View File

@ -151,7 +151,7 @@ typedef my_marker_reader *my_marker_ptr;
#define INPUT_BYTE(cinfo, V, action) \
MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
bytes_in_buffer--; \
V = GETJOCTET(*next_input_byte++); )
V = *next_input_byte++; )
/* As above, but read two bytes interpreted as an unsigned 16-bit integer.
* V should be declared unsigned int or perhaps JLONG.
@ -159,10 +159,10 @@ typedef my_marker_reader *my_marker_ptr;
#define INPUT_2BYTES(cinfo, V, action) \
MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
bytes_in_buffer--; \
V = ((unsigned int)GETJOCTET(*next_input_byte++)) << 8; \
V = ((unsigned int)(*next_input_byte++)) << 8; \
MAKE_BYTE_AVAIL(cinfo, action); \
bytes_in_buffer--; \
V += GETJOCTET(*next_input_byte++); )
V += *next_input_byte++; )
/*
@ -608,18 +608,18 @@ examine_app0(j_decompress_ptr cinfo, JOCTET *data, unsigned int datalen,
JLONG totallen = (JLONG)datalen + remaining;
if (datalen >= APP0_DATA_LEN &&
GETJOCTET(data[0]) == 0x4A &&
GETJOCTET(data[1]) == 0x46 &&
GETJOCTET(data[2]) == 0x49 &&
GETJOCTET(data[3]) == 0x46 &&
GETJOCTET(data[4]) == 0) {
data[0] == 0x4A &&
data[1] == 0x46 &&
data[2] == 0x49 &&
data[3] == 0x46 &&
data[4] == 0) {
/* Found JFIF APP0 marker: save info */
cinfo->saw_JFIF_marker = TRUE;
cinfo->JFIF_major_version = GETJOCTET(data[5]);
cinfo->JFIF_minor_version = GETJOCTET(data[6]);
cinfo->density_unit = GETJOCTET(data[7]);
cinfo->X_density = (GETJOCTET(data[8]) << 8) + GETJOCTET(data[9]);
cinfo->Y_density = (GETJOCTET(data[10]) << 8) + GETJOCTET(data[11]);
cinfo->JFIF_major_version = data[5];
cinfo->JFIF_minor_version = data[6];
cinfo->density_unit = data[7];
cinfo->X_density = (data[8] << 8) + data[9];
cinfo->Y_density = (data[10] << 8) + data[11];
/* Check version.
* Major version must be 1, anything else signals an incompatible change.
* (We used to treat this as an error, but now it's a nonfatal warning,
@ -634,24 +634,22 @@ examine_app0(j_decompress_ptr cinfo, JOCTET *data, unsigned int datalen,
cinfo->JFIF_major_version, cinfo->JFIF_minor_version,
cinfo->X_density, cinfo->Y_density, cinfo->density_unit);
/* Validate thumbnail dimensions and issue appropriate messages */
if (GETJOCTET(data[12]) | GETJOCTET(data[13]))
TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL,
GETJOCTET(data[12]), GETJOCTET(data[13]));
if (data[12] | data[13])
TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, data[12], data[13]);
totallen -= APP0_DATA_LEN;
if (totallen !=
((JLONG)GETJOCTET(data[12]) * (JLONG)GETJOCTET(data[13]) * (JLONG)3))
if (totallen != ((JLONG)data[12] * (JLONG)data[13] * (JLONG)3))
TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int)totallen);
} else if (datalen >= 6 &&
GETJOCTET(data[0]) == 0x4A &&
GETJOCTET(data[1]) == 0x46 &&
GETJOCTET(data[2]) == 0x58 &&
GETJOCTET(data[3]) == 0x58 &&
GETJOCTET(data[4]) == 0) {
data[0] == 0x4A &&
data[1] == 0x46 &&
data[2] == 0x58 &&
data[3] == 0x58 &&
data[4] == 0) {
/* Found JFIF "JFXX" extension APP0 marker */
/* The library doesn't actually do anything with these,
* but we try to produce a helpful trace message.
*/
switch (GETJOCTET(data[5])) {
switch (data[5]) {
case 0x10:
TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (int)totallen);
break;
@ -662,8 +660,7 @@ examine_app0(j_decompress_ptr cinfo, JOCTET *data, unsigned int datalen,
TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (int)totallen);
break;
default:
TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION,
GETJOCTET(data[5]), (int)totallen);
TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION, data[5], (int)totallen);
break;
}
} else {
@ -684,16 +681,16 @@ examine_app14(j_decompress_ptr cinfo, JOCTET *data, unsigned int datalen,
unsigned int version, flags0, flags1, transform;
if (datalen >= APP14_DATA_LEN &&
GETJOCTET(data[0]) == 0x41 &&
GETJOCTET(data[1]) == 0x64 &&
GETJOCTET(data[2]) == 0x6F &&
GETJOCTET(data[3]) == 0x62 &&
GETJOCTET(data[4]) == 0x65) {
data[0] == 0x41 &&
data[1] == 0x64 &&
data[2] == 0x6F &&
data[3] == 0x62 &&
data[4] == 0x65) {
/* Found Adobe APP14 marker */
version = (GETJOCTET(data[5]) << 8) + GETJOCTET(data[6]);
flags0 = (GETJOCTET(data[7]) << 8) + GETJOCTET(data[8]);
flags1 = (GETJOCTET(data[9]) << 8) + GETJOCTET(data[10]);
transform = GETJOCTET(data[11]);
version = (data[5] << 8) + data[6];
flags0 = (data[7] << 8) + data[8];
flags1 = (data[9] << 8) + data[10];
transform = data[11];
TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform);
cinfo->saw_Adobe_marker = TRUE;
cinfo->Adobe_transform = (UINT8)transform;

View File

@ -5,7 +5,7 @@
* Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2002-2009 by Guido Vollbeding.
* libjpeg-turbo Modifications:
* Copyright (C) 2009-2011, 2016, D. R. Commander.
* Copyright (C) 2009-2011, 2016, 2019, D. R. Commander.
* Copyright (C) 2013, Linaro Limited.
* Copyright (C) 2015, Google, Inc.
* For conditions of distribution and use, see the accompanying README.ijg
@ -22,7 +22,6 @@
#include "jpeglib.h"
#include "jpegcomp.h"
#include "jdmaster.h"
#include "jsimd.h"
/*
@ -70,17 +69,6 @@ use_merged_upsample(j_decompress_ptr cinfo)
cinfo->comp_info[1]._DCT_scaled_size != cinfo->_min_DCT_scaled_size ||
cinfo->comp_info[2]._DCT_scaled_size != cinfo->_min_DCT_scaled_size)
return FALSE;
#ifdef WITH_SIMD
/* If YCbCr-to-RGB color conversion is SIMD-accelerated but merged upsampling
isn't, then disabling merged upsampling is likely to be faster when
decompressing YCbCr JPEG images. */
if (!jsimd_can_h2v2_merged_upsample() && !jsimd_can_h2v1_merged_upsample() &&
jsimd_can_ycc_rgb() && cinfo->jpeg_color_space == JCS_YCbCr &&
(cinfo->out_color_space == JCS_RGB ||
(cinfo->out_color_space >= JCS_EXT_RGB &&
cinfo->out_color_space <= JCS_EXT_ARGB)))
return FALSE;
#endif
/* ??? also need to test for upsample-time rescaling, when & if supported */
return TRUE; /* by golly, it'll work... */
#else
@ -580,6 +568,7 @@ master_selection(j_decompress_ptr cinfo)
*/
cinfo->master->first_iMCU_col = 0;
cinfo->master->last_iMCU_col = cinfo->MCUs_per_row - 1;
cinfo->master->last_good_iMCU_row = 0;
#ifdef D_MULTISCAN_FILES_SUPPORTED
/* If jpeg_start_decompress will read the whole file, initialize

View File

@ -5,7 +5,7 @@
* Copyright (C) 1994-1996, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2009, 2011, 2014-2015, D. R. Commander.
* Copyright (C) 2009, 2011, 2014-2015, 2020, D. R. Commander.
* Copyright (C) 2013, Linaro Limited.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
@ -40,41 +40,13 @@
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
#include "jdmerge.h"
#include "jsimd.h"
#include "jconfigint.h"
#ifdef UPSAMPLE_MERGING_SUPPORTED
/* Private subobject */
typedef struct {
struct jpeg_upsampler pub; /* public fields */
/* Pointer to routine to do actual upsampling/conversion of one row group */
void (*upmethod) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf);
/* Private state for YCC->RGB conversion */
int *Cr_r_tab; /* => table for Cr to R conversion */
int *Cb_b_tab; /* => table for Cb to B conversion */
JLONG *Cr_g_tab; /* => table for Cr to G conversion */
JLONG *Cb_g_tab; /* => table for Cb to G conversion */
/* For 2:1 vertical sampling, we produce two output rows at a time.
* We need a "spare" row buffer to hold the second output row if the
* application provides just a one-row buffer; we also use the spare
* to discard the dummy last row if the image height is odd.
*/
JSAMPROW spare_row;
boolean spare_full; /* T if spare buffer is occupied */
JDIMENSION out_row_width; /* samples per output row */
JDIMENSION rows_to_go; /* counts rows remaining in image */
} my_upsampler;
typedef my_upsampler *my_upsample_ptr;
#define SCALEBITS 16 /* speediest right-shift on some machines */
#define ONE_HALF ((JLONG)1 << (SCALEBITS - 1))
#define FIX(x) ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
@ -189,7 +161,7 @@ typedef my_upsampler *my_upsample_ptr;
LOCAL(void)
build_ycc_rgb_table(j_decompress_ptr cinfo)
{
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
int i;
JLONG x;
SHIFT_TEMPS
@ -232,7 +204,7 @@ build_ycc_rgb_table(j_decompress_ptr cinfo)
METHODDEF(void)
start_pass_merged_upsample(j_decompress_ptr cinfo)
{
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
/* Mark the spare buffer empty */
upsample->spare_full = FALSE;
@ -254,7 +226,7 @@ merged_2v_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
/* 2:1 vertical sampling case: may need a spare row. */
{
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
JSAMPROW work_ptrs[2];
JDIMENSION num_rows; /* number of rows returned to caller */
@ -305,7 +277,7 @@ merged_1v_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
/* 1:1 vertical sampling case: much easier, never need a spare row. */
{
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
/* Just do the upsampling. */
(*upsample->upmethod) (cinfo, input_buf, *in_row_group_ctr,
@ -420,17 +392,14 @@ h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
* RGB565 conversion
*/
#define PACK_SHORT_565_LE(r, g, b) ((((r) << 8) & 0xF800) | \
(((g) << 3) & 0x7E0) | ((b) >> 3))
#define PACK_SHORT_565_BE(r, g, b) (((r) & 0xF8) | ((g) >> 5) | \
(((g) << 11) & 0xE000) | \
(((b) << 5) & 0x1F00))
#define PACK_SHORT_565_LE(r, g, b) \
((((r) << 8) & 0xF800) | (((g) << 3) & 0x7E0) | ((b) >> 3))
#define PACK_SHORT_565_BE(r, g, b) \
(((r) & 0xF8) | ((g) >> 5) | (((g) << 11) & 0xE000) | (((b) << 5) & 0x1F00))
#define PACK_TWO_PIXELS_LE(l, r) ((r << 16) | l)
#define PACK_TWO_PIXELS_BE(l, r) ((l << 16) | r)
#define PACK_NEED_ALIGNMENT(ptr) (((size_t)(ptr)) & 3)
#define WRITE_TWO_PIXELS_LE(addr, pixels) { \
((INT16 *)(addr))[0] = (INT16)(pixels); \
((INT16 *)(addr))[1] = (INT16)((pixels) >> 16); \
@ -448,7 +417,7 @@ h2v2_merged_upsample(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
/* Declarations for ordered dithering
*
* We use a 4x4 ordered dither array packed into 32 bits. This array is
* sufficent for dithering RGB888 to RGB565.
* sufficient for dithering RGB888 to RGB565.
*/
#define DITHER_MASK 0x3
@ -568,11 +537,11 @@ h2v2_merged_upsample_565D(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
GLOBAL(void)
jinit_merged_upsampler(j_decompress_ptr cinfo)
{
my_upsample_ptr upsample;
my_merged_upsample_ptr upsample;
upsample = (my_upsample_ptr)
upsample = (my_merged_upsample_ptr)
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
sizeof(my_upsampler));
sizeof(my_merged_upsampler));
cinfo->upsample = (struct jpeg_upsampler *)upsample;
upsample->pub.start_pass = start_pass_merged_upsample;
upsample->pub.need_context_rows = FALSE;

47
src/3rdparty/libjpeg/src/jdmerge.h vendored Normal file
View File

@ -0,0 +1,47 @@
/*
* jdmerge.h
*
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1994-1996, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright (C) 2020, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*/
#define JPEG_INTERNALS
#include "jpeglib.h"
#ifdef UPSAMPLE_MERGING_SUPPORTED
/* Private subobject */
typedef struct {
struct jpeg_upsampler pub; /* public fields */
/* Pointer to routine to do actual upsampling/conversion of one row group */
void (*upmethod) (j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr, JSAMPARRAY output_buf);
/* Private state for YCC->RGB conversion */
int *Cr_r_tab; /* => table for Cr to R conversion */
int *Cb_b_tab; /* => table for Cb to B conversion */
JLONG *Cr_g_tab; /* => table for Cr to G conversion */
JLONG *Cb_g_tab; /* => table for Cb to G conversion */
/* For 2:1 vertical sampling, we produce two output rows at a time.
* We need a "spare" row buffer to hold the second output row if the
* application provides just a one-row buffer; we also use the spare
* to discard the dummy last row if the image height is odd.
*/
JSAMPROW spare_row;
boolean spare_full; /* T if spare buffer is occupied */
JDIMENSION out_row_width; /* samples per output row */
JDIMENSION rows_to_go; /* counts rows remaining in image */
} my_merged_upsampler;
typedef my_merged_upsampler *my_merged_upsample_ptr;
#endif /* UPSAMPLE_MERGING_SUPPORTED */

View File

@ -5,7 +5,7 @@
* Copyright (C) 1994-1996, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright (C) 2013, Linaro Limited.
* Copyright (C) 2014-2015, 2018, D. R. Commander.
* Copyright (C) 2014-2015, 2018, 2020, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -19,7 +19,7 @@ h2v1_merged_upsample_565_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf)
{
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
register int y, cred, cgreen, cblue;
int cb, cr;
register JSAMPROW outptr;
@ -43,20 +43,20 @@ h2v1_merged_upsample_565_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
/* Loop for each pair of output pixels */
for (col = cinfo->output_width >> 1; col > 0; col--) {
/* Do the chroma part of the calculation */
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
cb = *inptr1++;
cr = *inptr2++;
cred = Crrtab[cr];
cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
/* Fetch 2 Y values and emit 2 pixels */
y = GETJSAMPLE(*inptr0++);
y = *inptr0++;
r = range_limit[y + cred];
g = range_limit[y + cgreen];
b = range_limit[y + cblue];
rgb = PACK_SHORT_565(r, g, b);
y = GETJSAMPLE(*inptr0++);
y = *inptr0++;
r = range_limit[y + cred];
g = range_limit[y + cgreen];
b = range_limit[y + cblue];
@ -68,12 +68,12 @@ h2v1_merged_upsample_565_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
/* If image width is odd, do the last output column separately */
if (cinfo->output_width & 1) {
cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2);
cb = *inptr1;
cr = *inptr2;
cred = Crrtab[cr];
cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
y = GETJSAMPLE(*inptr0);
y = *inptr0;
r = range_limit[y + cred];
g = range_limit[y + cgreen];
b = range_limit[y + cblue];
@ -90,7 +90,7 @@ h2v1_merged_upsample_565D_internal(j_decompress_ptr cinfo,
JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf)
{
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
register int y, cred, cgreen, cblue;
int cb, cr;
register JSAMPROW outptr;
@ -115,21 +115,21 @@ h2v1_merged_upsample_565D_internal(j_decompress_ptr cinfo,
/* Loop for each pair of output pixels */
for (col = cinfo->output_width >> 1; col > 0; col--) {
/* Do the chroma part of the calculation */
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
cb = *inptr1++;
cr = *inptr2++;
cred = Crrtab[cr];
cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
/* Fetch 2 Y values and emit 2 pixels */
y = GETJSAMPLE(*inptr0++);
y = *inptr0++;
r = range_limit[DITHER_565_R(y + cred, d0)];
g = range_limit[DITHER_565_G(y + cgreen, d0)];
b = range_limit[DITHER_565_B(y + cblue, d0)];
d0 = DITHER_ROTATE(d0);
rgb = PACK_SHORT_565(r, g, b);
y = GETJSAMPLE(*inptr0++);
y = *inptr0++;
r = range_limit[DITHER_565_R(y + cred, d0)];
g = range_limit[DITHER_565_G(y + cgreen, d0)];
b = range_limit[DITHER_565_B(y + cblue, d0)];
@ -142,12 +142,12 @@ h2v1_merged_upsample_565D_internal(j_decompress_ptr cinfo,
/* If image width is odd, do the last output column separately */
if (cinfo->output_width & 1) {
cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2);
cb = *inptr1;
cr = *inptr2;
cred = Crrtab[cr];
cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
y = GETJSAMPLE(*inptr0);
y = *inptr0;
r = range_limit[DITHER_565_R(y + cred, d0)];
g = range_limit[DITHER_565_G(y + cgreen, d0)];
b = range_limit[DITHER_565_B(y + cblue, d0)];
@ -163,7 +163,7 @@ h2v2_merged_upsample_565_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf)
{
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
register int y, cred, cgreen, cblue;
int cb, cr;
register JSAMPROW outptr0, outptr1;
@ -189,20 +189,20 @@ h2v2_merged_upsample_565_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
/* Loop for each group of output pixels */
for (col = cinfo->output_width >> 1; col > 0; col--) {
/* Do the chroma part of the calculation */
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
cb = *inptr1++;
cr = *inptr2++;
cred = Crrtab[cr];
cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
/* Fetch 4 Y values and emit 4 pixels */
y = GETJSAMPLE(*inptr00++);
y = *inptr00++;
r = range_limit[y + cred];
g = range_limit[y + cgreen];
b = range_limit[y + cblue];
rgb = PACK_SHORT_565(r, g, b);
y = GETJSAMPLE(*inptr00++);
y = *inptr00++;
r = range_limit[y + cred];
g = range_limit[y + cgreen];
b = range_limit[y + cblue];
@ -211,13 +211,13 @@ h2v2_merged_upsample_565_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
WRITE_TWO_PIXELS(outptr0, rgb);
outptr0 += 4;
y = GETJSAMPLE(*inptr01++);
y = *inptr01++;
r = range_limit[y + cred];
g = range_limit[y + cgreen];
b = range_limit[y + cblue];
rgb = PACK_SHORT_565(r, g, b);
y = GETJSAMPLE(*inptr01++);
y = *inptr01++;
r = range_limit[y + cred];
g = range_limit[y + cgreen];
b = range_limit[y + cblue];
@ -229,20 +229,20 @@ h2v2_merged_upsample_565_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
/* If image width is odd, do the last output column separately */
if (cinfo->output_width & 1) {
cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2);
cb = *inptr1;
cr = *inptr2;
cred = Crrtab[cr];
cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
y = GETJSAMPLE(*inptr00);
y = *inptr00;
r = range_limit[y + cred];
g = range_limit[y + cgreen];
b = range_limit[y + cblue];
rgb = PACK_SHORT_565(r, g, b);
*(INT16 *)outptr0 = (INT16)rgb;
y = GETJSAMPLE(*inptr01);
y = *inptr01;
r = range_limit[y + cred];
g = range_limit[y + cgreen];
b = range_limit[y + cblue];
@ -259,7 +259,7 @@ h2v2_merged_upsample_565D_internal(j_decompress_ptr cinfo,
JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf)
{
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
register int y, cred, cgreen, cblue;
int cb, cr;
register JSAMPROW outptr0, outptr1;
@ -287,21 +287,21 @@ h2v2_merged_upsample_565D_internal(j_decompress_ptr cinfo,
/* Loop for each group of output pixels */
for (col = cinfo->output_width >> 1; col > 0; col--) {
/* Do the chroma part of the calculation */
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
cb = *inptr1++;
cr = *inptr2++;
cred = Crrtab[cr];
cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
/* Fetch 4 Y values and emit 4 pixels */
y = GETJSAMPLE(*inptr00++);
y = *inptr00++;
r = range_limit[DITHER_565_R(y + cred, d0)];
g = range_limit[DITHER_565_G(y + cgreen, d0)];
b = range_limit[DITHER_565_B(y + cblue, d0)];
d0 = DITHER_ROTATE(d0);
rgb = PACK_SHORT_565(r, g, b);
y = GETJSAMPLE(*inptr00++);
y = *inptr00++;
r = range_limit[DITHER_565_R(y + cred, d0)];
g = range_limit[DITHER_565_G(y + cgreen, d0)];
b = range_limit[DITHER_565_B(y + cblue, d0)];
@ -311,14 +311,14 @@ h2v2_merged_upsample_565D_internal(j_decompress_ptr cinfo,
WRITE_TWO_PIXELS(outptr0, rgb);
outptr0 += 4;
y = GETJSAMPLE(*inptr01++);
y = *inptr01++;
r = range_limit[DITHER_565_R(y + cred, d1)];
g = range_limit[DITHER_565_G(y + cgreen, d1)];
b = range_limit[DITHER_565_B(y + cblue, d1)];
d1 = DITHER_ROTATE(d1);
rgb = PACK_SHORT_565(r, g, b);
y = GETJSAMPLE(*inptr01++);
y = *inptr01++;
r = range_limit[DITHER_565_R(y + cred, d1)];
g = range_limit[DITHER_565_G(y + cgreen, d1)];
b = range_limit[DITHER_565_B(y + cblue, d1)];
@ -331,20 +331,20 @@ h2v2_merged_upsample_565D_internal(j_decompress_ptr cinfo,
/* If image width is odd, do the last output column separately */
if (cinfo->output_width & 1) {
cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2);
cb = *inptr1;
cr = *inptr2;
cred = Crrtab[cr];
cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
y = GETJSAMPLE(*inptr00);
y = *inptr00;
r = range_limit[DITHER_565_R(y + cred, d0)];
g = range_limit[DITHER_565_G(y + cgreen, d0)];
b = range_limit[DITHER_565_B(y + cblue, d0)];
rgb = PACK_SHORT_565(r, g, b);
*(INT16 *)outptr0 = (INT16)rgb;
y = GETJSAMPLE(*inptr01);
y = *inptr01;
r = range_limit[DITHER_565_R(y + cred, d1)];
g = range_limit[DITHER_565_G(y + cgreen, d1)];
b = range_limit[DITHER_565_B(y + cblue, d1)];

View File

@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1994-1996, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright (C) 2011, 2015, D. R. Commander.
* Copyright (C) 2011, 2015, 2020, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -25,7 +25,7 @@ h2v1_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf)
{
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
register int y, cred, cgreen, cblue;
int cb, cr;
register JSAMPROW outptr;
@ -46,13 +46,13 @@ h2v1_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
/* Loop for each pair of output pixels */
for (col = cinfo->output_width >> 1; col > 0; col--) {
/* Do the chroma part of the calculation */
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
cb = *inptr1++;
cr = *inptr2++;
cred = Crrtab[cr];
cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
/* Fetch 2 Y values and emit 2 pixels */
y = GETJSAMPLE(*inptr0++);
y = *inptr0++;
outptr[RGB_RED] = range_limit[y + cred];
outptr[RGB_GREEN] = range_limit[y + cgreen];
outptr[RGB_BLUE] = range_limit[y + cblue];
@ -60,7 +60,7 @@ h2v1_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
outptr[RGB_ALPHA] = 0xFF;
#endif
outptr += RGB_PIXELSIZE;
y = GETJSAMPLE(*inptr0++);
y = *inptr0++;
outptr[RGB_RED] = range_limit[y + cred];
outptr[RGB_GREEN] = range_limit[y + cgreen];
outptr[RGB_BLUE] = range_limit[y + cblue];
@ -71,12 +71,12 @@ h2v1_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
}
/* If image width is odd, do the last output column separately */
if (cinfo->output_width & 1) {
cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2);
cb = *inptr1;
cr = *inptr2;
cred = Crrtab[cr];
cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
y = GETJSAMPLE(*inptr0);
y = *inptr0;
outptr[RGB_RED] = range_limit[y + cred];
outptr[RGB_GREEN] = range_limit[y + cgreen];
outptr[RGB_BLUE] = range_limit[y + cblue];
@ -97,7 +97,7 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf)
{
my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
my_merged_upsample_ptr upsample = (my_merged_upsample_ptr)cinfo->upsample;
register int y, cred, cgreen, cblue;
int cb, cr;
register JSAMPROW outptr0, outptr1;
@ -120,13 +120,13 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
/* Loop for each group of output pixels */
for (col = cinfo->output_width >> 1; col > 0; col--) {
/* Do the chroma part of the calculation */
cb = GETJSAMPLE(*inptr1++);
cr = GETJSAMPLE(*inptr2++);
cb = *inptr1++;
cr = *inptr2++;
cred = Crrtab[cr];
cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
/* Fetch 4 Y values and emit 4 pixels */
y = GETJSAMPLE(*inptr00++);
y = *inptr00++;
outptr0[RGB_RED] = range_limit[y + cred];
outptr0[RGB_GREEN] = range_limit[y + cgreen];
outptr0[RGB_BLUE] = range_limit[y + cblue];
@ -134,7 +134,7 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
outptr0[RGB_ALPHA] = 0xFF;
#endif
outptr0 += RGB_PIXELSIZE;
y = GETJSAMPLE(*inptr00++);
y = *inptr00++;
outptr0[RGB_RED] = range_limit[y + cred];
outptr0[RGB_GREEN] = range_limit[y + cgreen];
outptr0[RGB_BLUE] = range_limit[y + cblue];
@ -142,7 +142,7 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
outptr0[RGB_ALPHA] = 0xFF;
#endif
outptr0 += RGB_PIXELSIZE;
y = GETJSAMPLE(*inptr01++);
y = *inptr01++;
outptr1[RGB_RED] = range_limit[y + cred];
outptr1[RGB_GREEN] = range_limit[y + cgreen];
outptr1[RGB_BLUE] = range_limit[y + cblue];
@ -150,7 +150,7 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
outptr1[RGB_ALPHA] = 0xFF;
#endif
outptr1 += RGB_PIXELSIZE;
y = GETJSAMPLE(*inptr01++);
y = *inptr01++;
outptr1[RGB_RED] = range_limit[y + cred];
outptr1[RGB_GREEN] = range_limit[y + cgreen];
outptr1[RGB_BLUE] = range_limit[y + cblue];
@ -161,19 +161,19 @@ h2v2_merged_upsample_internal(j_decompress_ptr cinfo, JSAMPIMAGE input_buf,
}
/* If image width is odd, do the last output column separately */
if (cinfo->output_width & 1) {
cb = GETJSAMPLE(*inptr1);
cr = GETJSAMPLE(*inptr2);
cb = *inptr1;
cr = *inptr2;
cred = Crrtab[cr];
cgreen = (int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
cblue = Cbbtab[cb];
y = GETJSAMPLE(*inptr00);
y = *inptr00;
outptr0[RGB_RED] = range_limit[y + cred];
outptr0[RGB_GREEN] = range_limit[y + cgreen];
outptr0[RGB_BLUE] = range_limit[y + cblue];
#ifdef RGB_ALPHA
outptr0[RGB_ALPHA] = 0xFF;
#endif
y = GETJSAMPLE(*inptr01);
y = *inptr01;
outptr1[RGB_RED] = range_limit[y + cred];
outptr1[RGB_GREEN] = range_limit[y + cgreen];
outptr1[RGB_BLUE] = range_limit[y + cblue];

View File

@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1995-1997, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright (C) 2015-2016, 2018, D. R. Commander.
* Copyright (C) 2015-2016, 2018-2021, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -41,25 +41,6 @@ typedef struct {
int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
} savable_state;
/* This macro is to work around compilers with missing or broken
* structure assignment. You'll need to fix this code if you have
* such a compiler and you change MAX_COMPS_IN_SCAN.
*/
#ifndef NO_STRUCT_ASSIGN
#define ASSIGN_STATE(dest, src) ((dest) = (src))
#else
#if MAX_COMPS_IN_SCAN == 4
#define ASSIGN_STATE(dest, src) \
((dest).EOBRUN = (src).EOBRUN, \
(dest).last_dc_val[0] = (src).last_dc_val[0], \
(dest).last_dc_val[1] = (src).last_dc_val[1], \
(dest).last_dc_val[2] = (src).last_dc_val[2], \
(dest).last_dc_val[3] = (src).last_dc_val[3])
#endif
#endif
typedef struct {
struct jpeg_entropy_decoder pub; /* public fields */
@ -102,7 +83,7 @@ start_pass_phuff_decoder(j_decompress_ptr cinfo)
boolean is_DC_band, bad;
int ci, coefi, tbl;
d_derived_tbl **pdtbl;
int *coef_bit_ptr;
int *coef_bit_ptr, *prev_coef_bit_ptr;
jpeg_component_info *compptr;
is_DC_band = (cinfo->Ss == 0);
@ -143,8 +124,15 @@ start_pass_phuff_decoder(j_decompress_ptr cinfo)
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
int cindex = cinfo->cur_comp_info[ci]->component_index;
coef_bit_ptr = &cinfo->coef_bits[cindex][0];
prev_coef_bit_ptr = &cinfo->coef_bits[cindex + cinfo->num_components][0];
if (!is_DC_band && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
if (cinfo->input_scan_number > 1)
prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
else
prev_coef_bit_ptr[coefi] = 0;
}
for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
if (cinfo->Ah != expected)
@ -323,7 +311,7 @@ decode_mcu_DC_first(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
/* Load up working state */
BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
ASSIGN_STATE(state, entropy->saved);
state = entropy->saved;
/* Outer loop handles each block in the MCU */
@ -356,11 +344,12 @@ decode_mcu_DC_first(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
/* Completed MCU, so update state */
BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
ASSIGN_STATE(entropy->saved, state);
entropy->saved = state;
}
/* Account for restart interval (no-op if not using restarts) */
entropy->restarts_to_go--;
if (cinfo->restart_interval)
entropy->restarts_to_go--;
return TRUE;
}
@ -444,7 +433,8 @@ decode_mcu_AC_first(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
}
/* Account for restart interval (no-op if not using restarts) */
entropy->restarts_to_go--;
if (cinfo->restart_interval)
entropy->restarts_to_go--;
return TRUE;
}
@ -495,7 +485,8 @@ decode_mcu_DC_refine(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
/* Account for restart interval (no-op if not using restarts) */
entropy->restarts_to_go--;
if (cinfo->restart_interval)
entropy->restarts_to_go--;
return TRUE;
}
@ -638,7 +629,8 @@ decode_mcu_AC_refine(j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
}
/* Account for restart interval (no-op if not using restarts) */
entropy->restarts_to_go--;
if (cinfo->restart_interval)
entropy->restarts_to_go--;
return TRUE;
@ -676,7 +668,7 @@ jinit_phuff_decoder(j_decompress_ptr cinfo)
/* Create progression status table */
cinfo->coef_bits = (int (*)[DCTSIZE2])
(*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
cinfo->num_components * DCTSIZE2 *
cinfo->num_components * 2 * DCTSIZE2 *
sizeof(int));
coef_bit_ptr = &cinfo->coef_bits[0][0];
for (ci = 0; ci < cinfo->num_components; ci++)

View File

@ -8,6 +8,7 @@
* Copyright (C) 2010, 2015-2016, D. R. Commander.
* Copyright (C) 2014, MIPS Technologies, Inc., California.
* Copyright (C) 2015, Google, Inc.
* Copyright (C) 2019-2020, Arm Limited.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -176,7 +177,7 @@ int_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
outptr = output_data[outrow];
outend = outptr + cinfo->output_width;
while (outptr < outend) {
invalue = *inptr++; /* don't need GETJSAMPLE() here */
invalue = *inptr++;
for (h = h_expand; h > 0; h--) {
*outptr++ = invalue;
}
@ -212,7 +213,7 @@ h2v1_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
outptr = output_data[inrow];
outend = outptr + cinfo->output_width;
while (outptr < outend) {
invalue = *inptr++; /* don't need GETJSAMPLE() here */
invalue = *inptr++;
*outptr++ = invalue;
*outptr++ = invalue;
}
@ -241,7 +242,7 @@ h2v2_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
outptr = output_data[outrow];
outend = outptr + cinfo->output_width;
while (outptr < outend) {
invalue = *inptr++; /* don't need GETJSAMPLE() here */
invalue = *inptr++;
*outptr++ = invalue;
*outptr++ = invalue;
}
@ -282,20 +283,20 @@ h2v1_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
inptr = input_data[inrow];
outptr = output_data[inrow];
/* Special case for first column */
invalue = GETJSAMPLE(*inptr++);
invalue = *inptr++;
*outptr++ = (JSAMPLE)invalue;
*outptr++ = (JSAMPLE)((invalue * 3 + GETJSAMPLE(*inptr) + 2) >> 2);
*outptr++ = (JSAMPLE)((invalue * 3 + inptr[0] + 2) >> 2);
for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) {
/* General case: 3/4 * nearer pixel + 1/4 * further pixel */
invalue = GETJSAMPLE(*inptr++) * 3;
*outptr++ = (JSAMPLE)((invalue + GETJSAMPLE(inptr[-2]) + 1) >> 2);
*outptr++ = (JSAMPLE)((invalue + GETJSAMPLE(*inptr) + 2) >> 2);
invalue = (*inptr++) * 3;
*outptr++ = (JSAMPLE)((invalue + inptr[-2] + 1) >> 2);
*outptr++ = (JSAMPLE)((invalue + inptr[0] + 2) >> 2);
}
/* Special case for last column */
invalue = GETJSAMPLE(*inptr);
*outptr++ = (JSAMPLE)((invalue * 3 + GETJSAMPLE(inptr[-1]) + 1) >> 2);
invalue = *inptr;
*outptr++ = (JSAMPLE)((invalue * 3 + inptr[-1] + 1) >> 2);
*outptr++ = (JSAMPLE)invalue;
}
}
@ -315,9 +316,9 @@ h1v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
JSAMPARRAY output_data = *output_data_ptr;
JSAMPROW inptr0, inptr1, outptr;
#if BITS_IN_JSAMPLE == 8
int thiscolsum;
int thiscolsum, bias;
#else
JLONG thiscolsum;
JLONG thiscolsum, bias;
#endif
JDIMENSION colctr;
int inrow, outrow, v;
@ -327,15 +328,18 @@ h1v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
for (v = 0; v < 2; v++) {
/* inptr0 points to nearest input row, inptr1 points to next nearest */
inptr0 = input_data[inrow];
if (v == 0) /* next nearest is row above */
if (v == 0) { /* next nearest is row above */
inptr1 = input_data[inrow - 1];
else /* next nearest is row below */
bias = 1;
} else { /* next nearest is row below */
inptr1 = input_data[inrow + 1];
bias = 2;
}
outptr = output_data[outrow++];
for (colctr = 0; colctr < compptr->downsampled_width; colctr++) {
thiscolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);
*outptr++ = (JSAMPLE)((thiscolsum + 1) >> 2);
thiscolsum = (*inptr0++) * 3 + (*inptr1++);
*outptr++ = (JSAMPLE)((thiscolsum + bias) >> 2);
}
}
inrow++;
@ -377,8 +381,8 @@ h2v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
outptr = output_data[outrow++];
/* Special case for first column */
thiscolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);
nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);
thiscolsum = (*inptr0++) * 3 + (*inptr1++);
nextcolsum = (*inptr0++) * 3 + (*inptr1++);
*outptr++ = (JSAMPLE)((thiscolsum * 4 + 8) >> 4);
*outptr++ = (JSAMPLE)((thiscolsum * 3 + nextcolsum + 7) >> 4);
lastcolsum = thiscolsum; thiscolsum = nextcolsum;
@ -386,7 +390,7 @@ h2v2_fancy_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr,
for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) {
/* General case: 3/4 * nearer pixel + 1/4 * further pixel in each */
/* dimension, thus 9/16, 3/16, 3/16, 1/16 overall */
nextcolsum = GETJSAMPLE(*inptr0++) * 3 + GETJSAMPLE(*inptr1++);
nextcolsum = (*inptr0++) * 3 + (*inptr1++);
*outptr++ = (JSAMPLE)((thiscolsum * 3 + lastcolsum + 8) >> 4);
*outptr++ = (JSAMPLE)((thiscolsum * 3 + nextcolsum + 7) >> 4);
lastcolsum = thiscolsum; thiscolsum = nextcolsum;
@ -473,7 +477,13 @@ jinit_upsampler(j_decompress_ptr cinfo)
} else if (h_in_group == h_out_group &&
v_in_group * 2 == v_out_group && do_fancy) {
/* Non-fancy upsampling is handled by the generic method */
upsample->methods[ci] = h1v2_fancy_upsample;
#if defined(__arm__) || defined(__aarch64__) || \
defined(_M_ARM) || defined(_M_ARM64)
if (jsimd_can_h1v2_fancy_upsample())
upsample->methods[ci] = jsimd_h1v2_fancy_upsample;
else
#endif
upsample->methods[ci] = h1v2_fancy_upsample;
upsample->pub.need_context_rows = TRUE;
} else if (h_in_group * 2 == h_out_group &&
v_in_group * 2 == v_out_group) {

View File

@ -3,8 +3,8 @@
*
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1995-1997, Thomas G. Lane.
* It was modified by The libjpeg-turbo Project to include only code relevant
* to libjpeg-turbo.
* libjpeg-turbo Modifications:
* Copyright (C) 2020, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -16,6 +16,7 @@
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
#include "jpegcomp.h"
/* Forward declarations */

View File

@ -207,6 +207,10 @@ JMESSAGE(JWRN_ARITH_BAD_CODE, "Corrupt JPEG data: bad arithmetic code")
#endif
#endif
JMESSAGE(JWRN_BOGUS_ICC, "Corrupt JPEG data: bad ICC marker")
#if JPEG_LIB_VERSION < 70
JMESSAGE(JERR_BAD_DROP_SAMPLING,
"Component index %d: mismatching sampling ratio %d:%d, %d:%d, %c")
#endif
#ifdef JMAKE_ENUM_LIST
@ -252,6 +256,15 @@ JMESSAGE(JWRN_BOGUS_ICC, "Corrupt JPEG data: bad ICC marker")
(cinfo)->err->msg_parm.i[2] = (p3), \
(cinfo)->err->msg_parm.i[3] = (p4), \
(*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
#define ERREXIT6(cinfo, code, p1, p2, p3, p4, p5, p6) \
((cinfo)->err->msg_code = (code), \
(cinfo)->err->msg_parm.i[0] = (p1), \
(cinfo)->err->msg_parm.i[1] = (p2), \
(cinfo)->err->msg_parm.i[2] = (p3), \
(cinfo)->err->msg_parm.i[3] = (p4), \
(cinfo)->err->msg_parm.i[4] = (p5), \
(cinfo)->err->msg_parm.i[5] = (p6), \
(*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
#define ERREXITS(cinfo, code, str) \
((cinfo)->err->msg_code = (code), \
strncpy((cinfo)->err->msg_parm.s, (str), JMSG_STR_PARM_MAX), \

View File

@ -1,14 +1,14 @@
/*
* jfdctint.c
*
* This file was part of the Independent JPEG Group's software.
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1996, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright (C) 2015, D. R. Commander.
* Copyright (C) 2015, 2020, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
* This file contains a slow-but-accurate integer implementation of the
* This file contains a slower but more accurate integer implementation of the
* forward DCT (Discrete Cosine Transform).
*
* A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT

View File

@ -1,15 +1,15 @@
/*
* jidctint.c
*
* This file was part of the Independent JPEG Group's software.
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1998, Thomas G. Lane.
* Modification developed 2002-2009 by Guido Vollbeding.
* Modification developed 2002-2018 by Guido Vollbeding.
* libjpeg-turbo Modifications:
* Copyright (C) 2015, D. R. Commander.
* Copyright (C) 2015, 2020, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
* This file contains a slow-but-accurate integer implementation of the
* This file contains a slower but more accurate integer implementation of the
* inverse DCT (Discrete Cosine Transform). In the IJG code, this routine
* must also perform dequantization of the input coefficients.
*
@ -417,7 +417,7 @@ jpeg_idct_islow(j_decompress_ptr cinfo, jpeg_component_info *compptr,
/*
* Perform dequantization and inverse DCT on one block of coefficients,
* producing a 7x7 output block.
* producing a reduced-size 7x7 output block.
*
* Optimized algorithm with 12 multiplications in the 1-D kernel.
* cK represents sqrt(2) * cos(K*pi/14).
@ -1258,7 +1258,7 @@ jpeg_idct_10x10(j_decompress_ptr cinfo, jpeg_component_info *compptr,
/*
* Perform dequantization and inverse DCT on one block of coefficients,
* producing a 11x11 output block.
* producing an 11x11 output block.
*
* Optimized algorithm with 24 multiplications in the 1-D kernel.
* cK represents sqrt(2) * cos(K*pi/22).
@ -2398,7 +2398,7 @@ jpeg_idct_16x16(j_decompress_ptr cinfo, jpeg_component_info *compptr,
tmp0 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
tmp0 = LEFT_SHIFT(tmp0, CONST_BITS);
/* Add fudge factor here for final descale. */
tmp0 += 1 << (CONST_BITS - PASS1_BITS - 1);
tmp0 += ONE << (CONST_BITS - PASS1_BITS - 1);
z1 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
tmp1 = MULTIPLY(z1, FIX(1.306562965)); /* c4[16] = c2[8] */

View File

@ -1,7 +1,7 @@
/*
* jidctred.c
*
* This file was part of the Independent JPEG Group's software.
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1994-1998, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright (C) 2015, D. R. Commander.

View File

@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1997, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright (C) 2016, D. R. Commander.
* Copyright (C) 2016, 2021, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -1032,7 +1032,7 @@ free_pool(j_common_ptr cinfo, int pool_id)
large_pool_ptr next_lhdr_ptr = lhdr_ptr->next;
space_freed = lhdr_ptr->bytes_used +
lhdr_ptr->bytes_left +
sizeof(large_pool_hdr);
sizeof(large_pool_hdr) + ALIGN_SIZE - 1;
jpeg_free_large(cinfo, (void *)lhdr_ptr, space_freed);
mem->total_space_allocated -= space_freed;
lhdr_ptr = next_lhdr_ptr;
@ -1045,7 +1045,7 @@ free_pool(j_common_ptr cinfo, int pool_id)
while (shdr_ptr != NULL) {
small_pool_ptr next_shdr_ptr = shdr_ptr->next;
space_freed = shdr_ptr->bytes_used + shdr_ptr->bytes_left +
sizeof(small_pool_hdr);
sizeof(small_pool_hdr) + ALIGN_SIZE - 1;
jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed);
mem->total_space_allocated -= space_freed;
shdr_ptr = next_shdr_ptr;

View File

@ -5,7 +5,7 @@
* Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 1997-2009 by Guido Vollbeding.
* libjpeg-turbo Modifications:
* Copyright (C) 2009, 2011, 2014-2015, 2018, D. R. Commander.
* Copyright (C) 2009, 2011, 2014-2015, 2018, 2020, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -43,25 +43,11 @@
#if BITS_IN_JSAMPLE == 8
/* JSAMPLE should be the smallest type that will hold the values 0..255.
* You can use a signed char by having GETJSAMPLE mask it with 0xFF.
*/
#ifdef HAVE_UNSIGNED_CHAR
typedef unsigned char JSAMPLE;
#define GETJSAMPLE(value) ((int)(value))
#else /* not HAVE_UNSIGNED_CHAR */
typedef char JSAMPLE;
#ifdef __CHAR_UNSIGNED__
#define GETJSAMPLE(value) ((int)(value))
#else
#define GETJSAMPLE(value) ((int)(value) & 0xFF)
#endif /* __CHAR_UNSIGNED__ */
#endif /* HAVE_UNSIGNED_CHAR */
#define MAXJSAMPLE 255
#define CENTERJSAMPLE 128
@ -97,22 +83,9 @@ typedef short JCOEF;
* managers, this is also the data type passed to fread/fwrite.
*/
#ifdef HAVE_UNSIGNED_CHAR
typedef unsigned char JOCTET;
#define GETJOCTET(value) (value)
#else /* not HAVE_UNSIGNED_CHAR */
typedef char JOCTET;
#ifdef __CHAR_UNSIGNED__
#define GETJOCTET(value) (value)
#else
#define GETJOCTET(value) ((value) & 0xFF)
#endif /* __CHAR_UNSIGNED__ */
#endif /* HAVE_UNSIGNED_CHAR */
/* These typedefs are used for various table entries and so forth.
* They must be at least as wide as specified; but making them too big
@ -123,15 +96,7 @@ typedef char JOCTET;
/* UINT8 must hold at least the values 0..255. */
#ifdef HAVE_UNSIGNED_CHAR
typedef unsigned char UINT8;
#else /* not HAVE_UNSIGNED_CHAR */
#ifdef __CHAR_UNSIGNED__
typedef char UINT8;
#else /* not __CHAR_UNSIGNED__ */
typedef short UINT8;
#endif /* __CHAR_UNSIGNED__ */
#endif /* HAVE_UNSIGNED_CHAR */
/* UINT16 must hold at least the values 0..65535. */
@ -273,9 +238,9 @@ typedef int boolean;
/* Capability options common to encoder and decoder: */
#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */
#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */
#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */
#define DCT_ISLOW_SUPPORTED /* accurate integer method */
#define DCT_IFAST_SUPPORTED /* less accurate int method [legacy feature] */
#define DCT_FLOAT_SUPPORTED /* floating-point method [legacy feature] */
/* Encoder capability options: */

View File

@ -1,7 +1,7 @@
/*
* jpegcomp.h
*
* Copyright (C) 2010, D. R. Commander.
* Copyright (C) 2010, 2020, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -19,6 +19,7 @@
#define _min_DCT_v_scaled_size min_DCT_v_scaled_size
#define _jpeg_width jpeg_width
#define _jpeg_height jpeg_height
#define JERR_ARITH_NOTIMPL JERR_NOT_COMPILED
#else
#define _DCT_scaled_size DCT_scaled_size
#define _DCT_h_scaled_size DCT_scaled_size

View File

@ -5,8 +5,9 @@
* Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 1997-2009 by Guido Vollbeding.
* libjpeg-turbo Modifications:
* Copyright (C) 2015-2016, D. R. Commander.
* Copyright (C) 2015-2016, 2019, 2021, D. R. Commander.
* Copyright (C) 2015, Google, Inc.
* Copyright (C) 2021, Alex Richardson.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -47,6 +48,18 @@ typedef enum { /* Operating modes for buffer controllers */
/* JLONG must hold at least signed 32-bit values. */
typedef long JLONG;
/* JUINTPTR must hold pointer values. */
#ifdef __UINTPTR_TYPE__
/*
* __UINTPTR_TYPE__ is GNU-specific and available in GCC 4.6+ and Clang 3.0+.
* Fortunately, that is sufficient to support the few architectures for which
* sizeof(void *) != sizeof(size_t). The only other options would require C99
* or Clang-specific builtins.
*/
typedef __UINTPTR_TYPE__ JUINTPTR;
#else
typedef size_t JUINTPTR;
#endif
/*
* Left shift macro that handles a negative operand without causing any
@ -158,6 +171,9 @@ struct jpeg_decomp_master {
JDIMENSION first_MCU_col[MAX_COMPONENTS];
JDIMENSION last_MCU_col[MAX_COMPONENTS];
boolean jinit_upsampler_no_alloc;
/* Last iMCU row that was successfully decoded */
JDIMENSION last_good_iMCU_row;
};
/* Input control module */

View File

@ -5,7 +5,7 @@
* Copyright (C) 1991-1998, Thomas G. Lane.
* Modified 2002-2009 by Guido Vollbeding.
* libjpeg-turbo Modifications:
* Copyright (C) 2009-2011, 2013-2014, 2016-2017, D. R. Commander.
* Copyright (C) 2009-2011, 2013-2014, 2016-2017, 2020, D. R. Commander.
* Copyright (C) 2015, Google, Inc.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
@ -244,9 +244,9 @@ typedef enum {
/* DCT/IDCT algorithm options. */
typedef enum {
JDCT_ISLOW, /* slow but accurate integer algorithm */
JDCT_IFAST, /* faster, less accurate integer method */
JDCT_FLOAT /* floating-point: accurate, fast on fast HW */
JDCT_ISLOW, /* accurate integer method */
JDCT_IFAST, /* less accurate integer method [legacy feature] */
JDCT_FLOAT /* floating-point method [legacy feature] */
} J_DCT_METHOD;
#ifndef JDCT_DEFAULT /* may be overridden in jconfig.h */

View File

@ -154,7 +154,7 @@ typedef struct {
*/
boolean is_padded; /* is the colorindex padded for odither? */
int Ncolors[MAX_Q_COMPS]; /* # of values alloced to each component */
int Ncolors[MAX_Q_COMPS]; /* # of values allocated to each component */
/* Variables for ordered dithering */
int row_index; /* cur row's vertical index in dither matrix */
@ -479,7 +479,7 @@ color_quantize(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
for (col = width; col > 0; col--) {
pixcode = 0;
for (ci = 0; ci < nc; ci++) {
pixcode += GETJSAMPLE(colorindex[ci][GETJSAMPLE(*ptrin++)]);
pixcode += colorindex[ci][*ptrin++];
}
*ptrout++ = (JSAMPLE)pixcode;
}
@ -506,9 +506,9 @@ color_quantize3(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
ptrin = input_buf[row];
ptrout = output_buf[row];
for (col = width; col > 0; col--) {
pixcode = GETJSAMPLE(colorindex0[GETJSAMPLE(*ptrin++)]);
pixcode += GETJSAMPLE(colorindex1[GETJSAMPLE(*ptrin++)]);
pixcode += GETJSAMPLE(colorindex2[GETJSAMPLE(*ptrin++)]);
pixcode = colorindex0[*ptrin++];
pixcode += colorindex1[*ptrin++];
pixcode += colorindex2[*ptrin++];
*ptrout++ = (JSAMPLE)pixcode;
}
}
@ -552,7 +552,7 @@ quantize_ord_dither(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
* required amount of padding.
*/
*output_ptr +=
colorindex_ci[GETJSAMPLE(*input_ptr) + dither[col_index]];
colorindex_ci[*input_ptr + dither[col_index]];
input_ptr += nc;
output_ptr++;
col_index = (col_index + 1) & ODITHER_MASK;
@ -595,12 +595,9 @@ quantize3_ord_dither(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
col_index = 0;
for (col = width; col > 0; col--) {
pixcode =
GETJSAMPLE(colorindex0[GETJSAMPLE(*input_ptr++) + dither0[col_index]]);
pixcode +=
GETJSAMPLE(colorindex1[GETJSAMPLE(*input_ptr++) + dither1[col_index]]);
pixcode +=
GETJSAMPLE(colorindex2[GETJSAMPLE(*input_ptr++) + dither2[col_index]]);
pixcode = colorindex0[(*input_ptr++) + dither0[col_index]];
pixcode += colorindex1[(*input_ptr++) + dither1[col_index]];
pixcode += colorindex2[(*input_ptr++) + dither2[col_index]];
*output_ptr++ = (JSAMPLE)pixcode;
col_index = (col_index + 1) & ODITHER_MASK;
}
@ -677,15 +674,15 @@ quantize_fs_dither(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
* The maximum error is +- MAXJSAMPLE; this sets the required size
* of the range_limit array.
*/
cur += GETJSAMPLE(*input_ptr);
cur = GETJSAMPLE(range_limit[cur]);
cur += *input_ptr;
cur = range_limit[cur];
/* Select output value, accumulate into output code for this pixel */
pixcode = GETJSAMPLE(colorindex_ci[cur]);
pixcode = colorindex_ci[cur];
*output_ptr += (JSAMPLE)pixcode;
/* Compute actual representation error at this pixel */
/* Note: we can do this even though we don't have the final */
/* pixel code, because the colormap is orthogonal. */
cur -= GETJSAMPLE(colormap_ci[pixcode]);
cur -= colormap_ci[pixcode];
/* Compute error fractions to be propagated to adjacent pixels.
* Add these into the running sums, and simultaneously shift the
* next-line error sums left by 1 column.

View File

@ -4,7 +4,7 @@
* This file was part of the Independent JPEG Group's software:
* Copyright (C) 1991-1996, Thomas G. Lane.
* libjpeg-turbo Modifications:
* Copyright (C) 2009, 2014-2015, D. R. Commander.
* Copyright (C) 2009, 2014-2015, 2020, D. R. Commander.
* For conditions of distribution and use, see the accompanying README.ijg
* file.
*
@ -215,9 +215,9 @@ prescan_quantize(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
ptr = input_buf[row];
for (col = width; col > 0; col--) {
/* get pixel value and index into the histogram */
histp = &histogram[GETJSAMPLE(ptr[0]) >> C0_SHIFT]
[GETJSAMPLE(ptr[1]) >> C1_SHIFT]
[GETJSAMPLE(ptr[2]) >> C2_SHIFT];
histp = &histogram[ptr[0] >> C0_SHIFT]
[ptr[1] >> C1_SHIFT]
[ptr[2] >> C2_SHIFT];
/* increment, check for overflow and undo increment if so. */
if (++(*histp) <= 0)
(*histp)--;
@ -665,7 +665,7 @@ find_nearby_colors(j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
for (i = 0; i < numcolors; i++) {
/* We compute the squared-c0-distance term, then add in the other two. */
x = GETJSAMPLE(cinfo->colormap[0][i]);
x = cinfo->colormap[0][i];
if (x < minc0) {
tdist = (x - minc0) * C0_SCALE;
min_dist = tdist * tdist;
@ -688,7 +688,7 @@ find_nearby_colors(j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
}
}
x = GETJSAMPLE(cinfo->colormap[1][i]);
x = cinfo->colormap[1][i];
if (x < minc1) {
tdist = (x - minc1) * C1_SCALE;
min_dist += tdist * tdist;
@ -710,7 +710,7 @@ find_nearby_colors(j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
}
}
x = GETJSAMPLE(cinfo->colormap[2][i]);
x = cinfo->colormap[2][i];
if (x < minc2) {
tdist = (x - minc2) * C2_SCALE;
min_dist += tdist * tdist;
@ -788,13 +788,13 @@ find_best_colors(j_decompress_ptr cinfo, int minc0, int minc1, int minc2,
#define STEP_C2 ((1 << C2_SHIFT) * C2_SCALE)
for (i = 0; i < numcolors; i++) {
icolor = GETJSAMPLE(colorlist[i]);
icolor = colorlist[i];
/* Compute (square of) distance from minc0/c1/c2 to this color */
inc0 = (minc0 - GETJSAMPLE(cinfo->colormap[0][icolor])) * C0_SCALE;
inc0 = (minc0 - cinfo->colormap[0][icolor]) * C0_SCALE;
dist0 = inc0 * inc0;
inc1 = (minc1 - GETJSAMPLE(cinfo->colormap[1][icolor])) * C1_SCALE;
inc1 = (minc1 - cinfo->colormap[1][icolor]) * C1_SCALE;
dist0 += inc1 * inc1;
inc2 = (minc2 - GETJSAMPLE(cinfo->colormap[2][icolor])) * C2_SCALE;
inc2 = (minc2 - cinfo->colormap[2][icolor]) * C2_SCALE;
dist0 += inc2 * inc2;
/* Form the initial difference increments */
inc0 = inc0 * (2 * STEP_C0) + STEP_C0 * STEP_C0;
@ -879,7 +879,7 @@ fill_inverse_cmap(j_decompress_ptr cinfo, int c0, int c1, int c2)
for (ic1 = 0; ic1 < BOX_C1_ELEMS; ic1++) {
cachep = &histogram[c0 + ic0][c1 + ic1][c2];
for (ic2 = 0; ic2 < BOX_C2_ELEMS; ic2++) {
*cachep++ = (histcell)(GETJSAMPLE(*cptr++) + 1);
*cachep++ = (histcell)((*cptr++) + 1);
}
}
}
@ -909,9 +909,9 @@ pass2_no_dither(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
outptr = output_buf[row];
for (col = width; col > 0; col--) {
/* get pixel value and index into the cache */
c0 = GETJSAMPLE(*inptr++) >> C0_SHIFT;
c1 = GETJSAMPLE(*inptr++) >> C1_SHIFT;
c2 = GETJSAMPLE(*inptr++) >> C2_SHIFT;
c0 = (*inptr++) >> C0_SHIFT;
c1 = (*inptr++) >> C1_SHIFT;
c2 = (*inptr++) >> C2_SHIFT;
cachep = &histogram[c0][c1][c2];
/* If we have not seen this color before, find nearest colormap entry */
/* and update the cache */
@ -996,12 +996,12 @@ pass2_fs_dither(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
* The maximum error is +- MAXJSAMPLE (or less with error limiting);
* this sets the required size of the range_limit array.
*/
cur0 += GETJSAMPLE(inptr[0]);
cur1 += GETJSAMPLE(inptr[1]);
cur2 += GETJSAMPLE(inptr[2]);
cur0 = GETJSAMPLE(range_limit[cur0]);
cur1 = GETJSAMPLE(range_limit[cur1]);
cur2 = GETJSAMPLE(range_limit[cur2]);
cur0 += inptr[0];
cur1 += inptr[1];
cur2 += inptr[2];
cur0 = range_limit[cur0];
cur1 = range_limit[cur1];
cur2 = range_limit[cur2];
/* Index into the cache with adjusted pixel value */
cachep =
&histogram[cur0 >> C0_SHIFT][cur1 >> C1_SHIFT][cur2 >> C2_SHIFT];
@ -1015,9 +1015,9 @@ pass2_fs_dither(j_decompress_ptr cinfo, JSAMPARRAY input_buf,
register int pixcode = *cachep - 1;
*outptr = (JSAMPLE)pixcode;
/* Compute representation error for this pixel */
cur0 -= GETJSAMPLE(colormap0[pixcode]);
cur1 -= GETJSAMPLE(colormap1[pixcode]);
cur2 -= GETJSAMPLE(colormap2[pixcode]);
cur0 -= colormap0[pixcode];
cur1 -= colormap1[pixcode];
cur2 -= colormap2[pixcode];
}
/* Compute error fractions to be propagated to adjacent pixels.
* Add these into the running sums, and simultaneously shift the
@ -1145,7 +1145,7 @@ start_pass_2_quant(j_decompress_ptr cinfo, boolean is_pre_scan)
int i;
/* Only F-S dithering or no dithering is supported. */
/* If user asks for ordered dither, give him F-S. */
/* If user asks for ordered dither, give them F-S. */
if (cinfo->dither_mode != JDITHER_NONE)
cinfo->dither_mode = JDITHER_FS;
@ -1263,7 +1263,7 @@ jinit_2pass_quantizer(j_decompress_ptr cinfo)
cquantize->sv_colormap = NULL;
/* Only F-S dithering or no dithering is supported. */
/* If user asks for ordered dither, give him F-S. */
/* If user asks for ordered dither, give them F-S. */
if (cinfo->dither_mode != JDITHER_NONE)
cinfo->dither_mode = JDITHER_FS;

View File

@ -4,6 +4,7 @@
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
* Copyright (C) 2011, 2014, D. R. Commander.
* Copyright (C) 2015-2016, 2018, Matthieu Darbois.
* Copyright (C) 2020, Arm Limited.
*
* Based on the x86 SIMD extension for IJG JPEG library,
* Copyright (C) 1999-2006, MIYASAKA Masaru.
@ -75,6 +76,7 @@ EXTERN(void) jsimd_int_upsample(j_decompress_ptr cinfo,
EXTERN(int) jsimd_can_h2v2_fancy_upsample(void);
EXTERN(int) jsimd_can_h2v1_fancy_upsample(void);
EXTERN(int) jsimd_can_h1v2_fancy_upsample(void);
EXTERN(void) jsimd_h2v2_fancy_upsample(j_decompress_ptr cinfo,
jpeg_component_info *compptr,
@ -84,6 +86,10 @@ EXTERN(void) jsimd_h2v1_fancy_upsample(j_decompress_ptr cinfo,
jpeg_component_info *compptr,
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr);
EXTERN(void) jsimd_h1v2_fancy_upsample(j_decompress_ptr cinfo,
jpeg_component_info *compptr,
JSAMPARRAY input_data,
JSAMPARRAY *output_data_ptr);
EXTERN(int) jsimd_can_h2v2_merged_upsample(void);
EXTERN(int) jsimd_can_h2v1_merged_upsample(void);

Some files were not shown because too many files have changed in this diff Show More