Diff between 0f10ac2b8c79f9e5eb49e9f8db023e30cdba93b4 and 007d9e39f648e52cd140aa44bf441a1fa211b4dc

Changed Files

File Additions Deletions Status
gobex/gobex-packet.c +5 -3 modified
gobex/gobex-packet.h +0 -2 modified
gobex/gobex.c +3 -1 modified

Full Patch

diff --git a/gobex/gobex-packet.c b/gobex/gobex-packet.c
index 6ac77bf..94b3024 100644
--- a/gobex/gobex-packet.c
+++ b/gobex/gobex-packet.c
@@ -24,6 +24,8 @@
 
 #include "gobex-packet.h"
 
+#define FINAL_BIT 0x80
+
 struct _GObexPacket {
 	guint8 opcode;
 	gboolean final;
@@ -209,8 +211,8 @@ GObexPacket *g_obex_packet_decode(const void *data, gsize len,
 		return NULL;
 	}
 
-	final = (opcode & G_OBEX_PACKET_FINAL) ? TRUE : FALSE;
-	opcode &= ~G_OBEX_PACKET_FINAL;
+	final = (opcode & FINAL_BIT) ? TRUE : FALSE;
+	opcode &= ~FINAL_BIT;
 
 	pkt = g_obex_packet_new(opcode, final);
 
@@ -251,7 +253,7 @@ gssize g_obex_packet_encode(GObexPacket *pkt, guint8 *buf, gsize len)
 
 	buf[0] = pkt->opcode;
 	if (pkt->final)
-		buf[0] |= G_OBEX_PACKET_FINAL;
+		buf[0] |= FINAL_BIT;
 
 	u16 = g_htons(pkt_len);
 	memcpy(&buf[1], &u16, sizeof(u16));
diff --git a/gobex/gobex-packet.h b/gobex/gobex-packet.h
index 38a8ff2..40580cb 100644
--- a/gobex/gobex-packet.h
+++ b/gobex/gobex-packet.h
@@ -36,8 +36,6 @@
 #define G_OBEX_OP_SESSION	0x07
 #define G_OBEX_OP_ABORT		0x7f
 
-#define G_OBEX_PACKET_FINAL	0x80
-
 typedef struct _GObexPacket GObexPacket;
 
 GObexHeader *g_obex_packet_get_header(GObexPacket *pkt, guint8 id);
diff --git a/gobex/gobex.c b/gobex/gobex.c
index be4fc5f..1c1f413 100644
--- a/gobex/gobex.c
+++ b/gobex/gobex.c
@@ -28,6 +28,8 @@
 #define G_OBEX_MINIMUM_MTU	255
 #define G_OBEX_MAXIMUM_MTU	65535
 
+#define FINAL_BIT		0x80
+
 struct _GObex {
 	gint ref_count;
 	GIOChannel *io;
@@ -402,7 +404,7 @@ static gboolean incoming_data(GIOChannel *io, GIOCondition cond,
 		guint8 opcode = g_obex_packet_get_operation(p->pkt, NULL);
 		header_offset = req_header_offset(opcode);
 	} else {
-		guint8 opcode = obex->rx_buf[0] & ~G_OBEX_PACKET_FINAL;
+		guint8 opcode = obex->rx_buf[0] & ~FINAL_BIT;
 		header_offset = rsp_header_offset(opcode);
 	}