summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-08-24 09:13:51 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-08-24 09:13:51 +0000
commit4021798aec181d1280b3ac2044df82fb3131d9ce (patch)
tree41e8034ae2bbe9f3f7643c844a3d12793917e5f6
parentc7e4f5f2596bc7812b0569eabeea557686b43bb1 (diff)
downloadrockbox-4021798aec181d1280b3ac2044df82fb3131d9ce.tar.gz
rockbox-4021798aec181d1280b3ac2044df82fb3131d9ce.zip
FM radio: fix by Antonius Hellman, no more crash when loading preset files with more than 32 entries
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7398 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/recorder/radio.c4
-rw-r--r--firmware/tuner_philips.c6
2 files changed, 4 insertions, 6 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c
index 67306ac2b0..fa083f20f9 100644
--- a/apps/recorder/radio.c
+++ b/apps/recorder/radio.c
@@ -639,7 +639,6 @@ void radio_load_presets(void)
639 char *freq; 639 char *freq;
640 char *name; 640 char *name;
641 bool done = false; 641 bool done = false;
642 int i;
643 int f; 642 int f;
644 643
645 if(!presets_loaded) 644 if(!presets_loaded)
@@ -650,8 +649,7 @@ void radio_load_presets(void)
650 fd = open(default_filename, O_RDONLY); 649 fd = open(default_filename, O_RDONLY);
651 if(fd >= 0) 650 if(fd >= 0)
652 { 651 {
653 i = 0; 652 while(!done && num_presets < MAX_PRESETS)
654 while(!done && i < MAX_PRESETS)
655 { 653 {
656 rc = read_line(fd, buf, 128); 654 rc = read_line(fd, buf, 128);
657 if(rc > 0) 655 if(rc > 0)
diff --git a/firmware/tuner_philips.c b/firmware/tuner_philips.c
index 72dbf9df5b..59c6d219d8 100644
--- a/firmware/tuner_philips.c
+++ b/firmware/tuner_philips.c
@@ -37,7 +37,7 @@ void philips_set(int setting, int value)
37 /* init values */ 37 /* init values */
38 write_bytes[0] = 0x80; /* mute */ 38 write_bytes[0] = 0x80; /* mute */
39 write_bytes[1] = 0x00; 39 write_bytes[1] = 0x00;
40 write_bytes[2] = 0x00; 40 write_bytes[2] = 0x10;
41#if CONFIG_TUNER_XTAL == 32768000 41#if CONFIG_TUNER_XTAL == 32768000
42 write_bytes[3] = 0x1A; /* 32.768MHz, soft mute, 42 write_bytes[3] = 0x1A; /* 32.768MHz, soft mute,
43 stereo noise cancelling */ 43 stereo noise cancelling */
@@ -55,9 +55,9 @@ void philips_set(int setting, int value)
55 { 55 {
56 int n; 56 int n;
57#if CONFIG_TUNER_XTAL == 32768000 57#if CONFIG_TUNER_XTAL == 32768000
58 n = (4 * (value - 225000)) / 32768; 58 n = (4 * (value + 225000)) / 32768;
59#else 59#else
60 n = (4 * (value - 225000)) / 50000; 60 n = (4 * (value + 225000)) / 50000;
61#endif 61#endif
62 write_bytes[0] = (write_bytes[0] & 0xC0) | (n >> 8); 62 write_bytes[0] = (write_bytes[0] & 0xC0) | (n >> 8);
63 write_bytes[1] = n & 0xFF; 63 write_bytes[1] = n & 0xFF;