From ddb3a52987c9144a4ea6974f6ec39e5361c0647a Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 21 Oct 2014 17:12:02 +0000 Subject: [PATCH] valgrindiness git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4774 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/console.c | 8 ++++---- engine/gl/gl_font.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/engine/client/console.c b/engine/client/console.c index 23bc72e4..01042cac 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -2024,7 +2024,7 @@ char *Con_CopyConsole(qboolean nomarkup, qboolean onlyiflink) if (*cur == CON_LINKSTART) break; } - while (finalendoffset < con->selendline->length) + while (finalendoffset < l->length) { uc = (((conchar_t*)(l+1))[finalendoffset] & CON_CHARMASK); if (uc != ' ' && uc != '\t' && ((conchar_t*)(l+1))[finalendoffset] != CON_LINKEND) @@ -2034,9 +2034,9 @@ char *Con_CopyConsole(qboolean nomarkup, qboolean onlyiflink) } } } - + //scan backwards to find any link enclosure - for(lend = cur; lend >= (conchar_t*)(l+1); lend--) + for(lend = cur-1; lend >= (conchar_t*)(l+1); lend--) { if (*lend == CON_LINKSTART) { @@ -2051,7 +2051,7 @@ char *Con_CopyConsole(qboolean nomarkup, qboolean onlyiflink) } } //scan forwards to find the end of the selected link - if (*cur == CON_LINKSTART) + if (l->length && *cur == CON_LINKSTART) { for(lend = (conchar_t*)(con->selendline+1) + finalendoffset; lend < (conchar_t*)(con->selendline+1) + con->selendline->length; lend++) { diff --git a/engine/gl/gl_font.c b/engine/gl/gl_font.c index 239cbbe8..51e4abc0 100644 --- a/engine/gl/gl_font.c +++ b/engine/gl/gl_font.c @@ -1570,8 +1570,8 @@ int Font_LineBreaks(conchar_t *start, conchar_t *end, int maxpixelwidth, int max { if (start+l >= end || (start[l]&(CON_CHARMASK|CON_HIDDEN)) == '\n') break; - l++; px = Font_CharEndCoord(font, px, start[l]); + l++; } //if we did get to the end if (px > maxpixelwidth)