gobjectification: 9083d5eb: renamed PurpleGCipher to PurpleGHash

grim at pidgin.im grim at pidgin.im
Sun Jul 19 16:05:34 EDT 2009


-----------------------------------------------------------------
Revision: 9083d5ebc2aa6c8dade1b7f301bb7ccb2c5688fd
Ancestor: ebdc92f265d516131a14ffe8143cb05057241abe
Author: grim at pidgin.im
Date: 2009-07-19T20:00:51
Branch: im.pidgin.gobjectification
URL: http://d.pidgin.im/viewmtn/revision/info/9083d5ebc2aa6c8dade1b7f301bb7ccb2c5688fd

Renamed entries:
        libpurple/gcipher.c to libpurple/ghash.c
        libpurple/gcipher.h to libpurple/ghash.h
Modified files:
        libpurple/Makefile.am libpurple/ghash.c libpurple/ghash.h
        libpurple/md5cipher.c libpurple/md5cipher.h
        libpurple/sha1cipher.c libpurple/sha1cipher.h
        libpurple/sha256cipher.c libpurple/sha256cipher.h

ChangeLog: 

renamed PurpleGCipher to PurpleGHash
fixed everyting involved in that and then some


-------------- next part --------------
============================================================
--- libpurple/Makefile.am	09fa8b5e0ba27717f98dc58a08a813906e688f67
+++ libpurple/Makefile.am	27224eeb995a50d60c283c9119e968510a9ef802
@@ -57,7 +57,7 @@ purple_coresources = \
 	desktopitem.c \
 	eventloop.c \
 	ft.c \
-	gcipher.c \
+	ghash.c \
 	group.c \
 	gsignal.c \
 	hmaccipher.c \
@@ -133,7 +133,7 @@ purple_coreheaders = \
 	eventloop.h \
 	ft.h \
 	gaim-compat.h \
-	gcipher.h \
+	ghash.h \
 	gsignal.h \
 	hmaccipher.h \
 	idle.h \
============================================================
--- libpurple/gcipher.c	61b8db6219fc9ba0aa6eafa63b6e12fa6e36128d
+++ libpurple/ghash.c	2230f25d20eeb78c25316d3857a9c62a6bcc45ad
@@ -22,10 +22,10 @@
 #include "internal.h"
 
 #if GLIB_CHECK_VERSION(2,16,0)
-#include "gcipher.h"
+#include "ghash.h"
 
-#define PURPLE_GCIPHER_GET_PRIVATE(obj) \
-	(G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_GCIPHER, PurpleGCipherPrivate))
+#define PURPLE_G_HASH_GET_PRIVATE(obj) \
+	(G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_G_HASH, PurpleGHashPrivate))
 
 /*******************************************************************************
  * Structs
@@ -33,7 +33,7 @@ typedef struct {
 typedef struct {
 	GChecksum *checksum;
 	GChecksumType type;
-} PurpleGCipherPrivate;
+} PurpleGHashPrivate;
 
 /******************************************************************************
  * Enums
@@ -53,9 +53,9 @@ static void
  * Helpers
  *****************************************************************************/
 static void
-purple_gcipher_set_checksum_type(PurpleGCipher *cipher, GChecksumType type)
+purple_g_hash_set_checksum_type(PurpleGHash *cipher, GChecksumType type)
 {
-	PurpleGCipherPrivate *priv = PURPLE_GCIPHER_GET_PRIVATE(cipher);
+	PurpleGHashPrivate *priv = PURPLE_G_HASH_GET_PRIVATE(cipher);
 
 	priv->type = type;
 }
@@ -64,9 +64,9 @@ static void
  * Object Stuff
  *****************************************************************************/
 static void
-purple_gcipher_reset(PurpleCipher *cipher)
+purple_g_hash_reset(PurpleCipher *cipher)
 {
-	PurpleGCipherPrivate *priv = PURPLE_GCIPHER_GET_PRIVATE(cipher);
+	PurpleGHashPrivate *priv = PURPLE_G_HASH_GET_PRIVATE(cipher);
 
 	if(priv->checksum) {
 #if GLIB_CHECK_VERSION(2,18,0)
@@ -79,9 +79,9 @@ static void
 }
 
 static void
-purple_gcipher_append(PurpleCipher *cipher, const guchar *data, size_t len)
+purple_g_hash_append(PurpleCipher *cipher, const guchar *data, size_t len)
 {
-	PurpleGCipherPrivate *priv = PURPLE_GCIPHER_GET_PRIVATE(cipher);
+	PurpleGHashPrivate *priv = PURPLE_G_HASH_GET_PRIVATE(cipher);
 
 	while (len >= G_MAXSSIZE) {
 		g_checksum_update(priv->checksum, data, G_MAXSSIZE);
@@ -94,10 +94,10 @@ static gboolean
 }
 
 static gboolean
-purple_gcipher_digest(PurpleCipher *cipher, size_t in_len,
+purple_g_hash_digest(PurpleCipher *cipher, size_t in_len,
 						guchar digest[16], size_t *out_len)
 {
-	PurpleGCipherPrivate *priv = PURPLE_GCIPHER_GET_PRIVATE(cipher);
+	PurpleGHashPrivate *priv = PURPLE_G_HASH_GET_PRIVATE(cipher);
 
 	const gssize required_length = g_checksum_type_get_length(priv->type);
 
@@ -118,14 +118,14 @@ static void
  * Object Stuff
  *****************************************************************************/
 static void
-purple_gcipher_set_property(GObject *obj, guint param_id,
+purple_g_hash_set_property(GObject *obj, guint param_id,
                             const GValue *value, GParamSpec *pspec)
 {
-	PurpleGCipher *cipher = PURPLE_GCIPHER(obj);
+	PurpleGHash *cipher = PURPLE_G_HASH(obj);
 
 	switch(param_id) {
 		case PROP_GCHECKSUM_TYPE:
-			purple_gcipher_set_checksum_type(cipher, g_value_get_int(value));
+			purple_g_hash_set_checksum_type(cipher, g_value_get_int(value));
 			break;
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
@@ -134,14 +134,14 @@ static void
 }
 
 static void
-purple_gcipher_get_property(GObject *obj, guint param_id, GValue *value,
+purple_g_hash_get_property(GObject *obj, guint param_id, GValue *value,
                             GParamSpec *pspec)
 {
-	PurpleGCipher *gcipher = PURPLE_GCIPHER(obj);
+	PurpleGHash *g_hash = PURPLE_G_HASH(obj);
 
 	switch(param_id) {
 		case PROP_GCHECKSUM_TYPE:
-			g_value_set_int(value, purple_gcipher_get_checksum_type(gcipher));
+			g_value_set_int(value, purple_g_hash_get_checksum_type(g_hash));
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
 			break;
@@ -149,8 +149,8 @@ static void
 }
 
 static void
-purple_gcipher_finalize(GObject *obj) {
-	PurpleGCipherPrivate *priv = PURPLE_GCIPHER_GET_PRIVATE(obj);
+purple_g_hash_finalize(GObject *obj) {
+	PurpleGHashPrivate *priv = PURPLE_G_HASH_GET_PRIVATE(obj);
 
 	g_checksum_reset(priv->checksum);
 	g_checksum_free(priv->checksum);
@@ -160,7 +160,7 @@ static void
 }
 
 static void
-purple_gcipher_class_init(PurpleGCipherClass *klass)
+purple_g_hash_class_init(PurpleGHashClass *klass)
 {
 	GObjectClass *obj_class = G_OBJECT_CLASS(klass);
 	PurpleCipherClass *cipher_class = PURPLE_CIPHER_CLASS(klass);
@@ -168,15 +168,15 @@ purple_gcipher_class_init(PurpleGCipherC
 
 	parent_class = g_type_class_peek_parent(klass);
 
-	g_type_class_add_private(klass, sizeof(PurpleGCipherPrivate));
+	g_type_class_add_private(klass, sizeof(PurpleGHashPrivate));
 
-	obj_class->set_property = purple_gcipher_set_property;
-	obj_class->get_property = purple_gcipher_get_property;
-	obj_class->finalize = purple_gcipher_finalize;
+	obj_class->set_property = purple_g_hash_set_property;
+	obj_class->get_property = purple_g_hash_get_property;
+	obj_class->finalize = purple_g_hash_finalize;
 
-	cipher_class->reset = purple_gcipher_reset;
-	cipher_class->append = purple_gcipher_append;
-	cipher_class->digest = purple_gcipher_digest;
+	cipher_class->reset = purple_g_hash_reset;
+	cipher_class->append = purple_g_hash_append;
+	cipher_class->digest = purple_g_hash_digest;
 
 	pspec = g_param_spec_int("checksum_type", "Checksum Type",
 			"The GChecksumType for this cipher",
@@ -188,25 +188,25 @@ GType
  * PurpleCipher API
  *****************************************************************************/
 GType
-purple_gcipher_get_gtype(void) {
+purple_g_hash_get_type(void) {
 	static GType type = 0;
 
 	if(type == 0) {
 		static const GTypeInfo info = {
-			sizeof(PurpleGCipherClass),
+			sizeof(PurpleGHashClass),
 			NULL,
 			NULL,
-			(GClassInitFunc)purple_gcipher_class_init,
+			(GClassInitFunc)purple_g_hash_class_init,
 			NULL,
 			NULL,
-			sizeof(PurpleGCipher),
+			sizeof(PurpleGHash),
 			0,
 			NULL,
 			NULL
 		};
 
 		type = g_type_register_static(G_TYPE_OBJECT,
-									  "PurpleGCipher",
+									  "PurpleGHash",
 									  &info, G_TYPE_FLAG_ABSTRACT);
 	}
 
@@ -214,13 +214,13 @@ GChecksumType
 }
 
 GChecksumType
-purple_gcipher_get_checksum_type(PurpleGCipher *cipher)
+purple_g_hash_get_checksum_type(PurpleGHash *cipher)
 {
-	PurpleGCipherPrivate *priv = NULL;
+	PurpleGHashPrivate *priv = NULL;
 
-	g_return_val_if_fail(PURPLE_IS_GCIPHER(cipher), -1);
+	g_return_val_if_fail(PURPLE_IS_G_HASH(cipher), -1);
 
-	priv = PURPLE_GCIPHER_GET_PRIVATE(cipher);
+	priv = PURPLE_G_HASH_GET_PRIVATE(cipher);
 
 	return priv->type;
 }
============================================================
--- libpurple/gcipher.h	e916b59bb623983bfb6b06112f9a5fab507ef066
+++ libpurple/ghash.h	7a263a93df0223f3e0f31842a68e30eca088ad11
@@ -1,5 +1,5 @@
 /**
- * @file gcipher.h Purple Cipher API
+ * @file ghash.h Purple GHash API
  * @ingroup core
  */
 
@@ -23,30 +23,27 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  */
-#ifndef PURPLE_GCIPHER_H
-#define PURPLE_GCIPHER_H
+#ifndef PURPLE_GHASH_H
+#define PURPLE_GHASH_H
 
 #include <cipher.h>
 #include <glib.h>
 #if GLIB_CHECK_VERSION(2,16,0)
 
-/*******************************************************************************
- * New Cipher Header
- ******************************************************************************/
 #include <glib-object.h>
 
-#define PURPLE_TYPE_GCIPHER				(purple_gcipher_get_gtype())
-#define PURPLE_GCIPHER(obj)				(G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_GCIPHER, PurpleGCipher))
-#define PURPLE_GCIPHER_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_GCIPHER, PurpleGCipherClass))
-#define PURPLE_IS_GCIPHER(obj)			(G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_GCIPHER))
-#define PURPLE_IS_GCIPHER_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_GCIPHER))
-#define PURPLE_GCIPHER_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_GCIPHER, PurpleGCipherClass))
+#define PURPLE_TYPE_G_HASH				(purple_g_hash_get_type())
+#define PURPLE_G_HASH(obj)				(G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_G_HASH, PurpleGHash))
+#define PURPLE_G_HASH_CLASS(klass)		(G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_G_HASH, PurpleGHashClass))
+#define PURPLE_IS_G_HASH(obj)			(G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_G_HASH))
+#define PURPLE_IS_G_HASH_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_G_HASH))
+#define PURPLE_G_HASH_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_G_HASH, PurpleGHashClass))
 
-typedef struct _PurpleGCipher		PurpleGCipher;
-typedef struct _PurpleGCipherClass	PurpleGCipherClass;
+typedef struct _PurpleGHash				PurpleGHash;
+typedef struct _PurpleGHashClass		PurpleGHashClass;
 
-struct _PurpleGCipher {
-	GObject gparent;
+struct _PurpleGHash {
+	PurpleCipher parent;
 
 	void (*_purple_reserved1)(void);
 	void (*_purple_reserved2)(void);
@@ -54,8 +51,8 @@ struct _PurpleGCipher {
 	void (*_purple_reserved4)(void);
 };
 
-struct _PurpleGCipherClass {
-	GObjectClass gparent;
+struct _PurpleGHashClass {
+	PurpleCipherClass parent;
 
 	void (*_purple_reserved1)(void);
 	void (*_purple_reserved2)(void);
@@ -65,17 +62,17 @@ G_BEGIN_DECLS
 
 G_BEGIN_DECLS
 
-GType purple_gcipher_get_gtype(void);
+GType purple_g_hash_get_type(void);
 
 /**
- * Gets the type of a cipher
+ * Gets the type of a hash
  *
- * @param cipher  The cipher
+ * @param hash  The hash
  * @returns The type of the cipher
  */
-GChecksumType purple_gcipher_get_checksum_type(PurpleGCipher *cipher);
+GChecksumType purple_g_hash_get_checksum_type(PurpleGHash *hash);
 
 G_END_DECLS
 
 #endif /* GLIB_CHECK_VERSION */
-#endif /* PURPLE_GCIPHER_H */
+#endif /* PURPLE_G_HASH_H */
============================================================
--- libpurple/md5cipher.c	2fdd62595b5749051a0b78d7a92cc084f20f32ce
+++ libpurple/md5cipher.c	cf8dd3e4e61e04ce1bc723dd10db38a83b447c2c
@@ -3,7 +3,6 @@
  * Copyright (C) 2001-2003  Christophe Devine <c.devine at cr0.net>
  */
 #include "md5cipher.h"
-#include "gcipher.h"
 
 #include <string.h>
 
@@ -330,11 +329,14 @@ purple_md5_cipher_get_gtype(void) {
 			NULL,
 		};
 
+		GType parent = G_TYPE_INVALID;
 #if GLIB_CHECK_VERSION(2,16,0)
-		type = g_type_register_static(PURPLE_TYPE_GCIPHER,
+		parent = PURPLE_TYPE_G_HASH;
 #else
-		type = g_type_register_static(PURPLE_TYPE_CIPHER,
+		parent = PURPLE_TYPE_CIPHER;
 #endif
+
+		type = g_type_register_static(parent,
 									  "PurpleMD5Cipher",
 									  &info, 0);
 	}
============================================================
--- libpurple/md5cipher.h	c804bce2c575d4ca81eae36939a66363882bbbcd
+++ libpurple/md5cipher.h	fbd4cfe5c0422197789fb6bcf56920d34f830730
@@ -26,6 +26,7 @@
 #define PURPLE_MD5_CIPHER_H
 
 #include <cipher.h>
+#include <ghash.h>
 
 #define PURPLE_TYPE_MD5_CIPHER				(purple_md5_cipher_get_gtype())
 #define PURPLE_MD5_CIPHER(obj)				(G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_MD5_CIPHER, PurpleMD5Cipher))
@@ -39,7 +40,11 @@ struct _PurpleMD5Cipher {
 typedef struct _PurpleMD5CipherClass		PurpleMD5CipherClass;
 
 struct _PurpleMD5Cipher {
-	PurpleCipher gparent;
+#if GLIB_CHECK_VERSION(2,16,0)
+	PurpleGHash parent;
+#else
+	PurpleCipher parent;
+#endif
 
 	PurpleMD5CipherPriv *priv;
 
@@ -50,7 +55,11 @@ struct _PurpleMD5CipherClass {
 };
 
 struct _PurpleMD5CipherClass {
-	PurpleCipherClass gparent;
+#if GLIB_CHECK_VERSION(2,16,0)
+	PurpleGHash parent;
+#else
+	PurpleCipherClass parent;
+#endif
 
 	void (*_purple_reserved1)(void);
 	void (*_purple_reserved2)(void);
============================================================
--- libpurple/sha1cipher.c	27b247ee9373ec2a2644e4b5f3403950ac4c5514
+++ libpurple/sha1cipher.c	19e45a9eaae0178a23e35ff3e642bc44e9683390
@@ -1,7 +1,6 @@
 /*
  */
 #include "sha1cipher.h"
-#include "gcipher.h"
 
 #include <string.h>
 
@@ -251,7 +250,7 @@ purple_sha1_cipher_get_gtype(void) {
 purple_sha1_cipher_get_gtype(void) {
 	static GType type = 0;
 
-	if(type == 0) {
+	if(G_UNLIKELY(type == 0)) {
 		static const GTypeInfo info = {
 			sizeof(PurpleSHA1CipherClass),
 			NULL,
@@ -265,11 +264,15 @@ purple_sha1_cipher_get_gtype(void) {
 			NULL,
 		};
 
+		GType parent = G_TYPE_INVALID;
+
 #if GLIB_CHECK_VERSION(2,16,0)
-		type = g_type_register_static(PURPLE_TYPE_GCIPHER,
+		parent = PURPLE_TYPE_G_HASH;
 #else
-		type = g_type_register_static(PURPLE_TYPE_CIPHER,
+		parent = PURPLE_TYPE_CIPHER;
 #endif
+
+		type = g_type_register_static(parent,
 									  "PurpleSHA1Cipher",
 									  &info, 0);
 	}
============================================================
--- libpurple/sha1cipher.h	9a7de695e33970a405f497e8f2792b1ab60b640c
+++ libpurple/sha1cipher.h	74a761b00fedb2e88b1111a2e868b54c4b57cfef
@@ -26,6 +26,7 @@
 #define PURPLE_SHA1_CIPHER_H
 
 #include <cipher.h>
+#include <ghash.h>
 
 #define PURPLE_TYPE_SHA1_CIPHER				(purple_sha1_cipher_get_gtype())
 #define PURPLE_SHA1_CIPHER(obj)				(G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_SHA1_CIPHER, PurpleSHA1Cipher))
@@ -39,7 +40,11 @@ struct _PurpleSHA1Cipher {
 typedef struct _PurpleSHA1CipherClass		PurpleSHA1CipherClass;
 
 struct _PurpleSHA1Cipher {
-	PurpleCipher gparent;
+#if GLIB_CHECK_VERSION(2,16,0)
+	PurpleGHash parent;
+#else
+	PurpleCipher parent;
+#endif
 
 	PurpleSHA1CipherPriv *priv;
 
@@ -50,7 +55,11 @@ struct _PurpleSHA1CipherClass {
 };
 
 struct _PurpleSHA1CipherClass {
-	PurpleCipherClass gparent;
+#if GLIB_CHECK_VERSION(2,16,0)
+	PurpleGHashClass parent;
+#else
+	PurpleCipherClass parent;
+#endif
 
 	void (*_purple_reserved1)(void);
 	void (*_purple_reserved2)(void);
============================================================
--- libpurple/sha256cipher.c	df2b19cad5ada8071473c094e383b11b8a47a555
+++ libpurple/sha256cipher.c	bb490f2ee92fcbf994da72376a79d667d89ede82
@@ -1,7 +1,6 @@
 /*
  */
 #include "sha256cipher.h"
-#include "gcipher.h"
 
 #include <string.h>
 
@@ -276,11 +275,15 @@ purple_sha256_cipher_get_gtype(void) {
 			NULL,
 		};
 
+		GType parent = G_TYPE_INVALID;
+
 #if GLIB_CHECK_VERSION(2,16,0)
-		type = g_type_register_static(PURPLE_TYPE_GCIPHER,
+		parent = PURPLE_TYPE_G_HASH;
 #else
-		type = g_type_register_static(PURPLE_TYPE_CIPHER,
+		parent = PURPLE_TYPE_CIPHER;
 #endif
+
+		type = g_type_register_static(parent,
 									  "PurpleSHA256Cipher",
 									  &info, 0);
 	}
============================================================
--- libpurple/sha256cipher.h	4de05b5e483a16f125fa68ac1dcc42cdd0e2ec83
+++ libpurple/sha256cipher.h	0999dbf6ba6da2ccf6bb18f2622c0d0b7f65349d
@@ -26,6 +26,7 @@
 #define PURPLE_SHA256_CIPHER_H
 
 #include <cipher.h>
+#include <ghash.h>
 
 #define PURPLE_TYPE_SHA256_CIPHER				(purple_sha256_cipher_get_gtype())
 #define PURPLE_SHA256_CIPHER(obj)				(G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_SHA256_CIPHER, PurpleSHA256Cipher))
@@ -39,7 +40,11 @@ struct _PurpleSHA256Cipher {
 typedef struct _PurpleSHA256CipherClass		PurpleSHA256CipherClass;
 
 struct _PurpleSHA256Cipher {
-	PurpleCipher gparent;
+#if GLIB_CHECK_VERSION(2,16,0)
+	PurpleGHash parent;
+#else
+	PurpleCipher parent;
+#endif
 
 	PurpleSHA256CipherPriv *priv;
 
@@ -50,7 +55,11 @@ struct _PurpleSHA256CipherClass {
 };
 
 struct _PurpleSHA256CipherClass {
-	PurpleCipherClass gparent;
+#if GLIB_CHECK_VERSION(2,16,0)
+	PurpleGHash parent;
+#else
+	PurpleCipherClass parent;
+#endif
 
 	void (*_purple_reserved1)(void);
 	void (*_purple_reserved2)(void);


More information about the Commits mailing list