Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: [PATCH] bug fix in fat_seek()

[PATCH] bug fix in fat_seek()

From: Hardeep Sidhu <hardeeps_at_pobox.com>
Date: Tue, 23 Jul 2002 23:42:11 -0700

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
_at__at_ -926,9 +926,19 _at__at_
             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;
Received on 2002-07-24

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy