rhythmbox r5838 - in trunk: . lib plugins/audioscrobbler
- From: jmatthew svn gnome org
- To: svn-commits-list gnome org
- Subject: rhythmbox r5838 - in trunk: . lib plugins/audioscrobbler
- Date: Tue, 5 Aug 2008 11:45:22 +0000 (UTC)
Author: jmatthew
Date: Tue Aug 5 11:45:22 2008
New Revision: 5838
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=5838&view=rev
Log:
2008-08-05 Jonathan Matthew <jonathan d14n org>
patch by: Johannes H. Jensen <joh pseudoberries com>
* lib/Makefile.am:
* lib/md5.c:
* lib/md5.h:
* plugins/audioscrobbler/rb-audioscrobbler.c: (mkmd5):
* plugins/audioscrobbler/rb-lastfm-source.c: (mkmd5):
Use GChecksum to calculate MD5 hashes. Remove the MD5 code we were
shipping. Fixes #524827.
Removed:
trunk/lib/md5.c
trunk/lib/md5.h
Modified:
trunk/ChangeLog
trunk/lib/Makefile.am
trunk/plugins/audioscrobbler/rb-audioscrobbler.c
trunk/plugins/audioscrobbler/rb-lastfm-source.c
Modified: trunk/lib/Makefile.am
==============================================================================
--- trunk/lib/Makefile.am (original)
+++ trunk/lib/Makefile.am Tue Aug 5 11:45:22 2008
@@ -27,8 +27,6 @@
rb-tree-dnd.c \
rb-tree-dnd.h \
rb-preferences.h \
- md5.c \
- md5.h \
rb-proxy-config.c \
rb-proxy-config.h \
rb-string-value-map.c \
Modified: trunk/plugins/audioscrobbler/rb-audioscrobbler.c
==============================================================================
--- trunk/plugins/audioscrobbler/rb-audioscrobbler.c (original)
+++ trunk/plugins/audioscrobbler/rb-audioscrobbler.c Tue Aug 5 11:45:22 2008
@@ -56,7 +56,6 @@
#include "rb-shell.h"
#include "rb-shell-player.h"
#include "rb-source.h"
-#include "md5.h"
#include "rb-proxy-config.h"
#include "rb-cut-and-paste-code.h"
#include "rb-plugin.h"
@@ -644,26 +643,16 @@
static gchar *
mkmd5 (char *string)
{
- md5_state_t md5state;
- guchar md5pword[16];
- gchar md5_response[33];
-
- int j = 0;
-
- memset (md5_response, 0, sizeof (md5_response));
-
- md5_init (&md5state);
- md5_append (&md5state, (unsigned char*)string, strlen (string));
- md5_finish (&md5state, md5pword);
-
- for (j = 0; j < 16; j++) {
- char a[3];
- sprintf (a, "%02x", md5pword[j]);
- md5_response[2*j] = a[0];
- md5_response[2*j+1] = a[1];
- }
-
- return (g_strdup (md5_response));
+ GChecksum *checksum;
+ gchar *md5_result;
+
+ checksum = g_checksum_new(G_CHECKSUM_MD5);
+ g_checksum_update(checksum, (guchar *)string, -1);
+
+ md5_result = g_strdup(g_checksum_get_string(checksum));
+ g_checksum_free(checksum);
+
+ return (md5_result);
}
static void
Modified: trunk/plugins/audioscrobbler/rb-lastfm-source.c
==============================================================================
--- trunk/plugins/audioscrobbler/rb-lastfm-source.c (original)
+++ trunk/plugins/audioscrobbler/rb-lastfm-source.c Tue Aug 5 11:45:22 2008
@@ -57,8 +57,6 @@
#include <libsoup/soup.h>
-#include "md5.h"
-
#include "eel-gconf-extensions.h"
#include "rb-proxy-config.h"
@@ -1399,29 +1397,20 @@
static gchar *
mkmd5 (char *string, char *string2)
{
- md5_state_t md5state;
- guchar md5pword[16];
- gchar md5_response[33];
-
- int j = 0;
-
- memset (md5_response, 0, sizeof (md5_response));
-
- md5_init (&md5state);
- md5_append (&md5state, (unsigned char*)string, strlen (string));
+ GChecksum *checksum;
+ gchar *md5_result;
+
+ checksum = g_checksum_new(G_CHECKSUM_MD5);
+ g_checksum_update(checksum, (guchar *)string, -1);
+
if (string2 != NULL) {
- md5_append (&md5state, (unsigned char*)string2, strlen (string2));
+ g_checksum_update(checksum, (guchar *)string2, -1);
}
- md5_finish (&md5state, md5pword);
-
- for (j = 0; j < 16; j++) {
- char a[3];
- sprintf (a, "%02x", md5pword[j]);
- md5_response[2*j] = a[0];
- md5_response[2*j+1] = a[1];
- }
-
- return (g_strdup (md5_response));
+
+ md5_result = g_strdup(g_checksum_get_string(checksum));
+ g_checksum_free(checksum);
+
+ return (md5_result);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]