After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 689028 - Signalize higher version services
Signalize higher version services
Status: RESOLVED FIXED
Product: GUPnP
Classification: Other
Component: gupnp
unspecified
Other All
: Normal normal
: ---
Assigned To: GUPnP Maintainers
GUPnP Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-11-25 14:28 UTC by Jens Georg
Modified: 2012-11-28 23:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Signalize higher version services (2.45 KB, patch)
2012-11-25 14:28 UTC, Jens Georg
none Details | Review
Signalize higher version services (2.77 KB, patch)
2012-11-28 19:16 UTC, Jens Georg
committed Details | Review

Description Jens Georg 2012-11-25 14:28:20 UTC
Fix control point not finding services.
Comment 1 Jens Georg 2012-11-25 14:28:21 UTC
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.
Comment 2 Zeeshan Ali 2012-11-25 15:03:18 UTC
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?
Comment 3 Jens Georg 2012-11-25 21:17:24 UTC
(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.
Comment 4 Jens Georg 2012-11-28 19:16:28 UTC
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.
Comment 5 Zeeshan Ali 2012-11-28 21:33:36 UTC
Review of attachment 230114 [details] [review]:

Looks good
Comment 6 Jens Georg 2012-11-28 23:15:16 UTC
Attachment 230114 [details] pushed as eb5b312 - Signalize higher version services