diff options
| author | Xavier Claessens <xavier.claessens@collabora.com> | 2015-08-13 11:30:39 -0400 |
|---|---|---|
| committer | Xavier Claessens <xavier.claessens@collabora.com> | 2015-08-13 11:32:35 -0400 |
| commit | 2215e458139cd9e7f321feb4a631aec8f8778251 (patch) | |
| tree | 0086deb920623f98af07171521c6df466dc9b643 | |
| parent | 2dd764906f7d7403b6c47c3e339177085f540c1b (diff) | |
| download | libsoup-2215e458139cd9e7f321feb4a631aec8f8778251.tar.gz | |
xmlrpc: Deprecate gvalue API
| -rw-r--r-- | docs/reference/Makefile.am | 2 | ||||
| -rw-r--r-- | docs/reference/libsoup-2.4-docs.sgml | 1 | ||||
| -rw-r--r-- | docs/reference/libsoup-2.4-sections.txt | 38 | ||||
| -rw-r--r-- | libsoup/soup-value-utils.c | 51 | ||||
| -rw-r--r-- | libsoup/soup-value-utils.h | 16 | ||||
| -rw-r--r-- | libsoup/soup-xmlrpc-old.c | 55 | ||||
| -rw-r--r-- | libsoup/soup-xmlrpc-old.h | 9 |
7 files changed, 94 insertions, 78 deletions
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am index 311fce85..6011da1d 100644 --- a/docs/reference/Makefile.am +++ b/docs/reference/Makefile.am @@ -46,7 +46,7 @@ IGNORE_HFILES= soup.h soup-enum-types.h \ soup-misc-private.h soup-proxy-uri-resolver.h \ soup-proxy-resolver-wrapper.h soup-proxy-uri-resolver.h \ soup-cache-private.h soup-cache-client-input-stream.h \ - soup-socket-private.h + soup-socket-private.h soup-value-utils.h soup-xmlrpc-old.h # Images to copy into HTML directory. HTML_IMAGES = diff --git a/docs/reference/libsoup-2.4-docs.sgml b/docs/reference/libsoup-2.4-docs.sgml index 7e553ff2..7bd4858e 100644 --- a/docs/reference/libsoup-2.4-docs.sgml +++ b/docs/reference/libsoup-2.4-docs.sgml @@ -62,7 +62,6 @@ <title>Web Services APIs</title> <xi:include href="xml/soup-form.xml"/> <xi:include href="xml/soup-xmlrpc.xml"/> - <xi:include href="xml/soup-value-utils.xml"/> <xi:include href="xml/soup-websocket.xml"/> </chapter> diff --git a/docs/reference/libsoup-2.4-sections.txt b/docs/reference/libsoup-2.4-sections.txt index 490c36c3..5185d0a3 100644 --- a/docs/reference/libsoup-2.4-sections.txt +++ b/docs/reference/libsoup-2.4-sections.txt @@ -849,50 +849,12 @@ soup_xmlrpc_build_response soup_xmlrpc_build_fault soup_xmlrpc_message_set_response soup_xmlrpc_message_set_fault -<SUBSECTION> -soup_xmlrpc_build_method_call -soup_xmlrpc_request_new -soup_xmlrpc_parse_method_response -soup_xmlrpc_extract_method_response -soup_xmlrpc_parse_method_call -soup_xmlrpc_extract_method_call -soup_xmlrpc_build_method_response -soup_xmlrpc_set_response -soup_xmlrpc_set_fault <SUBSECTION Private> soup_xmlrpc_error_quark soup_xmlrpc_fault_quark </SECTION> <SECTION> -<FILE>soup-value-utils</FILE> -<TITLE>GValue Support</TITLE> -soup_value_hash_new -soup_value_hash_new_with_vals -soup_value_hash_insert_value -soup_value_hash_insert -soup_value_hash_insert_vals -soup_value_hash_lookup -soup_value_hash_lookup_vals -<SUBSECTION> -soup_value_array_from_args -soup_value_array_to_args -soup_value_array_new -soup_value_array_new_with_vals -soup_value_array_insert -soup_value_array_append -soup_value_array_append_vals -soup_value_array_get_nth -<SUBSECTION> -SOUP_VALUE_SETV -SOUP_VALUE_GETV -<SUBSECTION> -SOUP_TYPE_BYTE_ARRAY -<SUBSECTION Private> -soup_byte_array_get_type -</SECTION> - -<SECTION> <FILE>soup-logger</FILE> <TITLE>SoupLogger</TITLE> SoupLogger diff --git a/libsoup/soup-value-utils.c b/libsoup/soup-value-utils.c index 5ae0a694..8ff2d86e 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) @@ -101,6 +112,8 @@ soup_value_hash_insert_valist (GHashTable *hash, const char *first_key, * * Return value: (element-type utf8 GValue) (transfer full): a new * #GHashTable, initialized with the given values + * + * Deprecated: Use #GVariant API instead. **/ GHashTable * soup_value_hash_new_with_vals (const char *first_key, ...) @@ -123,6 +136,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 +158,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 +183,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, ...) @@ -189,6 +208,8 @@ soup_value_hash_insert_vals (GHashTable *hash, const char *first_key, ...) * * Return value: %TRUE if @hash contained a value with key @key and * type @type, %FALSE if not. + * + * Deprecated: Use #GVariant API instead. **/ gboolean soup_value_hash_lookup (GHashTable *hash, const char *key, GType type, ...) @@ -222,6 +243,8 @@ soup_value_hash_lookup (GHashTable *hash, const char *key, GType type, ...) * initialize each destination variable to a reasonable default * value, since there is no way to tell which keys were found * and which were not. + * + * Deprecated: Use #GVariant API instead. **/ gboolean soup_value_hash_lookup_vals (GHashTable *hash, const char *first_key, ...) @@ -253,10 +276,6 @@ soup_value_hash_lookup_vals (GHashTable *hash, const char *first_key, ...) } -#ifdef G_GNUC_BEGIN_IGNORE_DEPRECATIONS -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -#endif - /** * soup_value_array_from_args: * @args: arguments to create a #GValueArray from @@ -268,6 +287,8 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS * * Return value: (nullable): a new #GValueArray, or %NULL if an error * occurred. + * + * Deprecated: Use #GVariant API instead. **/ GValueArray * soup_value_array_from_args (va_list args) @@ -295,6 +316,8 @@ soup_value_array_from_args (va_list args) * same memory as the values in the array. * * Return value: success or failure + * + * Deprecated: Use #GVariant API instead. **/ gboolean soup_value_array_to_args (GValueArray *array, va_list args) @@ -322,6 +345,8 @@ soup_value_array_to_args (GValueArray *array, va_list args) * g_value_array_new(), for naming consistency purposes.) * * Return value: a new %GValueArray + * + * Deprecated: Use #GVariant API instead. **/ GValueArray * soup_value_array_new (void) @@ -355,6 +380,8 @@ soup_value_array_append_valist (GValueArray *array, * into it. * * Return value: a new %GValueArray + * + * Deprecated: Use #GVariant API instead. **/ GValueArray * soup_value_array_new_with_vals (GType first_type, ...) @@ -379,6 +406,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 +430,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 +455,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, ...) @@ -447,6 +480,8 @@ soup_value_array_append_vals (GValueArray *array, GType first_type, ...) * * Return value: %TRUE if @array contained a value with index @index_ * and type @type, %FALSE if not. + * + * Deprecated: Use #GVariant API instead. **/ gboolean soup_value_array_get_nth (GValueArray *array, guint index_, GType type, ...) @@ -464,10 +499,6 @@ soup_value_array_get_nth (GValueArray *array, guint index_, GType type, ...) return TRUE; } -#ifdef G_GNUC_END_IGNORE_DEPRECATIONS -G_GNUC_END_IGNORE_DEPRECATIONS -#endif - static GByteArray * soup_byte_array_copy (GByteArray *ba) { @@ -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 1ff42356..2a50abc8 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-old.c b/libsoup/soup-xmlrpc-old.c index 4796134a..2f325d44 100644 --- a/libsoup/soup-xmlrpc-old.c +++ b/libsoup/soup-xmlrpc-old.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; @@ -152,6 +149,8 @@ G_GNUC_END_IGNORE_DEPRECATIONS * * Return value: (nullable): the text of the methodCall, or %NULL on * error + * + * Deprecated: Use soup_xmlrpc_build_request() instead. **/ char * soup_xmlrpc_build_method_call (const char *method_name, @@ -202,13 +201,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; @@ -233,6 +227,8 @@ G_GNUC_END_IGNORE_DEPRECATIONS * * Return value: (transfer full): a #SoupMessage encoding the * indicated XML-RPC request. + * + * Deprecated: Use soup_xmlrpc_message_new() instead. **/ SoupMessage * soup_xmlrpc_request_new (const char *uri, const char *method_name, ...) @@ -259,6 +255,8 @@ soup_xmlrpc_request_new (const char *uri, const char *method_name, ...) * * Return value: (nullable): the text of the methodResponse, or %NULL * on error + * + * Deprecated: Use soup_xmlrpc_build_response() instead. **/ char * soup_xmlrpc_build_method_response (GValue *value) @@ -300,6 +298,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, ...) @@ -333,6 +333,8 @@ char *soup_xmlrpc_build_faultv (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, @@ -459,9 +461,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; @@ -478,9 +477,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; @@ -500,6 +496,8 @@ G_GNUC_END_IGNORE_DEPRECATIONS * know in advance what the types of the parameters will be. * * Return value: success or failure. + * + * Deprecated: Use soup_xmlrpc_parse_request_full() instead. **/ gboolean soup_xmlrpc_parse_method_call (const char *method_call, int length, @@ -530,9 +528,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")) { @@ -547,9 +542,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 (); @@ -582,6 +574,8 @@ fail: * you don't know the types of the parameters. * * Return value: success or failure. + * + * Deprecated: Use soup_xmlrpc_parse_request_full() instead. **/ gboolean soup_xmlrpc_extract_method_call (const char *method_call, int length, @@ -599,13 +593,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; } @@ -626,6 +615,8 @@ G_GNUC_END_IGNORE_DEPRECATIONS * * Return value: %TRUE if a return value was parsed, %FALSE if the * response could not be parsed, or contained a fault. + * + * Deprecated: Use soup_xmlrpc_parse_response() instead. **/ gboolean soup_xmlrpc_parse_method_response (const char *method_response, int length, @@ -712,6 +703,8 @@ fail: * * Return value: %TRUE if a return value was parsed, %FALSE if the * response was of the wrong type, or contained a fault. + * + * Deprecated: Use soup_xmlrpc_parse_response() instead. **/ gboolean soup_xmlrpc_extract_method_response (const char *method_response, int length, @@ -741,3 +734,5 @@ find_real_node (xmlNode *node) node = node->next; return node; } + +G_GNUC_END_IGNORE_DEPRECATIONS diff --git a/libsoup/soup-xmlrpc-old.h b/libsoup/soup-xmlrpc-old.h index 23db5029..47ab15cb 100644 --- a/libsoup/soup-xmlrpc-old.h +++ b/libsoup/soup-xmlrpc-old.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) 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) 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, |
