[libdmapsharing] fix some compiler warnings



commit cea4b17cde4f8f8d567d2d4ac88db83d95dc9b3e
Author: W. Michael Petullo <mike flyn org>
Date:   Sat Apr 19 20:16:48 2014 -0400

    fix some compiler warnings
    
    Signed-off-by: W. Michael Petullo <mike flyn org>

 libdmapsharing/dacp-share.c            |    4 ++--
 libdmapsharing/dmap-gst-input-stream.c |    2 +-
 libdmapsharing/dmap-md5.c              |   22 ++++++++++++----------
 libdmapsharing/dmap-private-utils.c    |    2 +-
 tests/test-dmap-server.c               |    4 +++-
 5 files changed, 19 insertions(+), 15 deletions(-)
---
diff --git a/libdmapsharing/dacp-share.c b/libdmapsharing/dacp-share.c
index daed469..906babb 100644
--- a/libdmapsharing/dacp-share.c
+++ b/libdmapsharing/dacp-share.c
@@ -861,7 +861,7 @@ dacp_share_ctrl_int (DMAPShare * share,
                   == 0) {
                guint width = 320;
                guint height = 320;
-               gchar *artwork_filename;
+               guchar *artwork_filename;
                gchar *buffer;
                gsize buffer_len;
 
@@ -881,7 +881,7 @@ dacp_share_ctrl_int (DMAPShare * share,
                }
 #ifdef HAVE_GDKPIXBUF
                GdkPixbuf *artwork =
-                       gdk_pixbuf_new_from_file_at_scale (artwork_filename,
+                       gdk_pixbuf_new_from_file_at_scale ((char *) artwork_filename,
                                                           width, height,
                                                           TRUE, NULL);
 
diff --git a/libdmapsharing/dmap-gst-input-stream.c b/libdmapsharing/dmap-gst-input-stream.c
index d01e964..18dd9d2 100644
--- a/libdmapsharing/dmap-gst-input-stream.c
+++ b/libdmapsharing/dmap-gst-input-stream.c
@@ -307,7 +307,7 @@ dmap_gst_input_stream_read (GInputStream * stream,
        DMAPGstInputStream *gst_stream = DMAP_GST_INPUT_STREAM (stream);
        gint64 end_time;
 
-       end_time = end_time = g_get_monotonic_time () + QUEUE_POP_WAIT_SECONDS * G_TIME_SPAN_SECOND;
+       end_time = g_get_monotonic_time () + QUEUE_POP_WAIT_SECONDS * G_TIME_SPAN_SECOND;
 
        g_mutex_lock (&gst_stream->priv->buffer_mutex);
 
diff --git a/libdmapsharing/dmap-md5.c b/libdmapsharing/dmap-md5.c
index c646d6c..92dd5ba 100644
--- a/libdmapsharing/dmap-md5.c
+++ b/libdmapsharing/dmap-md5.c
@@ -142,6 +142,7 @@ DMAP_MD5Final (DMAPHashContext * ctx, unsigned char digest[16])
 {
        unsigned count;
        unsigned char *p;
+       guint32 *tmp;
 
        /* Compute number of bytes mod 64 */
        count = (ctx->bits[0] >> 3) & 0x3F;
@@ -170,8 +171,9 @@ DMAP_MD5Final (DMAPHashContext * ctx, unsigned char digest[16])
        byteReverse (ctx->in, 14);
 
        /* Append length in bits and transform */
-       ((guint32 *) ctx->in)[14] = ctx->bits[0];
-       ((guint32 *) ctx->in)[15] = ctx->bits[1];
+       tmp = (guint32 *) ctx->in;
+       tmp[14] = ctx->bits[0];
+       tmp[15] = ctx->bits[1];
 
        MD5Transform (ctx->buf, (guint32 *) ctx->in, ctx->version);
        byteReverse ((unsigned char *) ctx->buf, 4);
@@ -525,19 +527,19 @@ void dmap_hash_progressive_final (DMAPHashContext *context,
 #ifdef HAVE_CHECK
 START_TEST(test_dmap_hash_generate_v3_h2)
 {
-       char hash[33] = { 0 };
-       char *url = "test://foo";
+       guchar hash[33] = { 0 };
+       guchar *url = (guchar *) "test://foo";
        dmap_hash_generate (3, url, 2, hash, 0);
-       fail_unless (! strcmp (hash, "798A9D80B6F08E339603BE83E0FEAD03"));
+       fail_unless (! memcmp (hash, "798A9D80B6F08E339603BE83E0FEAD03", strlen 
("798A9D80B6F08E339603BE83E0FEAD03")));
 }
 END_TEST
 
 START_TEST(test_dmap_hash_progressive)
 {
-       char buf[16] = { 0 };
-       char hash1[33] = { 0 };
-       char hash2[33] = { 0 };
-       char *value = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+       guchar buf[16] = { 0 };
+       guchar hash1[33] = { 0 };
+       guchar hash2[33] = { 0 };
+       guchar *value = (guchar *) "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        DMAPHashContext context;
 
        dmap_hash_progressive_init   (&context);
@@ -552,7 +554,7 @@ START_TEST(test_dmap_hash_progressive)
 
        dmap_hash_generate (3, value, 2, hash2, 0);
 
-       fail_unless (! strcmp (hash1, hash2)); 
+       fail_unless (! memcmp (hash1, hash2, 32));
 }
 END_TEST
 
diff --git a/libdmapsharing/dmap-private-utils.c b/libdmapsharing/dmap-private-utils.c
index eef065b..30144a4 100644
--- a/libdmapsharing/dmap-private-utils.c
+++ b/libdmapsharing/dmap-private-utils.c
@@ -38,7 +38,7 @@ dmap_write_next_chunk (SoupMessage * message, ChunkData * cd)
        if (read_size > 0) {
                soup_message_body_append (message->response_body,
                                          SOUP_MEMORY_TAKE, chunk, read_size);
-               g_debug ("Read/wrote %d bytes.", read_size);
+               g_debug ("Read/wrote %ld bytes.", read_size);
        } else {
                if (error != NULL) {
                        g_warning ("Error reading from input stream: %s",
diff --git a/tests/test-dmap-server.c b/tests/test-dmap-server.c
index 7c3f539..b773b3c 100644
--- a/tests/test-dmap-server.c
+++ b/tests/test-dmap-server.c
@@ -63,7 +63,7 @@ create_share (guint conn_type)
                                        (dmap_container_record));
        DMAPRecordFactory *factory;
        DMAPRecord *record;
-       DMAPShare *share;
+       DMAPShare *share = NULL;
        DMAPDb *db;
 
        if (conn_type == DAAP) { 
@@ -94,6 +94,8 @@ create_share (guint conn_type)
                                                    NULL));
        }
 
+       g_assert (NULL != share);
+
        g_free (name);
 }
 


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