diff options
author | Timm Bäder <mail@baedert.org> | 2016-07-26 14:57:27 +0200 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2017-02-21 17:21:19 +0100 |
commit | f39ea4104f8f4b30df795c3e7f4b85cfb8b76339 (patch) | |
tree | 443644a5707612c43dd487a2d7b323b640132e86 | |
parent | bc9ba9d05734799c5e936604e5058788679b1488 (diff) | |
download | librest-f39ea4104f8f4b30df795c3e7f4b85cfb8b76339.tar.gz |
Use goffset for message sizes
That's what libsoup uses as well.
-rw-r--r-- | rest-extras/youtube-proxy.c | 2 | ||||
-rw-r--r-- | rest-extras/youtube-proxy.h | 2 | ||||
-rw-r--r-- | rest/rest-proxy-call.c | 27 | ||||
-rw-r--r-- | rest/rest-proxy-call.h | 17 |
4 files changed, 18 insertions, 30 deletions
diff --git a/rest-extras/youtube-proxy.c b/rest-extras/youtube-proxy.c index be0cf08..d953dd4 100644 --- a/rest-extras/youtube-proxy.c +++ b/rest-extras/youtube-proxy.c @@ -245,7 +245,7 @@ typedef struct { SoupMessage *message; GObject *weak_object; gpointer user_data; - gsize uploaded; + goffset uploaded; } YoutubeProxyUploadClosure; static void diff --git a/rest-extras/youtube-proxy.h b/rest-extras/youtube-proxy.h index 1fe6c20..3c8892a 100644 --- a/rest-extras/youtube-proxy.h +++ b/rest-extras/youtube-proxy.h @@ -78,7 +78,7 @@ void youtube_proxy_set_user_auth (YoutubeProxy *proxy, typedef void (*YoutubeProxyUploadCallback)(YoutubeProxy *proxy, const gchar *payload, gsize total, - gsize uploaded, + goffset uploaded, const GError *error, GObject *weak_object, gpointer user_data); diff --git a/rest/rest-proxy-call.c b/rest/rest-proxy-call.c index 6cc3781..bcf9c6b 100644 --- a/rest/rest-proxy-call.c +++ b/rest/rest-proxy-call.c @@ -53,7 +53,7 @@ struct _RestProxyCallUploadClosure { GObject *weak_object; gpointer userdata; SoupMessage *message; - gsize uploaded; + goffset uploaded; }; typedef struct _RestProxyCallUploadClosure RestProxyCallUploadClosure; @@ -645,14 +645,15 @@ finish_call (RestProxyCall *call, SoupMessage *message, GError **error) static void _continuous_call_message_completed_cb (SoupSession *session, SoupMessage *message, - gpointer userdata) + gpointer user_data) { + GTask *task = user_data; RestProxyCallContinuousClosure *closure; RestProxyCall *call; RestProxyCallPrivate *priv; GError *error = NULL; - closure = (RestProxyCallContinuousClosure *)userdata; + closure = (RestProxyCallContinuousClosure *)g_task_get_task_data (task); call = closure->call; priv = GET_PRIVATE (call); @@ -661,22 +662,10 @@ _continuous_call_message_completed_cb (SoupSession *session, _handle_error_from_message (message, &error); - closure->callback (closure->call, - NULL, - 0, - error, - closure->weak_object, - closure->userdata); - - g_clear_error (&error); - - /* Success. We don't need the weak reference any more */ - if (closure->weak_object) - { - g_object_weak_unref (closure->weak_object, - (GWeakNotify)_call_async_weak_notify_cb, - closure); - } + if (error != NULL) + g_task_return_error (task, error); + else + g_task_return_boolean (task, TRUE); priv->cur_call_closure = NULL; g_object_unref (closure->call); diff --git a/rest/rest-proxy-call.h b/rest/rest-proxy-call.h index f8ff714..4c09bd1 100644 --- a/rest/rest-proxy-call.h +++ b/rest/rest-proxy-call.h @@ -150,7 +150,6 @@ RestParams *rest_proxy_call_get_params (RestProxyCall *call); typedef void (*RestProxyCallAsyncCallback)(RestProxyCall *call, const GError *error, - GObject *weak_object, gpointer userdata); void rest_proxy_call_invoke_async (RestProxyCall *call, @@ -166,25 +165,25 @@ typedef void (*RestProxyCallContinuousCallback) (RestProxyCall *call, const gchar *buf, gsize len, const GError *error, - GObject *weak_object, gpointer userdata); -gboolean rest_proxy_call_continuous (RestProxyCall *call, - RestProxyCallContinuousCallback callback, - GObject *weak_object, - gpointer userdata, - GError **error); +void rest_proxy_call_continuous (RestProxyCall *call, + RestProxyCallContinuousCallback continuous_callback, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +gboolean rest_proxy_call_continuous_finish (RestProxyCall *call, + GAsyncResult *result, + GError **error); typedef void (*RestProxyCallUploadCallback) (RestProxyCall *call, gsize total, gsize uploaded, const GError *error, - GObject *weak_object, gpointer userdata); gboolean rest_proxy_call_upload (RestProxyCall *call, RestProxyCallUploadCallback callback, - GObject *weak_object, gpointer userdata, GError **error); |