fix for bug in console indent, was not copying the null terminator.

also add assert to catch this case more quickly.
This commit is contained in:
Campbell Barton 2012-12-01 06:29:04 +00:00
parent eb490f3aae
commit 2f97f929a5
3 changed files with 3 additions and 5 deletions

@ -146,7 +146,8 @@ static int console_textview_line_get(struct TextViewContext *tvc, const char **l
ConsoleLine *cl = (ConsoleLine *)tvc->iter;
*line = cl->line;
*len = cl->len;
// printf("'%s' %d\n", *line, cl->len);
BLI_assert(cl->line[cl->len] == '\0' && (cl->len == 0 || cl->line[cl->len - 1] != '\0'));
return 1;
}

@ -444,7 +444,7 @@ static int console_indent_exec(bContext *C, wmOperator *UNUSED(op))
console_line_verify_length(ci, ci->len + len);
memmove(ci->line + len, ci->line, ci->len);
memmove(ci->line + len, ci->line, ci->len + 1);
memset(ci->line, ' ', len);
ci->len += len;
BLI_assert(ci->len >= 0);

@ -73,9 +73,6 @@ void printfGlyph(bmGlyph * glyph)
}
*/
#define MAX2(x,y) ( (x)>(y) ? (x) : (y) )
#define MAX3(x,y,z) MAX2( MAX2((x),(y)) , (z) )
void calcAlpha(ImBuf * ibuf)
{
int i;