Add missing DMAP types and correct existing types

Most of the unsigned DMAP types were missing and assignments were incorrect
between signed and unsigned types. Fix all of this, and add (preliminary)
support for the new types.
This commit is contained in:
Ace Jones 2010-02-08 14:43:06 +01:00 committed by Julien BLACHE
parent d4fb2091c8
commit 0607e82a42
2 changed files with 13 additions and 6 deletions

View File

@ -6,11 +6,14 @@
enum dmap_type
{
DMAP_TYPE_BYTE = 0x01,
DMAP_TYPE_UBYTE = 0x02,
DMAP_TYPE_SHORT = 0x03,
DMAP_TYPE_INT = 0x05,
DMAP_TYPE_LONG = 0x07,
DMAP_TYPE_UBYTE = 0x01,
DMAP_TYPE_BYTE = 0x02,
DMAP_TYPE_USHORT = 0x03,
DMAP_TYPE_SHORT = 0x04,
DMAP_TYPE_UINT = 0x05,
DMAP_TYPE_INT = 0x06,
DMAP_TYPE_ULONG = 0x07,
DMAP_TYPE_LONG = 0x08,
DMAP_TYPE_STRING = 0x09,
DMAP_TYPE_DATE = 0x0a,
DMAP_TYPE_VERSION = 0x0b,

View File

@ -519,23 +519,26 @@ dmap_add_field(struct evbuffer *evbuf, struct dmap_field_map *dfm, char *strval,
switch (dfm->type)
{
case DMAP_TYPE_BYTE:
case DMAP_TYPE_UBYTE:
case DMAP_TYPE_BYTE:
if (val)
dmap_add_char(evbuf, dfm->tag, val);
break;
case DMAP_TYPE_USHORT:
case DMAP_TYPE_SHORT:
if (val)
dmap_add_short(evbuf, dfm->tag, val);
break;
case DMAP_TYPE_UINT:
case DMAP_TYPE_INT:
case DMAP_TYPE_DATE:
if (val)
dmap_add_int(evbuf, dfm->tag, val);
break;
case DMAP_TYPE_ULONG:
case DMAP_TYPE_LONG:
if (val64)
dmap_add_long(evbuf, dfm->tag, val64);
@ -546,6 +549,7 @@ dmap_add_field(struct evbuffer *evbuf, struct dmap_field_map *dfm, char *strval,
dmap_add_string(evbuf, dfm->tag, strval);
break;
/* DMAP_TYPE_VERSION & DMAP_TYPE_LIST not handled here */
default:
DPRINTF(E_LOG, L_DAAP, "Unsupported DMAP type %d for DMAP field %s\n", dfm->type, dfm->desc);
break;