From b57ce6ca8a80443c7b4927136e35e160fdaf345e Mon Sep 17 00:00:00 2001 From: akir Date: Wed, 25 Aug 2004 10:03:09 +0000 Subject: make use of "size" in "recode" -> fixes drawin the cursor in textboxes --- ChangeLog | 2 ++ src/FbTk/Font.cc | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3fae2ba..4b040a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ (Format: Year/Month/Day) Changes for 0.9.10: +*04/08/25: + * Fix to draw Cursors in Textboxes correctly again (Mathias) *04/08/22: * Preliminary basic support for icons in fluxbox-generate_menu (Han) - put a .xpm into ~/.fluxbox/icons. e.g. Eterm.xpm diff --git a/src/FbTk/Font.cc b/src/FbTk/Font.cc index b79cdcc..7cacbd5 100644 --- a/src/FbTk/Font.cc +++ b/src/FbTk/Font.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -//$Id: Font.cc,v 1.11 2004/08/18 16:30:33 rathnor Exp $ +//$Id: Font.cc,v 1.12 2004/08/25 10:03:09 akir Exp $ #include "StringUtil.hh" @@ -94,10 +94,13 @@ char* recode(iconv_t cd, const char *msg, size_t size) { // If empty message, yes this can happen, return - if(strlen(msg) == 0) + if(strlen(msg) == 0 || size == 0) return 0; - size_t inbytesleft = strlen(msg); + if(strlen(msg) < size) + size = strlen(msg); + + size_t inbytesleft = size; size_t outbytesleft = 4*inbytesleft; char *new_msg = new char[outbytesleft]; char *new_msg_ptr = new_msg; -- cgit v0.11.2