[vlc-devel] [vlc-commits] stream: use same pf_read return value as access

RĂ©mi Denis-Courmont remi at remlab.net
Fri Jul 22 14:24:45 CEST 2016


Le 2016-07-22 13:31, Thomas Guillem a écrit :
> On Thu, Jul 21, 2016, at 21:30, Rémi Denis-Courmont wrote:
>> vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu 
>> Jul 21
>> 21:48:45 2016 +0300| [e77eb3bdb2269c6e085b98cb050918a764dd9b52] |
>> committer: Rémi Denis-Courmont
>>
>> stream: use same pf_read return value as access
>>
>> Accesses return -1 to try again; stream filters returned -1 for 
>> fatal
>> errors. This switches stream filters to 0 for fatal errors.
>>
>> > 
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e77eb3bdb2269c6e085b98cb050918a764dd9b52
>> ---
>>
>>  modules/stream_filter/prefetch.c |    2 +-
>>  src/input/stream.c               |   16 +++++++---------
>>  2 files changed, 8 insertions(+), 10 deletions(-)
>>
>> diff --git a/modules/stream_filter/prefetch.c
>> b/modules/stream_filter/prefetch.c
>> index be2820e..d0f877c 100644
>> --- a/modules/stream_filter/prefetch.c
>> +++ b/modules/stream_filter/prefetch.c
>> @@ -330,7 +330,7 @@ static ssize_t Read(stream_t *stream, void *buf,
>> size_t buflen)
>>          if (sys->error)
>>          {
>>              vlc_mutex_unlock(&sys->lock);
>> -            return -1;
>> +            return 0;
>>          }
>>
>>          vlc_interrupt_forward_start(sys->interrupt, data);
>> diff --git a/src/input/stream.c b/src/input/stream.c
>> index cd61196..78b025f 100644
>> --- a/src/input/stream.c
>> +++ b/src/input/stream.c
>> @@ -333,12 +333,8 @@ static ssize_t vlc_stream_ReadRaw(stream_t *s, 
>> void
>> *buf, size_t len)
>>      while (len > 0)
>>      {
>>          if (vlc_killed())
>> -        {
>> -            ret = -1;
>> -            break;
>> -        }
>> -
>> -        if (s->pf_read != NULL)
>> +            ret = 0;
>> +        else if (s->pf_read != NULL)
>>          {
>>              assert(priv->block == NULL);
>>              ret = s->pf_read(s, buf, len);
>> @@ -375,10 +371,12 @@ static ssize_t vlc_stream_ReadRaw(stream_t *s, 
>> void
>> *buf, size_t len)
>>              }
>>          }
>>          else
>> -            ret = -1;
>> +            ret = 0;
>>
>> -        if (ret <= 0)
>> +        if (ret == 0)
>>              break;
>> +        if (ret < 0)
>> +            continue;
>>
>>          assert((size_t)ret <= len);
>>          if (buf != NULL)
>> @@ -387,7 +385,7 @@ static ssize_t vlc_stream_ReadRaw(stream_t *s, 
>> void
>> *buf, size_t len)
>>          copy += ret;
>>      }
>>
>> -    return (copy > 0) ? (ssize_t)copy : ret;
>> +    return copy;
>
> copy is a size_t, so this function never returns -1.
>
> Did you mean "return ret == 0 ? -1 : copy;" ?

I don't think so.

>
>>  }
>>
>>  ssize_t vlc_stream_Read(stream_t *s, void *buf, size_t len)
>>
>> _______________________________________________
>> vlc-commits mailing list
>> vlc-commits at videolan.org
>> https://mailman.videolan.org/listinfo/vlc-commits
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

-- 
Rémi Denis-Courmont
http://www.remlab.net/


More information about the vlc-devel mailing list