summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2006-12-14 02:32:39 +0000
committerDave Chapman <dave@dchapman.com>2006-12-14 02:32:39 +0000
commit8f08f29a6607c529c627855a0753f76da73e13c0 (patch)
treec3c60d982368f117a76865dae4896af61058c7b1 /tools
parentc5e30e15ec423a0b8df4f54ed921d3d17b143481 (diff)
downloadrockbox-8f08f29a6607c529c627855a0753f76da73e13c0.tar.gz
rockbox-8f08f29a6607c529c627855a0753f76da73e13c0.tar.bz2
rockbox-8f08f29a6607c529c627855a0753f76da73e13c0.zip
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
Diffstat (limited to 'tools')
-rw-r--r--tools/ipodpatcher/ipodpatcher.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/ipodpatcher/ipodpatcher.c b/tools/ipodpatcher/ipodpatcher.c
index bfad75b98a..a745b92c49 100644
--- a/tools/ipodpatcher/ipodpatcher.c
+++ b/tools/ipodpatcher/ipodpatcher.c
@@ -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 i;
- unsigned char sector[MAX_SECTOR_SIZE];
unsigned long count;
- count = ipod_read(dh,sector,sector_size);
+ count = ipod_read(dh,sectorbuf,sector_size);
if (count <= 0) {
print_error(" Error reading from disk: ");
@@ -212,7 +211,7 @@ int read_partinfo(HANDLE dh, int sector_size, struct partinfo_t* pinfo)
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)
{
int res;
@@ -220,9 +219,9 @@ int read_partition(HANDLE dh, int outfile,unsigned long start,
int bytesleft;
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;
}
@@ -269,7 +268,8 @@ int read_partition(HANDLE dh, int outfile,unsigned long start,
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;
int n;
@@ -278,7 +278,7 @@ int write_partition(HANDLE dh, int infile,unsigned long start, int sector_size)
int eof;
int padding = 0;
- if (ipod_seek(dh, start*sector_size) < 0) {
+ if (ipod_seek(dh, start_sector*sector_size) < 0) {
return -1;
}