Skip to content

Commit

Permalink
[qt5-tools] Fix deploying translation files with windeployqt (#25134)
Browse files Browse the repository at this point in the history
  • Loading branch information
MehdiChinoune committed Jun 15, 2022
1 parent a175d0a commit 86bf362
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/src/linguist/shared/qm.cpp b/src/linguist/shared/qm.cpp
index 8c3fc3f..d772855 100644
--- a/src/linguist/shared/qm.cpp
+++ b/src/linguist/shared/qm.cpp
@@ -552,12 +552,17 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd)
goto end;
case Tag_Translation: {
int len = read32(m);
- if (len & 1) {
+ m += 4;
+
+ // -1 indicates an empty string
+ // Otherwise streaming format is UTF-16 -> 2 bytes per character
+ if ((len != -1) && (len & 1)) {
cd.appendError(QLatin1String("QM-Format error"));
return false;
}
- m += 4;
- QString str = QString((const QChar *)m, len/2);
+ QString str;
+ if (len != -1)
+ str = QString((const QChar *)m, len / 2);
if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) {
for (int i = 0; i < str.length(); ++i)
str[i] = QChar((str.at(i).unicode() >> 8) +
1 change: 1 addition & 0 deletions ports/qt5-tools/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ include(${CURRENT_INSTALLED_DIR}/share/qt5/qt_port_functions.cmake)

qt_submodule_installation(PATCHES
icudt-debug-suffix.patch # https://bugreports.qt.io/browse/QTBUG-87677
Fix-regression-in-lconvert-handling-empty-translations.patch # https://codereview.qt-project.org/c/qt/qttools/+/337738
)

if(EXISTS "${CURRENT_INSTALLED_DIR}/plugins/platforms/qminimal${VCPKG_TARGET_SHARED_LIBRARY_SUFFIX}")
Expand Down
1 change: 1 addition & 0 deletions ports/qt5-tools/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "qt5-tools",
"version": "5.15.4",
"port-version": 1,
"description": "Qt5 Tools Module; Includes deployment tools and helpers, Qt Designer, Assistant, and other applications",
"license": null,
"dependencies": [
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5846,7 +5846,7 @@
},
"qt5-tools": {
"baseline": "5.15.4",
"port-version": 0
"port-version": 1
},
"qt5-translations": {
"baseline": "5.15.4",
Expand Down
5 changes: 5 additions & 0 deletions versions/q-/qt5-tools.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "6025c1997ce5b8bf0ebb131b0628641e8e550d6d",
"version": "5.15.4",
"port-version": 1
},
{
"git-tree": "b8a761a89f1f3aabb2c3e990b40cc69d0b7ea543",
"version": "5.15.4",
Expand Down

0 comments on commit 86bf362

Please sign in to comment.