grel: Fix sign of GRealTuples.width

Thankfully this struct is also internal, so we can happily change the
types of any field except the first one (which is in the public `GTuples`
prefix).

This fixes the remaining `-Wsign-conversion` warnings for `grel.c`.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3405
This commit is contained in:
Philip Withnall
2025-04-10 19:02:35 +01:00
parent ea06530b6e
commit 79fa5fc305

View File

@@ -124,7 +124,7 @@ static size_t relation_count_internal (GRelation *relation,
struct _GRealTuples
{
guint len;
gint width;
size_t width;
gpointer *data;
};
@@ -622,11 +622,16 @@ g_tuples_index (GTuples *tuples0,
gint field)
{
GRealTuples *tuples = (GRealTuples*) tuples0;
size_t unsigned_index, unsigned_field;
g_return_val_if_fail (tuples0 != NULL, NULL);
g_return_val_if_fail (field < tuples->width, NULL);
return tuples->data[index * tuples->width + field];
g_return_val_if_fail (index >= 0, NULL);
g_return_val_if_fail (field >= 0 && (size_t) field < tuples->width, NULL);
unsigned_index = (size_t) index;
unsigned_field = (size_t) field;
return tuples->data[unsigned_index * tuples->width + unsigned_field];
}
/* Print