typedef int (*cmpfnc)(const void *, const void *);
+int fcmp(const void *d1, const void *d2) {
+ const char **f1 = (const char **)d1;
+ const char **f2 = (const char **)d2;
+ int r = strcmp(*f1, *f2);
+ return r;
+}
+
char* util_find_next_file(char *current_file) {
char *current_folder = util_parent_path(current_file);
char *current_file_name = util_resource_name(current_file);
char *result = NULL;
if(!abort) {
- qsort(files, nfiles, sizeof(char*), (cmpfnc)strcmp);
+ qsort(files, nfiles, sizeof(char*), fcmp);
// search array for current file and return the successor
for(int i=0;i<nfiles;i++) {
+ char *c = files[i];
if(!strcmp(files[i], current_file_name)) {
if(i + 1 < nfiles) {
result = util_concat_path(current_folder, files[i+1]);