From 1237525da2dc38453b1ff05dd1d743b2ff8edcf3 Mon Sep 17 00:00:00 2001 From: "Maciej S. Szmigiero" Date: Tue, 8 Aug 2023 14:52:05 +0200 Subject: [PATCH] GTree: Annotate the real return value type of g_tree_nnodes () g_tree_nnodes () is returning a signed integer type (gint), however the tree node counter value type is really an unsigned integer (guint). This means that the returned size will be negative if the container holds more than G_MAXINT elements. Add a note to this function that its return value can be cast back to guint in order to support its full range of values. This will also make sure that we take this into account in future Glib versions. Signed-off-by: Maciej S. Szmigiero --- glib/gtree.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/glib/gtree.c b/glib/gtree.c index bbd609e5b..41e797376 100644 --- a/glib/gtree.c +++ b/glib/gtree.c @@ -1454,6 +1454,11 @@ g_tree_height (GTree *tree) * Gets the number of nodes in a #GTree. * * Returns: the number of nodes in @tree + * + * The node counter value type is really a #guint, + * but it is returned as a #gint due to backward + * compatibility issues (can be cast back to #guint to + * support its full range of values). */ gint g_tree_nnodes (GTree *tree)