Hi,

I did compile latest CVS with
-O3 -g -std=c99 -pedantic -W -Wall

and fixed all warnings that came up. The attached patch is a proposal only as 
it touches many files. It breaks the previously posted win32 patchset.
And it definitely needs a second pair of eyes on it!

Have fun :)

HS
Index: openobex-anoncvs/lib/btobex.c
===================================================================
--- openobex-anoncvs.orig/lib/btobex.c	2007-01-28 23:11:04.245397148 +0100
+++ openobex-anoncvs/lib/btobex.c	2007-01-28 23:11:56.184643148 +0100
@@ -115,28 +115,28 @@
 int btobex_listen(obex_t *self)
 {
 #ifndef _WIN32
-	DEBUG(3, "\n");
+	DEBUG(3, "", 0);
 
 	self->serverfd = obex_create_socket(self, AF_BLUETOOTH);
 	if(self->serverfd < 0) {
-		DEBUG(0, "Error creating socket\n");
+		DEBUG(0, "%s", "Error creating socket");
 		return -1;
 	}
 	
 	if (bind(self->serverfd, (struct sockaddr*) &self->trans.self.rfcomm, 
 		 sizeof(struct sockaddr_rc)))
 	{
-		DEBUG(0, "Error doing bind\n");
+		DEBUG(0, "%s", "Error doing bind");
 		goto out_freesock;
 	}
 
 
 	if (listen(self->serverfd, 1)) {
-		DEBUG(0, "Error doing listen\n");
+		DEBUG(0, "%s", "Error doing listen");
 		goto out_freesock;
 	}
 
-	DEBUG(4, "We are now listening for connections\n");
+	DEBUG(4, "%s", "We are now listening for connections");
 	return 1;
 
 out_freesock:
@@ -187,7 +187,7 @@
 	int mtu = 0;
 	//int len = sizeof(int);
 
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	if(self->fd < 0)	{
 		self->fd = obex_create_socket(self, AF_BLUETOOTH);
@@ -234,7 +234,7 @@
 {
 	int ret;
 #ifndef _WIN32
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 	ret = obex_delete_socket(self, self->fd);
 	if(ret < 0)
 		return ret;
@@ -255,7 +255,7 @@
 {
 	int ret;
 #ifndef _WIN32
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 	ret = obex_delete_socket(self, self->serverfd);
 	self->serverfd = -1;
 #endif /* _WIN32 */
Index: openobex-anoncvs/lib/databuffer.c
===================================================================
--- openobex-anoncvs.orig/lib/databuffer.c	2007-01-28 22:34:50.977576398 +0100
+++ openobex-anoncvs/lib/databuffer.c	2007-01-28 22:37:32.439667148 +0100
@@ -110,13 +110,13 @@
 void buf_resize(buf_t *p, size_t new_size) 
 {
 	uint8_t *tmp;
-	int bSize;
+	size_t bSize;
 
 	if (!p)
 		return;
 	bSize = buf_total_size(p);
 	if (new_size < bSize) {
-		int itRem = bSize - new_size;
+		size_t itRem = bSize - new_size;
 		if (itRem > p->data_avail) {
 			itRem -= p->data_avail;
 			p->data_avail = 0;
@@ -191,7 +191,7 @@
 		return p->buffer + p->head_avail;
 	} else {
 		if (data_size > p->head_avail + p->data_avail) {
-			int tmp;
+			size_t tmp;
 			tmp = p->data_avail;
 			buf_resize(p, buf_total_size(p) + data_size -
 			                    p->head_avail - p->data_avail);
@@ -218,7 +218,7 @@
 		p->tail_avail -= data_size;
 	else {
 		if (data_size > p->tail_avail + p->data_avail) {
-			int tmp;
+			size_t tmp;
 			tmp = p->data_avail;
 			buf_resize(p, buf_total_size(p) + data_size -
 			                    p->tail_avail - p->data_avail);
@@ -284,15 +284,15 @@
 {
 	if (!p || !label)
 		return;
-	int i, n;
+	size_t i = 0;
+	unsigned long n = 0;
 
-	n = 0;
-	for (i = 0; i < p->data_size; ++i) {
+	for (; i < p->data_size; ++i) {
 		if (n == 0)
 			log_debug("%s%s:", log_debug_prefix, label);
 		log_debug(" %02X", p->data[i]);
 		if (n >= 25 || i == p->data_size - 1) {
-			log_debug("\n");
+			log_debug("\n", 0);
 			n = 0;
 		} else
 			n++;
Index: openobex-anoncvs/lib/inobex.c
===================================================================
--- openobex-anoncvs.orig/lib/inobex.c	2007-01-28 23:08:35.504101398 +0100
+++ openobex-anoncvs/lib/inobex.c	2007-01-28 23:10:33.335465398 +0100
@@ -86,7 +86,7 @@
  *    Prepare for INET-connect
  *
  */
-void inobex_prepare_connect(obex_t *self, struct sockaddr *saddr, int addrlen)
+void inobex_prepare_connect(obex_t *self, struct sockaddr *saddr, int __unused addrlen)
 {
 	struct sockaddr_in6 addr = {
 		.sin6_family       = AF_INET6,
@@ -120,7 +120,7 @@
  *    Prepare for INET-listen
  *
  */
-void inobex_prepare_listen(obex_t *self, struct sockaddr *saddr, int addrlen)
+void inobex_prepare_listen(obex_t *self, struct sockaddr *saddr, int __unused addrlen)
 {
 	struct sockaddr_in6 addr = {
 		.sin6_family       = AF_INET6,
@@ -157,11 +157,11 @@
  */
 int inobex_listen(obex_t *self)
 {
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	self->serverfd = obex_create_socket(self, AF_INET6);
 	if(self->serverfd < 0) {
-		DEBUG(0, "Cannot create server-socket\n");
+		DEBUG(0, "%s", "Cannot create server-socket.");
 		return -1;
 	}
 #ifdef IPV6_V6ONLY
@@ -180,12 +180,12 @@
 	//       self->trans.self.inet.sin_addr.s_addr);
 	if (bind(self->serverfd, (struct sockaddr *) &self->trans.self.inet6,
 						sizeof(struct sockaddr_in6))) {
-		DEBUG(0, "bind() Failed\n");
+		DEBUG(0, "%s", "bind() Failed");
 		return -1;
 	}
 
 	if (listen(self->serverfd, 2)) {
-		DEBUG(0, "listen() Failed\n");
+		DEBUG(0, "%s", "listen() Failed");
 		return -1;
 	}
 
@@ -240,25 +240,25 @@
 #ifndef _WIN32
 	if (!inet_ntop(AF_INET6,&self->trans.peer.inet6.sin6_addr,
 		       addr,sizeof(addr))) {
-		DEBUG(4, "Adress problem\n");
+		DEBUG(4, "%s", "Adress problem:");
 		obex_delete_socket(self, self->fd);
 		self->fd = -1;
 		return -1;
 	}
-	DEBUG(2, "peer addr = [%s]:%u\n",addr,ntohs(self->trans.peer.inet6.sin6_port));
+	DEBUG(2, "peer addr = [%s]:%u",addr,ntohs(self->trans.peer.inet6.sin6_port));
 #endif
 
 	ret = connect(self->fd, (struct sockaddr *) &self->trans.peer.inet6,
 		      sizeof(struct sockaddr_in6));
 	if (ret < 0) {
-		DEBUG(4, "Connect failed\n");
+		DEBUG(4, "%s", "Connect failed:");
 		obex_delete_socket(self, self->fd);
 		self->fd = -1;
 		return ret;
 	}
 
 	self->trans.mtu = OBEX_DEFAULT_MTU;
-	DEBUG(3, "transport mtu=%d\n", self->trans.mtu);
+	DEBUG(3, "transport mtu=%d", self->trans.mtu);
 
 	return ret;
 }
@@ -272,7 +272,7 @@
 int inobex_disconnect_request(obex_t *self)
 {
 	int ret;
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 	ret = obex_delete_socket(self, self->fd);
 	if(ret < 0)
 		return ret;
@@ -291,7 +291,7 @@
 int inobex_disconnect_server(obex_t *self)
 {
 	int ret;
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 	ret = obex_delete_socket(self, self->serverfd);
 	self->serverfd = -1;
 	return ret;	
Index: openobex-anoncvs/lib/irobex.c
===================================================================
--- openobex-anoncvs.orig/lib/irobex.c	2007-01-28 23:02:33.049449398 +0100
+++ openobex-anoncvs/lib/irobex.c	2007-01-28 23:07:38.116514898 +0100
@@ -128,18 +128,18 @@
  */
 int irobex_listen(obex_t *self)
 {
-	DEBUG(3, "\n");
+	DEBUG(3, "", 0);
 
 	self->serverfd = obex_create_socket(self, AF_IRDA);
 	if(self->serverfd < 0) {
-		DEBUG(0, "Error creating socket\n");
+		DEBUG(0, "%s", "Error creating socket");
 		return -1;
 	}
 	
 	if (bind(self->serverfd, (struct sockaddr*) &self->trans.self.irda, 
 		 sizeof(struct sockaddr_irda)))
 	{
-		DEBUG(0, "Error doing bind\n");
+		DEBUG(0, "%s", "Error doing bind");
 		goto out_freesock;
 	}
 
@@ -166,11 +166,11 @@
 #endif /* _WIN32 */
 
 	if (listen(self->serverfd, 1)) {
-		DEBUG(0, "Error doing listen\n");
+		DEBUG(0, "%s", "Error doing listen");
 		goto out_freesock;
 	}
 
-	DEBUG(4, "We are now listening for connections\n");
+	DEBUG(4, "%s", "We are now listening for connections");
 	return 1;
 
 out_freesock:
@@ -237,7 +237,7 @@
 	int ret = -1;
 	int err;
 	socklen_t len;
-	int i;
+	size_t i;
 
 #ifndef _WIN32
 	/* Hint bit filtering. Linux case */
@@ -263,19 +263,19 @@
 
 	/* Perform a discovery and get device list */
 	if (getsockopt(self->fd, SOL_IRLMP, IRLMP_ENUMDEVICES, buf, &len)) {
-		DEBUG(1, "Didn't find any devices!\n");
+		DEBUG(1, "%s", "Didn't find any devices!");
 		return(-1);
 	}
 
 #ifndef _WIN32
 	/* Did we get any ? (in some rare cases, this test is true) */
 	if (list->len <= 0) {
-		DEBUG(1, "Didn't find any devices!\n");
+		DEBUG(1, "%s", "Didn't find any devices!");
 		return(-1);
 	}
 
 	/* List all Obex devices : Linux case */
-	DEBUG(1, "Discovered %d devices :\n", list->len);
+	DEBUG(1, "Discovered %d devices:", list->len);
 	for(i = 0; i < list->len; i++) {
 		DEBUG(1, "  [%d] name:  %s, daddr: 0x%08x",
 		      i + 1, list->dev[i].info, list->dev[i].daddr);
@@ -296,9 +296,9 @@
 			/* Check if we failed */
 			if(err != 0) {
 				if(errno != EADDRNOTAVAIL) {
-					DEBUG(1, " <can't query IAS>\n");
+					DEBUG(1, "%s", "Cannot query IAS.");
 				} else {
-					DEBUG(1, ", doesn't have %s\n",
+					DEBUG(1, "Doesn't have %s",
 					      self->trans.peer.irda.sir_name);
 				}
 				/* Go back to for(;;) */
@@ -308,7 +308,7 @@
 			      self->trans.peer.irda.sir_name);
 		}
 		else {
-			DEBUG(1, "\n");
+			DEBUG(1, "", 0);
 		}
 
 		/* Pick this device */
@@ -321,7 +321,7 @@
 	if (len > 0) {
 		DEBUG(1, "Discovered: (list len=%d)\n", list->numDevice);
 
-		for (i=0; i<(int)list->numDevice; i++) {
+		for (i = 0; i < list->numDevice; i++) {
 			DEBUG(1, "  name:  %s\n", list->Device[i].irdaDeviceName);
 			DEBUG(1, "  daddr: %08x\n", list->Device[i].irdaDeviceID);
 			memcpy(&self->trans.peer.irda.irdaDeviceID[0], &list->Device[i].irdaDeviceID[0], 4);
@@ -331,7 +331,7 @@
 #endif /* _WIN32 */
 
 	if(ret <  0)
-		DEBUG(1, "didn't find any OBEX devices!\n");
+		DEBUG(1, "%s", "Didn't find any OBEX devices!");
 	return(ret);
 }
 
@@ -347,7 +347,7 @@
 	socklen_t len = sizeof(int);
 	int ret;
 
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	if(self->fd < 0)	{
 		self->fd = obex_create_socket(self, AF_IRDA);
@@ -361,7 +361,7 @@
 		/* Nope. Go find one... */
 		ret = irobex_discover_devices(self);
 		if (ret < 0)	{
-			DEBUG(1, "No devices in range\n");
+			DEBUG(1, "%s", "No devices in range.");
 			goto out_freesock;
 		}
 	}
@@ -404,7 +404,7 @@
 int irobex_disconnect_request(obex_t *self)
 {
 	int ret;
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 	ret = obex_delete_socket(self, self->fd);
 	if(ret < 0)
 		return ret;
@@ -423,7 +423,7 @@
 int irobex_disconnect_server(obex_t *self)
 {
 	int ret;
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 	ret = obex_delete_socket(self, self->serverfd);
 	self->serverfd = -1;
 	return ret;	
Index: openobex-anoncvs/lib/obex.c
===================================================================
--- openobex-anoncvs.orig/lib/obex.c	2007-01-28 22:11:33.290226398 +0100
+++ openobex-anoncvs/lib/obex.c	2007-01-28 22:30:56.846944148 +0100
@@ -273,7 +273,7 @@
 {
 	obex_return_val_if_fail(self != NULL, -EFAULT);
 	if (self->object)	{
-		DEBUG(1, "We are busy.\n");
+		DEBUG(1, "%s", "We are busy.");
 		return -EBUSY;
 	}
 
@@ -313,7 +313,7 @@
  */
 int OBEX_ServerRegister(obex_t *self, struct sockaddr *saddr, int addrlen)
 {
-	DEBUG(3, "\n");
+	DEBUG(3, "", 0);
 
 	obex_return_val_if_fail(self != NULL, -1);
 	obex_return_val_if_fail((addrlen == 0) || (saddr != NULL), -1);
@@ -347,7 +347,7 @@
 {
 	obex_t *self;
 
-	DEBUG(3, "\n");
+	DEBUG(3, "", 0);
 
 	obex_return_val_if_fail(server != NULL, NULL);
 
@@ -433,7 +433,7 @@
  */
 int OBEX_HandleInput(obex_t *self, int timeout)
 {
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 	obex_return_val_if_fail(self != NULL, -1);
 	return obex_transport_handle_input(self, timeout);
 }
@@ -447,7 +447,7 @@
  */
 int OBEX_CustomDataFeed(obex_t *self, uint8_t *inputbuf, int actual)
 {
-	DEBUG(3, "\n");
+	DEBUG(3, "", 0);
 
 	obex_return_val_if_fail(self != NULL, -1);
 	obex_return_val_if_fail(inputbuf != NULL, -1);
@@ -466,7 +466,7 @@
  */
 int OBEX_TransportConnect(obex_t *self, struct sockaddr *saddr, int addrlen)
 {
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	obex_return_val_if_fail(self != NULL, -1);
 	obex_return_val_if_fail((addrlen == 0) || (saddr != NULL), -1);
@@ -483,7 +483,7 @@
  */
 int OBEX_TransportDisconnect(obex_t *self)
 {
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	obex_return_val_if_fail(self != NULL, -1);
 	obex_transport_disconnect_request(self);
@@ -525,12 +525,12 @@
  */
 int OBEX_Request(obex_t *self, obex_object_t *object)
 {
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	obex_return_val_if_fail(self != NULL, -1);
 
 	if (self->object)	{
-		DEBUG(1, "We are busy.\n");
+		DEBUG(1, "%s", "We are busy.");
 		return -EBUSY;
 	}
 
@@ -615,7 +615,7 @@
  * Note that as soon as you have passed an object to the lib using
  * OBEX_Request(), you shall not delete it yourself.
  */
-int OBEX_ObjectDelete(obex_t *self, obex_object_t *object)
+int OBEX_ObjectDelete(obex_t __unused *self, obex_object_t *object)
 {
 	obex_return_val_if_fail(object != NULL, -1);
 	return obex_object_delete(object);
@@ -833,7 +833,7 @@
 int OBEX_UnicodeToChar(uint8_t *c, const uint8_t *uc, int size)
 {
 	int n;
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 		
 	obex_return_val_if_fail(uc != NULL, -1);
 	obex_return_val_if_fail(c != NULL, -1);
@@ -860,7 +860,7 @@
 int OBEX_CharToUnicode(uint8_t *uc, const uint8_t *c, int size)
 {
 	int len, n;
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	obex_return_val_if_fail(uc != NULL, -1);
 	obex_return_val_if_fail(c != NULL, -1);
@@ -887,7 +887,7 @@
  */
 char *OBEX_ResponseToString(int rsp)
 {
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	return obex_response_to_string(rsp);
 }
@@ -899,9 +899,9 @@
  *
  * The returned char must not be freed. Returns %NULL on error.
  */
-char* OBEX_GetResponseMessage(obex_t *self, int rsp)
+char* OBEX_GetResponseMessage(obex_t __unused *self, int rsp)
 {
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	return obex_response_to_string(rsp);
 }
@@ -955,7 +955,7 @@
  */
 int TcpOBEX_ServerRegister(obex_t *self, struct sockaddr *addr, int addrlen)
 {
-	DEBUG(3, "\n");
+	DEBUG(3, "", 0);
 
 	errno = EINVAL;
 	obex_return_val_if_fail(self != NULL, -1);
@@ -977,13 +977,13 @@
  */
 int TcpOBEX_TransportConnect(obex_t *self, struct sockaddr *addr, int addrlen)
 {
-     	DEBUG(4, "\n");
+     	DEBUG(4, "", 0);
 
 	errno = EINVAL;
 	obex_return_val_if_fail(self != NULL, -1);
 
 	if (self->object)	{
-		DEBUG(1, "We are busy.\n");
+		DEBUG(1, "%s", "We are busy.");
 		errno = EBUSY;
 		return -1;
 	}
@@ -1003,7 +1003,7 @@
  */
 int InOBEX_ServerRegister(obex_t *self)
 {
-	DEBUG(3, "\n");
+	DEBUG(3, "", 0);
 
 	return TcpOBEX_ServerRegister(self, NULL, 0);
 }
@@ -1022,13 +1022,13 @@
  */
 int InOBEX_TransportConnect(obex_t *self, struct sockaddr *saddr, int addrlen)
 {
-     	DEBUG(4, "\n");
+     	DEBUG(4, "", 0);
 
 	errno = EINVAL;
 	obex_return_val_if_fail(self != NULL, -1);
 
 	if (self->object)	{
-		DEBUG(1, "We are busy.\n");
+		DEBUG(1, "%s", "We are busy.");
 		errno = EBUSY;
 		return -1;
 	}
@@ -1050,7 +1050,7 @@
  */
 int IrOBEX_ServerRegister(obex_t *self, const char *service)
 {
-	DEBUG(3, "\n");
+	DEBUG(3, "", 0);
 
 	obex_return_val_if_fail(self != NULL, -1);
 	obex_return_val_if_fail(service != NULL, -1);
@@ -1072,12 +1072,12 @@
  */
 int IrOBEX_TransportConnect(obex_t *self, const char *service)
 {
-     	DEBUG(4, "\n");
+     	DEBUG(4, "", 0);
 
 	obex_return_val_if_fail(self != NULL, -1);
 
 	if (self->object)	{
-		DEBUG(1, "We are busy.\n");
+		DEBUG(1, "%s", "We are busy.");
 		return -EBUSY;
 	}
 
@@ -1101,7 +1101,7 @@
  */
 int BtOBEX_ServerRegister(obex_t *self, bdaddr_t *src, uint8_t channel)
 {
-	DEBUG(3, "\n");
+	DEBUG(3, "", 0);
 
 	obex_return_val_if_fail(self != NULL, -1);
 
@@ -1124,12 +1124,12 @@
  */
 int BtOBEX_TransportConnect(obex_t *self, bdaddr_t *src, bdaddr_t *dst, uint8_t channel)
 {
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	obex_return_val_if_fail(self != NULL, -1);
 
 	if (self->object)	{
-		DEBUG(1, "We are busy.\n");
+		DEBUG(1, "%s", "We are busy.");
 		return -EBUSY;
 	}
 
@@ -1155,12 +1155,12 @@
  */
 int FdOBEX_TransportSetup(obex_t *self, int rfd, int wfd, int mtu)
 {
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	obex_return_val_if_fail(self != NULL, -1);
 
 	if (self->object)	{
-		DEBUG(1, "We are busy.\n");
+		DEBUG(1, "%s", "We are busy.");
 		return -EBUSY;
 	}
 	self->fd = rfd;
@@ -1179,12 +1179,12 @@
  */
 int OBEX_InterfaceConnect(obex_t *self, obex_interface_t *intf)
 {
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	obex_return_val_if_fail(self != NULL, -1);
 
 	if (self->object) {
-		DEBUG(1, "We are busy.\n");
+		DEBUG(1, "%s", "We are busy.");
 		return -EBUSY;
 	}
 
@@ -1212,7 +1212,7 @@
  */
 int OBEX_FindInterfaces(obex_t *self, obex_interface_t **interfaces)
 {
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	obex_return_val_if_fail(self != NULL, -1);
 	
@@ -1240,7 +1240,7 @@
  */
 void OBEX_FreeInterfaces(obex_t *self)
 {
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	obex_return_if_fail(self != NULL);
 	
Index: openobex-anoncvs/lib/obex_client.c
===================================================================
--- openobex-anoncvs.orig/lib/obex_client.c	2007-01-28 23:00:43.158581648 +0100
+++ openobex-anoncvs/lib/obex_client.c	2007-01-28 23:05:22.932066398 +0100
@@ -44,12 +44,12 @@
  *    Handle client operations
  *
  */
-int obex_client(obex_t *self, buf_t *msg, int final)
+int obex_client(obex_t *self, buf_t *msg, int __unused final)
 {
 	obex_common_hdr_t *response = NULL;
 	int rsp = OBEX_RSP_BAD_REQUEST, ret;
 	
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	/* If this is a response we have some data in msg */
 	if(msg) {
@@ -61,12 +61,12 @@
 	{
 	case STATE_SEND:
 		/* In progress of sending request */
-		DEBUG(4, "STATE_SEND\n");
+		DEBUG(4, "%s", "STATE_SEND");
 		
 		/* Any errors from peer? Win2k will send RSP_SUCCESS after
 		   every fragment sent so we have to accept that too.*/
 		if(rsp != OBEX_RSP_SUCCESS && rsp != OBEX_RSP_CONTINUE) {
-			DEBUG(0, "STATE_SEND. request not accepted.\n");
+			DEBUG(0, "%s", "STATE_SEND. request not accepted.");
 			obex_deliver_event(self, OBEX_EV_REQDONE, self->object->opcode, rsp, TRUE);
 			/* This is not an Obex error, it is just that the peer
 			 * doesn't accept the request, so return 0 - Jean II */
@@ -111,7 +111,7 @@
 	
 	case STATE_START:
 		/* Nothing has been sent yet */
-		DEBUG(4, "STATE_START\n");
+		DEBUG(4, "%s", "STATE_START");
 		
 		ret = obex_object_send(self, self->object, TRUE, FALSE);
 		if(ret < 0) {
@@ -134,11 +134,11 @@
 			
 	case STATE_REC:
 		/* Receiving answer of request */
-		DEBUG(4, "STATE_REC\n");
+		DEBUG(4, "%s", "STATE_REC");
 		
 		/* Response of a CMD_CONNECT needs some special treatment.*/
 		if(self->object->opcode == OBEX_CMD_CONNECT)	{
-			DEBUG(2, "We expect a connect-rsp\n");
+			DEBUG(2, "%s", "We expect a connect-rsp");
 			if(obex_parse_connect_header(self, msg) < 0)	{
 				self->state = MODE_SRV | STATE_IDLE;
 				obex_deliver_event(self, OBEX_EV_PARSEERR, self->object->opcode, 0, TRUE);
@@ -149,7 +149,7 @@
 
 		/* So does CMD_DISCONNECT */
 		if(self->object->opcode == OBEX_CMD_DISCONNECT)	{
-			DEBUG(2, "CMD_DISCONNECT done. Resetting MTU!\n");
+			DEBUG(2, "%s", "CMD_DISCONNECT done. Resetting MTU!");
 			self->mtu_tx = OBEX_MINIMUM_MTU;
 		}
 
@@ -162,17 +162,17 @@
 	
 		/* Are we done yet? */
 		if (rsp == OBEX_RSP_CONTINUE) {
-			DEBUG(3, "Continue...\n");
+			DEBUG(3, "%s", "Continue...");
 
 			self->object->continue_received = 1;
 
 			if (self->object->abort) {
-				DEBUG(3, "Ignoring CONTINUE because request was aborted\n");
+				DEBUG(3, "%s", "Ignoring CONTINUE because request was aborted.");
 				break;
 			}
 
 			if (self->object->suspend) {
-				DEBUG(3, "Not sending new request because transfer is suspended\n");
+				DEBUG(3, "%s", "Not sending new request because transfer is suspended.");
 				break;
 			}
 
@@ -198,7 +198,7 @@
 		break;
        	
        	default:
-		DEBUG(0, "Unknown state\n");		
+		DEBUG(0, "%s", "Unknown state");
 		obex_deliver_event(self, OBEX_EV_PARSEERR, rsp, 0, TRUE);
 		return -1;
 	}
Index: openobex-anoncvs/lib/obex_connect.c
===================================================================
--- openobex-anoncvs.orig/lib/obex_connect.c	2007-01-28 22:44:53.079205398 +0100
+++ openobex-anoncvs/lib/obex_connect.c	2007-01-28 22:45:37.169960898 +0100
@@ -51,7 +51,7 @@
 {
 	obex_connect_hdr_t *conn_hdr;
 
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	object->tx_nonhdr_data = buf_new(4);
 	if(!object->tx_nonhdr_data) 
@@ -80,7 +80,7 @@
 	uint8_t opcode;
 	uint16_t length;
 
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	/* Remember opcode and size for later */
 	common_hdr = (obex_common_hdr_t *) msg->data;
@@ -99,7 +99,7 @@
 		flags   = conn_hdr->flags;
 		mtu     = ntohs(conn_hdr->mtu);
 
-		DEBUG(1, "version=%02x\n", version);
+		DEBUG(1, "version=%02x", version);
 
 		/* Limit to some reasonable value (usually OBEX_DEFAULT_MTU) */
 		if(mtu < self->mtu_tx_max)
@@ -107,9 +107,9 @@
 		else
 			self->mtu_tx = self->mtu_tx_max;
 
-		DEBUG(1, "requested MTU=%02x, used MTU=%02x\n", mtu, self->mtu_tx);
+		DEBUG(1, "requested MTU=%02x, used MTU=%02x", mtu, self->mtu_tx);
 		return 1;
 	}
-	DEBUG(1, "Malformed connect-header received\n");
+	DEBUG(1, "%s", "Malformed connect-header received");
 	return -1;
 }
Index: openobex-anoncvs/lib/obex_header.c
===================================================================
--- openobex-anoncvs.orig/lib/obex_header.c	2007-01-28 22:46:04.419663898 +0100
+++ openobex-anoncvs/lib/obex_header.c	2007-01-28 23:53:09.503215898 +0100
@@ -49,7 +49,7 @@
 {
 	struct obex_uint_hdr *hdr;
 
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 	obex_return_val_if_fail(msg != NULL, -1);
 
 	hdr = (struct obex_uint_hdr *) buf_reserve_end(msg, sizeof(struct obex_uint_hdr));
@@ -69,7 +69,7 @@
 {
 	struct obex_ubyte_hdr *hdr;
 
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 	obex_return_val_if_fail(msg != NULL, -1);
 
 	hdr = (struct obex_ubyte_hdr *) buf_reserve_end(msg, sizeof(struct obex_ubyte_hdr));
@@ -90,16 +90,22 @@
 			const uint8_t *text, int size)
 {
 	struct obex_unicode_hdr *hdr;
+	uint8_t *hv;
 
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 	obex_return_val_if_fail(msg != NULL, -1);
 	obex_return_val_if_fail(text != NULL || size == 0, -1);
 
-	hdr = (struct obex_unicode_hdr *) buf_reserve_end(msg, size + sizeof(struct obex_unicode_hdr));
+	hdr = (struct obex_unicode_hdr *) buf_reserve_end(msg, sizeof(struct obex_unicode_hdr));
+	hv = (uint8_t *) buf_reserve_end(msg, size);
+	if (hdr == 0 || hv == 0) {
+		DEBUG(4, "%s", "put failed!");
+		return 0;
+	}
 
 	hdr->hi = opcode;
 	hdr->hl = htons((uint16_t)(size + sizeof(struct obex_unicode_hdr)));
-	memcpy(hdr->hv, text, size);
+	memcpy(hv, text, size);
 
 	return size + sizeof(struct obex_unicode_hdr);
 }
@@ -114,21 +120,22 @@
 			const uint8_t *stream, int size)
 {
 	struct obex_byte_stream_hdr *hdr;
+	uint8_t *hv;
 
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 	obex_return_val_if_fail(msg != NULL, -1);
 	obex_return_val_if_fail(stream != NULL || size == 0, -1);
 	
-	hdr = (struct obex_byte_stream_hdr *) buf_reserve_end(msg, size + sizeof(struct obex_byte_stream_hdr));
-	if (hdr == 0) {
-		DEBUG(4, "put failed!\n");
+	hdr = (struct obex_byte_stream_hdr *) buf_reserve_end(msg, sizeof(struct obex_byte_stream_hdr));
+	hv = (uint8_t *) buf_reserve_end(msg, size);
+	if (hdr == 0 || hv == 0) {
+		DEBUG(4, "%s", "put failed!");
 		return 0;
 	}
 
 	hdr->hi = opcode;
-	hdr->hl = htons(size + sizeof(struct obex_byte_stream_hdr));
-
-	memcpy(hdr->hv, stream, size);
+	hdr->hl = htons((uint16_t)(size + sizeof(struct obex_byte_stream_hdr)));
+	memcpy(hv, stream, size);
 
 	return size + sizeof(struct obex_byte_stream_hdr);
 }
Index: openobex-anoncvs/lib/obex_main.c
===================================================================
--- openobex-anoncvs.orig/lib/obex_main.c	2007-01-28 22:31:55.310597898 +0100
+++ openobex-anoncvs/lib/obex_main.c	2007-01-28 22:34:30.460294148 +0100
@@ -80,10 +80,10 @@
  *    Create socket if needed.
  *
  */
-int obex_create_socket(obex_t *self, int domain)
+int obex_create_socket(obex_t __unused *self, int domain)
 {
 	int fd, proto;
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	proto = 0;
 
@@ -102,11 +102,11 @@
  *    Close socket if opened.
  *
  */
-int obex_delete_socket(obex_t *self, int fd)
+int obex_delete_socket(obex_t __unused *self, int fd)
 {
 	int ret;
 
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	if(fd < 0)
 		return fd;
@@ -249,7 +249,7 @@
 	unsigned int size;
 	int ret;
 	
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	obex_return_val_if_fail(self != NULL, -1);
 
Index: openobex-anoncvs/lib/obex_main.h
===================================================================
--- openobex-anoncvs.orig/lib/obex_main.h	2007-01-28 22:10:27.542117398 +0100
+++ openobex-anoncvs/lib/obex_main.h	2007-01-28 23:16:34.234020148 +0100
@@ -55,6 +55,12 @@
 #define obex_return_if_fail(test)	do { if (!(test)) return; } while(0);
 #define obex_return_val_if_fail(test, val)	do { if (!(test)) return val; } while(0);
 
+#if __GNUC__ >=3
+#define __unused    /[EMAIL PROTECTED]@*/ __attribute__((unused))
+#else
+#define __unused    /[EMAIL PROTECTED]@*/
+#endif
+
 #include <openobex/obex_const.h>
 
 #include "obex_object.h"
@@ -64,11 +70,11 @@
 
 #if defined(OBEX_SYSLOG) && !defined(_WIN32)
 #include <syslog.h>
-#define log_debug(format, args...) syslog(LOG_DEBUG, format, ##args)
+#define log_debug(format, ...) syslog(LOG_DEBUG, format, __VA_ARGS__)
 #define log_debug_prefix "OpenOBEX: "
 #else
 #include <stdio.h>
-#define log_debug(format, args...) fprintf(stderr, format, ##args)
+#define log_debug(format, ...) fprintf(stderr, format, __VA_ARGS__)
 #define log_debug_prefix ""
 #endif
 
@@ -79,11 +85,11 @@
  */
 #if OBEX_DEBUG
 extern int obex_debug;
-#define DEBUG(n, format, args...) \
+#define DEBUG(n, format, ...) \
         if (obex_debug >= (n)) \
-          log_debug("%s%s(): " format, log_debug_prefix, __FUNCTION__, ##args)
+          log_debug("%s%s(): " format "\n", log_debug_prefix, __FUNCTION__, __VA_ARGS__)
 #else
-#define DEBUG(n, format, args...)
+#define DEBUG(n, format, ...)  do {} while(0)
 #endif
 
 
Index: openobex-anoncvs/lib/obex_object.c
===================================================================
--- openobex-anoncvs.orig/lib/obex_object.c	2007-01-28 22:47:39.149584148 +0100
+++ openobex-anoncvs/lib/obex_object.c	2007-01-28 22:54:21.566733648 +0100
@@ -70,7 +70,7 @@
 {
 	struct obex_header_element *h;
 	
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 	while(*q != NULL) {
 	 	h = (*q)->data;
 		*q = slist_remove(*q, h);
@@ -89,7 +89,7 @@
 int obex_object_delete(obex_object_t *object)
 {
 
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 	obex_return_val_if_fail(object != NULL, -1);
 
 	/* Free the headerqueues */
@@ -134,7 +134,7 @@
  */
 int obex_object_setrsp(obex_object_t *object, uint8_t rsp, uint8_t lastrsp)
 {
-	DEBUG(4,"\n");
+	DEBUG(4, "", 0);
 	object->opcode = rsp;
 	object->lastopcode = lastrsp;
 	return 1;
@@ -154,7 +154,7 @@
 	struct obex_header_element *element;
 	unsigned int maxlen;
 
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 	/* End of stream marker */
 	if(flags & OBEX_FL_STREAM_DATAEND)	{
 		if(self->object == NULL)
@@ -176,7 +176,7 @@
 	
 	if(flags & OBEX_FL_FIT_ONE_PACKET)	{
 		/* In this command all headers must fit in one packet! */
-		DEBUG(3, "Fit one packet!\n");
+		DEBUG(3, "%s", "Fit one packet!");
 		maxlen = self->mtu_tx - object->totallen - sizeof(struct obex_common_hdr);
 	}
 	else	{
@@ -193,14 +193,14 @@
 
 	/* Is this a stream? */
 	if(flags & OBEX_FL_STREAM_START) {
-		DEBUG(3, "Adding stream\n");
+		DEBUG(3, "%s", "Adding stream");
 		element->stream = TRUE;
 		object->tx_headerq = slist_append(object->tx_headerq, element);
 		return 1;
 	}
 
 	if (hi == OBEX_HDR_EMPTY) {
-		DEBUG(2, "Empty header\n");
+		DEBUG(2, "%s", "Empty header");
 		object->tx_headerq = slist_append(object->tx_headerq, element);
 		return 1;
 	}
@@ -255,7 +255,7 @@
 	/* Check if you can send this header without violating MTU or OBEX_FIT_ONE_PACKET */
 	if( (element->hi != OBEX_HDR_BODY) || (flags & OBEX_FL_FIT_ONE_PACKET) )	{
 		if(maxlen < element->length)	{
-			DEBUG(0, "Header to big\n");
+			DEBUG(0, "%s", "Header to big");
 			ret = -1;
 		}
 	}
@@ -287,7 +287,7 @@
 	struct obex_byte_stream_hdr *body_txh;
 	int actual; 	/* Number of bytes sent in this fragment */
 
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 	
 	object = self->object;
 	
@@ -315,14 +315,14 @@
 
 			/* Error ?*/
 			if(object->s_buf == NULL) {
-				DEBUG(1, "Unexpected end-of-stream\n");
+				DEBUG(1, "%s", "Unexpected end-of-stream");
 				return -1;
 			}
 		}
 		
 		if(tx_left < object->s_len) {
 			/* There is more data left in buffer than tx_left */
-			DEBUG(4, "More data than tx_left. Buffer will not be empty\n");
+			DEBUG(4, "%s", "More data than tx_left. Buffer will not be empty.");
 			
 			buf_insert_end(txmsg, (uint8_t*) object->s_buf + object->s_offset, tx_left);
 			object->s_len -= tx_left;
@@ -332,7 +332,7 @@
 		}
 		else {
 			/* There less data in buffer than tx_left */
-			DEBUG(4, "Less data that tx_left. Buffer will be empty\n");
+			DEBUG(4, "%s", "Less data that tx_left. Buffer will be empty.");
 			buf_insert_end(txmsg, (uint8_t*) object->s_buf + object->s_offset, object->s_len);
 			tx_left -= object->s_len;
 			object->s_offset += object->s_len;
@@ -386,7 +386,7 @@
 		
 	if(tx_left < ( h->buf->data_size +
 			sizeof(struct obex_byte_stream_hdr) ) )	{
-		DEBUG(4, "Add BODY header\n");
+		DEBUG(4, "%s", "Add BODY header");
 		body_txh->hi = OBEX_HDR_BODY;
 		body_txh->hl = htons((uint16_t)tx_left);
 
@@ -399,7 +399,7 @@
 		actual = tx_left;
 	}
 	else	{
-		DEBUG(4, "Add BODY_END header\n");
+		DEBUG(4, "%s", "Add BODY_END header.");
 
 		body_txh->hi = OBEX_HDR_BODY_END;
 		body_txh->hl = htons((uint16_t) (h->buf->data_size + sizeof(struct obex_byte_stream_hdr)));
@@ -432,7 +432,7 @@
 	int addmore = TRUE;
 	int real_opcode;
 
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	/* Don't do anything of object is suspended */
 	if (object->suspend)
@@ -466,7 +466,7 @@
 		object->tx_nonhdr_data = NULL;
 	}
 
-	DEBUG(4, "4\n");
+	DEBUG(4, "", 0);
 
 	/* Take headers from the tx queue and try to stuff as
 	   many as possible into the tx-msg */
@@ -497,7 +497,7 @@
 		}
 		else if(h->length <= tx_left) {
 			/* There is room for more data in tx msg */
-			DEBUG(4, "Adding non-body header\n");
+			DEBUG(4, "%s", "Adding non-body header.");
 			buf_insert_end(txmsg, h->buf->data, h->length);
 			tx_left -= h->length;
 			if(h->flags & OBEX_FL_SUSPEND)
@@ -513,7 +513,7 @@
 			   because OBEX_ObjectAddHeader() rejects headers
 			   bigger than the MTU */
 				
-			DEBUG(0, "ERROR! header to big for MTU\n");
+			DEBUG(0, "%s", "ERROR! header to big for MTU.");
 			return -1;
 		}
 		else	{
@@ -557,7 +557,7 @@
 	actual = obex_data_request(self, txmsg, real_opcode);
 
 	if(actual < 0) {
-		DEBUG(4, "Send error\n");
+		DEBUG(4, "%s", "Send error.");
 		return actual;
 	}
 	else {
@@ -572,13 +572,13 @@
  * Return the next header in the rx-queue
  *
  */
-int obex_object_getnextheader(obex_t *self, obex_object_t *object, uint8_t *hi,
-				obex_headerdata_t *hv, uint32_t *hv_size)
+int obex_object_getnextheader(obex_t __unused *self, obex_object_t *object, uint8_t *hi,
+			      obex_headerdata_t *hv, uint32_t *hv_size)
 {
 	uint32_t *bq4;
 	struct obex_header_element *h;
 
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	/* No more headers */
 	if(object->rx_headerq == NULL)
@@ -623,10 +623,10 @@
  * Allow the user to re-parse the headers in the rx-queue
  *
  */
-int obex_object_reparseheaders(obex_t *self, obex_object_t *object)
+int obex_object_reparseheaders(obex_t __unused *self, obex_object_t *object)
 {
 
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	/* Check that there is no more active headers */
 	if(object->rx_headerq != NULL)
@@ -651,7 +651,7 @@
 				uint8_t *source, unsigned int len)
 {
 	obex_object_t *object = self->object;
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 	
 	/* Spare the app this empty nonlast body-hdr */
 	if(hi == OBEX_HDR_BODY && len == 0) {
@@ -662,7 +662,7 @@
 	object->s_len = len;
 
 	if (object->abort) {
-		DEBUG(3, "Ignoring incomming data because request was aborted\n");
+		DEBUG(3, "%s", "Ignoring incomming data because request was aborted.");
 		return;
 	}
 	
@@ -685,7 +685,7 @@
  *
  */
 static int obex_object_receive_body(obex_object_t *object, buf_t *msg, uint8_t hi,
-				uint8_t *source, unsigned int len)
+				    uint8_t *source, size_t len)
 {
 	struct obex_header_element *element;
 
@@ -710,13 +710,13 @@
 	}
 
 	/* Reallocate body buffer if needed */ 
-	if(object->rx_body->data_avail + object->rx_body->tail_avail < (int)len)	{
+	if(object->rx_body->data_avail + object->rx_body->tail_avail < len)	{
 		int t;
-		DEBUG(4, "Buffer too small. Go realloc\n");
+		DEBUG(4, "%s", "Buffer too small. Go realloc.");
 		t = buf_total_size(object->rx_body);
 		buf_resize(object->rx_body, t + OBEX_OBJECT_ALLOCATIONTRESHOLD + len);
 		if(buf_total_size(object->rx_body) != t + OBEX_OBJECT_ALLOCATIONTRESHOLD + len)	{
-			DEBUG(1, "Can't realloc rx_body\n");
+			DEBUG(1, "%s", "Can't realloc rx_body.");
 			return -1;
 			// FIXME: Handle this in a nice way...
 		}
@@ -725,7 +725,7 @@
 	buf_insert_end(object->rx_body, source, len);
 
 	if(hi == OBEX_HDR_BODY_END)	{
-		DEBUG(4, "Body receive done\n");
+		DEBUG(4, "%s", "Body receive done.");
 		if( (element = malloc(sizeof(struct obex_header_element)) ) ) {
 			memset(element, 0, sizeof(struct obex_header_element));
 			element->length = object->rx_body->data_size;
@@ -742,7 +742,7 @@
 		object->rx_body = NULL;
 	}
 	else	{
-		DEBUG(4, "Normal body fragment...\n");
+		DEBUG(4, "%s", "Normal body fragment...");
 	}
 	return 1;
 }
@@ -770,7 +770,7 @@
 	} h;
 
 
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 	object = self->object;
 
 	/* Remove command from buffer */
@@ -831,7 +831,7 @@
 			hlen = 5;
 			break;
 		default:
-			DEBUG(1, "Badly formed header received\n");
+			DEBUG(1, "%s", "Badly formed header received.");
 			source = NULL;
 			hlen = 0;
 			len = 0;
@@ -865,7 +865,7 @@
 				// If we get an emtpy we have to deal with it...
 				// This might not be an optimal way, but it works.
 				if(len == 0) {
-					DEBUG(4, "Got empty header. Allocating dummy buffer anyway\n");
+					DEBUG(4, "%s", "Got empty header. Allocating dummy buffer anyway.");
 					element->buf = buf_new(1);
 				}
 				else {
@@ -881,13 +881,13 @@
 					object->rx_headerq = slist_append(object->rx_headerq, element);
 				}
 				else	{
-					DEBUG(1, "Cannot allocate memory\n");
+					DEBUG(1, "%s", "Cannot allocate memory.");
 					free(element);
 					err = -1;
 				}
 			}
 			else {
-				DEBUG(1, "Cannot allocate memory\n");
+				DEBUG(1, "%s", "Cannot allocate memory.");
 				err = -1;
 			}
 		}
@@ -908,12 +908,12 @@
  *    App wants to read stream fragment.
  *
  */
-int obex_object_readstream(obex_t *self, obex_object_t *object, const uint8_t **buf)
+int obex_object_readstream(obex_t __unused *self, obex_object_t *object, const uint8_t **buf)
 {
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 	/* Enable streaming */
 	if(buf == NULL) {
-		DEBUG(4, "Streaming is enabled!\n");
+		DEBUG(4, "%s", "Streaming is enabled!");
 		object->s_srv = TRUE;
 		return 0;
 	}
Index: openobex-anoncvs/lib/obex_server.c
===================================================================
--- openobex-anoncvs.orig/lib/obex_server.c	2007-01-28 22:59:11.620860898 +0100
+++ openobex-anoncvs/lib/obex_server.c	2007-01-28 23:00:32.889939898 +0100
@@ -52,7 +52,7 @@
 	unsigned int len;
 
 	
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	request = (obex_common_hdr_t *) msg->data;
 	cmd = request->opcode & ~OBEX_FINAL;
@@ -62,11 +62,11 @@
 	{
 	case STATE_IDLE:
 		/* Nothing has been recieved yet, so this is probably a new request */
-		DEBUG(4, "STATE_IDLE\n");
+		DEBUG(4, "%s", "STATE_IDLE");
 		
 		if(self->object) {
 			/* What shall we do here? I don't know!*/
-			DEBUG(0, "Got a new server-request while already having one!\n");
+			DEBUG(0, "%s", "Got a new server-request while already having one!");
 			obex_response_request(self, OBEX_RSP_INTERNAL_SERVER_ERROR);
 			return -1;
 		}
@@ -74,7 +74,7 @@
 		self->object = obex_object_new();
 
 		if(self->object == NULL) {
-			DEBUG(1, "Allocation of object failed!\n");
+			DEBUG(1, "%s", "Allocation of object failed!");
 			obex_response_request(self, OBEX_RSP_INTERNAL_SERVER_ERROR);
 			return -1;
 		}
@@ -89,7 +89,7 @@
 		/* Some commands needs special treatment (data outside headers) */
 		switch(cmd)	{
 		case OBEX_CMD_CONNECT:
-			DEBUG(4, "Got CMD_CONNECT\n");
+			DEBUG(4, "%s", "Got CMD_CONNECT");
 			/* Connect needs some extra special treatment */
 			if(obex_parse_connect_header(self, msg) < 0) {
 				obex_response_request(self, OBEX_RSP_BAD_REQUEST);
@@ -107,12 +107,12 @@
 		// no break! Fallthrough */
 	
 	case STATE_REC:
-		DEBUG(4, "STATE_REC\n");
+		DEBUG(4, "%s", "STATE_REC");
 		/* In progress of receiving a request */
 		
 		/* Abort? */
 		if(cmd == OBEX_CMD_ABORT) {
-			DEBUG(1, "Got OBEX_ABORT request!\n");
+			DEBUG(1, "%s", "Got OBEX_ABORT request!");
 			obex_response_request(self, OBEX_RSP_SUCCESS);
 			self->state = MODE_SRV | STATE_IDLE;
 			obex_deliver_event(self, OBEX_EV_ABORT, self->object->opcode, cmd, TRUE);
@@ -173,7 +173,7 @@
 			break; /* Stay in this state if not final */
 		}
 		else {
-			DEBUG(4, "We got a request!\n");
+			DEBUG(4, "%s", "We got a request!");
 			/* More connect-magic woodoo stuff */
 			if(cmd == OBEX_CMD_CONNECT)
 				obex_insert_connectframe(self, self->object);
@@ -190,11 +190,11 @@
 	
 	case STATE_SEND:
 		/* Send back response */
-		DEBUG(4, "STATE_SEND\n");
+		DEBUG(4, "%s", "STATE_SEND");
 		
 		/* Abort? */
 		if(cmd == OBEX_CMD_ABORT) {
-			DEBUG(1, "Got OBEX_ABORT request!\n");
+			DEBUG(1, "%s", "Got OBEX_ABORT request!");
 			obex_response_request(self, OBEX_RSP_SUCCESS);
 			self->state = MODE_SRV | STATE_IDLE;
 			obex_deliver_event(self, OBEX_EV_ABORT, self->object->opcode, cmd, TRUE);
@@ -260,7 +260,7 @@
 		else {
 			/* Response sent! */
 			if(cmd == OBEX_CMD_DISCONNECT)	{
-				DEBUG(2, "CMD_DISCONNECT done. Resetting MTU!\n");
+				DEBUG(2, "%s", "CMD_DISCONNECT done. Resetting MTU!");
 				self->mtu_tx = OBEX_MINIMUM_MTU;
 			}
 			self->state = MODE_SRV | STATE_IDLE;
@@ -269,7 +269,7 @@
 		break;
 	
 	default:
-		DEBUG(0, "Unknown state\n");
+		DEBUG(0, "%s", "Unknown state");
 		obex_response_request(self, OBEX_RSP_BAD_REQUEST);
 		obex_deliver_event(self, OBEX_EV_PARSEERR, cmd, 0, TRUE);
 		return -1;
Index: openobex-anoncvs/lib/obex_transport.c
===================================================================
--- openobex-anoncvs.orig/lib/obex_transport.c	2007-01-28 22:55:06.325530898 +0100
+++ openobex-anoncvs/lib/obex_transport.c	2007-01-28 22:58:19.613610648 +0100
@@ -64,7 +64,7 @@
 		if(self->ctrans.handleinput)
 			ret = self->ctrans.handleinput(self, self->ctrans.customdata, timeout);
 		else {
-			DEBUG(4, "No handleinput-callback exist!\n");
+			DEBUG(4, "%s", "No handleinput-callback exist!");
 			ret = -1;
 		}
 	}
@@ -76,12 +76,12 @@
 		fd_set fdset;
 		int highestfd = 0;
 	
-		DEBUG(4, "\n");
+		DEBUG(4, "", 0);
 		obex_return_val_if_fail(self != NULL, -1);
 
 		/* Check of we have any fd's to do select on. */
 		if(self->fd < 0 && self->serverfd < 0) {
-			DEBUG(0, "No valid socket is open\n");
+			DEBUG(0, "%s", "No valid socket is open.");
 			return -1;
 		}
 
@@ -109,12 +109,12 @@
 			return ret;
 	
 		if( (self->fd >= 0) && FD_ISSET(self->fd, &fdset)) {
-			DEBUG(4, "Data available on client socket\n");
+			DEBUG(4, "%s", "Data available on client socket.");
 			ret = obex_data_indication(self, NULL, 0);
 		}
 
 		else if( (self->serverfd >= 0) && FD_ISSET(self->serverfd, &fdset)) {
-			DEBUG(4, "Data available on server socket\n");
+			DEBUG(4, "%s", "Data available on server socket");
 			/* Accept : create the connected socket */
 			ret = obex_transport_accept(self);
 
@@ -144,7 +144,7 @@
 {
 	int ret = -1;
 
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	switch (self->trans.type) {
 #ifdef HAVE_IRDA
@@ -166,7 +166,7 @@
 		break;
 
 	default:
-		DEBUG(4, "domain not implemented!\n");
+		DEBUG(4, "%s", "Domain not implemented!");
 		break;
 	}
 	return ret;
@@ -196,11 +196,11 @@
 		ret = inobex_connect_request(self);
 		break;
 	case OBEX_TRANS_CUSTOM:
-		DEBUG(4, "Custom connect\n");
+		DEBUG(4, "%s", "Custom connect.");
 		if(self->ctrans.connect)
 			ret = self->ctrans.connect(self, self->ctrans.customdata);
 		else
-			DEBUG(4, "No connect-callback exist!\n");
+			DEBUG(4, "%s", "No connect-callback exists!");
 		DEBUG(4, "ret=%d\n", ret);
 		break;
 #ifdef HAVE_BLUETOOTH
@@ -219,7 +219,7 @@
 		break;
 #endif /*HAVE_USB*/ 
 	default:
-		DEBUG(4, "Transport not implemented!\n");
+		DEBUG(4, "%s", "Transport not implemented!");
 		break;
 	}
 	if (ret >= 0)
@@ -247,11 +247,11 @@
 		inobex_disconnect_request(self);
 		break;	
 	case OBEX_TRANS_CUSTOM:
-		DEBUG(4, "Custom disconnect\n");
+		DEBUG(4, "%s", "Custom disconnect.");
 		if(self->ctrans.disconnect)
 			self->ctrans.disconnect(self, self->ctrans.customdata);
 		else
-			DEBUG(4, "No disconnect-callback exist!\n");
+			DEBUG(4, "%s", "No disconnect-callback exist!");
 		break;
 #ifdef HAVE_BLUETOOTH
 	case OBEX_TRANS_BLUETOOTH:
@@ -268,7 +268,7 @@
 		break;
 #endif /*HAVE_USB*/ 
 	default:
-		DEBUG(4, "Transport not implemented!\n");
+		DEBUG(4, "%s", "Transport not implemented!");
 		break;
 	}
 	self->trans.connected = FALSE;
@@ -294,11 +294,11 @@
 		ret = inobex_listen(self);
 		break;
 	case OBEX_TRANS_CUSTOM:
-		DEBUG(4, "Custom listen\n");
+		DEBUG(4, "%s", "Custom listen.");
 		if(self->ctrans.listen)
 			ret = self->ctrans.listen(self, self->ctrans.customdata);
 		else
-			DEBUG(4, "No listen-callback exist!\n");
+			DEBUG(4, "%s", "No listen-callback exist!");
 		break;
 #ifdef HAVE_BLUETOOTH
 	case OBEX_TRANS_BLUETOOTH:
@@ -340,7 +340,7 @@
 		inobex_disconnect_server(self);
 		break;	
 	case OBEX_TRANS_CUSTOM:
-		DEBUG(4, "Custom disconnect\n");
+		DEBUG(4, "%s", "Custom disconnect.");
 		break;
 #ifdef HAVE_BLUETOOTH
 	case OBEX_TRANS_BLUETOOTH:
@@ -352,7 +352,7 @@
 		/* no real server on a file or USB */;
 		break;
 	default:
-		DEBUG(4, "Transport not implemented!\n");
+		DEBUG(4, "%s", "Transport not implemented!");
 		break;
 	}
 }
@@ -360,7 +360,7 @@
 /*
  * does fragmented write
  */
-static int do_write(int fd, buf_t *msg, int mtu)
+static int do_write(int fd, buf_t *msg, size_t mtu)
 {
 	int actual = -1;
 	int size;
@@ -393,7 +393,7 @@
 {
 	int actual = -1;
 
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	switch(self->trans.type)	{
 #ifdef HAVE_IRDA
@@ -419,14 +419,14 @@
 		break;
 #endif /*HAVE_USB*/ 
 	case OBEX_TRANS_CUSTOM:
-		DEBUG(4, "Custom write\n");
+		DEBUG(4, "%s", "Custom write.");
 		if(self->ctrans.write)
 			actual = self->ctrans.write(self, self->ctrans.customdata, msg->data, msg->data_size);
 		else
-			DEBUG(4, "No write-callback exist!\n");
+			DEBUG(4, "%s", "No write-callback exist!");
 		break;
 	default:
-		DEBUG(4, "Transport not implemented!\n");
+		DEBUG(4, "%s", "Transport not implemented!");
 		break;
 	}	
 	return actual;
@@ -481,7 +481,7 @@
 		}
 		break;
 	default:
-		DEBUG(4, "Transport not implemented!\n");
+		DEBUG(4, "%s", "Transport not implemented!");
 		break;
 	}	
 	return actual;
Index: openobex-anoncvs/lib/usbobex.c
===================================================================
--- openobex-anoncvs.orig/lib/usbobex.c	2007-01-28 22:38:37.779750648 +0100
+++ openobex-anoncvs/lib/usbobex.c	2007-01-28 22:43:51.615364148 +0100
@@ -40,8 +40,6 @@
 #include <netinet/in.h>
 #include <sys/socket.h>
 
-#include <usb.h>
-
 #include "obex_main.h"
 #include "usbobex.h"
 
@@ -107,18 +105,18 @@
 	int found_idle = 0;
 
 	if (!buffer) {
-		DEBUG(2,"Weird descriptor references");
+		DEBUG(2, "%s", "Weird descriptor references.");
 		return -EINVAL;
 	}
 	while (buflen > 0) {
 		if (buffer [1] != USB_DT_CS_INTERFACE) {
-			DEBUG(2,"skipping garbage");
+			DEBUG(2, "%s", "Skipping garbage.");
 			goto next_desc;
 		}
 		switch (buffer [2]) {
 		case CDC_UNION_TYPE: /* we've found it */
 			if (union_header) {
-				DEBUG(2,"More than one union descriptor, skiping ...");
+				DEBUG(2, "%s", "More than one union descriptor, skiping ...");
 				goto next_desc;
 			}
 			union_header = (struct cdc_union_desc *)buffer;
@@ -135,7 +133,7 @@
 		buffer += buffer[0];
 	}
 	if (!union_header) {
-		DEBUG(2,"No union descriptor, giving up\n");
+		DEBUG(2, "%s", "No union descriptor, giving up");
 		return -ENODEV;
 	}
 	/* Found the slave interface, now find active/idle settings and endpoints */
@@ -152,11 +150,11 @@
 		}
 	}
 	if (!found_idle) {
-		DEBUG(2,"No idle setting\n");
+		DEBUG(2, "%s", "No idle setting.");
 		return -ENODEV;
 	}
 	if (!found_active) {
-		DEBUG(2,"No active setting\n");
+		DEBUG(2, "%s", "No active setting.");
 		return -ENODEV;
 	}
 	return 0;
@@ -329,7 +327,7 @@
 	int ret;
 #ifndef _WIN32
 
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 
 	self->trans.self.usb.dev_control = usb_open(self->trans.self.usb.device);
 	self->trans.self.usb.dev_data = usb_open(self->trans.self.usb.device);
@@ -390,7 +388,7 @@
 	if (self->trans.connected == FALSE)
 		return 0;
 #ifndef _WIN32
-	DEBUG(4, "\n");
+	DEBUG(4, "", 0);
 	ret = usb_set_altinterface(self->trans.self.usb.dev_data, self->trans.self.usb.data_idle_setting);
 	if (ret < 0)
 		DEBUG(4, "Can't set data idle setting %d", ret);
Index: openobex-anoncvs/lib/usbobex.h
===================================================================
--- openobex-anoncvs.orig/lib/usbobex.h	2007-01-28 22:22:11.950140148 +0100
+++ openobex-anoncvs/lib/usbobex.h	2007-01-28 23:29:04.760925148 +0100
@@ -29,6 +29,10 @@
 #define USBOBEX_H
 
 #include <openobex/obex_const.h>
+#include <limits.h>
+#ifndef PATH_MAX
+#define PATH_MAX FILENAME_MAX
+#endif
 #include <usb.h>
 
 /* Information about a USB OBEX interface present on the system */
Index: openobex-anoncvs/acinclude.m4
===================================================================
--- openobex-anoncvs.orig/acinclude.m4	2007-01-28 23:54:09.566969648 +0100
+++ openobex-anoncvs/acinclude.m4	2007-01-28 23:55:32.180132648 +0100
@@ -14,7 +14,8 @@
 	AC_PREFIX_DEFAULT(/usr/local)
 
 	if (test "${CFLAGS}" = ""); then
-		CFLAGS="-Wall -O2"
+		dnl enable all extra checking and all warnings
+		CFLAGS="-O3 -g -std=c99 -pedantic -W -Wall"
 	fi
 
 	if (test "${prefix}" = "NONE"); then
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Openobex-users mailing list
[email protected]
http://lists.sourceforge.net/lists/listinfo/openobex-users

Reply via email to