don't save the viewer position if it hasn't changed

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15689 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Marcoen Hirschberg 2007-11-19 16:02:45 +00:00
parent cfa6495356
commit 4c62c00f99

View file

@ -296,6 +296,7 @@ static int par_indent_spaces; /* number of spaces to indent first paragraph */
static int fd;
static char *file_name;
static long file_size;
static long start_position; /* position in the file after the viewer is started */
static bool mac_text;
static long file_pos; /* Position of the top of the buffer in the file */
static unsigned char *buffer_end; /*Set to BUFFER_END() when file_pos changes*/
@ -1142,12 +1143,19 @@ static void viewer_load_settings(void) /* same name as global, but not the same
}
fill_buffer(file_pos, buffer, BUFFER_SIZE);
/* remember the current position */
start_position = file_pos + screen_top_ptr - buffer;
}
static void viewer_save_settings(void)/* same name as global, but not the same file.. */
{
int settings_fd;
/* don't save if the position didn't change */
if (file_pos + screen_top_ptr - buffer == start_position)
return;
settings_fd = rb->creat(SETTINGS_FILE); /* create the settings file */
rb->write (settings_fd, &prefs, sizeof(struct preferences));