[libdmapsharing] Changes due to pedansee



commit b61351c803ef0fd6b10ea3d6db166ef23630b256
Author: W. Michael Petullo <mike flyn org>
Date:   Tue Mar 20 20:26:06 2018 -0400

    Changes due to pedansee
    
    Signed-off-by: W. Michael Petullo <mike flyn org>

 libdmapsharing/dmap-image-share.c           |  469 ++++++++++++++-------------
 libdmapsharing/test-dmap-container-db.c     |    8 +-
 libdmapsharing/test-dmap-container-record.c |    6 +-
 3 files changed, 242 insertions(+), 241 deletions(-)
---
diff --git a/libdmapsharing/dmap-image-share.c b/libdmapsharing/dmap-image-share.c
index 7cad7ac..7bda402 100644
--- a/libdmapsharing/dmap-image-share.c
+++ b/libdmapsharing/dmap-image-share.c
@@ -45,14 +45,6 @@
 #include <libdmapsharing/dmap-private-utils.h>
 #include <libdmapsharing/dmap-structure.h>
 
-static void dmap_image_share_set_property (GObject * object,
-                                    guint prop_id,
-                                    const GValue * value,
-                                    GParamSpec * pspec);
-static void dmap_image_share_get_property (GObject * object,
-                                    guint prop_id,
-                                    GValue * value, GParamSpec * pspec);
-static void dmap_image_share_dispose (GObject * object);
 guint dmap_image_share_get_desired_port (DmapShare * share);
 const char *dmap_image_share_get_type_of_service (DmapShare * share);
 void dmap_image_share_server_info (DmapShare * share,
@@ -62,20 +54,6 @@ void dmap_image_share_server_info (DmapShare * share,
                             GHashTable * query, SoupClientContext * context);
 void dmap_image_share_message_add_standard_headers (DmapShare * share,
                                              SoupMessage * message);
-static void databases_browse_xxx (DmapShare * share,
-                                 SoupServer * server,
-                                 SoupMessage * msg,
-                                 const char *path,
-                                 GHashTable * query,
-                                 SoupClientContext * context);
-static void databases_items_xxx (DmapShare * share,
-                                SoupServer * server,
-                                SoupMessage * msg,
-                                const char *path,
-                                GHashTable * query,
-                                SoupClientContext * context);
-static struct DmapMetaDataMap *get_meta_data_map (DmapShare * share);
-static void add_entry_to_mlcl (guint id, DmapRecord * record, gpointer mb);
 
 #define DPAP_TYPE_OF_SERVICE "_dpap._tcp"
 #define DPAP_PORT 8770
@@ -85,185 +63,6 @@ struct DmapImageSharePrivate
        gchar unused;
 };
 
-/* Mmap'ed full image file. Global so that it may be free'ed in a different
- * function call that the one that set it up.
- */
-static GMappedFile *mapped_file = NULL;
-
-#define DMAP_IMAGE_SHARE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DMAP_TYPE_IMAGE_SHARE, 
DmapImageSharePrivate))
-
-G_DEFINE_TYPE (DmapImageShare, dmap_image_share, DMAP_TYPE_SHARE);
-
-static void
-dmap_image_share_class_init (DmapImageShareClass * klass)
-{
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
-       DmapShareClass *parent_class = DMAP_SHARE_CLASS (object_class);
-
-       object_class->get_property = dmap_image_share_get_property;
-       object_class->set_property = dmap_image_share_set_property;
-       object_class->dispose = dmap_image_share_dispose;
-
-       parent_class->get_desired_port = dmap_image_share_get_desired_port;
-       parent_class->get_type_of_service = dmap_image_share_get_type_of_service;
-       parent_class->message_add_standard_headers =
-               dmap_image_share_message_add_standard_headers;
-       parent_class->get_meta_data_map = get_meta_data_map;
-       parent_class->add_entry_to_mlcl = add_entry_to_mlcl;
-       parent_class->databases_browse_xxx = databases_browse_xxx;
-       parent_class->databases_items_xxx = databases_items_xxx;
-       parent_class->server_info = dmap_image_share_server_info;
-
-       g_type_class_add_private (klass, sizeof (DmapImageSharePrivate));
-}
-
-static void
-dmap_image_share_init (DmapImageShare * share)
-{
-       share->priv = DMAP_IMAGE_SHARE_GET_PRIVATE (share);
-       /* FIXME: do I need to manually call parent _init? */
-}
-
-static void
-dmap_image_share_set_property (GObject * object,
-                        guint prop_id,
-                        const GValue * value, GParamSpec * pspec)
-{
-       // DmapImageShare *share = DMAP_IMAGE_SHARE (object);
-
-       switch (prop_id) {
-               /* FIXME: */
-       default:
-               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-               break;
-       }
-}
-
-static void
-dmap_image_share_get_property (GObject * object,
-                        guint prop_id, GValue * value, GParamSpec * pspec)
-{
-       // DmapImageShare *share = DMAP_IMAGE_SHARE (object);
-
-       switch (prop_id) {
-       default:
-               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-               break;
-       }
-}
-
-static void
-dmap_image_share_dispose (GObject * object)
-{
-       /* FIXME: implement in parent */
-}
-
-/* FIXME: trancode_mimetype currently not used for DPAP, only DAAP. 
- *        Threrfore, it is not passed to g_object_new.
- */
-DmapImageShare *
-dmap_image_share_new (const char *name,
-                      const char *password,
-                      gpointer db,
-                      gpointer container_db,
-                      gchar * transcode_mimetype)
-{
-       g_object_ref (db);
-       g_object_ref (container_db);
-
-       return DMAP_IMAGE_SHARE (g_object_new (DMAP_TYPE_IMAGE_SHARE,
-                                             "name", name,
-                                             "password", password,
-                                             "db", db,
-                                             "container-db", container_db,
-                                              NULL));
-}
-
-void
-dmap_image_share_message_add_standard_headers (DmapShare * share,
-                                        SoupMessage * message)
-{
-       soup_message_headers_append (message->response_headers, "DPAP-Server",
-                                    "libdmapsharing" VERSION);
-}
-
-#define DMAP_VERSION 2.0
-#define DPAP_VERSION 1.1
-#define DPAP_TIMEOUT 1800
-
-guint
-dmap_image_share_get_desired_port (DmapShare * share)
-{
-       return DPAP_PORT;
-}
-
-const char *
-dmap_image_share_get_type_of_service (DmapShare * share)
-{
-       return DPAP_TYPE_OF_SERVICE;
-}
-
-void
-dmap_image_share_server_info (DmapShare * share,
-                       SoupServer * server,
-                       SoupMessage * message,
-                       const char *path,
-                       GHashTable * query, SoupClientContext * context)
-{
-/* MSRV        server info response
- *     MSTT status
- *     MPRO dpap version
- *     PPRO dpap version
- *     MINM name
- *     MSAU authentication method
- *     MSLR login required
- *     MSTM timeout interval
- *     MSAL supports auto logout
- *     MSUP supports update
- *     MSPI supports persistent ids
- *     MSEX supports extensions
- *     MSBR supports browse
- *     MSQY supports query
- *     MSIX supports index
- *     MSRS supports resolve
- *     MSDC databases count
- */
-       gchar *nameprop;
-       GNode *msrv;
-
-       g_debug ("Path is %s.", path);
-
-       g_object_get ((gpointer) share, "name", &nameprop, NULL);
-
-       msrv = dmap_structure_add (NULL, DMAP_CC_MSRV);
-       dmap_structure_add (msrv, DMAP_CC_MSTT, (gint32) DMAP_STATUS_OK);
-       dmap_structure_add (msrv, DMAP_CC_MPRO, (gdouble) DMAP_VERSION);
-       dmap_structure_add (msrv, DMAP_CC_PPRO, (gdouble) DPAP_VERSION);
-       dmap_structure_add (msrv, DMAP_CC_MINM, nameprop);
-       /*dmap_structure_add (msrv, DMAP_CC_MSAU, dmap_share_get_auth_method (share)); */
-       /* authentication method
-        * 0 is nothing
-        * 1 is name & password
-        * 2 is password only
-        */
-       dmap_structure_add (msrv, DMAP_CC_MSLR, 0);
-       dmap_structure_add (msrv, DMAP_CC_MSTM, (gint32) DPAP_TIMEOUT);
-       dmap_structure_add (msrv, DMAP_CC_MSAL, (gchar) 0);
-       /*dmap_structure_add (msrv, DMAP_CC_MSUP, (gchar) 1);
-        *dmap_structure_add (msrv, DMAP_CC_MSPI, (gchar) 0);
-        *dmap_structure_add (msrv, DMAP_CC_MSEX, (gchar) 0);
-        *dmap_structure_add (msrv, DMAP_CC_MSBR, (gchar) 0);
-        *dmap_structure_add (msrv, DMAP_CC_MSQY, (gchar) 0); */
-       dmap_structure_add (msrv, DMAP_CC_MSIX, (gchar) 0);
-       /* dmap_structure_add (msrv, DMAP_CC_MSRS, (gchar) 0); */
-       dmap_structure_add (msrv, DMAP_CC_MSDC, (gint32) 1);
-
-       dmap_share_message_set_from_dmap_structure (share, message, msrv);
-       dmap_structure_destroy (msrv);
-
-       g_free (nameprop);
-}
-
 typedef enum
 {
        ITEM_ID = 0,
@@ -286,7 +85,7 @@ typedef enum
        PHOTO_IMAGECOMMENTS
 } DPAPMetaData;
 
-static struct DmapMetaDataMap meta_data_map[] = {
+static struct DmapMetaDataMap _meta_data_map[] = {
        {"dmap.itemid", ITEM_ID},
        {"dmap.itemname", ITEM_NAME},
        {"dmap.itemkind", ITEM_KIND},
@@ -310,12 +109,61 @@ static struct DmapMetaDataMap meta_data_map[] = {
 
 #define DPAP_ITEM_KIND_PHOTO 3 /* This is the constant that dpap-sharp uses. */
 
+/* Mmap'ed full image file. Global so that it may be free'ed in a different
+ * function call that the one that set it up.
+ */
+static GMappedFile *_mapped_file = NULL;
+
+#define DMAP_IMAGE_SHARE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DMAP_TYPE_IMAGE_SHARE, 
DmapImageSharePrivate))
+
+G_DEFINE_TYPE (DmapImageShare, dmap_image_share, DMAP_TYPE_SHARE);
+
+static void
+_set_property (GObject * object,
+               guint prop_id,
+               const GValue * value, GParamSpec * pspec)
+{
+       // DmapImageShare *share = DMAP_IMAGE_SHARE (object);
+
+       switch (prop_id) {
+               /* FIXME: */
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+_get_property (GObject * object,
+               guint prop_id, GValue * value, GParamSpec * pspec)
+{
+       // DmapImageShare *share = DMAP_IMAGE_SHARE (object);
+
+       switch (prop_id) {
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+_dispose (GObject * object)
+{
+       /* FIXME: implement in parent */
+}
+
+static struct DmapMetaDataMap *
+_get_meta_data_map (DmapShare * share)
+{
+       return _meta_data_map;
+}
+
 static GMappedFile *
-file_to_mmap (const char *location)
+_file_to_mmap (const char *location)
 {
        GFile *file;
        GMappedFile *mapped_file = NULL;
-       char *path;
+       char *path = NULL;
        GError *error = NULL;
 
        file = g_file_new_for_uri (location);
@@ -327,7 +175,7 @@ file_to_mmap (const char *location)
        if (path == NULL) {
                g_warning ("Couldn't mmap %s: couldn't get path", path);
                g_object_unref (file);
-               return mapped_file;
+               goto done;
        }
        g_object_unref (file);
 
@@ -336,23 +184,29 @@ file_to_mmap (const char *location)
                g_warning ("Unable to map file %s: %s", path, error->message);
        }
 
+done:
        g_free (path);
+
        return mapped_file;
 }
 
 static void
-add_entry_to_mlcl (guint id, DmapRecord * record, gpointer _mb)
+_add_entry_to_mlcl (guint id, DmapRecord * record, gpointer _mb)
 {
        GNode *mlit;
        struct DmapMlclBits *mb = (struct DmapMlclBits *) _mb;
 
        mlit = dmap_structure_add (mb->mlcl, DMAP_CC_MLIT);
 
-       if (dmap_share_client_requested (mb->bits, ITEM_KIND))
+       if (dmap_share_client_requested (mb->bits, ITEM_KIND)) {
                dmap_structure_add (mlit, DMAP_CC_MIKD,
                                    (gchar) DPAP_ITEM_KIND_PHOTO);
-       if (dmap_share_client_requested (mb->bits, ITEM_ID))
+       }
+
+       if (dmap_share_client_requested (mb->bits, ITEM_ID)) {
                dmap_structure_add (mlit, DMAP_CC_MIID, id);
+       }
+
        if (dmap_share_client_requested (mb->bits, ITEM_NAME)) {
                gchar *filename = NULL;
 
@@ -360,11 +214,15 @@ add_entry_to_mlcl (guint id, DmapRecord * record, gpointer _mb)
                if (filename) {
                        dmap_structure_add (mlit, DMAP_CC_MINM, filename);
                        g_free (filename);
-               } else
+               } else {
                        g_debug ("Filename requested but not available");
+               }
        }
-       if (dmap_share_client_requested (mb->bits, PERSISTENT_ID))
+
+       if (dmap_share_client_requested (mb->bits, PERSISTENT_ID)) {
                dmap_structure_add (mlit, DMAP_CC_MPER, id);
+       }
+
        if (TRUE) {
                /* dpap-sharp claims iPhoto '08 will not show thumbnails without PASP
                 * and this does seem to be the case when testing. */
@@ -374,16 +232,19 @@ add_entry_to_mlcl (guint id, DmapRecord * record, gpointer _mb)
                if (aspect_ratio) {
                        dmap_structure_add (mlit, DMAP_CC_PASP, aspect_ratio);
                        g_free (aspect_ratio);
-               } else
+               } else {
                        g_debug
                                ("Aspect ratio requested but not available");
+               }
        }
+
        if (dmap_share_client_requested (mb->bits, PHOTO_CREATIONDATE)) {
                gint creation_date = 0;
 
                g_object_get (record, "creation-date", &creation_date, NULL);
                dmap_structure_add (mlit, DMAP_CC_PICD, creation_date);
        }
+
        if (dmap_share_client_requested (mb->bits, PHOTO_IMAGEFILENAME)) {
                gchar *filename = NULL;
 
@@ -391,9 +252,11 @@ add_entry_to_mlcl (guint id, DmapRecord * record, gpointer _mb)
                if (filename) {
                        dmap_structure_add (mlit, DMAP_CC_PIMF, filename);
                        g_free (filename);
-               } else
+               } else {
                        g_debug ("Filename requested but not available");
+               }
        }
+
        if (dmap_share_client_requested (mb->bits, PHOTO_IMAGEFORMAT)) {
                gchar *format = NULL;
 
@@ -401,9 +264,11 @@ add_entry_to_mlcl (guint id, DmapRecord * record, gpointer _mb)
                if (format) {
                        dmap_structure_add (mlit, DMAP_CC_PFMT, format);
                        g_free (format);
-               } else
+               } else {
                        g_debug ("Format requested but not available");
+               }
        }
+
        if (dmap_share_client_requested (mb->bits, PHOTO_IMAGEFILESIZE)) {
                GArray *thumbnail = NULL;
 
@@ -415,6 +280,7 @@ add_entry_to_mlcl (guint id, DmapRecord * record, gpointer _mb)
                        dmap_structure_add (mlit, DMAP_CC_PIFS, 0);
                }
        }
+
        if (dmap_share_client_requested (mb->bits, PHOTO_IMAGELARGEFILESIZE)) {
                gint large_filesize = 0;
 
@@ -422,24 +288,28 @@ add_entry_to_mlcl (guint id, DmapRecord * record, gpointer _mb)
                              NULL);
                dmap_structure_add (mlit, DMAP_CC_PLSZ, large_filesize);
        }
+
        if (dmap_share_client_requested (mb->bits, PHOTO_IMAGEPIXELHEIGHT)) {
                gint pixel_height = 0;
 
                g_object_get (record, "pixel-height", &pixel_height, NULL);
                dmap_structure_add (mlit, DMAP_CC_PHGT, pixel_height);
        }
+
        if (dmap_share_client_requested (mb->bits, PHOTO_IMAGEPIXELWIDTH)) {
                gint pixel_width = 0;
 
                g_object_get (record, "pixel-width", &pixel_width, NULL);
                dmap_structure_add (mlit, DMAP_CC_PWTH, pixel_width);
        }
+
        if (dmap_share_client_requested (mb->bits, PHOTO_IMAGERATING)) {
                gint rating = 0;
 
                g_object_get (record, "rating", &rating, NULL);
                dmap_structure_add (mlit, DMAP_CC_PRAT, rating);
        }
+
        if (dmap_share_client_requested (mb->bits, PHOTO_IMAGECOMMENTS)) {
                gchar *comments = NULL;
 
@@ -447,9 +317,11 @@ add_entry_to_mlcl (guint id, DmapRecord * record, gpointer _mb)
                if (comments) {
                        dmap_structure_add (mlit, DMAP_CC_PCMT, comments);
                        g_free (comments);
-               } else
+               } else {
                        g_debug ("Comments requested but not available");
+               }
        }
+
        if (dmap_share_client_requested (mb->bits, PHOTO_FILEDATA)) {
                size_t size = 0;
                char *data = NULL;
@@ -469,22 +341,21 @@ add_entry_to_mlcl (guint id, DmapRecord * record, gpointer _mb)
                        char *location = NULL;
 
                        g_object_get (record, "location", &location, NULL);
-                       if (mapped_file) {
+                       if (_mapped_file) {
                                /* Free any previously mapped image */
-                               g_mapped_file_unref (mapped_file);
-                               mapped_file = NULL;
+                               g_mapped_file_unref (_mapped_file);
+                               _mapped_file = NULL;
                        }
 
-                       mapped_file = file_to_mmap (location);
-                       if (mapped_file == NULL) {
+                       _mapped_file = _file_to_mmap (location);
+                       if (_mapped_file == NULL) {
                                g_warning ("Error opening %s", location);
                                data = NULL;
                                size = 0;
                        } else {
                                data = (char *)
-                                       g_mapped_file_get_contents
-                                       (mapped_file);
-                               size = g_mapped_file_get_length (mapped_file);
+                                       g_mapped_file_get_contents (_mapped_file);
+                               size = g_mapped_file_get_length (_mapped_file);
                        }
                        g_free (location);
                }
@@ -493,7 +364,7 @@ add_entry_to_mlcl (guint id, DmapRecord * record, gpointer _mb)
 }
 
 static void
-databases_browse_xxx (DmapShare * share,
+_databases_browse_xxx (DmapShare * share,
                      SoupServer * server,
                      SoupMessage * msg,
                      const char *path,
@@ -503,8 +374,8 @@ databases_browse_xxx (DmapShare * share,
 }
 
 static void
-send_chunked_file (SoupServer * server, SoupMessage * message,
-                  DmapImageRecord * record, guint64 filesize)
+_send_chunked_file (SoupServer * server, SoupMessage * message,
+                    DmapImageRecord * record, guint64 filesize)
 {
        GInputStream *stream;
        char *location = NULL;
@@ -558,11 +429,11 @@ done:
 }
 
 static void
-databases_items_xxx (DmapShare * share,
-                    SoupServer * server,
-                    SoupMessage * msg,
-                    const char *path,
-                    GHashTable * query, SoupClientContext * context)
+_databases_items_xxx (DmapShare * share,
+                      SoupServer * server,
+                      SoupMessage * msg,
+                      const char *path,
+                      GHashTable * query, SoupClientContext * context)
 {
        DmapDb *db;
        const gchar *rest_of_path;
@@ -583,13 +454,143 @@ databases_items_xxx (DmapShare * share,
                (share, msg);
        soup_message_set_status (msg, SOUP_STATUS_OK);
 
-       send_chunked_file (server, msg, record, filesize);
+       _send_chunked_file (server, msg, record, filesize);
 
        g_object_unref (record);
 }
 
-static struct DmapMetaDataMap *
-get_meta_data_map (DmapShare * share)
+static void
+dmap_image_share_class_init (DmapImageShareClass * klass)
 {
-       return meta_data_map;
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       DmapShareClass *parent_class = DMAP_SHARE_CLASS (object_class);
+
+       object_class->get_property = _get_property;
+       object_class->set_property = _set_property;
+       object_class->dispose = _dispose;
+
+       parent_class->get_desired_port = dmap_image_share_get_desired_port;
+       parent_class->get_type_of_service = dmap_image_share_get_type_of_service;
+       parent_class->message_add_standard_headers =
+               dmap_image_share_message_add_standard_headers;
+       parent_class->get_meta_data_map = _get_meta_data_map;
+       parent_class->add_entry_to_mlcl = _add_entry_to_mlcl;
+       parent_class->databases_browse_xxx = _databases_browse_xxx;
+       parent_class->databases_items_xxx = _databases_items_xxx;
+       parent_class->server_info = dmap_image_share_server_info;
+
+       g_type_class_add_private (klass, sizeof (DmapImageSharePrivate));
+}
+
+static void
+dmap_image_share_init (DmapImageShare * share)
+{
+       share->priv = DMAP_IMAGE_SHARE_GET_PRIVATE (share);
+       /* FIXME: do I need to manually call parent _init? */
+}
+
+/* FIXME: trancode_mimetype currently not used for DPAP, only DAAP. 
+ *        Threrfore, it is not passed to g_object_new.
+ */
+DmapImageShare *
+dmap_image_share_new (const char *name,
+                      const char *password,
+                      gpointer db,
+                      gpointer container_db,
+                      gchar * transcode_mimetype)
+{
+       g_object_ref (db);
+       g_object_ref (container_db);
+
+       return DMAP_IMAGE_SHARE (g_object_new (DMAP_TYPE_IMAGE_SHARE,
+                                             "name", name,
+                                             "password", password,
+                                             "db", db,
+                                             "container-db", container_db,
+                                              NULL));
+}
+
+void
+dmap_image_share_message_add_standard_headers (DmapShare * share,
+                                        SoupMessage * message)
+{
+       soup_message_headers_append (message->response_headers, "DPAP-Server",
+                                    "libdmapsharing" VERSION);
+}
+
+#define DMAP_VERSION 2.0
+#define DPAP_VERSION 1.1
+#define DPAP_TIMEOUT 1800
+
+guint
+dmap_image_share_get_desired_port (DmapShare * share)
+{
+       return DPAP_PORT;
+}
+
+const char *
+dmap_image_share_get_type_of_service (DmapShare * share)
+{
+       return DPAP_TYPE_OF_SERVICE;
+}
+
+void
+dmap_image_share_server_info (DmapShare * share,
+                       SoupServer * server,
+                       SoupMessage * message,
+                       const char *path,
+                       GHashTable * query, SoupClientContext * context)
+{
+/* MSRV        server info response
+ *     MSTT status
+ *     MPRO dpap version
+ *     PPRO dpap version
+ *     MINM name
+ *     MSAU authentication method
+ *     MSLR login required
+ *     MSTM timeout interval
+ *     MSAL supports auto logout
+ *     MSUP supports update
+ *     MSPI supports persistent ids
+ *     MSEX supports extensions
+ *     MSBR supports browse
+ *     MSQY supports query
+ *     MSIX supports index
+ *     MSRS supports resolve
+ *     MSDC databases count
+ */
+       gchar *nameprop;
+       GNode *msrv;
+
+       g_debug ("Path is %s.", path);
+
+       g_object_get ((gpointer) share, "name", &nameprop, NULL);
+
+       msrv = dmap_structure_add (NULL, DMAP_CC_MSRV);
+       dmap_structure_add (msrv, DMAP_CC_MSTT, (gint32) DMAP_STATUS_OK);
+       dmap_structure_add (msrv, DMAP_CC_MPRO, (gdouble) DMAP_VERSION);
+       dmap_structure_add (msrv, DMAP_CC_PPRO, (gdouble) DPAP_VERSION);
+       dmap_structure_add (msrv, DMAP_CC_MINM, nameprop);
+       /*dmap_structure_add (msrv, DMAP_CC_MSAU, dmap_share_get_auth_method (share)); */
+       /* authentication method
+        * 0 is nothing
+        * 1 is name & password
+        * 2 is password only
+        */
+       dmap_structure_add (msrv, DMAP_CC_MSLR, 0);
+       dmap_structure_add (msrv, DMAP_CC_MSTM, (gint32) DPAP_TIMEOUT);
+       dmap_structure_add (msrv, DMAP_CC_MSAL, (gchar) 0);
+       /*dmap_structure_add (msrv, DMAP_CC_MSUP, (gchar) 1);
+        *dmap_structure_add (msrv, DMAP_CC_MSPI, (gchar) 0);
+        *dmap_structure_add (msrv, DMAP_CC_MSEX, (gchar) 0);
+        *dmap_structure_add (msrv, DMAP_CC_MSBR, (gchar) 0);
+        *dmap_structure_add (msrv, DMAP_CC_MSQY, (gchar) 0); */
+       dmap_structure_add (msrv, DMAP_CC_MSIX, (gchar) 0);
+       /* dmap_structure_add (msrv, DMAP_CC_MSRS, (gchar) 0); */
+       dmap_structure_add (msrv, DMAP_CC_MSDC, (gint32) 1);
+
+       dmap_share_message_set_from_dmap_structure (share, message, msrv);
+       dmap_structure_destroy (msrv);
+
+       g_free (nameprop);
 }
diff --git a/libdmapsharing/test-dmap-container-db.c b/libdmapsharing/test-dmap-container-db.c
index c351953..280ca5f 100644
--- a/libdmapsharing/test-dmap-container-db.c
+++ b/libdmapsharing/test-dmap-container-db.c
@@ -24,13 +24,13 @@
  * record.  Normally, one would befine some data structure to contain
  * multiple records.
  */
-static DmapContainerRecord *record = NULL;
+static DmapContainerRecord *_record = NULL;
 
 static DmapContainerRecord *
 test_dmap_container_db_lookup_by_id (DmapContainerDb *db, guint id)
 {
        /* In reality, lookup the proper record and return it. */
-       return g_object_ref (record);
+       return g_object_ref (_record);
 }
 
 static void
@@ -39,7 +39,7 @@ test_dmap_container_db_foreach (DmapContainerDb *db,
                                gpointer data)
 {
        /* In reality, pull each record from the db and execute func on it. */
-        func (1, record, data);
+        func (1, _record, data);
 }
 
 static gint64
@@ -82,7 +82,7 @@ test_dmap_container_db_new (DmapContainerRecord *r)
 
        db = TEST_DMAP_CONTAINER_DB (g_object_new (TYPE_TEST_DMAP_CONTAINER_DB, NULL));
 
-       record = r;
+       _record = r;
 
        return db;
 }
diff --git a/libdmapsharing/test-dmap-container-record.c b/libdmapsharing/test-dmap-container-record.c
index 9425c7d..b24d045 100644
--- a/libdmapsharing/test-dmap-container-record.c
+++ b/libdmapsharing/test-dmap-container-record.c
@@ -25,7 +25,7 @@ enum {
        PROP_NAME
 };
 
-static DmapDb *entries = NULL;
+static DmapDb *_entries = NULL;
 
 static void
 test_dmap_container_record_set_property (GObject *object,
@@ -82,13 +82,13 @@ test_dmap_container_record_get_entry_count (DmapContainerRecord *record)
 DmapDb *
 test_dmap_container_record_get_entries (DmapContainerRecord *record)
 {
-       return g_object_ref (entries);
+       return g_object_ref (_entries);
 }
 
 static void
 test_dmap_container_record_init (TestDmapContainerRecord *record)
 {
-       entries = DMAP_DB (test_dmap_db_new ());
+       _entries = DMAP_DB (test_dmap_db_new ());
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]