freemyipod r477 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r476‎ | r477 | r478 >
Date:03:11, 22 January 2011
Author:farthen
Status:new
Tags:
Comment:
emcore.py: file I/O: Another one!
Modified paths:
  • /emcore/trunk/tools/emcore.py (modified) (history)

Diff [purge]

Index: emcore/trunk/tools/emcore.py
@@ -901,7 +901,7 @@
902902 storageinfo = self.emcore.storage_get_info(volume)
903903 while count > 0:
904904 sectors = min(count, int(buffsize / storageinfo.sectorsize))
905 - self.emcore.storage_read_sectors_md(volume, sector, sectors, buffer, buffsize)
 905+ self.emcore.storage_read_sectors_md(volume, sector, sectors, buffsize, buffer)
906906 f.write(self.emcore.read(buffer, storageinfo.sectorsize * sectors))
907907 sector = sector + sectors
908908 count = count - sectors
@@ -941,7 +941,7 @@
942942 if len(data) == 0: break
943943 while len(data) < bytes: data = data + f.read(bytes - len(data))
944944 self.emcore.write(buffer, data)
945 - self.emcore.storage_write_sectors_md(volume, sector, sectors, buffer, buffsize)
 945+ self.emcore.storage_write_sectors_md(volume, sector, sectors, buffsize, buffer)
946946 sector = sector + sectors
947947 count = count - sectors
948948 f.close()
@@ -1029,7 +1029,7 @@
10301030 fd = self.emcore.file_open(remotename, 0)
10311031 size = self.emcore.file_size(fd)
10321032 while size > 0:
1033 - bytes = self.emcore.file_read(fd, buffer, buffsize)
 1033+ bytes = self.emcore.file_read(fd, buffsize, buffer)
10341034 f.write(self.emcore.read(buffer, bytes))
10351035 size = size - bytes
10361036 self.emcore.file_close(fd)
@@ -1065,8 +1065,8 @@
10661066 entry = self.emcore.dir_read(handle)
10671067 if entry.name == "." or entry.name == "..": continue
10681068 elif entry.attributes & 0x10:
1069 - self.gettree(remotepath + "/" + entry.name, localpath + "/" + entry.name, buffer, buffsize)
1070 - else: self.get(remotepath + "/" + entry.name, localpath + "/" + entry.name, buffer, buffsize)
 1069+ self.gettree(remotepath + "/" + entry.name, localpath + "/" + entry.name, buffsize, buffer)
 1070+ else: self.get(remotepath + "/" + entry.name, localpath + "/" + entry.name, buffsize, buffer)
10711071 except: break
10721072 self.emcore.dir_close(handle)
10731073 finally:
@@ -1102,7 +1102,7 @@
11031103 self.emcore.write(buffer, data)
11041104 bytes = 0
11051105 while bytes < len(data):
1106 - bytes = bytes + self.emcore.file_write(fd, buffer + bytes, len(data) - bytes)
 1106+ bytes = bytes + self.emcore.file_write(fd, len(data) - bytes, buffer + bytes)
11071107 self.emcore.file_close(fd)
11081108 f.close()
11091109 finally:
@@ -1138,7 +1138,7 @@
11391139 except: self.logger.info(" failed\n")
11401140 for f in d[2]:
11411141 if not prefix.find("/.svn/") > -1:
1142 - self.put(d[0] + "/" + f, prefix + f, buffer, buffsize)
 1142+ self.put(d[0] + "/" + f, prefix + f, buffsize, buffer)
11431143 finally:
11441144 if malloc == True:
11451145 self.emcore.free(buffer)