From 6aa3e25391d160482339ee072c010bcd22dfbbd1 Mon Sep 17 00:00:00 2001 From: delphij Date: Mon, 26 Nov 2007 08:57:30 +0000 Subject: Virgin import of less v416. --- contrib/less/search.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'contrib/less/search.c') diff --git a/contrib/less/search.c b/contrib/less/search.c index b983334..3a15380 100644 --- a/contrib/less/search.c +++ b/contrib/less/search.c @@ -118,13 +118,16 @@ cvt_length(len, ops) int len; int ops; { - if (utf_mode && (ops & CVT_TO_LC)) + if (utf_mode) /* - * Converting case can cause a UTF-8 string to increase in length. - * Multiplying by 3 is the worst case. + * Just copying a string in UTF-8 mode can cause it to grow + * in length. + * Six output bytes for one input byte is the worst case + * (and unfortunately is far more than is needed in any + * non-pathological situation, so this is very wasteful). */ - len *= 3; - return len+1; + len *= 6; + return len + 1; } /* -- cgit v1.1