qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] baum: Fix build with debugging enabled
@ 2015-08-30 14:19 Samuel Thibault
  2015-08-30 14:38 ` Stefan Weil
  2015-08-30 15:12 ` Samuel Thibault
  0 siblings, 2 replies; 7+ messages in thread
From: Samuel Thibault @ 2015-08-30 14:19 UTC (permalink / raw)
  To: qemu-devel

cur and buf are pointers, so the difference can be a long int on 64bit
platforms.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

diff --git a/backends/baum.c b/backends/baum.c
index a69aaff..0fa8025 100644
--- a/backends/baum.c
+++ b/backends/baum.c
@@ -303,7 +303,7 @@ static int baum_eat_packet(BaumDriverState *baum, const uint8_t *buf, int len)
                 return 0;
             cur++;
         }
-        DPRINTF("Dropped %d bytes!\n", cur - buf);
+        DPRINTF("Dropped %ld bytes!\n", (long int) (cur - buf));
     }
 
 #define EAT(c) do {\

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

* Re: [Qemu-devel] [PATCH] baum: Fix build with debugging enabled
  2015-08-30 14:19 [Qemu-devel] [PATCH] baum: Fix build with debugging enabled Samuel Thibault
@ 2015-08-30 14:38 ` Stefan Weil
  2015-08-30 14:50   ` Samuel Thibault
  2015-08-30 15:12 ` Samuel Thibault
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Weil @ 2015-08-30 14:38 UTC (permalink / raw)
  To: Samuel Thibault, qemu-devel

Am 30.08.2015 um 16:19 schrieb Samuel Thibault:
> cur and buf are pointers, so the difference can be a long int on 64bit
> platforms.
>
> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
>
> diff --git a/backends/baum.c b/backends/baum.c
> index a69aaff..0fa8025 100644
> --- a/backends/baum.c
> +++ b/backends/baum.c
> @@ -303,7 +303,7 @@ static int baum_eat_packet(BaumDriverState *baum, const uint8_t *buf, int len)
>                  return 0;
>              cur++;
>          }
> -        DPRINTF("Dropped %d bytes!\n", cur - buf);
> +        DPRINTF("Dropped %ld bytes!\n", (long int) (cur - buf));

Using %td (and no type cast) would be better.

Regards
Stefan

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

* Re: [Qemu-devel] [PATCH] baum: Fix build with debugging enabled
  2015-08-30 14:38 ` Stefan Weil
@ 2015-08-30 14:50   ` Samuel Thibault
  2015-08-30 15:02     ` Stefan Weil
  0 siblings, 1 reply; 7+ messages in thread
From: Samuel Thibault @ 2015-08-30 14:50 UTC (permalink / raw)
  To: Stefan Weil; +Cc: qemu-devel

Stefan Weil, le Sun 30 Aug 2015 16:38:25 +0200, a écrit :
> Am 30.08.2015 um 16:19 schrieb Samuel Thibault:
> > cur and buf are pointers, so the difference can be a long int on 64bit
> > platforms.
> >
> > Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> >
> > diff --git a/backends/baum.c b/backends/baum.c
> > index a69aaff..0fa8025 100644
> > --- a/backends/baum.c
> > +++ b/backends/baum.c
> > @@ -303,7 +303,7 @@ static int baum_eat_packet(BaumDriverState *baum, const uint8_t *buf, int len)
> >                  return 0;
> >              cur++;
> >          }
> > -        DPRINTF("Dropped %d bytes!\n", cur - buf);
> > +        DPRINTF("Dropped %ld bytes!\n", (long int) (cur - buf));
> 
> Using %td (and no type cast) would be better.

Ah, do we assume that %td is supported by libc?

Samuel

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

* Re: [Qemu-devel] [PATCH] baum: Fix build with debugging enabled
  2015-08-30 14:50   ` Samuel Thibault
@ 2015-08-30 15:02     ` Stefan Weil
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Weil @ 2015-08-30 15:02 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: qemu-devel

Am 30.08.2015 um 16:50 schrieb Samuel Thibault:
> Stefan Weil, le Sun 30 Aug 2015 16:38:25 +0200, a écrit :
>> Am 30.08.2015 um 16:19 schrieb Samuel Thibault:
>>> cur and buf are pointers, so the difference can be a long int on 64bit
>>> platforms.
>>>
>>> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
>>>
>>> diff --git a/backends/baum.c b/backends/baum.c
>>> index a69aaff..0fa8025 100644
>>> --- a/backends/baum.c
>>> +++ b/backends/baum.c
>>> @@ -303,7 +303,7 @@ static int baum_eat_packet(BaumDriverState *baum, const uint8_t *buf, int len)
>>>                  return 0;
>>>              cur++;
>>>          }
>>> -        DPRINTF("Dropped %d bytes!\n", cur - buf);
>>> +        DPRINTF("Dropped %ld bytes!\n", (long int) (cur - buf));
>>
>> Using %td (and no type cast) would be better.
> 
> Ah, do we assume that %td is supported by libc?
> 
> Samuel
> 

Yes. It is already used in hw/audio/es1370.c and in translate-all.c.

Stefan

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

* Re: [Qemu-devel] [PATCH] baum: Fix build with debugging enabled
  2015-08-30 14:19 [Qemu-devel] [PATCH] baum: Fix build with debugging enabled Samuel Thibault
  2015-08-30 14:38 ` Stefan Weil
@ 2015-08-30 15:12 ` Samuel Thibault
  2015-08-30 15:39   ` Stefan Weil
  2015-09-06 11:03   ` Michael Tokarev
  1 sibling, 2 replies; 7+ messages in thread
From: Samuel Thibault @ 2015-08-30 15:12 UTC (permalink / raw)
  To: qemu-devel

cur and buf are pointers, so the difference is a ptrdiff_t

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

diff --git a/backends/baum.c b/backends/baum.c
index a69aaff..1f9288e 100644
--- a/backends/baum.c
+++ b/backends/baum.c
@@ -303,7 +303,7 @@ static int baum_eat_packet(BaumDriverState *baum, const uint8_t *buf, int len)
                 return 0;
             cur++;
         }
-        DPRINTF("Dropped %d bytes!\n", cur - buf);
+        DPRINTF("Dropped %td bytes!\n", cur - buf);
     }
 
 #define EAT(c) do {\

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

* Re: [Qemu-devel] [PATCH] baum: Fix build with debugging enabled
  2015-08-30 15:12 ` Samuel Thibault
@ 2015-08-30 15:39   ` Stefan Weil
  2015-09-06 11:03   ` Michael Tokarev
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Weil @ 2015-08-30 15:39 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: QEMU Trivial, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 876 bytes --]

Am 30.08.2015 um 17:12 schrieb Samuel Thibault:
> cur and buf are pointers, so the difference is a ptrdiff_t
>
> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
>
> diff --git a/backends/baum.c b/backends/baum.c
> index a69aaff..1f9288e 100644
> --- a/backends/baum.c
> +++ b/backends/baum.c
> @@ -303,7 +303,7 @@ static int baum_eat_packet(BaumDriverState *baum, const uint8_t *buf, int len)
>                  return 0;
>              cur++;
>          }
> -        DPRINTF("Dropped %d bytes!\n", cur - buf);
> +        DPRINTF("Dropped %td bytes!\n", cur - buf);
>      }
>  
>  #define EAT(c) do {\
>

Please don't send patches as reply to previous e-mails
and use a subject which shows the patch revision (here
"[PATCH v2] baum: Fix build with debugging enabled")
for future patches.

Reviewed-by: Stefan Weil <sw@weilnetz.de>



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [Qemu-devel] [PATCH] baum: Fix build with debugging enabled
  2015-08-30 15:12 ` Samuel Thibault
  2015-08-30 15:39   ` Stefan Weil
@ 2015-09-06 11:03   ` Michael Tokarev
  1 sibling, 0 replies; 7+ messages in thread
From: Michael Tokarev @ 2015-09-06 11:03 UTC (permalink / raw)
  To: Samuel Thibault, qemu-devel; +Cc: qemu-trivial

30.08.2015 18:12, Samuel Thibault wrote:
> cur and buf are pointers, so the difference is a ptrdiff_t

Applied to -trivial, thanks!

/mjt

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

end of thread, other threads:[~2015-09-06 11:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-30 14:19 [Qemu-devel] [PATCH] baum: Fix build with debugging enabled Samuel Thibault
2015-08-30 14:38 ` Stefan Weil
2015-08-30 14:50   ` Samuel Thibault
2015-08-30 15:02     ` Stefan Weil
2015-08-30 15:12 ` Samuel Thibault
2015-08-30 15:39   ` Stefan Weil
2015-09-06 11:03   ` Michael Tokarev

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).