Changeset 082ff1ef4a4380332b73f35f143b97b216f97b1f

Show
Ignore:
Timestamp:
02/03/06 16:19:32 (3 years ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1141312772 +0000
git-parent:

[4d4cf03533ab30be134f78dd3f6e83376e4d4750]

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

Locale fixes (refs #528) + clean up

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/access_output/file.c

    r7c0169e r082ff1e  
    3535#include <vlc/vlc.h> 
    3636#include <vlc/sout.h> 
     37#include "charset.h" 
    3738 
    3839#ifdef HAVE_UNISTD_H 
     
    102103    sout_CfgParse( p_access, SOUT_CFG_PREFIX, ppsz_sout_options, p_access->p_cfg ); 
    103104 
    104     if( !( p_access->p_sys = malloc( sizeof( sout_access_out_sys_t ) ) ) ) 
    105     { 
    106         msg_Err( p_access, "out of memory" ); 
    107         return( VLC_EGENERIC ); 
    108     } 
    109  
    110105    if( !p_access->psz_name ) 
    111106    { 
     
    113108        return VLC_EGENERIC; 
    114109    } 
     110 
     111    if( !( p_access->p_sys = malloc( sizeof( sout_access_out_sys_t ) ) ) ) 
     112    { 
     113        return( VLC_ENOMEM ); 
     114    } 
     115 
    115116    i_flags = O_RDWR|O_CREAT|O_LARGEFILE; 
    116117 
    117118    var_Get( p_access, SOUT_CFG_PREFIX "append", &val ); 
    118     if( val.b_bool ) 
    119     { 
    120         i_flags |= O_APPEND; 
    121     } 
    122     else 
    123     { 
    124         i_flags |= O_TRUNC; 
    125     } 
     119    i_flags |= val.b_bool ? O_APPEND : O_TRUNC; 
     120 
    126121    if( !strcmp( p_access->psz_name, "-" ) ) 
    127122    { 
     
    132127        msg_Dbg( p_access, "using stdout" ); 
    133128    } 
    134     else if( ( p_access->p_sys->i_handle = 
    135                open( p_access->psz_name, i_flags, 0666 ) ) == -1 ) 
    136     { 
    137         msg_Err( p_access, "cannot open `%s'", p_access->psz_name ); 
    138         free( p_access->p_sys ); 
    139         return( VLC_EGENERIC ); 
     129    else 
     130    { 
     131        const char *psz_localname = ToLocale( p_access->psz_name ); 
     132        int fd = open( psz_localname, i_flags, 0666 ); 
     133        LocaleFree( psz_localname ); 
     134 
     135        if( fd == -1 ) 
     136        { 
     137            msg_Err( p_access, "cannot open `%s' (%s)", p_access->psz_name, 
     138                     strerror( errno ) ); 
     139            free( p_access->p_sys ); 
     140            return( VLC_EGENERIC ); 
     141        } 
     142        p_access->p_sys->i_handle = fd; 
    140143    } 
    141144