PDB: fix #14205 image-find-next-sample-point error

Three types declared in pdbgen perl code,
for sample-point, guides, and tatto objects,
declare too restrictive a range of permissible values.
They should allow the value 0, which the API uses as a sentinel value,
to represent "invalid object ID".
The types are for object ID's, which are unsigned.

GObject checks the declared range when you chunk into a GValueArray,
to call the PDB.

Declaring the attribute in the perl .pdb "no-validate"
is not sufficient since GObject doesn't understand
GIMP_PARAM_NO_VALIDATE, that flag is distinct from G_PARAM_NO_VALIDATE.

Only affects the ScriptFu binding to PDB.
The GI binding to libgimp is not affected.

The declared range is no more restrictive than the underlying type
"unsigned int 32."
So of no real consequence.

The API could be changed to return a list which the caller
would iterate on.
This commit is contained in:
lloyd konneker 2025-06-07 09:40:55 -04:00 committed by Lloyd Konneker
parent 7fd2489985
commit 69894d8bbf
5 changed files with 21 additions and 21 deletions

View file

@ -5439,7 +5439,7 @@ register_image_procs (GimpPDB *pdb)
g_param_spec_uint ("tattoo-state", g_param_spec_uint ("tattoo-state",
"tattoo state", "tattoo state",
"The tattoo state", "The tattoo state",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure); gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure); g_object_unref (procedure);
@ -5468,7 +5468,7 @@ register_image_procs (GimpPDB *pdb)
g_param_spec_uint ("tattoo-state", g_param_spec_uint ("tattoo-state",
"tattoo state", "tattoo state",
"The new image tattoo state", "The new image tattoo state",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure); gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure); g_object_unref (procedure);
@ -5497,7 +5497,7 @@ register_image_procs (GimpPDB *pdb)
g_param_spec_uint ("tattoo", g_param_spec_uint ("tattoo",
"tattoo", "tattoo",
"The tattoo of the layer to find", "The tattoo of the layer to find",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure, gimp_procedure_add_return_value (procedure,
gimp_param_spec_layer ("layer", gimp_param_spec_layer ("layer",
@ -5532,7 +5532,7 @@ register_image_procs (GimpPDB *pdb)
g_param_spec_uint ("tattoo", g_param_spec_uint ("tattoo",
"tattoo", "tattoo",
"The tattoo of the channel to find", "The tattoo of the channel to find",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure, gimp_procedure_add_return_value (procedure,
gimp_param_spec_channel ("channel", gimp_param_spec_channel ("channel",
@ -5567,7 +5567,7 @@ register_image_procs (GimpPDB *pdb)
g_param_spec_uint ("tattoo", g_param_spec_uint ("tattoo",
"tattoo", "tattoo",
"The tattoo of the path to find", "The tattoo of the path to find",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure, gimp_procedure_add_return_value (procedure,
gimp_param_spec_path ("path", gimp_param_spec_path ("path",

View file

@ -296,7 +296,7 @@ register_image_guides_procs (GimpPDB *pdb)
g_param_spec_uint ("guide", g_param_spec_uint ("guide",
"guide", "guide",
"The new guide", "The new guide",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure); gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure); g_object_unref (procedure);
@ -331,7 +331,7 @@ register_image_guides_procs (GimpPDB *pdb)
g_param_spec_uint ("guide", g_param_spec_uint ("guide",
"guide", "guide",
"The new guide", "The new guide",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure); gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure); g_object_unref (procedure);
@ -360,7 +360,7 @@ register_image_guides_procs (GimpPDB *pdb)
g_param_spec_uint ("guide", g_param_spec_uint ("guide",
"guide", "guide",
"The ID of the guide to be removed", "The ID of the guide to be removed",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure); gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure); g_object_unref (procedure);
@ -395,7 +395,7 @@ register_image_guides_procs (GimpPDB *pdb)
g_param_spec_uint ("next-guide", g_param_spec_uint ("next-guide",
"next guide", "next guide",
"The next guide's ID", "The next guide's ID",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure); gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure); g_object_unref (procedure);
@ -424,7 +424,7 @@ register_image_guides_procs (GimpPDB *pdb)
g_param_spec_uint ("guide", g_param_spec_uint ("guide",
"guide", "guide",
"The guide", "The guide",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure, gimp_procedure_add_return_value (procedure,
gimp_param_spec_enum ("orientation", gimp_param_spec_enum ("orientation",
@ -462,7 +462,7 @@ register_image_guides_procs (GimpPDB *pdb)
g_param_spec_uint ("guide", g_param_spec_uint ("guide",
"guide", "guide",
"The guide", "The guide",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure, gimp_procedure_add_return_value (procedure,
g_param_spec_int ("position", g_param_spec_int ("position",

View file

@ -240,7 +240,7 @@ register_image_sample_points_procs (GimpPDB *pdb)
g_param_spec_uint ("sample-point", g_param_spec_uint ("sample-point",
"sample point", "sample point",
"The new sample point", "The new sample point",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure); gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure); g_object_unref (procedure);
@ -269,7 +269,7 @@ register_image_sample_points_procs (GimpPDB *pdb)
g_param_spec_uint ("sample-point", g_param_spec_uint ("sample-point",
"sample point", "sample point",
"The ID of the sample point to be removed", "The ID of the sample point to be removed",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure); gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure); g_object_unref (procedure);
@ -298,13 +298,13 @@ register_image_sample_points_procs (GimpPDB *pdb)
g_param_spec_uint ("sample-point", g_param_spec_uint ("sample-point",
"sample point", "sample point",
"The ID of the current sample point (0 if first invocation)", "The ID of the current sample point (0 if first invocation)",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE)); GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
gimp_procedure_add_return_value (procedure, gimp_procedure_add_return_value (procedure,
g_param_spec_uint ("next-sample-point", g_param_spec_uint ("next-sample-point",
"next sample point", "next sample point",
"The next sample point's ID", "The next sample point's ID",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure); gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure); g_object_unref (procedure);
@ -333,7 +333,7 @@ register_image_sample_points_procs (GimpPDB *pdb)
g_param_spec_uint ("sample-point", g_param_spec_uint ("sample-point",
"sample point", "sample point",
"The guide", "The guide",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_return_value (procedure, gimp_procedure_add_return_value (procedure,
g_param_spec_int ("position-x", g_param_spec_int ("position-x",

View file

@ -1919,7 +1919,7 @@ register_item_procs (GimpPDB *pdb)
g_param_spec_uint ("tattoo", g_param_spec_uint ("tattoo",
"tattoo", "tattoo",
"The item tattoo", "The item tattoo",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure); gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure); g_object_unref (procedure);
@ -1948,7 +1948,7 @@ register_item_procs (GimpPDB *pdb)
g_param_spec_uint ("tattoo", g_param_spec_uint ("tattoo",
"tattoo", "tattoo",
"The new item tattoo", "The new item tattoo",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure); gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure); g_object_unref (procedure);

View file

@ -467,7 +467,7 @@ CODE
g_param_spec_uint ("$name", g_param_spec_uint ("$name",
"$nick", "$nick",
"$blurb", "$blurb",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
$flags) $flags)
CODE CODE
} }
@ -476,7 +476,7 @@ CODE
g_param_spec_uint ("$name", g_param_spec_uint ("$name",
"$nick", "$nick",
"$blurb", "$blurb",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
$flags) $flags)
CODE CODE
} }
@ -485,7 +485,7 @@ CODE
g_param_spec_uint ("$name", g_param_spec_uint ("$name",
"$nick", "$nick",
"$blurb", "$blurb",
1, G_MAXUINT32, 1, 0, G_MAXUINT32, 1,
$flags) $flags)
CODE CODE
} }