summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoshihisa Uchida <uchida@rockbox.org>2010-07-02 11:35:28 +0000
committerYoshihisa Uchida <uchida@rockbox.org>2010-07-02 11:35:28 +0000
commit426f4c1e87aea5f796d2b4ce71d9f1351f189c47 (patch)
tree2116744f2860f0b826abf98ab1f38acf180fd314
parent00a3024924b603fafb4c8d1b242e7af362affcae (diff)
text viewer: fixed garbage data are not stored in the setting file.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27240 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/text_viewer/tv_settings.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/apps/plugins/text_viewer/tv_settings.c b/apps/plugins/text_viewer/tv_settings.c
index 2419ae0705..549b0d7ab9 100644
--- a/apps/plugins/text_viewer/tv_settings.c
+++ b/apps/plugins/text_viewer/tv_settings.c
@@ -43,7 +43,7 @@
* overlap_page_mode 1
* header_mode 1
* footer_mode 1
- * scroll_mode 1
+ * vertical_scroll_mode 1
* autoscroll_speed 1
* horizontal_scrollbar 1
* horizontal_scroll_mode 1
@@ -86,7 +86,7 @@
* overlap_page_mode 1
* header_mode 1
* footer_mode 1
- * scroll_mode 1
+ * vertical_scroll_mode 1
* autoscroll_speed 1
* horizontal_scrollbar 1
* horizontal_scroll_mode 1
@@ -140,8 +140,8 @@ static bool tv_read_preferences(int pfd, int version, struct tv_preferences *pre
if (rb->read(pfd, buf, read_size) < 0)
return false;
- prefs->word_mode = *p++;
- prefs->line_mode = *p++;
+ prefs->word_mode = *p++;
+ prefs->line_mode = *p++;
prefs->windows = *p++;
if (version <= 1)
@@ -160,7 +160,7 @@ static bool tv_read_preferences(int pfd, int version, struct tv_preferences *pre
if (version < 7)
{
- prefs->statusbar = false;
+ prefs->statusbar = false;
if (*p > 1)
{
prefs->header_mode = ((*p & 1) != 0);
@@ -212,7 +212,7 @@ static bool tv_read_preferences(int pfd, int version, struct tv_preferences *pre
prefs->statusbar = (*p++ != 0);
#ifdef HAVE_LCD_BITMAP
- rb->memcpy(prefs->font_name, buf + read_size - MAX_PATH, MAX_PATH);
+ rb->strlcpy(prefs->font_name, buf + read_size - MAX_PATH, MAX_PATH);
prefs->font = rb->font_get(FONT_UI);
#endif
@@ -225,6 +225,7 @@ static bool tv_write_preferences(int pfd, const struct tv_preferences *prefs)
unsigned char buf[TV_PREFERENCES_SIZE];
unsigned char *p = buf;
+ rb->memset(buf, 0, TV_PREFERENCES_SIZE);
*p++ = prefs->word_mode;
*p++ = prefs->line_mode;
*p++ = prefs->windows;
@@ -245,7 +246,7 @@ static bool tv_write_preferences(int pfd, const struct tv_preferences *prefs)
*p++ = prefs->statusbar;
#ifdef HAVE_LCD_BITMAP
- rb->memcpy(buf + 28, prefs->font_name, MAX_PATH);
+ rb->strlcpy(buf + 28, prefs->font_name, MAX_PATH);
#endif
return (rb->write(pfd, buf, TV_PREFERENCES_SIZE) >= 0);
@@ -554,6 +555,7 @@ bool tv_save_settings(void)
{
/* save to current read file's preferences and bookmarks */
res = false;
+ rb->memset(buf, 0, MAX_PATH);
rb->strlcpy(buf, preferences->file_name, MAX_PATH);
if (rb->write(tfd, buf, MAX_PATH + 2) >= 0)