mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-22 11:32:41 -05:00
FS#11399 by me: fix r26998 for text_viewer
Restore the old behaviour: - preferences must be read-write for tv_preferences.c , read-only for all other modules -> use pointer to const struct - init functions must get the plugin buffer + its size as arguments for easily adding new functions -> use pointer to buffer pointer and size to make allocation easier - preferences meaning is private to each file and must not be known by tv_preferences.c -> move tv_check_header_and_footer() back in tv_window.c; also avoid chaining 3 times the callbacks by calling tv_set_preferences() only once if more than one preference needs changing git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27089 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
cf9bba7102
commit
59fd2b24bd
13 changed files with 115 additions and 52 deletions
|
|
@ -170,18 +170,18 @@ static void tv_change_preferences(const struct tv_preferences *oldp)
|
|||
tv_seek(cur_file_pos + cur_start_file_pos - start_file_pos, SEEK_SET);
|
||||
}
|
||||
|
||||
bool tv_init_reader(void)
|
||||
bool tv_init_reader(unsigned char **buf, size_t *size)
|
||||
{
|
||||
size_t size;
|
||||
|
||||
/* get the plugin buffer */
|
||||
reader_buffer = rb->plugin_get_buffer(&size);
|
||||
|
||||
if (size < 2 * TV_MIN_BLOCK_SIZE)
|
||||
if (*size < 2 * TV_MIN_BLOCK_SIZE)
|
||||
return false;
|
||||
|
||||
block_size = size / 2;
|
||||
block_size = *size / 2;
|
||||
buffer_size = 2 * block_size;
|
||||
reader_buffer = *buf;
|
||||
|
||||
*buf += buffer_size;
|
||||
*size -= buffer_size;
|
||||
|
||||
tv_add_preferences_change_listner(tv_change_preferences);
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue