From 3280fd5cf93b7c0766ab24967bee5412f8369169 Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Mon, 8 Feb 2010 19:28:42 +0100 Subject: [PATCH] Get rid of magic hash values for filtering query parameters Some metadata were filtered out from the reply by directly checking for their hash, including the hash value in the code. Remove the magic values and compare dfm->field against the relevant dmap_* field as for other special cases. --- src/httpd_daap.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/httpd_daap.c b/src/httpd_daap.c index 0fc6e053..6545bf23 100644 --- a/src/httpd_daap.c +++ b/src/httpd_daap.c @@ -1728,12 +1728,19 @@ daap_reply_playlists(struct evhttp_request *req, struct evbuffer *evbuf, char ** for (i = 0; i < nmeta; i++) { + dfm = dmap_find_field(meta[i]); + if (!dfm) + { + DPRINTF(E_LOG, L_DAAP, "Could not find requested meta field (%d)\n", i + 1); + continue; + } + /* dmap.itemcount - always added */ - if (meta[i] == 0xd4b8b70d) + if (dfm->field == &dmap_mimc) continue; /* com.apple.itunes.smart-playlist - type = 1 AND id != 1 */ - if (meta[i] == 0x670fc55e) + if (dfm->field == &dmap_aeSP) { val = 0; ret = safe_atoi32(dbpli.type, &val); @@ -1755,13 +1762,6 @@ daap_reply_playlists(struct evhttp_request *req, struct evbuffer *evbuf, char ** continue; } - dfm = dmap_find_field(meta[i]); - if (!dfm) - { - DPRINTF(E_LOG, L_DAAP, "Could not find requested meta field (%d)\n", i + 1); - continue; - } - /* Not in struct playlist_info */ if (dfm->pli_offset < 0) continue; @@ -1972,10 +1972,6 @@ daap_reply_groups(struct evhttp_request *req, struct evbuffer *evbuf, char **uri for (i = 0; i < nmeta; i++) { - /* dmap.itemcount - always added */ - if (meta[i] == 0xd4b8b70d) - continue; - dfm = dmap_find_field(meta[i]); if (!dfm) { @@ -1983,6 +1979,10 @@ daap_reply_groups(struct evhttp_request *req, struct evbuffer *evbuf, char **uri continue; } + /* dmap.itemcount - always added */ + if (dfm->field == &dmap_mimc) + continue; + /* Not in struct group_info */ if (dfm->gri_offset < 0) continue;