Re: [Rhythmbox-devel] music sharing patch #3



On Tue, 2005-08-23 at 11:52 -0400, Colin Walters wrote:
> On Tue, 2005-08-23 at 00:22 -0400, Charles Schmidt wrote:
> > Issues/Known Bugs:
> > * Signed errors when compiling.  According to walters (i think), gcc 4.0
> > added the signed checking thing.  I havn't found time to find packages
> > for 4.0 for my system yet, or I'd try to fix this myself.  Until then, I
> > suggest writing me a patch or turning off the extra warning checking.
> 
> I think James had a patch.

I've attached a patch which lets it compile with a gcc that complains
about signedness - and unlike my last attempt this one just inserts
casts, so shouldn't break anything.

Cheers,

James "Doc" Livingston 
-- 
Died. Woke up in Hell. Punched in PIN, logged on. Just another day." 
    -- David Gerard
diff -u rhythmbox-cvs/daapsharing/rb-daap-connection.c rhythmbox-daap/daapsharing/rb-daap-connection.c
--- rhythmbox-cvs/daapsharing/rb-daap-connection.c	2005-08-24 01:10:35.000000000 +1000
+++ rhythmbox-daap/daapsharing/rb-daap-connection.c	2005-08-24 01:27:13.000000000 +1000
@@ -319,8 +319,8 @@
 
 
 static int staticHashDone = 0;
-static char staticHash_42[256*65] = {0};
-static char staticHash_45[256*65] = {0};
+static unsigned char staticHash_42[256*65] = {0};
+static unsigned char staticHash_45[256*65] = {0};
 
 static const char hexchars[] = "0123456789ABCDEF";
 static const char appleCopyright[] = "Copyright 2003 Apple Computer, Inc.";
@@ -344,13 +344,13 @@
     MD5_CTX ctx;
     unsigned char *p = staticHash_42;
     int i;
-    char buf[16];
+    unsigned char buf[16];
 
     for (i = 0; i < 256; i++)
     {
         OpenDaap_MD5Init (&ctx, 0);
 
-#define MD5_STRUPDATE(str) OpenDaap_MD5Update(&ctx, str, strlen(str))
+#define MD5_STRUPDATE(str) OpenDaap_MD5Update(&ctx, (unsigned char const *)str, strlen(str))
 
         if ((i & 0x80) != 0)
             MD5_STRUPDATE("Accept-Language");
@@ -394,7 +394,7 @@
 #undef MD5_STRUPDATE
 
         OpenDaap_MD5Final (&ctx, buf);
-        DigestToString (buf, p);
+        DigestToString (buf, (char *)p);
         p += 65;
     }
 }
@@ -404,13 +404,13 @@
     MD5_CTX ctx;
     unsigned char *p = staticHash_45;
     int i;
-    char buf[16];
+    unsigned char buf[16];
 
     for (i = 0; i < 256; i++)
     {
         OpenDaap_MD5Init (&ctx, 1);
 
-#define MD5_STRUPDATE(str) OpenDaap_MD5Update(&ctx, str, strlen(str))
+#define MD5_STRUPDATE(str) OpenDaap_MD5Update(&ctx, (unsigned char const *)str, strlen(str))
 
         if ((i & 0x40) != 0)
             MD5_STRUPDATE("eqwsdxcqwesdc");
@@ -455,7 +455,7 @@
 #undef MD5_STRUPDATE
 
         OpenDaap_MD5Final (&ctx, buf);
-        DigestToString (buf, p);
+        DigestToString (buf, (char *)p);
         p += 65;
     }
 }
@@ -467,10 +467,10 @@
 		       guchar *out, 
 		       gint request_id)
 {
-    char buf[16];
+    unsigned char buf[16];
     MD5_CTX ctx;
 
-    char *hashTable = (version_major == 3) ?
+    unsigned char *hashTable = (version_major == 3) ?
                       staticHash_45 : staticHash_42;
 
     if (!staticHashDone)
@@ -482,8 +482,8 @@
 
     OpenDaap_MD5Init (&ctx, (version_major == 3) ? 1 : 0);
 
-    OpenDaap_MD5Update (&ctx, url, strlen (url));
-    OpenDaap_MD5Update (&ctx, appleCopyright, strlen (appleCopyright));
+    OpenDaap_MD5Update (&ctx, url, strlen ((const gchar*)url));
+    OpenDaap_MD5Update (&ctx, (const guchar*)appleCopyright, strlen (appleCopyright));
 
     OpenDaap_MD5Update (&ctx, &hashTable[hash_select * 65], 32);
 
@@ -491,11 +491,11 @@
     {
         char scribble[20];
         sprintf (scribble, "%u", request_id);
-        OpenDaap_MD5Update (&ctx, scribble, strlen (scribble));
+        OpenDaap_MD5Update (&ctx, (const guchar*)scribble, strlen (scribble));
     }
 
     OpenDaap_MD5Final (&ctx, buf);
-    DigestToString (buf, out);
+    DigestToString (buf, (char *)out);
 
     return;
 }
@@ -560,7 +560,7 @@
 			norb_daap_path = strstr (path, "/data");
 		}
 
-		rb_daap_hash_generate ((short)floor (version), norb_daap_path, 2, hash, req_id);
+		rb_daap_hash_generate ((short)floor (version), (const guchar*)norb_daap_path, 2, (guchar*)hash, req_id);
 
 		soup_message_add_header (message->request_headers, "Client-DAAP-Validation", hash);
 	}
@@ -1177,7 +1177,7 @@
 		norb_daap_uri = strstr (uri,"/data");
 	}
 
-	rb_daap_hash_generate ((short)floorf (connection->daap_version), norb_daap_uri,2, hash, connection->request_id);
+	rb_daap_hash_generate ((short)floorf (connection->daap_version), (const guchar*)norb_daap_uri,2, (guchar*)hash, connection->request_id);
 
 	headers = g_string_new ("Accept: */*\r\nCache-Control: no-cache\r\nUser-Agent: iTunes/4.6 (Windows; N)\r\nClient-DAAP-Access-Index: 2\r\nClient-DAAP-Version: 3.0\r\n");
 	g_string_append_printf (headers,"Client-DAAP-Validation: %s\r\nClient-DAAP-Request-ID: %d\r\nConnection: close\r\n", hash, connection->request_id);
diff -u rhythmbox-cvs/daapsharing/rb-daap-structure.c rhythmbox-daap/daapsharing/rb-daap-structure.c
--- rhythmbox-cvs/daapsharing/rb-daap-structure.c	2005-08-24 01:10:35.000000000 +1000
+++ rhythmbox-daap/daapsharing/rb-daap-structure.c	2005-08-24 01:19:43.000000000 +1000
@@ -253,7 +253,7 @@
 	RBDAAPType rb_daap_type;
 	guint32 size = GINT32_TO_BE (item->size);
 
-	g_byte_array_append (array, rb_daap_content_code_string (item->content_code), 4);
+	g_byte_array_append (array, (const guint8 *)rb_daap_content_code_string (item->content_code), 4);
 	g_byte_array_append (array, (const guint8 *)&size, 4);
 	
 	rb_daap_type = rb_daap_content_code_rb_daap_type (item->content_code);
@@ -263,7 +263,7 @@
 		case RB_DAAP_TYPE_SIGNED_INT: {
 			gchar c = g_value_get_char (&(item->content));
 			
-			g_byte_array_append (array, &c, 1);
+			g_byte_array_append (array, (const guint8 *)&c, 1);
 			
 			break;
 		}
@@ -399,7 +399,7 @@
 			return;
 		}
 		
-		item->content_code = rb_daap_buffer_read_content_code (&(buf[l]));
+		item->content_code = rb_daap_buffer_read_content_code ((const gchar*)&(buf[l]));
 		l += 4;
 
 		codesize = rb_daap_buffer_read_int32(&(buf[l]));
@@ -474,7 +474,7 @@
 				break;
 			}
 			case RB_DAAP_TYPE_STRING: {
-				gchar *s = rb_daap_buffer_read_string (&(buf[l]), codesize);
+				gchar *s = rb_daap_buffer_read_string ((const gchar*)&(buf[l]), codesize);
 
 				g_value_take_string (&(item->content), s);
 #ifdef PARSE_DEBUG

Attachment: signature.asc
Description: This is a digitally signed message part



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