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 696837 - (DefaultValue) return -1 when upnp:totalDeletedChildCount property is not found
(DefaultValue)
return -1 when upnp:totalDeletedChildCount property is not found
Status: RESOLVED FIXED
Product: gupnp-av
Classification: Other
Component: General
0.12.x
Other Linux
: Normal normal
: ---
Assigned To: GUPnP Maintainers
GUPnP Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-03-29 10:05 UTC by Ludovic Ferrandis
Modified: 2019-02-22 05:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Return -1 as default value for gupnp_didl_lite_container_get_total_deleted_child_count (1.10 KB, patch)
2013-03-29 10:05 UTC, Ludovic Ferrandis
committed Details | Review

Description Ludovic Ferrandis 2013-03-29 10:05:54 UTC
Created attachment 240107 [details] [review]
Return -1 as default value for gupnp_didl_lite_container_get_total_deleted_child_count

gupnp_didl_lite_container_get_total_deleted_child_count returns 0 as default value if the property is not found.
0 is a valid value for upnp:totalDeletedChildCount.

Fix the function so it behaves as gupnp_didl_lite_resource_get_update_count (res@updateCount) and return -1 when the property is not found.
Comment 1 Mark Ryan 2013-03-29 14:54:53 UTC
I wonder if the fact that gupnp_didl_lite_resource_get_update_count can return -1 is actually a bug.  As far as I can tell there are no other gupnp-av functions with a return type of guint that return -1.  If this is not a bug and it is okay to do this, we should update the documentation for both functions to indicate that (guint) -1 is returned when the property is not found.
Comment 2 Jens Georg 2013-04-02 09:01:49 UTC
with the newly added properties we did some change in the paradigm. Previously, uint properties were made int in -av so we could return -1 on "not set" (eg res@updateCount), but that caused problems.

With the newly added properties, there are "_is_set" fuctions to explicitly check for the presence of the property:

gupnp_didl_lite_container_total_deleted_child_count_is_set and such
Comment 3 Ludovic Ferrandis 2013-04-02 09:35:08 UTC
"is_set" will be the way to go when the parser will be change (using "SAX" if I well remember the bug description) and efficient, but today, we are going to parse 2 times the XML to test & get the value.

res@updateCount & totalDeleteChildCount have been added to support Content Sync, and they have the "same specification" (0 is a valid value, -1, is an invalid value as it could never be reached).

But these 2 functions behave differently.

So if we should use "is_set" right now, res@updateCount should be fixed.

But returning -1 for this function is a matter of prudence as otherwise it will return a valid value when not set.