qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH 5/7] curl: convert CURLAIOCB to byte values


From: Max Reitz
Subject: Re: [Qemu-block] [PATCH 5/7] curl: convert CURLAIOCB to byte values
Date: Wed, 10 May 2017 19:36:46 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0

On 10.05.2017 16:32, Paolo Bonzini wrote:
> This is in preparation for the conversion from bdrv_aio_readv to
> bdrv_co_preadv, and it also requires changing some of the size_t values
> to uint64_t.  This was broken before for disks > 2TB, but now it would
> break at 4GB.
> 
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>  block/curl.c | 44 ++++++++++++++++++++++----------------------
>  1 file changed, 22 insertions(+), 22 deletions(-)
> 
> diff --git a/block/curl.c b/block/curl.c
> index 4b4d5a2389..3e288f2bc7 100644
> --- a/block/curl.c
> +++ b/block/curl.c

[...]

> @@ -788,7 +788,7 @@ static int curl_open(BlockDriverState *bs, QDict 
> *options, int flags,
>      }
>  #endif
>  
> -    s->len = (size_t)d;
> +    s->len = d;

On a very personal level, I'd rather have an explicit cast when
converting floating point values to integers. Anyway:

Reviewed-by: Max Reitz <address@hidden>

On a very surprised level: Why does curl return the content length as a
double?! I can't think of a reason where that might be a good idea. If
your integer no longer fits into a uin64_t, the double will be inexact,
so it pretty much is useless, too...

>  
>      if ((!strncasecmp(s->url, "http://";, strlen("http://";))
>          || !strncasecmp(s->url, "https://";, strlen("https://";)))

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]