Previous | 199869 Revisions | Next |
r36218 Tuesday 3rd March, 2015 at 16:12:30 UTC by Reed |
---|
Update file2str.py Sorry about my previous recommendation that broke Python 2. It's been so long that I forgot that Python 2 open 'rb' returns a string representation of bytes. The above code will properly handle type conversion for Python 2. |
[src/build] | file2str.py |
r244729 | r244730 | |
---|---|---|
40 | 40 | chunk = src.read(16) |
41 | 41 | if chunk: |
42 | 42 | for b in chunk: |
43 | dst.write('0x%02x' % ord(b)) | |
43 | # For Python 2.x compatibility. | |
44 | if isinstance(b, str): | |
45 | b = ord(b) | |
46 | dst.write('0x%02x' % b) | |
44 | 47 | offs = offs + 1 |
45 | 48 | if offs != byteCount: |
46 | 49 | dst.write(',') |
https://github.com/mamedev/mame/commit/4b3a5f4f94e2e2a322badd2e686729ddedac6d27 |
Previous | 199869 Revisions | Next |