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
This commit is contained in:
Matthias Melcher 2005-08-26 20:06:29 +00:00
parent 16719ceb8c
commit 53e3d7582b

View File

@ -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... // Use memcpy for speed since we already know the length of the string...
memcpy(name, de->d_name, len+1); memcpy(name, de->d_name, len+1);
if (fl_filename_isdir(fullname)) { if (fl_filename_isdir(fullname)) {
if (len<FL_PATH_MAX) { (*list)[i] = de = (dirent*)realloc(de, de->d_name - (char*)de + len + 2);
char *dst = de->d_name + len; char *dst = de->d_name + len;
*dst++ = '/'; *dst++ = '/';
*dst = 0; *dst = 0;
}
} }
} }
free(fullname); free(fullname);