Skip to content

Commit

Permalink
Merge pull request #1150 from Shevonar/fix-rosbag-python3
Browse files Browse the repository at this point in the history
Fix rosbag API for Python 3
  • Loading branch information
dirk-thomas authored Aug 23, 2017
2 parents ba14130 + ae25383 commit b431e22
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/rosbag/src/rosbag/bag.py
Original file line number Diff line number Diff line change
Expand Up @@ -1586,6 +1586,7 @@ def _read_uint32(f): return _unpack_uint32(f.read(4))
def _read_uint64(f): return _unpack_uint64(f.read(8))
def _read_time (f): return _unpack_time (f.read(8))

def _decode_str(v): return v if type(v) is str else v.decode()
def _unpack_uint8(v): return struct.unpack('<B', v)[0]
def _unpack_uint32(v): return struct.unpack('<L', v)[0]
def _unpack_uint64(v): return struct.unpack('<Q', v)[0]
Expand Down Expand Up @@ -1634,8 +1635,7 @@ def _read_field(header, field, unpack_fn):

return value

def _read_str_field (header, field):
return _read_field(header, field, lambda v: v)
def _read_str_field (header, field): return _read_field(header, field, _decode_str)
def _read_uint8_field (header, field): return _read_field(header, field, _unpack_uint8)
def _read_uint32_field(header, field): return _read_field(header, field, _unpack_uint32)
def _read_uint64_field(header, field): return _read_field(header, field, _unpack_uint64)
Expand Down

0 comments on commit b431e22

Please sign in to comment.