File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ def crc16(data):
3636 crc = 0xFFFF
3737 for c in data :
3838 crc = (((crc >> 8 ) & 0xFF ) | (crc << 8 )) & 0xFFFF
39- crc = (crc ^ ord (c )) & 0xFFFF
39+ crc = (crc ^ ( c if isinstance ( c , int ) else ord (c ) )) & 0xFFFF
4040 crc = (crc ^ ((crc & 0xFF ) >> 4 )) & 0xFFFF
4141 crc = (crc ^ ((crc << 8 ) << 4 )) & 0xFFFF
4242 crc = (crc ^ (((crc & 0xFF ) << 4 ) << 1 )) & 0xFFFF
@@ -71,7 +71,7 @@ def create_app_signature(data):
7171 action = 'store_true' ,
7272 help = 'disable all console output unless an error occurs' )
7373 args = parser .parse_args ()
74-
74+
7575 # Make sure input filename exists.
7676 if not os .path .isfile (args .input ):
7777 raise RuntimeError ('Input file does not exist!' )
@@ -90,13 +90,13 @@ def create_app_signature(data):
9090
9191 # Generate and write signature.
9292 if not args .quiet :
93- print 'Writing signature to: {0}' .format (signature )
93+ print ( 'Writing signature to: {0}' .format (signature ) )
9494 with open (signature , 'wb' ) as out_file :
9595 out_file .write (create_app_signature (data ))
9696
9797 # Done!
9898 if not args .quiet :
99- print 'Done!'
99+ print ( 'Done!' )
100100
101101
102102# Unit Tests.
You can’t perform that action at this time.
0 commit comments