Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mymc.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def do_create_pad(cmd, mc, opts, args, opterr):
pad = b"\0" * mc.cluster_size
f = mc.open(args[0], "wb")
try:
for i in xrange(length):
for i in range(length):
f.write(pad)
finally:
f.close()
Expand Down
8 changes: 4 additions & 4 deletions ps2mc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ def search_directory(self, dir, name):
start = dir.tell() - 1
if start == -1:
start = 0
for i in range(start, len(dir)) + range(0, start):
for i in list(range(start, len(dir))) + list(range(0, start)):
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should've been in the "Random fixes" commit, but still kinda relevant

try:
ent = dir[i]
except IndexError:
Expand Down Expand Up @@ -1728,7 +1728,7 @@ def get_free_space(self):
"""Returns the amount of free space in bytes."""

free = 0
for i in xrange(self.allocatable_cluster_end):
for i in range(self.allocatable_cluster_end):
if (self.lookup_fat(i) & PS2MC_FAT_ALLOCATED_BIT) == 0:
free += 1
return free * self.cluster_size
Expand Down Expand Up @@ -1783,7 +1783,7 @@ def _check_dir(self, fat, dirloc, dirname, ent):
print("bad directory:", (dirname
+ ': missing ".." entry'))
ret = False
for i in xrange(2, length):
for i in range(2, length):
ent = dir[i]
mode = ent[0]
if not (mode & DF_EXISTS):
Expand Down Expand Up @@ -1821,7 +1821,7 @@ def check(self):
ret = self._check_dir(fat, (0, 0), "/", ent)

lost_clusters = 0
for i in xrange(self.allocatable_cluster_end):
for i in range(self.allocatable_cluster_end):
a = self.lookup_fat(i)
if (a & PS2MC_FAT_ALLOCATED_BIT) and not fat[i]:
print(i,)
Expand Down