[libsoup/wip/xmlrpc-variant: 16/18] xmlrpc: remove soup_xmlrpc_parse_request_full()



commit fdc7209523ecf06e73b3e296513826c7e2f68c07
Author: Xavier Claessens <xavier claessens collabora com>
Date:   Mon Aug 10 15:43:27 2015 -0400

    xmlrpc: remove soup_xmlrpc_parse_request_full()

 docs/reference/libsoup-2.4-sections.txt |    1 -
 libsoup/libsoup-2.4.sym                 |    1 -
 libsoup/soup-xmlrpc-old.c               |    4 +-
 libsoup/soup-xmlrpc-old.h               |    4 +-
 libsoup/soup-xmlrpc.c                   |   82 ++++++------------------------
 libsoup/soup-xmlrpc.h                   |    6 --
 tests/xmlrpc-test.c                     |   27 +++++++---
 7 files changed, 39 insertions(+), 86 deletions(-)
---
diff --git a/docs/reference/libsoup-2.4-sections.txt b/docs/reference/libsoup-2.4-sections.txt
index c483654..58f77e4 100644
--- a/docs/reference/libsoup-2.4-sections.txt
+++ b/docs/reference/libsoup-2.4-sections.txt
@@ -844,7 +844,6 @@ SoupXMLRPCParams
 soup_xmlrpc_params_free
 soup_xmlrpc_params_parse
 soup_xmlrpc_parse_request
-soup_xmlrpc_parse_request_full
 soup_xmlrpc_build_response
 soup_xmlrpc_build_fault
 soup_xmlrpc_message_set_response
diff --git a/libsoup/libsoup-2.4.sym b/libsoup/libsoup-2.4.sym
index ea458c7..257d4da 100644
--- a/libsoup/libsoup-2.4.sym
+++ b/libsoup/libsoup-2.4.sym
@@ -559,7 +559,6 @@ soup_xmlrpc_params_parse
 soup_xmlrpc_parse_method_call
 soup_xmlrpc_parse_method_response
 soup_xmlrpc_parse_request
-soup_xmlrpc_parse_request_full
 soup_xmlrpc_parse_response
 soup_xmlrpc_request_new
 soup_xmlrpc_set_fault
diff --git a/libsoup/soup-xmlrpc-old.c b/libsoup/soup-xmlrpc-old.c
index 2f325d4..c61991c 100644
--- a/libsoup/soup-xmlrpc-old.c
+++ b/libsoup/soup-xmlrpc-old.c
@@ -497,7 +497,7 @@ parse_value (xmlNode *xmlvalue, GValue *value)
  *
  * Return value: success or failure.
  *
- * Deprecated: Use soup_xmlrpc_parse_request_full() instead.
+ * Deprecated: Use soup_xmlrpc_parse_request() instead.
  **/
 gboolean
 soup_xmlrpc_parse_method_call (const char *method_call, int length,
@@ -575,7 +575,7 @@ fail:
  *
  * Return value: success or failure.
  *
- * Deprecated: Use soup_xmlrpc_parse_request_full() instead.
+ * Deprecated: Use soup_xmlrpc_parse_request() instead.
  **/
 gboolean
 soup_xmlrpc_extract_method_call (const char *method_call, int length,
diff --git a/libsoup/soup-xmlrpc-old.h b/libsoup/soup-xmlrpc-old.h
index 8792721..47ab15c 100644
--- a/libsoup/soup-xmlrpc-old.h
+++ b/libsoup/soup-xmlrpc-old.h
@@ -32,12 +32,12 @@ gboolean     soup_xmlrpc_extract_method_response (const char   *method_response,
                                                  ...);
 
 /* XML-RPC server */
-SOUP_DEPRECATED_IN_2_52_FOR(soup_xmlrpc_parse_request_full)
+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_full)
+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,
diff --git a/libsoup/soup-xmlrpc.c b/libsoup/soup-xmlrpc.c
index 6c25d25..d19c645 100644
--- a/libsoup/soup-xmlrpc.c
+++ b/libsoup/soup-xmlrpc.c
@@ -1132,9 +1132,22 @@ soup_xmlrpc_params_new (xmlNode *node)
  *
  * Parse method parameters returned by soup_xmlrpc_parse_request().
  *
- * See soup_xmlrpc_parse_request_full() for deserialization details.
+ * Deserialization details:
+ *  - If @signature is provided, &lt;int&gt and &lt;i4&gt can be deserialized
+ *    to byte, int16, uint16, int32, uint32, int64, uint64 or handle. Otherwise
+ *    it will be deserialized to int32. If the value is out of range
+ *    for the target type it will return an error.
+ *  - &lt;struct&gt; will be deserialized to "a{sv}". @signature could define
+ *    another value type (e.g. "a{ss}").
+ *  - &lt;array&gt; will be deserialized to "av". @signature could define
+ *    another element type (e.g. "as") or could be a tuple (e.g. "(ss)").
+ *  - &lt;base64&gt; will be deserialized to "ay".
+ *  - &lt;string&gt; will be deserialized to "s".
+ *  - &lt;dateTime.iso8601&gt; will be deserialized to int64 unix timestamp.
+ *  - @signature must not have maybes, otherwise an error is returned.
+ *  - Dictionaries must have string keys, otherwise an error is returned.
  *
- * Returns: (transfer full): a new #GVariant, or %NULL
+ * Returns: (transfer full): a new (non-floating) #GVariant, or %NULL
  *
  * Since: 2.52
  */
@@ -1174,9 +1187,7 @@ fail:
  * @error: a #GError, or %NULL
  *
  * Parses @method_call and return the method name. Method parameters can be
- * parsed later using soup_xmlrpc_params_parse(). If the signature of parameters
- * is known in advance then soup_xmlrpc_parse_request_full() can be used
- * instead.
+ * parsed later using soup_xmlrpc_params_parse().
  *
  * Returns: (transfer full): method's name, or %NULL on error.
  * Since: 2.52
@@ -1241,65 +1252,6 @@ fail:
 }
 
 /**
- * soup_xmlrpc_parse_request_full:
- * @method_call: the XML-RPC methodCall string
- * @length: the length of @method_call, or -1 if it is NUL-terminated
- * @signature: (allow-none): A valid #GVariant type string, or %NULL
- * @parameters: (out): on success, a new #GVariant
- * @error: a #GError, or %NULL
- *
- * Parses @method_call and return the method name and set @parameters.
- * soup_xmlrpc_parse_request() should be used instead if the method name must be
- * known to determine @parameters' signature.
- *
- * Deserialization details:
- *  - If @signature is provided, &lt;int&gt and &lt;i4&gt can be deserialized
- *    to byte, int16, uint16, int32, uint32, int64, uint64 or handle. Otherwise
- *    it will be deserialized to int32. If the value is out of range
- *    for the target type it will return an error.
- *  - &lt;struct&gt; will be deserialized to "a{sv}". @signature could define
- *    another value type (e.g. "a{ss}").
- *  - &lt;array&gt; will be deserialized to "av". @signature could define
- *    another element type (e.g. "as") or could be a tuple (e.g. "(ss)").
- *  - &lt;base64&gt; will be deserialized to "ay".
- *  - &lt;string&gt; will be deserialized to "s".
- *  - &lt;dateTime.iso8601&gt; will be deserialized to int64 unix timestamp.
- *  - @signature must not have maybes, otherwise an error is returned.
- *  - Dictionaries must have string keys, otherwise an error is returned.
- *
- * Returns: (transfer full): method's name, or %NULL on error.
- *
- * Since: 2.52
- **/
-char *
-soup_xmlrpc_parse_request_full (const char  *method_call,
-                               int          length,
-                               const char  *signature,
-                               GVariant   **parameters,
-                               GError     **error)
-{
-       char *method_name;
-       SoupXMLRPCParams *params;
-
-       method_name = soup_xmlrpc_parse_request (method_call,
-                                                length,
-                                                parameters ? &params : NULL,
-                                                error);
-       if (!method_name)
-               return NULL;
-
-       if (parameters) {
-               *parameters = soup_xmlrpc_params_parse (params, signature, error);
-               if (*parameters == NULL) {
-                       g_free (method_name);
-                       return NULL;
-               }
-       }
-
-       return method_name;
-}
-
-/**
  * soup_xmlrpc_parse_response:
  * @method_response: the XML-RPC methodResponse string
  * @length: the length of @method_response, or -1 if it is NUL-terminated
@@ -1313,7 +1265,7 @@ soup_xmlrpc_parse_request_full (const char  *method_call,
  * the fault string. If @method_response cannot be parsed, %NULL is returned,
  * and @error will be set to an error in the %SOUP_XMLRPC_ERROR domain.
  *
- * See soup_xmlrpc_parse_request_full() for deserialization details.
+ * See soup_xmlrpc_params_parse() for deserialization details.
  *
  * Returns: (transfer full): a new (non-floating) #GVariant, or %NULL
  *
diff --git a/libsoup/soup-xmlrpc.h b/libsoup/soup-xmlrpc.h
index f8f5f55..b51d1bd 100644
--- a/libsoup/soup-xmlrpc.h
+++ b/libsoup/soup-xmlrpc.h
@@ -41,12 +41,6 @@ char       *soup_xmlrpc_parse_request        (const char       *method_call,
                                               SoupXMLRPCParams **params,
                                               GError           **error);
 SOUP_AVAILABLE_IN_2_52
-char       *soup_xmlrpc_parse_request_full   (const char       *method_call,
-                                              int               length,
-                                              const char       *signature,
-                                              GVariant         **parameters,
-                                              GError           **error);
-SOUP_AVAILABLE_IN_2_52
 char       *soup_xmlrpc_build_response       (GVariant          *value,
                                               GError           **error);
 char       *soup_xmlrpc_build_fault          (int               fault_code,
diff --git a/tests/xmlrpc-test.c b/tests/xmlrpc-test.c
index 2a968a8..b966072 100644
--- a/tests/xmlrpc-test.c
+++ b/tests/xmlrpc-test.c
@@ -528,17 +528,20 @@ verify_deserialization (GVariant *expected_variant,
 {
        char *body;
        char *method_name;
+       SoupXMLRPCParams *out_params = NULL;
        GVariant *variant;
        GError *error = NULL;
 
        body = g_strconcat (BODY_PREFIX, params, BODY_SUFFIX, NULL);
-       method_name = soup_xmlrpc_parse_request_full (body, strlen (body),
-                                                     signature,
-                                                     &variant,
-                                                     &error);
+       method_name = soup_xmlrpc_parse_request (body, strlen (body),
+                                                &out_params,
+                                                &error);
        g_assert_no_error (error);
        g_assert_cmpstr (method_name, ==, "MyMethod");
 
+       variant = soup_xmlrpc_params_parse (out_params, signature, &error);
+       g_assert_no_error (error);
+
        if (!g_variant_equal (variant, expected_variant)) {
                char *str1, *str2;
 
@@ -552,6 +555,7 @@ verify_deserialization (GVariant *expected_variant,
                g_free (str2);
        }
 
+       soup_xmlrpc_params_free (out_params);
        g_variant_unref (variant);
        g_free (method_name);
        g_free (body);
@@ -563,18 +567,23 @@ verify_deserialization_fail (const char *signature,
 {
        char *body;
        char *method_name;
+       SoupXMLRPCParams *out_params = NULL;
        GVariant *variant;
        GError *error = NULL;
 
        body = g_strconcat (BODY_PREFIX, params, BODY_SUFFIX, NULL);
-       method_name = soup_xmlrpc_parse_request_full (body, strlen (body),
-                                                     signature,
-                                                     &variant,
-                                                     &error);
+       method_name = soup_xmlrpc_parse_request (body, strlen (body),
+                                                &out_params,
+                                                &error);
+       g_assert_no_error (error);
+       g_assert_cmpstr (method_name, ==, "MyMethod");
+
+       variant = soup_xmlrpc_params_parse (out_params, signature, &error);
        g_assert_error (error, SOUP_XMLRPC_ERROR, SOUP_XMLRPC_ERROR_ARGUMENTS);
-       g_assert (method_name == NULL);
+       g_assert (variant == NULL);
 
        g_free (body);
+       soup_xmlrpc_params_free (out_params);
 }
 
 static void


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