[Spice-devel] [PATCH spice-common] spice.proto: fix uninitalized variable in demarshaller

Jonathon Jongsma jjongsma at redhat.com
Tue Oct 22 21:55:27 CEST 2013


It would be nice to fix the generator to use full names (including the name of the owning struct) for these variables (e.g. u_foo for members of the outer 'u' struct and u_u_foo for members of the inner 'u' struct).  I spent some time looking at the generator code and experimented a bit with it, but concluded that it wasn't really worth my time.  If there's somebody else that's familiar enough with this code to fix it easily, it'd be a nice fix.  Otherwise I'm perfectly OK just working around this limitation like you've done in this patch.

jonathon


----- Original Message -----
> From: "Alon Levy" <alevy at redhat.com>
> To: spice-devel at freedesktop.org
> Sent: Tuesday, October 22, 2013 9:05:03 AM
> Subject: Re: [Spice-devel] [PATCH spice-common] spice.proto: fix uninitalized variable in demarshaller
> 
> On 10/22/2013 04:47 PM, Alon Levy wrote:
> > Our automatically generated marshallers use temporary variables whose
> > name is based on the field, without checking for shadowing. This bites
> > us in one location that is fixed by this patch. A better solution would
> > be to fix the marshaller, but it's more then I want to bite right now.
> s/marshaller/generator/
> 
> I'll fix it before pushing.
> 
> > 
> > RHBZ: 1021995
> > ---
> >  common/messages.h | 2 +-
> >  spice.proto       | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/common/messages.h b/common/messages.h
> > index a8a0eee..8ca5385 100644
> > --- a/common/messages.h
> > +++ b/common/messages.h
> > @@ -542,7 +542,7 @@ typedef struct SpiceMsgcTunnelAddGenericService {
> >      uint64_t description;
> >      union {
> >          SpiceMsgTunnelIpInfo ip;
> > -    } u;
> > +    } u2;
> >  } SpiceMsgcTunnelAddGenericService;
> >  
> >  typedef struct SpiceMsgcTunnelRemoveService {
> > diff --git a/spice.proto b/spice.proto
> > index 04e7ea4..b4920f5 100644
> > --- a/spice.proto
> > +++ b/spice.proto
> > @@ -1210,7 +1210,7 @@ channel TunnelChannel : BaseChannel {
> >  	switch (type) {
> >  	case IPP:
> >  	    TunnelIpInfo ip @ctype(SpiceMsgTunnelIpInfo);
> > -	} u;
> > +	} u2;
> >      } @ctype(SpiceMsgcTunnelAddGenericService) service_add = 101;
> >  
> >      message {
> > 
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list