aboutsummaryrefslogtreecommitdiff
path: root/src/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/file.c')
-rw-r--r--src/file.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/file.c b/src/file.c
index 3a6b005..423725c 100644
--- a/src/file.c
+++ b/src/file.c
@@ -1,6 +1,5 @@
#define _DEFAULT_SOURCE
-#include "file.h"
-#include "image.h"
+
#include <dirent.h>
#include <gtk-3.0/gtk/gtk.h>
#include <libgen.h>
@@ -9,6 +8,9 @@
#include <string.h>
#include <sys/types.h>
+#include "file.h"
+#include "image.h"
+
static int curr_file_index, file_list_count;
static char **file_list;
static char **extensions = NULL;
@@ -69,14 +71,15 @@ int image_filter(const struct dirent *dir)
return 0;
}
-int scan(const char *file_name)
+void scan(const char *file_name)
{
scan_supported_formats();
struct dirent **name_list;
char *dir_name = dirname(strdup(file_name));
file_list_count = scandir(dir_name, &name_list, image_filter, alphasort);
if (file_list_count < 0) {
- return -1;
+ g_printerr("failed to read direcory %s for image files", dir_name);
+ return;
}
file_list = malloc(file_list_count * sizeof(char *));
@@ -90,8 +93,6 @@ int scan(const char *file_name)
i++;
}
free(name_list);
-
- return 0;
}
void next_file()