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 (gimp_pdb_is_canonical_procedure (identifier, error))
if (gimp_is_canonical_identifier (identifier))
{
const guint8 *orig_data;
@ -1084,8 +1084,13 @@ pdb_get_data_invoker (GimpProcedure *procedure,
success = FALSE;
}
else
{
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,
error ? *error : NULL);
@ -1116,15 +1121,20 @@ pdb_get_data_size_invoker (GimpProcedure *procedure,
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,
identifier, &bytes))
success = FALSE;
}
else
{
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,
error ? *error : NULL);
@ -1154,14 +1164,19 @@ pdb_set_data_invoker (GimpProcedure *procedure,
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,
identifier, bytes, data);
}
else
{
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,
error ? *error : NULL);

View File

@ -1152,7 +1152,7 @@ HELP
%invoke = (
code => <<'CODE'
{
if (gimp_pdb_is_canonical_procedure (identifier, error))
if (gimp_is_canonical_identifier (identifier))
{
const guint8 *orig_data;
@ -1165,8 +1165,13 @@ HELP
success = FALSE;
}
else
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
_("Data label '%s' is not a canonical identifier"),
identifier);
success = FALSE;
}
}
CODE
);
}
@ -1197,15 +1202,20 @@ HELP
%invoke = (
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,
identifier, &bytes))
success = FALSE;
}
else
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
_("Data label '%s' is not a canonical identifier"),
identifier);
success = FALSE;
}
}
CODE
);
}
@ -1235,14 +1245,19 @@ HELP
%invoke = (
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,
identifier, bytes, data);
}
else
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT,
_("Data label '%s' is not a canonical identifier"),
identifier);
success = FALSE;
}
}
CODE
);
}