1
0
Fork 0
forked from len0rd/rockbox

Correct a bug (thanks to Llorean for spotting) in read_partition and use the aligned global sectorbuf for the disk read in read_partinfo instead of a local variable

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11756 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dave Chapman 2006-12-14 02:32:39 +00:00
parent c5e30e15ec
commit 8f08f29a66

View file

@ -173,10 +173,9 @@ void display_partinfo(struct partinfo_t* pinfo, int sector_size)
int read_partinfo(HANDLE dh, int sector_size, struct partinfo_t* pinfo) int read_partinfo(HANDLE dh, int sector_size, struct partinfo_t* pinfo)
{ {
int i; int i;
unsigned char sector[MAX_SECTOR_SIZE];
unsigned long count; unsigned long count;
count = ipod_read(dh,sector,sector_size); count = ipod_read(dh,sectorbuf,sector_size);
if (count <= 0) { if (count <= 0) {
print_error(" Error reading from disk: "); print_error(" Error reading from disk: ");
@ -212,7 +211,7 @@ int read_partinfo(HANDLE dh, int sector_size, struct partinfo_t* pinfo)
return 0; return 0;
} }
int read_partition(HANDLE dh, int outfile,unsigned long start, int read_partition(HANDLE dh, int outfile,unsigned long start_sector,
unsigned long count, int sector_size) unsigned long count, int sector_size)
{ {
int res; int res;
@ -220,9 +219,9 @@ int read_partition(HANDLE dh, int outfile,unsigned long start,
int bytesleft; int bytesleft;
int chunksize; int chunksize;
fprintf(stderr,"[INFO] Seeking to sector %ld\n",start); fprintf(stderr,"[INFO] Seeking to sector %ld\n",start_sector);
if (ipod_seek(dh,start) < 0) { if (ipod_seek(dh,start_sector*sector_size) < 0) {
return -1; return -1;
} }
@ -269,7 +268,8 @@ int read_partition(HANDLE dh, int outfile,unsigned long start,
return 0; return 0;
} }
int write_partition(HANDLE dh, int infile,unsigned long start, int sector_size) int write_partition(HANDLE dh, int infile,unsigned long start_sector,
int sector_size)
{ {
unsigned long res; unsigned long res;
int n; int n;
@ -278,7 +278,7 @@ int write_partition(HANDLE dh, int infile,unsigned long start, int sector_size)
int eof; int eof;
int padding = 0; int padding = 0;
if (ipod_seek(dh, start*sector_size) < 0) { if (ipod_seek(dh, start_sector*sector_size) < 0) {
return -1; return -1;
} }