Commit ec1566fe authored by Sven Petai's avatar Sven Petai Committed by Rémi Denis-Courmont

Make returning fatal error from the Read() more obvious. No functional change.

Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
parent 2a3e95d7
...@@ -760,10 +760,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) ...@@ -760,10 +760,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
int i_read; int i_read;
if( p_sys->fd == -1 ) if( p_sys->fd == -1 )
{ goto fatal;
p_access->info.b_eof = true;
return 0;
}
if( p_sys->b_has_size ) if( p_sys->b_has_size )
{ {
...@@ -780,10 +777,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) ...@@ -780,10 +777,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
if( p_sys->b_chunked ) if( p_sys->b_chunked )
{ {
if( p_sys->i_chunk < 0 ) if( p_sys->i_chunk < 0 )
{ goto fatal;
p_access->info.b_eof = true;
return 0;
}
if( p_sys->i_chunk <= 0 ) if( p_sys->i_chunk <= 0 )
{ {
...@@ -801,8 +795,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) ...@@ -801,8 +795,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
if( p_sys->i_chunk <= 0 ) /* eof */ if( p_sys->i_chunk <= 0 ) /* eof */
{ {
p_sys->i_chunk = -1; p_sys->i_chunk = -1;
p_access->info.b_eof = true; goto fatal;
return 0;
} }
} }
...@@ -811,10 +804,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) ...@@ -811,10 +804,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
} }
if( i_len == 0 ) if( i_len == 0 )
{ goto fatal;
p_access->info.b_eof = true;
return 0;
}
if( p_sys->i_icy_meta > 0 && p_access->info.i_pos-p_sys->i_icy_offset > 0 ) if( p_sys->i_icy_meta > 0 && p_access->info.i_pos-p_sys->i_icy_offset > 0 )
{ {
...@@ -824,10 +814,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) ...@@ -824,10 +814,7 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
if( i_next == p_sys->i_icy_meta ) if( i_next == p_sys->i_icy_meta )
{ {
if( ReadICYMeta( p_access ) ) if( ReadICYMeta( p_access ) )
{ goto fatal;
p_access->info.b_eof = true;
return 0;
}
} }
if( i_len > i_next ) if( i_len > i_next )
i_len = i_next; i_len = i_next;
...@@ -883,10 +870,9 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) ...@@ -883,10 +870,9 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
if( i_read <= 0 ) if( i_read <= 0 )
{ {
p_access->info.b_eof = true;
if( i_read < 0 ) if( i_read < 0 )
p_sys->b_error = true; p_sys->b_error = true;
return 0; goto fatal;
} }
} }
...@@ -900,6 +886,10 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len ) ...@@ -900,6 +886,10 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
} }
return i_read; return i_read;
fatal:
p_access->info.b_eof = true;
return 0;
} }
static int ReadICYMeta( access_t *p_access ) static int ReadICYMeta( access_t *p_access )
......
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