From 6e2411a98abe92df039e59fd048f347d2235f0ad Mon Sep 17 00:00:00 2001 From: dockes Date: Sat, 30 Aug 2008 07:34:14 +0000 Subject: [PATCH] utf8truncate --- src/utils/smallut.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/smallut.cpp b/src/utils/smallut.cpp index c343add1..169b2e39 100644 --- a/src/utils/smallut.cpp +++ b/src/utils/smallut.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: smallut.cpp,v 1.30 2008-08-30 07:30:55 dockes Exp $ (C) 2004 J.F.Dockes"; +static char rcsid[] = "@(#$Id: smallut.cpp,v 1.31 2008-08-30 07:34:11 dockes Exp $ (C) 2004 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -401,6 +401,8 @@ string truncate_to_word(const string &input, string::size_type maxlen) void utf8truncate(string &s, int maxlen) { + if (s.size() <= maxlen) + return; Utf8Iter iter(s); int pos = 0; while (iter++ != string::npos)