mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 13:11:31 +00:00
FAT: Simplify get_contents
One call to get_cluster can be factorized with another, so avoid duplicating code. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Cc: Wolfgang Denk <wd@denx.de>
This commit is contained in:
parent
cc63b25efb
commit
0880e5bb0c
1 changed files with 1 additions and 13 deletions
14
fs/fat/fat.c
14
fs/fat/fat.c
|
@ -367,21 +367,9 @@ get_contents(fsdata *mydata, dir_entry *dentptr, __u8 *buffer,
|
|||
actsize += bytesperclust;
|
||||
}
|
||||
|
||||
/* actsize >= file size */
|
||||
actsize -= bytesperclust;
|
||||
|
||||
/* get remaining clusters */
|
||||
if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
|
||||
printf("Error reading cluster\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* get remaining bytes */
|
||||
gotsize += (int)actsize;
|
||||
filesize -= actsize;
|
||||
buffer += actsize;
|
||||
actsize = filesize;
|
||||
if (get_cluster(mydata, endclust, buffer, (int)actsize) != 0) {
|
||||
if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
|
||||
printf("Error reading cluster\n");
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue