Hi.
I've just installed 1.1.15 and found a bug (IMO) that Script-Fu
failed if a string containing double quotes was given as an
argument of the SF_STRING type. Attached is a quick and dirty
patch for fixing that bug.
I wonder if we need to escape the values of the SF_FILENAME type
in the same way, although I believe that few people use double
quotes in file names.
I hope this helps.
Regards,
--
KAJIYAMA, Tamito <[EMAIL PROTECTED]>
diff -ru gimp-1.1.15.orig/plug-ins/script-fu/script-fu-scripts.c
gimp-1.1.15/plug-ins/script-fu/script-fu-scripts.c
--- gimp-1.1.15.orig/plug-ins/script-fu/script-fu-scripts.c Mon Jan 3 05:52:56
2000
+++ gimp-1.1.15/plug-ins/script-fu/script-fu-scripts.c Mon Jan 17 07:22:08 2000
@@ -1543,9 +1543,9 @@
char *command, *c;
char buffer[MAX_STRING_LENGTH];
int length;
- int i;
+ int i, j;
GdkFont *font;
- char *escaped;
+ char *escaped, *p, *q;
if ((script = sf_interface.script) == NULL)
return;
@@ -1586,7 +1586,11 @@
break;
case SF_STRING:
escaped = ESCAPE (gtk_entry_get_text (GTK_ENTRY (script->args_widgets[i])));
- length += strlen (escaped) + 3;
+ j = 0; /* number of double quotes */
+ for (p = escaped; *p; p++)
+ if (*p == '"')
+ j++;
+ length += strlen (escaped) + j + 3;
g_free (escaped);
break;
case SF_ADJUSTMENT:
@@ -1649,9 +1653,21 @@
text = gtk_entry_get_text (GTK_ENTRY (script->args_widgets[i]));
g_free (script->arg_values[i].sfa_value);
script->arg_values[i].sfa_value = g_strdup (text);
- escaped = ESCAPE (text);
+ p = ESCAPE (text);
+ j = 0; /* number of double quotes */
+ for (q = p; *q; q++)
+ if (*q == '"')
+ j++;
+ q = escaped = g_new (gchar, strlen (p) + j + 1);
+ for (j = 0; p[j]; j++) {
+ if (p[j] == '"')
+ *q++ = '\\';
+ *q++ = p[j];
+ }
+ *q = '\0';
g_snprintf (buffer, MAX_STRING_LENGTH, "\"%s\"", escaped);
g_free (escaped);
+ g_free (p);
text = buffer;
break;
case SF_ADJUSTMENT: