All of lore.kernel.org
 help / color / mirror / Atom feed
* Warning fixes for GCC 4.6
@ 2011-05-05 18:43 Bastien Nocera
  2011-05-06  7:52 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 10+ messages in thread
From: Bastien Nocera @ 2011-05-05 18:43 UTC (permalink / raw)
  To: BlueZ development

[-- Attachment #1: Type: text/plain, Size: 45 bytes --]

So that bluez compiles with -Werror.

Cheers

[-- Attachment #2: 0002-Fix-set-but-not-unused-variable-GCC-4.6-warnings.patch --]
[-- Type: text/x-patch, Size: 17758 bytes --]

>From 588f7efc01dde6eb81104a9edf6bde3a9afb770f Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 5 May 2011 19:41:38 +0100
Subject: [PATCH 2/2] Fix "set but not unused variable" GCC 4.6 warnings

---
 attrib/gatt.c         |    9 ++++-----
 audio/a2dp.c          |    5 ++---
 audio/manager.c       |    3 +--
 audio/pcm_bluetooth.c |    4 ++--
 btio/btio.c           |    5 +++++
 compat/fakehid.c      |    6 ++++--
 cups/hcrp.c           |   12 ++++++++++++
 gdbus/object.c        |    3 +--
 input/device.c        |    2 +-
 input/server.c        |    3 ++-
 lib/sdp.c             |    2 +-
 network/common.c      |    2 +-
 plugins/hciops.c      |    4 +---
 plugins/mgmtops.c     |    4 +---
 sbc/sbcinfo.c         |    2 +-
 src/adapter.c         |    6 ------
 src/sdp-xml.c         |    4 ----
 src/sdpd-request.c    |    2 +-
 src/textfile.c        |    8 ++++++++
 test/hciemu.c         |    6 ++++++
 test/hstest.c         |    7 ++++++-
 test/rctest.c         |    2 --
 test/scotest.c        |    2 --
 test/test-textfile.c  |    2 ++
 tools/hciattach.c     |    6 +++---
 tools/hcitool.c       |    2 --
 26 files changed, 65 insertions(+), 48 deletions(-)

diff --git a/attrib/gatt.c b/attrib/gatt.c
index 360218b..61c9ed1 100644
--- a/attrib/gatt.c
+++ b/attrib/gatt.c
@@ -71,13 +71,12 @@ static guint16 encode_discover_primary(uint16_t start, uint16_t end,
 {
 	bt_uuid_t prim;
 	guint16 plen;
-	uint8_t op;
 
 	bt_uuid16_create(&prim, GATT_PRIM_SVC_UUID);
 
 	if (uuid == NULL) {
-		/* Discover all primary services */
-		op = ATT_OP_READ_BY_GROUP_REQ;
+		/* Discover all primary services
+		   op = ATT_OP_READ_BY_GROUP_REQ; */
 		plen = enc_read_by_grp_req(start, end, &prim, pdu, len);
 	} else {
 		uint16_t u16;
@@ -85,8 +84,8 @@ static guint16 encode_discover_primary(uint16_t start, uint16_t end,
 		const void *value;
 		int vlen;
 
-		/* Discover primary service by service UUID */
-		op = ATT_OP_FIND_BY_TYPE_REQ;
+		/* Discover primary service by service UUID
+		   op = ATT_OP_FIND_BY_TYPE_REQ; */
 
 		if (uuid->type == BT_UUID16) {
 			u16 = htobs(uuid->value.u16);
diff --git a/audio/a2dp.c b/audio/a2dp.c
index 9cd7207..2333dee 100644
--- a/audio/a2dp.c
+++ b/audio/a2dp.c
@@ -2038,7 +2038,6 @@ unsigned int a2dp_config(struct avdtp *session, struct a2dp_sep *sep,
 	struct avdtp_media_codec_capability *codec_cap = NULL;
 	int posix_err;
 	bdaddr_t src;
-	uint8_t remote_type;
 
 	avdtp_get_peers(session, &src, NULL);
 	server = find_server(servers, &src);
@@ -2085,9 +2084,9 @@ unsigned int a2dp_config(struct avdtp *session, struct a2dp_sep *sep,
 	case AVDTP_STATE_IDLE:
 		if (sep->type == AVDTP_SEP_TYPE_SOURCE) {
 			l = server->sources;
-			remote_type = AVDTP_SEP_TYPE_SINK;
+			/* remote_type = AVDTP_SEP_TYPE_SINK; */
 		} else {
-			remote_type = AVDTP_SEP_TYPE_SOURCE;
+			/* remote_type = AVDTP_SEP_TYPE_SOURCE; */
 			l = server->sinks;
 		}
 
diff --git a/audio/manager.c b/audio/manager.c
index 7e206be..ec667d5 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -562,7 +562,6 @@ static void hf_io_cb(GIOChannel *chan, gpointer data)
 	GError *err = NULL;
 	uint8_t ch;
 	const char *server_uuid, *remote_uuid;
-	uint16_t svclass;
 	struct audio_device *device;
 	int perr;
 
@@ -580,7 +579,7 @@ static void hf_io_cb(GIOChannel *chan, gpointer data)
 
 	server_uuid = HFP_AG_UUID;
 	remote_uuid = HFP_HS_UUID;
-	svclass = HANDSFREE_AGW_SVCLASS_ID;
+	/* svclass = HANDSFREE_AGW_SVCLASS_ID; */
 
 	device = manager_get_device(&src, &dst, TRUE);
 	if (!device)
diff --git a/audio/pcm_bluetooth.c b/audio/pcm_bluetooth.c
index 799f17f..2d9f178 100644
--- a/audio/pcm_bluetooth.c
+++ b/audio/pcm_bluetooth.c
@@ -820,7 +820,7 @@ static int bluetooth_playback_poll_revents(snd_pcm_ioplug_t *io,
 					unsigned short *revents)
 {
 	static char buf[1];
-	int ret;
+	int ret = 0;
 
 	DBG("");
 
@@ -838,7 +838,7 @@ static int bluetooth_playback_poll_revents(snd_pcm_ioplug_t *io,
 
 	*revents = (pfds[0].revents & POLLIN) ? POLLOUT : 0;
 
-	return 0;
+	return ret;
 }
 
 
diff --git a/btio/btio.c b/btio/btio.c
index 6d71b90..6bfa619 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -884,6 +884,7 @@ static gboolean l2cap_get(int sock, GError **err, BtIOOption opt1,
 			*(va_arg(args, uint8_t *)) = l2o.mode;
 			break;
 		case BT_IO_OPT_FLUSHABLE:
+			flushable = TRUE;
 			if (l2cap_get_flushable(sock, &flushable) < 0) {
 				ERROR_FAILED(err, "get_flushable", errno);
 				return FALSE;
@@ -1135,6 +1136,10 @@ gboolean bt_io_accept(GIOChannel *io, BtIOConnect connect, gpointer user_data,
 	if (!(pfd.revents & POLLOUT)) {
 		int ret;
 		ret = read(sock, &c, 1);
+		if (ret == -1) {
+			ERROR_FAILED(err, "read", errno);
+			return FALSE;
+		}
 	}
 
 	accept_add(io, connect, user_data, destroy);
diff --git a/compat/fakehid.c b/compat/fakehid.c
index b996d10..0974d0a 100644
--- a/compat/fakehid.c
+++ b/compat/fakehid.c
@@ -60,13 +60,13 @@ static void sig_term(int sig)
 	__io_canceled = 1;
 }
 
-static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
+static int send_event(int fd, uint16_t type, uint16_t code, int32_t value)
 {
 	struct uinput_event event;
 	int len;
 
 	if (fd <= fileno(stderr))
-		return;
+		return -1;
 
 	memset(&event, 0, sizeof(event));
 	event.type = type;
@@ -74,6 +74,8 @@ static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
 	event.value = value;
 
 	len = write(fd, &event, sizeof(event));
+
+	return len;
 }
 
 static int uinput_create(char *name, int keyboard, int mouse)
diff --git a/cups/hcrp.c b/cups/hcrp.c
index 7aafcdc..e2e8ce3 100644
--- a/cups/hcrp.c
+++ b/cups/hcrp.c
@@ -94,8 +94,12 @@ static int hcrp_credit_grant(int sk, uint16_t tid, uint32_t credit)
 	memcpy(buf, &hdr, HCRP_PDU_HDR_SIZE);
 	memcpy(buf + HCRP_PDU_HDR_SIZE, &cp, HCRP_CREDIT_GRANT_CP_SIZE);
 	len = write(sk, buf, HCRP_PDU_HDR_SIZE + HCRP_CREDIT_GRANT_CP_SIZE);
+	if (len == -1)
+		return -1;
 
 	len = read(sk, buf, sizeof(buf));
+	if (len == -1)
+		return -1;
 	memcpy(&hdr, buf, HCRP_PDU_HDR_SIZE);
 	memcpy(&rp, buf + HCRP_PDU_HDR_SIZE, HCRP_CREDIT_GRANT_RP_SIZE);
 
@@ -119,8 +123,12 @@ static int hcrp_credit_request(int sk, uint16_t tid, uint32_t *credit)
 	hdr.plen = htons(0);
 	memcpy(buf, &hdr, HCRP_PDU_HDR_SIZE);
 	len = write(sk, buf, HCRP_PDU_HDR_SIZE);
+	if (len == -1)
+		return -1;
 
 	len = read(sk, buf, sizeof(buf));
+	if (len == -1)
+		return -1;
 	memcpy(&hdr, buf, HCRP_PDU_HDR_SIZE);
 	memcpy(&rp, buf + HCRP_PDU_HDR_SIZE, HCRP_CREDIT_REQUEST_RP_SIZE);
 
@@ -147,8 +155,12 @@ static int hcrp_get_lpt_status(int sk, uint16_t tid, uint8_t *lpt_status)
 	hdr.plen = htons(0);
 	memcpy(buf, &hdr, HCRP_PDU_HDR_SIZE);
 	len = write(sk, buf, HCRP_PDU_HDR_SIZE);
+	if (len == -1)
+		return -1;
 
 	len = read(sk, buf, sizeof(buf));
+	if (len == -1)
+		return -1;
 	memcpy(&hdr, buf, HCRP_PDU_HDR_SIZE);
 	memcpy(&rp, buf + HCRP_PDU_HDR_SIZE, HCRP_GET_LPT_STATUS_RP_SIZE);
 
diff --git a/gdbus/object.c b/gdbus/object.c
index eaa2e1a..d17a101 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -255,14 +255,13 @@ void g_dbus_pending_success(DBusConnection *connection,
 
         for (list = pending_security; list; list = list->next) {
 		struct security_data *secdata = list->data;
-		DBusHandlerResult result;
 
 		if (secdata->pending != pending)
 			continue;
 
 		pending_security = g_slist_remove(pending_security, secdata);
 
-		result = process_message(connection, secdata->message,
+		process_message(connection, secdata->message,
 				secdata->method, secdata->iface_user_data);
 
 		dbus_message_unref(secdata->message);
diff --git a/input/device.c b/input/device.c
index 554f5ac..550e1c7 100644
--- a/input/device.c
+++ b/input/device.c
@@ -250,7 +250,7 @@ static int decode_key(const char *str)
 static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
 {
 	struct uinput_event event;
-	int err;
+	int __attribute__((__unused__)) err;
 
 	memset(&event, 0, sizeof(event));
 	event.type	= type;
diff --git a/input/server.c b/input/server.c
index d98018b..15bf5b3 100644
--- a/input/server.c
+++ b/input/server.c
@@ -91,7 +91,8 @@ static void connect_event_cb(GIOChannel *chan, GError *err, gpointer data)
 	/* Send unplug virtual cable to unknown devices */
 	if (ret == -ENOENT && psm == L2CAP_PSM_HIDP_CTRL) {
 		unsigned char unplug = 0x15;
-		int err, sk = g_io_channel_unix_get_fd(chan);
+		int __attribute__((__unused__)) err;
+		int sk = g_io_channel_unix_get_fd(chan);
 		err = write(sk, &unplug, sizeof(unplug));
 	}
 
diff --git a/lib/sdp.c b/lib/sdp.c
index d24d1e2..d852587 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -3319,7 +3319,7 @@ int sdp_service_search_req(sdp_session_t *session, const sdp_list_t *search,
 	uint32_t reqsize = 0, _reqsize;
 	uint32_t rspsize = 0, rsplen;
 	int seqlen = 0;
-	int total_rec_count, rec_count;
+	int __attribute__((__unused__)) total_rec_count, rec_count;
 	unsigned scanned, pdata_len;
 	uint8_t *pdata, *_pdata;
 	uint8_t *reqbuf, *rspbuf;
diff --git a/network/common.c b/network/common.c
index ef72679..38d2c49 100644
--- a/network/common.c
+++ b/network/common.c
@@ -215,7 +215,7 @@ int bnep_if_up(const char *devname)
 int bnep_if_down(const char *devname)
 {
 	struct ifreq ifr;
-	int sk, err;
+	int sk, __attribute__((__unused__)) err;
 
 	sk = socket(AF_INET, SOCK_DGRAM, 0);
 
diff --git a/plugins/hciops.c b/plugins/hciops.c
index 2c49e35..49dd48d 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
@@ -2754,7 +2754,7 @@ static void init_conn_list(int index)
 	struct dev_info *dev = &devs[index];
 	struct hci_conn_list_req *cl;
 	struct hci_conn_info *ci;
-	int err, i;
+	int i;
 
 	DBG("hci%d", index);
 
@@ -2780,8 +2780,6 @@ static void init_conn_list(int index)
 		conn->handle = ci->handle;
 	}
 
-	err = 0;
-
 failed:
 	g_free(cl);
 }
diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index 9e1cfac..b831044 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
@@ -207,7 +207,7 @@ static int mgmt_update_powered(int index, uint8_t powered)
 {
 	struct controller_info *info;
 	struct btd_adapter *adapter;
-	gboolean pairable, discoverable;
+	gboolean pairable;
 	uint8_t on_mode;
 
 	if (index > max_index) {
@@ -238,8 +238,6 @@ static int mgmt_update_powered(int index, uint8_t powered)
 
 	btd_adapter_get_mode(adapter, NULL, &on_mode, &pairable);
 
-	discoverable = (on_mode == MODE_DISCOVERABLE);
-
 	if (on_mode == MODE_DISCOVERABLE && !info->discoverable)
 		mgmt_set_discoverable(index, TRUE);
 	else if (on_mode == MODE_CONNECTABLE && !info->connectable)
diff --git a/sbc/sbcinfo.c b/sbc/sbcinfo.c
index 6d92679..63f05aa 100644
--- a/sbc/sbcinfo.c
+++ b/sbc/sbcinfo.c
@@ -281,7 +281,7 @@ static int analyze_file(char *filename)
 	printf("Subbands\t\t%d\n", subbands);
 	printf("Block length\t\t%d\n", blocks);
 	printf("Sampling frequency\t%s\n", freq2str(freq));
-	printf("Channel mode\t\t%s\n", mode2str(hdr.channel_mode));
+	printf("Channel mode\t\t%s\n", mode2str(mode));
 	printf("Allocation method\t%s\n", method ? "SNR" : "Loudness");
 	printf("Bitpool\t\t\t%d", bitpool[0]);
 	for (n = 1; n < SIZE; n++)
diff --git a/src/adapter.c b/src/adapter.c
index f068335..76fc01b 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -476,13 +476,10 @@ static int set_mode(struct btd_adapter *adapter, uint8_t new_mode,
 {
 	int err;
 	const char *modestr;
-	gboolean discoverable;
 
 	if (adapter->pending_mode != NULL)
 		return -EALREADY;
 
-	discoverable = new_mode == MODE_DISCOVERABLE;
-
 	if (!adapter->up && new_mode != MODE_OFF) {
 		err = adapter_ops->set_powered(adapter->dev_id, TRUE);
 		if (err < 0)
@@ -3405,7 +3402,6 @@ gboolean adapter_powering_down(struct btd_adapter *adapter)
 int btd_adapter_restore_powered(struct btd_adapter *adapter)
 {
 	char mode[14], address[18];
-	gboolean discoverable;
 
 	if (!adapter_ops)
 		return -EINVAL;
@@ -3421,8 +3417,6 @@ int btd_adapter_restore_powered(struct btd_adapter *adapter)
 						g_str_equal(mode, "off"))
 		return 0;
 
-	discoverable = get_mode(&adapter->bdaddr, mode) == MODE_DISCOVERABLE;
-
 	return adapter_ops->set_powered(adapter->dev_id, TRUE);
 }
 
diff --git a/src/sdp-xml.c b/src/sdp-xml.c
index 3aa9df0..62226cc 100644
--- a/src/sdp-xml.c
+++ b/src/sdp-xml.c
@@ -47,7 +47,6 @@ static void convert_raw_data_to_xml(sdp_data_t *value, int indent_level,
 	int i, hex;
 	char buf[STRBUFSIZE];
 	char indent[MAXINDENT];
-	char next_indent[MAXINDENT];
 
 	if (!value)
 		return;
@@ -57,12 +56,9 @@ static void convert_raw_data_to_xml(sdp_data_t *value, int indent_level,
 
 	for (i = 0; i < indent_level; i++) {
 		indent[i] = '\t';
-		next_indent[i] = '\t';
 	}
 
 	indent[i] = '\0';
-	next_indent[i] = '\t';
-	next_indent[i + 1] = '\0';
 
 	buf[STRBUFSIZE - 1] = '\0';
 
diff --git a/src/sdpd-request.c b/src/sdpd-request.c
index 1722f78..287acc2 100644
--- a/src/sdpd-request.c
+++ b/src/sdpd-request.c
@@ -962,7 +962,7 @@ static void process_request(sdp_req_t *req)
 	sdp_pdu_hdr_t *rsphdr;
 	sdp_buf_t rsp;
 	uint8_t *buf = malloc(USHRT_MAX);
-	int sent = 0;
+	int __attribute__((__unused__)) sent = 0;
 	int status = SDP_INVALID_SYNTAX;
 
 	memset(buf, 0, USHRT_MAX);
diff --git a/src/textfile.c b/src/textfile.c
index d115ff6..2645f9a 100644
--- a/src/textfile.c
+++ b/src/textfile.c
@@ -204,6 +204,10 @@ static int write_key(const char *pathname, const char *key, const char *value, i
 	if (!size) {
 		if (value) {
 			pos = lseek(fd, size, SEEK_SET);
+			if (pos == (off_t) -1) {
+				err = errno;
+				goto unlock;
+			}
 			err = write_key_value(fd, key, value);
 		}
 		goto unlock;
@@ -222,6 +226,10 @@ static int write_key(const char *pathname, const char *key, const char *value, i
 		if (value) {
 			munmap(map, size);
 			pos = lseek(fd, size, SEEK_SET);
+			if (pos == (off_t) -1) {
+				err = errno;
+				goto unlock;
+			}
 			err = write_key_value(fd, key, value);
 		}
 		goto unlock;
diff --git a/test/hciemu.c b/test/hciemu.c
index 66f99a9..3048285 100644
--- a/test/hciemu.c
+++ b/test/hciemu.c
@@ -222,7 +222,11 @@ static int write_snoop(int fd, int type, int incoming, unsigned char *buf, int l
 		pkt.flags |= ntohl(0x02);
 
 	err = write(fd, &pkt, BTSNOOP_PKT_SIZE);
+	if (err == -1)
+		return -1;
 	err = write(fd, buf, size);
+	if (err == -1)
+		return -1;
 
 	return 0;
 }
@@ -899,6 +903,8 @@ static gboolean io_acl_data(GIOChannel *chan, GIOCondition cond, gpointer data)
 	write_snoop(vdev.dd, HCI_ACLDATA_PKT, 1, buf, len);
 
 	err = write(vdev.fd, buf, len);
+	if (err == -1)
+		return FALSE;
 
 	return TRUE;
 }
diff --git a/test/hstest.c b/test/hstest.c
index 08f2257..63c402b 100644
--- a/test/hstest.c
+++ b/test/hstest.c
@@ -244,8 +244,13 @@ int main(int argc, char *argv[])
 
 	fprintf(stderr, "SCO audio channel connected (handle %d, mtu %d)\n", sco_handle, sco_mtu);
 
-	if (mode == RECORD)
+	if (mode == RECORD) {
 		err = write(rd, "RING\r\n", 6);
+		if (err == -1) {
+			perror("Can't write \"RING\"");
+			return -1;
+		}
+	}
 
 	maxfd = (rd > sd) ? rd : sd;
 
diff --git a/test/rctest.c b/test/rctest.c
index b3804f5..9754f52 100644
--- a/test/rctest.c
+++ b/test/rctest.c
@@ -417,13 +417,11 @@ static void recv_mode(int sk)
 	struct timeval tv_beg, tv_end, tv_diff;
 	char ts[30];
 	long total;
-	uint32_t seq;
 
 	syslog(LOG_INFO, "Receiving ...");
 
 	memset(ts, 0, sizeof(ts));
 
-	seq = 0;
 	while (1) {
 		gettimeofday(&tv_beg,NULL);
 		total = 0;
diff --git a/test/scotest.c b/test/scotest.c
index 50b622a..17bd8a6 100644
--- a/test/scotest.c
+++ b/test/scotest.c
@@ -216,11 +216,9 @@ static void recv_mode(int sk)
 {
 	struct timeval tv_beg,tv_end,tv_diff;
 	long total;
-	uint32_t seq;
 
 	syslog(LOG_INFO, "Receiving ...");
 
-	seq = 0;
 	while (1) {
 		gettimeofday(&tv_beg, NULL);
 		total = 0;
diff --git a/test/test-textfile.c b/test/test-textfile.c
index 970e9e7..7adc3da 100644
--- a/test/test-textfile.c
+++ b/test/test-textfile.c
@@ -51,6 +51,8 @@ int main(int argc, char *argv[])
 
 	fd = creat(filename, 0644);
 	err = ftruncate(fd, 0);
+	if (err == -1)
+		fprintf(stderr, "%s (%d)\n", strerror(errno), errno);
 
 	memset(value, 0, sizeof(value));
 	for (i = 0; i < (size / sizeof(value)); i++)
diff --git a/tools/hciattach.c b/tools/hciattach.c
index e4d5aa1..bc56f31 100644
--- a/tools/hciattach.c
+++ b/tools/hciattach.c
@@ -351,7 +351,7 @@ static int bcsp_max_retries = 10;
 static void bcsp_tshy_sig_alarm(int sig)
 {
 	unsigned char bcsp_sync_pkt[10] = {0xc0,0x00,0x41,0x00,0xbe,0xda,0xdc,0xed,0xed,0xc0};
-	int len;
+	int __attribute__((__unused__)) len;
 	static int retries = 0;
 
 	if (retries < bcsp_max_retries) {
@@ -369,7 +369,7 @@ static void bcsp_tshy_sig_alarm(int sig)
 static void bcsp_tconf_sig_alarm(int sig)
 {
 	unsigned char bcsp_conf_pkt[10] = {0xc0,0x00,0x41,0x00,0xbe,0xad,0xef,0xac,0xed,0xc0};
-	int len;
+	int __attribute__((__unused__)) len;
 	static int retries = 0;
 
 	if (retries < bcsp_max_retries){
@@ -394,7 +394,7 @@ static int bcsp(int fd, struct uart_t *u, struct termios *ti)
 		bcspconf[4]     = {0xad,0xef,0xac,0xed},
 		bcspconfresp[4] = {0xde,0xad,0xd0,0xd0};
 	struct sigaction sa;
-	int len;
+	int __attribute__((__unused__)) len;
 
 	if (set_speed(fd, ti, u->speed) < 0) {
 		perror("Can't set default baud rate");
diff --git a/tools/hcitool.c b/tools/hcitool.c
index a117449..ece187c 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -2351,7 +2351,6 @@ static int print_advertising_devices(int dd, uint8_t filter_type)
 	unsigned char buf[HCI_MAX_EVENT_SIZE], *ptr;
 	struct hci_filter nf, of;
 	socklen_t olen;
-	hci_event_hdr *hdr;
 	int num, len;
 
 	olen = sizeof(of);
@@ -2382,7 +2381,6 @@ static int print_advertising_devices(int dd, uint8_t filter_type)
 			goto done;
 		}
 
-		hdr = (void *) (buf + 1);
 		ptr = buf + (1 + HCI_EVENT_HDR_SIZE);
 		len -= (1 + HCI_EVENT_HDR_SIZE);
 
-- 
1.7.5


[-- Attachment #3: 0001-Remove-obsolete-Sixaxis-enablement-in-hidd.patch --]
[-- Type: text/x-patch, Size: 1180 bytes --]

>From de72d9561310b996fb643d84e678e8cb59fedbfc Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 5 May 2011 19:41:07 +0100
Subject: [PATCH 1/2] Remove obsolete Sixaxis enablement in hidd

Seeing as this is now handled in the kernel.
---
 compat/hidd.c |   13 -------------
 1 files changed, 0 insertions(+), 13 deletions(-)

diff --git a/compat/hidd.c b/compat/hidd.c
index 88944cf..d83d41f 100644
--- a/compat/hidd.c
+++ b/compat/hidd.c
@@ -237,16 +237,6 @@ static int request_encryption(bdaddr_t *src, bdaddr_t *dst)
 	return err;
 }
 
-static void enable_sixaxis(int csk)
-{
-	const unsigned char buf[] = {
-		0x53 /*HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_FEATURE*/,
-		0xf4,  0x42, 0x03, 0x00, 0x00 };
-	int err;
-
-	err = write(csk, buf, sizeof(buf));
-}
-
 static int create_device(int ctl, int csk, int isk, uint8_t subclass, int nosdp, int nocheck, int bootonly, int encrypt, int timeout)
 {
 	struct hidp_connadd_req req;
@@ -335,9 +325,6 @@ create:
 		req.flags |= (1 << HIDP_BOOT_PROTOCOL_MODE);
 	}
 
-	if (req.vendor == 0x054c && req.product == 0x0268)
-		enable_sixaxis(csk);
-
 	err = ioctl(ctl, HIDPCONNADD, &req);
 
 error:
-- 
1.7.5


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: Warning fixes for GCC 4.6
  2011-05-05 18:43 Warning fixes for GCC 4.6 Bastien Nocera
@ 2011-05-06  7:52 ` Luiz Augusto von Dentz
  2011-05-06 14:48   ` Bastien Nocera
  2011-05-06 14:56   ` Bastien Nocera
  0 siblings, 2 replies; 10+ messages in thread
From: Luiz Augusto von Dentz @ 2011-05-06  7:52 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: BlueZ development

Hi Bastien,

On Thu, May 5, 2011 at 9:43 PM, Bastien Nocera <hadess@hadess.net> wrote:
> So that bluez compiles with -Werror.
>
> Cheers
>

diff --git a/attrib/gatt.c b/attrib/gatt.c
index 360218b..61c9ed1 100644
--- a/attrib/gatt.c
+++ b/attrib/gatt.c
@@ -71,13 +71,12 @@ static guint16 encode_discover_primary(uint16_t
start, uint16_t end,
 {
 	bt_uuid_t prim;
 	guint16 plen;
-	uint8_t op;

 	bt_uuid16_create(&prim, GATT_PRIM_SVC_UUID);

 	if (uuid == NULL) {
-		/* Discover all primary services */
-		op = ATT_OP_READ_BY_GROUP_REQ;
+		/* Discover all primary services
+		   op = ATT_OP_READ_BY_GROUP_REQ; */
 		plen = enc_read_by_grp_req(start, end, &prim, pdu, len);
 	} else {
 		uint16_t u16;

I guess we don't need the comments as enc_read_by_grp_req already
should already do what ATT_OP_READ_BY_GROUP_REQ was meant.

@@ -2085,9 +2084,9 @@ unsigned int a2dp_config(struct avdtp *session,
struct a2dp_sep *sep,
 	case AVDTP_STATE_IDLE:
 		if (sep->type == AVDTP_SEP_TYPE_SOURCE) {
 			l = server->sources;
-			remote_type = AVDTP_SEP_TYPE_SINK;
+			/* remote_type = AVDTP_SEP_TYPE_SINK; */
 		} else {
-			remote_type = AVDTP_SEP_TYPE_SOURCE;
+			/* remote_type = AVDTP_SEP_TYPE_SOURCE; */
 			l = server->sinks;
 		}

Same here, avdtp_find_remote_sep already take care of finding a match
so remote_type is useless.

@@ -580,7 +579,7 @@ static void hf_io_cb(GIOChannel *chan, gpointer data)

 	server_uuid = HFP_AG_UUID;
 	remote_uuid = HFP_HS_UUID;
-	svclass = HANDSFREE_AGW_SVCLASS_ID;
+	/* svclass = HANDSFREE_AGW_SVCLASS_ID; */

 	device = manager_get_device(&src, &dst, TRUE);
 	if (!device)

Since introduced this variable was never really used, I guess it is
safe to remove it completely too.

@@ -1135,6 +1136,10 @@ gboolean bt_io_accept(GIOChannel *io,
BtIOConnect connect, gpointer user_data,
 	if (!(pfd.revents & POLLOUT)) {
 		int ret;
 		ret = read(sock, &c, 1);
+		if (ret == -1) {
+			ERROR_FAILED(err, "read", errno);
+			return FALSE;
+		}
 	}

We normally use < 0, but I guess it doesn't make any difference since
errno is actually what we should be looking for.

@@ -94,8 +94,12 @@ static int hcrp_credit_grant(int sk, uint16_t tid,
uint32_t credit)
 	memcpy(buf, &hdr, HCRP_PDU_HDR_SIZE);
 	memcpy(buf + HCRP_PDU_HDR_SIZE, &cp, HCRP_CREDIT_GRANT_CP_SIZE);
 	len = write(sk, buf, HCRP_PDU_HDR_SIZE + HCRP_CREDIT_GRANT_CP_SIZE);
+	if (len == -1)
+		return -1;

 	len = read(sk, buf, sizeof(buf));
+	if (len == -1)
+		return -1;
 	memcpy(&hdr, buf, HCRP_PDU_HDR_SIZE);
 	memcpy(&rp, buf + HCRP_PDU_HDR_SIZE, HCRP_CREDIT_GRANT_RP_SIZE);

@@ -119,8 +123,12 @@ static int hcrp_credit_request(int sk, uint16_t
tid, uint32_t *credit)
 	hdr.plen = htons(0);
 	memcpy(buf, &hdr, HCRP_PDU_HDR_SIZE);
 	len = write(sk, buf, HCRP_PDU_HDR_SIZE);
+	if (len == -1)
+		return -1;

 	len = read(sk, buf, sizeof(buf));
+	if (len == -1)
+		return -1;
 	memcpy(&hdr, buf, HCRP_PDU_HDR_SIZE);
 	memcpy(&rp, buf + HCRP_PDU_HDR_SIZE, HCRP_CREDIT_REQUEST_RP_SIZE);

@@ -147,8 +155,12 @@ static int hcrp_get_lpt_status(int sk, uint16_t
tid, uint8_t *lpt_status)
 	hdr.plen = htons(0);
 	memcpy(buf, &hdr, HCRP_PDU_HDR_SIZE);
 	len = write(sk, buf, HCRP_PDU_HDR_SIZE);
+	if (len == -1)
+		return -1;

 	len = read(sk, buf, sizeof(buf));
+	if (len == -1)
+		return -1;
 	memcpy(&hdr, buf, HCRP_PDU_HDR_SIZE);
 	memcpy(&rp, buf + HCRP_PDU_HDR_SIZE, HCRP_GET_LPT_STATUS_RP_SIZE);

Same here.

@@ -250,7 +250,7 @@ static int decode_key(const char *str)
 static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
 {
 	struct uinput_event event;
-	int err;
+	int __attribute__((__unused__)) err;

 	memset(&event, 0, sizeof(event));
 	event.type	= type;

Can't we just removed err here, Im afraid using
__attribute__((__unused__)) is not a good practice and we should try
to avoid using it.

-- 
Luiz Augusto von Dentz
Computer Engineer

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: Warning fixes for GCC 4.6
  2011-05-06  7:52 ` Luiz Augusto von Dentz
@ 2011-05-06 14:48   ` Bastien Nocera
  2011-05-06 15:08     ` Szymon Janc
  2011-05-06 17:43     ` Luiz Augusto von Dentz
  2011-05-06 14:56   ` Bastien Nocera
  1 sibling, 2 replies; 10+ messages in thread
From: Bastien Nocera @ 2011-05-06 14:48 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: BlueZ development

On Fri, 2011-05-06 at 10:52 +0300, Luiz Augusto von Dentz wrote:
> Hi Bastien,
> 
> On Thu, May 5, 2011 at 9:43 PM, Bastien Nocera <hadess@hadess.net> wrote:
> > So that bluez compiles with -Werror.
> >
> > Cheers
> >
> 
> diff --git a/attrib/gatt.c b/attrib/gatt.c
> index 360218b..61c9ed1 100644
> --- a/attrib/gatt.c
> +++ b/attrib/gatt.c
> @@ -71,13 +71,12 @@ static guint16 encode_discover_primary(uint16_t
> start, uint16_t end,
>  {
>  	bt_uuid_t prim;
>  	guint16 plen;
> -	uint8_t op;
> 
>  	bt_uuid16_create(&prim, GATT_PRIM_SVC_UUID);
> 
>  	if (uuid == NULL) {
> -		/* Discover all primary services */
> -		op = ATT_OP_READ_BY_GROUP_REQ;
> +		/* Discover all primary services
> +		   op = ATT_OP_READ_BY_GROUP_REQ; */
>  		plen = enc_read_by_grp_req(start, end, &prim, pdu, len);
>  	} else {
>  		uint16_t u16;
> 
> I guess we don't need the comments as enc_read_by_grp_req already
> should already do what ATT_OP_READ_BY_GROUP_REQ was meant.

I'll remove those.

> @@ -2085,9 +2084,9 @@ unsigned int a2dp_config(struct avdtp *session,
> struct a2dp_sep *sep,
>  	case AVDTP_STATE_IDLE:
>  		if (sep->type == AVDTP_SEP_TYPE_SOURCE) {
>  			l = server->sources;
> -			remote_type = AVDTP_SEP_TYPE_SINK;
> +			/* remote_type = AVDTP_SEP_TYPE_SINK; */
>  		} else {
> -			remote_type = AVDTP_SEP_TYPE_SOURCE;
> +			/* remote_type = AVDTP_SEP_TYPE_SOURCE; */
>  			l = server->sinks;
>  		}
> 
> Same here, avdtp_find_remote_sep already take care of finding a match
> so remote_type is useless.

Ditto.

> @@ -580,7 +579,7 @@ static void hf_io_cb(GIOChannel *chan, gpointer data)
> 
>  	server_uuid = HFP_AG_UUID;
>  	remote_uuid = HFP_HS_UUID;
> -	svclass = HANDSFREE_AGW_SVCLASS_ID;
> +	/* svclass = HANDSFREE_AGW_SVCLASS_ID; */
> 
>  	device = manager_get_device(&src, &dst, TRUE);
>  	if (!device)
> 
> Since introduced this variable was never really used, I guess it is
> safe to remove it completely too.

OK.

> @@ -1135,6 +1136,10 @@ gboolean bt_io_accept(GIOChannel *io,
> BtIOConnect connect, gpointer user_data,
>  	if (!(pfd.revents & POLLOUT)) {
>  		int ret;
>  		ret = read(sock, &c, 1);
> +		if (ret == -1) {
> +			ERROR_FAILED(err, "read", errno);
> +			return FALSE;
> +		}
>  	}
> 
> We normally use < 0, but I guess it doesn't make any difference since
> errno is actually what we should be looking for.

I'll make the change.

> @@ -94,8 +94,12 @@ static int hcrp_credit_grant(int sk, uint16_t tid,
> uint32_t credit)
>  	memcpy(buf, &hdr, HCRP_PDU_HDR_SIZE);
>  	memcpy(buf + HCRP_PDU_HDR_SIZE, &cp, HCRP_CREDIT_GRANT_CP_SIZE);
>  	len = write(sk, buf, HCRP_PDU_HDR_SIZE + HCRP_CREDIT_GRANT_CP_SIZE);
> +	if (len == -1)
> +		return -1;
> 
>  	len = read(sk, buf, sizeof(buf));
> +	if (len == -1)
> +		return -1;
>  	memcpy(&hdr, buf, HCRP_PDU_HDR_SIZE);
>  	memcpy(&rp, buf + HCRP_PDU_HDR_SIZE, HCRP_CREDIT_GRANT_RP_SIZE);
> 
> @@ -119,8 +123,12 @@ static int hcrp_credit_request(int sk, uint16_t
> tid, uint32_t *credit)
>  	hdr.plen = htons(0);
>  	memcpy(buf, &hdr, HCRP_PDU_HDR_SIZE);
>  	len = write(sk, buf, HCRP_PDU_HDR_SIZE);
> +	if (len == -1)
> +		return -1;
> 
>  	len = read(sk, buf, sizeof(buf));
> +	if (len == -1)
> +		return -1;
>  	memcpy(&hdr, buf, HCRP_PDU_HDR_SIZE);
>  	memcpy(&rp, buf + HCRP_PDU_HDR_SIZE, HCRP_CREDIT_REQUEST_RP_SIZE);
> 
> @@ -147,8 +155,12 @@ static int hcrp_get_lpt_status(int sk, uint16_t
> tid, uint8_t *lpt_status)
>  	hdr.plen = htons(0);
>  	memcpy(buf, &hdr, HCRP_PDU_HDR_SIZE);
>  	len = write(sk, buf, HCRP_PDU_HDR_SIZE);
> +	if (len == -1)
> +		return -1;
> 
>  	len = read(sk, buf, sizeof(buf));
> +	if (len == -1)
> +		return -1;
>  	memcpy(&hdr, buf, HCRP_PDU_HDR_SIZE);
>  	memcpy(&rp, buf + HCRP_PDU_HDR_SIZE, HCRP_GET_LPT_STATUS_RP_SIZE);
> 
> Same here.

Yep.

> @@ -250,7 +250,7 @@ static int decode_key(const char *str)
>  static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
>  {
>  	struct uinput_event event;
> -	int err;
> +	int __attribute__((__unused__)) err;
> 
>  	memset(&event, 0, sizeof(event));
>  	event.type	= type;
> 
> Can't we just removed err here, Im afraid using
> __attribute__((__unused__)) is not a good practice and we should try
> to avoid using it.

We either get a warning that the return value is unused, or that we
should be checking the return value. Which one do you prefer?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Warning fixes for GCC 4.6
  2011-05-06  7:52 ` Luiz Augusto von Dentz
  2011-05-06 14:48   ` Bastien Nocera
@ 2011-05-06 14:56   ` Bastien Nocera
  2011-05-06 15:12     ` Gustavo F. Padovan
  1 sibling, 1 reply; 10+ messages in thread
From: Bastien Nocera @ 2011-05-06 14:56 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: BlueZ development

[-- Attachment #1: Type: text/plain, Size: 288 bytes --]

On Fri, 2011-05-06 at 10:52 +0300, Luiz Augusto von Dentz wrote:
> Hi Bastien,
> 
> On Thu, May 5, 2011 at 9:43 PM, Bastien Nocera <hadess@hadess.net> wrote:
> > So that bluez compiles with -Werror.
> >
> > Cheers
> >

Updated patch attached. Only comment left is the "unused" attribute.

[-- Attachment #2: 0001-Fix-set-but-not-unused-variable-GCC-4.6-warnings.patch --]
[-- Type: text/x-patch, Size: 17420 bytes --]

>From 1816c686e1e411ec574c6f168dac43e0ff4d6bd1 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 5 May 2011 19:41:38 +0100
Subject: [PATCH] Fix "set but not unused variable" GCC 4.6 warnings

---
 attrib/gatt.c         |    4 ----
 audio/a2dp.c          |    3 ---
 audio/manager.c       |    2 --
 audio/pcm_bluetooth.c |    4 ++--
 btio/btio.c           |    5 +++++
 compat/fakehid.c      |    6 ++++--
 cups/hcrp.c           |   12 ++++++++++++
 gdbus/object.c        |    3 +--
 input/device.c        |    2 +-
 input/server.c        |    3 ++-
 lib/sdp.c             |    2 +-
 network/common.c      |    2 +-
 plugins/hciops.c      |    4 +---
 plugins/mgmtops.c     |    4 +---
 sbc/sbcinfo.c         |    2 +-
 src/adapter.c         |    6 ------
 src/sdp-xml.c         |    4 ----
 src/sdpd-request.c    |    2 +-
 src/textfile.c        |    8 ++++++++
 test/hciemu.c         |    6 ++++++
 test/hstest.c         |    7 ++++++-
 test/rctest.c         |    2 --
 test/scotest.c        |    2 --
 test/test-textfile.c  |    2 ++
 tools/hciattach.c     |    6 +++---
 tools/hcitool.c       |    2 --
 26 files changed, 58 insertions(+), 47 deletions(-)

diff --git a/attrib/gatt.c b/attrib/gatt.c
index 360218b..095b157 100644
--- a/attrib/gatt.c
+++ b/attrib/gatt.c
@@ -71,13 +71,11 @@ static guint16 encode_discover_primary(uint16_t start, uint16_t end,
 {
 	bt_uuid_t prim;
 	guint16 plen;
-	uint8_t op;
 
 	bt_uuid16_create(&prim, GATT_PRIM_SVC_UUID);
 
 	if (uuid == NULL) {
 		/* Discover all primary services */
-		op = ATT_OP_READ_BY_GROUP_REQ;
 		plen = enc_read_by_grp_req(start, end, &prim, pdu, len);
 	} else {
 		uint16_t u16;
@@ -86,8 +84,6 @@ static guint16 encode_discover_primary(uint16_t start, uint16_t end,
 		int vlen;
 
 		/* Discover primary service by service UUID */
-		op = ATT_OP_FIND_BY_TYPE_REQ;
-
 		if (uuid->type == BT_UUID16) {
 			u16 = htobs(uuid->value.u16);
 			value = &u16;
diff --git a/audio/a2dp.c b/audio/a2dp.c
index 9cd7207..52acdfa 100644
--- a/audio/a2dp.c
+++ b/audio/a2dp.c
@@ -2038,7 +2038,6 @@ unsigned int a2dp_config(struct avdtp *session, struct a2dp_sep *sep,
 	struct avdtp_media_codec_capability *codec_cap = NULL;
 	int posix_err;
 	bdaddr_t src;
-	uint8_t remote_type;
 
 	avdtp_get_peers(session, &src, NULL);
 	server = find_server(servers, &src);
@@ -2085,9 +2084,7 @@ unsigned int a2dp_config(struct avdtp *session, struct a2dp_sep *sep,
 	case AVDTP_STATE_IDLE:
 		if (sep->type == AVDTP_SEP_TYPE_SOURCE) {
 			l = server->sources;
-			remote_type = AVDTP_SEP_TYPE_SINK;
 		} else {
-			remote_type = AVDTP_SEP_TYPE_SOURCE;
 			l = server->sinks;
 		}
 
diff --git a/audio/manager.c b/audio/manager.c
index 7e206be..d4ff906 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -562,7 +562,6 @@ static void hf_io_cb(GIOChannel *chan, gpointer data)
 	GError *err = NULL;
 	uint8_t ch;
 	const char *server_uuid, *remote_uuid;
-	uint16_t svclass;
 	struct audio_device *device;
 	int perr;
 
@@ -580,7 +579,6 @@ static void hf_io_cb(GIOChannel *chan, gpointer data)
 
 	server_uuid = HFP_AG_UUID;
 	remote_uuid = HFP_HS_UUID;
-	svclass = HANDSFREE_AGW_SVCLASS_ID;
 
 	device = manager_get_device(&src, &dst, TRUE);
 	if (!device)
diff --git a/audio/pcm_bluetooth.c b/audio/pcm_bluetooth.c
index 799f17f..2d9f178 100644
--- a/audio/pcm_bluetooth.c
+++ b/audio/pcm_bluetooth.c
@@ -820,7 +820,7 @@ static int bluetooth_playback_poll_revents(snd_pcm_ioplug_t *io,
 					unsigned short *revents)
 {
 	static char buf[1];
-	int ret;
+	int ret = 0;
 
 	DBG("");
 
@@ -838,7 +838,7 @@ static int bluetooth_playback_poll_revents(snd_pcm_ioplug_t *io,
 
 	*revents = (pfds[0].revents & POLLIN) ? POLLOUT : 0;
 
-	return 0;
+	return ret;
 }
 
 
diff --git a/btio/btio.c b/btio/btio.c
index 6d71b90..64cd8c6 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -884,6 +884,7 @@ static gboolean l2cap_get(int sock, GError **err, BtIOOption opt1,
 			*(va_arg(args, uint8_t *)) = l2o.mode;
 			break;
 		case BT_IO_OPT_FLUSHABLE:
+			flushable = TRUE;
 			if (l2cap_get_flushable(sock, &flushable) < 0) {
 				ERROR_FAILED(err, "get_flushable", errno);
 				return FALSE;
@@ -1135,6 +1136,10 @@ gboolean bt_io_accept(GIOChannel *io, BtIOConnect connect, gpointer user_data,
 	if (!(pfd.revents & POLLOUT)) {
 		int ret;
 		ret = read(sock, &c, 1);
+		if (ret < 0) {
+			ERROR_FAILED(err, "read", errno);
+			return FALSE;
+		}
 	}
 
 	accept_add(io, connect, user_data, destroy);
diff --git a/compat/fakehid.c b/compat/fakehid.c
index b996d10..0974d0a 100644
--- a/compat/fakehid.c
+++ b/compat/fakehid.c
@@ -60,13 +60,13 @@ static void sig_term(int sig)
 	__io_canceled = 1;
 }
 
-static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
+static int send_event(int fd, uint16_t type, uint16_t code, int32_t value)
 {
 	struct uinput_event event;
 	int len;
 
 	if (fd <= fileno(stderr))
-		return;
+		return -1;
 
 	memset(&event, 0, sizeof(event));
 	event.type = type;
@@ -74,6 +74,8 @@ static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
 	event.value = value;
 
 	len = write(fd, &event, sizeof(event));
+
+	return len;
 }
 
 static int uinput_create(char *name, int keyboard, int mouse)
diff --git a/cups/hcrp.c b/cups/hcrp.c
index 7aafcdc..ad88ff6 100644
--- a/cups/hcrp.c
+++ b/cups/hcrp.c
@@ -94,8 +94,12 @@ static int hcrp_credit_grant(int sk, uint16_t tid, uint32_t credit)
 	memcpy(buf, &hdr, HCRP_PDU_HDR_SIZE);
 	memcpy(buf + HCRP_PDU_HDR_SIZE, &cp, HCRP_CREDIT_GRANT_CP_SIZE);
 	len = write(sk, buf, HCRP_PDU_HDR_SIZE + HCRP_CREDIT_GRANT_CP_SIZE);
+	if (len < 0)
+		return -1;
 
 	len = read(sk, buf, sizeof(buf));
+	if (len < 0)
+		return -1;
 	memcpy(&hdr, buf, HCRP_PDU_HDR_SIZE);
 	memcpy(&rp, buf + HCRP_PDU_HDR_SIZE, HCRP_CREDIT_GRANT_RP_SIZE);
 
@@ -119,8 +123,12 @@ static int hcrp_credit_request(int sk, uint16_t tid, uint32_t *credit)
 	hdr.plen = htons(0);
 	memcpy(buf, &hdr, HCRP_PDU_HDR_SIZE);
 	len = write(sk, buf, HCRP_PDU_HDR_SIZE);
+	if (len < 0)
+		return -1;
 
 	len = read(sk, buf, sizeof(buf));
+	if (len < 0)
+		return -1;
 	memcpy(&hdr, buf, HCRP_PDU_HDR_SIZE);
 	memcpy(&rp, buf + HCRP_PDU_HDR_SIZE, HCRP_CREDIT_REQUEST_RP_SIZE);
 
@@ -147,8 +155,12 @@ static int hcrp_get_lpt_status(int sk, uint16_t tid, uint8_t *lpt_status)
 	hdr.plen = htons(0);
 	memcpy(buf, &hdr, HCRP_PDU_HDR_SIZE);
 	len = write(sk, buf, HCRP_PDU_HDR_SIZE);
+	if (len < 0)
+		return -1;
 
 	len = read(sk, buf, sizeof(buf));
+	if (len < 0)
+		return -1;
 	memcpy(&hdr, buf, HCRP_PDU_HDR_SIZE);
 	memcpy(&rp, buf + HCRP_PDU_HDR_SIZE, HCRP_GET_LPT_STATUS_RP_SIZE);
 
diff --git a/gdbus/object.c b/gdbus/object.c
index eaa2e1a..d17a101 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -255,14 +255,13 @@ void g_dbus_pending_success(DBusConnection *connection,
 
         for (list = pending_security; list; list = list->next) {
 		struct security_data *secdata = list->data;
-		DBusHandlerResult result;
 
 		if (secdata->pending != pending)
 			continue;
 
 		pending_security = g_slist_remove(pending_security, secdata);
 
-		result = process_message(connection, secdata->message,
+		process_message(connection, secdata->message,
 				secdata->method, secdata->iface_user_data);
 
 		dbus_message_unref(secdata->message);
diff --git a/input/device.c b/input/device.c
index 554f5ac..550e1c7 100644
--- a/input/device.c
+++ b/input/device.c
@@ -250,7 +250,7 @@ static int decode_key(const char *str)
 static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
 {
 	struct uinput_event event;
-	int err;
+	int __attribute__((__unused__)) err;
 
 	memset(&event, 0, sizeof(event));
 	event.type	= type;
diff --git a/input/server.c b/input/server.c
index d98018b..15bf5b3 100644
--- a/input/server.c
+++ b/input/server.c
@@ -91,7 +91,8 @@ static void connect_event_cb(GIOChannel *chan, GError *err, gpointer data)
 	/* Send unplug virtual cable to unknown devices */
 	if (ret == -ENOENT && psm == L2CAP_PSM_HIDP_CTRL) {
 		unsigned char unplug = 0x15;
-		int err, sk = g_io_channel_unix_get_fd(chan);
+		int __attribute__((__unused__)) err;
+		int sk = g_io_channel_unix_get_fd(chan);
 		err = write(sk, &unplug, sizeof(unplug));
 	}
 
diff --git a/lib/sdp.c b/lib/sdp.c
index d24d1e2..d852587 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -3319,7 +3319,7 @@ int sdp_service_search_req(sdp_session_t *session, const sdp_list_t *search,
 	uint32_t reqsize = 0, _reqsize;
 	uint32_t rspsize = 0, rsplen;
 	int seqlen = 0;
-	int total_rec_count, rec_count;
+	int __attribute__((__unused__)) total_rec_count, rec_count;
 	unsigned scanned, pdata_len;
 	uint8_t *pdata, *_pdata;
 	uint8_t *reqbuf, *rspbuf;
diff --git a/network/common.c b/network/common.c
index ef72679..38d2c49 100644
--- a/network/common.c
+++ b/network/common.c
@@ -215,7 +215,7 @@ int bnep_if_up(const char *devname)
 int bnep_if_down(const char *devname)
 {
 	struct ifreq ifr;
-	int sk, err;
+	int sk, __attribute__((__unused__)) err;
 
 	sk = socket(AF_INET, SOCK_DGRAM, 0);
 
diff --git a/plugins/hciops.c b/plugins/hciops.c
index 2c49e35..49dd48d 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
@@ -2754,7 +2754,7 @@ static void init_conn_list(int index)
 	struct dev_info *dev = &devs[index];
 	struct hci_conn_list_req *cl;
 	struct hci_conn_info *ci;
-	int err, i;
+	int i;
 
 	DBG("hci%d", index);
 
@@ -2780,8 +2780,6 @@ static void init_conn_list(int index)
 		conn->handle = ci->handle;
 	}
 
-	err = 0;
-
 failed:
 	g_free(cl);
 }
diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index 9e1cfac..b831044 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
@@ -207,7 +207,7 @@ static int mgmt_update_powered(int index, uint8_t powered)
 {
 	struct controller_info *info;
 	struct btd_adapter *adapter;
-	gboolean pairable, discoverable;
+	gboolean pairable;
 	uint8_t on_mode;
 
 	if (index > max_index) {
@@ -238,8 +238,6 @@ static int mgmt_update_powered(int index, uint8_t powered)
 
 	btd_adapter_get_mode(adapter, NULL, &on_mode, &pairable);
 
-	discoverable = (on_mode == MODE_DISCOVERABLE);
-
 	if (on_mode == MODE_DISCOVERABLE && !info->discoverable)
 		mgmt_set_discoverable(index, TRUE);
 	else if (on_mode == MODE_CONNECTABLE && !info->connectable)
diff --git a/sbc/sbcinfo.c b/sbc/sbcinfo.c
index 6d92679..63f05aa 100644
--- a/sbc/sbcinfo.c
+++ b/sbc/sbcinfo.c
@@ -281,7 +281,7 @@ static int analyze_file(char *filename)
 	printf("Subbands\t\t%d\n", subbands);
 	printf("Block length\t\t%d\n", blocks);
 	printf("Sampling frequency\t%s\n", freq2str(freq));
-	printf("Channel mode\t\t%s\n", mode2str(hdr.channel_mode));
+	printf("Channel mode\t\t%s\n", mode2str(mode));
 	printf("Allocation method\t%s\n", method ? "SNR" : "Loudness");
 	printf("Bitpool\t\t\t%d", bitpool[0]);
 	for (n = 1; n < SIZE; n++)
diff --git a/src/adapter.c b/src/adapter.c
index f068335..76fc01b 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -476,13 +476,10 @@ static int set_mode(struct btd_adapter *adapter, uint8_t new_mode,
 {
 	int err;
 	const char *modestr;
-	gboolean discoverable;
 
 	if (adapter->pending_mode != NULL)
 		return -EALREADY;
 
-	discoverable = new_mode == MODE_DISCOVERABLE;
-
 	if (!adapter->up && new_mode != MODE_OFF) {
 		err = adapter_ops->set_powered(adapter->dev_id, TRUE);
 		if (err < 0)
@@ -3405,7 +3402,6 @@ gboolean adapter_powering_down(struct btd_adapter *adapter)
 int btd_adapter_restore_powered(struct btd_adapter *adapter)
 {
 	char mode[14], address[18];
-	gboolean discoverable;
 
 	if (!adapter_ops)
 		return -EINVAL;
@@ -3421,8 +3417,6 @@ int btd_adapter_restore_powered(struct btd_adapter *adapter)
 						g_str_equal(mode, "off"))
 		return 0;
 
-	discoverable = get_mode(&adapter->bdaddr, mode) == MODE_DISCOVERABLE;
-
 	return adapter_ops->set_powered(adapter->dev_id, TRUE);
 }
 
diff --git a/src/sdp-xml.c b/src/sdp-xml.c
index 3aa9df0..62226cc 100644
--- a/src/sdp-xml.c
+++ b/src/sdp-xml.c
@@ -47,7 +47,6 @@ static void convert_raw_data_to_xml(sdp_data_t *value, int indent_level,
 	int i, hex;
 	char buf[STRBUFSIZE];
 	char indent[MAXINDENT];
-	char next_indent[MAXINDENT];
 
 	if (!value)
 		return;
@@ -57,12 +56,9 @@ static void convert_raw_data_to_xml(sdp_data_t *value, int indent_level,
 
 	for (i = 0; i < indent_level; i++) {
 		indent[i] = '\t';
-		next_indent[i] = '\t';
 	}
 
 	indent[i] = '\0';
-	next_indent[i] = '\t';
-	next_indent[i + 1] = '\0';
 
 	buf[STRBUFSIZE - 1] = '\0';
 
diff --git a/src/sdpd-request.c b/src/sdpd-request.c
index 1722f78..287acc2 100644
--- a/src/sdpd-request.c
+++ b/src/sdpd-request.c
@@ -962,7 +962,7 @@ static void process_request(sdp_req_t *req)
 	sdp_pdu_hdr_t *rsphdr;
 	sdp_buf_t rsp;
 	uint8_t *buf = malloc(USHRT_MAX);
-	int sent = 0;
+	int __attribute__((__unused__)) sent = 0;
 	int status = SDP_INVALID_SYNTAX;
 
 	memset(buf, 0, USHRT_MAX);
diff --git a/src/textfile.c b/src/textfile.c
index d115ff6..2645f9a 100644
--- a/src/textfile.c
+++ b/src/textfile.c
@@ -204,6 +204,10 @@ static int write_key(const char *pathname, const char *key, const char *value, i
 	if (!size) {
 		if (value) {
 			pos = lseek(fd, size, SEEK_SET);
+			if (pos == (off_t) -1) {
+				err = errno;
+				goto unlock;
+			}
 			err = write_key_value(fd, key, value);
 		}
 		goto unlock;
@@ -222,6 +226,10 @@ static int write_key(const char *pathname, const char *key, const char *value, i
 		if (value) {
 			munmap(map, size);
 			pos = lseek(fd, size, SEEK_SET);
+			if (pos == (off_t) -1) {
+				err = errno;
+				goto unlock;
+			}
 			err = write_key_value(fd, key, value);
 		}
 		goto unlock;
diff --git a/test/hciemu.c b/test/hciemu.c
index 66f99a9..27e8275 100644
--- a/test/hciemu.c
+++ b/test/hciemu.c
@@ -222,7 +222,11 @@ static int write_snoop(int fd, int type, int incoming, unsigned char *buf, int l
 		pkt.flags |= ntohl(0x02);
 
 	err = write(fd, &pkt, BTSNOOP_PKT_SIZE);
+	if (err < 0)
+		return -1;
 	err = write(fd, buf, size);
+	if (err < 0)
+		return -1;
 
 	return 0;
 }
@@ -899,6 +903,8 @@ static gboolean io_acl_data(GIOChannel *chan, GIOCondition cond, gpointer data)
 	write_snoop(vdev.dd, HCI_ACLDATA_PKT, 1, buf, len);
 
 	err = write(vdev.fd, buf, len);
+	if (err < 0)
+		return FALSE;
 
 	return TRUE;
 }
diff --git a/test/hstest.c b/test/hstest.c
index 08f2257..07124c1 100644
--- a/test/hstest.c
+++ b/test/hstest.c
@@ -244,8 +244,13 @@ int main(int argc, char *argv[])
 
 	fprintf(stderr, "SCO audio channel connected (handle %d, mtu %d)\n", sco_handle, sco_mtu);
 
-	if (mode == RECORD)
+	if (mode == RECORD) {
 		err = write(rd, "RING\r\n", 6);
+		if (err < 0) {
+			perror("Can't write \"RING\"");
+			return -1;
+		}
+	}
 
 	maxfd = (rd > sd) ? rd : sd;
 
diff --git a/test/rctest.c b/test/rctest.c
index b3804f5..9754f52 100644
--- a/test/rctest.c
+++ b/test/rctest.c
@@ -417,13 +417,11 @@ static void recv_mode(int sk)
 	struct timeval tv_beg, tv_end, tv_diff;
 	char ts[30];
 	long total;
-	uint32_t seq;
 
 	syslog(LOG_INFO, "Receiving ...");
 
 	memset(ts, 0, sizeof(ts));
 
-	seq = 0;
 	while (1) {
 		gettimeofday(&tv_beg,NULL);
 		total = 0;
diff --git a/test/scotest.c b/test/scotest.c
index 50b622a..17bd8a6 100644
--- a/test/scotest.c
+++ b/test/scotest.c
@@ -216,11 +216,9 @@ static void recv_mode(int sk)
 {
 	struct timeval tv_beg,tv_end,tv_diff;
 	long total;
-	uint32_t seq;
 
 	syslog(LOG_INFO, "Receiving ...");
 
-	seq = 0;
 	while (1) {
 		gettimeofday(&tv_beg, NULL);
 		total = 0;
diff --git a/test/test-textfile.c b/test/test-textfile.c
index 970e9e7..0786022 100644
--- a/test/test-textfile.c
+++ b/test/test-textfile.c
@@ -51,6 +51,8 @@ int main(int argc, char *argv[])
 
 	fd = creat(filename, 0644);
 	err = ftruncate(fd, 0);
+	if (err < 0)
+		fprintf(stderr, "%s (%d)\n", strerror(errno), errno);
 
 	memset(value, 0, sizeof(value));
 	for (i = 0; i < (size / sizeof(value)); i++)
diff --git a/tools/hciattach.c b/tools/hciattach.c
index e4d5aa1..bc56f31 100644
--- a/tools/hciattach.c
+++ b/tools/hciattach.c
@@ -351,7 +351,7 @@ static int bcsp_max_retries = 10;
 static void bcsp_tshy_sig_alarm(int sig)
 {
 	unsigned char bcsp_sync_pkt[10] = {0xc0,0x00,0x41,0x00,0xbe,0xda,0xdc,0xed,0xed,0xc0};
-	int len;
+	int __attribute__((__unused__)) len;
 	static int retries = 0;
 
 	if (retries < bcsp_max_retries) {
@@ -369,7 +369,7 @@ static void bcsp_tshy_sig_alarm(int sig)
 static void bcsp_tconf_sig_alarm(int sig)
 {
 	unsigned char bcsp_conf_pkt[10] = {0xc0,0x00,0x41,0x00,0xbe,0xad,0xef,0xac,0xed,0xc0};
-	int len;
+	int __attribute__((__unused__)) len;
 	static int retries = 0;
 
 	if (retries < bcsp_max_retries){
@@ -394,7 +394,7 @@ static int bcsp(int fd, struct uart_t *u, struct termios *ti)
 		bcspconf[4]     = {0xad,0xef,0xac,0xed},
 		bcspconfresp[4] = {0xde,0xad,0xd0,0xd0};
 	struct sigaction sa;
-	int len;
+	int __attribute__((__unused__)) len;
 
 	if (set_speed(fd, ti, u->speed) < 0) {
 		perror("Can't set default baud rate");
diff --git a/tools/hcitool.c b/tools/hcitool.c
index a117449..ece187c 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -2351,7 +2351,6 @@ static int print_advertising_devices(int dd, uint8_t filter_type)
 	unsigned char buf[HCI_MAX_EVENT_SIZE], *ptr;
 	struct hci_filter nf, of;
 	socklen_t olen;
-	hci_event_hdr *hdr;
 	int num, len;
 
 	olen = sizeof(of);
@@ -2382,7 +2381,6 @@ static int print_advertising_devices(int dd, uint8_t filter_type)
 			goto done;
 		}
 
-		hdr = (void *) (buf + 1);
 		ptr = buf + (1 + HCI_EVENT_HDR_SIZE);
 		len -= (1 + HCI_EVENT_HDR_SIZE);
 
-- 
1.7.5


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: Warning fixes for GCC 4.6
  2011-05-06 14:48   ` Bastien Nocera
@ 2011-05-06 15:08     ` Szymon Janc
  2011-05-06 17:43     ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 10+ messages in thread
From: Szymon Janc @ 2011-05-06 15:08 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: Luiz Augusto von Dentz, BlueZ development

Hi,

> > Can't we just removed err here, Im afraid using
> > __attribute__((__unused__)) is not a good practice and we should try
> > to avoid using it.
> 
> We either get a warning that the return value is unused, or that we
> should be checking the return value. Which one do you prefer?

Maybe sth like this:

diff --git a/input/device.c b/input/device.c
index 316b2cc..2da2030 100644
--- a/input/device.c
+++ b/input/device.c
@@ -250,14 +250,14 @@ static int decode_key(const char *str)
 static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
 {
        struct uinput_event event;
-       int err;
 
        memset(&event, 0, sizeof(event));
        event.type      = type;
        event.code      = code;
        event.value     = value;
 
-       err = write(fd, &event, sizeof(event));
+       if (write(fd, &event, sizeof(event)) < 0)
+               error("input: send_event failed: %s", strerror(errno));
 }

-- 
BR
Szymon Janc

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: Warning fixes for GCC 4.6
  2011-05-06 14:56   ` Bastien Nocera
@ 2011-05-06 15:12     ` Gustavo F. Padovan
  0 siblings, 0 replies; 10+ messages in thread
From: Gustavo F. Padovan @ 2011-05-06 15:12 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: Luiz Augusto von Dentz, BlueZ development

Hi Bastien,

* Bastien Nocera <hadess@hadess.net> [2011-05-06 15:56:28 +0100]:

> On Fri, 2011-05-06 at 10:52 +0300, Luiz Augusto von Dentz wrote:
> > Hi Bastien,
> > 
> > On Thu, May 5, 2011 at 9:43 PM, Bastien Nocera <hadess@hadess.net> wrote:
> > > So that bluez compiles with -Werror.
> > >
> > > Cheers
> > >
> 
> Updated patch attached. Only comment left is the "unused" attribute.

> From 1816c686e1e411ec574c6f168dac43e0ff4d6bd1 Mon Sep 17 00:00:00 2001
> From: Bastien Nocera <hadess@hadess.net>
> Date: Thu, 5 May 2011 19:41:38 +0100
> Subject: [PATCH] Fix "set but not unused variable" GCC 4.6 warnings
> 
> ---
>  attrib/gatt.c         |    4 ----
>  audio/a2dp.c          |    3 ---
>  audio/manager.c       |    2 --
>  audio/pcm_bluetooth.c |    4 ++--
>  btio/btio.c           |    5 +++++
>  compat/fakehid.c      |    6 ++++--
>  cups/hcrp.c           |   12 ++++++++++++
>  gdbus/object.c        |    3 +--

The gdbus changes need a new patch. It also needs to be applied to Obexd
ConnMan and oFono.

-- 
Gustavo F. Padovan
http://profusion.mobi

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Warning fixes for GCC 4.6
  2011-05-06 14:48   ` Bastien Nocera
  2011-05-06 15:08     ` Szymon Janc
@ 2011-05-06 17:43     ` Luiz Augusto von Dentz
  2011-05-06 17:50       ` Bastien Nocera
  1 sibling, 1 reply; 10+ messages in thread
From: Luiz Augusto von Dentz @ 2011-05-06 17:43 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: BlueZ development

Hi,

On Fri, May 6, 2011 at 5:48 PM, Bastien Nocera <hadess@hadess.net> wrote:
>> @@ -250,7 +250,7 @@ static int decode_key(const char *str)
>>  static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
>>  {
>>       struct uinput_event event;
>> -     int err;
>> +     int __attribute__((__unused__)) err;
>>
>>       memset(&event, 0, sizeof(event));
>>       event.type      = type;
>>
>> Can't we just removed err here, Im afraid using
>> __attribute__((__unused__)) is not a good practice and we should try
>> to avoid using it.
>
> We either get a warning that the return value is unused, or that we
> should be checking the return value. Which one do you prefer?

I guess I would prefer checking the return properly if you don't mind.
Also like Gustavo mentioned, it would be great to have the gdbus
changes in a separate patch so we can apply to other project which
uses it.

-- 
Luiz Augusto von Dentz
Computer Engineer

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Warning fixes for GCC 4.6
  2011-05-06 17:43     ` Luiz Augusto von Dentz
@ 2011-05-06 17:50       ` Bastien Nocera
  2011-05-06 17:54         ` Bastien Nocera
  0 siblings, 1 reply; 10+ messages in thread
From: Bastien Nocera @ 2011-05-06 17:50 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: BlueZ development

[-- Attachment #1: Type: text/plain, Size: 1031 bytes --]

On Fri, 2011-05-06 at 20:43 +0300, Luiz Augusto von Dentz wrote:
> Hi,
> 
> On Fri, May 6, 2011 at 5:48 PM, Bastien Nocera <hadess@hadess.net> wrote:
> >> @@ -250,7 +250,7 @@ static int decode_key(const char *str)
> >>  static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
> >>  {
> >>       struct uinput_event event;
> >> -     int err;
> >> +     int __attribute__((__unused__)) err;
> >>
> >>       memset(&event, 0, sizeof(event));
> >>       event.type      = type;
> >>
> >> Can't we just removed err here, Im afraid using
> >> __attribute__((__unused__)) is not a good practice and we should try
> >> to avoid using it.
> >
> > We either get a warning that the return value is unused, or that we
> > should be checking the return value. Which one do you prefer?
> 
> I guess I would prefer checking the return properly if you don't mind.

Done.

> Also like Gustavo mentioned, it would be great to have the gdbus
> changes in a separate patch so we can apply to other project which
> uses it.

Done.

[-- Attachment #2: 0001-GDBus-Fix-set-but-not-unused-variable-GCC-4.6-warnin.patch --]
[-- Type: text/x-patch, Size: 985 bytes --]

>From 59b84e616cec298cfb87ab08bbc5ea31b21adf17 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Fri, 6 May 2011 18:49:11 +0100
Subject: [PATCH 1/2] GDBus: Fix "set but not unused variable" GCC 4.6
 warnings

---
 gdbus/object.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/gdbus/object.c b/gdbus/object.c
index eaa2e1a..d17a101 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -255,14 +255,13 @@ void g_dbus_pending_success(DBusConnection *connection,
 
         for (list = pending_security; list; list = list->next) {
 		struct security_data *secdata = list->data;
-		DBusHandlerResult result;
 
 		if (secdata->pending != pending)
 			continue;
 
 		pending_security = g_slist_remove(pending_security, secdata);
 
-		result = process_message(connection, secdata->message,
+		process_message(connection, secdata->message,
 				secdata->method, secdata->iface_user_data);
 
 		dbus_message_unref(secdata->message);
-- 
1.7.5.1


[-- Attachment #3: 0002-Fix-set-but-not-unused-variable-GCC-4.6-warnings.patch --]
[-- Type: text/x-patch, Size: 16938 bytes --]

>From 1177b9a0c9cabcf15982ea78801465212d2564aa Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Fri, 6 May 2011 18:49:26 +0100
Subject: [PATCH 2/2] Fix "set but not unused variable" GCC 4.6 warnings

---
 attrib/gatt.c         |    4 ----
 audio/a2dp.c          |    3 ---
 audio/manager.c       |    2 --
 audio/pcm_bluetooth.c |    4 ++--
 btio/btio.c           |    5 +++++
 compat/fakehid.c      |    6 ++++--
 cups/hcrp.c           |   12 ++++++++++++
 input/device.c        |    4 ++--
 input/server.c        |    3 ++-
 lib/sdp.c             |    2 +-
 network/common.c      |    2 +-
 plugins/hciops.c      |    4 +---
 plugins/mgmtops.c     |    4 +---
 sbc/sbcinfo.c         |    2 +-
 src/adapter.c         |    6 ------
 src/sdp-xml.c         |    4 ----
 src/sdpd-request.c    |    2 +-
 src/textfile.c        |    8 ++++++++
 test/hciemu.c         |    6 ++++++
 test/hstest.c         |    7 ++++++-
 test/rctest.c         |    2 --
 test/scotest.c        |    2 --
 test/test-textfile.c  |    2 ++
 tools/hciattach.c     |    6 +++---
 tools/hcitool.c       |    2 --
 25 files changed, 58 insertions(+), 46 deletions(-)

diff --git a/attrib/gatt.c b/attrib/gatt.c
index 360218b..095b157 100644
--- a/attrib/gatt.c
+++ b/attrib/gatt.c
@@ -71,13 +71,11 @@ static guint16 encode_discover_primary(uint16_t start, uint16_t end,
 {
 	bt_uuid_t prim;
 	guint16 plen;
-	uint8_t op;
 
 	bt_uuid16_create(&prim, GATT_PRIM_SVC_UUID);
 
 	if (uuid == NULL) {
 		/* Discover all primary services */
-		op = ATT_OP_READ_BY_GROUP_REQ;
 		plen = enc_read_by_grp_req(start, end, &prim, pdu, len);
 	} else {
 		uint16_t u16;
@@ -86,8 +84,6 @@ static guint16 encode_discover_primary(uint16_t start, uint16_t end,
 		int vlen;
 
 		/* Discover primary service by service UUID */
-		op = ATT_OP_FIND_BY_TYPE_REQ;
-
 		if (uuid->type == BT_UUID16) {
 			u16 = htobs(uuid->value.u16);
 			value = &u16;
diff --git a/audio/a2dp.c b/audio/a2dp.c
index 9cd7207..52acdfa 100644
--- a/audio/a2dp.c
+++ b/audio/a2dp.c
@@ -2038,7 +2038,6 @@ unsigned int a2dp_config(struct avdtp *session, struct a2dp_sep *sep,
 	struct avdtp_media_codec_capability *codec_cap = NULL;
 	int posix_err;
 	bdaddr_t src;
-	uint8_t remote_type;
 
 	avdtp_get_peers(session, &src, NULL);
 	server = find_server(servers, &src);
@@ -2085,9 +2084,7 @@ unsigned int a2dp_config(struct avdtp *session, struct a2dp_sep *sep,
 	case AVDTP_STATE_IDLE:
 		if (sep->type == AVDTP_SEP_TYPE_SOURCE) {
 			l = server->sources;
-			remote_type = AVDTP_SEP_TYPE_SINK;
 		} else {
-			remote_type = AVDTP_SEP_TYPE_SOURCE;
 			l = server->sinks;
 		}
 
diff --git a/audio/manager.c b/audio/manager.c
index 7e206be..d4ff906 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -562,7 +562,6 @@ static void hf_io_cb(GIOChannel *chan, gpointer data)
 	GError *err = NULL;
 	uint8_t ch;
 	const char *server_uuid, *remote_uuid;
-	uint16_t svclass;
 	struct audio_device *device;
 	int perr;
 
@@ -580,7 +579,6 @@ static void hf_io_cb(GIOChannel *chan, gpointer data)
 
 	server_uuid = HFP_AG_UUID;
 	remote_uuid = HFP_HS_UUID;
-	svclass = HANDSFREE_AGW_SVCLASS_ID;
 
 	device = manager_get_device(&src, &dst, TRUE);
 	if (!device)
diff --git a/audio/pcm_bluetooth.c b/audio/pcm_bluetooth.c
index 799f17f..2d9f178 100644
--- a/audio/pcm_bluetooth.c
+++ b/audio/pcm_bluetooth.c
@@ -820,7 +820,7 @@ static int bluetooth_playback_poll_revents(snd_pcm_ioplug_t *io,
 					unsigned short *revents)
 {
 	static char buf[1];
-	int ret;
+	int ret = 0;
 
 	DBG("");
 
@@ -838,7 +838,7 @@ static int bluetooth_playback_poll_revents(snd_pcm_ioplug_t *io,
 
 	*revents = (pfds[0].revents & POLLIN) ? POLLOUT : 0;
 
-	return 0;
+	return ret;
 }
 
 
diff --git a/btio/btio.c b/btio/btio.c
index 6d71b90..64cd8c6 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -884,6 +884,7 @@ static gboolean l2cap_get(int sock, GError **err, BtIOOption opt1,
 			*(va_arg(args, uint8_t *)) = l2o.mode;
 			break;
 		case BT_IO_OPT_FLUSHABLE:
+			flushable = TRUE;
 			if (l2cap_get_flushable(sock, &flushable) < 0) {
 				ERROR_FAILED(err, "get_flushable", errno);
 				return FALSE;
@@ -1135,6 +1136,10 @@ gboolean bt_io_accept(GIOChannel *io, BtIOConnect connect, gpointer user_data,
 	if (!(pfd.revents & POLLOUT)) {
 		int ret;
 		ret = read(sock, &c, 1);
+		if (ret < 0) {
+			ERROR_FAILED(err, "read", errno);
+			return FALSE;
+		}
 	}
 
 	accept_add(io, connect, user_data, destroy);
diff --git a/compat/fakehid.c b/compat/fakehid.c
index b996d10..0974d0a 100644
--- a/compat/fakehid.c
+++ b/compat/fakehid.c
@@ -60,13 +60,13 @@ static void sig_term(int sig)
 	__io_canceled = 1;
 }
 
-static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
+static int send_event(int fd, uint16_t type, uint16_t code, int32_t value)
 {
 	struct uinput_event event;
 	int len;
 
 	if (fd <= fileno(stderr))
-		return;
+		return -1;
 
 	memset(&event, 0, sizeof(event));
 	event.type = type;
@@ -74,6 +74,8 @@ static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
 	event.value = value;
 
 	len = write(fd, &event, sizeof(event));
+
+	return len;
 }
 
 static int uinput_create(char *name, int keyboard, int mouse)
diff --git a/cups/hcrp.c b/cups/hcrp.c
index 7aafcdc..ad88ff6 100644
--- a/cups/hcrp.c
+++ b/cups/hcrp.c
@@ -94,8 +94,12 @@ static int hcrp_credit_grant(int sk, uint16_t tid, uint32_t credit)
 	memcpy(buf, &hdr, HCRP_PDU_HDR_SIZE);
 	memcpy(buf + HCRP_PDU_HDR_SIZE, &cp, HCRP_CREDIT_GRANT_CP_SIZE);
 	len = write(sk, buf, HCRP_PDU_HDR_SIZE + HCRP_CREDIT_GRANT_CP_SIZE);
+	if (len < 0)
+		return -1;
 
 	len = read(sk, buf, sizeof(buf));
+	if (len < 0)
+		return -1;
 	memcpy(&hdr, buf, HCRP_PDU_HDR_SIZE);
 	memcpy(&rp, buf + HCRP_PDU_HDR_SIZE, HCRP_CREDIT_GRANT_RP_SIZE);
 
@@ -119,8 +123,12 @@ static int hcrp_credit_request(int sk, uint16_t tid, uint32_t *credit)
 	hdr.plen = htons(0);
 	memcpy(buf, &hdr, HCRP_PDU_HDR_SIZE);
 	len = write(sk, buf, HCRP_PDU_HDR_SIZE);
+	if (len < 0)
+		return -1;
 
 	len = read(sk, buf, sizeof(buf));
+	if (len < 0)
+		return -1;
 	memcpy(&hdr, buf, HCRP_PDU_HDR_SIZE);
 	memcpy(&rp, buf + HCRP_PDU_HDR_SIZE, HCRP_CREDIT_REQUEST_RP_SIZE);
 
@@ -147,8 +155,12 @@ static int hcrp_get_lpt_status(int sk, uint16_t tid, uint8_t *lpt_status)
 	hdr.plen = htons(0);
 	memcpy(buf, &hdr, HCRP_PDU_HDR_SIZE);
 	len = write(sk, buf, HCRP_PDU_HDR_SIZE);
+	if (len < 0)
+		return -1;
 
 	len = read(sk, buf, sizeof(buf));
+	if (len < 0)
+		return -1;
 	memcpy(&hdr, buf, HCRP_PDU_HDR_SIZE);
 	memcpy(&rp, buf + HCRP_PDU_HDR_SIZE, HCRP_GET_LPT_STATUS_RP_SIZE);
 
diff --git a/input/device.c b/input/device.c
index 554f5ac..0bc4c9d 100644
--- a/input/device.c
+++ b/input/device.c
@@ -250,14 +250,14 @@ static int decode_key(const char *str)
 static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
 {
 	struct uinput_event event;
-	int err;
 
 	memset(&event, 0, sizeof(event));
 	event.type	= type;
 	event.code	= code;
 	event.value	= value;
 
-	err = write(fd, &event, sizeof(event));
+	if (write(fd, &event, sizeof(event)) < 0)
+		error("input: send_event failed: %s", strerror(errno));
 }
 
 static void send_key(int fd, uint16_t key)
diff --git a/input/server.c b/input/server.c
index d98018b..15bf5b3 100644
--- a/input/server.c
+++ b/input/server.c
@@ -91,7 +91,8 @@ static void connect_event_cb(GIOChannel *chan, GError *err, gpointer data)
 	/* Send unplug virtual cable to unknown devices */
 	if (ret == -ENOENT && psm == L2CAP_PSM_HIDP_CTRL) {
 		unsigned char unplug = 0x15;
-		int err, sk = g_io_channel_unix_get_fd(chan);
+		int __attribute__((__unused__)) err;
+		int sk = g_io_channel_unix_get_fd(chan);
 		err = write(sk, &unplug, sizeof(unplug));
 	}
 
diff --git a/lib/sdp.c b/lib/sdp.c
index d24d1e2..d852587 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -3319,7 +3319,7 @@ int sdp_service_search_req(sdp_session_t *session, const sdp_list_t *search,
 	uint32_t reqsize = 0, _reqsize;
 	uint32_t rspsize = 0, rsplen;
 	int seqlen = 0;
-	int total_rec_count, rec_count;
+	int __attribute__((__unused__)) total_rec_count, rec_count;
 	unsigned scanned, pdata_len;
 	uint8_t *pdata, *_pdata;
 	uint8_t *reqbuf, *rspbuf;
diff --git a/network/common.c b/network/common.c
index ef72679..38d2c49 100644
--- a/network/common.c
+++ b/network/common.c
@@ -215,7 +215,7 @@ int bnep_if_up(const char *devname)
 int bnep_if_down(const char *devname)
 {
 	struct ifreq ifr;
-	int sk, err;
+	int sk, __attribute__((__unused__)) err;
 
 	sk = socket(AF_INET, SOCK_DGRAM, 0);
 
diff --git a/plugins/hciops.c b/plugins/hciops.c
index 2c49e35..49dd48d 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
@@ -2754,7 +2754,7 @@ static void init_conn_list(int index)
 	struct dev_info *dev = &devs[index];
 	struct hci_conn_list_req *cl;
 	struct hci_conn_info *ci;
-	int err, i;
+	int i;
 
 	DBG("hci%d", index);
 
@@ -2780,8 +2780,6 @@ static void init_conn_list(int index)
 		conn->handle = ci->handle;
 	}
 
-	err = 0;
-
 failed:
 	g_free(cl);
 }
diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index 9e1cfac..b831044 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
@@ -207,7 +207,7 @@ static int mgmt_update_powered(int index, uint8_t powered)
 {
 	struct controller_info *info;
 	struct btd_adapter *adapter;
-	gboolean pairable, discoverable;
+	gboolean pairable;
 	uint8_t on_mode;
 
 	if (index > max_index) {
@@ -238,8 +238,6 @@ static int mgmt_update_powered(int index, uint8_t powered)
 
 	btd_adapter_get_mode(adapter, NULL, &on_mode, &pairable);
 
-	discoverable = (on_mode == MODE_DISCOVERABLE);
-
 	if (on_mode == MODE_DISCOVERABLE && !info->discoverable)
 		mgmt_set_discoverable(index, TRUE);
 	else if (on_mode == MODE_CONNECTABLE && !info->connectable)
diff --git a/sbc/sbcinfo.c b/sbc/sbcinfo.c
index 6d92679..63f05aa 100644
--- a/sbc/sbcinfo.c
+++ b/sbc/sbcinfo.c
@@ -281,7 +281,7 @@ static int analyze_file(char *filename)
 	printf("Subbands\t\t%d\n", subbands);
 	printf("Block length\t\t%d\n", blocks);
 	printf("Sampling frequency\t%s\n", freq2str(freq));
-	printf("Channel mode\t\t%s\n", mode2str(hdr.channel_mode));
+	printf("Channel mode\t\t%s\n", mode2str(mode));
 	printf("Allocation method\t%s\n", method ? "SNR" : "Loudness");
 	printf("Bitpool\t\t\t%d", bitpool[0]);
 	for (n = 1; n < SIZE; n++)
diff --git a/src/adapter.c b/src/adapter.c
index f068335..76fc01b 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -476,13 +476,10 @@ static int set_mode(struct btd_adapter *adapter, uint8_t new_mode,
 {
 	int err;
 	const char *modestr;
-	gboolean discoverable;
 
 	if (adapter->pending_mode != NULL)
 		return -EALREADY;
 
-	discoverable = new_mode == MODE_DISCOVERABLE;
-
 	if (!adapter->up && new_mode != MODE_OFF) {
 		err = adapter_ops->set_powered(adapter->dev_id, TRUE);
 		if (err < 0)
@@ -3405,7 +3402,6 @@ gboolean adapter_powering_down(struct btd_adapter *adapter)
 int btd_adapter_restore_powered(struct btd_adapter *adapter)
 {
 	char mode[14], address[18];
-	gboolean discoverable;
 
 	if (!adapter_ops)
 		return -EINVAL;
@@ -3421,8 +3417,6 @@ int btd_adapter_restore_powered(struct btd_adapter *adapter)
 						g_str_equal(mode, "off"))
 		return 0;
 
-	discoverable = get_mode(&adapter->bdaddr, mode) == MODE_DISCOVERABLE;
-
 	return adapter_ops->set_powered(adapter->dev_id, TRUE);
 }
 
diff --git a/src/sdp-xml.c b/src/sdp-xml.c
index 3aa9df0..62226cc 100644
--- a/src/sdp-xml.c
+++ b/src/sdp-xml.c
@@ -47,7 +47,6 @@ static void convert_raw_data_to_xml(sdp_data_t *value, int indent_level,
 	int i, hex;
 	char buf[STRBUFSIZE];
 	char indent[MAXINDENT];
-	char next_indent[MAXINDENT];
 
 	if (!value)
 		return;
@@ -57,12 +56,9 @@ static void convert_raw_data_to_xml(sdp_data_t *value, int indent_level,
 
 	for (i = 0; i < indent_level; i++) {
 		indent[i] = '\t';
-		next_indent[i] = '\t';
 	}
 
 	indent[i] = '\0';
-	next_indent[i] = '\t';
-	next_indent[i + 1] = '\0';
 
 	buf[STRBUFSIZE - 1] = '\0';
 
diff --git a/src/sdpd-request.c b/src/sdpd-request.c
index 1722f78..287acc2 100644
--- a/src/sdpd-request.c
+++ b/src/sdpd-request.c
@@ -962,7 +962,7 @@ static void process_request(sdp_req_t *req)
 	sdp_pdu_hdr_t *rsphdr;
 	sdp_buf_t rsp;
 	uint8_t *buf = malloc(USHRT_MAX);
-	int sent = 0;
+	int __attribute__((__unused__)) sent = 0;
 	int status = SDP_INVALID_SYNTAX;
 
 	memset(buf, 0, USHRT_MAX);
diff --git a/src/textfile.c b/src/textfile.c
index d115ff6..2645f9a 100644
--- a/src/textfile.c
+++ b/src/textfile.c
@@ -204,6 +204,10 @@ static int write_key(const char *pathname, const char *key, const char *value, i
 	if (!size) {
 		if (value) {
 			pos = lseek(fd, size, SEEK_SET);
+			if (pos == (off_t) -1) {
+				err = errno;
+				goto unlock;
+			}
 			err = write_key_value(fd, key, value);
 		}
 		goto unlock;
@@ -222,6 +226,10 @@ static int write_key(const char *pathname, const char *key, const char *value, i
 		if (value) {
 			munmap(map, size);
 			pos = lseek(fd, size, SEEK_SET);
+			if (pos == (off_t) -1) {
+				err = errno;
+				goto unlock;
+			}
 			err = write_key_value(fd, key, value);
 		}
 		goto unlock;
diff --git a/test/hciemu.c b/test/hciemu.c
index 66f99a9..27e8275 100644
--- a/test/hciemu.c
+++ b/test/hciemu.c
@@ -222,7 +222,11 @@ static int write_snoop(int fd, int type, int incoming, unsigned char *buf, int l
 		pkt.flags |= ntohl(0x02);
 
 	err = write(fd, &pkt, BTSNOOP_PKT_SIZE);
+	if (err < 0)
+		return -1;
 	err = write(fd, buf, size);
+	if (err < 0)
+		return -1;
 
 	return 0;
 }
@@ -899,6 +903,8 @@ static gboolean io_acl_data(GIOChannel *chan, GIOCondition cond, gpointer data)
 	write_snoop(vdev.dd, HCI_ACLDATA_PKT, 1, buf, len);
 
 	err = write(vdev.fd, buf, len);
+	if (err < 0)
+		return FALSE;
 
 	return TRUE;
 }
diff --git a/test/hstest.c b/test/hstest.c
index 08f2257..07124c1 100644
--- a/test/hstest.c
+++ b/test/hstest.c
@@ -244,8 +244,13 @@ int main(int argc, char *argv[])
 
 	fprintf(stderr, "SCO audio channel connected (handle %d, mtu %d)\n", sco_handle, sco_mtu);
 
-	if (mode == RECORD)
+	if (mode == RECORD) {
 		err = write(rd, "RING\r\n", 6);
+		if (err < 0) {
+			perror("Can't write \"RING\"");
+			return -1;
+		}
+	}
 
 	maxfd = (rd > sd) ? rd : sd;
 
diff --git a/test/rctest.c b/test/rctest.c
index b3804f5..9754f52 100644
--- a/test/rctest.c
+++ b/test/rctest.c
@@ -417,13 +417,11 @@ static void recv_mode(int sk)
 	struct timeval tv_beg, tv_end, tv_diff;
 	char ts[30];
 	long total;
-	uint32_t seq;
 
 	syslog(LOG_INFO, "Receiving ...");
 
 	memset(ts, 0, sizeof(ts));
 
-	seq = 0;
 	while (1) {
 		gettimeofday(&tv_beg,NULL);
 		total = 0;
diff --git a/test/scotest.c b/test/scotest.c
index 50b622a..17bd8a6 100644
--- a/test/scotest.c
+++ b/test/scotest.c
@@ -216,11 +216,9 @@ static void recv_mode(int sk)
 {
 	struct timeval tv_beg,tv_end,tv_diff;
 	long total;
-	uint32_t seq;
 
 	syslog(LOG_INFO, "Receiving ...");
 
-	seq = 0;
 	while (1) {
 		gettimeofday(&tv_beg, NULL);
 		total = 0;
diff --git a/test/test-textfile.c b/test/test-textfile.c
index 970e9e7..0786022 100644
--- a/test/test-textfile.c
+++ b/test/test-textfile.c
@@ -51,6 +51,8 @@ int main(int argc, char *argv[])
 
 	fd = creat(filename, 0644);
 	err = ftruncate(fd, 0);
+	if (err < 0)
+		fprintf(stderr, "%s (%d)\n", strerror(errno), errno);
 
 	memset(value, 0, sizeof(value));
 	for (i = 0; i < (size / sizeof(value)); i++)
diff --git a/tools/hciattach.c b/tools/hciattach.c
index e4d5aa1..bc56f31 100644
--- a/tools/hciattach.c
+++ b/tools/hciattach.c
@@ -351,7 +351,7 @@ static int bcsp_max_retries = 10;
 static void bcsp_tshy_sig_alarm(int sig)
 {
 	unsigned char bcsp_sync_pkt[10] = {0xc0,0x00,0x41,0x00,0xbe,0xda,0xdc,0xed,0xed,0xc0};
-	int len;
+	int __attribute__((__unused__)) len;
 	static int retries = 0;
 
 	if (retries < bcsp_max_retries) {
@@ -369,7 +369,7 @@ static void bcsp_tshy_sig_alarm(int sig)
 static void bcsp_tconf_sig_alarm(int sig)
 {
 	unsigned char bcsp_conf_pkt[10] = {0xc0,0x00,0x41,0x00,0xbe,0xad,0xef,0xac,0xed,0xc0};
-	int len;
+	int __attribute__((__unused__)) len;
 	static int retries = 0;
 
 	if (retries < bcsp_max_retries){
@@ -394,7 +394,7 @@ static int bcsp(int fd, struct uart_t *u, struct termios *ti)
 		bcspconf[4]     = {0xad,0xef,0xac,0xed},
 		bcspconfresp[4] = {0xde,0xad,0xd0,0xd0};
 	struct sigaction sa;
-	int len;
+	int __attribute__((__unused__)) len;
 
 	if (set_speed(fd, ti, u->speed) < 0) {
 		perror("Can't set default baud rate");
diff --git a/tools/hcitool.c b/tools/hcitool.c
index a117449..ece187c 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -2351,7 +2351,6 @@ static int print_advertising_devices(int dd, uint8_t filter_type)
 	unsigned char buf[HCI_MAX_EVENT_SIZE], *ptr;
 	struct hci_filter nf, of;
 	socklen_t olen;
-	hci_event_hdr *hdr;
 	int num, len;
 
 	olen = sizeof(of);
@@ -2382,7 +2381,6 @@ static int print_advertising_devices(int dd, uint8_t filter_type)
 			goto done;
 		}
 
-		hdr = (void *) (buf + 1);
 		ptr = buf + (1 + HCI_EVENT_HDR_SIZE);
 		len -= (1 + HCI_EVENT_HDR_SIZE);
 
-- 
1.7.5.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: Warning fixes for GCC 4.6
  2011-05-06 17:50       ` Bastien Nocera
@ 2011-05-06 17:54         ` Bastien Nocera
  2011-06-10  6:02           ` Lucas De Marchi
  0 siblings, 1 reply; 10+ messages in thread
From: Bastien Nocera @ 2011-05-06 17:54 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: BlueZ development

[-- Attachment #1: Type: text/plain, Size: 1242 bytes --]

On Fri, 2011-05-06 at 18:50 +0100, Bastien Nocera wrote:
> On Fri, 2011-05-06 at 20:43 +0300, Luiz Augusto von Dentz wrote:
> > Hi,
> > 
> > On Fri, May 6, 2011 at 5:48 PM, Bastien Nocera <hadess@hadess.net> wrote:
> > >> @@ -250,7 +250,7 @@ static int decode_key(const char *str)
> > >>  static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
> > >>  {
> > >>       struct uinput_event event;
> > >> -     int err;
> > >> +     int __attribute__((__unused__)) err;
> > >>
> > >>       memset(&event, 0, sizeof(event));
> > >>       event.type      = type;
> > >>
> > >> Can't we just removed err here, Im afraid using
> > >> __attribute__((__unused__)) is not a good practice and we should try
> > >> to avoid using it.
> > >
> > > We either get a warning that the return value is unused, or that we
> > > should be checking the return value. Which one do you prefer?
> > 
> > I guess I would prefer checking the return properly if you don't mind.
> 
> Done.
> 
> > Also like Gustavo mentioned, it would be great to have the gdbus
> > changes in a separate patch so we can apply to other project which
> > uses it.
> 
> Done.

And without the now unnecessary changes to btio/btio.c (flushable
problem is already fixed).

[-- Attachment #2: 0001-Fix-set-but-not-unused-variable-GCC-4.6-warnings.patch --]
[-- Type: text/x-patch, Size: 16621 bytes --]

>From 4fa5b05d184d355ee1cb7ebc7abf88f51ec53a59 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Fri, 6 May 2011 18:49:26 +0100
Subject: [PATCH] Fix "set but not unused variable" GCC 4.6 warnings

---
 attrib/gatt.c         |    4 ----
 audio/a2dp.c          |    3 ---
 audio/manager.c       |    2 --
 audio/pcm_bluetooth.c |    4 ++--
 btio/btio.c           |    4 ++++
 compat/fakehid.c      |    6 ++++--
 cups/hcrp.c           |   12 ++++++++++++
 input/device.c        |    4 ++--
 input/server.c        |    3 ++-
 lib/sdp.c             |    2 +-
 network/common.c      |    2 +-
 plugins/hciops.c      |    4 +---
 plugins/mgmtops.c     |    4 +---
 sbc/sbcinfo.c         |    2 +-
 src/adapter.c         |    6 ------
 src/sdp-xml.c         |    4 ----
 src/sdpd-request.c    |    2 +-
 src/textfile.c        |    8 ++++++++
 test/hciemu.c         |    6 ++++++
 test/hstest.c         |    7 ++++++-
 test/rctest.c         |    2 --
 test/scotest.c        |    2 --
 test/test-textfile.c  |    2 ++
 tools/hciattach.c     |    6 +++---
 tools/hcitool.c       |    2 --
 25 files changed, 57 insertions(+), 46 deletions(-)

diff --git a/attrib/gatt.c b/attrib/gatt.c
index 360218b..095b157 100644
--- a/attrib/gatt.c
+++ b/attrib/gatt.c
@@ -71,13 +71,11 @@ static guint16 encode_discover_primary(uint16_t start, uint16_t end,
 {
 	bt_uuid_t prim;
 	guint16 plen;
-	uint8_t op;
 
 	bt_uuid16_create(&prim, GATT_PRIM_SVC_UUID);
 
 	if (uuid == NULL) {
 		/* Discover all primary services */
-		op = ATT_OP_READ_BY_GROUP_REQ;
 		plen = enc_read_by_grp_req(start, end, &prim, pdu, len);
 	} else {
 		uint16_t u16;
@@ -86,8 +84,6 @@ static guint16 encode_discover_primary(uint16_t start, uint16_t end,
 		int vlen;
 
 		/* Discover primary service by service UUID */
-		op = ATT_OP_FIND_BY_TYPE_REQ;
-
 		if (uuid->type == BT_UUID16) {
 			u16 = htobs(uuid->value.u16);
 			value = &u16;
diff --git a/audio/a2dp.c b/audio/a2dp.c
index 9cd7207..52acdfa 100644
--- a/audio/a2dp.c
+++ b/audio/a2dp.c
@@ -2038,7 +2038,6 @@ unsigned int a2dp_config(struct avdtp *session, struct a2dp_sep *sep,
 	struct avdtp_media_codec_capability *codec_cap = NULL;
 	int posix_err;
 	bdaddr_t src;
-	uint8_t remote_type;
 
 	avdtp_get_peers(session, &src, NULL);
 	server = find_server(servers, &src);
@@ -2085,9 +2084,7 @@ unsigned int a2dp_config(struct avdtp *session, struct a2dp_sep *sep,
 	case AVDTP_STATE_IDLE:
 		if (sep->type == AVDTP_SEP_TYPE_SOURCE) {
 			l = server->sources;
-			remote_type = AVDTP_SEP_TYPE_SINK;
 		} else {
-			remote_type = AVDTP_SEP_TYPE_SOURCE;
 			l = server->sinks;
 		}
 
diff --git a/audio/manager.c b/audio/manager.c
index 7e206be..d4ff906 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -562,7 +562,6 @@ static void hf_io_cb(GIOChannel *chan, gpointer data)
 	GError *err = NULL;
 	uint8_t ch;
 	const char *server_uuid, *remote_uuid;
-	uint16_t svclass;
 	struct audio_device *device;
 	int perr;
 
@@ -580,7 +579,6 @@ static void hf_io_cb(GIOChannel *chan, gpointer data)
 
 	server_uuid = HFP_AG_UUID;
 	remote_uuid = HFP_HS_UUID;
-	svclass = HANDSFREE_AGW_SVCLASS_ID;
 
 	device = manager_get_device(&src, &dst, TRUE);
 	if (!device)
diff --git a/audio/pcm_bluetooth.c b/audio/pcm_bluetooth.c
index 799f17f..2d9f178 100644
--- a/audio/pcm_bluetooth.c
+++ b/audio/pcm_bluetooth.c
@@ -820,7 +820,7 @@ static int bluetooth_playback_poll_revents(snd_pcm_ioplug_t *io,
 					unsigned short *revents)
 {
 	static char buf[1];
-	int ret;
+	int ret = 0;
 
 	DBG("");
 
@@ -838,7 +838,7 @@ static int bluetooth_playback_poll_revents(snd_pcm_ioplug_t *io,
 
 	*revents = (pfds[0].revents & POLLIN) ? POLLOUT : 0;
 
-	return 0;
+	return ret;
 }
 
 
diff --git a/btio/btio.c b/btio/btio.c
index a3cf38a..4d855ae 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -1135,6 +1135,10 @@ gboolean bt_io_accept(GIOChannel *io, BtIOConnect connect, gpointer user_data,
 	if (!(pfd.revents & POLLOUT)) {
 		int ret;
 		ret = read(sock, &c, 1);
+		if (ret < 0) {
+			ERROR_FAILED(err, "read", errno);
+			return FALSE;
+		}
 	}
 
 	accept_add(io, connect, user_data, destroy);
diff --git a/compat/fakehid.c b/compat/fakehid.c
index b996d10..0974d0a 100644
--- a/compat/fakehid.c
+++ b/compat/fakehid.c
@@ -60,13 +60,13 @@ static void sig_term(int sig)
 	__io_canceled = 1;
 }
 
-static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
+static int send_event(int fd, uint16_t type, uint16_t code, int32_t value)
 {
 	struct uinput_event event;
 	int len;
 
 	if (fd <= fileno(stderr))
-		return;
+		return -1;
 
 	memset(&event, 0, sizeof(event));
 	event.type = type;
@@ -74,6 +74,8 @@ static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
 	event.value = value;
 
 	len = write(fd, &event, sizeof(event));
+
+	return len;
 }
 
 static int uinput_create(char *name, int keyboard, int mouse)
diff --git a/cups/hcrp.c b/cups/hcrp.c
index 7aafcdc..ad88ff6 100644
--- a/cups/hcrp.c
+++ b/cups/hcrp.c
@@ -94,8 +94,12 @@ static int hcrp_credit_grant(int sk, uint16_t tid, uint32_t credit)
 	memcpy(buf, &hdr, HCRP_PDU_HDR_SIZE);
 	memcpy(buf + HCRP_PDU_HDR_SIZE, &cp, HCRP_CREDIT_GRANT_CP_SIZE);
 	len = write(sk, buf, HCRP_PDU_HDR_SIZE + HCRP_CREDIT_GRANT_CP_SIZE);
+	if (len < 0)
+		return -1;
 
 	len = read(sk, buf, sizeof(buf));
+	if (len < 0)
+		return -1;
 	memcpy(&hdr, buf, HCRP_PDU_HDR_SIZE);
 	memcpy(&rp, buf + HCRP_PDU_HDR_SIZE, HCRP_CREDIT_GRANT_RP_SIZE);
 
@@ -119,8 +123,12 @@ static int hcrp_credit_request(int sk, uint16_t tid, uint32_t *credit)
 	hdr.plen = htons(0);
 	memcpy(buf, &hdr, HCRP_PDU_HDR_SIZE);
 	len = write(sk, buf, HCRP_PDU_HDR_SIZE);
+	if (len < 0)
+		return -1;
 
 	len = read(sk, buf, sizeof(buf));
+	if (len < 0)
+		return -1;
 	memcpy(&hdr, buf, HCRP_PDU_HDR_SIZE);
 	memcpy(&rp, buf + HCRP_PDU_HDR_SIZE, HCRP_CREDIT_REQUEST_RP_SIZE);
 
@@ -147,8 +155,12 @@ static int hcrp_get_lpt_status(int sk, uint16_t tid, uint8_t *lpt_status)
 	hdr.plen = htons(0);
 	memcpy(buf, &hdr, HCRP_PDU_HDR_SIZE);
 	len = write(sk, buf, HCRP_PDU_HDR_SIZE);
+	if (len < 0)
+		return -1;
 
 	len = read(sk, buf, sizeof(buf));
+	if (len < 0)
+		return -1;
 	memcpy(&hdr, buf, HCRP_PDU_HDR_SIZE);
 	memcpy(&rp, buf + HCRP_PDU_HDR_SIZE, HCRP_GET_LPT_STATUS_RP_SIZE);
 
diff --git a/input/device.c b/input/device.c
index 554f5ac..0bc4c9d 100644
--- a/input/device.c
+++ b/input/device.c
@@ -250,14 +250,14 @@ static int decode_key(const char *str)
 static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
 {
 	struct uinput_event event;
-	int err;
 
 	memset(&event, 0, sizeof(event));
 	event.type	= type;
 	event.code	= code;
 	event.value	= value;
 
-	err = write(fd, &event, sizeof(event));
+	if (write(fd, &event, sizeof(event)) < 0)
+		error("input: send_event failed: %s", strerror(errno));
 }
 
 static void send_key(int fd, uint16_t key)
diff --git a/input/server.c b/input/server.c
index d98018b..15bf5b3 100644
--- a/input/server.c
+++ b/input/server.c
@@ -91,7 +91,8 @@ static void connect_event_cb(GIOChannel *chan, GError *err, gpointer data)
 	/* Send unplug virtual cable to unknown devices */
 	if (ret == -ENOENT && psm == L2CAP_PSM_HIDP_CTRL) {
 		unsigned char unplug = 0x15;
-		int err, sk = g_io_channel_unix_get_fd(chan);
+		int __attribute__((__unused__)) err;
+		int sk = g_io_channel_unix_get_fd(chan);
 		err = write(sk, &unplug, sizeof(unplug));
 	}
 
diff --git a/lib/sdp.c b/lib/sdp.c
index d24d1e2..d852587 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -3319,7 +3319,7 @@ int sdp_service_search_req(sdp_session_t *session, const sdp_list_t *search,
 	uint32_t reqsize = 0, _reqsize;
 	uint32_t rspsize = 0, rsplen;
 	int seqlen = 0;
-	int total_rec_count, rec_count;
+	int __attribute__((__unused__)) total_rec_count, rec_count;
 	unsigned scanned, pdata_len;
 	uint8_t *pdata, *_pdata;
 	uint8_t *reqbuf, *rspbuf;
diff --git a/network/common.c b/network/common.c
index ef72679..38d2c49 100644
--- a/network/common.c
+++ b/network/common.c
@@ -215,7 +215,7 @@ int bnep_if_up(const char *devname)
 int bnep_if_down(const char *devname)
 {
 	struct ifreq ifr;
-	int sk, err;
+	int sk, __attribute__((__unused__)) err;
 
 	sk = socket(AF_INET, SOCK_DGRAM, 0);
 
diff --git a/plugins/hciops.c b/plugins/hciops.c
index 2c49e35..49dd48d 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
@@ -2754,7 +2754,7 @@ static void init_conn_list(int index)
 	struct dev_info *dev = &devs[index];
 	struct hci_conn_list_req *cl;
 	struct hci_conn_info *ci;
-	int err, i;
+	int i;
 
 	DBG("hci%d", index);
 
@@ -2780,8 +2780,6 @@ static void init_conn_list(int index)
 		conn->handle = ci->handle;
 	}
 
-	err = 0;
-
 failed:
 	g_free(cl);
 }
diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c
index 9e1cfac..b831044 100644
--- a/plugins/mgmtops.c
+++ b/plugins/mgmtops.c
@@ -207,7 +207,7 @@ static int mgmt_update_powered(int index, uint8_t powered)
 {
 	struct controller_info *info;
 	struct btd_adapter *adapter;
-	gboolean pairable, discoverable;
+	gboolean pairable;
 	uint8_t on_mode;
 
 	if (index > max_index) {
@@ -238,8 +238,6 @@ static int mgmt_update_powered(int index, uint8_t powered)
 
 	btd_adapter_get_mode(adapter, NULL, &on_mode, &pairable);
 
-	discoverable = (on_mode == MODE_DISCOVERABLE);
-
 	if (on_mode == MODE_DISCOVERABLE && !info->discoverable)
 		mgmt_set_discoverable(index, TRUE);
 	else if (on_mode == MODE_CONNECTABLE && !info->connectable)
diff --git a/sbc/sbcinfo.c b/sbc/sbcinfo.c
index 6d92679..63f05aa 100644
--- a/sbc/sbcinfo.c
+++ b/sbc/sbcinfo.c
@@ -281,7 +281,7 @@ static int analyze_file(char *filename)
 	printf("Subbands\t\t%d\n", subbands);
 	printf("Block length\t\t%d\n", blocks);
 	printf("Sampling frequency\t%s\n", freq2str(freq));
-	printf("Channel mode\t\t%s\n", mode2str(hdr.channel_mode));
+	printf("Channel mode\t\t%s\n", mode2str(mode));
 	printf("Allocation method\t%s\n", method ? "SNR" : "Loudness");
 	printf("Bitpool\t\t\t%d", bitpool[0]);
 	for (n = 1; n < SIZE; n++)
diff --git a/src/adapter.c b/src/adapter.c
index f068335..76fc01b 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -476,13 +476,10 @@ static int set_mode(struct btd_adapter *adapter, uint8_t new_mode,
 {
 	int err;
 	const char *modestr;
-	gboolean discoverable;
 
 	if (adapter->pending_mode != NULL)
 		return -EALREADY;
 
-	discoverable = new_mode == MODE_DISCOVERABLE;
-
 	if (!adapter->up && new_mode != MODE_OFF) {
 		err = adapter_ops->set_powered(adapter->dev_id, TRUE);
 		if (err < 0)
@@ -3405,7 +3402,6 @@ gboolean adapter_powering_down(struct btd_adapter *adapter)
 int btd_adapter_restore_powered(struct btd_adapter *adapter)
 {
 	char mode[14], address[18];
-	gboolean discoverable;
 
 	if (!adapter_ops)
 		return -EINVAL;
@@ -3421,8 +3417,6 @@ int btd_adapter_restore_powered(struct btd_adapter *adapter)
 						g_str_equal(mode, "off"))
 		return 0;
 
-	discoverable = get_mode(&adapter->bdaddr, mode) == MODE_DISCOVERABLE;
-
 	return adapter_ops->set_powered(adapter->dev_id, TRUE);
 }
 
diff --git a/src/sdp-xml.c b/src/sdp-xml.c
index 3aa9df0..62226cc 100644
--- a/src/sdp-xml.c
+++ b/src/sdp-xml.c
@@ -47,7 +47,6 @@ static void convert_raw_data_to_xml(sdp_data_t *value, int indent_level,
 	int i, hex;
 	char buf[STRBUFSIZE];
 	char indent[MAXINDENT];
-	char next_indent[MAXINDENT];
 
 	if (!value)
 		return;
@@ -57,12 +56,9 @@ static void convert_raw_data_to_xml(sdp_data_t *value, int indent_level,
 
 	for (i = 0; i < indent_level; i++) {
 		indent[i] = '\t';
-		next_indent[i] = '\t';
 	}
 
 	indent[i] = '\0';
-	next_indent[i] = '\t';
-	next_indent[i + 1] = '\0';
 
 	buf[STRBUFSIZE - 1] = '\0';
 
diff --git a/src/sdpd-request.c b/src/sdpd-request.c
index 1722f78..287acc2 100644
--- a/src/sdpd-request.c
+++ b/src/sdpd-request.c
@@ -962,7 +962,7 @@ static void process_request(sdp_req_t *req)
 	sdp_pdu_hdr_t *rsphdr;
 	sdp_buf_t rsp;
 	uint8_t *buf = malloc(USHRT_MAX);
-	int sent = 0;
+	int __attribute__((__unused__)) sent = 0;
 	int status = SDP_INVALID_SYNTAX;
 
 	memset(buf, 0, USHRT_MAX);
diff --git a/src/textfile.c b/src/textfile.c
index d115ff6..2645f9a 100644
--- a/src/textfile.c
+++ b/src/textfile.c
@@ -204,6 +204,10 @@ static int write_key(const char *pathname, const char *key, const char *value, i
 	if (!size) {
 		if (value) {
 			pos = lseek(fd, size, SEEK_SET);
+			if (pos == (off_t) -1) {
+				err = errno;
+				goto unlock;
+			}
 			err = write_key_value(fd, key, value);
 		}
 		goto unlock;
@@ -222,6 +226,10 @@ static int write_key(const char *pathname, const char *key, const char *value, i
 		if (value) {
 			munmap(map, size);
 			pos = lseek(fd, size, SEEK_SET);
+			if (pos == (off_t) -1) {
+				err = errno;
+				goto unlock;
+			}
 			err = write_key_value(fd, key, value);
 		}
 		goto unlock;
diff --git a/test/hciemu.c b/test/hciemu.c
index 66f99a9..27e8275 100644
--- a/test/hciemu.c
+++ b/test/hciemu.c
@@ -222,7 +222,11 @@ static int write_snoop(int fd, int type, int incoming, unsigned char *buf, int l
 		pkt.flags |= ntohl(0x02);
 
 	err = write(fd, &pkt, BTSNOOP_PKT_SIZE);
+	if (err < 0)
+		return -1;
 	err = write(fd, buf, size);
+	if (err < 0)
+		return -1;
 
 	return 0;
 }
@@ -899,6 +903,8 @@ static gboolean io_acl_data(GIOChannel *chan, GIOCondition cond, gpointer data)
 	write_snoop(vdev.dd, HCI_ACLDATA_PKT, 1, buf, len);
 
 	err = write(vdev.fd, buf, len);
+	if (err < 0)
+		return FALSE;
 
 	return TRUE;
 }
diff --git a/test/hstest.c b/test/hstest.c
index 08f2257..07124c1 100644
--- a/test/hstest.c
+++ b/test/hstest.c
@@ -244,8 +244,13 @@ int main(int argc, char *argv[])
 
 	fprintf(stderr, "SCO audio channel connected (handle %d, mtu %d)\n", sco_handle, sco_mtu);
 
-	if (mode == RECORD)
+	if (mode == RECORD) {
 		err = write(rd, "RING\r\n", 6);
+		if (err < 0) {
+			perror("Can't write \"RING\"");
+			return -1;
+		}
+	}
 
 	maxfd = (rd > sd) ? rd : sd;
 
diff --git a/test/rctest.c b/test/rctest.c
index b3804f5..9754f52 100644
--- a/test/rctest.c
+++ b/test/rctest.c
@@ -417,13 +417,11 @@ static void recv_mode(int sk)
 	struct timeval tv_beg, tv_end, tv_diff;
 	char ts[30];
 	long total;
-	uint32_t seq;
 
 	syslog(LOG_INFO, "Receiving ...");
 
 	memset(ts, 0, sizeof(ts));
 
-	seq = 0;
 	while (1) {
 		gettimeofday(&tv_beg,NULL);
 		total = 0;
diff --git a/test/scotest.c b/test/scotest.c
index 50b622a..17bd8a6 100644
--- a/test/scotest.c
+++ b/test/scotest.c
@@ -216,11 +216,9 @@ static void recv_mode(int sk)
 {
 	struct timeval tv_beg,tv_end,tv_diff;
 	long total;
-	uint32_t seq;
 
 	syslog(LOG_INFO, "Receiving ...");
 
-	seq = 0;
 	while (1) {
 		gettimeofday(&tv_beg, NULL);
 		total = 0;
diff --git a/test/test-textfile.c b/test/test-textfile.c
index 970e9e7..0786022 100644
--- a/test/test-textfile.c
+++ b/test/test-textfile.c
@@ -51,6 +51,8 @@ int main(int argc, char *argv[])
 
 	fd = creat(filename, 0644);
 	err = ftruncate(fd, 0);
+	if (err < 0)
+		fprintf(stderr, "%s (%d)\n", strerror(errno), errno);
 
 	memset(value, 0, sizeof(value));
 	for (i = 0; i < (size / sizeof(value)); i++)
diff --git a/tools/hciattach.c b/tools/hciattach.c
index e4d5aa1..bc56f31 100644
--- a/tools/hciattach.c
+++ b/tools/hciattach.c
@@ -351,7 +351,7 @@ static int bcsp_max_retries = 10;
 static void bcsp_tshy_sig_alarm(int sig)
 {
 	unsigned char bcsp_sync_pkt[10] = {0xc0,0x00,0x41,0x00,0xbe,0xda,0xdc,0xed,0xed,0xc0};
-	int len;
+	int __attribute__((__unused__)) len;
 	static int retries = 0;
 
 	if (retries < bcsp_max_retries) {
@@ -369,7 +369,7 @@ static void bcsp_tshy_sig_alarm(int sig)
 static void bcsp_tconf_sig_alarm(int sig)
 {
 	unsigned char bcsp_conf_pkt[10] = {0xc0,0x00,0x41,0x00,0xbe,0xad,0xef,0xac,0xed,0xc0};
-	int len;
+	int __attribute__((__unused__)) len;
 	static int retries = 0;
 
 	if (retries < bcsp_max_retries){
@@ -394,7 +394,7 @@ static int bcsp(int fd, struct uart_t *u, struct termios *ti)
 		bcspconf[4]     = {0xad,0xef,0xac,0xed},
 		bcspconfresp[4] = {0xde,0xad,0xd0,0xd0};
 	struct sigaction sa;
-	int len;
+	int __attribute__((__unused__)) len;
 
 	if (set_speed(fd, ti, u->speed) < 0) {
 		perror("Can't set default baud rate");
diff --git a/tools/hcitool.c b/tools/hcitool.c
index a117449..ece187c 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -2351,7 +2351,6 @@ static int print_advertising_devices(int dd, uint8_t filter_type)
 	unsigned char buf[HCI_MAX_EVENT_SIZE], *ptr;
 	struct hci_filter nf, of;
 	socklen_t olen;
-	hci_event_hdr *hdr;
 	int num, len;
 
 	olen = sizeof(of);
@@ -2382,7 +2381,6 @@ static int print_advertising_devices(int dd, uint8_t filter_type)
 			goto done;
 		}
 
-		hdr = (void *) (buf + 1);
 		ptr = buf + (1 + HCI_EVENT_HDR_SIZE);
 		len -= (1 + HCI_EVENT_HDR_SIZE);
 
-- 
1.7.5.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: Warning fixes for GCC 4.6
  2011-05-06 17:54         ` Bastien Nocera
@ 2011-06-10  6:02           ` Lucas De Marchi
  0 siblings, 0 replies; 10+ messages in thread
From: Lucas De Marchi @ 2011-06-10  6:02 UTC (permalink / raw)
  To: Bastien Nocera; +Cc: Luiz Augusto von Dentz, BlueZ development

On Fri, May 6, 2011 at 2:54 PM, Bastien Nocera <hadess@hadess.net> wrote:
> On Fri, 2011-05-06 at 18:50 +0100, Bastien Nocera wrote:
>> On Fri, 2011-05-06 at 20:43 +0300, Luiz Augusto von Dentz wrote:
>> > Hi,
>> >
>> > On Fri, May 6, 2011 at 5:48 PM, Bastien Nocera <hadess@hadess.net> wrote:
>> > >> @@ -250,7 +250,7 @@ static int decode_key(const char *str)
>> > >>  static void send_event(int fd, uint16_t type, uint16_t code, int32_t value)
>> > >>  {
>> > >>       struct uinput_event event;
>> > >> -     int err;
>> > >> +     int __attribute__((__unused__)) err;
>> > >>
>> > >>       memset(&event, 0, sizeof(event));
>> > >>       event.type      = type;
>> > >>
>> > >> Can't we just removed err here, Im afraid using
>> > >> __attribute__((__unused__)) is not a good practice and we should try
>> > >> to avoid using it.
>> > >
>> > > We either get a warning that the return value is unused, or that we
>> > > should be checking the return value. Which one do you prefer?
>> >
>> > I guess I would prefer checking the return properly if you don't mind.
>>
>> Done.
>>
>> > Also like Gustavo mentioned, it would be great to have the gdbus
>> > changes in a separate patch so we can apply to other project which
>> > uses it.
>>
>> Done.
>
> And without the now unnecessary changes to btio/btio.c (flushable
> problem is already fixed).
>

Any chance of landing these patches? There are already more places
needing fixes. I can send them once these go in.


Lucas De Marchi

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-06-10  6:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-05 18:43 Warning fixes for GCC 4.6 Bastien Nocera
2011-05-06  7:52 ` Luiz Augusto von Dentz
2011-05-06 14:48   ` Bastien Nocera
2011-05-06 15:08     ` Szymon Janc
2011-05-06 17:43     ` Luiz Augusto von Dentz
2011-05-06 17:50       ` Bastien Nocera
2011-05-06 17:54         ` Bastien Nocera
2011-06-10  6:02           ` Lucas De Marchi
2011-05-06 14:56   ` Bastien Nocera
2011-05-06 15:12     ` Gustavo F. Padovan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.