Rockbox mail archive
Subject: [PATCH] bug fix in fat_seek()
From: Hardeep Sidhu (hardeeps_at_pobox.com)
Date: 2002-07-24
fat_seek() was incorrectly returning an error when seeking to the end of a
file whose size was a multiple of SECTOR_SIZE. Problem I encountered was
song length being displayed as 0. Patch attached.
--- orig/firmware/drivers/fat.c Mon Jul 15 16:39:06 2002
+++ firmware/drivers/fat.c Tue Jul 23 23:28:56 2002
@@ -926,9 +926,19 @@
if ( numsec >= fat_bpb.bpb_secperclus ) {
cluster = get_next_cluster(cluster);
if (!cluster)
+ {
/* end of file */
- return -1;
-
+ if (i == (seeksector-1))
+ {
+ /* seeksector is last sector in file */
+ sector = -1;
+ break;
+ }
+ else
+ /* attempting to seek beyond end of file */
+ return -1;
+ }
+
sector = cluster2sec(cluster);
if (sector<0)
return -2;
Page was last modified "Jan 10 2012" The Rockbox Crew
|