| | 683 | if( p_access->info.i_pos < 0 ) |
|---|
| | 684 | { |
|---|
| | 685 | msg_Err( p_access, "seeking too early" ); |
|---|
| | 686 | return Seek( p_access, 0); |
|---|
| | 687 | } |
|---|
| | 688 | else |
|---|
| | 689 | { |
|---|
| | 690 | int64_t i_size = p_access->info.i_size; |
|---|
| | 691 | if(i_size > 0) |
|---|
| | 692 | { |
|---|
| | 693 | if( i_size < i_pos ) |
|---|
| | 694 | { |
|---|
| | 695 | msg_Err( p_access, "seeking too far" ); |
|---|
| | 696 | // Fix me: This replicates the file.c behavior of returning |
|---|
| | 697 | // success even when seeking too far. |
|---|
| | 698 | return Seek( p_access, i_size ); |
|---|
| | 699 | } |
|---|
| | 700 | else if ( i_size == i_pos ) |
|---|
| | 701 | { |
|---|
| | 702 | // This is the only way I have found to seek to the end, and |
|---|
| | 703 | // still leave the file handle open. |
|---|
| | 704 | int retval = Seek( p_access, i_pos - 1); |
|---|
| | 705 | if ( retval == VLC_SUCCESS ) { |
|---|
| | 706 | int8_t p_buffer[2]; |
|---|
| | 707 | Read( p_access, p_buffer, 1 ); |
|---|
| | 708 | // Reset EOF |
|---|
| | 709 | p_access->info.b_eof = VLC_FALSE; |
|---|
| | 710 | } |
|---|
| | 711 | return retval; |
|---|
| | 712 | } |
|---|
| | 713 | } |
|---|
| | 714 | } |
|---|