gobjectification: 021931b4: PurpleGHash should inherit from PurpleHa...

qulogic at pidgin.im qulogic at pidgin.im
Sun Jul 11 04:05:42 EDT 2010


----------------------------------------------------------------------
Revision: 021931b42eee6266afb03649729dbe68922cb642
Parent:   0b949ca1cae25b8d4c6c651d9b11045fcce090fb
Author:   qulogic at pidgin.im
Date:     07/11/10 03:18:59
Branch:   im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/021931b42eee6266afb03649729dbe68922cb642

Changelog: 

PurpleGHash should inherit from PurpleHash, not PurpleCipher.

Changes against parent 0b949ca1cae25b8d4c6c651d9b11045fcce090fb

  patched  libpurple/cipher/ghash.c
  patched  libpurple/cipher/ghash.h

-------------- next part --------------
============================================================
--- libpurple/cipher/ghash.c	f790d218d3662c9c6c763325a00930611697e744
+++ libpurple/cipher/ghash.c	1c7e2a83edccb83f49731272dac8a4462d8aa4c0
@@ -53,9 +53,9 @@ static void
  * Helpers
  *****************************************************************************/
 static void
-purple_g_hash_set_checksum_type(PurpleGHash *cipher, GChecksumType type)
+purple_g_hash_set_checksum_type(PurpleGHash *hash, GChecksumType type)
 {
-	PurpleGHashPrivate *priv = PURPLE_G_HASH_GET_PRIVATE(cipher);
+	PurpleGHashPrivate *priv = PURPLE_G_HASH_GET_PRIVATE(hash);
 
 	priv->type = type;
 	if (priv->checksum)
@@ -67,9 +67,9 @@ static void
  * Object Stuff
  *****************************************************************************/
 static void
-purple_g_hash_reset(PurpleCipher *cipher)
+purple_g_hash_reset(PurpleHash *hash)
 {
-	PurpleGHashPrivate *priv = PURPLE_G_HASH_GET_PRIVATE(cipher);
+	PurpleGHashPrivate *priv = PURPLE_G_HASH_GET_PRIVATE(hash);
 
 	if(priv->checksum) {
 #if GLIB_CHECK_VERSION(2,18,0)
@@ -82,9 +82,9 @@ static void
 }
 
 static void
-purple_g_hash_append(PurpleCipher *cipher, const guchar *data, size_t len)
+purple_g_hash_append(PurpleHash *hash, const guchar *data, size_t len)
 {
-	PurpleGHashPrivate *priv = PURPLE_G_HASH_GET_PRIVATE(cipher);
+	PurpleGHashPrivate *priv = PURPLE_G_HASH_GET_PRIVATE(hash);
 
 	while (len >= G_MAXSSIZE) {
 		g_checksum_update(priv->checksum, data, G_MAXSSIZE);
@@ -97,10 +97,10 @@ static gboolean
 }
 
 static gboolean
-purple_g_hash_digest(PurpleCipher *cipher, size_t in_len,
+purple_g_hash_digest(PurpleHash *hash, size_t in_len,
 						guchar digest[16], size_t *out_len)
 {
-	PurpleGHashPrivate *priv = PURPLE_G_HASH_GET_PRIVATE(cipher);
+	PurpleGHashPrivate *priv = PURPLE_G_HASH_GET_PRIVATE(hash);
 
 	const gssize required_length = g_checksum_type_get_length(priv->type);
 
@@ -109,7 +109,7 @@ purple_g_hash_digest(PurpleCipher *ciphe
 
 	g_checksum_get_digest(priv->checksum, digest, &in_len);
 
-	purple_cipher_reset(cipher);
+	purple_hash_reset(hash);
 
 	if (out_len)
 		*out_len = in_len;
@@ -124,11 +124,11 @@ purple_g_hash_set_property(GObject *obj,
 purple_g_hash_set_property(GObject *obj, guint param_id,
                             const GValue *value, GParamSpec *pspec)
 {
-	PurpleGHash *cipher = PURPLE_G_HASH(obj);
+	PurpleGHash *hash = PURPLE_G_HASH(obj);
 
 	switch(param_id) {
 		case PROP_GCHECKSUM_TYPE:
-			purple_g_hash_set_checksum_type(cipher, g_value_get_int(value));
+			purple_g_hash_set_checksum_type(hash, g_value_get_int(value));
 			break;
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
@@ -165,7 +165,7 @@ purple_g_hash_class_init(PurpleGHashClas
 purple_g_hash_class_init(PurpleGHashClass *klass)
 {
 	GObjectClass *obj_class = G_OBJECT_CLASS(klass);
-	PurpleCipherClass *cipher_class = PURPLE_CIPHER_CLASS(klass);
+	PurpleHashClass *hash_class = PURPLE_HASH_CLASS(klass);
 	GParamSpec *pspec = NULL;
 
 	parent_class = g_type_class_peek_parent(klass);
@@ -176,18 +176,18 @@ purple_g_hash_class_init(PurpleGHashClas
 	obj_class->get_property = purple_g_hash_get_property;
 	obj_class->finalize = purple_g_hash_finalize;
 
-	cipher_class->reset = purple_g_hash_reset;
-	cipher_class->append = purple_g_hash_append;
-	cipher_class->digest = purple_g_hash_digest;
+	hash_class->reset = purple_g_hash_reset;
+	hash_class->append = purple_g_hash_append;
+	hash_class->digest = purple_g_hash_digest;
 
 	pspec = g_param_spec_int("checksum_type", "Checksum Type",
-			"The GChecksumType for this cipher",
+			"The GChecksumType for this hash",
 			0, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
 	g_object_class_install_property(obj_class, PROP_GCHECKSUM_TYPE, pspec);
 }
 
 /******************************************************************************
- * PurpleCipher API
+ * PurpleHash API
  *****************************************************************************/
 GType
 purple_g_hash_get_type(void) {
@@ -207,7 +207,7 @@ purple_g_hash_get_type(void) {
 			NULL
 		};
 
-		type = g_type_register_static(PURPLE_TYPE_CIPHER,
+		type = g_type_register_static(PURPLE_TYPE_HASH,
 									  "PurpleGHash",
 									  &info, G_TYPE_FLAG_ABSTRACT);
 	}
@@ -216,13 +216,13 @@ GChecksumType
 }
 
 GChecksumType
-purple_g_hash_get_checksum_type(PurpleGHash *cipher)
+purple_g_hash_get_checksum_type(PurpleGHash *hash)
 {
 	PurpleGHashPrivate *priv = NULL;
 
-	g_return_val_if_fail(PURPLE_IS_G_HASH(cipher), -1);
+	g_return_val_if_fail(PURPLE_IS_G_HASH(hash), -1);
 
-	priv = PURPLE_G_HASH_GET_PRIVATE(cipher);
+	priv = PURPLE_G_HASH_GET_PRIVATE(hash);
 
 	return priv->type;
 }
============================================================
--- libpurple/cipher/ghash.h	136e94a7aa4d3bf337164553202aef693f1364b1
+++ libpurple/cipher/ghash.h	76b9cc19a8cfdea5b293417846370b82c58c1973
@@ -26,7 +26,7 @@
 #ifndef PURPLE_GHASH_H
 #define PURPLE_GHASH_H
 
-#include <cipher/cipher.h>
+#include <cipher/hash.h>
 #include <glib.h>
 #if GLIB_CHECK_VERSION(2,16,0)
 
@@ -43,7 +43,7 @@ struct _PurpleGHash {
 typedef struct _PurpleGHashClass		PurpleGHashClass;
 
 struct _PurpleGHash {
-	PurpleCipher parent;
+	PurpleHash parent;
 
 	void (*_purple_reserved1)(void);
 	void (*_purple_reserved2)(void);
@@ -52,7 +52,7 @@ struct _PurpleGHashClass {
 };
 
 struct _PurpleGHashClass {
-	PurpleCipherClass parent;
+	PurpleHashClass parent;
 
 	void (*_purple_reserved1)(void);
 	void (*_purple_reserved2)(void);
@@ -68,7 +68,7 @@ GType purple_g_hash_get_type(void);
  * Gets the type of a hash
  *
  * @param hash  The hash
- * @returns The type of the cipher
+ * @returns The type of the hash
  */
 GChecksumType purple_g_hash_get_checksum_type(PurpleGHash *hash);
 


More information about the Commits mailing list