Changeset 08936b3bbeae3b93615fa665683c540de4eb8d23

Show
Ignore:
Timestamp:
11/21/06 06:58:55 (2 years ago)
Author:
Rafaël Carré <funman@videolan.org>
git-committer:
Rafaël Carré <funman@videolan.org> 1164088735 +0000
git-parent:

[e77b5163a51dde46815bea3ae41537525498d4c4]

git-author:
Rafaël Carré <funman@videolan.org> 1164088735 +0000
Message:

Unicode support in directory access on windows. Patch by xxcv. Untested.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/extras/libc.c

    rce6d823 r08936b3  
    417417    } 
    418418 
    419     p_real_dir = opendir( psz_path ); 
     419    if (GetVersion() < 0x80000000) 
     420    { 
     421        /* for Windows NT and above */ 
     422        wchar_t wpath[MAX_PATH + 1]; 
     423 
     424        if (!MultiByteToWideChar (CP_UTF8, 0, psz_path, -1, wpath, MAX_PATH)) 
     425            return NULL; 
     426        wpath[MAX_PATH] = L'\0'; 
     427        p_real_dir = _wopendir( wpath ); 
     428    } 
     429 
    420430    if ( p_real_dir == NULL ) 
    421431        return NULL; 
     
    446456        } 
    447457 
    448         return readdir( p_dir->p_real_dir ); 
     458        return _wreaddir( p_dir->p_real_dir ); 
    449459    } 
    450460 
     
    472482    if ( p_dir->p_real_dir != NULL ) 
    473483    { 
    474         int i_ret = closedir( p_dir->p_real_dir ); 
     484        int i_ret = _wclosedir( p_dir->p_real_dir ); 
    475485        free( p_dir ); 
    476486        return i_ret; 
  • src/misc/unicode.c

    r2f09505 r08936b3  
    430430void *utf8_opendir( const char *dirname ) 
    431431{ 
    432     /* TODO: support for WinNT non-ACP filenames */ 
     432 
     433#if defined (UNDER_CE) || defined (WIN32) 
     434    DIR *dir = vlc_opendir_wrapper( dirname ); 
     435    return dir; 
     436#else 
    433437    const char *local_name = ToLocale( dirname ); 
    434438 
     
    441445    else 
    442446        errno = ENOENT; 
     447#endif 
     448 
    443449    return NULL; 
    444450} 
     
    453459        return NULL; 
    454460 
     461#if defined (UNDER_CE) || defined (WIN32) 
     462    return FromWide(ent->d_name); 
     463#else 
    455464    return vlc_fix_readdir( ent->d_name ); 
     465#endif 
    456466} 
    457467