Commit db7e4c77 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

stream: add stream_GetSize() helper

Unlike stream_Size(), this helper distinguishes between unknown and
zero sizes.
parent 65ae8f15
...@@ -133,12 +133,17 @@ static inline int64_t stream_Tell( stream_t *s ) ...@@ -133,12 +133,17 @@ static inline int64_t stream_Tell( stream_t *s )
/** /**
* Get the size of the stream. * Get the size of the stream.
*/ */
VLC_USED static inline int stream_GetSize( stream_t *s, uint64_t *size )
{
return stream_Control( s, STREAM_GET_SIZE, size );
}
static inline int64_t stream_Size( stream_t *s ) static inline int64_t stream_Size( stream_t *s )
{ {
uint64_t i_pos; uint64_t i_pos;
if( stream_Control( s, STREAM_GET_SIZE, &i_pos ) ) if( stream_GetSize( s, &i_pos ) )
i_pos = 0; return 0;
if( i_pos >> 62 ) if( i_pos >> 62 )
return (int64_t)1 << 62; return (int64_t)1 << 62;
return i_pos; return i_pos;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment