Fix: _IntegerFieldType.__init__(): use correct alignment
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 3 Sep 2020 01:23:56 +0000 (21:23 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 3 Sep 2020 14:09:47 +0000 (10:09 -0400)
This patch makes _IntegerFieldType.__init__() consider `alignment` if
it's not `None` instead of completely ignoring it.

😒

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
barectf/config.py
doc/examples/linux-fs-simple/config.yaml

index e438cfb47bccdafd048f2bb513fbd5f7ba56dad6..1920c87f3a35c55c61c9ade81006b7164a3aa829 100644 (file)
@@ -75,12 +75,10 @@ class _IntegerFieldType(_BitArrayFieldType):
     def __init__(self, size: Count, byte_order: Optional[ByteOrder] = None,
                  alignment: Optional[Alignment] = None,
                  preferred_display_base: DisplayBase = DisplayBase.DECIMAL):
-        effective_alignment = 1
+        if alignment is None:
+            alignment = Alignment(8 if size % 8 == 0 else 1)
 
-        if alignment is None and size % 8 == 0:
-            effective_alignment = 8
-
-        super().__init__(size, byte_order, Alignment(effective_alignment))
+        super().__init__(size, byte_order, alignment)
         self._preferred_display_base = preferred_display_base
 
     @property
index 9d81b3d017ba971bfacc25d0979252f4f9105eff..7e7e2cbf483ace0bdedfe98761ceb7b97525dc26 100644 (file)
@@ -66,7 +66,6 @@ metadata:
           packet_size: uint32
           content_size: uint32
           events_discarded: uint32
-          salut: string
       event-header-type:
         class: struct
         fields:
This page took 0.024978 seconds and 4 git commands to generate.