mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-02 17:03:26 +00:00
Issue #14205: gimp-image-find-next-sample-point returns error when…
… passed "0" as argument. Adding support of none_ok for arguments of type sample_point, allowing to pass 0 as a special value and use it on this function.
This commit is contained in:
parent
2d2f1d048d
commit
bf14d3db20
4 changed files with 17 additions and 10 deletions
|
@ -298,13 +298,13 @@ register_image_sample_points_procs (GimpPDB *pdb)
|
|||
g_param_spec_uint ("sample-point",
|
||||
"sample point",
|
||||
"The ID of the current sample point (0 if first invocation)",
|
||||
1, G_MAXUINT32, 1,
|
||||
0, G_MAXUINT32, 0,
|
||||
GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
|
||||
gimp_procedure_add_return_value (procedure,
|
||||
g_param_spec_uint ("next-sample-point",
|
||||
"next sample point",
|
||||
"The next sample point's ID",
|
||||
1, G_MAXUINT32, 1,
|
||||
0, G_MAXUINT32, 0,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_pdb_register_procedure (pdb, procedure);
|
||||
g_object_unref (procedure);
|
||||
|
|
|
@ -481,11 +481,12 @@ g_param_spec_uint ("$name",
|
|||
CODE
|
||||
}
|
||||
elsif ($pdbtype eq 'sample_point') {
|
||||
$min = exists $arg->{none_ok} ? 0 : 1,
|
||||
$pspec = <<CODE;
|
||||
g_param_spec_uint ("$name",
|
||||
"$nick",
|
||||
"$blurb",
|
||||
1, G_MAXUINT32, 1,
|
||||
$min, G_MAXUINT32, $min,
|
||||
$flags)
|
||||
CODE
|
||||
}
|
||||
|
|
|
@ -109,12 +109,12 @@ HELP
|
|||
@inargs = (
|
||||
{ name => 'image', type => 'image',
|
||||
desc => 'The image' },
|
||||
{ name => 'sample_point', type => 'sample_point', no_validate => 1,
|
||||
{ name => 'sample_point', type => 'sample_point', no_validate => 1, none_ok => 1,
|
||||
desc => 'The ID of the current sample point (0 if first invocation)' }
|
||||
);
|
||||
|
||||
@outargs = (
|
||||
{ name => 'next_sample_point', type => 'sample_point',
|
||||
{ name => 'next_sample_point', type => 'sample_point', none_ok => 1,
|
||||
desc => "The next sample point's ID" }
|
||||
);
|
||||
|
||||
|
|
16
pdb/lib.pl
16
pdb/lib.pl
|
@ -139,7 +139,8 @@ sub generate_fun {
|
|||
$retarg_len = $retarg->{array}->{name};
|
||||
$annotate = " (array length=$retarg_len)";
|
||||
}
|
||||
if (exists $retarg->{none_ok}) {
|
||||
|
||||
if (exists $retarg->{none_ok} && $type ne 'sample_point') {
|
||||
$annotate .= " (nullable)";
|
||||
}
|
||||
|
||||
|
@ -199,6 +200,7 @@ sub generate_fun {
|
|||
my $desc = exists $_->{desc} ? $_->{desc} : "";
|
||||
my $var_len;
|
||||
my $value;
|
||||
my $n_annotations = 0;
|
||||
|
||||
if (exists $_->{nopdb}) {
|
||||
$argc--;
|
||||
|
@ -284,16 +286,20 @@ sub generate_fun {
|
|||
|
||||
if (exists $arg->{array}) {
|
||||
$argdesc .= " (array length=$var_len)";
|
||||
$n_annotations++;
|
||||
}
|
||||
|
||||
if (exists $arg->{in_annotate}) {
|
||||
$argdesc .= " $arg->{in_annotate}";
|
||||
}
|
||||
if (exists $_->{none_ok}) {
|
||||
$argdesc .= " (nullable)";
|
||||
$n_annotations++;
|
||||
}
|
||||
|
||||
if (exists $arg->{array} || exists $_->{none_ok} || exists $arg->{in_annotate}) {
|
||||
if (exists $_->{none_ok} && $type ne 'sample_point') {
|
||||
$argdesc .= " (nullable)";
|
||||
$n_annotations++;
|
||||
}
|
||||
|
||||
if ($n_annotations > 0) {
|
||||
$argdesc .= ":";
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue