Skip to contentSkip to conversation

Type conversion in read and write obex streams

PATCH In review Dmitriy Paliy 2 participants 2 messages Oct 15, 2010 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Type conversion in read and write obex streams

Integer types in obex_write_stream and obex_read_stream shell be the same as those returned by read and write function prototypes of obex_mime_type_driver.

---
 src/obex.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
src/obex.c +3 -3
index adfcc95..0a0b6b9 100644
@@ -555,7 +555,7 @@ static int obex_read_stream(struct obex_session *os, obex_t *obex,
 						obex_object_t *obj)
 {
 	int size;
-	int32_t len = 0;
+	ssize_t len = 0;
 	const uint8_t *buffer;
 
 	DBG("name=%s type=%s rx_mtu=%d file=%p",
@@ -596,7 +596,7 @@ static int obex_read_stream(struct obex_session *os, obex_t *obex,
 
 write:
 	while (os->pending > 0) {
-		int w;
+		ssize_t w;
 
 		w = os->driver->write(os->object, os->buf + len,
 					os->pending);
@@ -622,7 +622,7 @@ static int obex_write_stream(struct obex_session *os,
 {
 	obex_headerdata_t hd;
 	uint8_t *ptr;
-	int32_t len;
+	ssize_t len;
 	unsigned int flags;
 	uint8_t hi;
 
Signature · 1 line
1.7.0.4
#1 lore raw

Hi Dmitriy,

Quoted 6 lines · Dmitriy Paliy

Integer types in obex_write_stream and obex_read_stream shell be the same as those returned by read and write function prototypes of obex_mime_type_driver.

---
 src/obex.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Not good:

src/obex.c: In function ‘obex_write_stream’:
src/obex.c:647: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘ssize_t’

Always compile-check your patches with ./bootstrap-configure.

The correct format specifier for ssize_t is %zd

Johan