/soc/2013/ashmew2/filetransferY: 3a9668da6203: Most warnings res...
Ashish Gupta
ashmew2 at gmail.com
Tue Dec 31 07:34:21 EST 2013
Changeset: 3a9668da6203dca8eacb8df128438dc8942d767d
Author: Ashish Gupta <ashmew2 at gmail.com>
Date: 2013-12-31 17:08 +0530
Branch: filetransferX
URL: https://hg.pidgin.im/soc/2013/ashmew2/filetransferY/rev/3a9668da6203
Description:
Most warnings resolved
diffstat:
libpurple/protocols/jabber/google/google_session.c | 97 +++------------------
1 files changed, 15 insertions(+), 82 deletions(-)
diffs (truncated from 315 to 300 lines):
diff --git a/libpurple/protocols/jabber/google/google_session.c b/libpurple/protocols/jabber/google/google_session.c
--- a/libpurple/protocols/jabber/google/google_session.c
+++ b/libpurple/protocols/jabber/google/google_session.c
@@ -95,7 +95,7 @@ gtalk_xfer_handle_info(JabberStream *js
NiceCandidate * nice_candidate_from_xml(const xmlnode *candidate, guint stream_id);
gchar * http_read_line(gchar *buffer, guint len);
char* gtalk_get_temporary_url(void);
-GoogleSession *gtalk_xfer_new_session(JabberStream *js, char *who);
+GoogleSession *gtalk_xfer_new_session(JabberStream *js, const char *who);
char *nice_component_state_to_str(guint state);
void gtalk_xfer_get_next_block(GoogleXferSessionData *share_session);
void gtalk_xfer_send_info(JabberStream *js, GoogleSession *session, xmlnode *sess);
@@ -123,27 +123,9 @@ google_session_destroy(GoogleSession *se
JabberStream *js = session->js;
- session->state = TERMINATED;
- purple_debug_info("google_session", "Inside google_session_destroy..\n\n");
-
- if(!session_data)
- purple_debug_info("google_session","Session_data is NULL..\n");
- else
- purple_debug_info("google_session", "Session_data is NOT NULL..\n");
-
- purple_debug_info("google_session", "google_session_destroy] session's address : %u\n",session);
- purple_debug_info("google_session", "google_session_destroy] session_data's address : %u\n",session_data);
- purple_debug_info("google_session", "google_session_destroy] session_data's address : %u\n",session->session_data);
-
- if(session_data->share)
- purple_debug_info("google_session", "Share found!\n");
- else
- purple_debug_info("google_session", "Share NOT found!\n");
-
-
+ session->state = TERMINATED;
if(session_data->share) {
- purple_debug_info("google_session", "Session_data->share Block..\n");
GoogleXferSessionData *share_session = session_data->share_session;
GSList *temp = NULL;
@@ -200,12 +182,12 @@ google_session_destroy(GoogleSession *se
purple_circ_buffer_destroy(share_session->buffer);
for (temp = share_session->remote_share_candidates; temp; temp =
- g_list_delete_link(temp, temp)) {
+ g_slist_delete_link(temp, temp)) {
nice_candidate_free(temp->data);
}
for (temp = share_session->local_share_candidates; temp; temp =
- g_list_delete_link(temp, temp)) {
+ g_slist_delete_link(temp, temp)) {
nice_candidate_free(temp->data);
}
@@ -535,9 +517,6 @@ gtalk_xfer_send_terminate(PurpleXfer *xf
purple_debug_info("google_session", "Inside gtalk_xfer_send_terminate, xfer_status : %d\n",
purple_xfer_get_status(xfer));
- purple_debug_info("google_session", "gtalk_xfer_send_terminate] session's address : %u\n",session);
- purple_debug_info("google_session", "gtalk_xfer_send_terminate] session->session_data's address : %u\n",session->session_data);
-
if(session->state < IN_PROGRESS) {
purple_debug_info("google_session", "Directly calling destroy().. as state<IN_PROGRESS..\n");
google_session_destroy(session);
@@ -550,7 +529,6 @@ gtalk_xfer_send_terminate(PurpleXfer *xf
xmlnode_set_attrib(session_node, "initiator", session->id.initiator);
xmlnode_set_namespace(session_node, NS_GOOGLE_SESSION);
purple_debug_info("google_session", "Sending google_s_dest as callback..Sending IQ\n");
- purple_debug_info("google_session", "gtalk_xfer_send_terminate] xfer->data's address : %u\n",xfer->data);
jabber_iq_send(iq);
google_session_destroy(session);
}
@@ -560,8 +538,6 @@ void
gtalk_xfer_cancel_xfer(PurpleXfer *xfer)
{
GoogleSession *session = (GoogleSession *)xfer->data;
- GoogleAVSessionData *session_data = session->session_data;
- GoogleXferSessionData *share_session = session_data->share_session;
purple_debug_info("gs", "Inside gtalk_xfer_cancel_xfer...\n");
@@ -587,9 +563,6 @@ gint gtalk_xfer_init_agent(GoogleSession
GoogleXferSessionData *share_session = session_data->share_session;
purple_debug_info("google_session", "Inside gtalk_xfer_init_agent\n");
- purple_debug_info("google_session", "gtalk_xfer_init_agent] session_data's address : %u\n",session_data);
- purple_debug_info("google_session", "gtalk_xfer_init_agent] ->session_data's address : %u\n",session->session_data);
-
if(!share_session)
return -1;
@@ -634,8 +607,6 @@ jabber_google_relay_response_session_ini
(GoogleAVSessionData *) session->session_data;
GoogleXferSessionData *share_session =
session_data->share_session;
- NiceCandidate *relay_candidate_udp, *relay_candidate_tcp;
- NiceCandidate *relay_candidate_ssltcp;
gint stream_id = share_session->stream_id;
NiceAgent *agent = share_session->share_agent;
@@ -952,14 +923,7 @@ google_session_handle_initiate(JabberStr
xmlnode *description = xmlnode_get_child(sess, "description");
xmlnode *manifest,*file,*filename = NULL,*protocol,*http,*url_source_path,*url_preview_path,*transport;
guint filesize = 0;
- JabberIq *result_iq, *set_iq,*result;
- char *responsetxt;
- int responsetxtlen;
- xmlnode *tmp;
- gchar *me = g_strdup_printf("%s@%s/%s",
- session->js->user->node,
- session->js->user->domain,
- session->js->user->resource);
+ JabberIq *result;
purple_debug_info("google_session", "Indeed a SHARE Session\n");
if( description ) {
@@ -1062,10 +1026,6 @@ gtalk_xfer_handle_info(JabberStream *js
xmlnode *complete = xmlnode_get_child(sess, "complete");
GoogleAVSessionData *session_data = (GoogleAVSessionData *)session->session_data;
GoogleXferSessionData *share_session = session_data->share_session;
- gchar *me = g_strdup_printf("%s@%s/%s",
- js->user->node,
- js->user->domain,
- js->user->resource);
purple_debug_info("google_session", "Inside gtalk_xfer_handle_info\n");
@@ -1209,8 +1169,6 @@ static void
google_session_handle_transport_accept(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id)
{
JabberIq *result_iq = jabber_iq_new(js,JABBER_IQ_RESULT);
- purple_debug_info("google_session", "Inside handle_transport_accept()\n");
- purple_debug_info("google_session", "google_session_handle_transport_accept] session->session_data's address : %u\n",session->session_data);
xmlnode_set_attrib(result_iq->node, "to", session->remote_jid);
jabber_iq_set_id(result_iq, iq_id);
@@ -1315,7 +1273,6 @@ static void
google_session_handle_transport_info(JabberStream *js, GoogleSession *session, xmlnode *sess, const char *iq_id)
{
GoogleAVSessionData *session_data = (GoogleAVSessionData *)session->session_data;
- GoogleXferSessionData *share_session = session_data->share_session;
purple_debug_info("google_session", "Inside handle_transport_info..\n");
if(session_data->share)
@@ -1579,7 +1536,6 @@ nice_candidate_to_xml(const NiceCandidat
void
cb_candidate_gathering_done(NiceAgent *agent, guint stream_id, gpointer user_data)
{
- char *local_ufrag, *local_password;
GoogleSession *session = (GoogleSession *)user_data;
GoogleAVSessionData *session_data = session->session_data;
GoogleXferSessionData *share_session = session_data->share_session;
@@ -1672,10 +1628,8 @@ void
gtalk_xfer_end(PurpleXfer *xfer)
{
-/*The following is only for PURPLE_XFER_RECEIVE...Should add something for PURPLE_XFER_SEND ?..TODO*/
+/*The following is only for PURPLE_XFER_RECEIVE...Should add something for PURPLE_XFER_SEND ?..TODO isn't send_terminate for x_send*/
GoogleSession *session = (GoogleSession *) xfer->data;
- GoogleAVSessionData *session_data =
- (GoogleAVSessionData *) session->session_data;
JabberStream *js = session->js;
JabberIq *iq = jabber_iq_new(js, JABBER_IQ_SET);
xmlnode *complete_node, *session_node;
@@ -1739,27 +1693,22 @@ cb_nice_recv(NiceAgent *agent, guint str
/*We should send back a 200 OK now*/
int send_ret;
- char *file_buf = NULL;
- FILE *file_ptr = fopen(xfer->local_filename, "rb");
gchar *response = g_strdup_printf( "HTTP/1.1 200\r\n"
"Connection: Keep-Alive\r\n"
- "Content-Length: %zu\r\n"
+ "Content-Length: %" G_GSIZE_FORMAT "\r\n"
"Content-Type: application/octet-stream\r\n\r\n",
xfer->size);
- int fread_ret;
-
purple_debug_info("google_session", "Inside cb_nice_recv for XFER_SEND.\nReceived : %s\n-X-\n", buf);
share_session->channel_state = GTALK_XFER_CHANNEL_HTTP_GET_RECEIVED;
- file_buf = g_malloc(65536);
send_ret = nice_agent_send(share_session->share_agent, share_session->stream_id, 1,
strlen(response), response);
purple_debug_info("google_session", "Sending response : %s\n", response);
purple_debug_info("google_session", "For sending 200 OK, send_ret is : %d\n",send_ret);
- purple_debug_info("google_session", "Filesize is : %zu\n", xfer->size);
- /*Share_session->fileize should probably have xfer->size's value ^ G_SIZE_FORMAT!!! TODO*/
+ purple_debug_info("google_session", "Filesize is : %" G_GSIZE_FORMAT "\n", xfer->size);
+ /*Share_session->fileize should probably have xfer->size's value ^ G_GSIZE_FORMAT!!! TODO*/
share_session->channel_state = GTALK_XFER_CHANNEL_HTTP_OK_SENT;
share_session->file_to_send = fopen(share_session->xfer->local_filename, "rb");
@@ -1938,7 +1887,6 @@ void cb_nice_component_state_changed(Nic
purple_xfer_get_type(share_session->xfer) == PURPLE_XFER_RECEIVE) {
gint send_ret;
- JabberStream *js = session->js;
gchar *raw_filename = purple_strreplace(share_session->filename, " ","%20");
gchar *url = g_strdup_printf("%s%s", share_session->source_url, raw_filename);
gchar *request = g_strdup_printf("GET %s HTTP/1.1\r\n"
@@ -1983,15 +1931,12 @@ void cb_nice_component_writable(NiceAgen
GoogleXferSessionData *share_session = (GoogleXferSessionData *)user_data;
PurpleXfer *xfer = share_session->xfer;
- FILE *file_ptr = share_session->file_to_send;
char *file_buf = share_session->file_buf;
- int fread_count = 0;
- int send_ret, fread_ret;
+ int send_ret;
if(share_session->channel_state == GTALK_XFER_CHANNEL_HTTP_GET_NOT_SENT) {
gint send_ret;
GoogleSession *session = (GoogleSession *)xfer->data;
- JabberStream *js = session->js;
gchar *raw_filename = purple_strreplace(share_session->filename, " ","%20");
gchar *url = g_strdup_printf("%s%s", share_session->source_url, raw_filename);
gchar *request = g_strdup_printf("GET %s HTTP/1.1\r\n"
@@ -1999,14 +1944,13 @@ void cb_nice_component_writable(NiceAgen
"Content-Length: 0\r\n"
"Host: %s:0\r\n"
"User-Agent: %s\r\n\r\n", url, session->remote_jid, "Google Talk");
- gsize raw_len;
send_ret = nice_agent_send(share_session->share_agent, share_session->stream_id, 1,
strlen(request), request);
purple_debug_info("google_session", "send_ret is %d, \nRequest is : \n%s\n",send_ret, request);
if(send_ret > 0) { /*Considering this to be successful. Maybe add a check for response?*/
share_session->channel_state = GTALK_XFER_CHANNEL_SENT_HTTP_GET;
- purple_debug_info("google_session", "Request is : %s with length %zu\n",request, strlen(request));
+ purple_debug_info("google_session", "Request is : %s with length %" G_GSIZE_FORMAT "\n",request, strlen(request));
purple_debug_info("google_session", "send_ret is %d, SENT_HTTP_GET\n",send_ret);
}
else {
@@ -2085,7 +2029,7 @@ gtalk_xfer_start(PurpleXfer *xfer)
}
GoogleSession *
-gtalk_xfer_new_session(JabberStream *js, char *who)
+gtalk_xfer_new_session(JabberStream *js, const char *who)
{
GoogleSession *session = g_new0(GoogleSession, 1);
GoogleAVSessionData *session_data = g_new0(GoogleAVSessionData, 1);
@@ -2123,8 +2067,6 @@ gtalk_xfer_new_session(JabberStream *js,
session->state = UNINIT; /*TODO: Add similar state changes in the code for GoogleSession*/
session->js = js;
session->remote_jid = g_strdup(jid);
- purple_debug_info("google_session", "gtalk_xfer_new_session] session_data's address : %u\n",session_data);
- purple_debug_info("google_session", "gtalk_xfer_new_session] session_data's address : %u\n",session->session_data);
return session;
}
@@ -2228,14 +2170,12 @@ void gtalk_xfer_send_session_initiate(Pu
JabberIq *iq;
xmlnode *session_node, *description_node, *file_node, *manifest_node, *transport_node;
xmlnode *name_node, *protocol_node, *http_node, *url_source_node, *url_preview_node;
- guint64 size;
gchar *me = g_strdup_printf("%s@%s/%s",
js->user->node,
js->user->domain,
js->user->resource);
purple_debug_info("google_session", "Inside gtalk_xfer_send_session_initiate()\n");
- purple_debug_info("google_session", "gtalk_xfer_send_session_initiate] session_data's address : %u\n",session->session_data);
iq = jabber_iq_new(js, JABBER_IQ_SET);
xmlnode_set_attrib(iq->node, "to", session->remote_jid);
@@ -2258,8 +2198,8 @@ void gtalk_xfer_send_session_initiate(Pu
manifest_node = xmlnode_new_child(description_node, "manifest");
file_node = xmlnode_new_child(manifest_node, "file");
- xmlnode_set_attrib(file_node, "size", g_strdup_printf("%zu",xfer->size));
-/*TODO: REPLACE XFER->size with the PROPER FUNCTIONS from ft.h everywhere! Check G_SIZE_FORMAT afair*/
+ xmlnode_set_attrib(file_node, "size", g_strdup_printf("%" G_GSIZE_FORMAT,xfer->size));
+ /*TODO: REPLACE XFER->size with the PROPER FUNCTIONS from ft.h everywhere! Check G_GSIZE_FORMAT afair*/
purple_debug_info("google_session", "session_init : Pass 4\n");
name_node = xmlnode_new_child(file_node, "name");
@@ -2326,13 +2266,9 @@ void
gtalk_xfer_init(PurpleXfer *xfer)
{
GoogleSession *session = (GoogleSession *)(xfer->data);
- GoogleAVSessionData *session_data = (GoogleAVSessionData *)session->session_data;
- GoogleXferSessionData *share_session = session_data->share_session;
JabberStream *js = session->js;
purple_debug_info("google_session", "Inside gtalk_xfer_init\n");
- purple_debug_info("google_session", "gtalk_xfer_send_session_initiate] session_data's address : %u\n",session_data);
- purple_debug_info("google_session", "gtalk_xfer_send_session_initiate] session->session_data's address : %u\n",session->session_data);
js->google_share_sessions = g_list_prepend(js->google_share_sessions, session);
@@ -2400,7 +2336,7 @@ gtalk_xfer_accept_cb(JabberStream *js, c
if (type != JABBER_IQ_RESULT) {
purple_debug_info("google_session", "Our Accept Request was REJECTED by Gtalk?. Should Abort.\n");
share_session->xfer->status = PURPLE_XFER_STATUS_CANCEL_REMOTE;
More information about the Commits
mailing list