From: Tollef Fog Heen Date: Fri, 6 Jan 2012 22:22:25 +0000 (+0100) Subject: Loosen restrictions on interesting file somewhat X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=423b554e781f7bf523cf2161991a764f9ae8a0ce;p=gant Loosen restrictions on interesting file somewhat Whether the file number is above the number of entries seen or not should not matter, since there might be holes. --- diff --git a/fr60.c b/fr60.c index 1509909..e0d6a1c 100644 --- a/fr60.c +++ b/fr60.c @@ -400,13 +400,12 @@ save_antfs_file(const uchar chan, const uchar* blast, uint blsize) return 0; } -static int interesting_file(struct antfs_dir_entry *e, int dir_used) { +static int interesting_file(struct antfs_dir_entry *e) { char ts[256], filename[256]; struct stat statbuf; if (!(e->filetype == FILETYPE_FIT && ( e->subfiletype == SF_FIT_ACTIVITY || - e->subfiletype == SF_FIT_WORKOUT ) && - e->fileno < dir_used)) + e->subfiletype == SF_FIT_WORKOUT ))) return 0; format_time(ts, FIT_TIMESTAMP_PATTERN, 256, e->last_modified); @@ -666,7 +665,8 @@ chevent(uchar chan, uchar event) } } else { downloadingfilenum = 0; - while (! interesting_file(&antfsdir[downloadingfilenum], antfsdir_used)) { + while (downloadingfilenum < antfsdir_used && + ! interesting_file(&antfsdir[downloadingfilenum])) { D("Skipping %d; not .fit file/not interesting\n", downloadingfilenum); downloadingfilenum++; } @@ -687,7 +687,7 @@ chevent(uchar chan, uchar event) } else { downloadingfilenum++; while (downloadingfilenum < antfsdir_used && - ! interesting_file(&antfsdir[downloadingfilenum], antfsdir_used)) { + ! interesting_file(&antfsdir[downloadingfilenum])) { D("Skipping %d; not .fit file\n", downloadingfilenum); downloadingfilenum++; }