Changeset 1252:96c2d4610e28 in roaraudio
- Timestamp:
- 02/27/09 00:04:31 (15 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
include/libroar/vio.h
r1247 r1252 96 96 int roar_vio_close (struct roar_vio_calls * vio); 97 97 98 // converters: 99 int roar_vio_open_file (struct roar_vio_calls * calls, char * filename, int flags, mode_t mode); 100 int roar_vio_open_fh (struct roar_vio_calls * calls, int fh); 101 int roar_vio_open_stdio (struct roar_vio_calls * calls, FILE * dst); 102 FILE * roar_vio_to_stdio (struct roar_vio_calls * calls, int flags); 103 98 104 99 105 // possible VIOs: -
libroar/vio.c
r1247 r1252 146 146 147 147 return vio->close(vio); 148 } 149 150 // converters: 151 int roar_vio_open_file (struct roar_vio_calls * calls, char * filename, int flags, mode_t mode) { 152 int fh; 153 154 if ( calls == NULL || filename == NULL ) 155 return -1; 156 157 if ( (fh = open(filename, flags, mode)) == -1 ) 158 return -1; 159 160 if ( roar_vio_open_fh(calls, fh) == -1 ) { 161 close(fh); 162 return -1; 163 } 164 165 return 0; 166 } 167 168 int roar_vio_open_fh (struct roar_vio_calls * calls, int fh) { 169 if ( calls == NULL ) 170 return -1; 171 172 if ( roar_vio_init_calls(calls) == -1 ) 173 return -1; 174 175 return roar_vio_set_fh(calls, fh); 176 } 177 178 int roar_vio_open_stdio (struct roar_vio_calls * calls, FILE * dst) { 179 if ( calls == NULL || dst == NULL ) 180 return -1; 181 182 return -1; 183 } 184 185 FILE * roar_vio_to_stdio (struct roar_vio_calls * calls, int flags) { 186 #ifdef ROAR_HAVE_FOPENCOOKIE 187 cookie_io_functions_t foc_funcs; 188 #endif 189 190 if ( calls == NULL ) 191 return NULL; 192 193 #if defined(ROAR_HAVE_FOPENCOOKIE) 194 memset(&foc_funcs, 0, sizeof(cookie_io_functions_t)); 195 196 return fopencookie((void*) calls, "rw", foc_funcs); 197 #elif defined(ROAR_HAVE_FUNOPEN) 198 return funopen((void*) calls, NULL /* read */, NULL /* write */, NULL /* lseek */, NULL /* close */); 199 #else 200 return NULL; 201 #endif 148 202 } 149 203
Note: See TracChangeset
for help on using the changeset viewer.