Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx> On Mon, May 14, 2018 at 11:18:54PM +0100, Frediano Ziglio wrote: > Make sure there are not 2 messages with the same value in the > same channel. > > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> > --- > python_modules/ptypes.py | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/python_modules/ptypes.py b/python_modules/ptypes.py > index 664dd1d..1b05cc6 100644 > --- a/python_modules/ptypes.py > +++ b/python_modules/ptypes.py > @@ -1039,6 +1039,10 @@ class ChannelType(Type): > self.messages_byname = {} > self.count = 1 > > + self.messages_byvalue = {} > + for m in self.messages: > + self.messages_byvalue[m.value] = m > + > server_info = MessagesInfo(self.base, True) > client_info = MessagesInfo(self.base, False) > > @@ -1059,6 +1063,10 @@ class ChannelType(Type): > raise Exception("Duplicated message name between %s and %s in channel %s" % ( > info.messages_byname[m.name].name, m.name, self.name)) > info.messages_byname[m.name] = m > + if m.value in info.messages_byvalue: > + raise Exception("Duplicated message value %d between %s and %s in channel %s" % ( > + m.value, info.messages_byvalue[m.value].name, m.name, self.name)) > + info.messages_byvalue[m.value] = m > > self.server_messages = server_info.messages > self.server_messages_byname = server_info.messages_byname > -- > 2.17.0 > > _______________________________________________ > Spice-devel mailing list > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/spice-devel
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel