]> err.no Git - gant/commitdiff
Loosen restrictions on interesting file somewhat
authorTollef Fog Heen <tfheen@err.no>
Fri, 6 Jan 2012 22:22:25 +0000 (23:22 +0100)
committerTollef Fog Heen <tfheen@err.no>
Fri, 6 Jan 2012 22:22:25 +0000 (23:22 +0100)
Whether the file number is above the number of entries seen or not
should not matter, since there might be holes.

fr60.c

diff --git a/fr60.c b/fr60.c
index 1509909443ea4f143430f53292a6f668640e7f81..e0d6a1ca245051dcb508ceb40ee983e254fdabcb 100644 (file)
--- 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++;
                                                }