ppmviewer: steal from audiobuffer for large arrays

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26744 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Rafaël Carré 2010-06-10 18:28:31 +00:00
parent 05ca8978c4
commit 0acf34fc2d

View file

@ -38,8 +38,7 @@ PLUGIN_HEADER
#define ppm_error(...) rb->splashf(HZ*2, __VA_ARGS__ )
static fb_data buffer[PPM_MAXSIZE];
static fb_data lcd_buf[LCD_WIDTH * LCD_HEIGHT];
static fb_data *buffer, *lcd_buf;
int ppm_read_magic_number(int fd)
{
@ -294,6 +293,19 @@ enum plugin_status plugin_start(const void* parameter)
if(!parameter) return PLUGIN_ERROR;
size_t buffer_size;
char *audiobuf = rb->plugin_get_audio_buffer(&buffer_size);
if (buffer_size < PPM_MAXSIZE + LCD_WIDTH * LCD_HEIGHT + 1)
{
rb->splash(HZ, "Not enough memory");
return PLUGIN_ERROR;
}
/* align on 16 bits */
audiobuf = (char *)(((uintptr_t)audiobuf + 1) & ~1);
buffer = (fb_data *)audiobuf;
lcd_buf = (fb_data*) (audiobuf + PPM_MAXSIZE);
rb->strcpy(filename, parameter);
fd = rb->open(filename, O_RDONLY);