qemu-trivial.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH] curl: Cast fd to int for DPRINTF
@ 2016-08-01  5:04 Fam Zheng
  2016-08-01 16:41 ` [Qemu-trivial] [Qemu-devel] " John Snow
  2016-08-10  2:41 ` Fam Zheng
  0 siblings, 2 replies; 5+ messages in thread
From: Fam Zheng @ 2016-08-01  5:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

Currently "make docker-test-mingw@fedora" has a warning like:

    /tmp/qemu-test/src/block/curl.c: In function 'curl_sock_cb':
    /tmp/qemu-test/src/block/curl.c:172:6: warning: format '%d' expects
    argument of type 'int', but argument 4 has type 'curl_socket_t {aka long
    long unsigned int}'
         DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, fd);
          ^
    cc1: all warnings being treated as errors

Cast to int to suppress it.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/curl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/curl.c b/block/curl.c
index da9f5e8..426fb4d 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -169,7 +169,7 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
     state->sock_fd = fd;
     s = state->s;
 
-    DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, fd);
+    DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, (int)fd);
     switch (action) {
         case CURL_POLL_IN:
             aio_set_fd_handler(s->aio_context, fd, false,
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-trivial] [Qemu-devel] [PATCH] curl: Cast fd to int for DPRINTF
  2016-08-01  5:04 [Qemu-trivial] [PATCH] curl: Cast fd to int for DPRINTF Fam Zheng
@ 2016-08-01 16:41 ` John Snow
  2016-08-02  1:09   ` Fam Zheng
  2016-08-10  2:41 ` Fam Zheng
  1 sibling, 1 reply; 5+ messages in thread
From: John Snow @ 2016-08-01 16:41 UTC (permalink / raw)
  To: Fam Zheng; +Cc: qemu-devel, QEMU Trivial



On 08/01/2016 01:04 AM, Fam Zheng wrote:
> Currently "make docker-test-mingw@fedora" has a warning like:
>
>     /tmp/qemu-test/src/block/curl.c: In function 'curl_sock_cb':
>     /tmp/qemu-test/src/block/curl.c:172:6: warning: format '%d' expects
>     argument of type 'int', but argument 4 has type 'curl_socket_t {aka long
>     long unsigned int}'
>          DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, fd);
>           ^
>     cc1: all warnings being treated as errors
>
> Cast to int to suppress it.
>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block/curl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/curl.c b/block/curl.c
> index da9f5e8..426fb4d 100644
> --- a/block/curl.c
> +++ b/block/curl.c
> @@ -169,7 +169,7 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
>      state->sock_fd = fd;
>      s = state->s;
>
> -    DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, fd);
> +    DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, (int)fd);
>      switch (action) {
>          case CURL_POLL_IN:
>              aio_set_fd_handler(s->aio_context, fd, false,
>

Is curl_socket_t always of type long long unsigned int? why not use %llu ?

(...Yeah, I know, we're probably not going to be dealing with FDs above 
2-4 billion, just curious...)

--js

Benefit of doubt (this cast is almost certain to never do the wrong 
thing, and even if it did, it's just a dprintf)

Reviewed-by: John Snow <jsnow@redhat.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-trivial] [Qemu-devel] [PATCH] curl: Cast fd to int for DPRINTF
  2016-08-01 16:41 ` [Qemu-trivial] [Qemu-devel] " John Snow
@ 2016-08-02  1:09   ` Fam Zheng
  2016-08-02  2:59     ` John Snow
  0 siblings, 1 reply; 5+ messages in thread
From: Fam Zheng @ 2016-08-02  1:09 UTC (permalink / raw)
  To: John Snow; +Cc: qemu-devel, QEMU Trivial

On Mon, 08/01 12:41, John Snow wrote:
> > -    DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, fd);
> > +    DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, (int)fd);
> >      switch (action) {
> >          case CURL_POLL_IN:
> >              aio_set_fd_handler(s->aio_context, fd, false,
> > 
> 
> Is curl_socket_t always of type long long unsigned int? why not use %llu ?

Since it is a typedef, variation between platforms is imaginable. On Linux it
is 4 bytes, the error is only seen on Windows.

Fam


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-trivial] [Qemu-devel] [PATCH] curl: Cast fd to int for DPRINTF
  2016-08-02  1:09   ` Fam Zheng
@ 2016-08-02  2:59     ` John Snow
  0 siblings, 0 replies; 5+ messages in thread
From: John Snow @ 2016-08-02  2:59 UTC (permalink / raw)
  To: Fam Zheng; +Cc: qemu-devel, QEMU Trivial



On 08/01/2016 09:09 PM, Fam Zheng wrote:
> On Mon, 08/01 12:41, John Snow wrote:
>>> -    DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, fd);
>>> +    DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, (int)fd);
>>>      switch (action) {
>>>          case CURL_POLL_IN:
>>>              aio_set_fd_handler(s->aio_context, fd, false,
>>>
>>
>> Is curl_socket_t always of type long long unsigned int? why not use %llu ?
>
> Since it is a typedef, variation between platforms is imaginable. On Linux it
> is 4 bytes, the error is only seen on Windows.
>
> Fam
>

Ah, there we go. The B-O-D was justified. :)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-trivial] [Qemu-devel] [PATCH] curl: Cast fd to int for DPRINTF
  2016-08-01  5:04 [Qemu-trivial] [PATCH] curl: Cast fd to int for DPRINTF Fam Zheng
  2016-08-01 16:41 ` [Qemu-trivial] [Qemu-devel] " John Snow
@ 2016-08-10  2:41 ` Fam Zheng
  1 sibling, 0 replies; 5+ messages in thread
From: Fam Zheng @ 2016-08-10  2:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

On Mon, 08/01 13:04, Fam Zheng wrote:
> Currently "make docker-test-mingw@fedora" has a warning like:
> 
>     /tmp/qemu-test/src/block/curl.c: In function 'curl_sock_cb':
>     /tmp/qemu-test/src/block/curl.c:172:6: warning: format '%d' expects
>     argument of type 'int', but argument 4 has type 'curl_socket_t {aka long
>     long unsigned int}'
>          DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, fd);
>           ^
>     cc1: all warnings being treated as errors
> 
> Cast to int to suppress it.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block/curl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/curl.c b/block/curl.c
> index da9f5e8..426fb4d 100644
> --- a/block/curl.c
> +++ b/block/curl.c
> @@ -169,7 +169,7 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
>      state->sock_fd = fd;
>      s = state->s;
>  
> -    DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, fd);
> +    DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, (int)fd);
>      switch (action) {
>          case CURL_POLL_IN:
>              aio_set_fd_handler(s->aio_context, fd, false,
> -- 
> 2.7.4
> 
> 

Since this is blocking the mingw testing on patchew, I'm taking this in my
tree. Applied to my docker branch:

https://github.com/famz/qemu/tree/docker

Thanks,
Fam


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-08-10  2:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-01  5:04 [Qemu-trivial] [PATCH] curl: Cast fd to int for DPRINTF Fam Zheng
2016-08-01 16:41 ` [Qemu-trivial] [Qemu-devel] " John Snow
2016-08-02  1:09   ` Fam Zheng
2016-08-02  2:59     ` John Snow
2016-08-10  2:41 ` Fam Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).