develop.uap-core.de/git
/
uwplayer.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2d586cf
)
fix qsort call in util_find_next_file
author
Olaf Wintermann
<olaf.wintermann@gmail.com>
Sun, 16 Jan 2022 21:09:53 +0000
(22:09 +0100)
committer
Olaf Wintermann
<olaf.wintermann@gmail.com>
Sun, 16 Jan 2022 21:09:53 +0000
(22:09 +0100)
application/utils.c
patch
|
blob
|
history
diff --git
a/application/utils.c
b/application/utils.c
index
7d123e3
..
fd615fd
100644
(file)
--- a/
application/utils.c
+++ b/
application/utils.c
@@
-91,6
+91,13
@@
char* util_parent_path(const char *path) {
typedef int (*cmpfnc)(const void *, const void *);
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* util_find_next_file(char *current_file) {
char *current_folder = util_parent_path(current_file);
char *current_file_name = util_resource_name(current_file);
@@
-143,9
+150,10
@@
char* util_find_next_file(char *current_file) {
char *result = NULL;
if(!abort) {
char *result = NULL;
if(!abort) {
- qsort(files, nfiles, sizeof(char*),
(cmpfnc)str
cmp);
+ qsort(files, nfiles, sizeof(char*),
f
cmp);
// search array for current file and return the successor
for(int i=0;i<nfiles;i++) {
// 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]);
if(!strcmp(files[i], current_file_name)) {
if(i + 1 < nfiles) {
result = util_concat_path(current_folder, files[i+1]);