formatting, whitespaces--

SVN revision: 54221
This commit is contained in:
Vincent Torri 2010-11-06 07:37:52 +00:00
parent 66b9ed8926
commit eccd70139b
1 changed files with 33 additions and 21 deletions

View File

@ -70,6 +70,14 @@ void *alloca (size_t);
#include "eina_file.h" #include "eina_file.h"
#include "eina_stringshare.h" #include "eina_stringshare.h"
/*============================================================================*
* Local *
*============================================================================*/
/**
* @cond LOCAL
*/
typedef struct _Eina_File_Iterator Eina_File_Iterator; typedef struct _Eina_File_Iterator Eina_File_Iterator;
struct _Eina_File_Iterator struct _Eina_File_Iterator
{ {
@ -112,7 +120,7 @@ _eina_dirent_buffer_size(DIR *dirp)
name_max = pathconf(dirp, _PC_NAME_MAX); name_max = pathconf(dirp, _PC_NAME_MAX);
# else # else
# error "buffer size for readdir_r cannot be determined safely" # error "buffer size for readdir_r cannot be determined safely"
# endif # endif
# endif # endif
#endif #endif
name_end = (size_t) offsetof(struct dirent, d_name) + name_max + 1; name_end = (size_t) offsetof(struct dirent, d_name) + name_max + 1;
@ -312,6 +320,10 @@ _eina_file_stat_ls_iterator_next(Eina_File_Direct_Iterator *it, void **data)
return EINA_TRUE; return EINA_TRUE;
} }
/**
* @endcond
*/
/*============================================================================* /*============================================================================*
* Global * * Global *
*============================================================================*/ *============================================================================*/
@ -362,10 +374,10 @@ eina_file_dir_list(const char *dir,
int dlength; int dlength;
struct dirent *de; struct dirent *de;
DIR *d; DIR *d;
#ifndef _DIRENT_HAVE_D_TYPE # ifndef _DIRENT_HAVE_D_TYPE
struct stat st; struct stat st;
#endif # endif
EINA_SAFETY_ON_NULL_RETURN_VAL(cb, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(cb, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(dir, EINA_FALSE); EINA_SAFETY_ON_NULL_RETURN_VAL(dir, EINA_FALSE);
EINA_SAFETY_ON_TRUE_RETURN_VAL(dir[0] == '\0', EINA_FALSE); EINA_SAFETY_ON_TRUE_RETURN_VAL(dir[0] == '\0', EINA_FALSE);
@ -389,25 +401,25 @@ eina_file_dir_list(const char *dir,
{ {
char *path; char *path;
int length; int length;
#ifdef _DIRENT_HAVE_D_NAMLEN # ifdef _DIRENT_HAVE_D_NAMLEN
length = de->d_namlen; length = de->d_namlen;
#else # else
length = strlen(de->d_name); length = strlen(de->d_name);
#endif # endif
path = alloca(dlength + length + 2); path = alloca(dlength + length + 2);
strcpy(path, dir); strcpy(path, dir);
strcat(path, "/"); strcat(path, "/");
strcat(path, de->d_name); strcat(path, de->d_name);
#ifdef _DIRENT_HAVE_D_TYPE # ifdef _DIRENT_HAVE_D_TYPE
if (de->d_type != DT_DIR) if (de->d_type != DT_DIR)
continue; continue;
#else # else
if (stat(path, &st)) if (stat(path, &st))
continue; continue;
if (!S_ISDIR(st.st_mode)) if (!S_ISDIR(st.st_mode))
continue; continue;
#endif # endif
eina_file_dir_list(path, recursive, cb, data); eina_file_dir_list(path, recursive, cb, data);
} }
} }
@ -432,15 +444,15 @@ eina_file_dir_list(const char *dir,
memcpy(new_dir, dir, length_dir); memcpy(new_dir, dir, length_dir);
memcpy(new_dir + length_dir, "/*.*", 5); memcpy(new_dir + length_dir, "/*.*", 5);
#ifdef UNICODE # ifdef UNICODE
tdir = evil_char_to_wchar(new_dir); tdir = evil_char_to_wchar(new_dir);
#else # else
tdir = new_dir; tdir = new_dir;
#endif /* ! UNICODE */ # endif /* ! UNICODE */
hSearch = FindFirstFile(tdir, &file); hSearch = FindFirstFile(tdir, &file);
#ifdef UNICODE # ifdef UNICODE
free(tdir); free(tdir);
#endif /* UNICODE */ # endif /* UNICODE */
if (hSearch == INVALID_HANDLE_VALUE) if (hSearch == INVALID_HANDLE_VALUE)
return EINA_FALSE; return EINA_FALSE;
@ -449,11 +461,11 @@ eina_file_dir_list(const char *dir,
{ {
char *filename; char *filename;
#ifdef UNICODE # ifdef UNICODE
filename = evil_wchar_to_char(file.cFileName); filename = evil_wchar_to_char(file.cFileName);
#else # else
filename = file.cFileName; filename = file.cFileName;
#endif /* ! UNICODE */ # endif /* ! UNICODE */
if (!strcmp(filename, ".") || !strcmp(filename, "..")) if (!strcmp(filename, ".") || !strcmp(filename, ".."))
continue; continue;
@ -474,9 +486,9 @@ eina_file_dir_list(const char *dir,
eina_file_dir_list(path, recursive, cb, data); eina_file_dir_list(path, recursive, cb, data);
} }
#ifdef UNICODE # ifdef UNICODE
free(filename); free(filename);
#endif /* UNICODE */ # endif /* UNICODE */
} while (FindNextFile(hSearch, &file)); } while (FindNextFile(hSearch, &file));
FindClose(hSearch); FindClose(hSearch);