From 168dc90aa82e7fe97983c93e61329a8ee606c8d8 Mon Sep 17 00:00:00 2001 From: Frank Gevaerts Date: Wed, 1 Jul 2009 18:42:51 +0000 Subject: Remove the static order[] allocation in favour of plugin_get_buffer() git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21598 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/random_folder_advance_config.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c index 96938c6d09..70b721522a 100644 --- a/apps/plugins/random_folder_advance_config.c +++ b/apps/plugins/random_folder_advance_config.c @@ -31,8 +31,6 @@ static int lasttick; #define RFADIR_FILE ROCKBOX_DIR "/folder_advance_dir.txt" #define RFA_FILE_TEXT ROCKBOX_DIR "/folder_advance_list.txt" #define MAX_REMOVED_DIRS 10 -/* The plugin code fits in less than 10k */ -#define MAX_SHUFFLE_SIZE (PLUGIN_BUFFER_SIZE/4 - 2500) char *buffer = NULL; ssize_t buffer_size; @@ -43,7 +41,6 @@ struct file_format { char folder[][MAX_PATH]; }; struct file_format *list = NULL; -static int order[MAX_SHUFFLE_SIZE]; void update_screen(bool clear) { @@ -466,7 +463,19 @@ int import_list_from_file_text(void) int start_shuffled_play(void) { + int *order; + size_t max_shuffle_size; int i = 0; + + /* get memory for shuffling */ + order=rb->plugin_get_buffer(&max_shuffle_size); + max_shuffle_size/=sizeof(int); + if (order==NULL || max_shuffle_size==0) + { + rb->splashf(HZ*2, "Not enough memory for shuffling"); + return 0; + } + /* load the dat file if not already done */ if ((list == NULL || list->count == 0) && (i = load_list()) != 0) { @@ -482,7 +491,7 @@ int start_shuffled_play(void) /* shuffle the thing */ rb->srand(*rb->current_tick); - if(list->count>MAX_SHUFFLE_SIZE) + if(list->count>(int)max_shuffle_size) { rb->splashf(HZ*2, "Too many files: %d", list->count); return 0; -- cgit v1.2.3