mirror of
https://github.com/wiiu-env/libfat.git
synced 2024-11-25 19:36:52 +01:00
simplified read/write position reset
This commit is contained in:
parent
ef3f19697c
commit
25b615836f
@ -594,16 +594,15 @@ int _FAT_write_r (struct _reent *r,int fd, const char *ptr, int len) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
file->startCluster = tempNextCluster;
|
file->startCluster = tempNextCluster;
|
||||||
|
|
||||||
// Appending starts at the begining for a 0 byte file
|
// Appending starts at the begining for a 0 byte file
|
||||||
file->appendPosition.cluster = file->startCluster;
|
file->appendPosition.cluster = file->startCluster;
|
||||||
file->appendPosition.sector = 0;
|
file->appendPosition.sector = 0;
|
||||||
file->appendPosition.byte = 0;
|
file->appendPosition.byte = 0;
|
||||||
|
|
||||||
if ( file->currentPosition < partition->bytesPerCluster ) {
|
|
||||||
file->rwPosition.cluster = file->startCluster;
|
file->rwPosition.cluster = file->startCluster;
|
||||||
file->rwPosition.sector = (file->currentPosition % partition->bytesPerCluster) / BYTES_PER_READ;
|
file->rwPosition.sector = 0;
|
||||||
file->rwPosition.byte = file->currentPosition % BYTES_PER_READ;
|
file->rwPosition.byte = 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file->append) {
|
if (file->append) {
|
||||||
|
Loading…
Reference in New Issue
Block a user