On Thu, 2016-09-15 at 23:19 +0100, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fzig...@redhat.com>
> ---
>  server/red-replay-qxl.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
> index 73f9cd4..fe4f7a9 100644
> --- a/server/red-replay-qxl.c
> +++ b/server/red-replay-qxl.c
> @@ -57,16 +57,15 @@ struct SpiceReplay {
>      pthread_cond_t cond;
>  };
>  
> -static int replay_fread(SpiceReplay *replay, uint8_t *buf, size_t
> size)
> +static ssize_t replay_fread(SpiceReplay *replay, uint8_t *buf,
> size_t size)
>  {
> -    if (replay->error) {
> -        return 0;
> -    }
> -    if (feof(replay->fd)) {
> +    if (replay->error
> +        || feof(replay->fd)
> +        || fread(buf, 1, size, replay->fd) != size) {

it doesn't follow our style:
https://www.spice-space.org/spice-project-coding-style-and-coding-conv
entions.html#_branching_indentation

>          replay->error = TRUE;
>          return 0;
>      }
> -    return fread(buf, size, 1, replay->fd);
> +    return size;
What is the point of returning size - unchanged by the function ?

If the function is boolean, return type should be boolean as well

Pavel

>  }
>  
>  __attribute__((format(scanf, 2, 3)))
> 
_______________________________________________
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel

Reply via email to