pyloxi: rewrite deserialization to use OFReader
diff --git a/py_gen/templates/_unpack.py b/py_gen/templates/_unpack.py
index 91186cc..8be8254 100644
--- a/py_gen/templates/_unpack.py
+++ b/py_gen/templates/_unpack.py
@@ -27,22 +27,21 @@
 ::
 :: # TODO coalesce format strings
 :: from py_gen.codegen import Member, LengthMember, TypeMember, PadMember
+        if type(buf) == loxi.generic_util.OFReader:
+            reader = buf
+        else:
+            reader = loxi.generic_util.OFReader(buf)
 :: for m in ofclass.members:
 ::     if type(m) == PadMember:
+        reader.skip(${m.length})
 ::         continue
 ::     #endif
-::     unpack_expr = m.oftype.gen_unpack_expr('buf', m.offset)
+::     unpack_expr = m.oftype.gen_unpack_expr('reader')
 ::     if type(m) == LengthMember:
-        _length = ${unpack_expr}
-        assert(_length == len(buf))
-:: if ofclass.is_fixed_length:
-        if _length != ${ofclass.min_length}: raise loxi.ProtocolError("${ofclass.pyname} length is %d, should be ${ofclass.min_length}" % _length)
-:: else:
-        if _length < ${ofclass.min_length}: raise loxi.ProtocolError("${ofclass.pyname} length is %d, should be at least ${ofclass.min_length}" % _length)
-:: #endif
+        _${m.name} = ${unpack_expr}
 ::     elif type(m) == TypeMember:
-        ${m.name} = ${unpack_expr}
-        assert(${m.name} == ${m.value})
+        _${m.name} = ${unpack_expr}
+        assert(_${m.name} == ${m.value})
 ::     else:
         obj.${m.name} = ${unpack_expr}
 ::     #endif