make use of "size" in "recode" -> fixes drawin the cursor in textboxes

This commit is contained in:
akir 2004-08-25 10:03:09 +00:00
parent 94c823f997
commit b57ce6ca8a
2 changed files with 8 additions and 3 deletions

View file

@ -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 <progname>.xpm into ~/.fluxbox/icons. e.g. Eterm.xpm

View file

@ -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;