summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBertrik Sikken <bertrik@sikken.nl>2011-04-30 09:15:57 +0000
committerBertrik Sikken <bertrik@sikken.nl>2011-04-30 09:15:57 +0000
commiteac9577f7611f1c505e3168aeb956dd02865afc8 (patch)
treee82b093bd8c00d3d0430e9a746c8f68e0daab44d
parentde40194b61db898952455f52b9f8fa0e255651db (diff)
downloadrockbox-eac9577f7611f1c505e3168aeb956dd02865afc8.tar.gz
rockbox-eac9577f7611f1c505e3168aeb956dd02865afc8.tar.bz2
rockbox-eac9577f7611f1c505e3168aeb956dd02865afc8.zip
FS#12085 - Correction of iap.c to avoid sending useless data to an accessory, and allow larger playlists names, by Ophir Lojkine
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29796 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/iap.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/apps/iap.c b/apps/iap.c
index fa2c7d6beb..dcdb0fbb91 100644
--- a/apps/iap.c
+++ b/apps/iap.c
@@ -43,7 +43,6 @@
#include "tuner.h"
#include "ipod_remote_tuner.h"
-#define MAX_NAME_LENGTH 20
#include "filetree.h"
#include "dir.h"
@@ -647,20 +646,20 @@ static void iap_handlepkt_mode4(void)
case 0x001A:
{
/* ReturnCategorizedDatabaseRecord */
- unsigned char data[7 + MAX_NAME_LENGTH] =
+ unsigned char data[7 + MAX_PATH] =
{0x04, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00,
'R', 'O', 'C', 'K', 'B', 'O', 'X', '\0'};
unsigned long item_offset = (serbuf[5] << 24) | (serbuf[6] << 16) |
(serbuf[7] << 8) | serbuf[8];
- get_playlist_name(data + 7, item_offset, MAX_NAME_LENGTH);
+ get_playlist_name(data + 7, item_offset, MAX_PATH);
/*Remove file extension*/
char *dot=NULL;
dot = (strrchr(data+7, '.'));
if (dot != NULL)
*dot = '\0';
- iap_send_pkt(data, sizeof(data));
+ iap_send_pkt(data, 7 + strlen(data+7) + 1);
break;
}
@@ -779,7 +778,9 @@ static void iap_handlepkt_mode4(void)
(cur_dbrecord[3] << 8) |
cur_dbrecord[4];
unsigned char selected_playlist
- [sizeof(global_settings.playlist_catalog_dir) + 1 + MAX_NAME_LENGTH] = {0};
+ [sizeof(global_settings.playlist_catalog_dir)
+ + 1
+ + MAX_PATH] = {0};
strcpy(selected_playlist,
global_settings.playlist_catalog_dir);
@@ -787,7 +788,7 @@ static void iap_handlepkt_mode4(void)
selected_playlist[len] = '/';
get_playlist_name (selected_playlist + len + 1,
item_offset,
- MAX_NAME_LENGTH);
+ MAX_PATH);
ft_play_playlist(selected_playlist,
global_settings.playlist_catalog_dir,
strrchr(selected_playlist, '/') + 1);