update pyloxi to c47bc6facb2869a7833b8694b7a20b3113284d94
diff --git a/src/python/loxi/generic_util.py b/src/python/loxi/generic_util.py
index ce31049..f965e64 100644
--- a/src/python/loxi/generic_util.py
+++ b/src/python/loxi/generic_util.py
@@ -40,6 +40,13 @@
return deserializer(reader.slice(length), typ)
return unpack_list(reader, wrapper)
+def pad_to(alignment, length):
+ """
+ Return a string of zero bytes that will pad a string of length 'length' to
+ a multiple of 'alignment'.
+ """
+ return "\x00" * ((length + alignment - 1)/alignment*alignment - length)
+
class OFReader(object):
"""
Cursor over a read-only buffer
@@ -79,6 +86,12 @@
raise loxi.ProtocolError("Buffer too short")
self.offset += length
+ def skip_align(self):
+ new_offset = (self.offset + 7) / 8 * 8
+ if new_offset > len(self.buf):
+ raise loxi.ProtocolError("Buffer too short")
+ self.offset = new_offset
+
def is_empty(self):
return self.offset == len(self.buf)