Mercurial > audlegacy-plugins
comparison src/stdio/stdio.c @ 965:f1642ee1115c trunk
[svn]
- Implement vfs_fsize() for stdio
- Implement dummys for curl/mms/smb
| author | ertzing |
|---|---|
| date | Fri, 20 Apr 2007 06:50:15 -0700 |
| parents | 1d81ea250dce |
| children | 183d03932c9e |
comparison
equal
deleted
inserted
replaced
| 964:368f8ee0a95f | 965:f1642ee1115c |
|---|---|
| 228 handle = (FILE *) file->handle; | 228 handle = (FILE *) file->handle; |
| 229 | 229 |
| 230 return ftruncate(fileno(handle), size); | 230 return ftruncate(fileno(handle), size); |
| 231 } | 231 } |
| 232 | 232 |
| 233 off_t | |
| 234 stdio_vfs_fsize_impl(VFSFile * file) | |
| 235 { | |
| 236 FILE *handle; | |
| 237 struct stat s; | |
| 238 | |
| 239 if (file == NULL) | |
| 240 return -1; | |
| 241 | |
| 242 handle = (FILE *) file->handle; | |
| 243 | |
| 244 if (-1 == fstat(fileno(handle), &s)) | |
| 245 return -1; | |
| 246 | |
| 247 return s.st_size; | |
| 248 } | |
| 249 | |
| 233 VFSConstructor file_const = { | 250 VFSConstructor file_const = { |
| 234 "file://", | 251 "file://", |
| 235 stdio_vfs_fopen_impl, | 252 stdio_vfs_fopen_impl, |
| 236 stdio_vfs_fclose_impl, | 253 stdio_vfs_fclose_impl, |
| 237 stdio_vfs_fread_impl, | 254 stdio_vfs_fread_impl, |
| 240 stdio_vfs_ungetc_impl, | 257 stdio_vfs_ungetc_impl, |
| 241 stdio_vfs_fseek_impl, | 258 stdio_vfs_fseek_impl, |
| 242 stdio_vfs_rewind_impl, | 259 stdio_vfs_rewind_impl, |
| 243 stdio_vfs_ftell_impl, | 260 stdio_vfs_ftell_impl, |
| 244 stdio_vfs_feof_impl, | 261 stdio_vfs_feof_impl, |
| 245 stdio_vfs_truncate_impl | 262 stdio_vfs_truncate_impl, |
| 263 stdio_vfs_fsize_impl | |
| 246 }; | 264 }; |
| 247 | 265 |
| 248 VFSConstructor default_const = { | 266 VFSConstructor default_const = { |
| 249 "/", | 267 "/", |
| 250 stdio_vfs_fopen_impl, | 268 stdio_vfs_fopen_impl, |
| 255 stdio_vfs_ungetc_impl, | 273 stdio_vfs_ungetc_impl, |
| 256 stdio_vfs_fseek_impl, | 274 stdio_vfs_fseek_impl, |
| 257 stdio_vfs_rewind_impl, | 275 stdio_vfs_rewind_impl, |
| 258 stdio_vfs_ftell_impl, | 276 stdio_vfs_ftell_impl, |
| 259 stdio_vfs_feof_impl, | 277 stdio_vfs_feof_impl, |
| 260 stdio_vfs_truncate_impl | 278 stdio_vfs_truncate_impl, |
| 279 stdio_vfs_fsize_impl | |
| 261 }; | 280 }; |
| 262 | 281 |
| 263 static void init(void) | 282 static void init(void) |
| 264 { | 283 { |
| 265 vfs_register_transport(&default_const); | 284 vfs_register_transport(&default_const); |
