From 53e3d7582b0b294cbefc3c74030e6d7cacd8e065 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 26 Aug 2005 20:06:29 +0000 Subject: 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 --- src/filename_list.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') 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 (lend_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); -- cgit v1.2.3