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

Re: [libvirt] [PATCH] virt-aa-helper: fix clang build



On Wed, May 11, 2016 at 09:46:23AM +0300, Roman Bogorodskiy wrote:
>   Pavel Hrdina wrote:
> 
> > Clang complains about wrong argument type:
> > 
> > libvirt/src/security/virt-aa-helper.c:174:11: error: absolute value
> >       function 'abs' given an argument of type 'long' but has parameter
> >       of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value]
> >     idx = abs(pos - orig);
> 
> Out of curiosity, why not use labs() here instead of casting?  

Just a random pick from those two possible fixes. It's stored into 'idx'
variable which is int and labs() returns long.  To use labs() the 'idx' would
have to be changed to 'long' or even 'size_t' since it's used only as 'size_t'.

If you think that it would be better to use the labs() and change the 'idx' to
'size_t' I can do that.

Pavel


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