Changeset 07b2e364addba87a4f304d3a3dfd2db79103e76e

Show
Ignore:
Timestamp:
10/11/06 21:10:23 (2 years ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1163189423 +0000
git-parent:

[497a6b5b58f15feeb8340c392b7aec0bc9818f6e]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1163189423 +0000
Message:

Code factorization and some warning fixes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/access/directory.c

    r415749b r07b2e36  
    7575        "expand: all subdirectories are expanded.\n" ) 
    7676 
    77 static char *psz_recursive_list[] = { "none", "collapse", "expand" }; 
    78 static char *psz_recursive_list_text[] = { N_("none"), N_("collapse"), 
    79                                            N_("expand") }; 
     77static const char *psz_recursive_list[] = { "none", "collapse", "expand" }; 
     78static const char *psz_recursive_list_text[] = { N_("none"), N_("collapse"), 
     79                                                 N_("expand") }; 
    8080 
    8181#define IGNORE_TEXT N_("Ignored extensions") 
     
    135135    access_t *p_access = (access_t*)p_this; 
    136136 
     137    struct stat stat_info; 
     138 
    137139#ifdef HAVE_SYS_STAT_H 
    138     struct stat stat_info; 
    139     char *psz_path = ToLocale( p_access->psz_path ); 
    140  
    141     if( ( stat( psz_path, &stat_info ) == -1 ) || 
    142         !S_ISDIR( stat_info.st_mode ) ) 
    143 #elif defined(WIN32) 
    144     int i_ret; 
    145  
    146 #   ifdef UNICODE 
    147     wchar_t psz_path[MAX_PATH]; 
    148     mbstowcs( psz_path, p_access->psz_path, MAX_PATH ); 
    149     psz_path[MAX_PATH-1] = 0; 
    150 #   else 
    151     char *psz_path = p_access->psz_path; 
    152 #   endif /* UNICODE */ 
    153  
    154     i_ret = GetFileAttributes( psz_path ); 
    155     if( i_ret == -1 || !(i_ret & FILE_ATTRIBUTE_DIRECTORY) ) 
    156  
     140    if (utf8_stat (p_access->psz_path, &stat_info) 
     141     || !S_ISDIR (stat_info.st_mode)) 
    157142#else 
    158143    if( strcmp( p_access->psz_access, "dir") && 
    159144        strcmp( p_access->psz_access, "directory") ) 
    160145#endif 
    161     { 
    162         LocaleFree( psz_path ); 
    163146        return VLC_EGENERIC; 
    164     } 
    165  
    166     LocaleFree( psz_path ); 
     147 
    167148    p_access->pf_read  = Read; 
    168149    p_access->pf_block = NULL;