Re: [spice] server: Make sure g_object_new receive the correct data

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

 



On Mon, 25 Jul 2016, Frediano Ziglio wrote:
[...]
> > > -                        "client-tokens-interval", REDS_TOKENS_TO_SEND,
> > > -                        "self-tokens", REDS_NUM_INTERNAL_AGENT_MESSAGES,
> > > +                        "client-tokens-interval", (guint64)REDS_TOKENS_TO_SEND,
> > > +                        "self-tokens", (guint64)REDS_NUM_INTERNAL_AGENT_MESSAGES,
[...]
> > The patch is ok, but I think it would be better
> > to do the cast in the define itself, or replace
> > the define with a const (g)uint64_t variable
> > 
> > Uri.
> 
> This would bound the constant to the property which does
> not make much sense as the constant can be used for
> different purposes. What if the same constant is used for
> two properties with different types?

To be fair REDS_TOKENS_TO_SEND is only used in this one place. But 
REDS_NUM_INTERNAL_AGENT_MESSAGES is defined in main-channel.h and is 
used to define MAIN_CHANNEL_RECEIVE_BUF_SIZE so defining it as a guint64 
may not make sense.

Also I think having a visible cast here more explicitly indicates that 
the property is 64 bit than a cast hidden in a far away macro.

(One could also argue for an explicit comment but I think that would be 
overkill. Why add a comment here and not for every other cast?)

-- 
Francois Gouget <fgouget@xxxxxxxxxxxxxxx>
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




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