From 2c1e7afe061303a728e1a3648c91c995f7835fb2 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Sat, 22 Feb 2003 23:45:28 +0000 Subject: * ttyio.c (tty_print_utf8_string, tty_print_utf8_string2): Use 0 to indicate a string with no maximum size. This prevents early truncation of strings that contain control chars which are expanded into \xXX form. --- util/ttyio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'util/ttyio.c') diff --git a/util/ttyio.c b/util/ttyio.c index 2d362a502..e5b2b581a 100644 --- a/util/ttyio.c +++ b/util/ttyio.c @@ -274,7 +274,7 @@ tty_print_utf8_string2( byte *p, size_t n, size_t max_n ) } if( i < n ) { buf = utf8_to_native( p, n, 0 ); - if( strlen( buf ) > max_n ) { + if( max_n && (strlen( buf ) > max_n )) { buf[max_n] = 0; } /*(utf8 conversion already does the control character quoting)*/ @@ -282,7 +282,7 @@ tty_print_utf8_string2( byte *p, size_t n, size_t max_n ) m_free( buf ); } else { - if( n > max_n ) { + if( max_n && (n > max_n) ) { n = max_n; } tty_print_string( p, n ); @@ -292,7 +292,7 @@ tty_print_utf8_string2( byte *p, size_t n, size_t max_n ) void tty_print_utf8_string( byte *p, size_t n ) { - tty_print_utf8_string2( p, n, n ); + tty_print_utf8_string2( p, n, 0 ); } -- cgit v1.2.3