[libsoup/wip/xclaesse/xmlrpc: 4/4] xmlrpc: Deprecate gvalue API



commit 4c5eafd964d93e36c44a0ac43a140a78672dd007
Author: Xavier Claessens <xavier claessens collabora com>
Date:   Mon Jul 27 16:24:34 2015 -0400

    xmlrpc: Deprecate gvalue API
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746495

 libsoup/soup-value-utils.c   |   35 +++++++++++++++++++++++++++++++
 libsoup/soup-value-utils.h   |   16 ++++++++++++++
 libsoup/soup-xmlrpc-gvalue.c |   46 ++++++++++++++---------------------------
 libsoup/soup-xmlrpc-gvalue.h |    9 ++++++++
 libsoup/soup-xmlrpc.c        |    2 +
 5 files changed, 78 insertions(+), 30 deletions(-)
---
diff --git a/libsoup/soup-value-utils.c b/libsoup/soup-value-utils.c
index 5ae0a69..711d71b 100644
--- a/libsoup/soup-value-utils.c
+++ b/libsoup/soup-value-utils.c
@@ -23,6 +23,8 @@
  *
  * They are written for use with soup-xmlrpc, but they also work with
  * types not used by XML-RPC.
+ *
+ * Deprecated: Use #GVariant API instead.
  **/
 
 /**
@@ -34,6 +36,8 @@
  * Copies an argument of type @type from @args into @val. @val will
  * point directly to the value in @args rather than copying it, so you
  * must g_value_copy() it if you want it to remain valid.
+ *
+ * Deprecated: Use #GVariant API instead.
  **/
 
 /**
@@ -45,8 +49,13 @@
  * Extracts a value of type @type from @val into @args. The return
  * value will point to the same data as @val rather than being a copy
  * of it.
+ *
+ * Deprecated: Use #GVariant API instead.
  **/
 
+/* This whole file is deprecated and replaced by GVariant API */
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
 static void
 soup_value_hash_value_free (gpointer val)
 {
@@ -62,6 +71,8 @@ soup_value_hash_value_free (gpointer val)
  *
  * Return value: (element-type utf8 GValue) (transfer full): a new
  * empty #GHashTable
+ *
+ * Deprecated: Use #GVariant API instead.
  **/
 GHashTable *
 soup_value_hash_new (void)
@@ -99,6 +110,7 @@ soup_value_hash_insert_valist (GHashTable *hash, const char *first_key,
  * with soup_value_hash_insert(), the keys and values are copied
  * rather than being inserted directly.
  *
+ * Deprecated: Use #GVariant API instead.
  * Return value: (element-type utf8 GValue) (transfer full): a new
  * #GHashTable, initialized with the given values
  **/
@@ -123,6 +135,8 @@ soup_value_hash_new_with_vals (const char *first_key, ...)
  *
  * Inserts @value into @hash. (Unlike with g_hash_table_insert(), both
  * the key and the value are copied).
+ *
+ * Deprecated: Use #GVariant API instead.
  **/
 void
 soup_value_hash_insert_value (GHashTable *hash, const char *key, GValue *value)
@@ -143,6 +157,8 @@ soup_value_hash_insert_value (GHashTable *hash, const char *key, GValue *value)
  *
  * Inserts the provided value of type @type into @hash. (Unlike with
  * g_hash_table_insert(), both the key and the value are copied).
+ *
+ * Deprecated: Use #GVariant API instead.
  **/
 void
 soup_value_hash_insert (GHashTable *hash, const char *key, GType type, ...)
@@ -166,6 +182,8 @@ soup_value_hash_insert (GHashTable *hash, const char *key, GType type, ...)
  * Inserts the given data into @hash. As with
  * soup_value_hash_insert(), the keys and values are copied rather
  * than being inserted directly.
+ *
+ * Deprecated: Use #GVariant API instead.
  **/
 void
 soup_value_hash_insert_vals (GHashTable *hash, const char *first_key, ...)
@@ -187,6 +205,7 @@ soup_value_hash_insert_vals (GHashTable *hash, const char *first_key, ...)
  * Looks up @key in @hash and stores its value into the provided
  * location.
  *
+ * Deprecated: Use #GVariant API instead.
  * Return value: %TRUE if @hash contained a value with key @key and
  * type @type, %FALSE if not.
  **/
@@ -217,6 +236,7 @@ soup_value_hash_lookup (GHashTable *hash, const char *key, GType type, ...)
  *
  * Looks up a number of keys in @hash and returns their values.
  *
+ * Deprecated: Use #GVariant API instead.
  * Return value: %TRUE if all of the keys were found, %FALSE
  * if any were missing; note that you will generally need to
  * initialize each destination variable to a reasonable default
@@ -266,6 +286,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
  * by %G_TYPE_INVALID. (The array will contain copies of the provided
  * data rather than pointing to the passed-in data directly.)
  *
+ * Deprecated: Use #GVariant API instead.
  * Return value: (nullable): a new #GValueArray, or %NULL if an error
  * occurred.
  **/
@@ -294,6 +315,7 @@ soup_value_array_from_args (va_list args)
  * terminated by %G_TYPE_INVALID. The returned values will point to the
  * same memory as the values in the array.
  *
+ * Deprecated: Use #GVariant API instead.
  * Return value: success or failure
  **/
 gboolean
@@ -321,6 +343,7 @@ soup_value_array_to_args (GValueArray *array, va_list args)
  * Creates a new %GValueArray. (This is just a wrapper around
  * g_value_array_new(), for naming consistency purposes.)
  *
+ * Deprecated: Use #GVariant API instead.
  * Return value: a new %GValueArray
  **/
 GValueArray *
@@ -354,6 +377,7 @@ soup_value_array_append_valist (GValueArray *array,
  * Creates a new %GValueArray and copies the provided values
  * into it.
  *
+ * Deprecated: Use #GVariant API instead.
  * Return value: a new %GValueArray
  **/
 GValueArray *
@@ -379,6 +403,8 @@ soup_value_array_new_with_vals (GType first_type, ...)
  * Inserts the provided value of type @type into @array as with
  * g_value_array_insert(). (The provided data is copied rather than
  * being inserted directly.)
+ *
+ * Deprecated: Use #GVariant API instead.
  **/
 void
 soup_value_array_insert (GValueArray *array, guint index_, GType type, ...)
@@ -401,6 +427,8 @@ soup_value_array_insert (GValueArray *array, guint index_, GType type, ...)
  * Appends the provided value of type @type to @array as with
  * g_value_array_append(). (The provided data is copied rather than
  * being inserted directly.)
+ *
+ * Deprecated: Use #GVariant API instead.
  **/
 void
 soup_value_array_append (GValueArray *array, GType type, ...)
@@ -424,6 +452,8 @@ soup_value_array_append (GValueArray *array, GType type, ...)
  * Appends the provided values into @array as with
  * g_value_array_append(). (The provided data is copied rather than
  * being inserted directly.)
+ *
+ * Deprecated: Use #GVariant API instead.
  **/
 void
 soup_value_array_append_vals (GValueArray *array, GType first_type, ...)
@@ -445,6 +475,7 @@ soup_value_array_append_vals (GValueArray *array, GType first_type, ...)
  * Gets the @index_ element of @array and stores its value into the
  * provided location.
  *
+ * Deprecated: Use #GVariant API instead.
  * Return value: %TRUE if @array contained a value with index @index_
  * and type @type, %FALSE if not.
  **/
@@ -489,6 +520,10 @@ soup_byte_array_free (GByteArray *ba)
  *
  * glib did not used to define a #GType for #GByteArray, so libsoup
  * defines this one itself.
+ *
+ * Deprecated: Use #GVariant API instead.
  **/
 typedef GByteArray SoupByteArray;
 G_DEFINE_BOXED_TYPE (SoupByteArray, soup_byte_array, soup_byte_array_copy, soup_byte_array_free)
+
+G_GNUC_END_IGNORE_DEPRECATIONS
diff --git a/libsoup/soup-value-utils.h b/libsoup/soup-value-utils.h
index 1ff4235..2a50abc 100644
--- a/libsoup/soup-value-utils.h
+++ b/libsoup/soup-value-utils.h
@@ -29,51 +29,67 @@ G_STMT_START {                                                              \
        g_free (getv_error);                                            \
 } G_STMT_END
 
+SOUP_DEPRECATED_IN_2_52
 GHashTable  *soup_value_hash_new            (void);
+SOUP_DEPRECATED_IN_2_52
 GHashTable  *soup_value_hash_new_with_vals  (const char  *first_key,
                                             ...) G_GNUC_NULL_TERMINATED;
+SOUP_DEPRECATED_IN_2_52
 void         soup_value_hash_insert_value   (GHashTable  *hash,
                                             const char  *key,
                                             GValue      *value);
+SOUP_DEPRECATED_IN_2_52
 void         soup_value_hash_insert         (GHashTable  *hash,
                                             const char  *key,
                                             GType        type,
                                             ...);
+SOUP_DEPRECATED_IN_2_52
 void         soup_value_hash_insert_vals    (GHashTable  *hash,
                                             const char  *first_key,
                                             ...) G_GNUC_NULL_TERMINATED;
+SOUP_DEPRECATED_IN_2_52
 gboolean     soup_value_hash_lookup         (GHashTable  *hash,
                                             const char  *key,
                                             GType        type,
                                             ...);
+SOUP_DEPRECATED_IN_2_52
 gboolean     soup_value_hash_lookup_vals    (GHashTable  *hash,
                                             const char  *first_key,
                                             ...) G_GNUC_NULL_TERMINATED;
 
+SOUP_DEPRECATED_IN_2_52
 GValueArray *soup_value_array_from_args     (va_list      args);
+SOUP_DEPRECATED_IN_2_52
 gboolean     soup_value_array_to_args       (GValueArray *array,
                                             va_list      args);
 
+SOUP_DEPRECATED_IN_2_52
 GValueArray *soup_value_array_new           (void);
+SOUP_DEPRECATED_IN_2_52
 GValueArray *soup_value_array_new_with_vals (GType        first_type,
                                             ...) G_GNUC_NULL_TERMINATED;
 
+SOUP_DEPRECATED_IN_2_52
 void         soup_value_array_insert        (GValueArray *array,
                                             guint        index_,
                                             GType        type,
                                             ...);
+SOUP_DEPRECATED_IN_2_52
 void         soup_value_array_append        (GValueArray *array,
                                             GType        type,
                                             ...);
+SOUP_DEPRECATED_IN_2_52
 void         soup_value_array_append_vals   (GValueArray *array,
                                             GType        first_type,
                                             ...) G_GNUC_NULL_TERMINATED;
+SOUP_DEPRECATED_IN_2_52
 gboolean     soup_value_array_get_nth       (GValueArray *array,
                                             guint        index_,
                                             GType        type,
                                             ...);
 
 
+SOUP_DEPRECATED_IN_2_52
 GType        soup_byte_array_get_type       (void);
 #define SOUP_TYPE_BYTE_ARRAY (soup_byte_array_get_type ())
 
diff --git a/libsoup/soup-xmlrpc-gvalue.c b/libsoup/soup-xmlrpc-gvalue.c
index b6fd90c..e81f56b 100644
--- a/libsoup/soup-xmlrpc-gvalue.c
+++ b/libsoup/soup-xmlrpc-gvalue.c
@@ -22,6 +22,9 @@
  *
  **/
 
+/* This whole file is deprecated and replaced by soup-xmlrpc.c */
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
 static xmlNode *find_real_node (xmlNode *node);
 
 static gboolean insert_value (xmlNode *parent, GValue *value);
@@ -96,13 +99,7 @@ insert_value (xmlNode *parent, GValue *value)
 
                if (!struct_node)
                        return FALSE;
-#ifdef G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-#endif
        } else if (type == G_TYPE_VALUE_ARRAY) {
-#ifdef G_GNUC_END_IGNORE_DEPRECATIONS
-G_GNUC_END_IGNORE_DEPRECATIONS
-#endif
                GValueArray *va = g_value_get_boxed (value);
                xmlNode *node;
                int i;
@@ -150,6 +147,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
  * For structs, use a #GHashTable that maps strings to #GValue;
  * soup_value_hash_new() and related methods can help with this.
  *
+ * Deprecated: Use soup_xmlrpc_build_request() instead.
  * Return value: (nullable): the text of the methodCall, or %NULL on
  * error
  **/
@@ -202,13 +200,8 @@ soup_xmlrpc_request_newv (const char *uri, const char *method_name, va_list args
 
        body = soup_xmlrpc_build_method_call (method_name, params->values,
                                              params->n_values);
-#ifdef G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-#endif
        g_value_array_free (params);
-#ifdef G_GNUC_END_IGNORE_DEPRECATIONS
-G_GNUC_END_IGNORE_DEPRECATIONS
-#endif
+
        if (!body)
                return NULL;
 
@@ -231,6 +224,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
  * and then a value of the appropriate type, finally terminated by
  * %G_TYPE_INVALID.
  *
+ * Deprecated: Use soup_xmlrpc_message_new() instead.
  * Return value: (transfer full): a #SoupMessage encoding the
  * indicated XML-RPC request.
  **/
@@ -257,6 +251,7 @@ soup_xmlrpc_request_new (const char *uri, const char *method_name, ...)
  * The glib type to XML-RPC type mapping is as with
  * soup_xmlrpc_build_method_call(), qv.
  *
+ * Deprecated: Use soup_xmlrpc_build_response() instead.
  * Return value: (nullable): the text of the methodResponse, or %NULL
  * on error
  **/
@@ -300,6 +295,8 @@ soup_xmlrpc_build_method_response (GValue *value)
  * Sets the status code and response body of @msg to indicate a
  * successful XML-RPC call, with a return value given by @type and the
  * following varargs argument, of the type indicated by @type.
+ *
+ * Deprecated: Use soup_xmlrpc_message_set_response() instead.
  **/
 void
 soup_xmlrpc_set_response (SoupMessage *msg, GType type, ...)
@@ -426,9 +423,6 @@ parse_value (xmlNode *xmlvalue, GValue *value)
                if (!data || strcmp ((const char *)data->name, "data") != 0)
                        return FALSE;
 
-#ifdef G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-#endif
                array = g_value_array_new (1);
                for (xval = find_real_node (data->children);
                     xval;
@@ -445,9 +439,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
                }
                g_value_init (value, G_TYPE_VALUE_ARRAY);
                g_value_take_boxed (value, array);
-#ifdef G_GNUC_END_IGNORE_DEPRECATIONS
-G_GNUC_END_IGNORE_DEPRECATIONS
-#endif
        } else
                return FALSE;
 
@@ -466,6 +457,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
  * soup_xmlrpc_extract_method_call(), which is more convenient if you
  * know in advance what the types of the parameters will be.
  *
+ * Deprecated: Use soup_xmlrpc_parse_request_full() instead.
  * Return value: success or failure.
  **/
 gboolean
@@ -497,9 +489,6 @@ soup_xmlrpc_parse_method_call (const char *method_call, int length,
                if (strcmp ((const char *)node->name, "params") != 0)
                        goto fail;
 
-#ifdef G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-#endif
                *params = soup_value_array_new ();
                param = find_real_node (node->children);
                while (param && !strcmp ((const char *)param->name, "param")) {
@@ -514,9 +503,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
 
                        param = find_real_node (param->next);
                }
-#ifdef G_GNUC_END_IGNORE_DEPRECATIONS
-G_GNUC_END_IGNORE_DEPRECATIONS
-#endif
        } else
                *params = soup_value_array_new ();
 
@@ -548,6 +534,7 @@ fail:
  * See also soup_xmlrpc_parse_method_call(), which can be used if
  * you don't know the types of the parameters.
  *
+ * Deprecated: Use soup_xmlrpc_parse_request_full() instead.
  * Return value: success or failure.
  **/
 gboolean
@@ -566,13 +553,8 @@ soup_xmlrpc_extract_method_call (const char *method_call, int length,
        success = soup_value_array_to_args (params, args);
        va_end (args);
 
-#ifdef G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-#endif
        g_value_array_free (params);
-#ifdef G_GNUC_END_IGNORE_DEPRECATIONS
-G_GNUC_END_IGNORE_DEPRECATIONS
-#endif
+
        return success;
 }
 
@@ -591,6 +573,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
  * soup_xmlrpc_parse_method_response() will return %FALSE, but @error
  * will be unset.)
  *
+ * Deprecated: Use soup_xmlrpc_parse_response() instead.
  * Return value: %TRUE if a return value was parsed, %FALSE if the
  * response could not be parsed, or contained a fault.
  **/
@@ -677,6 +660,7 @@ fail:
  * at all, soup_xmlrpc_extract_method_response() will return %FALSE,
  * but @error will be unset.)
  *
+ * Deprecated: Use soup_xmlrpc_parse_response() instead.
  * Return value: %TRUE if a return value was parsed, %FALSE if the
  * response was of the wrong type, or contained a fault.
  **/
@@ -708,3 +692,5 @@ find_real_node (xmlNode *node)
                node = node->next;
        return node;
 }
+
+G_GNUC_END_IGNORE_DEPRECATIONS
diff --git a/libsoup/soup-xmlrpc-gvalue.h b/libsoup/soup-xmlrpc-gvalue.h
index 7975f49..34db645 100644
--- a/libsoup/soup-xmlrpc-gvalue.h
+++ b/libsoup/soup-xmlrpc-gvalue.h
@@ -11,16 +11,20 @@
 G_BEGIN_DECLS
 
 /* XML-RPC client */
+SOUP_DEPRECATED_IN_2_52_FOR(soup_xmlrpc_build_request)
 char        *soup_xmlrpc_build_method_call       (const char   *method_name,
                                                  GValue       *params,
                                                  int           n_params);
+SOUP_DEPRECATED_IN_2_52_FOR(soup_xmlrpc_message_new)
 SoupMessage *soup_xmlrpc_request_new             (const char   *uri,
                                                  const char   *method_name,
                                                  ...);
+SOUP_DEPRECATED_IN_2_52_FOR(soup_xmlrpc_parse_response)
 gboolean     soup_xmlrpc_parse_method_response   (const char   *method_response,
                                                  int           length,
                                                  GValue       *value,
                                                  GError      **error);
+SOUP_DEPRECATED_IN_2_52_FOR(soup_xmlrpc_parse_response)
 gboolean     soup_xmlrpc_extract_method_response (const char   *method_response,
                                                  int           length,
                                                  GError      **error,
@@ -28,18 +32,23 @@ gboolean     soup_xmlrpc_extract_method_response (const char   *method_response,
                                                  ...);
 
 /* XML-RPC server */
+SOUP_DEPRECATED_IN_2_52_FOR(soup_xmlrpc_parse_request_full)
 gboolean     soup_xmlrpc_parse_method_call       (const char   *method_call,
                                                  int           length,
                                                  char        **method_name,
                                                  GValueArray **params);
+SOUP_DEPRECATED_IN_2_52_FOR(soup_xmlrpc_parse_request_full)
 gboolean     soup_xmlrpc_extract_method_call     (const char   *method_call,
                                                  int           length,
                                                  char        **method_name,
                                                  ...);
+SOUP_DEPRECATED_IN_2_52_FOR(soup_xmlrpc_build_response)
 char        *soup_xmlrpc_build_method_response   (GValue       *value);
+SOUP_DEPRECATED_IN_2_52_FOR(soup_xmlrpc_message_set_response)
 void         soup_xmlrpc_set_response            (SoupMessage  *msg,
                                                  GType         type,
                                                  ...);
+SOUP_DEPRECATED_IN_2_52_FOR(soup_xmlrpc_message_set_fault)
 void         soup_xmlrpc_set_fault               (SoupMessage  *msg,
                                                  int           fault_code,
                                                  const char   *fault_format,
diff --git a/libsoup/soup-xmlrpc.c b/libsoup/soup-xmlrpc.c
index 2d641e0..c7ce536 100644
--- a/libsoup/soup-xmlrpc.c
+++ b/libsoup/soup-xmlrpc.c
@@ -528,6 +528,8 @@ soup_xmlrpc_message_set_fault (SoupMessage *msg, int fault_code,
  * Sets the status code and response body of @msg to indicate an
  * unsuccessful XML-RPC call, with the error described by @fault_code
  * and @fault_format.
+ *
+ * Deprecated: Use soup_xmlrpc_message_set_fault() instead.
  **/
 void
 soup_xmlrpc_set_fault (SoupMessage *msg, int fault_code,


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