summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Bícha <jeremy.bicha@canonical.com>2023-09-14 11:22:04 -0400
committerJeremy Bícha <jeremy.bicha@canonical.com>2023-09-14 15:36:19 -0400
commite44fc9e22a05930703f0ce286ba10ac94e56ddb9 (patch)
treeb938e5ef0dba1f8305b07d4e927cac7340c50c62
parentc0112da1ea3b62a4ef88bae36817823306cfcd24 (diff)
Add another proposed patch to fix big-endian
-rw-r--r--debian/patches/series1
-rw-r--r--debian/patches/typelib-Fix-byte-order-issue.patch28
2 files changed, 29 insertions, 0 deletions
diff --git a/debian/patches/series b/debian/patches/series
index 2a7b7a2..15e608a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
Handle-big-endian-bitfields-correctly.patch
+typelib-Fix-byte-order-issue.patch
diff --git a/debian/patches/typelib-Fix-byte-order-issue.patch b/debian/patches/typelib-Fix-byte-order-issue.patch
new file mode 100644
index 0000000..aa6ddbf
--- /dev/null
+++ b/debian/patches/typelib-Fix-byte-order-issue.patch
@@ -0,0 +1,28 @@
+From: James Westman <james@jwestman.net>
+Date: Thu, 14 Sep 2023 10:19:49 -0500
+Subject: typelib: Fix byte order issue
+
+Origin: https://gitlab.gnome.org/jwestman/blueprint-compiler/-/issues/131
+---
+ blueprintcompiler/typelib.py | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/blueprintcompiler/typelib.py b/blueprintcompiler/typelib.py
+index a42ab3a..7b186f7 100644
+--- a/blueprintcompiler/typelib.py
++++ b/blueprintcompiler/typelib.py
+@@ -64,11 +64,11 @@ class Field:
+ if not mask or sys.byteorder == "little":
+ self._shift = shift
+ elif self._type == "u8" or self._type == "i8":
+- self._shift = 7 - shift
++ self._shift = 8 - (shift + mask)
+ elif self._type == "u16" or self._type == "i16":
+- self._shift = 15 - shift
++ self._shift = 16 - (shift + mask)
+ else:
+- self._shift = 31 - shift
++ self._shift = 32 - (shift + mask)
+ self._mask = (1 << mask) - 1 if mask else None
+ self._name = f"{offset}__{type}__{shift}__{mask}"
+