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.
This commit is contained in:
Julien BLACHE 2010-02-08 19:28:42 +01:00
parent 2524eb0f8f
commit 3280fd5cf9

View File

@ -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;