Skip to content

Commit

Permalink
DFReader_text: some arrays indexed by bytes instead of str
Browse files Browse the repository at this point in the history
  • Loading branch information
shancock884 committed Jan 19, 2024
1 parent 57646ca commit 1c1ca18
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions DFReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def __getattr__(self, field):
if self.fmt.msg_types[i] == str:
v = null_term(v)
if self.fmt.msg_mults[i] is not None and self._apply_multiplier:
v *= self.fmt.msg_mults[i]
v *= self.fmt.msg_mults[i]
return v

def __setattr__(self, field, value):
Expand Down Expand Up @@ -1086,7 +1086,7 @@ def make_format_msgbuf(self, fmt):
def DFReader_is_text_log(filename):
'''return True if a file appears to be a valid text log'''
with open(filename, 'r') as f:
ret = (f.read(8000).find('FMT,') != -1)
ret = (f.read(8000).find('FMT,') != -1)

return ret

Expand Down Expand Up @@ -1147,8 +1147,7 @@ def init_arrays(self, progress_callback=None):

while ofs+16 < self.data_len:
mtype = self.data_map[ofs:ofs+4]
if mtype[3] == b',':
mtype = mtype[0:3]
mtype = mtype.decode().rstrip(', ')
if not mtype in self.offsets:
self.counts[mtype] = 0
self.offsets[mtype] = []
Expand Down

0 comments on commit 1c1ca18

Please sign in to comment.