Re: [PATCH spice-common] quic: fix sign-compare warning

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

 



Hi

On Thu, Jan 17, 2019 at 12:19 PM Frediano Ziglio <fziglio@xxxxxxxxxx> wrote:
>
> >
> > From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
> >
> > ../subprojects/spice-common/common/quic.c: In function
> > 'fill_model_structures':
> > ../subprojects/spice-common/common/quic.c:695:55: error: comparison of
> > integer expressions of different signedness: 'int' and 'unsigned int'
> > [-Werror=sign-compare]
> >      spice_assert(free_counter - family_stat->counters == nbuckets *
> >      ncounters);
>
> OT: is it a 32 bit architecture? Why a pointer difference is "int" ?

Yes, on 32 bit architecture. But I don't know the details, ie why it
doesn't warn on 64 bit.

>
> >                                                        ^~
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
>
> Acked-by: Frediano Ziglio <figlio@xxxxxxxxxx>

thanks

>
> > ---
> >  common/quic.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/common/quic.c b/common/quic.c
> > index c28974e..1760274 100644
> > --- a/common/quic.c
> > +++ b/common/quic.c
> > @@ -692,7 +692,7 @@ static void fill_model_structures(SPICE_GNUC_UNUSED
> > Encoder *encoder, FamilyStat
> >          bnumber++;
> >      } while (bend < levels - 1);
> >
> > -    spice_assert(free_counter - family_stat->counters == nbuckets *
> > ncounters);
> > +    spice_assert(free_counter - family_stat->counters ==
> > (ptrdiff_t)(nbuckets * ncounters));
> >  }
> >
> >  static void find_model_params(Encoder *encoder,
>
> Frediano
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/spice-devel



-- 
Marc-André Lureau
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]