| | 832 | if( p_access->info.i_pos < 0 ) |
|---|
| | 833 | { |
|---|
| | 834 | msg_Err( p_access, "seeking too early" ); |
|---|
| | 835 | return Seek( p_access, 0); |
|---|
| | 836 | } |
|---|
| | 837 | else |
|---|
| | 838 | { |
|---|
| | 839 | int64_t i_size = p_access->info.i_size; |
|---|
| | 840 | if(i_size > 0) |
|---|
| | 841 | { |
|---|
| | 842 | if( i_size < i_pos ) |
|---|
| | 843 | { |
|---|
| | 844 | msg_Err( p_access, "seeking too far" ); |
|---|
| | 845 | // Fix me: This replicates the file.c behavior of returning |
|---|
| | 846 | // success even when seeking too far. |
|---|
| | 847 | return Seek( p_access, i_size ); |
|---|
| | 848 | } |
|---|
| | 849 | else if ( i_size == i_pos ) |
|---|
| | 850 | { |
|---|
| | 851 | // This is the only way I have found to seek to the end, and |
|---|
| | 852 | // still leave the file handle open. |
|---|
| | 853 | int retval = Seek( p_access, i_pos - 1); |
|---|
| | 854 | if ( retval == VLC_SUCCESS ) { |
|---|
| | 855 | int8_t p_buffer[2]; |
|---|
| | 856 | Read( p_access, p_buffer, (size_t)1 ); |
|---|
| | 857 | // Reset EOF |
|---|
| | 858 | p_access->info.b_eof = false; |
|---|
| | 859 | } |
|---|
| | 860 | return retval; |
|---|
| | 861 | } |
|---|
| | 862 | } |
|---|
| | 863 | } |
|---|