Rockbox mail archiveSubject: Re: Dynamic global char arrays.
Re: Dynamic global char arrays.
From: Daniel Stenberg <daniel_at_rockbox.org>
Date: Fri, 19 Aug 2005 23:25:40 +0200 (CEST)
On Sat, 20 Aug 2005, XavierGr wrote:
> I can use a very big one (*pointer, buffer) 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
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/rockboxReceived on 2005-08-19