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

access: make access_GetSize() return an error code

So far, it was returning zero on error. That prevented distinction
between an empty file and a file with unknown size.
parent 2b23857c
......@@ -233,12 +233,9 @@ static inline int access_Control( access_t *p_access, int i_query, ... )
return i_result;
}
static inline uint64_t access_GetSize( access_t *p_access )
static inline int access_GetSize( access_t *p_access, uint64_t *size )
{
uint64_t val;
if( access_Control( p_access, ACCESS_GET_SIZE, &val ) )
val = 0;
return val;
return access_Control( p_access, ACCESS_GET_SIZE, size );
}
static inline void access_InitFields( access_t *p_a )
......
......@@ -156,8 +156,10 @@ static int Seek(access_t *access, uint64_t position)
if (!can_seek)
break;
uint64_t size = access_GetSize(a);
uint64_t size;
if (access_GetSize(a, &size))
size = 0;
if (position - access->info.i_pos < size)
{
if (vlc_access_Seek(a, position - access->info.i_pos))
......@@ -281,7 +283,9 @@ static int Open(vlc_object_t *obj)
if (sys->can_control_pace)
access_Control(a, ACCESS_CAN_CONTROL_PACE, &sys->can_control_pace);
sys->size += access_GetSize(a);
uint64_t size;
if (access_GetSize(a, &size) == 0)
sys->size += size;
int64_t caching;
access_Control(a, ACCESS_GET_PTS_DELAY, &caching);
......
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