diff --git a/obexd/plugins/filesystem.c b/obexd/plugins/filesystem.c
index 4d611de..041cca6 100644
--- a/obexd/plugins/filesystem.c
+++ b/obexd/plugins/filesystem.c
return 0;
}
-static ssize_t filesystem_read(void *object, void *buf, size_t count,
- uint8_t *hi)
+static ssize_t filesystem_read(void *object, void *buf, size_t count)
{
ssize_t ret;
if (ret < 0)
return -errno;
- *hi = OBEX_HDR_BODY;
-
return ret;
}
return len;
}
-static ssize_t folder_read(void *object, void *buf, size_t count, uint8_t *hi)
+static ssize_t folder_read(void *object, void *buf, size_t count)
{
- *hi = OBEX_HDR_BODY;
return string_read(object, buf, count);
}
-static ssize_t capability_read(void *object, void *buf, size_t count,
- uint8_t *hi)
+static ssize_t capability_read(void *object, void *buf, size_t count)
{
struct capability_object *obj = object;
- *hi = OBEX_HDR_BODY;
-
if (obj->buffer)
return string_read(obj->buffer, buf, count);
diff --git a/obexd/plugins/irmc.c b/obexd/plugins/irmc.c
index cc0b9db..0fb92be 100644
--- a/obexd/plugins/irmc.c
+++ b/obexd/plugins/irmc.c
return 0;
}
-static ssize_t irmc_read(void *object, void *buf, size_t count, uint8_t *hi)
+static ssize_t irmc_read(void *object, void *buf, size_t count)
{
struct irmc_session *irmc = object;
int len;
if (!irmc->buffer)
return -EAGAIN;
- *hi = OBEX_HDR_BODY;
len = string_read(irmc->buffer, buf, count);
DBG("returning %d bytes", len);
return len;
diff --git a/obexd/plugins/mas.c b/obexd/plugins/mas.c
index 08e47a2..0ef8c81 100644
--- a/obexd/plugins/mas.c
+++ b/obexd/plugins/mas.c
return count;
}
-static ssize_t any_read(void *obj, void *buf, size_t count, uint8_t *hi)
+static ssize_t any_read(void *obj, void *buf, size_t count)
{
DBG("");
- *hi = OBEX_HDR_BODY;
-
return 0;
}
diff --git a/obexd/plugins/pbap.c b/obexd/plugins/pbap.c
index b230218..5455cce 100644
--- a/obexd/plugins/pbap.c
+++ b/obexd/plugins/pbap.c
return 0;
}
-static ssize_t vobject_pull_read(void *object, void *buf, size_t count,
- uint8_t *hi)
+static ssize_t vobject_pull_read(void *object, void *buf, size_t count)
{
struct pbap_object *obj = object;
struct pbap_session *pbap = obj->session;
if (pbap->params->maxlistcount == 0)
return -ENOSTR;
- *hi = OBEX_HDR_BODY;
-
len = string_read(obj->buffer, buf, count);
if (len == 0 && !obj->lastpart) {
/* in case when buffer is empty and we know that more
return 0;
}
-static ssize_t vobject_list_read(void *object, void *buf, size_t count,
- uint8_t *hi)
+static ssize_t vobject_list_read(void *object, void *buf, size_t count)
{
struct pbap_object *obj = object;
struct pbap_session *pbap = obj->session;
if (pbap->params->maxlistcount == 0)
return -ENOSTR;
- *hi = OBEX_HDR_BODY;
-
return string_read(obj->buffer, buf, count);
}
-static ssize_t vobject_vcard_read(void *object, void *buf, size_t count,
- uint8_t *hi)
+static ssize_t vobject_vcard_read(void *object, void *buf, size_t count)
{
struct pbap_object *obj = object;
if (!obj->buffer)
return -EAGAIN;
- *hi = OBEX_HDR_BODY;
return string_read(obj->buffer, buf, count);
}
diff --git a/obexd/plugins/pcsuite.c b/obexd/plugins/pcsuite.c
index 9b93372..5276ed9 100644
--- a/obexd/plugins/pcsuite.c
+++ b/obexd/plugins/pcsuite.c
return 0;
}
-static ssize_t backup_read(void *object, void *buf, size_t count, uint8_t *hi)
+static ssize_t backup_read(void *object, void *buf, size_t count)
{
struct backup_object *obj = object;
ssize_t ret = 0;
- *hi = OBEX_HDR_BODY;
-
if (obj->pending_call) {
DBG("cmd = %s, IN WAITING STAGE", obj->cmd);
return -EAGAIN;
diff --git a/obexd/plugins/syncevolution.c b/obexd/plugins/syncevolution.c
index 77c1bd6..7a78669 100644
--- a/obexd/plugins/syncevolution.c
+++ b/obexd/plugins/syncevolution.c
return 0;
}
-static ssize_t synce_read(void *object, void *buf, size_t count, uint8_t *hi)
+static ssize_t synce_read(void *object, void *buf, size_t count)
{
struct synce_context *context = object;
DBusConnection *conn;
gboolean authenticate;
DBusPendingCall *call;
- if (context->buffer) {
- *hi = OBEX_HDR_BODY;
+ if (context->buffer)
return string_read(context->buffer, buf, count);
- }
conn = obex_dbus_get_connection();
if (conn == NULL)
diff --git a/obexd/src/mimetype.h b/obexd/src/mimetype.h
index 3426cac..79529b8 100644
--- a/obexd/src/mimetype.h
+++ b/obexd/src/mimetype.h
int (*close) (void *object);
ssize_t (*get_next_header)(void *object, void *buf, size_t mtu,
uint8_t *hi);
- ssize_t (*read) (void *object, void *buf, size_t count, uint8_t *hi);
+ ssize_t (*read) (void *object, void *buf, size_t count);
ssize_t (*write) (void *object, const void *buf, size_t count);
int (*flush) (void *object);
int (*copy) (const char *name, const char *destname);
diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index b4f3714..49a110d 100644
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
{
obex_headerdata_t hd;
ssize_t len;
- unsigned int flags;
- uint8_t hi;
DBG("name=%s type=%s tx_mtu=%d file=%p",
os->name ? os->name : "", os->type ? os->type : "",
if (os->object == NULL)
return -EIO;
- len = os->driver->read(os->object, os->buf, os->tx_mtu, &hi);
+ len = os->driver->read(os->object, os->buf, os->tx_mtu);
if (len < 0) {
error("read(): %s (%zd)", strerror(-len), -len);
if (len == -EAGAIN)
os->streaming = TRUE;
}
- hd.bs = os->buf;
-
- switch (hi) {
- case OBEX_HDR_BODY:
- flags = len ? OBEX_FL_STREAM_DATA : OBEX_FL_STREAM_DATAEND;
- break;
- case OBEX_HDR_APPARAM:
- flags = 0;
- break;
- default:
- error("read(): unkown header type %u", hi);
- return -EIO;
- }
-
- OBEX_ObjectAddHeader(obex, obj, hi, hd, len, flags);
-
if (len == 0) {
+ hd.bs = NULL;
+ OBEX_ObjectAddHeader(obex, obj, OBEX_HDR_BODY, hd, 0,
+ OBEX_FL_STREAM_DATAEND);
g_free(os->buf);
os->buf = NULL;
}
+ hd.bs = os->buf;
+ OBEX_ObjectAddHeader(obex, obj, OBEX_HDR_BODY, hd, len,
+ OBEX_FL_STREAM_DATA);
+
return 0;
}