All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] attrib: Use const source data pointer for write
@ 2014-03-27 14:03 Jakub Tyszkowski
  2014-03-27 14:03 ` [PATCH 2/2] attrib/gatttool: Use define for UUID format check Jakub Tyszkowski
  2014-03-28 12:25 ` [PATCH 1/2] attrib: Use const source data pointer for write Johan Hedberg
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Tyszkowski @ 2014-03-27 14:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

Source buffer for write operations should be immutable.
---
 attrib/gatt.c | 6 +++---
 attrib/gatt.h | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/attrib/gatt.c b/attrib/gatt.c
index 7363b4b..5ae20f4 100644
--- a/attrib/gatt.c
+++ b/attrib/gatt.c
@@ -840,7 +840,7 @@ static guint prepare_write(struct write_long_data *long_write)
 									NULL);
 }
 
-guint gatt_write_char(GAttrib *attrib, uint16_t handle, uint8_t *value,
+guint gatt_write_char(GAttrib *attrib, uint16_t handle, const uint8_t *value,
 			size_t vlen, GAttribResultFunc func, gpointer user_data)
 {
 	uint8_t *buf;
@@ -904,8 +904,8 @@ guint gatt_discover_char_desc(GAttrib *attrib, uint16_t start, uint16_t end,
 	return g_attrib_send(attrib, 0, buf, plen, func, user_data, NULL);
 }
 
-guint gatt_write_cmd(GAttrib *attrib, uint16_t handle, uint8_t *value, int vlen,
-				GDestroyNotify notify, gpointer user_data)
+guint gatt_write_cmd(GAttrib *attrib, uint16_t handle, const uint8_t *value,
+			int vlen, GDestroyNotify notify, gpointer user_data)
 {
 	uint8_t *buf;
 	size_t buflen;
diff --git a/attrib/gatt.h b/attrib/gatt.h
index a11e473..c65bf6c 100644
--- a/attrib/gatt.h
+++ b/attrib/gatt.h
@@ -80,15 +80,15 @@ guint gatt_discover_char(GAttrib *attrib, uint16_t start, uint16_t end,
 guint gatt_read_char(GAttrib *attrib, uint16_t handle, GAttribResultFunc func,
 							gpointer user_data);
 
-guint gatt_write_char(GAttrib *attrib, uint16_t handle, uint8_t *value,
+guint gatt_write_char(GAttrib *attrib, uint16_t handle, const uint8_t *value,
 					size_t vlen, GAttribResultFunc func,
 					gpointer user_data);
 
 guint gatt_discover_char_desc(GAttrib *attrib, uint16_t start, uint16_t end,
 				GAttribResultFunc func, gpointer user_data);
 
-guint gatt_write_cmd(GAttrib *attrib, uint16_t handle, uint8_t *value, int vlen,
-				GDestroyNotify notify, gpointer user_data);
+guint gatt_write_cmd(GAttrib *attrib, uint16_t handle, const uint8_t *value,
+			int vlen, GDestroyNotify notify, gpointer user_data);
 
 guint gatt_read_char_by_uuid(GAttrib *attrib, uint16_t start, uint16_t end,
 				bt_uuid_t *uuid, GAttribResultFunc func,
-- 
1.9.0


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

* [PATCH 2/2] attrib/gatttool: Use define for UUID format check
  2014-03-27 14:03 [PATCH 1/2] attrib: Use const source data pointer for write Jakub Tyszkowski
@ 2014-03-27 14:03 ` Jakub Tyszkowski
  2014-03-28 12:25 ` [PATCH 1/2] attrib: Use const source data pointer for write Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Tyszkowski @ 2014-03-27 14:03 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

---
 attrib/gatttool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/attrib/gatttool.c b/attrib/gatttool.c
index ca178ce..5e0f820 100644
--- a/attrib/gatttool.c
+++ b/attrib/gatttool.c
@@ -426,7 +426,7 @@ static void char_desc_cb(guint8 status, const guint8 *pdu, guint16 plen,
 		value = list->data[i];
 		handle = get_le16(value);
 
-		if (format == 0x01)
+		if (format == ATT_FIND_INFO_RESP_FMT_16BIT)
 			bt_uuid16_create(&uuid, get_le16(&value[2]));
 		else {
 			uint128_t u128;
-- 
1.9.0


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

* Re: [PATCH 1/2] attrib: Use const source data pointer for write
  2014-03-27 14:03 [PATCH 1/2] attrib: Use const source data pointer for write Jakub Tyszkowski
  2014-03-27 14:03 ` [PATCH 2/2] attrib/gatttool: Use define for UUID format check Jakub Tyszkowski
@ 2014-03-28 12:25 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2014-03-28 12:25 UTC (permalink / raw)
  To: Jakub Tyszkowski; +Cc: linux-bluetooth

Hi Jakub,

On Thu, Mar 27, 2014, Jakub Tyszkowski wrote:
> Source buffer for write operations should be immutable.
> ---
>  attrib/gatt.c | 6 +++---
>  attrib/gatt.h | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)

Both patches have been applied. Thanks.

Johan

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

end of thread, other threads:[~2014-03-28 12:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-27 14:03 [PATCH 1/2] attrib: Use const source data pointer for write Jakub Tyszkowski
2014-03-27 14:03 ` [PATCH 2/2] attrib/gatttool: Use define for UUID format check Jakub Tyszkowski
2014-03-28 12:25 ` [PATCH 1/2] attrib: Use const source data pointer for write Johan Hedberg

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.