fix DMAP parsing and a few compiler warning - release

This commit is contained in:
philippe44
2023-08-26 13:16:09 -07:00
parent 888371ef08
commit b5b7dc6ebb
2 changed files with 15 additions and 13 deletions

View File

@@ -46,11 +46,11 @@ typedef struct {
} dmap_field;
static const dmap_field dmap_fields[] = {
#ifdef DMAP_FULL
{ "abal", DMAP_DICT, DMAP_STR, "daap.browsealbumlisting" },
{ "abar", DMAP_DICT, DMAP_STR, "daap.browseartistlisting" },
{ "abcp", DMAP_DICT, DMAP_STR, "daap.browsecomposerlisting" },
{ "abgn", DMAP_DICT, DMAP_STR, "daap.browsegenrelisting" },
#ifdef DMAP_FULL
{ "abpl", DMAP_UINT, 0, "daap.baseplaylist" },
{ "abro", DMAP_DICT, 0, "daap.databasebrowse" },
{ "adbs", DMAP_DICT, 0, "daap.databasesongs" },
@@ -139,8 +139,10 @@ static const dmap_field dmap_fields[] = {
{ "asaa", DMAP_STR, 0, "daap.songalbumartist" },
{ "asac", DMAP_UINT, 0, "daap.songartworkcount" },
{ "asai", DMAP_UINT, 0, "daap.songalbumid" },
#endif
{ "asal", DMAP_STR, 0, "daap.songalbum" },
{ "asar", DMAP_STR, 0, "daap.songartist" },
#ifdef DMAP_FULL
{ "asas", DMAP_UINT, 0, "daap.songalbumuserratingstatus" },
{ "asbk", DMAP_UINT, 0, "daap.bookmarkable" },
{ "asbo", DMAP_UINT, 0, "daap.songbookmark" },
@@ -257,10 +259,10 @@ static const dmap_field dmap_fields[] = {
{ "meia", DMAP_UINT, 0, "dmap.itemdateadded" },
{ "meip", DMAP_UINT, 0, "dmap.itemdateplayed" },
{ "mext", DMAP_UINT, 0, "dmap.objectextradata" },
#endif
{ "miid", DMAP_UINT, 0, "dmap.itemid" },
{ "mikd", DMAP_UINT, 0, "dmap.itemkind" },
{ "mimc", DMAP_UINT, 0, "dmap.itemcount" },
#endif
{ "minm", DMAP_STR, 0, "dmap.itemname" },
#ifdef DMAP_FULL
{ "mlcl", DMAP_DICT, DMAP_DICT, "dmap.listing" },
@@ -424,7 +426,7 @@ static int dmap_parse_internal(const dmap_settings *settings, const char *buf, s
/* Make a best guess of the type */
field_type = DMAP_UNKNOWN;
field_name = code;
#ifdef DMAP_FULL
if (field_len >= 8) {
/* Look for a four char code followed by a length within the current field */
if (isalpha(p[0] & 0xff) &&
@@ -435,7 +437,7 @@ static int dmap_parse_internal(const dmap_settings *settings, const char *buf, s
field_type = DMAP_DICT;
}
}
#ifdef DMAP_FULL
if (field_type == DMAP_UNKNOWN) {
size_t i;
int is_string = 1;

View File

@@ -185,7 +185,7 @@ struct raop_ctx_s *raop_create(uint32_t host, char *name,
getsockname(ctx->sock, (struct sockaddr *) &addr, &nlen);
ctx->port = ntohs(addr.sin_port);
#endif
ctx->running = true;
memcpy(ctx->mac, mac, 6);
@@ -193,7 +193,7 @@ struct raop_ctx_s *raop_create(uint32_t host, char *name,
#ifdef WIN32
// seems that Windows snprintf does not add NULL char if actual size > max
id[63] = '\0';
id[63] = '\0';
ctx->svc = mdnsd_register_svc(ctx->svr, id, "_raop._tcp.local", ctx->port, NULL, (const char**) txt);
pthread_create(&ctx->thread, NULL, &rtsp_thread, ctx);
@@ -619,12 +619,12 @@ static bool handle_rtsp(raop_ctx_t *ctx, int sock)
LOG_INFO("[%p]: SET PARAMETER progress %d/%u %s", ctx, current, stop, p);
success = ctx->cmd_cb(RAOP_PROGRESS, max(current, 0), stop);
} else if (body && ((p = kd_lookup(headers, "Content-Type")) != NULL) && !strcasecmp(p, "application/x-dmap-tagged")) {
struct metadata_s metadata;
struct metadata_s metadata;
dmap_settings settings = {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, on_dmap_string, NULL,
NULL
};
settings.ctx = &metadata;
memset(&metadata, 0, sizeof(struct metadata_s));
if (!dmap_parse(&settings, body, len)) {
@@ -873,7 +873,7 @@ static int base64_pad(char *src, char **padded)
memset(*padded, '=', n);
memcpy(*padded, src, strlen(src));
(*padded)[n] = '\0';
return strlen(*padded);
}
@@ -959,7 +959,7 @@ static int base64_decode(const char *str, void *data)
*q++ = (val >> 8) & 0xff;
if (marker < 1)
*q++ = val & 0xff;
}
}
return q - (unsigned char *) data;
}