tweak xwd header output

This commit is contained in:
Eric House 2023-05-26 09:20:00 -07:00
parent 69afe41040
commit 9680733899

View file

@ -170,22 +170,22 @@ def process(args):
md5Sum = getNullTermParam(header) md5Sum = getNullTermParam(header)
print( 'header: read sum: {}'.format(md5Sum), file=sys.stderr ) print( 'header: read sum: {}'.format(md5Sum), file=sys.stderr )
# skip header flags hdrFlags = int.from_bytes(header.read(2), 'little')
header.read(2) print( 'header: flags: {:X}'.format(hdrFlags), file=sys.stderr)
print( 'header: skipped flags', file=sys.stderr)
langCode = getNullTermParam(header) langCode = getNullTermParam(header)
print('header: langCode: {}; '.format(langCode), file=sys.stderr, end = '')
langName = getNullTermParam(header) langName = getNullTermParam(header)
print('header: langCode: {}; langName: {}'.format(langCode, langName), print('langName: {}'.format(langName), file=sys.stderr)
file=sys.stderr)
extraSize = int.from_bytes(header.read(1), 'little') extraSize = int.from_bytes(header.read(1), 'little')
print( 'header: extraSize: {}'.format(extraSize), file=sys.stderr ) print( 'header: extraSize: {}'.format(extraSize), file=sys.stderr )
extraData = header.read(extraSize) extraData = header.read(extraSize)
except Exception as ex: except Exception as ex:
print( 'header: exception!! {} '.format(ex), file=sys.stderr ) # This will fire when header ends before langCode,
md5Sum = None # i.e. for older wordlists
print( 'old/small header? exception!! {} '.format(ex), file=sys.stderr )
if args.GET_SUM: if args.GET_SUM:
print( '{}'.format(md5Sum), file=sys.stdout ) print( '{}'.format(md5Sum), file=sys.stdout )
@ -236,7 +236,10 @@ def process(args):
else: else:
error('I don\'t handle obsolete ascii case') error('I don\'t handle obsolete ascii case')
langCode = 0x7F & oneByteFmt.unpack(dawg.read(oneByteFmt.size))[0] langCode = oneByteFmt.unpack(dawg.read(oneByteFmt.size))[0]
official = 0 != langCode & 0x80
langCode = 0x7F & langCode
print( 'langCode: {:02X}; official: {}'.format(langCode, official), file=sys.stderr )
dawg.read( oneByteFmt.size ) # skip byte dawg.read( oneByteFmt.size ) # skip byte
loadCountsAndValues( dawg, numFaces, extraData, data ) loadCountsAndValues( dawg, numFaces, extraData, data )