mirror of https://github.com/fltk/fltk
Fixed definitions of scandir, numericsort, and alphasort (no const!)
git-svn-id: file:///fltk/svn/fltk/trunk@26 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
74858f12e3
commit
0f60ac9155
|
@ -29,13 +29,13 @@
|
|||
#include <FL/filename.H>
|
||||
|
||||
extern "C" {
|
||||
int numericsort(const dirent **, const dirent **);
|
||||
int numericsort(dirent **, dirent **);
|
||||
#if HAVE_SCANDIR
|
||||
#else
|
||||
int alphasort(const dirent **, const dirent **);
|
||||
int alphasort(dirent **, dirent **);
|
||||
int scandir (const char *dir, dirent ***namelist,
|
||||
int (*select)(const dirent *),
|
||||
int (*compar)(const dirent **, const dirent **));
|
||||
int (*select)(dirent *),
|
||||
int (*compar)(dirent **, dirent **));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -46,14 +46,10 @@ int filename_list(const char *d, dirent ***list) {
|
|||
// of pointer indirection is missing:
|
||||
return scandir(d, list, 0, (int(*)(const void*,const void*))numericsort);
|
||||
#else
|
||||
#if HAVE_SCANDIR
|
||||
return scandir(d, list, 0, (int(*)(const dirent**,const dirent**))numericsort);
|
||||
#else // built-in scandir is const-correct:
|
||||
return scandir(d, list, 0, numericsort);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: filename_list.cxx,v 1.3 1998/10/19 20:46:24 mike Exp $".
|
||||
// End of "$Id: filename_list.cxx,v 1.4 1998/10/20 23:58:30 mike Exp $".
|
||||
//
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
int numericsort(const struct dirent **A, const struct dirent **B) {
|
||||
int numericsort(struct dirent **A, struct dirent **B) {
|
||||
const char* a = (*A)->d_name;
|
||||
const char* b = (*B)->d_name;
|
||||
int ret = 0;
|
||||
|
@ -80,6 +80,6 @@ int numericsort(const struct dirent **A, const struct dirent **B) {
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: numericsort.c,v 1.4 1998/10/19 20:46:57 mike Exp $".
|
||||
//
|
||||
/*
|
||||
* End of "$Id: numericsort.c,v 1.5 1998/10/20 23:58:31 mike Exp $".
|
||||
*/
|
||||
|
|
|
@ -50,8 +50,8 @@ USA. */
|
|||
|
||||
int
|
||||
scandir (const char *dir, struct dirent ***namelist,
|
||||
int (*select)(const struct dirent *),
|
||||
int (*compar)(const struct dirent **, const struct dirent **))
|
||||
int (*select)(struct dirent *),
|
||||
int (*compar)(struct dirent **, struct dirent **))
|
||||
{
|
||||
DIR *dp = opendir (dir);
|
||||
struct dirent **v = NULL;
|
||||
|
@ -120,7 +120,7 @@ scandir (const char *dir, struct dirent ***namelist,
|
|||
return i;
|
||||
}
|
||||
|
||||
int alphasort (const struct dirent **a, const struct dirent **b) {
|
||||
int alphasort (struct dirent **a, struct dirent **b) {
|
||||
return strcmp ((*a)->d_name, (*b)->d_name);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
extern "C"
|
||||
#endif
|
||||
int scandir(const char *dirname, struct dirent ***namelist,
|
||||
int (*select)(const struct dirent *),
|
||||
int (*compar)(const struct dirent **, const struct dirent **)) {
|
||||
int (*select)(struct dirent *),
|
||||
int (*compar)(struct dirent **, struct dirent **)) {
|
||||
|
||||
int len = strlen(dirname);
|
||||
char *findIn = new char[len+5]; strcpy(findIn, dirname);
|
||||
|
@ -100,10 +100,10 @@ int scandir(const char *dirname, struct dirent ***namelist,
|
|||
return nDir;
|
||||
}
|
||||
|
||||
int alphasort (const struct dirent **a, const struct dirent **b) {
|
||||
int alphasort (struct dirent **a, struct dirent **b) {
|
||||
return strcmp ((*a)->d_name, (*b)->d_name);
|
||||
}
|
||||
|
||||
//
|
||||
// End of "$Id: scandir_win32.c,v 1.4 1998/10/19 20:46:58 mike Exp $".
|
||||
// End of "$Id: scandir_win32.c,v 1.5 1998/10/20 23:58:32 mike Exp $".
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue