[gimp] app, pdb: use gimp_is_canonical_identifier() for pdb-get|set-data…
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app, pdb: use gimp_is_canonical_identifier() for pdb-get|set-data…
- Date: Fri, 30 Oct 2020 10:54:27 +0000 (UTC)
commit 1fb2448850e623052f9f44cc7c9aa10cd2546941
Author: Jehan <jehan girinstud io>
Date: Tue Oct 27 12:13:38 2020 +0100
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.
app/pdb/pdb-cmds.c | 27 +++++++++++++++++++++------
pdb/groups/pdb.pdb | 27 +++++++++++++++++++++------
2 files changed, 42 insertions(+), 12 deletions(-)
---
diff --git a/app/pdb/pdb-cmds.c b/app/pdb/pdb-cmds.c
index d63e1405a4..6b1c80af7b 100644
--- a/app/pdb/pdb-cmds.c
+++ b/app/pdb/pdb-cmds.c
@@ -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,7 +1084,12 @@ pdb_get_data_invoker (GimpProcedure *procedure,
success = FALSE;
}
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,
@@ -1116,14 +1121,19 @@ 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
- 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,
@@ -1154,13 +1164,18 @@ 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
- 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,
diff --git a/pdb/groups/pdb.pdb b/pdb/groups/pdb.pdb
index b8ad965ac7..9ac205fee4 100644
--- a/pdb/groups/pdb.pdb
+++ b/pdb/groups/pdb.pdb
@@ -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,7 +1165,12 @@ HELP
success = FALSE;
}
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
);
@@ -1197,14 +1202,19 @@ 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
- 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
);
@@ -1235,13 +1245,18 @@ 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
- 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
);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]