From c0b28629565de55084a1c6c5d2ce387490032e7d Mon Sep 17 00:00:00 2001 From: Magnus Holmgren Date: Sun, 17 Dec 2006 15:40:13 +0000 Subject: [PATCH] Fix freeze/crash problems when scrolling very long strings (like filenames or tags). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11789 a1c6a512-1295-4272-9138-f99709370657 --- firmware/bidi.c | 4 ++-- firmware/export/lcd.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/firmware/bidi.c b/firmware/bidi.c index a6f6b8c5d9..b5851f298e 100644 --- a/firmware/bidi.c +++ b/firmware/bidi.c @@ -131,8 +131,8 @@ void arabjoin(unsigned short * stringprt, int length){ unsigned short *bidi_l2v(const unsigned char *str, int orientation) { int length = utf8length(str); - static unsigned short utf16_buf[MAX_PATH+1]; - static unsigned short bidi_buf[MAX_PATH+1]; + static unsigned short utf16_buf[SCROLL_LINE_SIZE]; + static unsigned short bidi_buf[SCROLL_LINE_SIZE]; unsigned short *heb_str, *target, *tmp; // *broken_str int block_start, block_end, block_type, block_length, i; //long max_chars=0; diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 1ccbc513d2..3e1ea4430b 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h @@ -367,9 +367,10 @@ extern void lcd_bitmap_transparent(const fb_data *src, int x, int y, /* internal usage, but in multiple drivers */ #ifdef HAVE_LCD_BITMAP #define SCROLL_SPACING 3 +#define SCROLL_LINE_SIZE (MAX_PATH + LCD_WIDTH/2 + SCROLL_SPACING + 2) struct scrollinfo { - char line[MAX_PATH + LCD_WIDTH/2 + SCROLL_SPACING + 2]; + char line[SCROLL_LINE_SIZE]; int len; /* length of line in chars */ int width; /* length of line in pixels */ int offset;