From cfcc08137d844a35899bdaea3aa77052a7a4b11d Mon Sep 17 00:00:00 2001 From: Adrian Lees Date: Sat, 9 Jul 2005 18:30:28 +0000 Subject: [PATCH] [project @ 2005-07-09 18:30:28 by adrianl] Stylistic changes svn path=/import/netsurf/; revision=1791 --- riscos/download.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/riscos/download.c b/riscos/download.c index 491adcea0..3f64cd315 100644 --- a/riscos/download.c +++ b/riscos/download.c @@ -864,7 +864,6 @@ bool ro_gui_download_check_space(struct gui_download_window *dw, if ((bits)max_file < dw->total_size || (!free_hi && free_lo < dw->total_size)) { char *dest_canon, *orig_canon; - const char *a, *b; bits space; if (!orig_file || !dw->file) { @@ -881,25 +880,22 @@ bool ro_gui_download_check_space(struct gui_download_window *dw, if (!orig_canon) orig_canon = (char*)orig_file; /* not enough space; allow for the file's original location - when space is tight (assuming the FS isn't brain damaged!) */ + when space is tight by comparing the first part of the two + pathnames (and assuming the FS isn't brain damaged!) */ - a = dest_canon; b = orig_canon; - while (toupper(*a) == toupper(*b)) { - if (*a == '.' && *b == '.') { - int allocation; + char *dot = strchr(orig_canon, '.'); + if (dot && !strncasecmp(dest_canon, orig_canon, (dot + 1) - orig_canon)) { + int allocation; - error = xosargs_read_allocation(dw->file, - &allocation); - if (error) { - LOG(("xosargs_read_allocation: 0x%x : %s", - error->errnum, error->errmess)); - } - else { - space += allocation; - } - break; + error = xosargs_read_allocation(dw->file, + &allocation); + if (error) { + LOG(("xosargs_read_allocation: 0x%x : %s", + error->errnum, error->errmess)); + } + else { + space += allocation; } - a++; b++; } if (dest_canon != dest_file) free(dest_canon);