changeset 31566:9ccbd0302bb2

Change MsnFileContext variables from "header" to "context". This it totally superfluous, but I don't like seeing that code if I'm looking for header stuff.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Thu, 06 Jan 2011 05:51:03 +0000
parents 3824f34c93d9
children d143f52ae28e
files libpurple/protocols/msn/slp.c libpurple/protocols/msn/slpcall.c libpurple/protocols/msn/xfer.c libpurple/protocols/msn/xfer.h
diffstat 4 files changed, 61 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/slp.c	Thu Jan 06 05:35:23 2011 +0000
+++ b/libpurple/protocols/msn/slp.c	Thu Jan 06 05:51:03 2011 +0000
@@ -293,7 +293,7 @@
 gen_context(PurpleXfer *xfer, const char *file_name, const char *file_path)
 {
 	gsize size = 0;
-	MsnFileContext header;
+	MsnFileContext context;
 	gchar *u8 = NULL;
 	gchar *ret;
 	gunichar2 *uni = NULL;
@@ -323,28 +323,28 @@
 
 	preview = purple_xfer_get_thumbnail(xfer, &preview_len);
 
-	header.length = MSN_FILE_CONTEXT_SIZE;
-	header.version = 2; /* V.3 contains additional unnecessary data */
-	header.file_size = size;
+	context.length = MSN_FILE_CONTEXT_SIZE;
+	context.version = 2; /* V.3 contains additional unnecessary data */
+	context.file_size = size;
 	if (preview)
-		header.type = 0;
+		context.type = 0;
 	else
-		header.type = 1;
+		context.type = 1;
 
 	len = MIN(len, MAX_FILE_NAME_LEN);
 	for (currentChar = 0; currentChar < len; currentChar++) {
-		header.file_name[currentChar] = GUINT16_TO_LE(uni[currentChar]);
+		context.file_name[currentChar] = GUINT16_TO_LE(uni[currentChar]);
 	}
-	memset(&header.file_name[currentChar], 0x00, (MAX_FILE_NAME_LEN - currentChar) * 2);
+	memset(&context.file_name[currentChar], 0x00, (MAX_FILE_NAME_LEN - currentChar) * 2);
 
-	memset(&header.unknown1, 0, sizeof(header.unknown1));
-	header.unknown2 = 0xffffffff;
+	memset(&context.unknown1, 0, sizeof(context.unknown1));
+	context.unknown2 = 0xffffffff;
 
 	/* Mind the cast, as in, don't free it after! */
-	header.preview = (char *)preview;
-	header.preview_len = preview_len;
+	context.preview = (char *)preview;
+	context.preview_len = preview_len;
 
-	u8 = msn_file_context_to_wire(&header);
+	u8 = msn_file_context_to_wire(&context);
 	ret = purple_base64_encode((const guchar *)u8, MSN_FILE_CONTEXT_SIZE + preview_len);
 
 	g_free(uni);
--- a/libpurple/protocols/msn/slpcall.c	Thu Jan 06 05:35:23 2011 +0000
+++ b/libpurple/protocols/msn/slpcall.c	Thu Jan 06 05:51:03 2011 +0000
@@ -511,7 +511,7 @@
 		/* File Transfer */
 		PurpleAccount *account;
 		PurpleXfer *xfer;
-		MsnFileContext *header;
+		MsnFileContext *file_context;
 		char *buf;
 		gsize bin_len;
 		guint32 file_size;
@@ -528,12 +528,12 @@
 							 slpcall->slplink->remote_user);
 
 		buf = (char *)purple_base64_decode(context, &bin_len);
-		header = msn_file_context_from_wire(buf, bin_len);
+		file_context = msn_file_context_from_wire(buf, bin_len);
 
-		if (header != NULL) {
-			file_size = header->file_size;
+		if (file_context != NULL) {
+			file_size = file_context->file_size;
 
-			file_name = g_convert((const gchar *)&header->file_name,
+			file_name = g_convert((const gchar *)&file_context->file_name,
 			                      MAX_FILE_NAME_LEN * 2,
 			                      "UTF-8", "UTF-16LE",
 			                      NULL, NULL, NULL);
@@ -554,16 +554,16 @@
 
 			xfer->data = slpcall;
 
-			if (header->preview) {
-				purple_xfer_set_thumbnail(xfer, header->preview,
-				                          header->preview_len,
+			if (file_context->preview) {
+				purple_xfer_set_thumbnail(xfer, file_context->preview,
+				                          file_context->preview_len,
 				    					  "image/png");
-				g_free(header->preview);
+				g_free(file_context->preview);
 			}
 
 			purple_xfer_request(xfer);
 		}
-		g_free(header);
+		g_free(file_context);
 		g_free(buf);
 
 		accepted = TRUE;
--- a/libpurple/protocols/msn/xfer.c	Thu Jan 06 05:35:23 2011 +0000
+++ b/libpurple/protocols/msn/xfer.c	Thu Jan 06 05:51:03 2011 +0000
@@ -162,25 +162,25 @@
 }
 
 gchar *
-msn_file_context_to_wire(MsnFileContext *header)
+msn_file_context_to_wire(MsnFileContext *context)
 {
 	gchar *ret, *tmp;
 
-	tmp = ret = g_new(gchar, MSN_FILE_CONTEXT_SIZE + header->preview_len + 1);
+	tmp = ret = g_new(gchar, MSN_FILE_CONTEXT_SIZE + context->preview_len + 1);
 
-	msn_push32le(tmp, header->length);
-	msn_push32le(tmp, header->version);
-	msn_push64le(tmp, header->file_size);
-	msn_push32le(tmp, header->type);
-	memcpy(tmp, header->file_name, MAX_FILE_NAME_LEN * 2);
+	msn_push32le(tmp, context->length);
+	msn_push32le(tmp, context->version);
+	msn_push64le(tmp, context->file_size);
+	msn_push32le(tmp, context->type);
+	memcpy(tmp, context->file_name, MAX_FILE_NAME_LEN * 2);
 	tmp += MAX_FILE_NAME_LEN * 2;
-	memcpy(tmp, header->unknown1, sizeof(header->unknown1));
-	tmp += sizeof(header->unknown1);
-	msn_push32le(tmp, header->unknown2);
-	if (header->preview) {
-		memcpy(tmp, header->preview, header->preview_len);
+	memcpy(tmp, context->unknown1, sizeof(context->unknown1));
+	tmp += sizeof(context->unknown1);
+	msn_push32le(tmp, context->unknown2);
+	if (context->preview) {
+		memcpy(tmp, context->preview, context->preview_len);
 	}
-	tmp[header->preview_len] = '\0';
+	tmp[context->preview_len] = '\0';
 
 	return ret;
 }
@@ -188,48 +188,48 @@
 MsnFileContext *
 msn_file_context_from_wire(const char *buf, gsize len)
 {
-	MsnFileContext *header;
+	MsnFileContext *context;
 
 	if (!buf || len < MSN_FILE_CONTEXT_SIZE)
 		return NULL;
 
-	header = g_new(MsnFileContext, 1);
+	context = g_new(MsnFileContext, 1);
 
-	header->length = msn_pop32le(buf);
-	header->version = msn_pop32le(buf);
-	if (header->version == 2) {
+	context->length = msn_pop32le(buf);
+	context->version = msn_pop32le(buf);
+	if (context->version == 2) {
 		/* The length field is broken for this version. No check. */
-		header->length = MSN_FILE_CONTEXT_SIZE;
-	} else if (header->version == 3) {
-		if (header->length != MSN_FILE_CONTEXT_SIZE + 63) {
-			g_free(header);
+		context->length = MSN_FILE_CONTEXT_SIZE;
+	} else if (context->version == 3) {
+		if (context->length != MSN_FILE_CONTEXT_SIZE + 63) {
+			g_free(context);
 			return NULL;
 		} else if (len < MSN_FILE_CONTEXT_SIZE + 63) {
-			g_free(header);
+			g_free(context);
 			return NULL;
 		}
 	} else {
-		purple_debug_warning("msn", "Received MsnFileContext with unknown version: %d\n", header->version);
-		g_free(header);
+		purple_debug_warning("msn", "Received MsnFileContext with unknown version: %d\n", context->version);
+		g_free(context);
 		return NULL;
 	}
 
-	header->file_size = msn_pop64le(buf);
-	header->type = msn_pop32le(buf);
-	memcpy(header->file_name, buf, MAX_FILE_NAME_LEN * 2);
+	context->file_size = msn_pop64le(buf);
+	context->type = msn_pop32le(buf);
+	memcpy(context->file_name, buf, MAX_FILE_NAME_LEN * 2);
 	buf += MAX_FILE_NAME_LEN * 2;
-	memcpy(header->unknown1, buf, sizeof(header->unknown1));
-	buf += sizeof(header->unknown1);
-	header->unknown2 = msn_pop32le(buf);
+	memcpy(context->unknown1, buf, sizeof(context->unknown1));
+	buf += sizeof(context->unknown1);
+	context->unknown2 = msn_pop32le(buf);
 
-	if (header->type == 0 && len > header->length) {
-		header->preview_len = len - header->length;
-		header->preview = g_memdup(buf, header->preview_len);
+	if (context->type == 0 && len > context->length) {
+		context->preview_len = len - context->length;
+		context->preview = g_memdup(buf, context->preview_len);
 	} else {
-		header->preview_len = 0;
-		header->preview = NULL;
+		context->preview_len = 0;
+		context->preview = NULL;
 	}
 
-	return header;
+	return context;
 }
 
--- a/libpurple/protocols/msn/xfer.h	Thu Jan 06 05:35:23 2011 +0000
+++ b/libpurple/protocols/msn/xfer.h	Thu Jan 06 05:51:03 2011 +0000
@@ -56,7 +56,7 @@
 void msn_xfer_end_cb(MsnSlpCall *slpcall, MsnSession *session);
 
 gchar *
-msn_file_context_to_wire(MsnFileContext *header);
+msn_file_context_to_wire(MsnFileContext *context);
 
 MsnFileContext *
 msn_file_context_from_wire(const char *buf, gsize len);