Changeset ff02bf907b6272b898612724634371bc95b8a5f1
- Timestamp:
- 05/24/08 09:52:00
(3 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1211615520 +0300
- git-parent:
[96cc9c261db1c616efa2fbc0aea21bc70b1e46fc]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1211615520 +0300
- Message:
seekdir, telldir: unused, remove
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r96cc9c2 |
rff02bf9 |
|
| 761 | 761 | VLC_EXPORT( int, vlc_wclosedir, ( void * ) ); |
|---|
| 762 | 762 | VLC_INTERNAL( void, vlc_rewinddir, ( void * ) ); |
|---|
| 763 | | VLC_INTERNAL( void, vlc_seekdir, ( void *, long ) ); |
|---|
| 764 | | VLC_INTERNAL( long, vlc_telldir, ( void * ) ); |
|---|
| 765 | 763 | # define opendir Use_utf8_opendir_or_vlc_wopendir_instead! |
|---|
| 766 | 764 | # define readdir Use_utf8_readdir_or_vlc_wreaddir_instead! |
|---|
| … | … | |
| 770 | 768 | # define _wclosedir vlc_wclosedir |
|---|
| 771 | 769 | # define rewinddir vlc_rewinddir |
|---|
| 772 | | # define seekdir vlc_seekdir |
|---|
| 773 | | # define telldir vlc_telldir |
|---|
| 774 | 770 | #endif |
|---|
| 775 | 771 | |
|---|
| r5f2dd73 |
rff02bf9 |
|
| 146 | 146 | # define closedir vlc_closedir |
|---|
| 147 | 147 | # define rewinddir vlc_rewindir |
|---|
| 148 | | # define seekdir vlc_seekdir |
|---|
| 149 | | # define telldir vlc_telldir |
|---|
| 150 | 148 | VLC_EXPORT( void *, vlc_opendir, ( const char * ) ); |
|---|
| 151 | 149 | VLC_EXPORT( void *, vlc_readdir, ( void * ) ); |
|---|
| 152 | 150 | VLC_EXPORT( int, vlc_closedir, ( void * ) ); |
|---|
| 153 | 151 | VLC_INTERNAL( void, vlc_rewinddir, ( void * ) ); |
|---|
| 154 | | VLC_INTERNAL( void, vlc_seekdir, ( void *, long ) ); |
|---|
| 155 | | VLC_INTERNAL( long, vlc_telldir, ( void * ) ); |
|---|
| 156 | 152 | #endif |
|---|
| 157 | 153 | |
|---|
| r6ee1e19 |
rff02bf9 |
|
| 343 | 343 | dirp->dd_stat = 0; |
|---|
| 344 | 344 | } |
|---|
| 345 | | |
|---|
| 346 | | /* |
|---|
| 347 | | * telldir |
|---|
| 348 | | * |
|---|
| 349 | | * Returns the "position" in the "directory stream" which can be used with |
|---|
| 350 | | * seekdir to go back to an old entry. We simply return the value in stat. |
|---|
| 351 | | */ |
|---|
| 352 | | long |
|---|
| 353 | | vlc_telldir (DIR * dirp) |
|---|
| 354 | | { |
|---|
| 355 | | errno = 0; |
|---|
| 356 | | |
|---|
| 357 | | if (!dirp) |
|---|
| 358 | | { |
|---|
| 359 | | errno = EFAULT; |
|---|
| 360 | | return -1; |
|---|
| 361 | | } |
|---|
| 362 | | return dirp->dd_stat; |
|---|
| 363 | | } |
|---|
| 364 | | |
|---|
| 365 | | /* |
|---|
| 366 | | * seekdir |
|---|
| 367 | | * |
|---|
| 368 | | * Seek to an entry previously returned by telldir. We rewind the directory |
|---|
| 369 | | * and call readdir repeatedly until either dd_stat is the position number |
|---|
| 370 | | * or -1 (off the end). This is not perfect, in that the directory may |
|---|
| 371 | | * have changed while we weren't looking. But that is probably the case with |
|---|
| 372 | | * any such system. |
|---|
| 373 | | */ |
|---|
| 374 | | void |
|---|
| 375 | | vlc_seekdir (DIR * dirp, long lPos) |
|---|
| 376 | | { |
|---|
| 377 | | errno = 0; |
|---|
| 378 | | |
|---|
| 379 | | if (!dirp) |
|---|
| 380 | | { |
|---|
| 381 | | errno = EFAULT; |
|---|
| 382 | | return; |
|---|
| 383 | | } |
|---|
| 384 | | |
|---|
| 385 | | if (lPos < -1) |
|---|
| 386 | | { |
|---|
| 387 | | /* Seeking to an invalid position. */ |
|---|
| 388 | | errno = EINVAL; |
|---|
| 389 | | return; |
|---|
| 390 | | } |
|---|
| 391 | | else if (lPos == -1) |
|---|
| 392 | | { |
|---|
| 393 | | /* Seek past end. */ |
|---|
| 394 | | if (dirp->dd_handle != INVALID_HANDLE_VALUE) |
|---|
| 395 | | { |
|---|
| 396 | | FindClose ((HANDLE)dirp->dd_handle); |
|---|
| 397 | | } |
|---|
| 398 | | dirp->dd_handle = INVALID_HANDLE_VALUE; |
|---|
| 399 | | dirp->dd_stat = -1; |
|---|
| 400 | | } |
|---|
| 401 | | else |
|---|
| 402 | | { |
|---|
| 403 | | /* Rewind and read forward to the appropriate index. */ |
|---|
| 404 | | vlc_rewinddir (dirp); |
|---|
| 405 | | |
|---|
| 406 | | while ((dirp->dd_stat < lPos) && vlc_readdir (dirp)) |
|---|
| 407 | | ; |
|---|
| 408 | | } |
|---|
| 409 | | } |
|---|
| rab67a53 |
rff02bf9 |
|
| 67 | 67 | # undef _wclosedir |
|---|
| 68 | 68 | # undef rewinddir |
|---|
| 69 | | # undef seekdir |
|---|
| 70 | | # undef telldir |
|---|
| 71 | 69 | # define WIN32_LEAN_AND_MEAN |
|---|
| 72 | 70 | # include <windows.h> |
|---|
| … | … | |
| 523 | 521 | _wrewinddir( p_dir->p_real_dir ); |
|---|
| 524 | 522 | } |
|---|
| 525 | | |
|---|
| 526 | | void vlc_seekdir( void *_p_dir, long loc) |
|---|
| 527 | | { |
|---|
| 528 | | vlc_DIR *p_dir = (vlc_DIR *)_p_dir; |
|---|
| 529 | | |
|---|
| 530 | | if ( p_dir->p_real_dir != NULL ) |
|---|
| 531 | | _wseekdir( p_dir->p_real_dir, loc ); |
|---|
| 532 | | } |
|---|
| 533 | | |
|---|
| 534 | | long vlc_telldir( void *_p_dir ) |
|---|
| 535 | | { |
|---|
| 536 | | vlc_DIR *p_dir = (vlc_DIR *)_p_dir; |
|---|
| 537 | | |
|---|
| 538 | | if ( p_dir->p_real_dir != NULL ) |
|---|
| 539 | | return _wtelldir( p_dir->p_real_dir ); |
|---|
| 540 | | return 0; |
|---|
| 541 | | } |
|---|
| 542 | 523 | #endif |
|---|
| 543 | 524 | |
|---|