diff --git a/ChangeLog b/ChangeLog index b542667a8c..cdf5c2506f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-06-13 Kevin Cozens + + * plug-ins/script-fu/tinyscheme/scheme.c (putchars): Update "cursor" + after writing characters to a string buffer. Fixes bug #446884. + 2007-06-13 Sven Neumann * app/app.c (app_exit_after_callback): if GIMP_UNSTABLE is diff --git a/plug-ins/script-fu/tinyscheme/scheme.c b/plug-ins/script-fu/tinyscheme/scheme.c index e02729f11c..82c2cb9cc8 100644 --- a/plug-ins/script-fu/tinyscheme/scheme.c +++ b/plug-ins/script-fu/tinyscheme/scheme.c @@ -1553,6 +1553,7 @@ static void backchar(scheme *sc, gunichar c) { /* len is number of UTF-8 characters in string pointed to by chars */ static void putchars(scheme *sc, const char *chars, int char_cnt) { + int free_bytes; /* Space remaining in buffer (in bytes) */ int l; char *s; port *pt=sc->outport->_object._port; @@ -1584,9 +1585,13 @@ static void putchars(scheme *sc, const char *chars, int char_cnt) { } #endif } else { - l = pt->rep.string.past_the_end - pt->rep.string.curr; - if (l > 0) - memcpy(pt->rep.string.curr, chars, min(char_cnt, l)); + free_bytes = pt->rep.string.past_the_end - pt->rep.string.curr; + if (free_bytes > 0) + { + l = min(char_cnt, free_bytes); + memcpy(pt->rep.string.curr, chars, l); + pt->rep.string.curr += l; + } } }