7
7
# There are some additional fixes added for reproducability, such as fixing the zero-padding of names in the coff
8
8
# section headers.
9
9
10
- import sys
11
10
import struct
11
+ import sys
12
12
13
13
verbose = True
14
14
@@ -96,8 +96,6 @@ def read_lib(fp):
96
96
print ("coff length:" , len (result ["o" ][- 1 ]))
97
97
h = None
98
98
99
- return result
100
-
101
99
102
100
def write_lib (fp , lib ):
103
101
fp .write (libheader )
@@ -184,15 +182,13 @@ def first_lm_read(fp):
184
182
185
183
offsets = []
186
184
strings = []
187
- for i in range (nos ):
185
+ for _ in range (nos ):
188
186
offset = fp .read (4 )
189
187
offsets .append (struct .unpack (">L" , offset )[0 ])
190
- for i in range (nos ):
188
+ for _ in range (nos ):
191
189
strings .append (readcstr (fp ))
192
190
return {"offsets" : offsets , "strings" : strings }
193
191
# sometimes there is an extra \0a after the strings
194
- p = peek (fp )
195
- return zip (offsets , strings )
196
192
197
193
198
194
def first_lm_write (fp , lm ):
@@ -208,16 +204,16 @@ def second_lm_read(fp):
208
204
# number of members
209
205
m = struct .unpack ("<L" , fp .read (4 ))[0 ] # unsigned long, big-endian
210
206
offsets = []
211
- for i in range (m ):
207
+ for _ in range (m ):
212
208
offsets .append (struct .unpack ("<L" , fp .read (4 ))[0 ])
213
209
214
210
# number of symbols
215
211
n = struct .unpack ("<L" , fp .read (4 ))[0 ] # unsigned long, big-endian
216
212
indices = []
217
- for i in range (n ):
213
+ for _ in range (n ):
218
214
indices .append (struct .unpack ("<H" , fp .read (2 ))[0 ]) # unsigned short
219
215
strings = []
220
- for i in range (n ):
216
+ for _ in range (n ):
221
217
strings .append (readcstr (fp ))
222
218
223
219
return {"offsets" : offsets , "indices" : indices , "strings" : strings }
@@ -261,7 +257,7 @@ def read_optional_nl(fp):
261
257
262
258
263
259
def peek (fp ):
264
- """ check the next char """
260
+ """check the next char"""
265
261
t = fp .tell ()
266
262
c = fp .read (1 )
267
263
fp .seek (t )
0 commit comments