diff options
| author | nirav <nirav@teisuu.com> | 2018-09-05 00:35:24 +0530 | 
|---|---|---|
| committer | Dandelion <nirav@teisuu.com> | 2018-09-07 21:16:09 +0530 | 
| commit | 02f7a54e67260ee7995c6cd9bf40ae784b60203d (patch) | |
| tree | d8bb663f273f4adf1d737ea39f19e5154c9ac07c /file.c | |
| parent | 28e58ba0dbf30a4a28465f460c67e1c4337bd3a4 (diff) | |
| download | im-02f7a54e67260ee7995c6cd9bf40ae784b60203d.tar.gz im-02f7a54e67260ee7995c6cd9bf40ae784b60203d.zip  | |
Added image panning support, refactoring
Diffstat (limited to 'file.c')
| -rw-r--r-- | file.c | 6 | 
1 files changed, 2 insertions, 4 deletions
@@ -1,5 +1,6 @@  #include "file.h"  #include <dirent.h> +#include <gtk-3.0/gtk/gtk.h>  #include <libgen.h>  #include <stdio.h>  #include <stdlib.h> @@ -27,7 +28,6 @@ int scan(const char *file_name)  {      struct dirent **name_list;      char *dir_name = dirname(strdup(file_name)); -    size_t dir_name_len = strlen(dir_name);      file_list_count = scandir(dir_name, &name_list, image_filter, alphasort);      if (file_list_count < 0) {          return -1; @@ -39,9 +39,7 @@ int scan(const char *file_name)      while (i < file_list_count) {          if (!strcmp(file_basename, name_list[i]->d_name))              curr_file_index = i; -        file_list[i] = malloc( -            (strlen(name_list[i]->d_name) + dir_name_len + 2) * sizeof(char *)); -        sprintf(file_list[i], "%s/%s", dir_name, name_list[i]->d_name); +        file_list[i] = g_build_filename(dir_name, name_list[i]->d_name, NULL);          free(name_list[i]);          i++;      }  | 
