Use the string length in bytes passed in instead of recalculating it.

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

	* plug-ins/script-fu/scheme-wrapper.c (ts_output_string): Use the
	string length in bytes passed in instead of recalculating it.

	* plug-ins/script-fu/tinyscheme/scheme.c: Added comment.

svn path=/trunk/; revision=23239
This commit is contained in:
Kevin Cozens 2007-08-13 16:39:16 +00:00 committed by Kevin Cozens
parent 47876907dd
commit 2dfb1e5193
3 changed files with 14 additions and 11 deletions

View File

@ -1,3 +1,10 @@
2007-08-13 Kevin Cozens <kcozens@cvs.gnome.org>
* plug-ins/script-fu/scheme-wrapper.c (ts_output_string): Use the
string length in bytes passed in instead of recalculating it.
* plug-ins/script-fu/tinyscheme/scheme.c: Added comment.
2007-08-13 Sven Neumann <sven@gimp.org>
* app/base/gimphistogram.c (gimp_histogram_get_std_dev): corrected

View File

@ -259,26 +259,21 @@ ts_get_error_msg (void)
const gchar *
ts_get_success_msg (void)
{
if (sc.vptr->is_string(sc.value)) {
if (sc.vptr->is_string(sc.value))
return sc.vptr->string_value(sc.value);
}
else
return "Success";
}
/* len is length of 'string' in bytes */
void
ts_output_string (const char *string, int len)
{
g_return_if_fail (len >= 0);
if (len > 0 && ts_console_mode)
{
/* len is the number of UTF-8 characters; we need the number of bytes */
len = g_utf8_offset_to_pointer (string, len) - string;
script_fu_output_to_console (string, len);
}
}
static void init_constants (void);

View File

@ -1550,6 +1550,7 @@ static void putchars(scheme *sc, const char *chars, int char_cnt) {
if (char_cnt <= 0)
return;
/* Get length of 'chars' in bytes */
char_cnt = g_utf8_offset_to_pointer(chars, (long)char_cnt) - chars;
if (sc->print_error) {