diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2003-09-03 19:38:01 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2003-09-03 19:38:01 +0000 |
| commit | cf40467b5bade681e67fc977401c2ccdbf845788 (patch) | |
| tree | 8bc3194717d45dec44666cee716e6bd1a956046d /src/Fl_File_Chooser2.cxx | |
| parent | daccac9672a336b7eae79a2a4efc6c877442f132 (diff) | |
Fix performance issues with large file chooser selections. (STR #140)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3087 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_File_Chooser2.cxx')
| -rw-r--r-- | src/Fl_File_Chooser2.cxx | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx index 914f72809..ce1c5d25c 100644 --- a/src/Fl_File_Chooser2.cxx +++ b/src/Fl_File_Chooser2.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.31 2003/05/26 01:39:53 easysw Exp $" +// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.32 2003/09/03 19:38:01 easysw Exp $" // // More Fl_File_Chooser routines. // @@ -112,7 +112,6 @@ Fl_File_Chooser::count() int i; // Looping var int fcount; // Number of selected files const char *filename; // Filename in input field or list - char pathname[1024]; // Full path to file if (!(type_ & MULTI)) @@ -134,12 +133,8 @@ Fl_File_Chooser::count() { // See if this file is a directory... filename = (char *)fileList->text(i); - if (directory_[0] != '\0') - snprintf(pathname, sizeof(pathname), "%s/%s", directory_, filename); - else - strlcpy(pathname, filename, sizeof(pathname)); - if (!fl_filename_isdir(pathname)) + if (filename[strlen(filename) - 1] != '/') fcount ++; } @@ -1027,16 +1022,19 @@ Fl_File_Chooser::value(int f) // I - File number // See if this file is a directory... name = fileList->text(i); - if (directory_[0]) { - snprintf(pathname, sizeof(pathname), "%s/%s", directory_, name); - } else { - strlcpy(pathname, name, sizeof(pathname)); - } - - if (!fl_filename_isdir(pathname)) { - // Nope, see if this this is "the one"... + if (name[strlen(name) - 1] != '/') { + // Not a directory, see if this this is "the one"... fcount ++; - if (fcount == f) return (pathname); + + if (fcount == f) { + if (directory_[0]) { + snprintf(pathname, sizeof(pathname), "%s/%s", directory_, name); + } else { + strlcpy(pathname, name, sizeof(pathname)); + } + + return (pathname); + } } } @@ -1165,5 +1163,5 @@ unquote_pathname(char *dst, // O - Destination string // -// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.31 2003/05/26 01:39:53 easysw Exp $". +// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.32 2003/09/03 19:38:01 easysw Exp $". // |
