From: Dana Jansens Date: Thu, 29 May 2003 00:12:18 +0000 (+0000) Subject: fix a seg, fix the loop for rendering a string X-Git-Tag: gl2~50 X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=fa909b1f68b54f21fa0e271f1b3e7e3f43ebfc37;p=dana%2Fopenbox.git fix a seg, fix the loop for rendering a string --- diff --git a/glft/font.c b/glft/font.c index db748ba2..3c1b33af 100644 --- a/glft/font.c +++ b/glft/font.c @@ -255,7 +255,7 @@ struct GlftGlyph *GlftFontGlyph(struct GlftFont *font, const char *c) } g->height = -(font->face->glyph->metrics.height >> 6); - g_hash_table_insert(font->glyph_map, &g->w, &g); + g_hash_table_insert(font->glyph_map, &g->w, g); } return g; diff --git a/glft/render.c b/glft/render.c index 2da342c5..5bb2711e 100644 --- a/glft/render.c +++ b/glft/render.c @@ -93,7 +93,7 @@ void GlftRenderString(struct GlftFont *font, const char *str, int bytes, glPushMatrix(); c = str; - while (c) { + while (c - str < bytes) { g = GlftFontGlyph(font, c); if (g) { glCallList(g->dlist); @@ -101,7 +101,6 @@ void GlftRenderString(struct GlftFont *font, const char *str, int bytes, } else glTranslatef(font->max_advance_width, 0.0, 0.0); c = g_utf8_next_char(c); - if (c - str >= bytes) break; } glPopMatrix();