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);
}
} 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++;
}
} 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++;
}