Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: Dynamic global char arrays.

Re: Dynamic global char arrays.

From: Daniel Stenberg <daniel_at_rockbox.org>
Date: 2005-08-19

On Sat, 20 Aug 2005, XavierGr wrote:

> I can use a very big one (*pointer[1500], buffer[10000]) but I think that
> this is a waste.

Just pick a reasonable default, I'd say. Use defines to make them easier to
change in the future.

> Also if someone is crazy enough to put 10000 picures in a folder then the
> plug-in would crash.

No, since your code must check to not overflow the buffers. But yes, it may
fill the buffer without all files fitting. That will always be a risk, and it
is so in the normal Rockbox dir browser etc too.

> I thought of using the max_files_in_dir value but this will not work on a
> global variable. Is there any alternatives? What do you think? Maybe
> pointers?

You can use the plugin memory area for dynamic memory to use for
arrays/buffers etc, but it takes some fiddling to keep things right and I
believe that memory is already used for the grayscale lib's buffers, and I
know there's this pending patch to the JPEG viewer that can load the image
into this area instead of the sound buffer to keep the music playing while
viewing pics. Your code might need to co-exist with these things.

-- 
  Daniel Stenberg -- http://www.rockbox.org/ -- http://daniel.haxx.se/
_______________________________________________
http://cool.haxx.se/mailman/listinfo/rockbox
Received on Fri Aug 19 23:25:50 2005

Page was last modified "Jan 10 2012" The Rockbox Crew
aaa