diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2005-08-26 20:06:29 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2005-08-26 20:06:29 +0000 |
| commit | 53e3d7582b0b294cbefc3c74030e6d7cacd8e065 (patch) | |
| tree | 88ff4cb7ceca58fcba827604d296f3709d2d1e41 | |
| parent | 16719ceb8c6184f97183afb055b2e0ddad61a03b (diff) | |
Fixed dirent list by making room for the additional '/' character on directory names. FLTK does not care about the internals of the dirent structure. We only support the member d_name. All other members are non-standard anyways on not available on Win32.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4540 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | src/filename_list.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/filename_list.cxx b/src/filename_list.cxx index b2b3858c7..4276a6cf5 100644 --- a/src/filename_list.cxx +++ b/src/filename_list.cxx @@ -91,11 +91,10 @@ int fl_filename_list(const char *d, dirent ***list, // Use memcpy for speed since we already know the length of the string... memcpy(name, de->d_name, len+1); if (fl_filename_isdir(fullname)) { - if (len<FL_PATH_MAX) { - char *dst = de->d_name + len; - *dst++ = '/'; - *dst = 0; - } + (*list)[i] = de = (dirent*)realloc(de, de->d_name - (char*)de + len + 2); + char *dst = de->d_name + len; + *dst++ = '/'; + *dst = 0; } } free(fullname); |
