app, pdb: use gimp_is_canonical_identifier() for pdb-get|set-data…

… instead of gimp_pdb_is_canonical_procedure().
The later would set an error saying "Procedure name '%s' is not a
canonical identifier". Yet the data label is not a procedure name. It is
a random name. I'm not sure why we need it to be canonical too, but why
not. In any case, let's use the right function.
This commit is contained in:
Jehan 2020-10-27 12:13:38 +01:00
parent 79319803a2
commit 1fb2448850
2 changed files with 42 additions and 12 deletions

View File

@ -1071,7 +1071,7 @@ pdb_get_data_invoker (GimpProcedure *procedure,
if (success) if (success)
{ {
if (gimp_pdb_is_canonical_procedure (identifier, error)) if (gimp_is_canonical_identifier (identifier))
{ {
const guint8 *orig_data; const guint8 *orig_data;
@ -1084,7 +1084,12 @@ pdb_get_data_invoker (GimpProcedure *procedure,
success = FALSE; success = FALSE;
} }
else else
success = FALSE; {
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
_("Data label '%s' is not a canonical identifier"),
identifier);
success = FALSE;
}
} }
return_vals = gimp_procedure_get_return_values (procedure, success, return_vals = gimp_procedure_get_return_values (procedure, success,
@ -1116,14 +1121,19 @@ pdb_get_data_size_invoker (GimpProcedure *procedure,
if (success) if (success)
{ {
if (gimp_pdb_is_canonical_procedure (identifier, error)) if (gimp_is_canonical_identifier (identifier))
{ {
if (! gimp_plug_in_manager_get_data (gimp->plug_in_manager, if (! gimp_plug_in_manager_get_data (gimp->plug_in_manager,
identifier, &bytes)) identifier, &bytes))
success = FALSE; success = FALSE;
} }
else else
success = FALSE; {
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
_("Data label '%s' is not a canonical identifier"),
identifier);
success = FALSE;
}
} }
return_vals = gimp_procedure_get_return_values (procedure, success, return_vals = gimp_procedure_get_return_values (procedure, success,
@ -1154,13 +1164,18 @@ pdb_set_data_invoker (GimpProcedure *procedure,
if (success) if (success)
{ {
if (gimp_pdb_is_canonical_procedure (identifier, error)) if (gimp_is_canonical_identifier (identifier))
{ {
gimp_plug_in_manager_set_data (gimp->plug_in_manager, gimp_plug_in_manager_set_data (gimp->plug_in_manager,
identifier, bytes, data); identifier, bytes, data);
} }
else else
success = FALSE; {
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
_("Data label '%s' is not a canonical identifier"),
identifier);
success = FALSE;
}
} }
return gimp_procedure_get_return_values (procedure, success, return gimp_procedure_get_return_values (procedure, success,

View File

@ -1152,7 +1152,7 @@ HELP
%invoke = ( %invoke = (
code => <<'CODE' code => <<'CODE'
{ {
if (gimp_pdb_is_canonical_procedure (identifier, error)) if (gimp_is_canonical_identifier (identifier))
{ {
const guint8 *orig_data; const guint8 *orig_data;
@ -1165,7 +1165,12 @@ HELP
success = FALSE; success = FALSE;
} }
else else
success = FALSE; {
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
_("Data label '%s' is not a canonical identifier"),
identifier);
success = FALSE;
}
} }
CODE CODE
); );
@ -1197,14 +1202,19 @@ HELP
%invoke = ( %invoke = (
code => <<'CODE' code => <<'CODE'
{ {
if (gimp_pdb_is_canonical_procedure (identifier, error)) if (gimp_is_canonical_identifier (identifier))
{ {
if (! gimp_plug_in_manager_get_data (gimp->plug_in_manager, if (! gimp_plug_in_manager_get_data (gimp->plug_in_manager,
identifier, &bytes)) identifier, &bytes))
success = FALSE; success = FALSE;
} }
else else
success = FALSE; {
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
_("Data label '%s' is not a canonical identifier"),
identifier);
success = FALSE;
}
} }
CODE CODE
); );
@ -1235,13 +1245,18 @@ HELP
%invoke = ( %invoke = (
code => <<'CODE' code => <<'CODE'
{ {
if (gimp_pdb_is_canonical_procedure (identifier, error)) if (gimp_is_canonical_identifier (identifier))
{ {
gimp_plug_in_manager_set_data (gimp->plug_in_manager, gimp_plug_in_manager_set_data (gimp->plug_in_manager,
identifier, bytes, data); identifier, bytes, data);
} }
else else
success = FALSE; {
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
_("Data label '%s' is not a canonical identifier"),
identifier);
success = FALSE;
}
} }
CODE CODE
); );