GNOME Bugzilla – Bug 689028
Signalize higher version services
Last modified: 2012-11-28 23:15:20 UTC
Fix control point not finding services.
Created attachment 229812 [details] [review] Signalize higher version services If a control point was looking for a service instead of a device it was only responding on exact version matches, but according to UDA also higher versions are compatible as well. This patch introduces a compare function that takes the service version into account instead of a simple string comparison.
Review of attachment 229812 [details] [review]: Looks good otherwise. ::: libgupnp/gupnp-control-point.c @@ -324,2 +324,4 @@ } +static gboolean +compare_st_with_version (const char *st, const char *service) ST stands for "Search target", right? If so, I think we don't need to abbreviate it and '_with_version' doesn't seem needed here. @@ +341,3 @@ + service_length = (service_version_ptr - service); + + if (st_length != service_length) is this check really needed since we compare the strings for equality below anyways?
(In reply to comment #2) > Review of attachment 229812 [details] [review]: > > Looks good otherwise. > > ::: libgupnp/gupnp-control-point.c > @@ -324,2 +324,4 @@ > } > > +static gboolean > +compare_st_with_version (const char *st, const char *service) > > ST stands for "Search target", right? If so, I think we don't need to > abbreviate it and '_with_version' doesn't seem needed here. Actually it was service_type here. Needs some other naming, yes. > > @@ +341,3 @@ > + service_length = (service_version_ptr - service); > + > + if (st_length != service_length) > > is this check really needed since we compare the strings for equality below > anyways? Well I need to calculate the length anyway, so there's no harm in trying to early exit. Comparing two ints should be faster than comparing two 20 char strings where half of it is mostly equal.
Created attachment 230114 [details] [review] Signalize higher version services If a control point was looking for a service instead of a device it was only responding on exact version matches, but according to UDA also higher versions are compatible as well. This patch introduces a compare function that takes the service version into account instead of a simple string comparison.
Review of attachment 230114 [details] [review]: Looks good
Attachment 230114 [details] pushed as eb5b312 - Signalize higher version services