From 423b554e781f7bf523cf2161991a764f9ae8a0ce Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Fri, 6 Jan 2012 23:22:25 +0100 Subject: [PATCH] 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. --- fr60.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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++; } -- 2.39.5