Update "cursor" after writing characters to a string buffer. Fixes bug

2007-06-13  Kevin Cozens  <kcozens@cvs.gnome.org>

	* plug-ins/script-fu/tinyscheme/scheme.c (putchars): Update "cursor"
	after writing characters to a string buffer. Fixes bug #446884.

svn path=/trunk/; revision=22774
This commit is contained in:
Kevin Cozens 2007-06-13 15:47:01 +00:00 committed by Kevin Cozens
parent d32097528e
commit 182b2e27f8
2 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2007-06-13 Kevin Cozens <kcozens@cvs.gnome.org>
* 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 <sven@gimp.org>
* app/app.c (app_exit_after_callback): if GIMP_UNSTABLE is

View File

@ -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;
}
}
}