mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
Adapted Sven's code into pdbgen so that gimp_image_set_filename()
2004-11-13 Manish Singh <yosh@gimp.org> * tools/pdbgen/pdb/image.pdb: Adapted Sven's code into pdbgen so that gimp_image_set_filename() validates that it is called with a filename in the filesystem encoding which can safely be converted to UTF-8 and back. Fixes #153751. * app/pdb/image_cmds.c * libgimp/gimpimage_pdb.c: Regenerated.
This commit is contained in:
parent
5ce8292af8
commit
c563a249b9
4 changed files with 56 additions and 4 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2004-11-13 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* tools/pdbgen/pdb/image.pdb: Adapted Sven's code into pdbgen so
|
||||
that gimp_image_set_filename() validates that it is called with
|
||||
a filename in the filesystem encoding which can safely be converted
|
||||
to UTF-8 and back. Fixes #153751.
|
||||
|
||||
* app/pdb/image_cmds.c
|
||||
* libgimp/gimpimage_pdb.c: Regenerated.
|
||||
|
||||
2004-11-13 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/dialogs/Makefile.am
|
||||
|
@ -40,7 +50,7 @@
|
|||
in UTF-8 encoding.
|
||||
|
||||
* app/pdb/image_cmds.c
|
||||
* libgimp/gimpimage_pdb.c
|
||||
* libgimp/gimpimage_pdb.c: Regenerated.
|
||||
|
||||
* app/vectors/gimpbezierstroke.h: formatting.
|
||||
|
||||
|
|
|
@ -3806,7 +3806,25 @@ image_set_filename_invoker (Gimp *gimp,
|
|||
success = FALSE;
|
||||
|
||||
if (success)
|
||||
gimp_image_set_filename (gimage, filename);
|
||||
{
|
||||
/* verify that the filename can be converted to UTF-8 and back */
|
||||
gchar *utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
|
||||
|
||||
if (utf8)
|
||||
{
|
||||
gchar *tmp = g_filename_from_utf8 (utf8, -1, NULL, NULL, NULL);
|
||||
|
||||
if (tmp)
|
||||
g_free (tmp);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
||||
if (success)
|
||||
gimp_image_set_filename (gimage, filename);
|
||||
}
|
||||
|
||||
return procedural_db_return_args (&image_set_filename_proc, success);
|
||||
}
|
||||
|
@ -3829,7 +3847,7 @@ static ProcRecord image_set_filename_proc =
|
|||
{
|
||||
"gimp_image_set_filename",
|
||||
"Sets the specified image's filename.",
|
||||
"This procedure sets the specified image's filename.",
|
||||
"This procedure sets the specified image's filename. The filename should be in the filesystem encoding.",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"Spencer Kimball & Peter Mattis",
|
||||
"1995-1996",
|
||||
|
|
|
@ -1868,7 +1868,8 @@ gimp_image_get_filename (gint32 image_ID)
|
|||
*
|
||||
* Sets the specified image's filename.
|
||||
*
|
||||
* This procedure sets the specified image's filename.
|
||||
* This procedure sets the specified image's filename. The filename
|
||||
* should be in the filesystem encoding.
|
||||
*
|
||||
* Returns: TRUE on success.
|
||||
*/
|
||||
|
|
|
@ -1289,8 +1289,31 @@ HELP
|
|||
|
||||
$outargs[0]->{alias} =~ s/g_strdup \((.*)\)/$1/;
|
||||
CODE1
|
||||
$help .= " The filename should be in the filesystem encoding.";
|
||||
|
||||
$inargs[1]->{no_validate} = 1;
|
||||
|
||||
$invoke{code} = <<CODE3;
|
||||
{
|
||||
/* verify that the filename can be converted to UTF-8 and back */
|
||||
gchar *utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
|
||||
|
||||
if (utf8)
|
||||
{
|
||||
gchar *tmp = g_filename_from_utf8 (utf8, -1, NULL, NULL, NULL);
|
||||
|
||||
if (tmp)
|
||||
g_free (tmp);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
||||
if (success)
|
||||
$invoke{code}
|
||||
}
|
||||
CODE3
|
||||
CODE2
|
||||
|
||||
&image_accessors('name', 'string', 'name', 1,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue