Commit 84dee699 authored by W. Michael Petullo's avatar W. Michael Petullo

Clean up code following previous Content-Length fix

Signed-off-by: W. Michael Petullo's avatarW. Michael Petullo <mike@flyn.org>
parent 7375c90c
18 November 2010 W. Michael Petullo <mike@flyn.org>
* Fix problem sharing to iTunes due to incorrect Content-Length
11 November 2010 W. Michael Petullo <mike@flyn.org>
* Bump version number.
......
......@@ -76,7 +76,7 @@ static void databases_items_xxx (DMAPShare *share,
GHashTable *query,
SoupClientContext *context);
static struct DMAPMetaDataMap *get_meta_data_map (DMAPShare *share);
static guint32 add_entry_to_mlcl (gpointer id,
static void add_entry_to_mlcl (gpointer id,
DMAPRecord *record,
gpointer mb);
......@@ -542,7 +542,7 @@ send_chunked_file (SoupServer *server, SoupMessage *message, DAAPRecord *record,
/* NOTE: cd g_free'd by chunked_message_finished(). */
}
static guint32
static void
add_entry_to_mlcl (gpointer id,
DMAPRecord *record,
gpointer _mb)
......@@ -713,8 +713,6 @@ add_entry_to_mlcl (gpointer id,
g_object_get (record, "mediakind", &mediakind, NULL);
dmap_structure_add (mlit, DMAP_CC_AEMK, mediakind);
}
return ((DMAPStructureItem *) mlit->data)->size;
}
static void
......
......@@ -1459,7 +1459,13 @@ accumulate_mlcl_size (gpointer id,
struct MLCL_Bits mb_copy = *((struct MLCL_Bits *) mb);
mb_copy.mlcl = dmap_structure_add (NULL, DMAP_CC_MLCL);;
*((guint *) ((struct MLCL_Bits *) mb)->user_data1) += DMAP_SHARE_GET_CLASS (((struct MLCL_Bits *) mb)->user_data2)->add_entry_to_mlcl (id, record, &mb_copy) + 8 /* FIXME: sizeof MLIT */;
DMAP_SHARE_GET_CLASS (((struct MLCL_Bits *) mb)->user_data2)->add_entry_to_mlcl (id, record, &mb_copy);
*((guint *) ((struct MLCL_Bits *) mb)->user_data1) += dmap_structure_get_size(mb_copy.mlcl);
/* Minus eight because we do not want to add size of MLCL CC field + size field n times,
* where n == number of records.
*/
*((guint *) ((struct MLCL_Bits *) mb)->user_data1) -= 8;
/* Destroy created structures as we go. */
dmap_structure_destroy (mb_copy.mlcl);
......@@ -1746,7 +1752,7 @@ _dmap_share_databases (DMAPShare *share,
/* 3: */
soup_message_set_status (message, SOUP_STATUS_OK);
soup_message_headers_set_content_length (message->response_headers, dmap_structure_get_size(adbs) + 8 /* FIXME: sizeof MLCL */);
soup_message_headers_set_content_length (message->response_headers, dmap_structure_get_size(adbs));
/* Free memory after each chunk sent out over network. */
soup_message_body_set_accumulate (message->response_body, FALSE);
......
......@@ -112,7 +112,7 @@ typedef struct {
void (*message_add_standard_headers) (DMAPShare *share,
SoupMessage *msg);
struct DMAPMetaDataMap * (*get_meta_data_map) (DMAPShare *share);
guint32 (*add_entry_to_mlcl) (gpointer id,
void (*add_entry_to_mlcl) (gpointer id,
DMAPRecord *record,
gpointer mb);
void (*databases_browse_xxx) (DMAPShare *share,
......
......@@ -789,7 +789,7 @@ dmap_structure_print (GNode *structure)
guint
dmap_structure_get_size (GNode *structure)
{
return ((DMAPStructureItem *) structure->data)->size;
return ((DMAPStructureItem *) structure->data)->size + 8 /* FIXME: 8 = actual CC field + size field */;
}
......
......@@ -78,7 +78,7 @@ static void databases_items_xxx (DMAPShare *share,
GHashTable *query,
SoupClientContext *context);
static struct DMAPMetaDataMap *get_meta_data_map (DMAPShare *share);
static guint32 add_entry_to_mlcl (gpointer id,
static void add_entry_to_mlcl (gpointer id,
DMAPRecord *record,
gpointer mb);
......@@ -347,7 +347,7 @@ file_to_mmap (const char *location)
return mapped_file;
}
static guint32
static void
add_entry_to_mlcl (gpointer id,
DMAPRecord *record,
gpointer _mb)
......@@ -466,8 +466,6 @@ add_entry_to_mlcl (gpointer id,
}
dmap_structure_add (mlit, DMAP_CC_PFDT, data, size);
}
return ((DMAPStructureItem *) mlit->data)->size;
}
static void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment