pidgin: 9000557e: Hide PurpleValue.

masca at cpw.pidgin.im masca at cpw.pidgin.im
Thu Aug 25 00:47:36 EDT 2011


----------------------------------------------------------------------
Revision: 9000557e8a6b7649547a10cfc0fe85dbb8ce661d
Parent:   f26c0f6a0d8e621d458d0c851a149c6cad2415ab
Author:   masca at cpw.pidgin.im
Date:     08/25/11 00:15:16
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/9000557e8a6b7649547a10cfc0fe85dbb8ce661d

Changelog: 

Hide PurpleValue.

Changes against parent f26c0f6a0d8e621d458d0c851a149c6cad2415ab

  patched  libpurple/status.c
  patched  libpurple/value.c
  patched  libpurple/value.h

-------------- next part --------------
============================================================
--- libpurple/status.c	6fef128edcbdfb94c015322f552eb258654a742f
+++ libpurple/status.c	c5bb519f5b5570622fe85b2ed7dc8197dcc0314f
@@ -763,29 +763,29 @@ purple_status_set_active_with_attrs_list
 
 		specified_attr_ids = g_list_prepend(specified_attr_ids, (gpointer)id);
 
-		if (value->type == PURPLE_TYPE_STRING)
+		if (purple_value_get_type(value) == PURPLE_TYPE_STRING)
 		{
 			const gchar *string_data = l->data;
 			l = l->next;
-			if (purple_strequal(string_data, value->data.string_data))
+			if (purple_strequal(string_data, purple_value_get_string(value)))
 				continue;
 			purple_status_set_attr_string(status, id, string_data);
 			changed = TRUE;
 		}
-		else if (value->type == PURPLE_TYPE_INT)
+		else if (purple_value_get_type(value) == PURPLE_TYPE_INT)
 		{
 			int int_data = GPOINTER_TO_INT(l->data);
 			l = l->next;
-			if (int_data == value->data.int_data)
+			if (int_data == purple_value_get_int(value))
 				continue;
 			purple_status_set_attr_int(status, id, int_data);
 			changed = TRUE;
 		}
-		else if (value->type == PURPLE_TYPE_BOOLEAN)
+		else if (purple_value_get_type(value) == PURPLE_TYPE_BOOLEAN)
 		{
 			gboolean boolean_data = GPOINTER_TO_INT(l->data);
 			l = l->next;
-			if (boolean_data == value->data.boolean_data)
+			if (boolean_data == purple_value_get_boolean(value))
 				continue;
 			purple_status_set_attr_boolean(status, id, boolean_data);
 			changed = TRUE;
@@ -809,7 +809,7 @@ purple_status_set_active_with_attrs_list
 		if (!g_list_find_custom(specified_attr_ids, attr->id, (GCompareFunc)strcmp)) {
 			PurpleValue *default_value;
 			default_value = purple_status_attr_get_value(attr);
-			if (default_value->type == PURPLE_TYPE_STRING) {
+			if (purple_value_get_type(default_value) == PURPLE_TYPE_STRING) {
 				const char *cur = purple_status_get_attr_string(status, attr->id);
 				const char *def = purple_value_get_string(default_value);
 				if ((cur == NULL && def == NULL)
@@ -819,14 +819,14 @@ purple_status_set_active_with_attrs_list
 				}
 
 				purple_status_set_attr_string(status, attr->id, def);
-			} else if (default_value->type == PURPLE_TYPE_INT) {
+			} else if (purple_value_get_type(default_value) == PURPLE_TYPE_INT) {
 				int cur = purple_status_get_attr_int(status, attr->id);
 				int def = purple_value_get_int(default_value);
 				if (cur == def)
 					continue;
 
 				purple_status_set_attr_int(status, attr->id, def);
-			} else if (default_value->type == PURPLE_TYPE_BOOLEAN) {
+			} else if (purple_value_get_type(default_value) == PURPLE_TYPE_BOOLEAN) {
 				gboolean cur = purple_status_get_attr_boolean(status, attr->id);
 				gboolean def = purple_value_get_boolean(default_value);
 				if (cur == def)
============================================================
--- libpurple/value.c	a0f522996e62f2fa8bc92ce830a0cd5326d4bb93
+++ libpurple/value.c	e1aad509cfbe35e49b0b21d03d674989c5780d20
@@ -29,6 +29,44 @@
 
 #define OUTGOING_FLAG 0x01
 
+/**
+ * A wrapper for a type, subtype, and specific type of value.
+ */
+struct _PurpleValue
+{
+	PurpleType type;
+	unsigned short flags;
+
+	union
+	{
+		char char_data;
+		unsigned char uchar_data;
+		gboolean boolean_data;
+		short short_data;
+		unsigned short ushort_data;
+		int int_data;
+		unsigned int uint_data;
+		long long_data;
+		unsigned long ulong_data;
+		gint64 int64_data;
+		guint64 uint64_data;
+		char *string_data;
+		void *object_data;
+		void *pointer_data;
+		int enum_data;
+		void *boxed_data;
+
+	} data;
+
+	union
+	{
+		unsigned int subtype;
+		char *specific_type;
+
+	} u;
+
+};
+
 PurpleValue *
 purple_value_new(PurpleType type, ...)
 {
============================================================
--- libpurple/value.h	2e4ee485ddf46affd4170adf8e560b17024fdbba
+++ libpurple/value.h	ca533ddfea5937c410bf315a1fa288b7eeaf089a
@@ -86,41 +86,8 @@ typedef enum
 /**
  * A wrapper for a type, subtype, and specific type of value.
  */
-typedef struct
-{
-	PurpleType type;
-	unsigned short flags;
+typedef struct _PurpleValue PurpleValue;
 
-	union
-	{
-		char char_data;
-		unsigned char uchar_data;
-		gboolean boolean_data;
-		short short_data;
-		unsigned short ushort_data;
-		int int_data;
-		unsigned int uint_data;
-		long long_data;
-		unsigned long ulong_data;
-		gint64 int64_data;
-		guint64 uint64_data;
-		char *string_data;
-		void *object_data;
-		void *pointer_data;
-		int enum_data;
-		void *boxed_data;
-
-	} data;
-
-	union
-	{
-		unsigned int subtype;
-		char *specific_type;
-
-	} u;
-
-} PurpleValue;
-
 #ifdef __cplusplus
 extern "C" {
 #endif


More information about the Commits mailing list