Changeset 082ff1ef4a4380332b73f35f143b97b216f97b1f
- 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
| r7c0169e |
r082ff1e |
|
| 35 | 35 | #include <vlc/vlc.h> |
|---|
| 36 | 36 | #include <vlc/sout.h> |
|---|
| | 37 | #include "charset.h" |
|---|
| 37 | 38 | |
|---|
| 38 | 39 | #ifdef HAVE_UNISTD_H |
|---|
| … | … | |
| 102 | 103 | sout_CfgParse( p_access, SOUT_CFG_PREFIX, ppsz_sout_options, p_access->p_cfg ); |
|---|
| 103 | 104 | |
|---|
| 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 | | |
|---|
| 110 | 105 | if( !p_access->psz_name ) |
|---|
| 111 | 106 | { |
|---|
| … | … | |
| 113 | 108 | return VLC_EGENERIC; |
|---|
| 114 | 109 | } |
|---|
| | 110 | |
|---|
| | 111 | if( !( p_access->p_sys = malloc( sizeof( sout_access_out_sys_t ) ) ) ) |
|---|
| | 112 | { |
|---|
| | 113 | return( VLC_ENOMEM ); |
|---|
| | 114 | } |
|---|
| | 115 | |
|---|
| 115 | 116 | i_flags = O_RDWR|O_CREAT|O_LARGEFILE; |
|---|
| 116 | 117 | |
|---|
| 117 | 118 | 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 | |
|---|
| 126 | 121 | if( !strcmp( p_access->psz_name, "-" ) ) |
|---|
| 127 | 122 | { |
|---|
| … | … | |
| 132 | 127 | msg_Dbg( p_access, "using stdout" ); |
|---|
| 133 | 128 | } |
|---|
| 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; |
|---|
| 140 | 143 | } |
|---|
| 141 | 144 | |
|---|