fix length issue found by yermin.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1256 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
bernard.xiong@gmail.com 2011-01-23 13:54:59 +00:00
parent 0ce73d5b17
commit 1f46f9da43
1 changed files with 3 additions and 1 deletions

View File

@ -77,7 +77,8 @@ void rtgui_bitmap_font_draw_char(struct rtgui_font_bitmap* font, struct rtgui_dc
} }
} }
static void rtgui_bitmap_font_draw_text(struct rtgui_font* font, struct rtgui_dc* dc, const char* text, rt_ubase_t len, struct rtgui_rect* rect) static void rtgui_bitmap_font_draw_text(struct rtgui_font* font, struct rtgui_dc* dc,
const char* text, rt_ubase_t len, struct rtgui_rect* rect)
{ {
rt_uint32_t length; rt_uint32_t length;
struct rtgui_font_bitmap* bmp_font = (struct rtgui_font_bitmap*)(font->data); struct rtgui_font_bitmap* bmp_font = (struct rtgui_font_bitmap*)(font->data);
@ -122,6 +123,7 @@ static void rtgui_bitmap_font_draw_text(struct rtgui_font* font, struct rtgui_dc
#else #else
while ((rect->x1 < rect->x2) && len) while ((rect->x1 < rect->x2) && len)
{ {
length = 0;
while (((rt_uint8_t)*(text + length) < 0x80) && *(text + length)) length ++; while (((rt_uint8_t)*(text + length) < 0x80) && *(text + length)) length ++;
if (length > 0) if (length > 0)
{ {