2013-05-09 04:16:31

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 01/26] obexd: Include the headers for types we use

From: Lucas De Marchi <[email protected]>

---
obexd/client/transfer.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/obexd/client/transfer.h b/obexd/client/transfer.h
index b6b835d..0d54733 100644
--- a/obexd/client/transfer.h
+++ b/obexd/client/transfer.h
@@ -22,6 +22,10 @@
*
*/

+#include <dbus/dbus.h>
+#include <glib.h>
+#include <stdlib.h>
+
struct obc_transfer;

typedef void (*transfer_callback_t) (struct obc_transfer *transfer,
--
1.8.2.2



2013-05-09 12:31:02

by Anderson Lizardo

[permalink] [raw]
Subject: Re: [PATCH BlueZ 05/26] attrib: Get rid of guint* types

Hi Lucas,

On Thu, May 9, 2013 at 8:15 AM, Lucas De Marchi
<[email protected]> wrote:
>> We used to avoid adding includes into headers, and instead add them on
>> the .c files only. (The existing include above is a unfortunate
>> exception). Not sure if this convention has changed since.
>
> Sure, but when you use a certain type in header you need the header
> (or if it's a pointer you have the option to do a forward declaration,
> but it's not the case here). If you don't do this you depend on the
> include order in each .c, risking to break the build, which is way
> worse.

My point is, I know of all these aspects of not having self-contained
headers, and I am personally okay with it. But there was a tendency in
BlueZ to explicitly add #include's to each .c where it was needed and
keep headers free from #include's. Maybe I just misinterpreted this
convention, but I wanted to have it noted (and maybe Johan/Marcel
could clarify whether this is relevant).

Best Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

2013-05-09 12:15:26

by Lucas De Marchi

[permalink] [raw]
Subject: Re: [PATCH BlueZ 05/26] attrib: Get rid of guint* types

Hi Anderson,

On Thu, May 9, 2013 at 7:55 AM, Anderson Lizardo
<[email protected]> wrote:
> Hi Lucas,
>
> On Thu, May 9, 2013 at 12:16 AM, Lucas De Marchi
> <[email protected]> wrote:
>> diff --git a/attrib/gatt.h b/attrib/gatt.h
>> index 305b4c6..d5758b7 100644
>> --- a/attrib/gatt.h
>> +++ b/attrib/gatt.h
>> @@ -22,6 +22,7 @@
>> *
>> */
>>
>> +#include <inttypes.h>
>> #include <bluetooth/sdp.h>
>
> We used to avoid adding includes into headers, and instead add them on
> the .c files only. (The existing include above is a unfortunate
> exception). Not sure if this convention has changed since.

Sure, but when you use a certain type in header you need the header
(or if it's a pointer you have the option to do a forward declaration,
but it's not the case here). If you don't do this you depend on the
include order in each .c, risking to break the build, which is way
worse.

Lucas De Marchi

2013-05-09 12:12:05

by Lucas De Marchi

[permalink] [raw]
Subject: Re: [PATCH BlueZ 05/26] attrib: Get rid of guint* types

Hi Anderson,

On Thu, May 9, 2013 at 7:45 AM, Anderson Lizardo
<[email protected]> wrote:
> Hi Lucas,
>
> On Thu, May 9, 2013 at 12:16 AM, Lucas De Marchi
> <[email protected]> wrote:
>> guint -> unsigned int
>> guint8 -> uint8_t
>> guint16 -> uint16_t
>> guint32 -> uint32_t
>> guint64 -> uint64_t
>>
>> Add "#include <inttypes.h>" where appropriate and prefer this one over
>> stdint.h.
>> ---
>> attrib/att.c | 2 +-
>> attrib/gatt.c | 124 ++++++++++++++++++++++++++-------------------------
>> attrib/gatt.h | 33 +++++++-------
>> attrib/gattrib.c | 51 ++++++++++-----------
>> attrib/gattrib.h | 21 +++++----
>> attrib/gatttool.c | 19 ++++----
>> attrib/interactive.c | 35 ++++++++-------
>> 7 files changed, 148 insertions(+), 137 deletions(-)
>>
>> diff --git a/attrib/att.c b/attrib/att.c
>> index d2b78bd..e196fa3 100644
>> --- a/attrib/att.c
>> +++ b/attrib/att.c
>> @@ -27,7 +27,7 @@
>> #endif
>>
>> #include <errno.h>
>> -#include <stdint.h>
>> +#include <inttypes.h>
>> #include <stdlib.h>
>
> Any reason to include inttypes.h instead of just stdint.h? Are we
> using any of the PRI* format conversion macros?

The reason is to be able to use PRI formats without having to change
the include later.


Lucas De Marchi

2013-05-09 10:55:05

by Anderson Lizardo

[permalink] [raw]
Subject: Re: [PATCH BlueZ 05/26] attrib: Get rid of guint* types

Hi Lucas,

On Thu, May 9, 2013 at 12:16 AM, Lucas De Marchi
<[email protected]> wrote:
> diff --git a/attrib/gatt.h b/attrib/gatt.h
> index 305b4c6..d5758b7 100644
> --- a/attrib/gatt.h
> +++ b/attrib/gatt.h
> @@ -22,6 +22,7 @@
> *
> */
>
> +#include <inttypes.h>
> #include <bluetooth/sdp.h>

We used to avoid adding includes into headers, and instead add them on
the .c files only. (The existing include above is a unfortunate
exception). Not sure if this convention has changed since.

> diff --git a/attrib/gattrib.h b/attrib/gattrib.h
> index 3fe92c7..a1f2dd8 100644
> --- a/attrib/gattrib.h
> +++ b/attrib/gattrib.h
> @@ -28,6 +28,8 @@
> extern "C" {
> #endif
>
> +#include <inttypes.h>
> +
> #define GATTRIB_ALL_EVENTS 0xFF
> #define GATTRIB_ALL_REQS 0xFE
> #define GATTRIB_ALL_HANDLES 0x0000

Same thing here.

Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

2013-05-09 10:45:48

by Anderson Lizardo

[permalink] [raw]
Subject: Re: [PATCH BlueZ 05/26] attrib: Get rid of guint* types

Hi Lucas,

On Thu, May 9, 2013 at 12:16 AM, Lucas De Marchi
<[email protected]> wrote:
> guint -> unsigned int
> guint8 -> uint8_t
> guint16 -> uint16_t
> guint32 -> uint32_t
> guint64 -> uint64_t
>
> Add "#include <inttypes.h>" where appropriate and prefer this one over
> stdint.h.
> ---
> attrib/att.c | 2 +-
> attrib/gatt.c | 124 ++++++++++++++++++++++++++-------------------------
> attrib/gatt.h | 33 +++++++-------
> attrib/gattrib.c | 51 ++++++++++-----------
> attrib/gattrib.h | 21 +++++----
> attrib/gatttool.c | 19 ++++----
> attrib/interactive.c | 35 ++++++++-------
> 7 files changed, 148 insertions(+), 137 deletions(-)
>
> diff --git a/attrib/att.c b/attrib/att.c
> index d2b78bd..e196fa3 100644
> --- a/attrib/att.c
> +++ b/attrib/att.c
> @@ -27,7 +27,7 @@
> #endif
>
> #include <errno.h>
> -#include <stdint.h>
> +#include <inttypes.h>
> #include <stdlib.h>

Any reason to include inttypes.h instead of just stdint.h? Are we
using any of the PRI* format conversion macros?

Best Regards,
--
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil

2013-05-09 04:16:51

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 21/26] scanparam: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate.
---
profiles/scanparam/scan.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/profiles/scanparam/scan.c b/profiles/scanparam/scan.c
index a9baec8..2458a7b 100644
--- a/profiles/scanparam/scan.c
+++ b/profiles/scanparam/scan.c
@@ -26,6 +26,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdbool.h>
#include <errno.h>

@@ -56,7 +57,7 @@ struct scan {
struct btd_device *device;
GAttrib *attrib;
struct att_range range;
- guint attioid;
+ unsigned int attioid;
uint16_t interval;
uint16_t window;
uint16_t iwhandle;
@@ -95,8 +96,8 @@ static void refresh_value_cb(const uint8_t *pdu, uint16_t len,
write_scan_params(scan->attrib, scan->iwhandle);
}

-static void ccc_written_cb(guint8 status, const guint8 *pdu,
- guint16 plen, gpointer user_data)
+static void ccc_written_cb(uint8_t status, const uint8_t *pdu,
+ uint16_t plen, gpointer user_data)
{
struct scan *scan = user_data;

@@ -113,8 +114,8 @@ static void ccc_written_cb(guint8 status, const guint8 *pdu,
refresh_value_cb, scan, NULL);
}

-static void discover_descriptor_cb(guint8 status, const guint8 *pdu,
- guint16 len, gpointer user_data)
+static void discover_descriptor_cb(uint8_t status, const uint8_t *pdu,
+ uint16_t len, gpointer user_data)
{
struct scan *scan = user_data;
struct att_data_list *list;
@@ -144,7 +145,7 @@ done:
att_data_list_free(list);
}

-static void refresh_discovered_cb(GSList *chars, guint8 status,
+static void refresh_discovered_cb(GSList *chars, uint8_t status,
gpointer user_data)
{
struct scan *scan = user_data;
@@ -177,7 +178,7 @@ static void refresh_discovered_cb(GSList *chars, guint8 status,
discover_descriptor_cb, user_data);
}

-static void iwin_discovered_cb(GSList *chars, guint8 status,
+static void iwin_discovered_cb(GSList *chars, uint8_t status,
gpointer user_data)
{
struct scan *scan = user_data;
--
1.8.2.2


2013-05-09 04:16:56

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 26/26] gdbus: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate and prefer this one
over stdint.h.
---
gdbus/gdbus.h | 19 ++++++++++---------
gdbus/mainloop.c | 5 +++--
gdbus/object.c | 3 ++-
gdbus/watch.c | 25 +++++++++++++------------
4 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
index 8b13393..f2c6646 100644
--- a/gdbus/gdbus.h
+++ b/gdbus/gdbus.h
@@ -28,6 +28,7 @@
extern "C" {
#endif

+#include <inttypes.h>
#include <dbus/dbus.h>
#include <glib.h>

@@ -72,7 +73,7 @@ typedef DBusMessage * (* GDBusMethodFunction) (DBusConnection *connection,
typedef gboolean (*GDBusPropertyGetter)(const GDBusPropertyTable *property,
DBusMessageIter *iter, void *data);

-typedef guint32 GDBusPendingPropertySet;
+typedef uint32_t GDBusPendingPropertySet;

typedef void (*GDBusPropertySetter)(const GDBusPropertyTable *property,
DBusMessageIter *value, GDBusPendingPropertySet id,
@@ -81,7 +82,7 @@ typedef void (*GDBusPropertySetter)(const GDBusPropertyTable *property,
typedef gboolean (*GDBusPropertyExists)(const GDBusPropertyTable *property,
void *data);

-typedef guint32 GDBusPendingReply;
+typedef uint32_t GDBusPendingReply;

typedef void (* GDBusSecurityFunction) (DBusConnection *connection,
const char *action,
@@ -268,24 +269,24 @@ gboolean g_dbus_emit_signal_valist(DBusConnection *connection,
const char *path, const char *interface,
const char *name, int type, va_list args);

-guint g_dbus_add_service_watch(DBusConnection *connection, const char *name,
- GDBusWatchFunction connect,
+unsigned int g_dbus_add_service_watch(DBusConnection *connection,
+ const char *name, GDBusWatchFunction connect,
GDBusWatchFunction disconnect,
void *user_data, GDBusDestroyFunction destroy);
-guint g_dbus_add_disconnect_watch(DBusConnection *connection, const char *name,
- GDBusWatchFunction function,
+unsigned int g_dbus_add_disconnect_watch(DBusConnection *connection,
+ const char *name, GDBusWatchFunction function,
void *user_data, GDBusDestroyFunction destroy);
-guint g_dbus_add_signal_watch(DBusConnection *connection,
+unsigned int g_dbus_add_signal_watch(DBusConnection *connection,
const char *sender, const char *path,
const char *interface, const char *member,
GDBusSignalFunction function, void *user_data,
GDBusDestroyFunction destroy);
-guint g_dbus_add_properties_watch(DBusConnection *connection,
+unsigned int g_dbus_add_properties_watch(DBusConnection *connection,
const char *sender, const char *path,
const char *interface,
GDBusSignalFunction function, void *user_data,
GDBusDestroyFunction destroy);
-gboolean g_dbus_remove_watch(DBusConnection *connection, guint tag);
+gboolean g_dbus_remove_watch(DBusConnection *connection, unsigned int tag);
void g_dbus_remove_all_watches(DBusConnection *connection);

void g_dbus_pending_property_success(GDBusPendingPropertySet id);
diff --git a/gdbus/mainloop.c b/gdbus/mainloop.c
index 099b67f..7dfa9f0 100644
--- a/gdbus/mainloop.c
+++ b/gdbus/mainloop.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <glib.h>
#include <dbus/dbus.h>

@@ -37,12 +38,12 @@
#define debug(fmt...)

struct timeout_handler {
- guint id;
+ unsigned int id;
DBusTimeout *timeout;
};

struct watch_info {
- guint id;
+ unsigned int id;
DBusWatch *watch;
DBusConnection *conn;
};
diff --git a/gdbus/object.c b/gdbus/object.c
index 2f8ef45..7210177 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdio.h>
#include <string.h>

@@ -55,7 +56,7 @@ struct generic_data {
GSList *objects;
GSList *added;
GSList *removed;
- guint process_id;
+ unsigned int process_id;
gboolean pending_prop;
char *introspect;
struct generic_data *parent;
diff --git a/gdbus/watch.c b/gdbus/watch.c
index 9e4f994..f086f0b 100644
--- a/gdbus/watch.c
+++ b/gdbus/watch.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdio.h>
#include <string.h>

@@ -40,7 +41,7 @@
static DBusHandlerResult message_filter(DBusConnection *connection,
DBusMessage *message, void *user_data);

-static guint listener_id = 0;
+static unsigned int listener_id = 0;
static GSList *listeners = NULL;

struct service_data {
@@ -48,7 +49,7 @@ struct service_data {
DBusPendingCall *call;
char *name;
const char *owner;
- guint id;
+ unsigned int id;
struct filter_callback *callback;
};

@@ -59,7 +60,7 @@ struct filter_callback {
GDBusDestroyFunction destroy_func;
struct service_data *data;
void *user_data;
- guint id;
+ unsigned int id;
};

struct filter_data {
@@ -73,7 +74,7 @@ struct filter_data {
char *argument;
GSList *callbacks;
GSList *processed;
- guint name_watch;
+ unsigned int name_watch;
gboolean lock;
gboolean registered;
};
@@ -259,7 +260,7 @@ proceed:

static struct filter_callback *filter_data_find_callback(
struct filter_data *data,
- guint id)
+ unsigned int id)
{
GSList *l;

@@ -689,8 +690,8 @@ done:
dbus_message_unref(message);
}

-guint g_dbus_add_service_watch(DBusConnection *connection, const char *name,
- GDBusWatchFunction connect,
+unsigned int g_dbus_add_service_watch(DBusConnection *connection,
+ const char *name, GDBusWatchFunction connect,
GDBusWatchFunction disconnect,
void *user_data, GDBusDestroyFunction destroy)
{
@@ -717,15 +718,15 @@ guint g_dbus_add_service_watch(DBusConnection *connection, const char *name,
return cb->id;
}

-guint g_dbus_add_disconnect_watch(DBusConnection *connection, const char *name,
- GDBusWatchFunction func,
+unsigned int g_dbus_add_disconnect_watch(DBusConnection *connection,
+ const char *name, GDBusWatchFunction func,
void *user_data, GDBusDestroyFunction destroy)
{
return g_dbus_add_service_watch(connection, name, NULL, func,
user_data, destroy);
}

-guint g_dbus_add_signal_watch(DBusConnection *connection,
+unsigned int g_dbus_add_signal_watch(DBusConnection *connection,
const char *sender, const char *path,
const char *interface, const char *member,
GDBusSignalFunction function, void *user_data,
@@ -752,7 +753,7 @@ guint g_dbus_add_signal_watch(DBusConnection *connection,
return cb->id;
}

-guint g_dbus_add_properties_watch(DBusConnection *connection,
+unsigned int g_dbus_add_properties_watch(DBusConnection *connection,
const char *sender, const char *path,
const char *interface,
GDBusSignalFunction function, void *user_data,
@@ -780,7 +781,7 @@ guint g_dbus_add_properties_watch(DBusConnection *connection,
return cb->id;
}

-gboolean g_dbus_remove_watch(DBusConnection *connection, guint id)
+gboolean g_dbus_remove_watch(DBusConnection *connection, unsigned int id)
{
struct filter_data *data;
struct filter_callback *cb;
--
1.8.2.2


2013-05-09 04:16:55

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 25/26] unit: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate and prefer this one
over stdint.h.
---
unit/test-gdbus-client.c | 7 +-
unit/test-gobex-apparam.c | 20 ++---
unit/test-gobex-header.c | 12 +--
unit/test-gobex-packet.c | 12 +--
unit/test-gobex-transfer.c | 180 +++++++++++++++++++++++----------------------
unit/test-gobex.c | 44 +++++------
unit/test-mgmt.c | 3 +-
unit/test-sdp.c | 5 +-
unit/util.c | 2 +-
unit/util.h | 7 +-
10 files changed, 151 insertions(+), 141 deletions(-)

diff --git a/unit/test-gdbus-client.c b/unit/test-gdbus-client.c
index a594384..f3c39b7 100644
--- a/unit/test-gdbus-client.c
+++ b/unit/test-gdbus-client.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <glib.h>
#include <gdbus.h>

@@ -36,7 +37,7 @@ struct context {
DBusConnection *dbus_conn;
GDBusClient *dbus_client;
void *data;
- guint timeout_source;
+ unsigned int timeout_source;
};

static const GDBusMethodTable methods[] = {
@@ -537,7 +538,7 @@ static void proxy_get_uint64(GDBusProxy *proxy, void *user_data)
{
struct context *context = user_data;
DBusMessageIter iter;
- guint64 value;
+ uint64_t value;

if (g_test_verbose())
g_print("proxy %s found\n",
@@ -555,7 +556,7 @@ static void proxy_get_uint64(GDBusProxy *proxy, void *user_data)
static gboolean get_uint64(const GDBusPropertyTable *property,
DBusMessageIter *iter, void *data)
{
- guint64 value = G_MAXUINT64;
+ uint64_t value = G_MAXUINT64;

dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT64, &value);

diff --git a/unit/test-gobex-apparam.c b/unit/test-gobex-apparam.c
index e6a42cc..d2460c3 100644
--- a/unit/test-gobex-apparam.c
+++ b/unit/test-gobex-apparam.c
@@ -24,7 +24,7 @@
#include "config.h"
#endif

-#include <stdint.h>
+#include <inttypes.h>
#include <string.h>

#include <gobex/gobex-apparam.h>
@@ -60,7 +60,7 @@ static uint8_t tag_multi[] = { TAG_U8, 0x01, 0x01,
static GObexApparam *parse_and_decode(const void *data, gsize size)
{
GObexApparam *apparam;
- guint8 encoded[1024];
+ uint8_t encoded[1024];
gsize len;

apparam = g_obex_apparam_decode(data, size);
@@ -117,7 +117,7 @@ static void test_apparam_nval2_data(void)
static void test_apparam_get_uint8(void)
{
GObexApparam *apparam;
- guint8 data;
+ uint8_t data;
gboolean ret;

apparam = parse_and_decode(tag_uint8, sizeof(tag_uint8));
@@ -256,7 +256,7 @@ static void test_apparam_get_multi(void)
static void test_apparam_set_uint8(void)
{
GObexApparam *apparam;
- guint8 buf[1024];
+ uint8_t buf[1024];
gsize len;

apparam = g_obex_apparam_set_uint8(NULL, TAG_U8, 0x01);
@@ -271,7 +271,7 @@ static void test_apparam_set_uint8(void)
static void test_apparam_set_uint16(void)
{
GObexApparam *apparam;
- guint8 buf[1024];
+ uint8_t buf[1024];
gsize len;

apparam = g_obex_apparam_set_uint16(NULL, TAG_U16, 0x0102);
@@ -286,7 +286,7 @@ static void test_apparam_set_uint16(void)
static void test_apparam_set_uint32(void)
{
GObexApparam *apparam;
- guint8 buf[1024];
+ uint8_t buf[1024];
gsize len;

apparam = g_obex_apparam_set_uint32(NULL, TAG_U32, 0x01020304);
@@ -301,7 +301,7 @@ static void test_apparam_set_uint32(void)
static void test_apparam_set_uint64(void)
{
GObexApparam *apparam;
- guint8 buf[1024];
+ uint8_t buf[1024];
gsize len;

apparam = g_obex_apparam_set_uint64(NULL, TAG_U64, 0x0102030405060708);
@@ -316,7 +316,7 @@ static void test_apparam_set_uint64(void)
static void test_apparam_set_string(void)
{
GObexApparam *apparam;
- guint8 buf[1024];
+ uint8_t buf[1024];
gsize len;

apparam = g_obex_apparam_set_string(NULL, TAG_STRING, "ABC");
@@ -331,7 +331,7 @@ static void test_apparam_set_string(void)
static void test_apparam_set_bytes(void)
{
GObexApparam *apparam;
- guint8 buf[1024];
+ uint8_t buf[1024];
gsize len;

apparam = g_obex_apparam_set_bytes(NULL, TAG_BYTES, tag_bytes + 2, 255);
@@ -346,7 +346,7 @@ static void test_apparam_set_bytes(void)
static void test_apparam_set_multi(void)
{
GObexApparam *apparam;
- guint8 buf[1024];
+ uint8_t buf[1024];
gsize len;

apparam = g_obex_apparam_set_uint8(NULL, TAG_U8, 0x01);
diff --git a/unit/test-gobex-header.c b/unit/test-gobex-header.c
index 31c49a6..f78a2cc 100644
--- a/unit/test-gobex-header.c
+++ b/unit/test-gobex-header.c
@@ -24,7 +24,7 @@
#include "config.h"
#endif

-#include <stdint.h>
+#include <inttypes.h>
#include <string.h>

#include <gobex/gobex-header.h>
@@ -197,7 +197,7 @@ static void test_header_encode_connid(void)
{
GObexHeader *header;
gboolean ret;
- guint32 val;
+ uint32_t val;

header = parse_and_encode(hdr_connid, sizeof(hdr_connid));

@@ -260,8 +260,8 @@ static void test_header_encode_name_empty(void)
static void test_header_encode_body(void)
{
GObexHeader *header;
- guint8 expected[] = { 1, 2, 3, 4};
- const guint8 *buf;
+ uint8_t expected[] = { 1, 2, 3, 4};
+ const uint8_t *buf;
size_t len;
gboolean ret;

@@ -280,7 +280,7 @@ static void test_header_encode_apparam(void)
GObexHeader *header;
GObexApparam *apparam;
gboolean ret;
- guint32 data;
+ uint32_t data;

header = parse_and_encode(hdr_apparam, sizeof(hdr_apparam));

@@ -299,7 +299,7 @@ static void test_header_encode_actionid(void)
{
GObexHeader *header;
gboolean ret;
- guint8 val;
+ uint8_t val;

header = parse_and_encode(hdr_actionid, sizeof(hdr_actionid));

diff --git a/unit/test-gobex-packet.c b/unit/test-gobex-packet.c
index bf2035b..6bd3f62 100644
--- a/unit/test-gobex-packet.c
+++ b/unit/test-gobex-packet.c
@@ -24,7 +24,7 @@
#include "config.h"
#endif

-#include <stdint.h>
+#include <inttypes.h>
#include <string.h>
#include <errno.h>

@@ -45,7 +45,7 @@ static uint8_t pkt_put[] = { G_OBEX_OP_PUT, 0x00, 0x03 };

static uint8_t pkt_nval_len[] = { G_OBEX_OP_PUT, 0xab, 0xcd, 0x12 };

-static guint8 pkt_put_long[] = { G_OBEX_OP_PUT, 0x00, 0x32,
+static uint8_t pkt_put_long[] = { G_OBEX_OP_PUT, 0x00, 0x32,
G_OBEX_HDR_CONNECTION, 0x01, 0x02, 0x03, 0x04,
G_OBEX_HDR_TYPE, 0x00, 0x0b,
'f', 'o', 'o', '/', 'b', 'a', 'r', '\0',
@@ -84,7 +84,7 @@ static void test_decode_pkt_header(void)
GObexHeader *header;
GError *err = NULL;
gboolean ret;
- guint8 val;
+ uint8_t val;

pkt = g_obex_packet_decode(pkt_put_action, sizeof(pkt_put_action),
0, G_OBEX_DATA_REF, &err);
@@ -106,8 +106,8 @@ static void test_decode_connect(void)
GObexHeader *header;
GError *err = NULL;
gboolean ret;
- const guint8 *buf;
- guint8 target[] = { 0xab, 0xcd };
+ const uint8_t *buf;
+ uint8_t target[] = { 0xab, 0xcd };
gsize len;

pkt = g_obex_packet_decode(pkt_connect, sizeof(pkt_connect),
@@ -213,7 +213,7 @@ static void test_encode_on_demand_fail(void)
static void test_create_args(void)
{
GObexPacket *pkt;
- guint8 buf[255], body[] = { 0x00, 0x01, 0x02, 0x03, 0x04 };
+ uint8_t buf[255], body[] = { 0x00, 0x01, 0x02, 0x03, 0x04 };
gssize len;

pkt = g_obex_packet_new(G_OBEX_OP_PUT, FALSE,
diff --git a/unit/test-gobex-transfer.c b/unit/test-gobex-transfer.c
index ef05047..693c70b 100644
--- a/unit/test-gobex-transfer.c
+++ b/unit/test-gobex-transfer.c
@@ -31,7 +31,7 @@
#include <errno.h>
#include <unistd.h>
#include <string.h>
-#include <stdint.h>
+#include <inttypes.h>
#include <fcntl.h>

#include <gobex/gobex.h>
@@ -41,7 +41,7 @@
#define FINAL_BIT 0x80
#define RANDOM_PACKETS 4

-static guint8 put_req_first[] = { G_OBEX_OP_PUT, 0x00, 0x30,
+static uint8_t put_req_first[] = { G_OBEX_OP_PUT, 0x00, 0x30,
G_OBEX_HDR_TYPE, 0x00, 0x0b,
'f', 'o', 'o', '/', 'b', 'a', 'r', '\0',
G_OBEX_HDR_NAME, 0x00, 0x15,
@@ -49,7 +49,7 @@ static guint8 put_req_first[] = { G_OBEX_OP_PUT, 0x00, 0x30,
G_OBEX_HDR_BODY, 0x00, 0x0d,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

-static guint8 put_req_first_srm[] = { G_OBEX_OP_PUT, 0x00, 0x32,
+static uint8_t put_req_first_srm[] = { G_OBEX_OP_PUT, 0x00, 0x32,
G_OBEX_HDR_TYPE, 0x00, 0x0b,
'f', 'o', 'o', '/', 'b', 'a', 'r', '\0',
G_OBEX_HDR_NAME, 0x00, 0x15,
@@ -58,32 +58,32 @@ static guint8 put_req_first_srm[] = { G_OBEX_OP_PUT, 0x00, 0x32,
G_OBEX_HDR_BODY, 0x00, 0x0d,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

-static guint8 put_req_zero[255] = { G_OBEX_OP_PUT, 0x00, 0xff,
+static uint8_t put_req_zero[255] = { G_OBEX_OP_PUT, 0x00, 0xff,
G_OBEX_HDR_BODY, 0x00, 0xfc };

-static guint8 put_req_last[] = { G_OBEX_OP_PUT | FINAL_BIT, 0x00, 0x06,
+static uint8_t put_req_last[] = { G_OBEX_OP_PUT | FINAL_BIT, 0x00, 0x06,
G_OBEX_HDR_BODY_END, 0x00, 0x03 };

-static guint8 abort_req[] = { G_OBEX_OP_ABORT | FINAL_BIT, 0x00, 0x03 };
+static uint8_t abort_req[] = { G_OBEX_OP_ABORT | FINAL_BIT, 0x00, 0x03 };

-static guint8 put_rsp_first[] = { G_OBEX_RSP_CONTINUE | FINAL_BIT,
+static uint8_t put_rsp_first[] = { G_OBEX_RSP_CONTINUE | FINAL_BIT,
0x00, 0x03 };
-static guint8 put_rsp_first_srm[] = { G_OBEX_RSP_CONTINUE | FINAL_BIT,
+static uint8_t put_rsp_first_srm[] = { G_OBEX_RSP_CONTINUE | FINAL_BIT,
0x00, 0x05,
G_OBEX_HDR_SRM, 0x01 };
-static guint8 put_rsp_first_srm_wait[] = { G_OBEX_RSP_CONTINUE | FINAL_BIT,
+static uint8_t put_rsp_first_srm_wait[] = { G_OBEX_RSP_CONTINUE | FINAL_BIT,
0x00, 0x07,
G_OBEX_HDR_SRM, 0x01,
G_OBEX_HDR_SRMP, 0x01 };
-static guint8 put_rsp_last[] = { G_OBEX_RSP_SUCCESS | FINAL_BIT, 0x00, 0x03 };
+static uint8_t put_rsp_last[] = { G_OBEX_RSP_SUCCESS | FINAL_BIT, 0x00, 0x03 };

-static guint8 get_req_first[] = { G_OBEX_OP_GET | FINAL_BIT, 0x00, 0x23,
+static uint8_t get_req_first[] = { G_OBEX_OP_GET | FINAL_BIT, 0x00, 0x23,
G_OBEX_HDR_TYPE, 0x00, 0x0b,
'f', 'o', 'o', '/', 'b', 'a', 'r', '\0',
G_OBEX_HDR_NAME, 0x00, 0x15,
0, 'f', 0, 'i', 0, 'l', 0, 'e', 0, '.', 0, 't', 0, 'x', 0, 't', 0, 0 };

-static guint8 get_req_first_app[] = { G_OBEX_OP_GET | FINAL_BIT, 0x00, 0x2a,
+static uint8_t get_req_first_app[] = { G_OBEX_OP_GET | FINAL_BIT, 0x00, 0x2a,
G_OBEX_HDR_TYPE, 0x00, 0x0b,
'f', 'o', 'o', '/', 'b', 'a', 'r', '\0',
G_OBEX_HDR_NAME, 0x00, 0x15,
@@ -91,14 +91,15 @@ static guint8 get_req_first_app[] = { G_OBEX_OP_GET | FINAL_BIT, 0x00, 0x2a,
G_OBEX_HDR_APPARAM, 0x00, 0x07,
0, 1, 2, 3 };

-static guint8 get_req_first_srm[] = { G_OBEX_OP_GET | FINAL_BIT, 0x00, 0x25,
+static uint8_t get_req_first_srm[] = { G_OBEX_OP_GET | FINAL_BIT, 0x00, 0x25,
G_OBEX_HDR_SRM, 0x01,
G_OBEX_HDR_TYPE, 0x00, 0x0b,
'f', 'o', 'o', '/', 'b', 'a', 'r', '\0',
G_OBEX_HDR_NAME, 0x00, 0x15,
0, 'f', 0, 'i', 0, 'l', 0, 'e', 0, '.', 0, 't', 0, 'x', 0, 't', 0, 0 };

-static guint8 get_req_first_srm_wait[] = { G_OBEX_OP_GET | FINAL_BIT, 0x00, 0x27,
+static uint8_t get_req_first_srm_wait[] = { G_OBEX_OP_GET | FINAL_BIT,
+ 0x00, 0x27,
G_OBEX_HDR_SRM, 0x01,
G_OBEX_HDR_TYPE, 0x00, 0x0b,
'f', 'o', 'o', '/', 'b', 'a', 'r', '\0',
@@ -106,67 +107,72 @@ static guint8 get_req_first_srm_wait[] = { G_OBEX_OP_GET | FINAL_BIT, 0x00, 0x27
0, 'f', 0, 'i', 0, 'l', 0, 'e', 0, '.', 0, 't', 0, 'x', 0, 't', 0, 0,
G_OBEX_HDR_SRMP, 0x01 };

-static guint8 get_req_last[] = { G_OBEX_OP_GET | FINAL_BIT, 0x00, 0x03, };
+static uint8_t get_req_last[] = { G_OBEX_OP_GET | FINAL_BIT, 0x00, 0x03, };

-static guint8 get_rsp_first_app[] = { G_OBEX_RSP_CONTINUE | FINAL_BIT, 0x00, 0x0A,
+static uint8_t get_rsp_first_app[] = { G_OBEX_RSP_CONTINUE | FINAL_BIT,
+ 0x00, 0x0A,
G_OBEX_HDR_APPARAM, 0x00, 0x07,
0, 1, 2, 3 };
-static guint8 get_rsp_first[] = { G_OBEX_RSP_CONTINUE | FINAL_BIT, 0x00, 0x10,
+static uint8_t get_rsp_first[] = { G_OBEX_RSP_CONTINUE | FINAL_BIT,
+ 0x00, 0x10,
G_OBEX_HDR_BODY, 0x00, 0x0d,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
-static guint8 get_rsp_first_srm[] = { G_OBEX_RSP_CONTINUE | FINAL_BIT, 0x00, 0x12,
+static uint8_t get_rsp_first_srm[] = { G_OBEX_RSP_CONTINUE | FINAL_BIT,
+ 0x00, 0x12,
G_OBEX_HDR_SRM, 0x01,
G_OBEX_HDR_BODY, 0x00, 0x0d,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
-static guint8 get_rsp_first_srm_wait_next[] = { G_OBEX_RSP_CONTINUE | FINAL_BIT,
+static uint8_t get_rsp_first_srm_wait_next[] = {
+ G_OBEX_RSP_CONTINUE | FINAL_BIT,
0x00, 0x14,
G_OBEX_HDR_SRM, 0x01,
G_OBEX_HDR_SRMP, 0x02,
G_OBEX_HDR_BODY, 0x00, 0x0d,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
-static guint8 get_rsp_zero[255] = { G_OBEX_RSP_CONTINUE | FINAL_BIT, 0x00, 0xff,
+static uint8_t get_rsp_zero[255] = { G_OBEX_RSP_CONTINUE | FINAL_BIT,
+ 0x00, 0xff,
G_OBEX_HDR_BODY, 0x00, 0xfc };
-static guint8 get_rsp_zero_wait_next[255] = { G_OBEX_RSP_CONTINUE | FINAL_BIT,
+static uint8_t get_rsp_zero_wait_next[255] = { G_OBEX_RSP_CONTINUE | FINAL_BIT,
0x00, 0xff,
G_OBEX_HDR_SRMP, 0x02,
G_OBEX_HDR_BODY, 0x00, 0xfa };
-static guint8 get_rsp_last[] = { G_OBEX_RSP_SUCCESS | FINAL_BIT, 0x00, 0x06,
+static uint8_t get_rsp_last[] = { G_OBEX_RSP_SUCCESS | FINAL_BIT, 0x00, 0x06,
G_OBEX_HDR_BODY_END, 0x00, 0x03 };

-static guint8 conn_req[] = { G_OBEX_OP_CONNECT | FINAL_BIT, 0x00, 0x07,
+static uint8_t conn_req[] = { G_OBEX_OP_CONNECT | FINAL_BIT, 0x00, 0x07,
0x10, 0x00, 0x10, 0x00 };
-static guint8 conn_rsp[] = { G_OBEX_RSP_SUCCESS | FINAL_BIT, 0x00, 0x0c,
+static uint8_t conn_rsp[] = { G_OBEX_RSP_SUCCESS | FINAL_BIT, 0x00, 0x0c,
0x10, 0x00, 0x10, 0x00,
G_OBEX_HDR_CONNECTION, 0x00, 0x00,
0x00, 0x01 };

-static guint8 conn_req_srm[] = { G_OBEX_OP_CONNECT | FINAL_BIT, 0x00, 0x09,
+static uint8_t conn_req_srm[] = { G_OBEX_OP_CONNECT | FINAL_BIT, 0x00, 0x09,
0x10, 0x00, 0x10, 0x00,
G_OBEX_HDR_SRM, 0x02 };
-static guint8 conn_rsp_srm[] = { G_OBEX_RSP_SUCCESS | FINAL_BIT, 0x00, 0x0e,
+static uint8_t conn_rsp_srm[] = { G_OBEX_RSP_SUCCESS | FINAL_BIT, 0x00, 0x0e,
0x10, 0x00, 0x10, 0x00,
G_OBEX_HDR_CONNECTION, 0x00, 0x00,
0x00, 0x01,
G_OBEX_HDR_SRM, 0x01 };

-static guint8 unavailable_rsp[] = { G_OBEX_RSP_SERVICE_UNAVAILABLE | FINAL_BIT,
+static uint8_t unavailable_rsp[] = { G_OBEX_RSP_SERVICE_UNAVAILABLE | FINAL_BIT,
0x00, 0x03 };

-static guint8 conn_get_req_first[] = { G_OBEX_OP_GET | FINAL_BIT, 0x00, 0x28,
+static uint8_t conn_get_req_first[] = { G_OBEX_OP_GET | FINAL_BIT, 0x00, 0x28,
G_OBEX_HDR_CONNECTION, 0x00, 0x00, 0x00, 0x01,
G_OBEX_HDR_TYPE, 0x00, 0x0b,
'f', 'o', 'o', '/', 'b', 'a', 'r', '\0',
G_OBEX_HDR_NAME, 0x00, 0x15,
0, 'f', 0, 'i', 0, 'l', 0, 'e', 0, '.', 0, 't', 0, 'x', 0, 't', 0, 0 };

-static guint8 conn_get_req_wrg[] = { G_OBEX_OP_GET | FINAL_BIT, 0x00, 0x28,
+static uint8_t conn_get_req_wrg[] = { G_OBEX_OP_GET | FINAL_BIT, 0x00, 0x28,
G_OBEX_HDR_CONNECTION, 0x00, 0x00, 0x00, 0xFF,
G_OBEX_HDR_TYPE, 0x00, 0x0b,
'f', 'o', 'o', '/', 'b', 'a', 'r', '\0',
G_OBEX_HDR_NAME, 0x00, 0x15,
0, 'f', 0, 'i', 0, 'l', 0, 'e', 0, '.', 0, 't', 0, 'x', 0, 't', 0, 0 };

-static guint8 conn_put_req_first[] = { G_OBEX_OP_PUT, 0x00, 0x35,
+static uint8_t conn_put_req_first[] = { G_OBEX_OP_PUT, 0x00, 0x35,
G_OBEX_HDR_CONNECTION, 0x00, 0x00, 0x00, 0x01,
G_OBEX_HDR_TYPE, 0x00, 0x0b,
'f', 'o', 'o', '/', 'b', 'a', 'r', '\0',
@@ -175,9 +181,9 @@ static guint8 conn_put_req_first[] = { G_OBEX_OP_PUT, 0x00, 0x35,
G_OBEX_HDR_BODY, 0x00, 0x0d,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

-static guint8 hdr_type[] = "foo/bar";
-static guint8 hdr_app[] = { 0, 1, 2, 3 };
-static guint8 body_data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+static uint8_t hdr_type[] = "foo/bar";
+static uint8_t hdr_app[] = { 0, 1, 2, 3 };
+static uint8_t body_data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

static void transfer_complete(GObex *obex, GError *err, gpointer user_data)
{
@@ -272,7 +278,7 @@ static void test_put_req(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ put_req_first, sizeof(put_req_first) },
@@ -329,8 +335,8 @@ static gboolean rcv_data(const void *buf, gsize len, gpointer user_data)
static void handle_put(GObex *obex, GObexPacket *req, gpointer user_data)
{
struct test_data *d = user_data;
- guint8 op = g_obex_packet_get_operation(req, NULL);
- guint id;
+ uint8_t op = g_obex_packet_get_operation(req, NULL);
+ unsigned int id;

if (op != G_OBEX_OP_PUT) {
d->err = g_error_new(TEST_ERROR, TEST_ERROR_UNEXPECTED,
@@ -349,7 +355,7 @@ static void test_put_rsp(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ put_rsp_first, sizeof(put_rsp_first) },
@@ -395,8 +401,8 @@ static void handle_put_seq(GObex *obex, GObexPacket *req,
gpointer user_data)
{
struct test_data *d = user_data;
- guint8 op = g_obex_packet_get_operation(req, NULL);
- guint id;
+ uint8_t op = g_obex_packet_get_operation(req, NULL);
+ unsigned int id;

if (op != G_OBEX_OP_PUT) {
d->err = g_error_new(TEST_ERROR, TEST_ERROR_UNEXPECTED,
@@ -415,7 +421,7 @@ static void test_stream_put_rsp(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ put_rsp_first, sizeof(put_rsp_first) },
@@ -477,7 +483,7 @@ static void test_stream_put_req_abort(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ put_req_first, sizeof(put_req_first) },
@@ -517,7 +523,7 @@ static void test_stream_put_rsp_abort(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ put_rsp_first, sizeof(put_rsp_first) },
@@ -562,8 +568,8 @@ static void handle_put_seq_wait(GObex *obex, GObexPacket *req,
gpointer user_data)
{
struct test_data *d = user_data;
- guint8 op = g_obex_packet_get_operation(req, NULL);
- guint id;
+ uint8_t op = g_obex_packet_get_operation(req, NULL);
+ unsigned int id;

if (op != G_OBEX_OP_PUT) {
d->err = g_error_new(TEST_ERROR, TEST_ERROR_UNEXPECTED,
@@ -584,7 +590,7 @@ static void test_packet_put_rsp_wait(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ put_rsp_first_srm_wait, sizeof(put_rsp_first_srm_wait) },
@@ -631,7 +637,7 @@ static void test_packet_put_rsp(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ put_rsp_first_srm, sizeof(put_rsp_first_srm) },
@@ -677,7 +683,7 @@ static void test_get_req(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ get_req_first, sizeof(get_req_first) },
@@ -718,7 +724,7 @@ static void test_stream_get_req(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ get_req_first, sizeof(get_req_first) },
@@ -763,7 +769,7 @@ static void test_packet_get_req(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ get_req_first_srm, sizeof(get_req_first_srm) },
@@ -808,7 +814,7 @@ static void test_packet_get_req_wait(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ get_req_first_srm_wait, sizeof(get_req_first_srm_wait) },
@@ -854,7 +860,7 @@ static void test_packet_get_req_wait_next(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ get_req_first_srm, sizeof(get_req_first_srm) },
@@ -900,7 +906,7 @@ static void test_get_req_app(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ get_req_first_app, sizeof(get_req_first_app) },
@@ -944,8 +950,8 @@ static void handle_get_eagain(GObex *obex, GObexPacket *req,
gpointer user_data)
{
struct test_data *d = user_data;
- guint8 op = g_obex_packet_get_operation(req, NULL);
- guint id;
+ uint8_t op = g_obex_packet_get_operation(req, NULL);
+ unsigned int id;

if (op != G_OBEX_OP_GET) {
d->err = g_error_new(TEST_ERROR, TEST_ERROR_UNEXPECTED,
@@ -963,8 +969,8 @@ static void handle_get_eagain(GObex *obex, GObexPacket *req,
static void handle_get(GObex *obex, GObexPacket *req, gpointer user_data)
{
struct test_data *d = user_data;
- guint8 op = g_obex_packet_get_operation(req, NULL);
- guint id;
+ uint8_t op = g_obex_packet_get_operation(req, NULL);
+ unsigned int id;

if (op != G_OBEX_OP_GET) {
d->err = g_error_new(TEST_ERROR, TEST_ERROR_UNEXPECTED,
@@ -983,7 +989,7 @@ static void test_stream_put_req(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ NULL, 0 },
@@ -1029,7 +1035,7 @@ static void test_packet_put_req_wait(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ NULL, 0 },
@@ -1075,7 +1081,7 @@ static void test_packet_put_req(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ NULL, 0 },
@@ -1121,7 +1127,7 @@ static void test_put_req_eagain(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ put_req_first, sizeof(put_req_first) },
@@ -1164,7 +1170,7 @@ static void test_get_rsp(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ get_rsp_first, sizeof(get_rsp_first) },
@@ -1205,8 +1211,8 @@ static void handle_get_seq(GObex *obex, GObexPacket *req,
gpointer user_data)
{
struct test_data *d = user_data;
- guint8 op = g_obex_packet_get_operation(req, NULL);
- guint id;
+ uint8_t op = g_obex_packet_get_operation(req, NULL);
+ unsigned int id;

if (op != G_OBEX_OP_GET) {
d->err = g_error_new(TEST_ERROR, TEST_ERROR_UNEXPECTED,
@@ -1225,7 +1231,7 @@ static void test_stream_get_rsp(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ NULL, 0 },
@@ -1269,7 +1275,7 @@ static void test_packet_get_rsp(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ NULL, 0 },
@@ -1314,8 +1320,8 @@ static void handle_get_seq_srm_wait(GObex *obex, GObexPacket *req,
gpointer user_data)
{
struct test_data *d = user_data;
- guint8 op = g_obex_packet_get_operation(req, NULL);
- guint id;
+ uint8_t op = g_obex_packet_get_operation(req, NULL);
+ unsigned int id;

if (op != G_OBEX_OP_GET) {
d->err = g_error_new(TEST_ERROR, TEST_ERROR_UNEXPECTED,
@@ -1336,7 +1342,7 @@ static void test_packet_get_rsp_wait(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ NULL, 0 },
@@ -1381,7 +1387,7 @@ static void test_packet_get_rsp_wait(void)
static void handle_get_app(GObex *obex, GObexPacket *req, gpointer user_data)
{
struct test_data *d = user_data;
- guint8 op = g_obex_packet_get_operation(req, NULL);
+ uint8_t op = g_obex_packet_get_operation(req, NULL);
GObexPacket *rsp;

if (op != G_OBEX_OP_GET) {
@@ -1405,7 +1411,7 @@ static void test_get_rsp_app(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ get_rsp_first_app, sizeof(get_rsp_first_app) },
@@ -1449,7 +1455,7 @@ static void test_put_req_delay(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ put_req_first, sizeof(put_req_first) },
@@ -1492,7 +1498,7 @@ static void test_get_rsp_delay(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ get_rsp_first, sizeof(get_rsp_first) },
@@ -1556,8 +1562,8 @@ static gboolean rcv_data_delay(const void *buf, gsize len, gpointer user_data)
static void handle_put_delay(GObex *obex, GObexPacket *req, gpointer user_data)
{
struct test_data *d = user_data;
- guint8 op = g_obex_packet_get_operation(req, NULL);
- guint id;
+ uint8_t op = g_obex_packet_get_operation(req, NULL);
+ unsigned int id;

if (op != G_OBEX_OP_PUT) {
d->err = g_error_new(TEST_ERROR, TEST_ERROR_UNEXPECTED,
@@ -1576,7 +1582,7 @@ static void test_put_rsp_delay(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ put_rsp_first, sizeof(put_rsp_first) },
@@ -1619,7 +1625,7 @@ static void test_get_req_delay(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ get_req_first, sizeof(get_req_first) },
@@ -1662,7 +1668,7 @@ static void test_get_rsp_eagain(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ get_rsp_first, sizeof(get_rsp_first) },
@@ -1717,7 +1723,7 @@ static void test_conn_req(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ conn_req, sizeof(conn_req) } }, {
@@ -1754,7 +1760,7 @@ static void handle_conn_rsp(GObex *obex, GObexPacket *req,
gpointer user_data)
{
struct test_data *d = user_data;
- guint8 op = g_obex_packet_get_operation(req, NULL);
+ uint8_t op = g_obex_packet_get_operation(req, NULL);
GObexPacket *rsp;

if (op != G_OBEX_OP_CONNECT) {
@@ -1774,7 +1780,7 @@ static void test_conn_rsp(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ conn_rsp, sizeof(conn_rsp) } }, {
@@ -1831,7 +1837,7 @@ static void test_conn_get_req(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ conn_req, sizeof(conn_req) },
@@ -1873,7 +1879,7 @@ static void test_conn_get_rsp(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ conn_rsp, sizeof(conn_rsp) },
@@ -1937,7 +1943,7 @@ static void test_conn_put_req(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ conn_req, sizeof(conn_req) },
@@ -1979,7 +1985,7 @@ static void test_conn_put_rsp(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ conn_rsp, sizeof(conn_rsp) },
@@ -2027,7 +2033,7 @@ static void test_conn_get_wrg_rsp(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ conn_rsp, sizeof(conn_rsp) },
@@ -2086,7 +2092,7 @@ static void test_conn_put_req_seq(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ conn_req, sizeof(conn_req) } ,
@@ -2146,7 +2152,7 @@ static void test_conn_put_req_seq_srm(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ conn_req_srm, sizeof(conn_req_srm) } ,
diff --git a/unit/test-gobex.c b/unit/test-gobex.c
index 66307c2..b1bd21b 100644
--- a/unit/test-gobex.c
+++ b/unit/test-gobex.c
@@ -24,13 +24,13 @@
#include "config.h"
#endif

+#include <inttypes.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
-#include <stdint.h>

#include <gobex/gobex.h>

@@ -104,7 +104,7 @@ static gboolean timeout(gpointer user_data)
static void connect_rsp(GObex *obex, GError *err, GObexPacket *rsp,
gpointer user_data)
{
- guint8 rsp_code;
+ uint8_t rsp_code;
gboolean final;
GError **test_err = user_data;

@@ -235,7 +235,7 @@ static void send_req(GObexPacket *req, GObexResponseFunc rsp_func,
GError *gerr = NULL;
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id, test_time;
+ unsigned int io_id, timer_id, test_time;
GObex *obex;

create_endpoints(&obex, &io, transport_type);
@@ -272,7 +272,7 @@ static void send_connect(GObexResponseFunc rsp_func, GIOFunc send_rsp_func,
int req_timeout, int transport_type)
{
GObexPacket *req;
- guint8 connect_data[] = { 0x10, 0x00, 0x10, 0x00 };
+ uint8_t connect_data[] = { 0x10, 0x00, 0x10, 0x00 };

req = g_obex_packet_new(G_OBEX_OP_CONNECT, TRUE, G_OBEX_HDR_INVALID);
g_assert(req != NULL);
@@ -322,7 +322,7 @@ static void test_send_connect_req_timeout_pkt(void)

struct req_info {
GObex *obex;
- guint id;
+ unsigned int id;
GError *err;
};

@@ -420,7 +420,7 @@ failed:
static void test_cancel_req_delay(int transport_type)
{
GIOChannel *io;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
struct req_info r;
GObexPacket *req;
GIOCondition cond;
@@ -464,7 +464,7 @@ static void test_cancel_req_delay_pkt(void)

struct rcv_buf_info {
GError *err;
- const guint8 *buf;
+ const uint8_t *buf;
gsize len;
};

@@ -510,12 +510,12 @@ done:

static void test_send_connect(int transport_type)
{
- guint8 connect_data[] = { 0x10, 0x00, 0x10, 0x00 };
+ uint8_t connect_data[] = { 0x10, 0x00, 0x10, 0x00 };
struct rcv_buf_info r;
GIOChannel *io;
GIOCondition cond;
GObexPacket *req;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;

create_endpoints(&obex, &io, transport_type);
@@ -578,9 +578,9 @@ static void test_recv_unexpected(void)
GError *err = NULL;
GObexPacket *req;
GIOChannel *io;
- guint timer_id;
+ unsigned int timer_id;
GObex *obex;
- guint8 buf[255];
+ uint8_t buf[255];
gssize len;

create_endpoints(&obex, &io, SOCK_STREAM);
@@ -632,7 +632,7 @@ static void test_send_on_demand(int transport_type, GObexDataProducer func)
GIOChannel *io;
GIOCondition cond;
GObexPacket *req;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;

create_endpoints(&obex, &io, transport_type);
@@ -715,7 +715,7 @@ static void handle_connect_err(GObex *obex, GError *err, gpointer user_data)
static void recv_connect(int transport_type)
{
GError *gerr = NULL;
- guint timer_id;
+ unsigned int timer_id;
GObex *obex;
GIOChannel *io;
GIOStatus status;
@@ -773,7 +773,7 @@ static void disconn_ev(GObex *obex, GError *err, gpointer user_data)
static void test_disconnect(void)
{
GError *gerr = NULL;
- guint timer_id;
+ unsigned int timer_id;
GObex *obex;
GIOChannel *io;

@@ -848,7 +848,7 @@ static void test_connect(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ pkt_connect_req, sizeof(pkt_connect_req) } }, {
@@ -884,7 +884,7 @@ static void test_setpath(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ pkt_setpath_req, sizeof(pkt_setpath_req) } }, {
@@ -920,7 +920,7 @@ static void test_setpath_up(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ pkt_setpath_up_req, sizeof(pkt_setpath_up_req) } }, {
@@ -956,7 +956,7 @@ static void test_setpath_up_down(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ pkt_setpath_up_down_req,
@@ -993,7 +993,7 @@ static void test_mkdir(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ pkt_mkdir_req, sizeof(pkt_mkdir_req) } }, {
@@ -1029,7 +1029,7 @@ static void test_delete(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ pkt_delete_req, sizeof(pkt_delete_req) } }, {
@@ -1065,7 +1065,7 @@ static void test_copy(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ pkt_copy_req, sizeof(pkt_copy_req) } }, {
@@ -1101,7 +1101,7 @@ static void test_move(void)
{
GIOChannel *io;
GIOCondition cond;
- guint io_id, timer_id;
+ unsigned int io_id, timer_id;
GObex *obex;
struct test_data d = { 0, NULL, {
{ pkt_move_req, sizeof(pkt_move_req) } }, {
diff --git a/unit/test-mgmt.c b/unit/test-mgmt.c
index f9dcb00..5b61975 100644
--- a/unit/test-mgmt.c
+++ b/unit/test-mgmt.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdbool.h>
#include <unistd.h>
#include <sys/socket.h>
@@ -39,7 +40,7 @@
struct context {
GMainLoop *main_loop;
struct mgmt *mgmt_client;
- guint server_source;
+ unsigned int server_source;
GList *handler_list;
};

diff --git a/unit/test-sdp.c b/unit/test-sdp.c
index 5aa6948..4a749c7 100644
--- a/unit/test-sdp.c
+++ b/unit/test-sdp.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdbool.h>
@@ -111,8 +112,8 @@ struct test_data_de {

struct context {
GMainLoop *main_loop;
- guint server_source;
- guint client_source;
+ unsigned int server_source;
+ unsigned int client_source;
int fd;
int mtu;
uint8_t cont_data[16];
diff --git a/unit/util.c b/unit/util.c
index c76acdf..093f001 100644
--- a/unit/util.c
+++ b/unit/util.c
@@ -27,7 +27,7 @@
#include <sys/socket.h>
#include <unistd.h>
#include <stdlib.h>
-#include <stdint.h>
+#include <inttypes.h>
#include <string.h>
#include <errno.h>

diff --git a/unit/util.h b/unit/util.h
index 752ce61..e4caf9c 100644
--- a/unit/util.h
+++ b/unit/util.h
@@ -19,6 +19,7 @@
*
*/

+#include <inttypes.h>
#include <gobex/gobex.h>

enum {
@@ -32,13 +33,13 @@ struct test_buf {
};

struct test_data {
- guint count;
+ unsigned int count;
GError *err;
struct test_buf recv[4];
struct test_buf send[4];
- guint provide_delay;
+ unsigned int provide_delay;
GObex *obex;
- guint id;
+ unsigned int id;
gsize total;
GMainLoop *mainloop;
};
--
1.8.2.2


2013-05-09 04:16:53

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 23/26] core: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate and prefer this one
over stdint.h.
---
src/adapter.c | 37 ++++++++++++++++++++-----------------
src/adapter.h | 5 +++--
src/agent.c | 3 ++-
src/attio.h | 7 +++++--
src/attrib-server.c | 30 +++++++++++++++---------------
src/attrib-server.h | 6 ++++--
src/device.c | 38 ++++++++++++++++++++------------------
src/device.h | 6 ++++--
src/main.c | 7 ++++---
src/profile.c | 8 ++++----
src/rfkill.c | 4 ++--
src/sdp-client.c | 5 +++--
src/sdpd-server.c | 3 ++-
src/shared/hciemu.c | 15 ++++++++-------
src/shared/mgmt.c | 5 +++--
src/shared/tester.c | 7 ++++---
16 files changed, 103 insertions(+), 83 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index b952ea1..a0253f5 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -26,6 +26,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
@@ -108,11 +109,11 @@ static GSList *adapter_drivers = NULL;
struct discovery_client {
struct btd_adapter *adapter;
char *owner;
- guint watch;
+ unsigned int watch;
};

struct service_auth {
- guint id;
+ unsigned int id;
service_auth_cb cb;
void *user_data;
const char *uuid;
@@ -152,12 +153,12 @@ struct btd_adapter {
bool discovery_suspended; /* discovery has been suspended */
GSList *discovery_list; /* list of discovery clients */
GSList *discovery_found; /* list of found devices */
- guint discovery_idle_timeout; /* timeout between discovery runs */
- guint passive_scan_timeout; /* timeout between passive scans */
- guint temp_devices_timeout; /* timeout for temporary devices */
+ unsigned int discovery_idle_timeout; /* timeout between discovery runs */
+ unsigned int passive_scan_timeout; /* timeout between passive scans */
+ unsigned int temp_devices_timeout; /* timeout for temporary devices */

- guint pairable_timeout_id; /* pairable timeout id */
- guint auth_idle_id; /* Pending authorization dequeue */
+ unsigned int pairable_timeout_id; /* pairable timeout id */
+ unsigned int auth_idle_id; /* Pending authorization dequeue */
GQueue *auths; /* Ongoing and pending auths */
GSList *connections; /* Connected devices */
GSList *devices; /* Devices structure pointers */
@@ -176,13 +177,13 @@ struct btd_adapter {
struct oob_handler *oob_handler;

unsigned int load_ltks_id;
- guint load_ltks_timeout;
+ unsigned int load_ltks_timeout;

unsigned int confirm_name_id;
- guint confirm_name_timeout;
+ unsigned int confirm_name_timeout;

unsigned int pair_device_id;
- guint pair_device_timeout;
+ unsigned int pair_device_timeout;

bool is_default; /* true if adapter is default one */
};
@@ -1217,7 +1218,8 @@ static void cancel_passive_scanning(struct btd_adapter *adapter)
}
}

-static void trigger_start_discovery(struct btd_adapter *adapter, guint delay);
+static void trigger_start_discovery(struct btd_adapter *adapter,
+ unsigned int delay);

static void start_discovery_complete(uint8_t status, uint16_t length,
const void *param, void *user_data)
@@ -1308,7 +1310,8 @@ static gboolean start_discovery_timeout(gpointer user_data)
return FALSE;
}

-static void trigger_start_discovery(struct btd_adapter *adapter, guint delay)
+static void trigger_start_discovery(struct btd_adapter *adapter,
+ unsigned int delay)
{

DBG("");
@@ -4392,7 +4395,7 @@ static int adapter_authorize(struct btd_adapter *adapter, const bdaddr_t *dst,
{
struct service_auth *auth;
struct btd_device *device;
- static guint id = 0;
+ static unsigned int id = 0;

device = adapter_find_device(adapter, dst);
if (!device)
@@ -4426,7 +4429,7 @@ static int adapter_authorize(struct btd_adapter *adapter, const bdaddr_t *dst,
return auth->id;
}

-guint btd_request_authorization(const bdaddr_t *src, const bdaddr_t *dst,
+unsigned int btd_request_authorization(const bdaddr_t *src, const bdaddr_t *dst,
const char *uuid, service_auth_cb cb,
void *user_data)
{
@@ -4442,7 +4445,7 @@ guint btd_request_authorization(const bdaddr_t *src, const bdaddr_t *dst,
}

for (l = adapters; l != NULL; l = g_slist_next(l)) {
- guint id;
+ unsigned int id;

adapter = l->data;

@@ -4454,7 +4457,7 @@ guint btd_request_authorization(const bdaddr_t *src, const bdaddr_t *dst,
return 0;
}

-static struct service_auth *find_authorization(guint id)
+static struct service_auth *find_authorization(unsigned int id)
{
GSList *l;
GList *l2;
@@ -4473,7 +4476,7 @@ static struct service_auth *find_authorization(guint id)
return NULL;
}

-int btd_cancel_authorization(guint id)
+int btd_cancel_authorization(unsigned int id)
{
struct service_auth *auth;

diff --git a/src/adapter.h b/src/adapter.h
index 6b6515a..c988e03 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -28,6 +28,7 @@
#include <bluetooth/hci_lib.h>
#include <dbus/dbus.h>
#include <glib.h>
+#include <inttypes.h>
#include <stdbool.h>

#define MAX_NAME_LENGTH 248
@@ -125,9 +126,9 @@ void adapter_add_profile(struct btd_adapter *adapter, gpointer p);
void adapter_remove_profile(struct btd_adapter *adapter, gpointer p);
int btd_register_adapter_driver(struct btd_adapter_driver *driver);
void btd_unregister_adapter_driver(struct btd_adapter_driver *driver);
-guint btd_request_authorization(const bdaddr_t *src, const bdaddr_t *dst,
+unsigned int btd_request_authorization(const bdaddr_t *src, const bdaddr_t *dst,
const char *uuid, service_auth_cb cb, void *user_data);
-int btd_cancel_authorization(guint id);
+int btd_cancel_authorization(unsigned int id);

int btd_adapter_restore_powered(struct btd_adapter *adapter);

diff --git a/src/agent.c b/src/agent.c
index 0fde3ef..b039aa3 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -26,6 +26,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
@@ -76,7 +77,7 @@ struct agent {
char *path;
uint8_t capability;
struct agent_request *request;
- guint watch;
+ unsigned int watch;
};

struct agent_request {
diff --git a/src/attio.h b/src/attio.h
index 16e2873..d5719c4 100644
--- a/src/attio.h
+++ b/src/attio.h
@@ -22,12 +22,15 @@
*
*/

+#include <inttypes.h>
+
typedef void (*attio_connect_cb) (GAttrib *attrib, gpointer user_data);
typedef void (*attio_disconnect_cb) (gpointer user_data);

-guint btd_device_add_attio_callback(struct btd_device *device,
+unsigned int btd_device_add_attio_callback(struct btd_device *device,
attio_connect_cb cfunc,
attio_disconnect_cb dcfunc,
gpointer user_data);

-gboolean btd_device_remove_attio_callback(struct btd_device *device, guint id);
+gboolean btd_device_remove_attio_callback(struct btd_device *device,
+ unsigned int id);
diff --git a/src/attrib-server.c b/src/attrib-server.c
index 3610e60..9029793 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -26,8 +26,8 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <errno.h>
-#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
@@ -72,12 +72,12 @@ struct gatt_channel {
bdaddr_t src;
bdaddr_t dst;
GAttrib *attrib;
- guint mtu;
+ unsigned int mtu;
gboolean le;
- guint id;
+ unsigned int id;
gboolean encrypted;
struct gatt_server *server;
- guint cleanup_id;
+ unsigned int cleanup_id;
struct btd_device *device;
};

@@ -260,7 +260,7 @@ static struct attribute *find_svc_range(struct gatt_server *server,
uint16_t start, uint16_t *end)
{
struct attribute *attrib;
- guint h = start;
+ unsigned int h = start;
GList *l;

if (end == NULL)
@@ -340,7 +340,7 @@ static struct attribute *attrib_db_add_new(struct gatt_server *server,
const uint8_t *value, size_t len)
{
struct attribute *a;
- guint h = handle;
+ unsigned int h = handle;

DBG("handle=0x%04x", handle);

@@ -787,7 +787,7 @@ static uint16_t read_value(struct gatt_channel *channel, uint16_t handle,
uint8_t status;
GList *l;
uint16_t cccval;
- guint h = handle;
+ unsigned int h = handle;

l = g_list_find_custom(channel->server->database,
GUINT_TO_POINTER(h), handle_cmp);
@@ -824,7 +824,7 @@ static uint16_t read_blob(struct gatt_channel *channel, uint16_t handle,
uint8_t status;
GList *l;
uint16_t cccval;
- guint h = handle;
+ unsigned int h = handle;

l = g_list_find_custom(channel->server->database,
GUINT_TO_POINTER(h), handle_cmp);
@@ -866,7 +866,7 @@ static uint16_t write_value(struct gatt_channel *channel, uint16_t handle,
struct attribute *a;
uint8_t status;
GList *l;
- guint h = handle;
+ unsigned int h = handle;

l = g_list_find_custom(channel->server->database,
GUINT_TO_POINTER(h), handle_cmp);
@@ -1098,7 +1098,7 @@ done:
g_attrib_send(channel->attrib, 0, opdu, length, NULL, NULL, NULL);
}

-guint attrib_channel_attach(GAttrib *attrib)
+unsigned int attrib_channel_attach(GAttrib *attrib)
{
struct gatt_server *server;
struct btd_device *device;
@@ -1106,7 +1106,7 @@ guint attrib_channel_attach(GAttrib *attrib)
GIOChannel *io;
GError *gerr = NULL;
uint16_t cid;
- guint mtu = 0;
+ unsigned int mtu = 0;

io = g_attrib_get_channel(attrib);

@@ -1179,12 +1179,12 @@ guint attrib_channel_attach(GAttrib *attrib)
static int channel_id_cmp(gconstpointer data, gconstpointer user_data)
{
const struct gatt_channel *channel = data;
- guint id = GPOINTER_TO_UINT(user_data);
+ unsigned int id = GPOINTER_TO_UINT(user_data);

return channel->id - id;
}

-gboolean attrib_channel_detach(GAttrib *attrib, guint id)
+gboolean attrib_channel_detach(GAttrib *attrib, unsigned int id)
{
struct gatt_server *server;
struct gatt_channel *channel;
@@ -1512,7 +1512,7 @@ int attrib_db_update(struct btd_adapter *adapter, uint16_t handle,
struct attribute *a;
GSList *l;
GList *dl;
- guint h = handle;
+ unsigned int h = handle;

l = g_slist_find_custom(servers, adapter, adapter_cmp);
if (l == NULL)
@@ -1551,7 +1551,7 @@ int attrib_db_del(struct btd_adapter *adapter, uint16_t handle)
struct attribute *a;
GSList *l;
GList *dl;
- guint h = handle;
+ unsigned int h = handle;

l = g_slist_find_custom(servers, adapter, adapter_cmp);
if (l == NULL)
diff --git a/src/attrib-server.h b/src/attrib-server.h
index 2148017..f4e3106 100644
--- a/src/attrib-server.h
+++ b/src/attrib-server.h
@@ -22,6 +22,8 @@
*
*/

+#include <inttypes.h>
+
uint16_t attrib_db_find_avail(struct btd_adapter *adapter, bt_uuid_t *svc_uuid,
uint16_t nitems);
struct attribute *attrib_db_add(struct btd_adapter *adapter, uint16_t handle,
@@ -37,5 +39,5 @@ int attrib_gap_set(struct btd_adapter *adapter, uint16_t uuid,
uint32_t attrib_create_sdp(struct btd_adapter *adapter, uint16_t handle,
const char *name);
void attrib_free_sdp(uint32_t sdp_handle);
-guint attrib_channel_attach(GAttrib *attrib);
-gboolean attrib_channel_detach(GAttrib *attrib, guint id);
+unsigned int attrib_channel_attach(GAttrib *attrib);
+gboolean attrib_channel_detach(GAttrib *attrib, unsigned int id);
diff --git a/src/device.c b/src/device.c
index 14c3e81..01fba20 100644
--- a/src/device.c
+++ b/src/device.c
@@ -26,6 +26,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -76,7 +77,7 @@ static DBusConnection *dbus_conn = NULL;
unsigned service_state_cb_id;

struct btd_disconnect_data {
- guint id;
+ unsigned int id;
disconnect_watch watch;
void *user_data;
GDestroyNotify destroy;
@@ -84,7 +85,7 @@ struct btd_disconnect_data {

struct bonding_req {
DBusMessage *msg;
- guint listener_id;
+ unsigned int listener_id;
struct btd_device *device;
struct agent *agent;
};
@@ -115,7 +116,7 @@ struct browse_req {
sdp_list_t *records;
int search_uuid;
int reconnect_attempt;
- guint listener_id;
+ unsigned int listener_id;
};

struct included_search {
@@ -125,7 +126,7 @@ struct included_search {
};

struct attio_data {
- guint id;
+ unsigned int id;
attio_connect_cb cfunc;
attio_disconnect_cb dcfunc;
gpointer user_data;
@@ -133,7 +134,7 @@ struct attio_data {

struct svc_callback {
unsigned int id;
- guint idle_id;
+ unsigned int idle_id;
struct btd_device *dev;
device_svc_cb_t func;
void *user_data;
@@ -174,8 +175,8 @@ struct btd_device {
GSList *pending; /* Pending services */
GSList *watches; /* List of disconnect_data */
gboolean temporary;
- guint disconn_timer;
- guint discov_timer;
+ unsigned int disconn_timer;
+ unsigned int discov_timer;
struct browse_req *browse; /* service discover request */
struct bonding_req *bonding;
struct authentication_req *authr; /* authentication request */
@@ -185,7 +186,7 @@ struct btd_device {
GAttrib *attrib;
GSList *attios;
GSList *attios_offline;
- guint attachid; /* Attrib server attach */
+ unsigned int attachid; /* Attrib server attach */

gboolean connected;

@@ -203,8 +204,8 @@ struct btd_device {
int8_t rssi;

GIOChannel *att_io;
- guint cleanup_id;
- guint store_id;
+ unsigned int cleanup_id;
+ unsigned int store_id;
};

static const uint16_t uuid_list[] = {
@@ -1752,12 +1753,12 @@ void device_remove_connection(struct btd_device *device)
DEVICE_INTERFACE, "Connected");
}

-guint device_add_disconnect_watch(struct btd_device *device,
+unsigned int device_add_disconnect_watch(struct btd_device *device,
disconnect_watch watch, void *user_data,
GDestroyNotify destroy)
{
struct btd_disconnect_data *data;
- static guint id = 0;
+ static unsigned int id = 0;

data = g_new0(struct btd_disconnect_data, 1);
data->id = ++id;
@@ -1770,7 +1771,7 @@ guint device_add_disconnect_watch(struct btd_device *device,
return data->id;
}

-void device_remove_disconnect_watch(struct btd_device *device, guint id)
+void device_remove_disconnect_watch(struct btd_device *device, unsigned int id)
{
GSList *l;

@@ -3167,7 +3168,7 @@ static void find_included_services(struct browse_req *req, GSList *services)

}

-static void primary_cb(GSList *services, guint8 status, gpointer user_data)
+static void primary_cb(GSList *services, uint8_t status, gpointer user_data)
{
struct browse_req *req = user_data;

@@ -4275,13 +4276,13 @@ static gboolean notify_attios(gpointer user_data)
return FALSE;
}

-guint btd_device_add_attio_callback(struct btd_device *device,
+unsigned int btd_device_add_attio_callback(struct btd_device *device,
attio_connect_cb cfunc,
attio_disconnect_cb dcfunc,
gpointer user_data)
{
struct attio_data *attio;
- static guint attio_id = 0;
+ static unsigned int attio_id = 0;

DBG("%p registered ATT connection callback", device);

@@ -4308,12 +4309,13 @@ guint btd_device_add_attio_callback(struct btd_device *device,
static int attio_id_cmp(gconstpointer a, gconstpointer b)
{
const struct attio_data *attio = a;
- guint id = GPOINTER_TO_UINT(b);
+ unsigned int id = GPOINTER_TO_UINT(b);

return attio->id - id;
}

-gboolean btd_device_remove_attio_callback(struct btd_device *device, guint id)
+gboolean btd_device_remove_attio_callback(struct btd_device *device,
+ unsigned int id)
{
struct attio_data *attio;
GSList *l;
diff --git a/src/device.h b/src/device.h
index 70e1502..94d2faf 100644
--- a/src/device.h
+++ b/src/device.h
@@ -22,6 +22,8 @@
*
*/

+#include <inttypes.h>
+
#define DEVICE_INTERFACE "org.bluez.Device1"

struct btd_device;
@@ -94,10 +96,10 @@ void device_request_disconnect(struct btd_device *device, DBusMessage *msg);
typedef void (*disconnect_watch) (struct btd_device *device, gboolean removal,
void *user_data);

-guint device_add_disconnect_watch(struct btd_device *device,
+unsigned int device_add_disconnect_watch(struct btd_device *device,
disconnect_watch watch, void *user_data,
GDestroyNotify destroy);
-void device_remove_disconnect_watch(struct btd_device *device, guint id);
+void device_remove_disconnect_watch(struct btd_device *device, unsigned int id);
int device_get_appearance(struct btd_device *device, uint16_t *value);
void device_set_appearance(struct btd_device *device, uint16_t value);

diff --git a/src/main.c b/src/main.c
index dc0478e..280a1bc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -27,6 +27,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
@@ -340,10 +341,10 @@ static gboolean signal_handler(GIOChannel *channel, GIOCondition cond,
return TRUE;
}

-static guint setup_signalfd(void)
+static unsigned int setup_signalfd(void)
{
GIOChannel *channel;
- guint source;
+ unsigned int source;
sigset_t mask;
int fd;

@@ -488,7 +489,7 @@ int main(int argc, char *argv[])
uint32_t sdp_flags = 0;
int gdbus_flags = 0;
GKeyFile *config;
- guint signal, watchdog;
+ unsigned int signal, watchdog;
const char *watchdog_usec;

init_defaults();
diff --git a/src/profile.c b/src/profile.c
index 8fd0424..5a3dd06 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -25,8 +25,8 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdbool.h>
-#include <stdint.h>
#include <stdlib.h>
#include <errno.h>

@@ -560,7 +560,7 @@ struct ext_profile {

char *remote_uuid;

- guint id;
+ unsigned int id;

BtIOSecLevel sec_level;
bool authorize;
@@ -588,7 +588,7 @@ struct ext_io {
struct ext_profile *ext;
int proto;
GIOChannel *io;
- guint io_id;
+ unsigned int io_id;
struct btd_adapter *adapter;
struct btd_device *device;
struct btd_service *service;
@@ -602,7 +602,7 @@ struct ext_io {
uint16_t psm;
uint8_t chan;

- guint auth_id;
+ unsigned int auth_id;
unsigned int svc_id;
DBusPendingCall *pending;
};
diff --git a/src/rfkill.c b/src/rfkill.c
index 70588c0..9380a1e 100644
--- a/src/rfkill.c
+++ b/src/rfkill.c
@@ -25,11 +25,11 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
-#include <stdint.h>
#include <stdlib.h>
#include <string.h>

@@ -138,7 +138,7 @@ static gboolean rfkill_event(GIOChannel *chan,
return TRUE;
}

-static guint watch = 0;
+static unsigned int watch = 0;

void rfkill_init(void)
{
diff --git a/src/sdp-client.c b/src/sdp-client.c
index fdf2b01..be1f004 100644
--- a/src/sdp-client.c
+++ b/src/sdp-client.c
@@ -26,6 +26,7 @@
#endif

#include <errno.h>
+#include <inttypes.h>

#include <bluetooth/bluetooth.h>
#include <bluetooth/sdp.h>
@@ -43,7 +44,7 @@ struct cached_sdp_session {
bdaddr_t src;
bdaddr_t dst;
sdp_session_t *session;
- guint timer;
+ unsigned int timer;
};

static GSList *cached_sdp_sessions = NULL;
@@ -123,7 +124,7 @@ struct search_context {
bt_destroy_t destroy;
gpointer user_data;
uuid_t uuid;
- guint io_id;
+ unsigned int io_id;
};

static GSList *context_list = NULL;
diff --git a/src/sdpd-server.c b/src/sdpd-server.c
index bc96d3c..88416e3 100644
--- a/src/sdpd-server.c
+++ b/src/sdpd-server.c
@@ -28,6 +28,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
@@ -49,7 +50,7 @@
#include "log.h"
#include "sdpd.h"

-static guint l2cap_id = 0, unix_id = 0;
+static unsigned int l2cap_id = 0, unix_id = 0;

static int l2cap_sock, unix_sock;

diff --git a/src/shared/hciemu.c b/src/shared/hciemu.c
index 463ef52..8adaf0a 100644
--- a/src/shared/hciemu.c
+++ b/src/shared/hciemu.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
@@ -46,9 +47,9 @@ struct hciemu {
struct bthost *host_stack;
struct btdev *master_dev;
struct btdev *client_dev;
- guint host_source;
- guint master_source;
- guint client_source;
+ unsigned int host_source;
+ unsigned int master_source;
+ unsigned int client_source;
GList *post_command_hooks;
char bdaddr_str[18];
};
@@ -125,10 +126,10 @@ static gboolean receive_bthost(GIOChannel *channel, GIOCondition condition,
return TRUE;
}

-static guint create_source_bthost(int fd, struct bthost *bthost)
+static unsigned int create_source_bthost(int fd, struct bthost *bthost)
{
GIOChannel *channel;
- guint source;
+ unsigned int source;

channel = g_io_channel_unix_new(fd);

@@ -169,10 +170,10 @@ static gboolean receive_btdev(GIOChannel *channel, GIOCondition condition,
return TRUE;
}

-static guint create_source_btdev(int fd, struct btdev *btdev)
+static unsigned int create_source_btdev(int fd, struct btdev *btdev)
{
GIOChannel *channel;
- guint source;
+ unsigned int source;

channel = g_io_channel_unix_new(fd);

diff --git a/src/shared/mgmt.c b/src/shared/mgmt.c
index 2c79886..7beae19 100644
--- a/src/shared/mgmt.c
+++ b/src/shared/mgmt.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
@@ -44,8 +45,8 @@ struct mgmt {
int fd;
bool close_on_unref;
GIOChannel *io;
- guint read_watch;
- guint write_watch;
+ unsigned int read_watch;
+ unsigned int write_watch;
GQueue *request_queue;
GQueue *reply_queue;
GList *pending_list;
diff --git a/src/shared/tester.c b/src/shared/tester.c
index f3edd74..0c84312 100644
--- a/src/shared/tester.c
+++ b/src/shared/tester.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
@@ -675,10 +676,10 @@ static gboolean signal_handler(GIOChannel *channel, GIOCondition condition,
return TRUE;
}

-static guint setup_signalfd(void)
+static unsigned int setup_signalfd(void)
{
GIOChannel *channel;
- guint source;
+ unsigned int source;
sigset_t mask;
int fd;

@@ -768,7 +769,7 @@ void tester_init(int *argc, char ***argv)

int tester_run(void)
{
- guint signal;
+ unsigned int signal;

if (!main_loop)
return EXIT_FAILURE;
--
1.8.2.2


2013-05-09 04:16:54

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 24/26] tools: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate.
---
tools/btiotest.c | 6 +++---
tools/mpris-player.c | 2 +-
tools/obex-server-tool.c | 15 ++++++++-------
3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/tools/btiotest.c b/tools/btiotest.c
index 5359ace..3c6a86e 100644
--- a/tools/btiotest.c
+++ b/tools/btiotest.c
@@ -26,9 +26,9 @@
#include "config.h"
#endif

+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
-#include <stdint.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
@@ -41,7 +41,7 @@
static int opt_update_sec = 0;

struct io_data {
- guint ref;
+ unsigned int ref;
GIOChannel *io;
int reject;
int disconn;
@@ -519,7 +519,7 @@ static int opt_sec = 0;
static gboolean opt_master = FALSE;
static int opt_priority = 0;
static int opt_cid = 0;
-static guint8 opt_addr_type = 0;
+static uint8_t opt_addr_type = 0;

static GMainLoop *main_loop;

diff --git a/tools/mpris-player.c b/tools/mpris-player.c
index a7a506c..3ad72e8 100644
--- a/tools/mpris-player.c
+++ b/tools/mpris-player.c
@@ -1844,7 +1844,7 @@ int main(int argc, char *argv[])
{
GOptionContext *context;
GError *error = NULL;
- guint owner_watch, properties_watch;
+ unsigned int owner_watch, properties_watch;
struct sigaction sa;

context = g_option_context_new(NULL);
diff --git a/tools/obex-server-tool.c b/tools/obex-server-tool.c
index e37c56f..08a21a1 100644
--- a/tools/obex-server-tool.c
+++ b/tools/obex-server-tool.c
@@ -27,6 +27,7 @@
#include <sys/socket.h>
#include <fcntl.h>
#include <sys/un.h>
+#include <inttypes.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
@@ -121,7 +122,7 @@ static void handle_put(GObex *obex, GObexPacket *req, gpointer user_data)

hdr = g_obex_packet_get_header(req, G_OBEX_HDR_TYPE);
if (hdr != NULL) {
- g_obex_header_get_bytes(hdr, (const guint8 **) &type,
+ g_obex_header_get_bytes(hdr, (const uint8_t **) &type,
&type_len);
if (type[type_len - 1] != '\0') {
g_printerr("non-nul terminated type header\n");
@@ -180,7 +181,7 @@ static void handle_get(GObex *obex, GObexPacket *req, gpointer user_data)

hdr = g_obex_packet_get_header(req, G_OBEX_HDR_TYPE);
if (hdr != NULL) {
- g_obex_header_get_bytes(hdr, (const guint8 **) &type,
+ g_obex_header_get_bytes(hdr, (const uint8_t **) &type,
&type_len);
if (type[type_len - 1] != '\0') {
g_printerr("non-nul terminated type header\n");
@@ -327,10 +328,10 @@ static GIOChannel *rfcomm_listen(GError **err)
BT_IO_OPT_INVALID);
}

-static guint bluetooth_listen(void)
+static unsigned int bluetooth_listen(void)
{
GIOChannel *io;
- guint id;
+ unsigned int id;
GError *err = NULL;

if (option_channel == -1) {
@@ -361,14 +362,14 @@ static guint bluetooth_listen(void)
return id;
}

-static guint unix_listen(void)
+static unsigned int unix_listen(void)
{
GIOChannel *io;
struct sockaddr_un addr = {
AF_UNIX, "\0/gobex/server"
};
int sk, err, sock_type;
- guint id;
+ unsigned int id;

if (option_packet)
sock_type = SOCK_SEQPACKET;
@@ -415,7 +416,7 @@ int main(int argc, char *argv[])
GOptionContext *context;
GError *err = NULL;
struct sigaction sa;
- guint server_id;
+ unsigned int server_id;

context = g_option_context_new(NULL);
g_option_context_add_main_entries(context, options, NULL);
--
1.8.2.2


2013-05-09 04:16:52

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 22/26] thermometer: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate.
---
profiles/thermometer/thermometer.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/profiles/thermometer/thermometer.c b/profiles/thermometer/thermometer.c
index c2ca251..ddc9d55 100644
--- a/profiles/thermometer/thermometer.c
+++ b/profiles/thermometer/thermometer.c
@@ -24,6 +24,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdbool.h>
#include <errno.h>

@@ -70,13 +71,13 @@ struct thermometer {
struct thermometer_adapter *tadapter;
GAttrib *attrib; /* GATT connection */
struct att_range *svc_range; /* Thermometer range */
- guint attioid; /* Att watcher id */
+ unsigned int attioid; /* Att watcher id */
/* attio id for Temperature Measurement value indications */
- guint attio_measurement_id;
+ unsigned int attio_measurement_id;
/* attio id for Intermediate Temperature value notifications */
- guint attio_intermediate_id;
+ unsigned int attio_intermediate_id;
/* attio id for Measurement Interval value indications */
- guint attio_interval_id;
+ unsigned int attio_interval_id;
gboolean intermediate;
uint8_t type;
uint16_t interval;
@@ -97,7 +98,7 @@ struct characteristic {

struct watcher {
struct thermometer_adapter *tadapter;
- guint id;
+ unsigned int id;
char *srv;
char *path;
};
@@ -476,8 +477,8 @@ static void interval_ind_handler(const uint8_t *pdu, uint16_t len,
g_attrib_send(t->attrib, 0, opdu, olen, NULL, NULL, NULL);
}

-static void valid_range_desc_cb(guint8 status, const guint8 *pdu, guint16 len,
- gpointer user_data)
+static void valid_range_desc_cb(uint8_t status, const uint8_t *pdu,
+ uint16_t len, gpointer user_data)
{
struct thermometer *t = user_data;
uint8_t value[VALID_RANGE_DESC_SIZE];
@@ -513,8 +514,8 @@ static void valid_range_desc_cb(guint8 status, const guint8 *pdu, guint16 len,
change_property(t, "Minimum", &min);
}

-static void write_ccc_cb(guint8 status, const guint8 *pdu,
- guint16 len, gpointer user_data)
+static void write_ccc_cb(uint8_t status, const uint8_t *pdu, uint16_t len,
+ gpointer user_data)
{
char *msg = user_data;

@@ -525,7 +526,7 @@ static void write_ccc_cb(guint8 status, const guint8 *pdu,
}

static void process_thermometer_desc(struct characteristic *ch, uint16_t uuid,
- uint16_t handle)
+ uint16_t handle)
{
uint8_t atval[2];
uint16_t val;
@@ -573,7 +574,7 @@ static void process_thermometer_desc(struct characteristic *ch, uint16_t uuid,
write_ccc_cb, msg);
}

-static void discover_desc_cb(guint8 status, const guint8 *pdu, guint16 len,
+static void discover_desc_cb(uint8_t status, const uint8_t *pdu, uint16_t len,
gpointer user_data)
{
struct characteristic *ch = user_data;
@@ -636,7 +637,7 @@ static void discover_desc(struct thermometer *t, struct gatt_char *c,
gatt_find_info(t->attrib, start, end, discover_desc_cb, ch);
}

-static void read_temp_type_cb(guint8 status, const guint8 *pdu, guint16 len,
+static void read_temp_type_cb(uint8_t status, const uint8_t *pdu, uint16_t len,
gpointer user_data)
{
struct thermometer *t = user_data;
@@ -664,7 +665,7 @@ static void read_temp_type_cb(guint8 status, const guint8 *pdu, guint16 len,
t->type = value[0];
}

-static void read_interval_cb(guint8 status, const guint8 *pdu, guint16 len,
+static void read_interval_cb(uint8_t status, const uint8_t *pdu, uint16_t len,
gpointer user_data)
{
struct thermometer *t = user_data;
@@ -737,7 +738,7 @@ static void process_thermometer_char(struct thermometer *t,
}
}

-static void configure_thermometer_cb(GSList *characteristics, guint8 status,
+static void configure_thermometer_cb(GSList *characteristics, uint8_t status,
gpointer user_data)
{
struct thermometer *t = user_data;
@@ -757,7 +758,7 @@ static void configure_thermometer_cb(GSList *characteristics, guint8 status,
}
}

-static void write_interval_cb(guint8 status, const guint8 *pdu, guint16 len,
+static void write_interval_cb(uint8_t status, const uint8_t *pdu, uint16_t len,
gpointer user_data)
{
struct tmp_interval_data *data = user_data;
--
1.8.2.2


2013-05-09 04:16:50

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 20/26] sap: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate.
---
profiles/sap/sap-dummy.c | 2 +-
profiles/sap/sap.h | 2 +-
profiles/sap/server.c | 9 +++++----
3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/profiles/sap/sap-dummy.c b/profiles/sap/sap-dummy.c
index 47dedf7..a62dbcc 100644
--- a/profiles/sap/sap-dummy.c
+++ b/profiles/sap/sap-dummy.c
@@ -28,7 +28,7 @@

#include <glib.h>
#include <gdbus/gdbus.h>
-#include <stdint.h>
+#include <inttypes.h>

#include "dbus-common.h"
#include "error.h"
diff --git a/profiles/sap/sap.h b/profiles/sap/sap.h
index 16c333a..88e328e 100644
--- a/profiles/sap/sap.h
+++ b/profiles/sap/sap.h
@@ -23,7 +23,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

-#include <stdint.h>
+#include <inttypes.h>
#include <glib.h>

#ifdef SAP_DEBUG
diff --git a/profiles/sap/server.c b/profiles/sap/server.c
index dfcf0f1..da5d494 100644
--- a/profiles/sap/server.c
+++ b/profiles/sap/server.c
@@ -28,6 +28,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <errno.h>
#include <glib.h>
#include <bluetooth/sdp.h>
@@ -69,7 +70,7 @@ struct sap_connection {
GIOChannel *io;
uint32_t state;
uint8_t processing_req;
- guint timer_id;
+ unsigned int timer_id;
};

struct sap_server {
@@ -79,7 +80,7 @@ struct sap_server {
struct sap_connection *conn;
};

-static void start_guard_timer(struct sap_server *server, guint interval);
+static void start_guard_timer(struct sap_server *server, unsigned int interval);
static void stop_guard_timer(struct sap_server *server);
static gboolean guard_timeout(gpointer data);

@@ -553,7 +554,7 @@ error_rsp:
sap_error_rsp(conn);
}

-static void start_guard_timer(struct sap_server *server, guint interval)
+static void start_guard_timer(struct sap_server *server, unsigned int interval)
{
struct sap_connection *conn = server->conn;

@@ -1209,7 +1210,7 @@ static void connect_confirm_cb(GIOChannel *io, gpointer data)
GError *gerr = NULL;
bdaddr_t src, dst;
char dstaddr[18];
- guint ret;
+ unsigned int ret;

DBG("conn %p io %p", conn, io);

--
1.8.2.2


2013-05-09 04:16:49

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 19/26] proximity: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate.
---
profiles/proximity/immalert.c | 3 ++-
profiles/proximity/linkloss.c | 5 +++--
profiles/proximity/main.c | 2 +-
profiles/proximity/monitor.c | 16 ++++++++--------
4 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/profiles/proximity/immalert.c b/profiles/proximity/immalert.c
index 06e8eb8..60487c6 100644
--- a/profiles/proximity/immalert.c
+++ b/profiles/proximity/immalert.c
@@ -24,6 +24,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdbool.h>

#include <glib.h>
@@ -56,7 +57,7 @@ struct connected_device {
struct btd_device *device;
struct imm_alert_adapter *adapter;
uint8_t alert_level;
- guint callback_id;
+ unsigned int callback_id;
};

static GSList *imm_alert_adapters;
diff --git a/profiles/proximity/linkloss.c b/profiles/proximity/linkloss.c
index cb87b12..b4cf8d3 100644
--- a/profiles/proximity/linkloss.c
+++ b/profiles/proximity/linkloss.c
@@ -24,6 +24,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdbool.h>

#include <glib.h>
@@ -57,8 +58,8 @@ struct connected_device {
struct btd_device *device;
struct link_loss_adapter *adapter;
uint8_t alert_level;
- guint callback_id;
- guint local_disc_id;
+ unsigned int callback_id;
+ unsigned int local_disc_id;
};

static GSList *link_loss_adapters;
diff --git a/profiles/proximity/main.c b/profiles/proximity/main.c
index 46468d2..f6ed629 100644
--- a/profiles/proximity/main.c
+++ b/profiles/proximity/main.c
@@ -27,7 +27,7 @@
#endif

#include <errno.h>
-#include <stdint.h>
+#include <inttypes.h>
#include <glib.h>
#include <gdbus/gdbus.h>

diff --git a/profiles/proximity/monitor.c b/profiles/proximity/monitor.c
index eaa5b0d..a084475 100644
--- a/profiles/proximity/monitor.c
+++ b/profiles/proximity/monitor.c
@@ -29,7 +29,7 @@
#include <errno.h>
#include <fcntl.h>
#include <gdbus/gdbus.h>
-#include <stdint.h>
+#include <inttypes.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -80,8 +80,8 @@ struct monitor {
* Value Handle */
uint16_t txpowerhandle; /* Tx Characteristic Value Handle */
uint16_t immediatehandle; /* Immediate Alert Value Handle */
- guint immediateto; /* Reset Immediate Alert to "none" */
- guint attioid;
+ unsigned int immediateto; /* Reset Immediate Alert to "none" */
+ unsigned int attioid;
};

static GSList *monitors = NULL;
@@ -166,7 +166,7 @@ static uint8_t str2level(const char *level)
return ALERT_NONE;
}

-static void linkloss_written(guint8 status, const guint8 *pdu, guint16 plen,
+static void linkloss_written(uint8_t status, const uint8_t *pdu, uint16_t plen,
gpointer user_data)
{
struct monitor *monitor = user_data;
@@ -190,7 +190,7 @@ static void linkloss_written(guint8 status, const guint8 *pdu, guint16 plen,
PROXIMITY_INTERFACE, "LinkLossAlertLevel");
}

-static void char_discovered_cb(GSList *characteristics, guint8 status,
+static void char_discovered_cb(GSList *characteristics, uint8_t status,
gpointer user_data)
{
struct monitor *monitor = user_data;
@@ -234,7 +234,7 @@ static int write_alert_level(struct monitor *monitor)
return 0;
}

-static void tx_power_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
+static void tx_power_read_cb(uint8_t status, const uint8_t *pdu, uint16_t plen,
gpointer user_data)
{
uint8_t value[TX_POWER_SIZE];
@@ -259,7 +259,7 @@ static void tx_power_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
DBG("Tx Power Level: %02x", (int8_t) value[0]);
}

-static void tx_power_handle_cb(GSList *characteristics, guint8 status,
+static void tx_power_handle_cb(GSList *characteristics, uint8_t status,
gpointer user_data)
{
struct monitor *monitor = user_data;
@@ -346,7 +346,7 @@ static void write_immediate_alert(struct monitor *monitor)
immediate_written, monitor);
}

-static void immediate_handle_cb(GSList *characteristics, guint8 status,
+static void immediate_handle_cb(GSList *characteristics, uint8_t status,
gpointer user_data)
{
struct monitor *monitor = user_data;
--
1.8.2.2


2013-05-09 04:16:48

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 18/26] network: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate.
---
profiles/network/connection.c | 7 ++++---
profiles/network/server.c | 7 ++++---
2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/profiles/network/connection.c b/profiles/network/connection.c
index 9481072..f69d22a 100644
--- a/profiles/network/connection.c
+++ b/profiles/network/connection.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdio.h>
#include <stdbool.h>
#include <errno.h>
@@ -71,10 +72,10 @@ struct network_conn {
uint16_t id; /* Role: Service Class Identifier */
conn_state state;
GIOChannel *io;
- guint dc_id;
+ unsigned int dc_id;
struct network_peer *peer;
- guint attempt_cnt;
- guint timeout_source;
+ unsigned int attempt_cnt;
+ unsigned int timeout_source;
DBusMessage *connect;
};

diff --git a/profiles/network/server.c b/profiles/network/server.c
index de48bec..3dff8b4 100644
--- a/profiles/network/server.c
+++ b/profiles/network/server.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
@@ -59,7 +60,7 @@ struct network_session {
bdaddr_t dst; /* Remote Bluetooth Address */
char dev[16]; /* Interface name */
GIOChannel *io; /* Pending connect channel */
- guint watch; /* BNEP socket watch */
+ unsigned int watch; /* BNEP socket watch */
};

struct network_adapter {
@@ -78,7 +79,7 @@ struct network_server {
uint16_t id; /* Service class identifier */
GSList *sessions; /* Active connections */
struct network_adapter *na; /* Adapter reference */
- guint watch_id; /* Client service watch */
+ unsigned int watch_id; /* Client service watch */
};

static GSList *adapters = NULL;
@@ -518,7 +519,7 @@ static void confirm_event(GIOChannel *chan, gpointer user_data)
bdaddr_t src, dst;
char address[18];
GError *err = NULL;
- guint ret;
+ unsigned int ret;

bt_io_get(chan, &err,
BT_IO_OPT_SOURCE_BDADDR, &src,
--
1.8.2.2


2013-05-09 04:16:47

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 17/26] input: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate.
---
profiles/input/device.c | 11 +++++-----
profiles/input/hog.c | 48 ++++++++++++++++++++++--------------------
profiles/input/server.c | 3 ++-
profiles/input/suspend-dummy.c | 3 ++-
4 files changed, 35 insertions(+), 30 deletions(-)

diff --git a/profiles/input/device.c b/profiles/input/device.c
index 498c226..ef209d2 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdlib.h>
#include <stdbool.h>
#include <errno.h>
@@ -72,15 +73,15 @@ struct input_device {
uint32_t handle;
GIOChannel *ctrl_io;
GIOChannel *intr_io;
- guint ctrl_watch;
- guint intr_watch;
- guint sec_watch;
+ unsigned int ctrl_watch;
+ unsigned int intr_watch;
+ unsigned int sec_watch;
struct hidp_connadd_req *req;
- guint dc_id;
+ unsigned int dc_id;
bool disable_sdp;
char *name;
enum reconnect_mode_t reconnect_mode;
- guint reconnect_timer;
+ unsigned int reconnect_timer;
uint32_t reconnect_attempt;
};

diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index 3ce9480..4d9f7b9 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -27,6 +27,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdlib.h>
#include <stdbool.h>
#include <errno.h>
@@ -79,12 +80,12 @@ struct hog_device {
uint16_t id;
struct btd_device *device;
GAttrib *attrib;
- guint attioid;
+ unsigned int attioid;
struct gatt_primary *hog_primary;
GSList *reports;
int uhid_fd;
gboolean has_report_id;
- guint uhid_watch_id;
+ unsigned int uhid_watch_id;
uint16_t bcdhid;
uint8_t bcountrycode;
uint16_t proto_mode_handle;
@@ -95,7 +96,7 @@ struct hog_device {
struct report {
uint8_t id;
uint8_t type;
- guint notifyid;
+ unsigned int notifyid;
struct gatt_char *decl;
struct hog_device *hogdev;
};
@@ -142,8 +143,8 @@ static void report_value_cb(const uint8_t *pdu, uint16_t len,
hogdev->id, hogdev->uhid_fd);
}

-static void report_ccc_written_cb(guint8 status, const guint8 *pdu,
- guint16 plen, gpointer user_data)
+static void report_ccc_written_cb(uint8_t status, const uint8_t *pdu,
+ uint16_t plen, gpointer user_data)
{
struct report *report = user_data;
struct hog_device *hogdev = report->hogdev;
@@ -172,8 +173,8 @@ static void write_ccc(uint16_t handle, gpointer user_data)
report_ccc_written_cb, report);
}

-static void report_reference_cb(guint8 status, const guint8 *pdu,
- guint16 plen, gpointer user_data)
+static void report_reference_cb(uint8_t status, const uint8_t *pdu,
+ uint16_t plen, gpointer user_data)
{
struct report *report = user_data;

@@ -193,12 +194,12 @@ static void report_reference_cb(guint8 status, const guint8 *pdu,
DBG("Report ID: 0x%02x Report type: 0x%02x", pdu[1], pdu[2]);
}

-static void external_report_reference_cb(guint8 status, const guint8 *pdu,
- guint16 plen, gpointer user_data);
+static void external_report_reference_cb(uint8_t status, const uint8_t *pdu,
+ uint16_t plen, gpointer user_data);


-static void discover_descriptor_cb(guint8 status, const guint8 *pdu,
- guint16 len, gpointer user_data)
+static void discover_descriptor_cb(uint8_t status, const uint8_t *pdu,
+ uint16_t len, gpointer user_data)
{
struct disc_desc_cb_data *ddcb_data = user_data;
struct report *report;
@@ -282,7 +283,7 @@ static void discover_descriptor(GAttrib *attrib, uint16_t start, uint16_t end,
gatt_find_info(attrib, start, end, discover_descriptor_cb, ddcb_data);
}

-static void external_service_char_cb(GSList *chars, guint8 status,
+static void external_service_char_cb(GSList *chars, uint8_t status,
gpointer user_data)
{
struct hog_device *hogdev = user_data;
@@ -316,8 +317,8 @@ static void external_service_char_cb(GSList *chars, guint8 status,
}
}

-static void external_report_reference_cb(guint8 status, const guint8 *pdu,
- guint16 plen, gpointer user_data)
+static void external_report_reference_cb(uint8_t status, const uint8_t *pdu,
+ uint16_t plen, gpointer user_data)
{
struct hog_device *hogdev = user_data;
uint16_t uuid16;
@@ -342,8 +343,8 @@ static void external_report_reference_cb(guint8 status, const guint8 *pdu,
external_service_char_cb, hogdev);
}

-static void report_map_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
- gpointer user_data)
+static void report_map_read_cb(uint8_t status, const uint8_t *pdu,
+ uint16_t plen, gpointer user_data)
{
struct hog_device *hogdev = user_data;
uint8_t value[HOG_REPORT_MAP_MAX_SIZE];
@@ -403,7 +404,7 @@ static void report_map_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
error("Failed to create uHID device: %s", strerror(errno));
}

-static void info_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
+static void info_read_cb(uint8_t status, const uint8_t *pdu, uint16_t plen,
gpointer user_data)
{
struct hog_device *hogdev = user_data;
@@ -430,8 +431,8 @@ static void info_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
hogdev->bcdhid, hogdev->bcountrycode, hogdev->flags);
}

-static void proto_mode_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
- gpointer user_data)
+static void proto_mode_read_cb(uint8_t status, const uint8_t *pdu,
+ uint16_t plen, gpointer user_data)
{
struct hog_device *hogdev = user_data;
uint8_t value;
@@ -462,7 +463,8 @@ static void proto_mode_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
hogdev->id);
}

-static void char_discovered_cb(GSList *chars, guint8 status, gpointer user_data)
+static void char_discovered_cb(GSList *chars, uint8_t status,
+ gpointer user_data)
{
struct hog_device *hogdev = user_data;
struct gatt_primary *prim = hogdev->hog_primary;
@@ -530,8 +532,8 @@ static void char_discovered_cb(GSList *chars, guint8 status, gpointer user_data)
hogdev);
}

-static void output_written_cb(guint8 status, const guint8 *pdu,
- guint16 plen, gpointer user_data)
+static void output_written_cb(uint8_t status, const uint8_t *pdu,
+ uint16_t plen, gpointer user_data)
{
if (status != 0) {
error("Write output report failed: %s", att_ecode2str(status));
@@ -554,7 +556,7 @@ static void forward_report(struct hog_device *hogdev,
GSList *l;
void *data;
int size;
- guint type;
+ unsigned int type;

if (hogdev->has_report_id) {
data = ev->u.output.data + 1;
diff --git a/profiles/input/server.c b/profiles/input/server.c
index 5c98573..6f37158 100644
--- a/profiles/input/server.c
+++ b/profiles/input/server.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <unistd.h>
#include <stdbool.h>
#include <errno.h>
@@ -154,7 +155,7 @@ static void confirm_event_cb(GIOChannel *chan, gpointer user_data)
bdaddr_t src, dst;
GError *err = NULL;
char addr[18];
- guint ret;
+ unsigned int ret;

bt_io_get(chan, &err,
BT_IO_OPT_SOURCE_BDADDR, &src,
diff --git a/profiles/input/suspend-dummy.c b/profiles/input/suspend-dummy.c
index 75dd536..f815703 100644
--- a/profiles/input/suspend-dummy.c
+++ b/profiles/input/suspend-dummy.c
@@ -26,6 +26,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
@@ -44,7 +45,7 @@

static suspend_event suspend_cb = NULL;
static resume_event resume_cb = NULL;
-static guint watch = 0;
+static unsigned int watch = 0;

static int fifo_open(void);

--
1.8.2.2


2013-05-09 04:16:46

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 16/26] iap: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate.
---
profiles/iap/main.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/profiles/iap/main.c b/profiles/iap/main.c
index 0e8f43f..08dcce3 100644
--- a/profiles/iap/main.c
+++ b/profiles/iap/main.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
@@ -102,7 +103,7 @@

static GMainLoop *main_loop;

-static guint iap_source = 0;
+static unsigned int iap_source = 0;

static gboolean iap_handler(GIOChannel *channel, GIOCondition condition,
gpointer user_data)
@@ -127,10 +128,10 @@ static gboolean iap_handler(GIOChannel *channel, GIOCondition condition,
return TRUE;
}

-static guint create_source(int fd, GIOFunc func)
+static unsigned int create_source(int fd, GIOFunc func)
{
GIOChannel *channel;
- guint source;
+ unsigned int source;

channel = g_io_channel_unix_new(fd);

@@ -370,10 +371,10 @@ static gboolean signal_handler(GIOChannel *channel, GIOCondition condition,
return TRUE;
}

-static guint setup_signalfd(void)
+static unsigned int setup_signalfd(void)
{
GIOChannel *channel;
- guint source;
+ unsigned int source;
sigset_t mask;
int fd;

@@ -421,7 +422,7 @@ int main(int argc, char *argv[])
GError *error = NULL;
DBusConnection *dbus_conn;
GDBusClient *client;
- guint signal;
+ unsigned int signal;

context = g_option_context_new(NULL);
g_option_context_add_main_entries(context, options, NULL);
--
1.8.2.2


2013-05-09 04:16:45

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 15/26] heartrate: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate.
---
profiles/heartrate/heartrate.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/profiles/heartrate/heartrate.c b/profiles/heartrate/heartrate.c
index 8de81bb..25077ad 100644
--- a/profiles/heartrate/heartrate.c
+++ b/profiles/heartrate/heartrate.c
@@ -24,6 +24,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <errno.h>
#include <stdbool.h>
#include <glib.h>
@@ -63,8 +64,8 @@ struct heartrate {
struct btd_device *dev;
struct heartrate_adapter *hradapter;
GAttrib *attrib;
- guint attioid;
- guint attionotid;
+ unsigned int attioid;
+ unsigned int attionotid;

struct att_range *svc_range; /* primary svc range */

@@ -77,7 +78,7 @@ struct heartrate {

struct watcher {
struct heartrate_adapter *hradapter;
- guint id;
+ unsigned int id;
char *srv;
char *path;
};
@@ -222,8 +223,8 @@ static void destroy_heartrate_adapter(gpointer user_data)
g_free(hradapter);
}

-static void read_sensor_location_cb(guint8 status, const guint8 *pdu,
- guint16 len, gpointer user_data)
+static void read_sensor_location_cb(uint8_t status, const uint8_t *pdu,
+ uint16_t len, gpointer user_data)
{
struct heartrate *hr = user_data;
uint8_t value;
@@ -250,7 +251,7 @@ static void read_sensor_location_cb(guint8 status, const guint8 *pdu,
hr->location = value;
}

-static void char_write_cb(guint8 status, const guint8 *pdu, guint16 len,
+static void char_write_cb(uint8_t status, const uint8_t *pdu, uint16_t len,
gpointer user_data)
{
char *msg = user_data;
@@ -390,8 +391,8 @@ static void notify_handler(const uint8_t *pdu, uint16_t len, gpointer user_data)
process_measurement(hr, pdu + 3, len - 3);
}

-static void discover_ccc_cb(guint8 status, const guint8 *pdu,
- guint16 len, gpointer user_data)
+static void discover_ccc_cb(uint8_t status, const uint8_t *pdu,
+ uint16_t len, gpointer user_data)
{
struct heartrate *hr = user_data;
struct att_data_list *list;
@@ -464,7 +465,7 @@ static void discover_measurement_ccc(struct heartrate *hr,
gatt_find_info(hr->attrib, start, end, discover_ccc_cb, hr);
}

-static void discover_char_cb(GSList *chars, guint8 status, gpointer user_data)
+static void discover_char_cb(GSList *chars, uint8_t status, gpointer user_data)
{
struct heartrate *hr = user_data;

--
1.8.2.2


2013-05-09 04:16:44

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 14/26] gatt: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate.
---
profiles/gatt/gas.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/profiles/gatt/gas.c b/profiles/gatt/gas.c
index 2ed837f..ca261c7 100644
--- a/profiles/gatt/gas.c
+++ b/profiles/gatt/gas.c
@@ -24,6 +24,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdbool.h>
#include <stdlib.h>
#include <sys/types.h>
@@ -53,8 +54,8 @@ struct gas {
struct att_range gap; /* GAP Primary service range */
struct att_range gatt; /* GATT Primary service range */
GAttrib *attrib;
- guint attioid;
- guint changed_ind;
+ unsigned int attioid;
+ unsigned int changed_ind;
uint16_t changed_handle;
uint16_t mtu;
};
@@ -141,7 +142,7 @@ static int read_ctp_handle(struct btd_device *device, uint16_t uuid,
return err;
}

-static void gap_appearance_cb(guint8 status, const guint8 *pdu, guint16 plen,
+static void gap_appearance_cb(uint8_t status, const uint8_t *pdu, uint16_t plen,
gpointer user_data)
{
struct gas *gas = user_data;
@@ -205,7 +206,7 @@ static void indication_cb(const uint8_t *pdu, uint16_t len, gpointer user_data)
btd_device_gatt_set_service_changed(gas->device, start, end);
}

-static void ccc_written_cb(guint8 status, const guint8 *pdu, guint16 plen,
+static void ccc_written_cb(uint8_t status, const uint8_t *pdu, uint16_t plen,
gpointer user_data)
{
struct gas *gas = user_data;
@@ -235,8 +236,8 @@ static void write_ccc(GAttrib *attrib, uint16_t handle, gpointer user_data)
user_data);
}

-static void gatt_descriptors_cb(guint8 status, const guint8 *pdu, guint16 len,
- gpointer user_data)
+static void gatt_descriptors_cb(uint8_t status, const uint8_t *pdu,
+ uint16_t len, gpointer user_data)
{
struct gas *gas = user_data;
struct att_data_list *list;
@@ -271,7 +272,7 @@ done:
att_data_list_free(list);
}

-static void gatt_characteristic_cb(GSList *characteristics, guint8 status,
+static void gatt_characteristic_cb(GSList *characteristics, uint8_t status,
gpointer user_data)
{
struct gas *gas = user_data;
@@ -297,7 +298,7 @@ static void gatt_characteristic_cb(GSList *characteristics, guint8 status,
gatt_find_info(gas->attrib, start, end, gatt_descriptors_cb, gas);
}

-static void exchange_mtu_cb(guint8 status, const guint8 *pdu, guint16 plen,
+static void exchange_mtu_cb(uint8_t status, const uint8_t *pdu, uint16_t plen,
gpointer user_data)
{
struct gas *gas = user_data;
--
1.8.2.2


2013-05-09 04:16:43

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 13/26] health: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate.
---
profiles/health/hdp.c | 6 +++---
profiles/health/hdp_types.h | 4 +++-
profiles/health/hdp_util.c | 10 +++++-----
profiles/health/mcap_internal.h | 8 +++++---
profiles/health/mcap_sync.c | 14 +++++++-------
5 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/profiles/health/hdp.c b/profiles/health/hdp.c
index 7f24756..5e43682 100644
--- a/profiles/health/hdp.c
+++ b/profiles/health/hdp.c
@@ -24,8 +24,8 @@
#include "config.h"
#endif

+#include <inttypes.h>
#include <stdlib.h>
-#include <stdint.h>
#include <stdbool.h>
#include <sdpd.h>
#include <unistd.h>
@@ -66,14 +66,14 @@ struct hdp_create_dc {
struct hdp_device *dev;
uint8_t config;
uint8_t mdep;
- guint ref;
+ unsigned int ref;
mcap_mdl_operation_cb cb;
};

struct hdp_tmp_dc_data {
DBusMessage *msg;
struct hdp_channel *hdp_chann;
- guint ref;
+ unsigned int ref;
mcap_mdl_operation_cb cb;
};

diff --git a/profiles/health/hdp_types.h b/profiles/health/hdp_types.h
index b34b5e0..c730b11 100644
--- a/profiles/health/hdp_types.h
+++ b/profiles/health/hdp_types.h
@@ -23,6 +23,8 @@
#ifndef __HDP_TYPES_H__
#define __HDP_TYPES_H__

+#include <inttypes.h>
+
#define MANAGER_PATH "/org/bluez"

#define HEALTH_MANAGER "org.bluez.HealthManager1"
@@ -76,7 +78,7 @@ struct hdp_application {
char *description; /* Options description for SDP record */
uint8_t id; /* The identification is also the mdepid */
char *oname; /* Name of the owner application */
- guint dbus_watcher; /* Watch for clients disconnection */
+ unsigned int dbus_watcher; /* Watch for clients disconnection */
int ref; /* Reference counter */
};

diff --git a/profiles/health/hdp_util.c b/profiles/health/hdp_util.c
index b53f1db..355496e 100644
--- a/profiles/health/hdp_util.c
+++ b/profiles/health/hdp_util.c
@@ -24,7 +24,7 @@
#include <config.h>
#endif

-#include <stdint.h>
+#include <inttypes.h>
#include <stdbool.h>

#include <glib.h>
@@ -874,7 +874,7 @@ gboolean hdp_get_mdep(struct hdp_device *device, struct hdp_application *app,
return TRUE;
}

-static gboolean get_prot_desc_entry(sdp_data_t *entry, int type, guint16 *val)
+static gboolean get_prot_desc_entry(sdp_data_t *entry, int type, uint16_t *val)
{
sdp_data_t *iter;
int proto;
@@ -902,8 +902,8 @@ static gboolean get_prot_desc_entry(sdp_data_t *entry, int type, guint16 *val)
return TRUE;
}

-static gboolean hdp_get_prot_desc_list(const sdp_record_t *rec, guint16 *psm,
- guint16 *version)
+static gboolean hdp_get_prot_desc_list(const sdp_record_t *rec, uint16_t *psm,
+ uint16_t *version)
{
sdp_data_t *pdl, *p0, *p1;

@@ -926,7 +926,7 @@ static gboolean hdp_get_prot_desc_list(const sdp_record_t *rec, guint16 *psm,
}

static gboolean hdp_get_add_prot_desc_list(const sdp_record_t *rec,
- guint16 *psm)
+ uint16_t *psm)
{
sdp_data_t *pdl, *p0, *p1;

diff --git a/profiles/health/mcap_internal.h b/profiles/health/mcap_internal.h
index 7191b23..016d40f 100644
--- a/profiles/health/mcap_internal.h
+++ b/profiles/health/mcap_internal.h
@@ -27,6 +27,8 @@
extern "C" {
#endif

+#include <inttypes.h>
+
typedef enum {
MCL_CONNECTED,
MCL_PENDING,
@@ -86,14 +88,14 @@ struct mcap_mcl {
struct mcap_instance *mi; /* MCAP instance where this MCL belongs */
bdaddr_t addr; /* Device address */
GIOChannel *cc; /* MCAP Control Channel IO */
- guint wid; /* MCL Watcher id */
+ unsigned int wid; /* MCL Watcher id */
GSList *mdls; /* List of Data Channels shorted by mdlid */
MCLState state; /* Current MCL State */
MCLRole role; /* Initiator or acceptor of this MCL */
MCAPCtrl req; /* Request control flag */
struct mcap_mdl_op_cb *priv_data; /* Temporal data to manage responses */
struct mcap_mdl_cb *cb; /* MDL callbacks */
- guint tid; /* Timer id for waiting for a response */
+ unsigned int tid; /* Timer id for waiting for a response */
uint8_t *lcmd; /* Last command sent */
int ref; /* References counter */
uint8_t ctrl; /* MCL control flag */
@@ -111,7 +113,7 @@ struct mcap_mcl {
struct mcap_mdl {
struct mcap_mcl *mcl; /* MCL where this MDL belongs */
GIOChannel *dc; /* MCAP Data Channel IO */
- guint wid; /* MDL Watcher id */
+ unsigned int wid; /* MDL Watcher id */
uint16_t mdlid; /* MDL id */
uint8_t mdep_id; /* MCAP Data End Point */
MDLState state; /* MDL state */
diff --git a/profiles/health/mcap_sync.c b/profiles/health/mcap_sync.c
index 0d9f17d..15d9d3f 100644
--- a/profiles/health/mcap_sync.c
+++ b/profiles/health/mcap_sync.c
@@ -25,7 +25,7 @@
#include <config.h>
#endif

-#include <stdint.h>
+#include <inttypes.h>
#include <netinet/in.h>
#include <time.h>
#include <stdlib.h>
@@ -51,13 +51,13 @@
struct mcap_csp {
uint64_t base_tmstamp; /* CSP base timestamp */
struct timespec base_time; /* CSP base time when timestamp set */
- guint local_caps; /* CSP-Master: have got remote caps */
- guint remote_caps; /* CSP-Slave: remote master got caps */
- guint rem_req_acc; /* CSP-Slave: accuracy required by master */
- guint ind_expected; /* CSP-Master: indication expected */
+ unsigned int local_caps; /* CSP-Master: have got remote caps */
+ unsigned int remote_caps; /* CSP-Slave: remote master got caps */
+ unsigned int rem_req_acc; /* CSP-Slave: accuracy required by master */
+ unsigned int ind_expected; /* CSP-Master: indication expected */
MCAPCtrl csp_req; /* CSP-Master: Request control flag */
- guint ind_timer; /* CSP-Slave: indication timer */
- guint set_timer; /* CSP-Slave: delayed set timer */
+ unsigned int ind_timer; /* CSP-Slave: indication timer */
+ unsigned int set_timer; /* CSP-Slave: delayed set timer */
void *set_data; /* CSP-Slave: delayed set data */
void *csp_priv_data; /* CSP-Master: In-flight request data */
};
--
1.8.2.2


2013-05-09 04:16:42

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 12/26] deviceinfo: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate.
---
profiles/deviceinfo/deviceinfo.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/profiles/deviceinfo/deviceinfo.c b/profiles/deviceinfo/deviceinfo.c
index e8cb5f7..39e4846 100644
--- a/profiles/deviceinfo/deviceinfo.c
+++ b/profiles/deviceinfo/deviceinfo.c
@@ -24,6 +24,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdbool.h>
#include <errno.h>

@@ -46,7 +47,7 @@
struct deviceinfo {
struct btd_device *dev; /* Device reference */
GAttrib *attrib; /* GATT connection */
- guint attioid; /* Att watcher id */
+ unsigned int attioid; /* Att watcher id */
struct att_range *svc_range; /* DeviceInfo range */
GSList *chars; /* Characteristics */
};
@@ -86,7 +87,7 @@ static int cmp_device(gconstpointer a, gconstpointer b)
return -1;
}

-static void read_pnpid_cb(guint8 status, const guint8 *pdu, guint16 len,
+static void read_pnpid_cb(uint8_t status, const uint8_t *pdu, uint16_t len,
gpointer user_data)
{
struct characteristic *ch = user_data;
@@ -120,7 +121,7 @@ static void process_deviceinfo_char(struct characteristic *ch)
read_pnpid_cb, ch);
}

-static void configure_deviceinfo_cb(GSList *characteristics, guint8 status,
+static void configure_deviceinfo_cb(GSList *characteristics, uint8_t status,
gpointer user_data)
{
struct deviceinfo *d = user_data;
--
1.8.2.2


2013-05-09 04:16:41

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 11/26] cyclingspeed: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate.
---
profiles/cyclingspeed/cyclingspeed.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/profiles/cyclingspeed/cyclingspeed.c b/profiles/cyclingspeed/cyclingspeed.c
index 76be234..6f0bd58 100644
--- a/profiles/cyclingspeed/cyclingspeed.c
+++ b/profiles/cyclingspeed/cyclingspeed.c
@@ -24,6 +24,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <errno.h>
#include <stdbool.h>
#include <glib.h>
@@ -75,7 +76,7 @@ struct csc;
struct controlpoint_req {
struct csc *csc;
uint8_t opcode;
- guint timeout;
+ unsigned int timeout;
GDBusPendingReply reply_id;
DBusMessage *msg;

@@ -93,11 +94,11 @@ struct csc {
struct csc_adapter *cadapter;

GAttrib *attrib;
- guint attioid;
+ unsigned int attioid;
/* attio id for measurement characteristics value notifications */
- guint attio_measurement_id;
+ unsigned int attio_measurement_id;
/* attio id for SC Control Point characteristics value indications */
- guint attio_controlpoint_id;
+ unsigned int attio_controlpoint_id;

struct att_range *svc_range;

@@ -115,7 +116,7 @@ struct csc {

struct watcher {
struct csc_adapter *cadapter;
- guint id;
+ unsigned int id;
char *srv;
char *path;
};
@@ -274,7 +275,7 @@ static void destroy_csc(gpointer user_data)
g_free(csc);
}

-static void char_write_cb(guint8 status, const guint8 *pdu, guint16 len,
+static void char_write_cb(uint8_t status, const uint8_t *pdu, uint16_t len,
gpointer user_data)
{
char *msg = user_data;
@@ -310,8 +311,8 @@ static gboolean controlpoint_timeout(gpointer user_data)
return FALSE;
}

-static void controlpoint_write_cb(guint8 status, const guint8 *pdu, guint16 len,
- gpointer user_data)
+static void controlpoint_write_cb(uint8_t status, const uint8_t *pdu,
+ uint16_t len, gpointer user_data)
{
struct controlpoint_req *req = user_data;

@@ -357,7 +358,7 @@ static void read_supported_locations(struct csc *csc)
controlpoint_write_cb, req);
}

-static void read_feature_cb(guint8 status, const guint8 *pdu, guint16 len,
+static void read_feature_cb(uint8_t status, const uint8_t *pdu, uint16_t len,
gpointer user_data)
{
struct csc *csc = user_data;
@@ -387,8 +388,8 @@ static void read_feature_cb(guint8 status, const guint8 *pdu, guint16 len,
read_supported_locations(csc);
}

-static void read_location_cb(guint8 status, const guint8 *pdu,
- guint16 len, gpointer user_data)
+static void read_location_cb(uint8_t status, const uint8_t *pdu,
+ uint16_t len, gpointer user_data)
{
struct csc *csc = user_data;
uint8_t value;
@@ -418,8 +419,8 @@ static void read_location_cb(guint8 status, const guint8 *pdu,
CYCLINGSPEED_INTERFACE, "Location");
}

-static void discover_desc_cb(guint8 status, const guint8 *pdu,
- guint16 len, gpointer user_data)
+static void discover_desc_cb(uint8_t status, const uint8_t *pdu,
+ uint16_t len, gpointer user_data)
{
struct characteristic *ch = user_data;
struct att_data_list *list = NULL;
@@ -759,7 +760,7 @@ done:
g_attrib_send(csc->attrib, 0, opdu, olen, NULL, NULL, NULL);
}

-static void discover_char_cb(GSList *chars, guint8 status, gpointer user_data)
+static void discover_char_cb(GSList *chars, uint8_t status, gpointer user_data)
{
struct csc *csc = user_data;
uint16_t feature_val_handle = 0;
--
1.8.2.2


2013-05-09 04:16:39

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 09/26] audio: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate and prefer this one
over stdint.h.
---
profiles/audio/a2dp.c | 5 +++--
profiles/audio/avctp.c | 12 ++++++------
profiles/audio/avdtp.c | 24 ++++++++++++------------
profiles/audio/avrcp.c | 2 +-
profiles/audio/control.c | 2 +-
profiles/audio/device.c | 5 +++--
profiles/audio/manager.c | 2 +-
profiles/audio/media.c | 12 ++++++------
profiles/audio/player.c | 3 +--
profiles/audio/sink.c | 4 ++--
profiles/audio/source.c | 4 ++--
profiles/audio/transport.c | 34 ++++++++++++++++++----------------
12 files changed, 56 insertions(+), 53 deletions(-)

diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 215f4db..14e7686 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -27,6 +27,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdlib.h>
#include <errno.h>

@@ -62,7 +63,7 @@ struct a2dp_sep {
struct avdtp_local_sep *lsep;
struct avdtp *session;
struct avdtp_stream *stream;
- guint suspend_timer;
+ unsigned int suspend_timer;
gboolean delay_reporting;
gboolean locked;
gboolean suspending;
@@ -77,7 +78,7 @@ struct a2dp_setup_cb {
a2dp_config_cb_t config_cb;
a2dp_stream_cb_t resume_cb;
a2dp_stream_cb_t suspend_cb;
- guint source_id;
+ unsigned int source_id;
void *user_data;
unsigned int id;
};
diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c
index 21aeb6f..6260098 100644
--- a/profiles/audio/avctp.c
+++ b/profiles/audio/avctp.c
@@ -27,8 +27,8 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdlib.h>
-#include <stdint.h>
#include <stdbool.h>
#include <errno.h>
#include <unistd.h>
@@ -149,7 +149,7 @@ typedef int (*avctp_process_cb) (void *data);
struct avctp_pending_req {
struct avctp_channel *chan;
uint8_t transaction;
- guint timeout;
+ unsigned int timeout;
avctp_process_cb process;
void *data;
GDestroyNotify destroy;
@@ -159,7 +159,7 @@ struct avctp_channel {
struct avctp *session;
GIOChannel *io;
uint8_t transaction;
- guint watch;
+ unsigned int watch;
uint16_t imtu;
uint16_t omtu;
uint8_t *buffer;
@@ -167,13 +167,13 @@ struct avctp_channel {
struct avctp_pending_req *p;
GQueue *queue;
GSList *processed;
- guint process_id;
+ unsigned int process_id;
GDestroyNotify destroy;
};

struct key_pressed {
uint8_t op;
- guint timer;
+ unsigned int timer;
};

struct avctp {
@@ -184,7 +184,7 @@ struct avctp {

int uinput;

- guint auth_id;
+ unsigned int auth_id;
unsigned int passthrough_id;
unsigned int unit_id;
unsigned int subunit_id;
diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index bd73572..9e5a9a5 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -26,9 +26,9 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
-#include <stdint.h>
#include <stdbool.h>
#include <errno.h>
#include <unistd.h>
@@ -314,7 +314,7 @@ struct pending_req {
void *data;
size_t data_size;
struct avdtp_stream *stream; /* Set if the request targeted a stream */
- guint timeout;
+ unsigned int timeout;
gboolean collided;
};

@@ -370,13 +370,13 @@ struct avdtp_stream {
GSList *caps;
GSList *callbacks;
struct avdtp_service_capability *codec;
- guint io_id; /* Transport GSource ID */
- guint timer; /* Waiting for other side to close or open
- * the transport channel */
- gboolean open_acp; /* If we are in ACT role for Open */
- gboolean close_int; /* If we are in INT role for Close */
- gboolean abort_int; /* If we are in INT role for Abort */
- guint start_timer; /* Wait START command timer */
+ unsigned int io_id; /* Transport GSource ID */
+ unsigned int timer; /* Waiting for other side to close or
+ * open the transport channel */
+ gboolean open_acp; /* If we are in ACT role for Open */
+ gboolean close_int; /* If we are in INT role for Close */
+ gboolean abort_int; /* If we are in INT role for Abort */
+ unsigned int start_timer; /* Wait START command timer */
gboolean delay_reporting;
uint16_t delay; /* AVDTP 1.3 Delay Reporting feature */
gboolean starting; /* only valid while sep state == OPEN */
@@ -397,10 +397,10 @@ struct avdtp {
/* True if the entire device is being disconnected */
gboolean device_disconnect;

- guint auth_id;
+ unsigned int auth_id;

GIOChannel *io;
- guint io_id;
+ unsigned int io_id;

GSList *seps; /* Elements of type struct avdtp_remote_sep * */

@@ -423,7 +423,7 @@ struct avdtp {

struct pending_req *req;

- guint dc_timer;
+ unsigned int dc_timer;

/* Attempt stream setup instead of disconnecting */
gboolean stream_setup;
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index b7de051..69cf8c4 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -28,7 +28,7 @@
#endif

#include <stdlib.h>
-#include <stdint.h>
+#include <inttypes.h>
#include <stdbool.h>
#include <errno.h>
#include <unistd.h>
diff --git a/profiles/audio/control.c b/profiles/audio/control.c
index cdba385..64d85f5 100644
--- a/profiles/audio/control.c
+++ b/profiles/audio/control.c
@@ -28,7 +28,7 @@
#endif

#include <stdlib.h>
-#include <stdint.h>
+#include <inttypes.h>
#include <errno.h>
#include <unistd.h>
#include <assert.h>
diff --git a/profiles/audio/device.c b/profiles/audio/device.c
index 3fa49ad..216aa37 100644
--- a/profiles/audio/device.c
+++ b/profiles/audio/device.c
@@ -26,6 +26,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
@@ -64,8 +65,8 @@ struct dev_priv {
sink_state_t sink_state;
avctp_state_t avctp_state;

- guint control_timer;
- guint dc_id;
+ unsigned int control_timer;
+ unsigned int dc_id;

gboolean disconnecting;

diff --git a/profiles/audio/manager.c b/profiles/audio/manager.c
index 15226e4..60c68fd 100644
--- a/profiles/audio/manager.c
+++ b/profiles/audio/manager.c
@@ -32,7 +32,7 @@
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
-#include <stdint.h>
+#include <inttypes.h>
#include <stdbool.h>
#include <sys/stat.h>
#include <dirent.h>
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index cab79b5..c8cdf93 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -79,9 +79,9 @@ struct media_endpoint {
uint8_t codec; /* Endpoint codec */
uint8_t *capabilities; /* Endpoint property capabilities */
size_t size; /* Endpoint capabilities size */
- guint hs_watch;
- guint ag_watch;
- guint watch;
+ unsigned int hs_watch;
+ unsigned int ag_watch;
+ unsigned int watch;
GSList *requests;
struct media_adapter *adapter;
GSList *transports;
@@ -94,9 +94,9 @@ struct media_player {
char *path; /* Player object path */
GHashTable *settings; /* Player settings */
GHashTable *track; /* Player current track */
- guint watch;
- guint properties_watch;
- guint track_watch;
+ unsigned int watch;
+ unsigned int properties_watch;
+ unsigned int track_watch;
char *status;
uint32_t position;
uint32_t duration;
diff --git a/profiles/audio/player.c b/profiles/audio/player.c
index e08e373..40d21ec 100644
--- a/profiles/audio/player.c
+++ b/profiles/audio/player.c
@@ -27,7 +27,6 @@
#endif

#include <stdlib.h>
-#include <stdint.h>
#include <inttypes.h>
#include <stdbool.h>
#include <errno.h>
@@ -87,7 +86,7 @@ struct media_player {
char *status;
uint32_t position;
GTimer *progress;
- guint process_id;
+ unsigned int process_id;
struct player_callback *cb;
GSList *pending;
GSList *folders;
diff --git a/profiles/audio/sink.c b/profiles/audio/sink.c
index 3969417..ce700ce 100644
--- a/profiles/audio/sink.c
+++ b/profiles/audio/sink.c
@@ -26,7 +26,7 @@
#include <config.h>
#endif

-#include <stdint.h>
+#include <inttypes.h>
#include <stdbool.h>
#include <errno.h>

@@ -60,7 +60,7 @@ struct sink {
struct avdtp *session;
struct avdtp_stream *stream;
unsigned int cb_id;
- guint retry_id;
+ unsigned int retry_id;
avdtp_session_state_t session_state;
avdtp_state_t stream_state;
sink_state_t state;
diff --git a/profiles/audio/source.c b/profiles/audio/source.c
index 226c372..24cadf4 100644
--- a/profiles/audio/source.c
+++ b/profiles/audio/source.c
@@ -27,7 +27,7 @@
#include <config.h>
#endif

-#include <stdint.h>
+#include <inttypes.h>
#include <stdbool.h>
#include <errno.h>

@@ -61,7 +61,7 @@ struct source {
struct avdtp *session;
struct avdtp_stream *stream;
unsigned int cb_id;
- guint retry_id;
+ unsigned int retry_id;
avdtp_session_state_t session_state;
avdtp_state_t stream_state;
source_state_t state;
diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index f585c3a..84a961e 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -26,6 +26,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <errno.h>

#include <glib.h>
@@ -67,14 +68,14 @@ static char *str_state[] = {

struct media_request {
DBusMessage *msg;
- guint id;
+ unsigned int id;
};

struct media_owner {
struct media_transport *transport;
struct media_request *pending;
char *name;
- guint watch;
+ unsigned int watch;
};

struct a2dp_transport {
@@ -94,15 +95,15 @@ struct media_transport {
uint16_t imtu; /* Transport input mtu */
uint16_t omtu; /* Transport output mtu */
transport_state_t state;
- guint hs_watch;
- guint source_watch;
- guint sink_watch;
- guint (*resume) (struct media_transport *transport,
+ unsigned int hs_watch;
+ unsigned int source_watch;
+ unsigned int sink_watch;
+ unsigned int (*resume) (struct media_transport *transport,
struct media_owner *owner);
- guint (*suspend) (struct media_transport *transport,
+ unsigned int (*suspend) (struct media_transport *transport,
struct media_owner *owner);
void (*cancel) (struct media_transport *transport,
- guint id);
+ unsigned int id);
GDestroyNotify destroy;
void *data;
};
@@ -180,7 +181,8 @@ void media_transport_destroy(struct media_transport *transport)
g_free(path);
}

-static struct media_request *media_request_create(DBusMessage *msg, guint id)
+static struct media_request *media_request_create(DBusMessage *msg,
+ unsigned int id)
{
struct media_request *req;

@@ -323,13 +325,13 @@ fail:
media_transport_remove_owner(transport);
}

-static guint resume_a2dp(struct media_transport *transport,
+static unsigned int resume_a2dp(struct media_transport *transport,
struct media_owner *owner)
{
struct a2dp_transport *a2dp = transport->data;
struct media_endpoint *endpoint = transport->endpoint;
struct a2dp_sep *sep = media_endpoint_get_sep(endpoint);
- guint id;
+ unsigned int id;

if (a2dp->session == NULL) {
a2dp->session = avdtp_get(transport->device);
@@ -377,7 +379,7 @@ static void a2dp_suspend_complete(struct avdtp *session,
media_transport_remove_owner(transport);
}

-static guint suspend_a2dp(struct media_transport *transport,
+static unsigned int suspend_a2dp(struct media_transport *transport,
struct media_owner *owner)
{
struct a2dp_transport *a2dp = transport->data;
@@ -394,7 +396,7 @@ static guint suspend_a2dp(struct media_transport *transport,
return 0;
}

-static void cancel_a2dp(struct media_transport *transport, guint id)
+static void cancel_a2dp(struct media_transport *transport, unsigned int id)
{
a2dp_cancel(transport->device, id);
}
@@ -449,7 +451,7 @@ static DBusMessage *acquire(DBusConnection *conn, DBusMessage *msg,
struct media_transport *transport = data;
struct media_owner *owner;
struct media_request *req;
- guint id;
+ unsigned int id;

if (transport->owner != NULL)
return btd_error_not_authorized(msg);
@@ -477,7 +479,7 @@ static DBusMessage *try_acquire(DBusConnection *conn, DBusMessage *msg,
struct media_transport *transport = data;
struct media_owner *owner;
struct media_request *req;
- guint id;
+ unsigned int id;

if (transport->owner != NULL)
return btd_error_not_authorized(msg);
@@ -509,7 +511,7 @@ static DBusMessage *release(DBusConnection *conn, DBusMessage *msg,
struct media_owner *owner = transport->owner;
const char *sender;
struct media_request *req;
- guint id;
+ unsigned int id;

sender = dbus_message_get_sender(msg);

--
1.8.2.2


2013-05-09 04:16:40

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 10/26] cups: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate.
---
profiles/cups/main.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/profiles/cups/main.c b/profiles/cups/main.c
index 2079812..ba3b029 100644
--- a/profiles/cups/main.c
+++ b/profiles/cups/main.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
@@ -158,7 +159,7 @@ static char *device_get_ieee1284_id(const char *adapter, const char *device)
/* Hopefully we only get one handle, or take a punt */
while (dbus_message_iter_get_arg_type(&reply_iter_entry) ==
DBUS_TYPE_DICT_ENTRY) {
- guint32 key;
+ uint32_t key;
DBusMessageIter dict_entry;

dbus_message_iter_recurse(&reply_iter_entry, &dict_entry);
@@ -245,7 +246,7 @@ static void add_device_to_list(const char *name, const char *bdaddr,
static gboolean parse_device_properties(DBusMessageIter *reply_iter,
char **name, char **bdaddr)
{
- guint32 class = 0;
+ uint32_t class = 0;
DBusMessageIter reply_iter_entry;

if (dbus_message_iter_get_arg_type(reply_iter) != DBUS_TYPE_ARRAY)
--
1.8.2.2


2013-05-09 04:16:38

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 08/26] alert: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate.
---
profiles/alert/server.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/profiles/alert/server.c b/profiles/alert/server.c
index 58c8b03..efbb202 100644
--- a/profiles/alert/server.c
+++ b/profiles/alert/server.c
@@ -26,6 +26,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdbool.h>
#include <errno.h>
#include <gdbus/gdbus.h>
@@ -104,7 +105,7 @@ struct alert_data {
const char *category;
char *srv;
char *path;
- guint watcher;
+ unsigned int watcher;
};

struct alert_adapter {
@@ -125,7 +126,7 @@ struct notify_data {
struct notify_callback {
struct notify_data *notify_data;
struct btd_device *device;
- guint id;
+ unsigned int id;
};

static GSList *registered_alerts = NULL;
--
1.8.2.2


2013-05-09 04:16:37

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 07/26] plugins: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate.
---
plugins/neard.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugins/neard.c b/plugins/neard.c
index e4a4d71..645202d 100644
--- a/plugins/neard.c
+++ b/plugins/neard.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <errno.h>
#include <gdbus/gdbus.h>

@@ -49,7 +50,7 @@
#define AGENT_CARRIER_TYPE "bluetooth"
#define ERROR_INTERFACE "org.neard.HandoverAgent.Error"

-static guint watcher_id = 0;
+static unsigned int watcher_id = 0;
static char *neard_service = NULL;
static bool agent_register_postpone = false;

--
1.8.2.2


2013-05-09 04:16:36

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 06/26] obexd: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate.
---
obexd/client/bluetooth.c | 15 ++++++++-------
obexd/client/ftp.c | 3 ++-
obexd/client/map.c | 21 +++++++++++----------
obexd/client/pbap.c | 25 +++++++++++++------------
obexd/client/session.c | 31 ++++++++++++++++---------------
obexd/client/session.h | 15 ++++++++-------
obexd/client/transfer.c | 16 ++++++++--------
obexd/client/transfer.h | 2 +-
obexd/client/transport.h | 8 +++++---
obexd/plugins/irmc.c | 2 +-
obexd/plugins/phonebook-dummy.c | 7 ++++---
obexd/src/main.c | 7 ++++---
obexd/src/obex-priv.h | 4 +++-
obexd/src/obex.c | 18 +++++++++---------
14 files changed, 93 insertions(+), 81 deletions(-)

diff --git a/obexd/client/bluetooth.c b/obexd/client/bluetooth.c
index 1f407d1..6e6e3ec 100644
--- a/obexd/client/bluetooth.c
+++ b/obexd/client/bluetooth.c
@@ -47,7 +47,7 @@
#define OBC_BT_ERROR obc_bt_error_quark()

struct bluetooth_session {
- guint id;
+ unsigned int id;
bdaddr_t src;
bdaddr_t dst;
uint16_t port;
@@ -385,12 +385,13 @@ static int session_connect(struct bluetooth_session *session)
return err;
}

-static guint bluetooth_connect(const char *source, const char *destination,
- const char *service, uint16_t port,
- obc_transport_func func, void *user_data)
+static unsigned int bluetooth_connect(const char *source,
+ const char *destination, const char *service,
+ uint16_t port, obc_transport_func func,
+ void *user_data)
{
struct bluetooth_session *session;
- static guint id = 0;
+ static unsigned int id = 0;

DBG("src %s dest %s service %s port %u",
source, destination, service, port);
@@ -421,7 +422,7 @@ static guint bluetooth_connect(const char *source, const char *destination,
return session->id;
}

-static void bluetooth_disconnect(guint id)
+static void bluetooth_disconnect(unsigned int id)
{
GSList *l;

@@ -467,7 +468,7 @@ static int bluetooth_getpacketopt(GIOChannel *io, int *tx_mtu, int *rx_mtu)
return 0;
}

-static const void *bluetooth_getattribute(guint id, int attribute_id)
+static const void *bluetooth_getattribute(unsigned int id, int attribute_id)
{
GSList *l;
sdp_data_t *data;
diff --git a/obexd/client/ftp.c b/obexd/client/ftp.c
index fa85708..af39653 100644
--- a/obexd/client/ftp.c
+++ b/obexd/client/ftp.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <errno.h>
#include <string.h>

@@ -124,7 +125,7 @@ static void xml_element(GMarkupParseContext *ctxt,
for (key = (char *) names[i]; key; key = (char *) names[++i]) {
key[0] = g_ascii_toupper(key[0]);
if (g_str_equal("Size", key) == TRUE) {
- guint64 size;
+ uint64_t size;
size = g_ascii_strtoll(values[i], NULL, 10);
obex_dbus_dict_append(&dict, key, DBUS_TYPE_UINT64,
&size);
diff --git a/obexd/client/map.c b/obexd/client/map.c
index 0285286..ae65bb3 100644
--- a/obexd/client/map.c
+++ b/obexd/client/map.c
@@ -24,6 +24,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
@@ -291,7 +292,7 @@ fail:

static GObexApparam *parse_offset(GObexApparam *apparam, DBusMessageIter *iter)
{
- guint16 num;
+ uint16_t num;

if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_UINT16)
return NULL;
@@ -304,7 +305,7 @@ static GObexApparam *parse_offset(GObexApparam *apparam, DBusMessageIter *iter)
static GObexApparam *parse_max_count(GObexApparam *apparam,
DBusMessageIter *iter)
{
- guint16 num;
+ uint16_t num;

if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_UINT16)
return NULL;
@@ -1123,7 +1124,7 @@ fail:
static GObexApparam *parse_subject_length(GObexApparam *apparam,
DBusMessageIter *iter)
{
- guint8 num;
+ uint8_t num;

if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_BYTE)
return NULL;
@@ -1150,9 +1151,9 @@ static uint64_t get_filter_mask(const char *filterstr)
return 0;
}

-static int set_field(guint32 *filter, const char *filterstr)
+static int set_field(uint32_t *filter, const char *filterstr)
{
- guint64 mask;
+ uint64_t mask;

mask = get_filter_mask(filterstr);

@@ -1166,7 +1167,7 @@ static int set_field(guint32 *filter, const char *filterstr)
static GObexApparam *parse_fields(GObexApparam *apparam, DBusMessageIter *iter)
{
DBusMessageIter array;
- guint32 filter = 0;
+ uint32_t filter = 0;

if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
return NULL;
@@ -1192,7 +1193,7 @@ static GObexApparam *parse_filter_type(GObexApparam *apparam,
DBusMessageIter *iter)
{
DBusMessageIter array;
- guint8 types = 0;
+ uint8_t types = 0;

if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
return NULL;
@@ -1251,7 +1252,7 @@ static GObexApparam *parse_period_end(GObexApparam *apparam,
static GObexApparam *parse_filter_read(GObexApparam *apparam,
DBusMessageIter *iter)
{
- guint8 status = FILTER_READ_STATUS_NONE;
+ uint8_t status = FILTER_READ_STATUS_NONE;
dbus_bool_t dbus_status = FALSE;

if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_BOOLEAN)
@@ -1299,7 +1300,7 @@ static GObexApparam *parse_filter_sender(GObexApparam *apparam,
static GObexApparam *parse_filter_priority(GObexApparam *apparam,
DBusMessageIter *iter)
{
- guint8 priority = FILTER_PRIORITY_NONE;
+ uint8_t priority = FILTER_PRIORITY_NONE;
dbus_bool_t dbus_priority = FALSE;

if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_BOOLEAN)
@@ -1560,7 +1561,7 @@ static GObexApparam *parse_retry(GObexApparam *apparam, DBusMessageIter *iter)

static GObexApparam *parse_charset(GObexApparam *apparam, DBusMessageIter *iter)
{
- guint8 charset = 0;
+ uint8_t charset = 0;
const char *string;

if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
diff --git a/obexd/client/pbap.c b/obexd/client/pbap.c
index 2089860..5aa8da9 100644
--- a/obexd/client/pbap.c
+++ b/obexd/client/pbap.c
@@ -26,6 +26,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
@@ -247,7 +248,7 @@ static void pbap_setpath_cb(struct obc_session *session,
}

static void read_return_apparam(struct obc_transfer *transfer,
- guint16 *phone_book_size, guint8 *new_missed_calls)
+ uint16_t *phone_book_size, uint8_t *new_missed_calls)
{
GObexApparam *apparam;

@@ -270,8 +271,8 @@ static void phonebook_size_callback(struct obc_session *session,
{
struct pending_request *request = user_data;
DBusMessage *reply;
- guint16 phone_book_size;
- guint8 new_missed_calls;
+ uint16_t phone_book_size;
+ uint8_t new_missed_calls;

if (err) {
reply = g_dbus_create_error(request->msg,
@@ -342,7 +343,7 @@ send:
static GObexApparam *parse_format(GObexApparam *apparam, DBusMessageIter *iter)
{
const char *string;
- guint8 format;
+ uint8_t format;

if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
return NULL;
@@ -364,7 +365,7 @@ static GObexApparam *parse_format(GObexApparam *apparam, DBusMessageIter *iter)
static GObexApparam *parse_order(GObexApparam *apparam, DBusMessageIter *iter)
{
const char *string;
- guint8 order;
+ uint8_t order;

if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
return NULL;
@@ -387,7 +388,7 @@ static GObexApparam *parse_order(GObexApparam *apparam, DBusMessageIter *iter)

static GObexApparam *parse_offset(GObexApparam *apparam, DBusMessageIter *iter)
{
- guint16 num;
+ uint16_t num;

if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_UINT16)
return NULL;
@@ -400,7 +401,7 @@ static GObexApparam *parse_offset(GObexApparam *apparam, DBusMessageIter *iter)
static GObexApparam *parse_max_count(GObexApparam *apparam,
DBusMessageIter *iter)
{
- guint16 num;
+ uint16_t num;

if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_UINT16)
return NULL;
@@ -435,9 +436,9 @@ static uint64_t get_filter_mask(const char *filterstr)
return 0;
}

-static int set_field(guint64 *filter, const char *filterstr)
+static int set_field(uint64_t *filter, const char *filterstr)
{
- guint64 mask;
+ uint64_t mask;

mask = get_filter_mask(filterstr);

@@ -451,7 +452,7 @@ static int set_field(guint64 *filter, const char *filterstr)
static GObexApparam *parse_fields(GObexApparam *apparam, DBusMessageIter *iter)
{
DBusMessageIter array;
- guint64 filter = 0;
+ uint64_t filter = 0;

if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
return NULL;
@@ -517,7 +518,7 @@ static GObexApparam *parse_filters(GObexApparam *apparam,

static DBusMessage *pull_phonebook(struct pbap_data *pbap,
DBusMessage *message,
- guint8 type,
+ uint8_t type,
const char *targetfile,
GObexApparam *apparam)
{
@@ -790,7 +791,7 @@ static DBusMessage *pbap_list(DBusConnection *connection,

static GObexApparam *parse_attribute(GObexApparam *apparam, const char *field)
{
- guint8 attrib;
+ uint8_t attrib;

if (!field || g_str_equal(field, ""))
attrib = ATTRIB_NAME;
diff --git a/obexd/client/session.c b/obexd/client/session.c
index 0fbfe41..daa49db 100644
--- a/obexd/client/session.c
+++ b/obexd/client/session.c
@@ -26,6 +26,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
@@ -57,7 +58,7 @@ enum {
OBEX_IO_BUSY,
};

-static guint64 counter = 0;
+static uint64_t counter = 0;

struct callback_data {
struct obc_session *session;
@@ -66,8 +67,8 @@ struct callback_data {
};

struct pending_request {
- guint id;
- guint req_id;
+ unsigned int id;
+ unsigned int req_id;
struct obc_session *session;
struct obc_transfer *transfer;
session_callback_t func;
@@ -82,7 +83,7 @@ struct setpath_data {
};

struct obc_session {
- guint id;
+ unsigned int id;
int refcount;
char *source;
char *destination;
@@ -94,9 +95,9 @@ struct obc_session {
GObex *obex;
struct pending_request *p;
char *owner; /* Session owner */
- guint watch;
+ unsigned int watch;
GQueue *queue;
- guint queue_complete_id;
+ unsigned int queue_complete_id;
};

static GSList *sessions = NULL;
@@ -145,7 +146,7 @@ static struct pending_request *pending_request_new(struct obc_session *session,
void *data)
{
struct pending_request *p;
- static guint id = 0;
+ static unsigned int id = 0;

p = g_new0(struct pending_request, 1);
p->id = ++id;
@@ -656,7 +657,7 @@ static gboolean session_queue_complete(gpointer data)
return FALSE;
}

-guint obc_session_queue(struct obc_session *session,
+unsigned int obc_session_queue(struct obc_session *session,
struct obc_transfer *transfer,
session_callback_t func, void *user_data,
GError **err)
@@ -881,7 +882,7 @@ static void setpath_cb(GObex *obex, GError *err, GObexPacket *rsp,
struct pending_request *p = user_data;
struct setpath_data *data = p->data;
char *next;
- guint8 code;
+ uint8_t code;

p->req_id = 0;

@@ -918,7 +919,7 @@ static void setpath_cb(GObex *obex, GError *err, GObexPacket *rsp,
}
}

-guint obc_session_setpath(struct obc_session *session, const char *path,
+unsigned int obc_session_setpath(struct obc_session *session, const char *path,
session_callback_t func, void *user_data,
GError **err)
{
@@ -1000,7 +1001,7 @@ done:
session_process_queue(session);
}

-guint obc_session_mkdir(struct obc_session *session, const char *folder,
+unsigned int obc_session_mkdir(struct obc_session *session, const char *folder,
session_callback_t func, void *user_data,
GError **err)
{
@@ -1030,7 +1031,7 @@ guint obc_session_mkdir(struct obc_session *session, const char *folder,
return p->id;
}

-guint obc_session_copy(struct obc_session *session, const char *srcname,
+unsigned int obc_session_copy(struct obc_session *session, const char *srcname,
const char *destname, session_callback_t func,
void *user_data, GError **err)
{
@@ -1060,7 +1061,7 @@ guint obc_session_copy(struct obc_session *session, const char *srcname,
return p->id;
}

-guint obc_session_move(struct obc_session *session, const char *srcname,
+unsigned int obc_session_move(struct obc_session *session, const char *srcname,
const char *destname, session_callback_t func,
void *user_data, GError **err)
{
@@ -1090,7 +1091,7 @@ guint obc_session_move(struct obc_session *session, const char *srcname,
return p->id;
}

-guint obc_session_delete(struct obc_session *session, const char *file,
+unsigned int obc_session_delete(struct obc_session *session, const char *file,
session_callback_t func, void *user_data,
GError **err)
{
@@ -1119,7 +1120,7 @@ guint obc_session_delete(struct obc_session *session, const char *file,
return p->id;
}

-void obc_session_cancel(struct obc_session *session, guint id,
+void obc_session_cancel(struct obc_session *session, unsigned int id,
gboolean remove)
{
struct pending_request *p = session->p;
diff --git a/obexd/client/session.h b/obexd/client/session.h
index b0b3655..22a4987 100644
--- a/obexd/client/session.h
+++ b/obexd/client/session.h
@@ -22,6 +22,7 @@
*
*/

+#include <inttypes.h>
#include <stdint.h>
#include <glib.h>
#include <gdbus/gdbus.h>
@@ -57,24 +58,24 @@ const char *obc_session_register(struct obc_session *session,
const void *obc_session_get_attribute(struct obc_session *session,
int attribute_id);

-guint obc_session_queue(struct obc_session *session,
+unsigned int obc_session_queue(struct obc_session *session,
struct obc_transfer *transfer,
session_callback_t func, void *user_data,
GError **err);
-guint obc_session_setpath(struct obc_session *session, const char *path,
+unsigned int obc_session_setpath(struct obc_session *session, const char *path,
session_callback_t func, void *user_data,
GError **err);
-guint obc_session_mkdir(struct obc_session *session, const char *folder,
+unsigned int obc_session_mkdir(struct obc_session *session, const char *folder,
session_callback_t func, void *user_data,
GError **err);
-guint obc_session_copy(struct obc_session *session, const char *srcname,
+unsigned int obc_session_copy(struct obc_session *session, const char *srcname,
const char *destname, session_callback_t func,
void *user_data, GError **err);
-guint obc_session_move(struct obc_session *session, const char *srcname,
+unsigned int obc_session_move(struct obc_session *session, const char *srcname,
const char *destname, session_callback_t func,
void *user_data, GError **err);
-guint obc_session_delete(struct obc_session *session, const char *file,
+unsigned int obc_session_delete(struct obc_session *session, const char *file,
session_callback_t func, void *user_data,
GError **err);
-void obc_session_cancel(struct obc_session *session, guint id,
+void obc_session_cancel(struct obc_session *session, unsigned int id,
gboolean remove);
diff --git a/obexd/client/transfer.c b/obexd/client/transfer.c
index ac0909d..7ab3473 100644
--- a/obexd/client/transfer.c
+++ b/obexd/client/transfer.c
@@ -50,7 +50,7 @@

#define FIRST_PACKET_TIMEOUT 60

-static guint64 counter = 0;
+static uint64_t counter = 0;

struct transfer_callback {
transfer_callback_t func;
@@ -68,7 +68,7 @@ struct obc_transfer {
GObex *obex;
uint8_t status;
GObexApparam *apparam;
- guint8 op;
+ uint8_t op;
struct transfer_callback *callback;
DBusConnection *conn;
DBusMessage *msg;
@@ -79,11 +79,11 @@ struct obc_transfer {
char *name; /* Transfer object name */
char *type; /* Transfer object type */
int fd;
- guint xfer;
+ unsigned int xfer;
int64_t size;
int64_t transferred;
int64_t progress;
- guint progress_id;
+ unsigned int progress_id;
};

static GQuark obc_transfer_error_quark(void)
@@ -356,7 +356,7 @@ static void obc_transfer_free(struct obc_transfer *transfer)
g_free(transfer);
}

-static struct obc_transfer *obc_transfer_create(guint8 op,
+static struct obc_transfer *obc_transfer_create(uint8_t op,
const char *filename,
const char *name,
const char *type)
@@ -584,9 +584,9 @@ static void get_xfer_progress_first(GObex *obex, GError *err, GObexPacket *rsp,
GObexPacket *req;
GObexHeader *hdr;
GObexApparam *apparam;
- const guint8 *buf;
+ const uint8_t *buf;
gsize len;
- guint8 rspcode;
+ uint8_t rspcode;
gboolean final;

if (err != NULL) {
@@ -788,7 +788,7 @@ gboolean obc_transfer_start(struct obc_transfer *transfer, void *obex,
return FALSE;
}

-guint8 obc_transfer_get_operation(struct obc_transfer *transfer)
+uint8_t obc_transfer_get_operation(struct obc_transfer *transfer)
{
return transfer->op;
}
diff --git a/obexd/client/transfer.h b/obexd/client/transfer.h
index 474900b..fb9e6dc 100644
--- a/obexd/client/transfer.h
+++ b/obexd/client/transfer.h
@@ -53,7 +53,7 @@ gboolean obc_transfer_set_callback(struct obc_transfer *transfer,

gboolean obc_transfer_start(struct obc_transfer *transfer, void *obex,
GError **err);
-guint8 obc_transfer_get_operation(struct obc_transfer *transfer);
+uint8_t obc_transfer_get_operation(struct obc_transfer *transfer);

void obc_transfer_set_apparam(struct obc_transfer *transfer, void *data);
void *obc_transfer_get_apparam(struct obc_transfer *transfer);
diff --git a/obexd/client/transport.h b/obexd/client/transport.h
index b035cfc..becb0fe 100644
--- a/obexd/client/transport.h
+++ b/obexd/client/transport.h
@@ -21,17 +21,19 @@
*
*/

+#include <inttypes.h>
+
typedef void (*obc_transport_func)(GIOChannel *io, GError *err,
gpointer user_data);

struct obc_transport {
const char *name;
- guint (*connect) (const char *source, const char *destination,
+ unsigned int (*connect) (const char *source, const char *destination,
const char *service, uint16_t port,
obc_transport_func func, void *user_data);
int (*getpacketopt) (GIOChannel *io, int *tx_mtu, int *rx_mtu);
- void (*disconnect) (guint id);
- const void *(*getattribute) (guint id, int attribute_id);
+ void (*disconnect) (unsigned int id);
+ const void *(*getattribute) (unsigned int id, int attribute_id);
};

int obc_transport_register(struct obc_transport *transport);
diff --git a/obexd/plugins/irmc.c b/obexd/plugins/irmc.c
index d343977..6407de2 100644
--- a/obexd/plugins/irmc.c
+++ b/obexd/plugins/irmc.c
@@ -68,7 +68,7 @@ struct irmc_session {

#define IRMC_TARGET_SIZE 9

-static const guint8 IRMC_TARGET[IRMC_TARGET_SIZE] = {
+static const uint8_t IRMC_TARGET[IRMC_TARGET_SIZE] = {
0x49, 0x52, 0x4d, 0x43, 0x2d, 0x53, 0x59, 0x4e, 0x43 };

/* FIXME:
diff --git a/obexd/plugins/phonebook-dummy.c b/obexd/plugins/phonebook-dummy.c
index 6b9d040..aa9ba18 100644
--- a/obexd/plugins/phonebook-dummy.c
+++ b/obexd/plugins/phonebook-dummy.c
@@ -26,6 +26,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <dirent.h>
#include <errno.h>
#include <stdio.h>
@@ -52,7 +53,7 @@ struct dummy_data {
const struct apparam_field *apparams;
char *folder;
int fd;
- guint id;
+ unsigned int id;
};

struct cache_query {
@@ -520,7 +521,7 @@ void *phonebook_get_entry(const char *folder, const char *id,
struct dummy_data *dummy;
char *filename;
int fd;
- guint ret;
+ unsigned int ret;

filename = g_build_filename(root_folder, folder, id, NULL);

@@ -553,7 +554,7 @@ void *phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb,
struct cache_query *query;
char *foldername;
DIR *dp;
- guint ret;
+ unsigned int ret;

foldername = g_build_filename(root_folder, name, NULL);
dp = opendir(foldername);
diff --git a/obexd/src/main.c b/obexd/src/main.c
index 61a06b2..ae7c73c 100644
--- a/obexd/src/main.c
+++ b/obexd/src/main.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
@@ -91,10 +92,10 @@ static gboolean signal_handler(GIOChannel *channel, GIOCondition cond,
return TRUE;
}

-static guint setup_signalfd(void)
+static unsigned int setup_signalfd(void)
{
GIOChannel *channel;
- guint source;
+ unsigned int source;
sigset_t mask;
int fd;

@@ -244,7 +245,7 @@ int main(int argc, char *argv[])
{
GOptionContext *context;
GError *err = NULL;
- guint signal;
+ unsigned int signal;

#ifdef NEED_THREADS
if (g_thread_supported() == FALSE)
diff --git a/obexd/src/obex-priv.h b/obexd/src/obex-priv.h
index 41854bc..aba3564 100644
--- a/obexd/src/obex-priv.h
+++ b/obexd/src/obex-priv.h
@@ -22,6 +22,8 @@
*
*/

+#include <inttypes.h>
+
struct obex_session {
GIOChannel *io;
uint32_t id;
@@ -36,7 +38,7 @@ struct obex_session {
size_t apparam_len;
const void *nonhdr;
size_t nonhdr_len;
- guint get_rsp;
+ unsigned int get_rsp;
uint8_t *buf;
int64_t pending;
int64_t offset;
diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index a3e7b0e..ec91733 100644
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
@@ -352,7 +352,7 @@ static uint8_t *challenge_response(const uint8_t *nonce)
static void parse_service(struct obex_session *os, GObexPacket *req)
{
GObexHeader *hdr;
- const guint8 *target = NULL, *who = NULL;
+ const uint8_t *target = NULL, *who = NULL;
gsize target_size = 0, who_size = 0;

hdr = g_obex_packet_get_header(req, G_OBEX_HDR_WHO);
@@ -378,7 +378,7 @@ static void parse_authchal(struct obex_session *session, GObexPacket *req,
GObexPacket *rsp)
{
GObexHeader *hdr;
- const guint8 *data, *nonce = NULL;
+ const uint8_t *data, *nonce = NULL;
gsize len;
uint8_t challenge[18];
struct auth_header *auth = (struct auth_header *) challenge;
@@ -561,8 +561,8 @@ static int driver_get_headers(struct obex_session *os)
{
GObexPacket *rsp;
gssize len;
- guint8 data[255];
- guint8 id;
+ uint8_t data[255];
+ uint8_t id;
GObexHeader *hdr;

DBG("name=%s type=%s object=%p", os->name, os->type, os->object);
@@ -687,7 +687,7 @@ static gboolean recv_data(const void *buf, gsize size, gpointer user_data)
static void parse_type(struct obex_session *os, GObexPacket *req)
{
GObexHeader *hdr;
- const guint8 *type;
+ const uint8_t *type;
gsize len;

g_free(os->type);
@@ -737,7 +737,7 @@ static void parse_name(struct obex_session *os, GObexPacket *req)
static void parse_apparam(struct obex_session *os, GObexPacket *req)
{
GObexHeader *hdr;
- const guint8 *apparam;
+ const uint8_t *apparam;
gsize len;

hdr = g_obex_packet_get_header(req, G_OBEX_HDR_APPARAM);
@@ -876,7 +876,7 @@ int obex_put_stream_start(struct obex_session *os, const char *filename)
static void parse_length(struct obex_session *os, GObexPacket *req)
{
GObexHeader *hdr;
- guint32 size;
+ uint32_t size;

hdr = g_obex_packet_get_header(req, G_OBEX_HDR_LENGTH);
if (hdr == NULL)
@@ -892,7 +892,7 @@ static void parse_length(struct obex_session *os, GObexPacket *req)
static void parse_time(struct obex_session *os, GObexPacket *req)
{
GObexHeader *hdr;
- const guint8 *time;
+ const uint8_t *time;
gsize len;

hdr = g_obex_packet_get_header(req, G_OBEX_HDR_TIME);
@@ -1009,7 +1009,7 @@ static void parse_destname(struct obex_session *os, GObexPacket *req)
static void parse_action(struct obex_session *os, GObexPacket *req)
{
GObexHeader *hdr;
- guint8 id;
+ uint8_t id;

hdr = g_obex_packet_get_header(req, G_OBEX_HDR_ACTION);
if (hdr == NULL)
--
1.8.2.2


2013-05-09 04:16:35

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 05/26] attrib: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate and prefer this one over
stdint.h.
---
attrib/att.c | 2 +-
attrib/gatt.c | 124 ++++++++++++++++++++++++++-------------------------
attrib/gatt.h | 33 +++++++-------
attrib/gattrib.c | 51 ++++++++++-----------
attrib/gattrib.h | 21 +++++----
attrib/gatttool.c | 19 ++++----
attrib/interactive.c | 35 ++++++++-------
7 files changed, 148 insertions(+), 137 deletions(-)

diff --git a/attrib/att.c b/attrib/att.c
index d2b78bd..e196fa3 100644
--- a/attrib/att.c
+++ b/attrib/att.c
@@ -27,7 +27,7 @@
#endif

#include <errno.h>
-#include <stdint.h>
+#include <inttypes.h>
#include <stdlib.h>

#include <bluetooth/bluetooth.h>
diff --git a/attrib/gatt.c b/attrib/gatt.c
index 0f116e8..3dacf9e 100644
--- a/attrib/gatt.c
+++ b/attrib/gatt.c
@@ -26,7 +26,7 @@
#include <config.h>
#endif

-#include <stdint.h>
+#include <inttypes.h>
#include <stdlib.h>
#include <glib.h>
#include <bluetooth/sdp.h>
@@ -107,11 +107,11 @@ static void discover_char_free(struct discover_char *dc)
g_free(dc);
}

-static guint16 encode_discover_primary(uint16_t start, uint16_t end,
+static uint16_t encode_discover_primary(uint16_t start, uint16_t end,
bt_uuid_t *uuid, uint8_t *pdu, size_t len)
{
bt_uuid_t prim;
- guint16 plen;
+ uint16_t plen;

bt_uuid16_create(&prim, GATT_PRIM_SVC_UUID);

@@ -143,15 +143,15 @@ static guint16 encode_discover_primary(uint16_t start, uint16_t end,
return plen;
}

-static void primary_by_uuid_cb(guint8 status, const guint8 *ipdu,
- guint16 iplen, gpointer user_data)
+static void primary_by_uuid_cb(uint8_t status, const uint8_t *ipdu,
+ uint16_t iplen, gpointer user_data)

{
struct discover_primary *dp = user_data;
GSList *ranges, *last;
struct att_range *range;
uint8_t *buf;
- guint16 oplen;
+ uint16_t oplen;
int err = 0;
size_t buflen;

@@ -187,7 +187,7 @@ done:
discover_primary_free(dp);
}

-static void primary_all_cb(guint8 status, const guint8 *ipdu, guint16 iplen,
+static void primary_all_cb(uint8_t status, const uint8_t *ipdu, uint16_t iplen,
gpointer user_data)
{
struct discover_primary *dp = user_data;
@@ -242,7 +242,7 @@ static void primary_all_cb(guint8 status, const guint8 *ipdu, guint16 iplen,
if (end != 0xffff) {
size_t buflen;
uint8_t *buf = g_attrib_get_buffer(dp->attrib, &buflen);
- guint16 oplen = encode_discover_primary(end + 1, 0xffff, NULL,
+ uint16_t oplen = encode_discover_primary(end + 1, 0xffff, NULL,
buf, buflen);

g_attrib_send(dp->attrib, 0, buf, oplen, primary_all_cb,
@@ -256,14 +256,14 @@ done:
discover_primary_free(dp);
}

-guint gatt_discover_primary(GAttrib *attrib, bt_uuid_t *uuid, gatt_cb_t func,
- gpointer user_data)
+unsigned int gatt_discover_primary(GAttrib *attrib, bt_uuid_t *uuid,
+ gatt_cb_t func, gpointer user_data)
{
struct discover_primary *dp;
size_t buflen;
uint8_t *buf = g_attrib_get_buffer(attrib, &buflen);
GAttribResultFunc cb;
- guint16 plen;
+ uint16_t plen;

plen = encode_discover_primary(0x0001, 0xffff, uuid, buf, buflen);
if (plen == 0)
@@ -322,13 +322,13 @@ done:
g_free(query);
}

-static guint resolve_included_uuid(struct included_discovery *isd,
+static unsigned int resolve_included_uuid(struct included_discovery *isd,
struct gatt_included *incl)
{
struct included_uuid_query *query;
size_t buflen;
uint8_t *buf = g_attrib_get_buffer(isd->attrib, &buflen);
- guint16 oplen = enc_read_req(incl->range.start, buf, buflen);
+ uint16_t oplen = enc_read_req(incl->range.start, buf, buflen);

query = g_new0(struct included_uuid_query, 1);
query->isd = isd_ref(isd);
@@ -360,12 +360,13 @@ static struct gatt_included *included_from_buf(const uint8_t *buf, gsize len)
static void find_included_cb(uint8_t status, const uint8_t *pdu, uint16_t len,
gpointer user_data);

-static guint find_included(struct included_discovery *isd, uint16_t start)
+static unsigned int find_included(struct included_discovery *isd,
+ uint16_t start)
{
bt_uuid_t uuid;
size_t buflen;
uint8_t *buf = g_attrib_get_buffer(isd->attrib, &buflen);
- guint16 oplen;
+ uint16_t oplen;

bt_uuid16_create(&uuid, GATT_INCLUDE_UUID);
oplen = enc_read_by_type_req(start, isd->end_handle, &uuid,
@@ -443,15 +444,15 @@ unsigned int gatt_find_included(GAttrib *attrib, uint16_t start, uint16_t end,
return find_included(isd, start);
}

-static void char_discovered_cb(guint8 status, const guint8 *ipdu, guint16 iplen,
- gpointer user_data)
+static void char_discovered_cb(uint8_t status, const uint8_t *ipdu,
+ uint16_t iplen, gpointer user_data)
{
struct discover_char *dc = user_data;
struct att_data_list *list;
unsigned int i, err = ATT_ECODE_ATTR_NOT_FOUND;
size_t buflen;
uint8_t *buf;
- guint16 oplen;
+ uint16_t oplen;
bt_uuid_t uuid;
uint16_t last = 0;

@@ -522,7 +523,7 @@ done:
discover_char_free(dc);
}

-guint gatt_discover_char(GAttrib *attrib, uint16_t start, uint16_t end,
+unsigned int gatt_discover_char(GAttrib *attrib, uint16_t start, uint16_t end,
bt_uuid_t *uuid, gatt_cb_t func,
gpointer user_data)
{
@@ -530,7 +531,7 @@ guint gatt_discover_char(GAttrib *attrib, uint16_t start, uint16_t end,
uint8_t *buf = g_attrib_get_buffer(attrib, &buflen);
struct discover_char *dc;
bt_uuid_t type_uuid;
- guint16 plen;
+ uint16_t plen;

bt_uuid16_create(&type_uuid, GATT_CHARAC_UUID);

@@ -552,13 +553,14 @@ guint gatt_discover_char(GAttrib *attrib, uint16_t start, uint16_t end,
dc, NULL);
}

-guint gatt_read_char_by_uuid(GAttrib *attrib, uint16_t start, uint16_t end,
- bt_uuid_t *uuid, GAttribResultFunc func,
+unsigned int gatt_read_char_by_uuid(GAttrib *attrib, uint16_t start,
+ uint16_t end, bt_uuid_t *uuid,
+ GAttribResultFunc func,
gpointer user_data)
{
size_t buflen;
uint8_t *buf = g_attrib_get_buffer(attrib, &buflen);
- guint16 plen;
+ uint16_t plen;

plen = enc_read_by_type_req(start, end, uuid, buf, buflen);
if (plen == 0)
@@ -571,10 +573,10 @@ struct read_long_data {
GAttrib *attrib;
GAttribResultFunc func;
gpointer user_data;
- guint8 *buffer;
- guint16 size;
- guint16 handle;
- guint id;
+ uint8_t *buffer;
+ uint16_t size;
+ uint16_t handle;
+ unsigned int id;
int ref;
};

@@ -591,15 +593,15 @@ static void read_long_destroy(gpointer user_data)
g_free(long_read);
}

-static void read_blob_helper(guint8 status, const guint8 *rpdu, guint16 rlen,
+static void read_blob_helper(uint8_t status, const uint8_t *rpdu, uint16_t rlen,
gpointer user_data)
{
struct read_long_data *long_read = user_data;
uint8_t *buf;
size_t buflen;
- guint8 *tmp;
- guint16 plen;
- guint id;
+ uint8_t *tmp;
+ uint16_t plen;
+ unsigned int id;

if (status != 0 || rlen == 1) {
status = 0;
@@ -638,14 +640,14 @@ done:
long_read->user_data);
}

-static void read_char_helper(guint8 status, const guint8 *rpdu,
- guint16 rlen, gpointer user_data)
+static void read_char_helper(uint8_t status, const uint8_t *rpdu,
+ uint16_t rlen, gpointer user_data)
{
struct read_long_data *long_read = user_data;
size_t buflen;
uint8_t *buf = g_attrib_get_buffer(long_read->attrib, &buflen);
- guint16 plen;
- guint id;
+ uint16_t plen;
+ unsigned int id;

if (status != 0 || rlen < buflen)
goto done;
@@ -674,13 +676,13 @@ done:
long_read->func(status, rpdu, rlen, long_read->user_data);
}

-guint gatt_read_char(GAttrib *attrib, uint16_t handle, GAttribResultFunc func,
- gpointer user_data)
+unsigned int gatt_read_char(GAttrib *attrib, uint16_t handle,
+ GAttribResultFunc func, gpointer user_data)
{
uint8_t *buf;
size_t buflen;
- guint16 plen;
- guint id;
+ uint16_t plen;
+ unsigned int id;
struct read_long_data *long_read;

long_read = g_try_new0(struct read_long_data, 1);
@@ -711,18 +713,18 @@ struct write_long_data {
GAttrib *attrib;
GAttribResultFunc func;
gpointer user_data;
- guint16 handle;
+ uint16_t handle;
uint16_t offset;
uint8_t *value;
size_t vlen;
};

-static guint execute_write(GAttrib *attrib, uint8_t flags,
+static unsigned int execute_write(GAttrib *attrib, uint8_t flags,
GAttribResultFunc func, gpointer user_data)
{
uint8_t *buf;
size_t buflen;
- guint16 plen;
+ uint16_t plen;

buf = g_attrib_get_buffer(attrib, &buflen);
plen = enc_exec_write_req(flags, buf, buflen);
@@ -732,12 +734,12 @@ static guint execute_write(GAttrib *attrib, uint8_t flags,
return g_attrib_send(attrib, 0, buf, plen, func, user_data, NULL);
}

-static guint prepare_write(GAttrib *attrib, uint16_t handle, uint16_t offset,
- uint8_t *value, size_t vlen, GAttribResultFunc func,
- gpointer user_data);
+static unsigned int prepare_write(GAttrib *attrib, uint16_t handle,
+ uint16_t offset, uint8_t *value, size_t vlen,
+ GAttribResultFunc func, gpointer user_data);

-static void prepare_write_cb(guint8 status, const guint8 *rpdu,
- guint16 rlen, gpointer user_data)
+static void prepare_write_cb(uint8_t status, const uint8_t *rpdu,
+ uint16_t rlen, gpointer user_data)
{
struct write_long_data *long_write = user_data;

@@ -763,11 +765,11 @@ static void prepare_write_cb(guint8 status, const guint8 *rpdu,
long_write->func, long_write);
}

-static guint prepare_write(GAttrib *attrib, uint16_t handle, uint16_t offset,
- uint8_t *value, size_t vlen, GAttribResultFunc func,
- gpointer user_data)
+static unsigned int prepare_write(GAttrib *attrib, uint16_t handle,
+ uint16_t offset, uint8_t *value, size_t vlen,
+ GAttribResultFunc func, gpointer user_data)
{
- guint16 plen;
+ uint16_t plen;
size_t buflen;
uint8_t *buf;

@@ -782,12 +784,12 @@ static guint prepare_write(GAttrib *attrib, uint16_t handle, uint16_t offset,
user_data, NULL);
}

-guint gatt_write_char(GAttrib *attrib, uint16_t handle, uint8_t *value,
+unsigned int gatt_write_char(GAttrib *attrib, uint16_t handle, uint8_t *value,
size_t vlen, GAttribResultFunc func, gpointer user_data)
{
uint8_t *buf;
size_t buflen;
- guint16 plen;
+ uint16_t plen;
struct write_long_data *long_write;

buf = g_attrib_get_buffer(attrib, &buflen);
@@ -822,24 +824,24 @@ guint gatt_write_char(GAttrib *attrib, uint16_t handle, uint8_t *value,
func, long_write);
}

-guint gatt_exchange_mtu(GAttrib *attrib, uint16_t mtu, GAttribResultFunc func,
- gpointer user_data)
+unsigned int gatt_exchange_mtu(GAttrib *attrib, uint16_t mtu,
+ GAttribResultFunc func, gpointer user_data)
{
uint8_t *buf;
size_t buflen;
- guint16 plen;
+ uint16_t plen;

buf = g_attrib_get_buffer(attrib, &buflen);
plen = enc_mtu_req(mtu, buf, buflen);
return g_attrib_send(attrib, 0, buf, plen, func, user_data, NULL);
}

-guint gatt_find_info(GAttrib *attrib, uint16_t start, uint16_t end,
+unsigned int gatt_find_info(GAttrib *attrib, uint16_t start, uint16_t end,
GAttribResultFunc func, gpointer user_data)
{
uint8_t *buf;
size_t buflen;
- guint16 plen;
+ uint16_t plen;

buf = g_attrib_get_buffer(attrib, &buflen);
plen = enc_find_info_req(start, end, buf, buflen);
@@ -849,12 +851,12 @@ guint gatt_find_info(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)
+unsigned int gatt_write_cmd(GAttrib *attrib, uint16_t handle, uint8_t *value,
+ int vlen, GDestroyNotify notify, gpointer user_data)
{
uint8_t *buf;
size_t buflen;
- guint16 plen;
+ uint16_t plen;

buf = g_attrib_get_buffer(attrib, &buflen);
plen = enc_write_cmd(handle, value, vlen, buf, buflen);
diff --git a/attrib/gatt.h b/attrib/gatt.h
index 305b4c6..d5758b7 100644
--- a/attrib/gatt.h
+++ b/attrib/gatt.h
@@ -22,6 +22,7 @@
*
*/

+#include <inttypes.h>
#include <bluetooth/sdp.h>

/* GATT Profile Attribute types */
@@ -53,7 +54,7 @@
#define GATT_CLIENT_CHARAC_CFG_NOTIF_BIT 0x0001
#define GATT_CLIENT_CHARAC_CFG_IND_BIT 0x0002

-typedef void (*gatt_cb_t) (GSList *l, guint8 status, gpointer user_data);
+typedef void (*gatt_cb_t) (GSList *l, uint8_t status, gpointer user_data);

struct gatt_primary {
char uuid[MAX_LEN_UUID_STR + 1];
@@ -74,35 +75,37 @@ struct gatt_char {
uint16_t value_handle;
};

-guint gatt_discover_primary(GAttrib *attrib, bt_uuid_t *uuid, gatt_cb_t func,
- gpointer user_data);
+unsigned int gatt_discover_primary(GAttrib *attrib, bt_uuid_t *uuid,
+ gatt_cb_t func, gpointer user_data);

unsigned int gatt_find_included(GAttrib *attrib, uint16_t start, uint16_t end,
gatt_cb_t func, gpointer user_data);

-guint gatt_discover_char(GAttrib *attrib, uint16_t start, uint16_t end,
+unsigned int gatt_discover_char(GAttrib *attrib, uint16_t start, uint16_t end,
bt_uuid_t *uuid, gatt_cb_t func,
gpointer user_data);

-guint gatt_read_char(GAttrib *attrib, uint16_t handle, GAttribResultFunc func,
- gpointer user_data);
+unsigned int 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,
+unsigned int gatt_write_char(GAttrib *attrib, uint16_t handle, uint8_t *value,
size_t vlen, GAttribResultFunc func,
gpointer user_data);

-guint gatt_find_info(GAttrib *attrib, uint16_t start, uint16_t end,
+unsigned int gatt_find_info(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);
+unsigned int gatt_write_cmd(GAttrib *attrib, uint16_t handle, 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,
- gpointer user_data);
+unsigned int gatt_read_char_by_uuid(GAttrib *attrib, uint16_t start,
+ uint16_t end, bt_uuid_t *uuid,
+ GAttribResultFunc func,
+ gpointer user_data);

-guint gatt_exchange_mtu(GAttrib *attrib, uint16_t mtu, GAttribResultFunc func,
- gpointer user_data);
+unsigned int gatt_exchange_mtu(GAttrib *attrib, uint16_t mtu,
+ GAttribResultFunc func, gpointer user_data);

gboolean gatt_parse_record(const sdp_record_t *rec,
uuid_t *prim_uuid, uint16_t *psm,
diff --git a/attrib/gattrib.c b/attrib/gattrib.c
index c662ace..ad4efe1 100644
--- a/attrib/gattrib.c
+++ b/attrib/gattrib.c
@@ -26,7 +26,7 @@
#include "config.h"
#endif

-#include <stdint.h>
+#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
#include <glib.h>
@@ -48,24 +48,24 @@ struct _GAttrib {
int refs;
uint8_t *buf;
size_t buflen;
- guint read_watch;
- guint write_watch;
- guint timeout_watch;
+ unsigned int read_watch;
+ unsigned int write_watch;
+ unsigned int timeout_watch;
GQueue *requests;
GQueue *responses;
GSList *events;
- guint next_cmd_id;
+ unsigned int next_cmd_id;
GDestroyNotify destroy;
gpointer destroy_user_data;
bool stale;
};

struct command {
- guint id;
- guint8 opcode;
- guint8 *pdu;
- guint16 len;
- guint8 expected;
+ unsigned int id;
+ uint8_t opcode;
+ uint8_t *pdu;
+ uint16_t len;
+ uint8_t expected;
bool sent;
GAttribResultFunc func;
gpointer user_data;
@@ -73,15 +73,15 @@ struct command {
};

struct event {
- guint id;
- guint8 expected;
- guint16 handle;
+ unsigned int id;
+ uint8_t expected;
+ uint16_t handle;
GAttribNotifyFunc func;
gpointer user_data;
GDestroyNotify notify;
};

-static guint8 opcode2expected(guint8 opcode)
+static uint8_t opcode2expected(uint8_t opcode)
{
switch (opcode) {
case ATT_OP_MTU_REQ:
@@ -124,7 +124,7 @@ static guint8 opcode2expected(guint8 opcode)
return 0;
}

-static bool is_response(guint8 opcode)
+static bool is_response(uint8_t opcode)
{
switch (opcode) {
case ATT_OP_ERROR:
@@ -367,7 +367,7 @@ static void wake_up_sender(struct _GAttrib *attrib)

static bool match_event(struct event *evt, const uint8_t *pdu, gsize len)
{
- guint16 handle;
+ uint16_t handle;

if (evt->expected == GATTRIB_ALL_EVENTS)
return true;
@@ -502,9 +502,10 @@ GAttrib *g_attrib_new(GIOChannel *io)
return g_attrib_ref(attrib);
}

-guint g_attrib_send(GAttrib *attrib, guint id, const guint8 *pdu, guint16 len,
- GAttribResultFunc func, gpointer user_data,
- GDestroyNotify notify)
+unsigned int g_attrib_send(GAttrib *attrib, unsigned int id,
+ const uint8_t *pdu, uint16_t len,
+ GAttribResultFunc func, gpointer user_data,
+ GDestroyNotify notify)
{
struct command *c;
GQueue *queue;
@@ -559,12 +560,12 @@ guint g_attrib_send(GAttrib *attrib, guint id, const guint8 *pdu, guint16 len,
static int command_cmp_by_id(gconstpointer a, gconstpointer b)
{
const struct command *cmd = a;
- guint id = GPOINTER_TO_UINT(b);
+ unsigned int id = GPOINTER_TO_UINT(b);

return cmd->id - id;
}

-gboolean g_attrib_cancel(GAttrib *attrib, guint id)
+gboolean g_attrib_cancel(GAttrib *attrib, unsigned int id)
{
GList *l = NULL;
struct command *cmd;
@@ -669,11 +670,11 @@ gboolean g_attrib_set_mtu(GAttrib *attrib, int mtu)
return TRUE;
}

-guint g_attrib_register(GAttrib *attrib, guint8 opcode, guint16 handle,
+unsigned int g_attrib_register(GAttrib *attrib, uint8_t opcode, uint16_t handle,
GAttribNotifyFunc func, gpointer user_data,
GDestroyNotify notify)
{
- static guint next_evt_id = 0;
+ static unsigned int next_evt_id = 0;
struct event *event;

event = g_try_new0(struct event, 1);
@@ -695,7 +696,7 @@ guint g_attrib_register(GAttrib *attrib, guint8 opcode, guint16 handle,
static int event_cmp_by_id(gconstpointer a, gconstpointer b)
{
const struct event *evt = a;
- guint id = GPOINTER_TO_UINT(b);
+ unsigned int id = GPOINTER_TO_UINT(b);

return evt->id - id;
}
@@ -712,7 +713,7 @@ gboolean g_attrib_is_encrypted(GAttrib *attrib)
return sec_level > BT_IO_SEC_LOW;
}

-gboolean g_attrib_unregister(GAttrib *attrib, guint id)
+gboolean g_attrib_unregister(GAttrib *attrib, unsigned int id)
{
struct event *evt;
GSList *l;
diff --git a/attrib/gattrib.h b/attrib/gattrib.h
index 3fe92c7..a1f2dd8 100644
--- a/attrib/gattrib.h
+++ b/attrib/gattrib.h
@@ -28,6 +28,8 @@
extern "C" {
#endif

+#include <inttypes.h>
+
#define GATTRIB_ALL_EVENTS 0xFF
#define GATTRIB_ALL_REQS 0xFE
#define GATTRIB_ALL_HANDLES 0x0000
@@ -35,11 +37,11 @@ extern "C" {
struct _GAttrib;
typedef struct _GAttrib GAttrib;

-typedef void (*GAttribResultFunc) (guint8 status, const guint8 *pdu,
- guint16 len, gpointer user_data);
+typedef void (*GAttribResultFunc) (uint8_t status, const uint8_t *pdu,
+ uint16_t len, gpointer user_data);
typedef void (*GAttribDisconnectFunc)(gpointer user_data);
typedef void (*GAttribDebugFunc)(const char *str, gpointer user_data);
-typedef void (*GAttribNotifyFunc)(const guint8 *pdu, guint16 len,
+typedef void (*GAttribNotifyFunc)(const uint8_t *pdu, uint16_t len,
gpointer user_data);

GAttrib *g_attrib_new(GIOChannel *io);
@@ -51,17 +53,18 @@ GIOChannel *g_attrib_get_channel(GAttrib *attrib);
gboolean g_attrib_set_destroy_function(GAttrib *attrib,
GDestroyNotify destroy, gpointer user_data);

-guint g_attrib_send(GAttrib *attrib, guint id, const guint8 *pdu, guint16 len,
- GAttribResultFunc func, gpointer user_data,
- GDestroyNotify notify);
+unsigned int g_attrib_send(GAttrib *attrib, unsigned int id,
+ const uint8_t *pdu, uint16_t len,
+ GAttribResultFunc func, gpointer user_data,
+ GDestroyNotify notify);

-gboolean g_attrib_cancel(GAttrib *attrib, guint id);
+gboolean g_attrib_cancel(GAttrib *attrib, unsigned int id);
gboolean g_attrib_cancel_all(GAttrib *attrib);

gboolean g_attrib_set_debug(GAttrib *attrib,
GAttribDebugFunc func, gpointer user_data);

-guint g_attrib_register(GAttrib *attrib, guint8 opcode, guint16 handle,
+unsigned int g_attrib_register(GAttrib *attrib, uint8_t opcode, uint16_t handle,
GAttribNotifyFunc func, gpointer user_data,
GDestroyNotify notify);

@@ -70,7 +73,7 @@ gboolean g_attrib_is_encrypted(GAttrib *attrib);
uint8_t *g_attrib_get_buffer(GAttrib *attrib, size_t *len);
gboolean g_attrib_set_mtu(GAttrib *attrib, int mtu);

-gboolean g_attrib_unregister(GAttrib *attrib, guint id);
+gboolean g_attrib_unregister(GAttrib *attrib, unsigned int id);
gboolean g_attrib_unregister_all(GAttrib *attrib);

#ifdef __cplusplus
diff --git a/attrib/gatttool.c b/attrib/gatttool.c
index 2c11562..9ecd628 100644
--- a/attrib/gatttool.c
+++ b/attrib/gatttool.c
@@ -26,6 +26,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <errno.h>
#include <glib.h>
#include <stdlib.h>
@@ -137,7 +138,7 @@ static void connect_cb(GIOChannel *io, GError *err, gpointer user_data)
operation(attrib);
}

-static void primary_all_cb(GSList *services, guint8 status, gpointer user_data)
+static void primary_all_cb(GSList *services, uint8_t status, gpointer user_data)
{
GSList *l;

@@ -157,7 +158,7 @@ done:
g_main_loop_quit(event_loop);
}

-static void primary_by_uuid_cb(GSList *ranges, guint8 status,
+static void primary_by_uuid_cb(GSList *ranges, uint8_t status,
gpointer user_data)
{
GSList *l;
@@ -191,7 +192,7 @@ static gboolean primary(gpointer user_data)
return FALSE;
}

-static void char_discovered_cb(GSList *characteristics, guint8 status,
+static void char_discovered_cb(GSList *characteristics, uint8_t status,
gpointer user_data)
{
GSList *l;
@@ -224,7 +225,7 @@ static gboolean characteristics(gpointer user_data)
return FALSE;
}

-static void char_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
+static void char_read_cb(uint8_t status, const uint8_t *pdu, uint16_t plen,
gpointer user_data)
{
uint8_t value[plen];
@@ -252,8 +253,8 @@ done:
g_main_loop_quit(event_loop);
}

-static void char_read_by_uuid_cb(guint8 status, const guint8 *pdu,
- guint16 plen, gpointer user_data)
+static void char_read_by_uuid_cb(uint8_t status, const uint8_t *pdu,
+ uint16_t plen, gpointer user_data)
{
struct characteristic_data *char_data = user_data;
struct att_data_list *list;
@@ -361,7 +362,7 @@ error:
return FALSE;
}

-static void char_write_req_cb(guint8 status, const guint8 *pdu, guint16 plen,
+static void char_write_req_cb(uint8_t status, const uint8_t *pdu, uint16_t plen,
gpointer user_data)
{
if (status != 0) {
@@ -414,11 +415,11 @@ error:
return FALSE;
}

-static void char_desc_cb(guint8 status, const guint8 *pdu, guint16 plen,
+static void char_desc_cb(uint8_t status, const uint8_t *pdu, uint16_t plen,
gpointer user_data)
{
struct att_data_list *list;
- guint8 format;
+ uint8_t format;
int i;

if (status != 0) {
diff --git a/attrib/interactive.c b/attrib/interactive.c
index f28dc22..12f1506 100644
--- a/attrib/interactive.c
+++ b/attrib/interactive.c
@@ -25,6 +25,7 @@
#include "config.h"
#endif

+#include <inttypes.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -187,7 +188,7 @@ static void disconnect_io()
set_state(STATE_DISCONNECTED);
}

-static void primary_all_cb(GSList *services, guint8 status, gpointer user_data)
+static void primary_all_cb(GSList *services, uint8_t status, gpointer user_data)
{
GSList *l;

@@ -209,7 +210,7 @@ static void primary_all_cb(GSList *services, guint8 status, gpointer user_data)
}
}

-static void primary_by_uuid_cb(GSList *ranges, guint8 status,
+static void primary_by_uuid_cb(GSList *ranges, uint8_t status,
gpointer user_data)
{
GSList *l;
@@ -232,7 +233,7 @@ static void primary_by_uuid_cb(GSList *ranges, guint8 status,
}
}

-static void included_cb(GSList *includes, guint8 status, gpointer user_data)
+static void included_cb(GSList *includes, uint8_t status, gpointer user_data)
{
GSList *l;

@@ -256,7 +257,7 @@ static void included_cb(GSList *includes, guint8 status, gpointer user_data)
}
}

-static void char_cb(GSList *characteristics, guint8 status, gpointer user_data)
+static void char_cb(GSList *characteristics, uint8_t status, gpointer user_data)
{
GSList *l;

@@ -276,11 +277,11 @@ static void char_cb(GSList *characteristics, guint8 status, gpointer user_data)
}
}

-static void char_desc_cb(guint8 status, const guint8 *pdu, guint16 plen,
+static void char_desc_cb(uint8_t status, const uint8_t *pdu, uint16_t plen,
gpointer user_data)
{
struct att_data_list *list;
- guint8 format;
+ uint8_t format;
uint16_t handle = 0xffff;
int i;

@@ -317,7 +318,7 @@ static void char_desc_cb(guint8 status, const guint8 *pdu, guint16 plen,
gatt_find_info(attrib, handle + 1, end, char_desc_cb, NULL);
}

-static void char_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
+static void char_read_cb(uint8_t status, const uint8_t *pdu, uint16_t plen,
gpointer user_data)
{
uint8_t value[plen];
@@ -345,8 +346,8 @@ static void char_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
g_string_free(s, TRUE);
}

-static void char_read_by_uuid_cb(guint8 status, const guint8 *pdu,
- guint16 plen, gpointer user_data)
+static void char_read_by_uuid_cb(uint8_t status, const uint8_t *pdu,
+ uint16_t plen, gpointer user_data)
{
struct characteristic_data *char_data = user_data;
struct att_data_list *list;
@@ -648,7 +649,7 @@ static void cmd_read_uuid(int argcp, char **argvp)
char_read_by_uuid_cb, char_data);
}

-static void char_write_req_cb(guint8 status, const guint8 *pdu, guint16 plen,
+static void char_write_req_cb(uint8_t status, const uint8_t *pdu, uint16_t plen,
gpointer user_data)
{
if (status != 0) {
@@ -743,7 +744,7 @@ static void cmd_sec_level(int argcp, char **argvp)
}
}

-static void exchange_mtu_cb(guint8 status, const guint8 *pdu, guint16 plen,
+static void exchange_mtu_cb(uint8_t status, const uint8_t *pdu, uint16_t plen,
gpointer user_data)
{
uint16_t mtu;
@@ -924,10 +925,10 @@ static char **commands_completion(const char *text, int start, int end)
return NULL;
}

-static guint setup_standard_input(void)
+static unsigned int setup_standard_input(void)
{
GIOChannel *channel;
- guint source;
+ unsigned int source;

channel = g_io_channel_unix_new(fileno(stdin));

@@ -980,10 +981,10 @@ static gboolean signal_handler(GIOChannel *channel, GIOCondition condition,
return TRUE;
}

-static guint setup_signalfd(void)
+static unsigned int setup_signalfd(void)
{
GIOChannel *channel;
- guint source;
+ unsigned int source;
sigset_t mask;
int fd;

@@ -1020,8 +1021,8 @@ static guint setup_signalfd(void)
int interactive(const char *src, const char *dst,
const char *dst_type, int psm)
{
- guint input;
- guint signal;
+ unsigned int input;
+ unsigned int signal;

opt_sec_level = g_strdup("low");

--
1.8.2.2


2013-05-09 04:16:33

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 03/26] gobex: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate.
---
gobex/gobex-apparam.c | 77 ++++++++++++++--------------
gobex/gobex-apparam.h | 43 ++++++++--------
gobex/gobex-debug.h | 7 +--
gobex/gobex-header.c | 51 +++++++++----------
gobex/gobex-header.h | 21 ++++----
gobex/gobex-packet.c | 41 +++++++--------
gobex/gobex-packet.h | 23 +++++----
gobex/gobex-transfer.c | 65 ++++++++++++------------
gobex/gobex.c | 133 +++++++++++++++++++++++++------------------------
gobex/gobex.h | 59 ++++++++++++----------
10 files changed, 269 insertions(+), 251 deletions(-)

diff --git a/gobex/gobex-apparam.c b/gobex/gobex-apparam.c
index 4328172..84fadc0 100644
--- a/gobex/gobex-apparam.c
+++ b/gobex/gobex-apparam.c
@@ -24,6 +24,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
@@ -36,20 +37,20 @@ struct _GObexApparam {
};

struct apparam_tag {
- guint8 id;
- guint8 len;
+ uint8_t id;
+ uint8_t len;
union {
/* Data is stored in network order */
char string[0];
- guint8 data[0];
- guint8 u8;
- guint16 u16;
- guint32 u32;
- guint64 u64;
+ uint8_t data[0];
+ uint8_t u8;
+ uint16_t u16;
+ uint32_t u32;
+ uint64_t u64;
} value;
} __attribute__ ((packed));

-static struct apparam_tag *tag_new(guint8 id, guint8 len, const void *data)
+static struct apparam_tag *tag_new(uint8_t id, uint8_t len, const void *data)
{
struct apparam_tag *tag;

@@ -76,9 +77,9 @@ static struct apparam_tag *apparam_tag_decode(const void *data, gsize size,
gsize *parsed)
{
struct apparam_tag *tag;
- const guint8 *ptr = data;
- guint8 id;
- guint8 len;
+ const uint8_t *ptr = data;
+ uint8_t id;
+ uint8_t len;

if (size < 2)
return NULL;
@@ -113,7 +114,7 @@ GObexApparam *g_obex_apparam_decode(const void *data, gsize size)
while (count < size) {
struct apparam_tag *tag;
gsize parsed;
- guint id;
+ unsigned int id;

tag = apparam_tag_decode(data + count, size - count, &parsed);
if (tag == NULL)
@@ -166,11 +167,11 @@ gssize g_obex_apparam_encode(GObexApparam *apparam, void *buf, gsize len)
return count;
}

-GObexApparam *g_obex_apparam_set_bytes(GObexApparam *apparam, guint8 id,
+GObexApparam *g_obex_apparam_set_bytes(GObexApparam *apparam, uint8_t id,
const void *value, gsize len)
{
struct apparam_tag *tag;
- guint uid = id;
+ unsigned int uid = id;

if (apparam == NULL)
apparam = g_obex_apparam_new();
@@ -181,38 +182,38 @@ GObexApparam *g_obex_apparam_set_bytes(GObexApparam *apparam, guint8 id,
return apparam;
}

-GObexApparam *g_obex_apparam_set_uint8(GObexApparam *apparam, guint8 id,
- guint8 value)
+GObexApparam *g_obex_apparam_set_uint8(GObexApparam *apparam, uint8_t id,
+ uint8_t value)
{
g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x value %u", id, value);

return g_obex_apparam_set_bytes(apparam, id, &value, 1);
}

-GObexApparam *g_obex_apparam_set_uint16(GObexApparam *apparam, guint8 id,
- guint16 value)
+GObexApparam *g_obex_apparam_set_uint16(GObexApparam *apparam, uint8_t id,
+ uint16_t value)
{
- guint16 num = g_htons(value);
+ uint16_t num = g_htons(value);

g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x value %u", id, value);

return g_obex_apparam_set_bytes(apparam, id, &num, 2);
}

-GObexApparam *g_obex_apparam_set_uint32(GObexApparam *apparam, guint8 id,
- guint32 value)
+GObexApparam *g_obex_apparam_set_uint32(GObexApparam *apparam, uint8_t id,
+ uint32_t value)
{
- guint32 num = g_htonl(value);
+ uint32_t num = g_htonl(value);

g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x value %u", id, value);

return g_obex_apparam_set_bytes(apparam, id, &num, 4);
}

-GObexApparam *g_obex_apparam_set_uint64(GObexApparam *apparam, guint8 id,
- guint64 value)
+GObexApparam *g_obex_apparam_set_uint64(GObexApparam *apparam, uint8_t id,
+ uint64_t value)
{
- guint64 num = GUINT64_TO_BE(value);
+ uint64_t num = GUINT64_TO_BE(value);

g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x value %"
G_GUINT64_FORMAT, id, value);
@@ -220,7 +221,7 @@ GObexApparam *g_obex_apparam_set_uint64(GObexApparam *apparam, guint8 id,
return g_obex_apparam_set_bytes(apparam, id, &num, 8);
}

-GObexApparam *g_obex_apparam_set_string(GObexApparam *apparam, guint8 id,
+GObexApparam *g_obex_apparam_set_string(GObexApparam *apparam, uint8_t id,
const char *value)
{
gsize len;
@@ -237,13 +238,13 @@ GObexApparam *g_obex_apparam_set_string(GObexApparam *apparam, guint8 id,
}

static struct apparam_tag *g_obex_apparam_find_tag(GObexApparam *apparam,
- guint id)
+ unsigned int id)
{
return g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
}

-gboolean g_obex_apparam_get_uint8(GObexApparam *apparam, guint8 id,
- guint8 *dest)
+gboolean g_obex_apparam_get_uint8(GObexApparam *apparam, uint8_t id,
+ uint8_t *dest)
{
struct apparam_tag *tag;

@@ -260,8 +261,8 @@ gboolean g_obex_apparam_get_uint8(GObexApparam *apparam, guint8 id,
return TRUE;
}

-gboolean g_obex_apparam_get_uint16(GObexApparam *apparam, guint8 id,
- guint16 *dest)
+gboolean g_obex_apparam_get_uint16(GObexApparam *apparam, uint8_t id,
+ uint16_t *dest)
{
struct apparam_tag *tag;

@@ -281,8 +282,8 @@ gboolean g_obex_apparam_get_uint16(GObexApparam *apparam, guint8 id,
return TRUE;
}

-gboolean g_obex_apparam_get_uint32(GObexApparam *apparam, guint8 id,
- guint32 *dest)
+gboolean g_obex_apparam_get_uint32(GObexApparam *apparam, uint8_t id,
+ uint32_t *dest)
{
struct apparam_tag *tag;

@@ -302,8 +303,8 @@ gboolean g_obex_apparam_get_uint32(GObexApparam *apparam, guint8 id,
return TRUE;
}

-gboolean g_obex_apparam_get_uint64(GObexApparam *apparam, guint8 id,
- guint64 *dest)
+gboolean g_obex_apparam_get_uint64(GObexApparam *apparam, uint8_t id,
+ uint64_t *dest)
{
struct apparam_tag *tag;

@@ -323,7 +324,7 @@ gboolean g_obex_apparam_get_uint64(GObexApparam *apparam, guint8 id,
return TRUE;
}

-char *g_obex_apparam_get_string(GObexApparam *apparam, guint8 id)
+char *g_obex_apparam_get_string(GObexApparam *apparam, uint8_t id)
{
struct apparam_tag *tag;
char *string;
@@ -341,8 +342,8 @@ char *g_obex_apparam_get_string(GObexApparam *apparam, guint8 id)
return string;
}

-gboolean g_obex_apparam_get_bytes(GObexApparam *apparam, guint8 id,
- const guint8 **val, gsize *len)
+gboolean g_obex_apparam_get_bytes(GObexApparam *apparam, uint8_t id,
+ const uint8_t **val, gsize *len)
{
struct apparam_tag *tag;

diff --git a/gobex/gobex-apparam.h b/gobex/gobex-apparam.h
index 6c08609..030a719 100644
--- a/gobex/gobex-apparam.h
+++ b/gobex/gobex-apparam.h
@@ -24,36 +24,37 @@
#define __GOBEX_APPARAM_H

#include <glib.h>
+#include <inttypes.h>

typedef struct _GObexApparam GObexApparam;

GObexApparam *g_obex_apparam_decode(const void *data, gsize size);
gssize g_obex_apparam_encode(GObexApparam *apparam, void *buf, gsize size);

-GObexApparam *g_obex_apparam_set_bytes(GObexApparam *apparam, guint8 id,
+GObexApparam *g_obex_apparam_set_bytes(GObexApparam *apparam, uint8_t id,
const void *value, gsize size);
-GObexApparam *g_obex_apparam_set_uint8(GObexApparam *apparam, guint8 id,
- guint8 value);
-GObexApparam *g_obex_apparam_set_uint16(GObexApparam *apparam, guint8 id,
- guint16 value);
-GObexApparam *g_obex_apparam_set_uint32(GObexApparam *apparam, guint8 id,
- guint32 value);
-GObexApparam *g_obex_apparam_set_uint64(GObexApparam *apparam, guint8 id,
- guint64 value);
-GObexApparam *g_obex_apparam_set_string(GObexApparam *apparam, guint8 id,
+GObexApparam *g_obex_apparam_set_uint8(GObexApparam *apparam, uint8_t id,
+ uint8_t value);
+GObexApparam *g_obex_apparam_set_uint16(GObexApparam *apparam, uint8_t id,
+ uint16_t value);
+GObexApparam *g_obex_apparam_set_uint32(GObexApparam *apparam, uint8_t id,
+ uint32_t value);
+GObexApparam *g_obex_apparam_set_uint64(GObexApparam *apparam, uint8_t id,
+ uint64_t value);
+GObexApparam *g_obex_apparam_set_string(GObexApparam *apparam, uint8_t id,
const char *value);

-gboolean g_obex_apparam_get_bytes(GObexApparam *apparam, guint8 id,
- const guint8 **val, gsize *len);
-gboolean g_obex_apparam_get_uint8(GObexApparam *apparam, guint8 id,
- guint8 *value);
-gboolean g_obex_apparam_get_uint16(GObexApparam *apparam, guint8 id,
- guint16 *value);
-gboolean g_obex_apparam_get_uint32(GObexApparam *apparam, guint8 id,
- guint32 *value);
-gboolean g_obex_apparam_get_uint64(GObexApparam *apparam, guint8 id,
- guint64 *value);
-char *g_obex_apparam_get_string(GObexApparam *apparam, guint8 id);
+gboolean g_obex_apparam_get_bytes(GObexApparam *apparam, uint8_t id,
+ const uint8_t **val, gsize *len);
+gboolean g_obex_apparam_get_uint8(GObexApparam *apparam, uint8_t id,
+ uint8_t *value);
+gboolean g_obex_apparam_get_uint16(GObexApparam *apparam, uint8_t id,
+ uint16_t *value);
+gboolean g_obex_apparam_get_uint32(GObexApparam *apparam, uint8_t id,
+ uint32_t *value);
+gboolean g_obex_apparam_get_uint64(GObexApparam *apparam, uint8_t id,
+ uint64_t *value);
+char *g_obex_apparam_get_string(GObexApparam *apparam, uint8_t id);

void g_obex_apparam_free(GObexApparam *apparam);

diff --git a/gobex/gobex-debug.h b/gobex/gobex-debug.h
index 688466e..fc4fdb1 100644
--- a/gobex/gobex-debug.h
+++ b/gobex/gobex-debug.h
@@ -22,6 +22,7 @@
#ifndef __GOBEX_DEBUG_H
#define __GOBEX_DEBUG_H

+#include <inttypes.h>
#include <glib.h>
#include <stdio.h>
#include <ctype.h>
@@ -35,17 +36,17 @@
#define G_OBEX_DEBUG_DATA (1 << 6)
#define G_OBEX_DEBUG_APPARAM (1 << 7)

-extern guint gobex_debug;
+extern unsigned int gobex_debug;

#define g_obex_debug(level, format, ...) \
if (gobex_debug & level) \
g_log("gobex", G_LOG_LEVEL_DEBUG, "%s:%s() " format, __FILE__, \
__FUNCTION__, ## __VA_ARGS__)

-static inline void g_obex_dump(guint level, const char *prefix,
+static inline void g_obex_dump(unsigned int level, const char *prefix,
const void *buf, gsize len)
{
- const guint8 *data = buf;
+ const uint8_t *data = buf;
int n = 0;

if (!(gobex_debug & level))
diff --git a/gobex/gobex-header.c b/gobex/gobex-header.c
index 281f8ea..8a4f401 100644
--- a/gobex/gobex-header.c
+++ b/gobex/gobex-header.c
@@ -24,6 +24,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <string.h>

#include "gobex-header.h"
@@ -38,16 +39,16 @@
#define G_OBEX_HDR_ENC(id) ((id) & 0xc0)

struct _GObexHeader {
- guint8 id;
+ uint8_t id;
gboolean extdata;
gsize vlen; /* Length of value */
gsize hlen; /* Length of full encoded header */
union {
char *string; /* UTF-8 converted from UTF-16 */
- guint8 *data; /* Own buffer */
- const guint8 *extdata; /* Reference to external buffer */
- guint8 u8;
- guint32 u32;
+ uint8_t *data; /* Own buffer */
+ const uint8_t *extdata; /* Reference to external buffer */
+ uint8_t u8;
+ uint32_t u32;
} v;
};

@@ -74,13 +75,13 @@ static glong utf8_to_utf16(gunichar2 **utf16, const char *utf8) {
return utf16_len;
}

-static guint8 *put_bytes(guint8 *to, const void *from, gsize count)
+static uint8_t *put_bytes(uint8_t *to, const void *from, gsize count)
{
memcpy(to, from, count);
return (to + count);
}

-static const guint8 *get_bytes(void *to, const guint8 *from, gsize count)
+static const uint8_t *get_bytes(void *to, const uint8_t *from, gsize count)
{
memcpy(to, from, count);
return (from + count);
@@ -88,9 +89,9 @@ static const guint8 *get_bytes(void *to, const guint8 *from, gsize count)

gssize g_obex_header_encode(GObexHeader *header, void *buf, gsize buf_len)
{
- guint8 *ptr = buf;
- guint16 u16;
- guint32 u32;
+ uint8_t *ptr = buf;
+ uint16_t u16;
+ uint32_t u32;
gunichar2 *utf16;
glong utf16_len;

@@ -105,7 +106,7 @@ gssize g_obex_header_encode(GObexHeader *header, void *buf, gsize buf_len)
switch (G_OBEX_HDR_ENC(header->id)) {
case G_OBEX_HDR_ENC_UNICODE:
utf16_len = utf8_to_utf16(&utf16, header->v.string);
- if (utf16_len < 0 || (guint16) utf16_len > buf_len)
+ if (utf16_len < 0 || (uint16_t) utf16_len > buf_len)
return -1;
g_assert_cmpuint(utf16_len + 3, ==, header->hlen);
u16 = g_htons(utf16_len + 3);
@@ -140,8 +141,8 @@ GObexHeader *g_obex_header_decode(const void *data, gsize len,
GError **err)
{
GObexHeader *header;
- const guint8 *ptr = data;
- guint16 hdr_len;
+ const uint8_t *ptr = data;
+ uint16_t hdr_len;
gsize str_len;
GError *conv_err = NULL;

@@ -319,7 +320,7 @@ gboolean g_obex_header_get_unicode(GObexHeader *header, const char **str)
return TRUE;
}

-gboolean g_obex_header_get_bytes(GObexHeader *header, const guint8 **val,
+gboolean g_obex_header_get_bytes(GObexHeader *header, const uint8_t **val,
gsize *len)
{
g_obex_debug(G_OBEX_DEBUG_HEADER, "header 0x%02x",
@@ -341,7 +342,7 @@ gboolean g_obex_header_get_bytes(GObexHeader *header, const guint8 **val,
GObexApparam *g_obex_header_get_apparam(GObexHeader *header)
{
gboolean ret;
- const guint8 *val;
+ const uint8_t *val;
gsize len;

ret = g_obex_header_get_bytes(header, &val, &len);
@@ -351,7 +352,7 @@ GObexApparam *g_obex_header_get_apparam(GObexHeader *header)
return g_obex_apparam_decode(val, len);
}

-gboolean g_obex_header_get_uint8(GObexHeader *header, guint8 *val)
+gboolean g_obex_header_get_uint8(GObexHeader *header, uint8_t *val)
{
g_obex_debug(G_OBEX_DEBUG_HEADER, "header 0x%02x",
G_OBEX_HDR_ENC(header->id));
@@ -366,7 +367,7 @@ gboolean g_obex_header_get_uint8(GObexHeader *header, guint8 *val)
return TRUE;
}

-gboolean g_obex_header_get_uint32(GObexHeader *header, guint32 *val)
+gboolean g_obex_header_get_uint32(GObexHeader *header, uint32_t *val)
{
g_obex_debug(G_OBEX_DEBUG_HEADER, "header 0x%02x",
G_OBEX_HDR_ENC(header->id));
@@ -381,7 +382,7 @@ gboolean g_obex_header_get_uint32(GObexHeader *header, guint32 *val)
return TRUE;
}

-GObexHeader *g_obex_header_new_unicode(guint8 id, const char *str)
+GObexHeader *g_obex_header_new_unicode(uint8_t id, const char *str)
{
GObexHeader *header;
gsize len;
@@ -406,7 +407,7 @@ GObexHeader *g_obex_header_new_unicode(guint8 id, const char *str)
return header;
}

-GObexHeader *g_obex_header_new_bytes(guint8 id, const void *data, gsize len)
+GObexHeader *g_obex_header_new_bytes(uint8_t id, const void *data, gsize len)
{
GObexHeader *header;

@@ -427,7 +428,7 @@ GObexHeader *g_obex_header_new_bytes(guint8 id, const void *data, gsize len)

GObexHeader *g_obex_header_new_apparam(GObexApparam *apparam)
{
- guint8 buf[1024];
+ uint8_t buf[1024];
gssize len;

len = g_obex_apparam_encode(apparam, buf, sizeof(buf));
@@ -437,7 +438,7 @@ GObexHeader *g_obex_header_new_apparam(GObexApparam *apparam)
return g_obex_header_new_bytes(G_OBEX_HDR_APPARAM, buf, len);
}

-GObexHeader *g_obex_header_new_uint8(guint8 id, guint8 val)
+GObexHeader *g_obex_header_new_uint8(uint8_t id, uint8_t val)
{
GObexHeader *header;

@@ -458,7 +459,7 @@ GObexHeader *g_obex_header_new_uint8(guint8 id, guint8 val)
return header;
}

-GObexHeader *g_obex_header_new_uint32(guint8 id, guint32 val)
+GObexHeader *g_obex_header_new_uint32(uint8_t id, uint32_t val)
{
GObexHeader *header;

@@ -479,7 +480,7 @@ GObexHeader *g_obex_header_new_uint32(guint8 id, guint32 val)
return header;
}

-guint8 g_obex_header_get_id(GObexHeader *header)
+uint8_t g_obex_header_get_id(GObexHeader *header)
{
g_obex_debug(G_OBEX_DEBUG_HEADER, "header 0x%02x id 0x%02x",
G_OBEX_HDR_ENC(header->id), header->id);
@@ -487,7 +488,7 @@ guint8 g_obex_header_get_id(GObexHeader *header)
return header->id;
}

-guint16 g_obex_header_get_length(GObexHeader *header)
+uint16_t g_obex_header_get_length(GObexHeader *header)
{
g_obex_debug(G_OBEX_DEBUG_HEADER, "header 0x%02x length %zu",
G_OBEX_HDR_ENC(header->id), header->hlen);
@@ -495,7 +496,7 @@ guint16 g_obex_header_get_length(GObexHeader *header)
return header->hlen;
}

-GSList *g_obex_header_create_list(guint8 first_hdr_id, va_list args,
+GSList *g_obex_header_create_list(uint8_t first_hdr_id, va_list args,
gsize *total_len)
{
unsigned int id = first_hdr_id;
diff --git a/gobex/gobex-header.h b/gobex/gobex-header.h
index 42a2a0c..64510ac 100644
--- a/gobex/gobex-header.h
+++ b/gobex/gobex-header.h
@@ -23,6 +23,7 @@
#ifndef __GOBEX_HEADER_H
#define __GOBEX_HEADER_H

+#include <inttypes.h>
#include <glib.h>

#include <gobex/gobex-defs.h>
@@ -75,23 +76,23 @@
typedef struct _GObexHeader GObexHeader;

gboolean g_obex_header_get_unicode(GObexHeader *header, const char **str);
-gboolean g_obex_header_get_bytes(GObexHeader *header, const guint8 **val,
+gboolean g_obex_header_get_bytes(GObexHeader *header, const uint8_t **val,
gsize *len);
-gboolean g_obex_header_get_uint8(GObexHeader *header, guint8 *val);
-gboolean g_obex_header_get_uint32(GObexHeader *header, guint32 *val);
+gboolean g_obex_header_get_uint8(GObexHeader *header, uint8_t *val);
+gboolean g_obex_header_get_uint32(GObexHeader *header, uint32_t *val);
GObexApparam *g_obex_header_get_apparam(GObexHeader *header);

-GObexHeader *g_obex_header_new_unicode(guint8 id, const char *str);
-GObexHeader *g_obex_header_new_bytes(guint8 id, const void *data, gsize len);
-GObexHeader *g_obex_header_new_uint8(guint8 id, guint8 val);
-GObexHeader *g_obex_header_new_uint32(guint8 id, guint32 val);
+GObexHeader *g_obex_header_new_unicode(uint8_t id, const char *str);
+GObexHeader *g_obex_header_new_bytes(uint8_t id, const void *data, gsize len);
+GObexHeader *g_obex_header_new_uint8(uint8_t id, uint8_t val);
+GObexHeader *g_obex_header_new_uint32(uint8_t id, uint32_t val);
GObexHeader *g_obex_header_new_apparam(GObexApparam *apparam);

-GSList *g_obex_header_create_list(guint8 first_hdr_id, va_list args,
+GSList *g_obex_header_create_list(uint8_t first_hdr_id, va_list args,
gsize *total_len);

-guint8 g_obex_header_get_id(GObexHeader *header);
-guint16 g_obex_header_get_length(GObexHeader *header);
+uint8_t g_obex_header_get_id(GObexHeader *header);
+uint16_t g_obex_header_get_length(GObexHeader *header);

gssize g_obex_header_encode(GObexHeader *header, void *buf, gsize buf_len);
GObexHeader *g_obex_header_decode(const void *data, gsize len,
diff --git a/gobex/gobex-packet.c b/gobex/gobex-packet.c
index 4c14cf7..911f1d4 100644
--- a/gobex/gobex-packet.c
+++ b/gobex/gobex-packet.c
@@ -24,6 +24,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <string.h>
#include <errno.h>

@@ -34,7 +35,7 @@
#define FINAL_BIT 0x80

struct _GObexPacket {
- guint8 opcode;
+ uint8_t opcode;
gboolean final;

GObexDataPolicy data_policy;
@@ -52,7 +53,7 @@ struct _GObexPacket {
gpointer get_body_data;
};

-GObexHeader *g_obex_packet_get_header(GObexPacket *pkt, guint8 id)
+GObexHeader *g_obex_packet_get_header(GObexPacket *pkt, uint8_t id)
{
GSList *l;

@@ -81,7 +82,7 @@ GObexHeader *g_obex_packet_get_body(GObexPacket *pkt)
return g_obex_packet_get_header(pkt, G_OBEX_HDR_BODY_END);
}

-guint8 g_obex_packet_get_operation(GObexPacket *pkt, gboolean *final)
+uint8_t g_obex_packet_get_operation(GObexPacket *pkt, gboolean *final)
{
g_obex_debug(G_OBEX_DEBUG_PACKET, "opcode 0x%02x", pkt->opcode);

@@ -125,7 +126,7 @@ gboolean g_obex_packet_add_body(GObexPacket *pkt, GObexDataProducer func,
return TRUE;
}

-gboolean g_obex_packet_add_unicode(GObexPacket *pkt, guint8 id,
+gboolean g_obex_packet_add_unicode(GObexPacket *pkt, uint8_t id,
const char *str)
{
GObexHeader *hdr;
@@ -139,7 +140,7 @@ gboolean g_obex_packet_add_unicode(GObexPacket *pkt, guint8 id,
return g_obex_packet_add_header(pkt, hdr);
}

-gboolean g_obex_packet_add_bytes(GObexPacket *pkt, guint8 id,
+gboolean g_obex_packet_add_bytes(GObexPacket *pkt, uint8_t id,
const void *data, gsize len)
{
GObexHeader *hdr;
@@ -153,7 +154,7 @@ gboolean g_obex_packet_add_bytes(GObexPacket *pkt, guint8 id,
return g_obex_packet_add_header(pkt, hdr);
}

-gboolean g_obex_packet_add_uint8(GObexPacket *pkt, guint8 id, guint8 val)
+gboolean g_obex_packet_add_uint8(GObexPacket *pkt, uint8_t id, uint8_t val)
{
GObexHeader *hdr;

@@ -166,7 +167,7 @@ gboolean g_obex_packet_add_uint8(GObexPacket *pkt, guint8 id, guint8 val)
return g_obex_packet_add_header(pkt, hdr);
}

-gboolean g_obex_packet_add_uint32(GObexPacket *pkt, guint8 id, guint32 val)
+gboolean g_obex_packet_add_uint32(GObexPacket *pkt, uint8_t id, uint32_t val)
{
GObexHeader *hdr;

@@ -227,8 +228,8 @@ gboolean g_obex_packet_set_data(GObexPacket *pkt, const void *data, gsize len,
return TRUE;
}

-GObexPacket *g_obex_packet_new_valist(guint8 opcode, gboolean final,
- guint8 first_hdr_id, va_list args)
+GObexPacket *g_obex_packet_new_valist(uint8_t opcode, gboolean final,
+ uint8_t first_hdr_id, va_list args)
{
GObexPacket *pkt;

@@ -245,8 +246,8 @@ GObexPacket *g_obex_packet_new_valist(guint8 opcode, gboolean final,
return pkt;
}

-GObexPacket *g_obex_packet_new(guint8 opcode, gboolean final,
- guint8 first_hdr_id, ...)
+GObexPacket *g_obex_packet_new(uint8_t opcode, gboolean final,
+ uint8_t first_hdr_id, ...)
{
GObexPacket *pkt;
va_list args;
@@ -282,7 +283,7 @@ static gboolean parse_headers(GObexPacket *pkt, const void *data, gsize len,
GObexDataPolicy data_policy,
GError **err)
{
- const guint8 *buf = data;
+ const uint8_t *buf = data;

g_obex_debug(G_OBEX_DEBUG_PACKET, "opcode 0x%02x", pkt->opcode);

@@ -305,7 +306,7 @@ static gboolean parse_headers(GObexPacket *pkt, const void *data, gsize len,
return TRUE;
}

-static const guint8 *get_bytes(void *to, const guint8 *from, gsize count)
+static const uint8_t *get_bytes(void *to, const uint8_t *from, gsize count)
{
memcpy(to, from, count);
return (from + count);
@@ -316,9 +317,9 @@ GObexPacket *g_obex_packet_decode(const void *data, gsize len,
GObexDataPolicy data_policy,
GError **err)
{
- const guint8 *buf = data;
- guint16 packet_len;
- guint8 opcode;
+ const uint8_t *buf = data;
+ uint16_t packet_len;
+ uint8_t opcode;
GObexPacket *pkt;
gboolean final;

@@ -373,9 +374,9 @@ failed:
return NULL;
}

-static gssize get_body(GObexPacket *pkt, guint8 *buf, gsize len)
+static gssize get_body(GObexPacket *pkt, uint8_t *buf, gsize len)
{
- guint16 u16;
+ uint16_t u16;
gssize ret;

g_obex_debug(G_OBEX_DEBUG_PACKET, "opcode 0x%02x", pkt->opcode);
@@ -398,11 +399,11 @@ static gssize get_body(GObexPacket *pkt, guint8 *buf, gsize len)
return ret;
}

-gssize g_obex_packet_encode(GObexPacket *pkt, guint8 *buf, gsize len)
+gssize g_obex_packet_encode(GObexPacket *pkt, uint8_t *buf, gsize len)
{
gssize ret;
gsize count;
- guint16 u16;
+ uint16_t u16;
GSList *l;

g_obex_debug(G_OBEX_DEBUG_PACKET, "opcode 0x%02x", pkt->opcode);
diff --git a/gobex/gobex-packet.h b/gobex/gobex-packet.h
index 6121fa7..66289f0 100644
--- a/gobex/gobex-packet.h
+++ b/gobex/gobex-packet.h
@@ -23,6 +23,7 @@
#ifndef __GOBEX_PACKET_H
#define __GOBEX_PACKET_H

+#include <inttypes.h>
#include <stdarg.h>
#include <glib.h>

@@ -81,32 +82,32 @@

typedef struct _GObexPacket GObexPacket;

-GObexHeader *g_obex_packet_get_header(GObexPacket *pkt, guint8 id);
+GObexHeader *g_obex_packet_get_header(GObexPacket *pkt, uint8_t id);
GObexHeader *g_obex_packet_get_body(GObexPacket *pkt);
-guint8 g_obex_packet_get_operation(GObexPacket *pkt, gboolean *final);
+uint8_t g_obex_packet_get_operation(GObexPacket *pkt, gboolean *final);
gboolean g_obex_packet_prepend_header(GObexPacket *pkt, GObexHeader *header);
gboolean g_obex_packet_add_header(GObexPacket *pkt, GObexHeader *header);
gboolean g_obex_packet_add_body(GObexPacket *pkt, GObexDataProducer func,
gpointer user_data);
-gboolean g_obex_packet_add_unicode(GObexPacket *pkt, guint8 id,
+gboolean g_obex_packet_add_unicode(GObexPacket *pkt, uint8_t id,
const char *str);
-gboolean g_obex_packet_add_bytes(GObexPacket *pkt, guint8 id,
+gboolean g_obex_packet_add_bytes(GObexPacket *pkt, uint8_t id,
const void *data, gsize len);
-gboolean g_obex_packet_add_uint8(GObexPacket *pkt, guint8 id, guint8 val);
-gboolean g_obex_packet_add_uint32(GObexPacket *pkt, guint8 id, guint32 val);
+gboolean g_obex_packet_add_uint8(GObexPacket *pkt, uint8_t id, uint8_t val);
+gboolean g_obex_packet_add_uint32(GObexPacket *pkt, uint8_t id, uint32_t val);
gboolean g_obex_packet_set_data(GObexPacket *pkt, const void *data, gsize len,
GObexDataPolicy data_policy);
const void *g_obex_packet_get_data(GObexPacket *pkt, gsize *len);
-GObexPacket *g_obex_packet_new(guint8 opcode, gboolean final,
- guint8 first_hdr_id, ...);
-GObexPacket *g_obex_packet_new_valist(guint8 opcode, gboolean final,
- guint8 first_hdr_id, va_list args);
+GObexPacket *g_obex_packet_new(uint8_t opcode, gboolean final,
+ uint8_t first_hdr_id, ...);
+GObexPacket *g_obex_packet_new_valist(uint8_t opcode, gboolean final,
+ uint8_t first_hdr_id, va_list args);
void g_obex_packet_free(GObexPacket *pkt);

GObexPacket *g_obex_packet_decode(const void *data, gsize len,
gsize header_offset,
GObexDataPolicy data_policy,
GError **err);
-gssize g_obex_packet_encode(GObexPacket *pkt, guint8 *buf, gsize len);
+gssize g_obex_packet_encode(GObexPacket *pkt, uint8_t *buf, gsize len);

#endif /* __GOBEX_PACKET_H */
diff --git a/gobex/gobex-transfer.c b/gobex/gobex-transfer.c
index ac8836c..4f3fb00 100644
--- a/gobex/gobex-transfer.c
+++ b/gobex/gobex-transfer.c
@@ -24,6 +24,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <string.h>
#include <errno.h>

@@ -38,16 +39,16 @@ static void transfer_response(GObex *obex, GError *err, GObexPacket *rsp,
gpointer user_data);

struct transfer {
- guint id;
- guint8 opcode;
+ unsigned int id;
+ uint8_t opcode;

GObex *obex;

- guint req_id;
+ unsigned int req_id;

- guint put_id;
- guint get_id;
- guint abort_id;
+ unsigned int put_id;
+ unsigned int get_id;
+ unsigned int abort_id;

GObexDataProducer data_producer;
GObexDataConsumer data_consumer;
@@ -81,7 +82,7 @@ static void transfer_free(struct transfer *transfer)
g_free(transfer);
}

-static struct transfer *find_transfer(guint id)
+static struct transfer *find_transfer(unsigned int id)
{
GSList *l;

@@ -96,7 +97,7 @@ static struct transfer *find_transfer(guint id)

static void transfer_complete(struct transfer *transfer, GError *err)
{
- guint id = transfer->id;
+ unsigned int id = transfer->id;

g_obex_debug(G_OBEX_DEBUG_TRANSFER, "transfer %u", id);

@@ -171,7 +172,7 @@ static gboolean handle_get_body(struct transfer *transfer, GObexPacket *rsp,
{
GObexHeader *body = g_obex_packet_get_body(rsp);
gboolean ret;
- const guint8 *buf;
+ const uint8_t *buf;
gsize len;

if (body == NULL)
@@ -243,10 +244,10 @@ failed:
}
}

-static struct transfer *transfer_new(GObex *obex, guint8 opcode,
+static struct transfer *transfer_new(GObex *obex, uint8_t opcode,
GObexFunc complete_func, gpointer user_data)
{
- static guint next_id = 1;
+ static unsigned int next_id = 1;
struct transfer *transfer;

g_obex_debug(G_OBEX_DEBUG_TRANSFER, "obex %p opcode %u", obex, opcode);
@@ -264,7 +265,7 @@ static struct transfer *transfer_new(GObex *obex, guint8 opcode,
return transfer;
}

-guint g_obex_put_req_pkt(GObex *obex, GObexPacket *req,
+unsigned int g_obex_put_req_pkt(GObex *obex, GObexPacket *req,
GObexDataProducer data_func, GObexFunc complete_func,
gpointer user_data, GError **err)
{
@@ -292,9 +293,9 @@ guint g_obex_put_req_pkt(GObex *obex, GObexPacket *req,
return transfer->id;
}

-guint g_obex_put_req(GObex *obex, GObexDataProducer data_func,
+unsigned int g_obex_put_req(GObex *obex, GObexDataProducer data_func,
GObexFunc complete_func, gpointer user_data,
- GError **err, guint8 first_hdr_id, ...)
+ GError **err, uint8_t first_hdr_id, ...)
{
GObexPacket *req;
va_list args;
@@ -327,12 +328,12 @@ static void transfer_abort_req(GObex *obex, GObexPacket *req, gpointer user_data
g_error_free(err);
}

-static guint8 put_get_bytes(struct transfer *transfer, GObexPacket *req)
+static uint8_t put_get_bytes(struct transfer *transfer, GObexPacket *req)
{
GObexHeader *body;
gboolean final;
- guint8 rsp;
- const guint8 *buf;
+ uint8_t rsp;
+ const uint8_t *buf;
gsize len;

g_obex_debug(G_OBEX_DEBUG_TRANSFER, "transfer %u", transfer->id);
@@ -358,11 +359,11 @@ static guint8 put_get_bytes(struct transfer *transfer, GObexPacket *req)
}

static void transfer_put_req_first(struct transfer *transfer, GObexPacket *req,
- guint8 first_hdr_id, va_list args)
+ uint8_t first_hdr_id, va_list args)
{
GError *err = NULL;
GObexPacket *rsp;
- guint8 rspcode;
+ uint8_t rspcode;

g_obex_debug(G_OBEX_DEBUG_TRANSFER, "transfer %u", transfer->id);

@@ -384,7 +385,7 @@ static void transfer_put_req(GObex *obex, GObexPacket *req, gpointer user_data)
struct transfer *transfer = user_data;
GError *err = NULL;
GObexPacket *rsp;
- guint8 rspcode;
+ uint8_t rspcode;

g_obex_debug(G_OBEX_DEBUG_TRANSFER, "transfer %u", transfer->id);

@@ -407,14 +408,14 @@ done:
transfer_complete(transfer, NULL);
}

-guint g_obex_put_rsp(GObex *obex, GObexPacket *req,
+unsigned int g_obex_put_rsp(GObex *obex, GObexPacket *req,
GObexDataConsumer data_func, GObexFunc complete_func,
gpointer user_data, GError **err,
- guint8 first_hdr_id, ...)
+ uint8_t first_hdr_id, ...)
{
struct transfer *transfer;
va_list args;
- guint id;
+ unsigned int id;

g_obex_debug(G_OBEX_DEBUG_TRANSFER, "obex %p", obex);

@@ -441,7 +442,7 @@ guint g_obex_put_rsp(GObex *obex, GObexPacket *req,
return transfer->id;
}

-guint g_obex_get_req_pkt(GObex *obex, GObexPacket *req,
+unsigned int g_obex_get_req_pkt(GObex *obex, GObexPacket *req,
GObexDataConsumer data_func, GObexFunc complete_func,
gpointer user_data, GError **err)
{
@@ -466,9 +467,9 @@ guint g_obex_get_req_pkt(GObex *obex, GObexPacket *req,
return transfer->id;
}

-guint g_obex_get_req(GObex *obex, GObexDataConsumer data_func,
+unsigned int g_obex_get_req(GObex *obex, GObexDataConsumer data_func,
GObexFunc complete_func, gpointer user_data,
- GError **err, guint8 first_hdr_id, ...)
+ GError **err, uint8_t first_hdr_id, ...)
{
struct transfer *transfer;
GObexPacket *req;
@@ -502,7 +503,7 @@ static gssize get_get_data(void *buf, gsize len, gpointer user_data)
GObexPacket *req, *rsp;
GError *err = NULL;
gssize ret;
- guint8 op;
+ uint8_t op;

g_obex_debug(G_OBEX_DEBUG_TRANSFER, "transfer %u", transfer->id);

@@ -577,12 +578,12 @@ static void transfer_get_req(GObex *obex, GObexPacket *req, gpointer user_data)
}
}

-guint g_obex_get_rsp_pkt(GObex *obex, GObexPacket *rsp,
+unsigned int g_obex_get_rsp_pkt(GObex *obex, GObexPacket *rsp,
GObexDataProducer data_func, GObexFunc complete_func,
gpointer user_data, GError **err)
{
struct transfer *transfer;
- guint id;
+ unsigned int id;

g_obex_debug(G_OBEX_DEBUG_TRANSFER, "obex %p", obex);

@@ -607,9 +608,9 @@ guint g_obex_get_rsp_pkt(GObex *obex, GObexPacket *rsp,
return transfer->id;
}

-guint g_obex_get_rsp(GObex *obex, GObexDataProducer data_func,
+unsigned int g_obex_get_rsp(GObex *obex, GObexDataProducer data_func,
GObexFunc complete_func, gpointer user_data,
- GError **err, guint8 first_hdr_id, ...)
+ GError **err, uint8_t first_hdr_id, ...)
{
GObexPacket *rsp;
va_list args;
@@ -625,7 +626,7 @@ guint g_obex_get_rsp(GObex *obex, GObexDataProducer data_func,
user_data, err);
}

-gboolean g_obex_cancel_transfer(guint id, GObexFunc complete_func,
+gboolean g_obex_cancel_transfer(unsigned int id, GObexFunc complete_func,
gpointer user_data)
{
struct transfer *transfer = NULL;
diff --git a/gobex/gobex.c b/gobex/gobex.c
index deeab40..9bf2398 100644
--- a/gobex/gobex.c
+++ b/gobex/gobex.c
@@ -24,6 +24,7 @@
# include "config.h"
#endif

+#include <inttypes.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
@@ -44,30 +45,30 @@

#define CONNID_INVALID 0xffffffff

-guint gobex_debug = 0;
+unsigned int gobex_debug = 0;

struct srm_config {
- guint8 op;
+ uint8_t op;
gboolean enabled;
- guint8 srm;
- guint8 srmp;
+ uint8_t srm;
+ uint8_t srmp;
gboolean outgoing;
};

struct _GObex {
int ref_count;
GIOChannel *io;
- guint io_source;
+ unsigned int io_source;

gboolean (*read) (GObex *obex, GError **err);
gboolean (*write) (GObex *obex, GError **err);

- guint8 *rx_buf;
+ uint8_t *rx_buf;
size_t rx_data;
- guint16 rx_pkt_len;
- guint8 rx_last_op;
+ uint16_t rx_pkt_len;
+ uint8_t rx_last_op;

- guint8 *tx_buf;
+ uint8_t *tx_buf;
size_t tx_data;
size_t tx_sent;

@@ -76,15 +77,15 @@ struct _GObex {

struct srm_config *srm;

- guint write_source;
+ unsigned int write_source;

gssize io_rx_mtu;
gssize io_tx_mtu;

- guint16 rx_mtu;
- guint16 tx_mtu;
+ uint16_t rx_mtu;
+ uint16_t tx_mtu;

- guint32 conn_id;
+ uint32_t conn_id;

GQueue *tx_queue;

@@ -97,36 +98,36 @@ struct _GObex {
};

struct pending_pkt {
- guint id;
+ unsigned int id;
GObex *obex;
GObexPacket *pkt;
- guint timeout;
- guint timeout_id;
+ unsigned int timeout;
+ unsigned int timeout_id;
GObexResponseFunc rsp_func;
gpointer rsp_data;
gboolean cancelled;
};

struct req_handler {
- guint id;
- guint8 opcode;
+ unsigned int id;
+ uint8_t opcode;
GObexRequestFunc func;
gpointer user_data;
};

struct connect_data {
- guint8 version;
- guint8 flags;
- guint16 mtu;
+ uint8_t version;
+ uint8_t flags;
+ uint16_t mtu;
} __attribute__ ((packed));

struct setpath_data {
- guint8 flags;
- guint8 constants;
+ uint8_t flags;
+ uint8_t constants;
} __attribute__ ((packed));

static struct error_code {
- guint8 code;
+ uint8_t code;
const char *name;
} obex_errors[] = {
{ G_OBEX_RSP_CONTINUE, "Continue" },
@@ -170,7 +171,7 @@ static struct error_code {
{ 0x00, NULL }
};

-const char *g_obex_strerror(guint8 err_code)
+const char *g_obex_strerror(uint8_t err_code)
{
struct error_code *error;

@@ -182,7 +183,7 @@ const char *g_obex_strerror(guint8 err_code)
return "<unknown>";
}

-static ssize_t req_header_offset(guint8 opcode)
+static ssize_t req_header_offset(uint8_t opcode)
{
switch (opcode) {
case G_OBEX_OP_CONNECT:
@@ -201,7 +202,7 @@ static ssize_t req_header_offset(guint8 opcode)
}
}

-static ssize_t rsp_header_offset(guint8 opcode)
+static ssize_t rsp_header_offset(uint8_t opcode)
{
switch (opcode) {
case G_OBEX_OP_CONNECT:
@@ -299,7 +300,7 @@ static gboolean write_packet(GObex *obex, GError **err)
return TRUE;
}

-static void set_srmp(GObex *obex, guint8 srmp, gboolean outgoing)
+static void set_srmp(GObex *obex, uint8_t srmp, gboolean outgoing)
{
struct srm_config *config = obex->srm;

@@ -314,7 +315,7 @@ static void set_srmp(GObex *obex, guint8 srmp, gboolean outgoing)
config->outgoing = outgoing;
}

-static void set_srm(GObex *obex, guint8 op, guint8 srm)
+static void set_srm(GObex *obex, uint8_t op, uint8_t srm)
{
struct srm_config *config = obex->srm;
gboolean enable;
@@ -355,7 +356,7 @@ done:
obex->srm = NULL;
}

-static void check_srm_final(GObex *obex, guint8 op)
+static void check_srm_final(GObex *obex, uint8_t op)
{
if (obex->srm == NULL || !obex->srm->enabled)
return;
@@ -374,7 +375,7 @@ static void check_srm_final(GObex *obex, guint8 op)
static void setup_srm(GObex *obex, GObexPacket *pkt, gboolean outgoing)
{
GObexHeader *hdr;
- guint8 op;
+ uint8_t op;
gboolean final;

if (!obex->use_srm)
@@ -384,7 +385,7 @@ static void setup_srm(GObex *obex, GObexPacket *pkt, gboolean outgoing)

hdr = g_obex_packet_get_header(pkt, G_OBEX_HDR_SRM);
if (hdr != NULL) {
- guint8 srm;
+ uint8_t srm;
g_obex_header_get_uint8(hdr, &srm);
g_obex_debug(G_OBEX_DEBUG_COMMAND, "srm 0x%02x", srm);
set_srm(obex, op, srm);
@@ -392,7 +393,7 @@ static void setup_srm(GObex *obex, GObexPacket *pkt, gboolean outgoing)

hdr = g_obex_packet_get_header(pkt, G_OBEX_HDR_SRMP);
if (hdr != NULL) {
- guint8 srmp;
+ uint8_t srmp;
g_obex_header_get_uint8(hdr, &srmp);
g_obex_debug(G_OBEX_DEBUG_COMMAND, "srmp 0x%02x", srmp);
set_srmp(obex, srmp, outgoing);
@@ -520,7 +521,7 @@ static gboolean g_obex_send_internal(GObex *obex, struct pending_pkt *p,

static void init_connect_data(GObex *obex, struct connect_data *data)
{
- guint16 u16;
+ uint16_t u16;

memset(data, 0, sizeof(*data));

@@ -535,7 +536,7 @@ static void prepare_connect_rsp(GObex *obex, GObexPacket *rsp)
{
GObexHeader *connid;
struct connect_data data;
- static guint32 next_connid = 1;
+ static uint32_t next_connid = 1;

init_connect_data(obex, &data);
g_obex_packet_set_data(rsp, &data, sizeof(data), G_OBEX_DATA_COPY);
@@ -623,14 +624,14 @@ static void prepare_srm_req(GObex *obex, GObexPacket *pkt)
g_obex_packet_prepend_header(pkt, hdr);
}

-guint g_obex_send_req(GObex *obex, GObexPacket *req, int timeout,
+unsigned int g_obex_send_req(GObex *obex, GObexPacket *req, int timeout,
GObexResponseFunc func, gpointer user_data,
GError **err)
{
GObexHeader *hdr;
struct pending_pkt *p;
- static guint id = 1;
- guint8 op;
+ static unsigned int id = 1;
+ uint8_t op;

g_obex_debug(G_OBEX_DEBUG_COMMAND, "conn %u", obex->conn_id);

@@ -680,7 +681,7 @@ create_pending:
static int pending_pkt_cmp(gconstpointer a, gconstpointer b)
{
const struct pending_pkt *p = a;
- guint id = GPOINTER_TO_UINT(b);
+ unsigned int id = GPOINTER_TO_UINT(b);

return (p->id - id);
}
@@ -723,7 +724,8 @@ static gboolean cancel_complete(gpointer user_data)
return FALSE;
}

-gboolean g_obex_cancel_req(GObex *obex, guint req_id, gboolean remove_callback)
+gboolean g_obex_cancel_req(GObex *obex, unsigned int req_id,
+ gboolean remove_callback)
{
GList *match;
struct pending_pkt *p;
@@ -762,8 +764,8 @@ immediate_completion:
return TRUE;
}

-gboolean g_obex_send_rsp(GObex *obex, guint8 rspcode, GError **err,
- guint8 first_hdr_type, ...)
+gboolean g_obex_send_rsp(GObex *obex, uint8_t rspcode, GError **err,
+ uint8_t first_hdr_type, ...)
{
GObexPacket *rsp;
va_list args;
@@ -785,7 +787,7 @@ void g_obex_set_disconnect_function(GObex *obex, GObexFunc func,
static int req_handler_cmpop(gconstpointer a, gconstpointer b)
{
const struct req_handler *handler = a;
- guint opcode = GPOINTER_TO_UINT(b);
+ unsigned int opcode = GPOINTER_TO_UINT(b);

return (int) handler->opcode - (int) opcode;
}
@@ -793,17 +795,17 @@ static int req_handler_cmpop(gconstpointer a, gconstpointer b)
static int req_handler_cmpid(gconstpointer a, gconstpointer b)
{
const struct req_handler *handler = a;
- guint id = GPOINTER_TO_UINT(b);
+ unsigned int id = GPOINTER_TO_UINT(b);

return (int) handler->id - (int) id;
}

-guint g_obex_add_request_function(GObex *obex, guint8 opcode,
+unsigned int g_obex_add_request_function(GObex *obex, uint8_t opcode,
GObexRequestFunc func,
gpointer user_data)
{
struct req_handler *handler;
- static guint next_id = 1;
+ static unsigned int next_id = 1;

handler = g_new0(struct req_handler, 1);
handler->id = next_id++;
@@ -816,7 +818,7 @@ guint g_obex_add_request_function(GObex *obex, guint8 opcode,
return handler->id;
}

-gboolean g_obex_remove_request_function(GObex *obex, guint id)
+gboolean g_obex_remove_request_function(GObex *obex, unsigned int id)
{
struct req_handler *handler;
GSList *match;
@@ -879,7 +881,7 @@ static void parse_connect_data(GObex *obex, GObexPacket *pkt)
{
const struct connect_data *data;
GObexHeader *connid;
- guint16 u16;
+ uint16_t u16;
size_t data_len;

data = g_obex_packet_get_data(pkt, &data_len);
@@ -901,7 +903,7 @@ static void parse_connect_data(GObex *obex, GObexPacket *pkt)
static gboolean parse_response(GObex *obex, GObexPacket *rsp)
{
struct pending_pkt *p = obex->pending_req;
- guint8 opcode, rspcode;
+ uint8_t opcode, rspcode;
gboolean final;

rspcode = g_obex_packet_get_operation(rsp, &final);
@@ -968,7 +970,7 @@ static void handle_response(GObex *obex, GError *err, GObexPacket *rsp)
static gboolean check_connid(GObex *obex, GObexPacket *pkt)
{
GObexHeader *hdr;
- guint32 id;
+ uint32_t id;

if (obex->conn_id == CONNID_INVALID)
return TRUE;
@@ -984,7 +986,7 @@ static gboolean check_connid(GObex *obex, GObexPacket *pkt)

static int parse_request(GObex *obex, GObexPacket *req)
{
- guint8 op;
+ uint8_t op;
gboolean final;

op = g_obex_packet_get_operation(req, &final);
@@ -1035,7 +1037,7 @@ static gboolean read_stream(GObex *obex, GError **err)
GIOChannel *io = obex->io;
GIOStatus status;
gsize rbytes, toread;
- guint16 u16;
+ uint16_t u16;
char *buf;

if (obex->rx_data >= 3)
@@ -1090,7 +1092,7 @@ static gboolean read_packet(GObex *obex, GError **err)
GError *read_err = NULL;
GIOStatus status;
gsize rbytes;
- guint16 u16;
+ uint16_t u16;

if (obex->rx_data > 0) {
g_set_error(err, G_OBEX_ERROR, G_OBEX_ERROR_PARSE_ERROR,
@@ -1140,7 +1142,7 @@ static gboolean incoming_data(GIOChannel *io, GIOCondition cond,
GObexPacket *pkt;
ssize_t header_offset;
GError *err = NULL;
- guint8 opcode;
+ uint8_t opcode;

if (cond & G_IO_NVAL)
return FALSE;
@@ -1364,8 +1366,9 @@ void g_obex_unref(GObex *obex)

/* Higher level functions */

-guint g_obex_connect(GObex *obex, GObexResponseFunc func, gpointer user_data,
- GError **err, guint8 first_hdr_id, ...)
+unsigned int g_obex_connect(GObex *obex, GObexResponseFunc func,
+ gpointer user_data, GError **err,
+ uint8_t first_hdr_id, ...)
{
GObexPacket *req;
struct connect_data data;
@@ -1384,8 +1387,9 @@ guint g_obex_connect(GObex *obex, GObexResponseFunc func, gpointer user_data,
return g_obex_send_req(obex, req, -1, func, user_data, err);
}

-guint g_obex_setpath(GObex *obex, const char *path, GObexResponseFunc func,
- gpointer user_data, GError **err)
+unsigned int g_obex_setpath(GObex *obex, const char *path,
+ GObexResponseFunc func, gpointer user_data,
+ GError **err)
{
GObexPacket *req;
struct setpath_data data;
@@ -1416,7 +1420,7 @@ guint g_obex_setpath(GObex *obex, const char *path, GObexResponseFunc func,
return g_obex_send_req(obex, req, -1, func, user_data, err);
}

-guint g_obex_mkdir(GObex *obex, const char *path, GObexResponseFunc func,
+unsigned int g_obex_mkdir(GObex *obex, const char *path, GObexResponseFunc func,
gpointer user_data, GError **err)
{
GObexPacket *req;
@@ -1433,8 +1437,9 @@ guint g_obex_mkdir(GObex *obex, const char *path, GObexResponseFunc func,
return g_obex_send_req(obex, req, -1, func, user_data, err);
}

-guint g_obex_delete(GObex *obex, const char *name, GObexResponseFunc func,
- gpointer user_data, GError **err)
+unsigned int g_obex_delete(GObex *obex, const char *name,
+ GObexResponseFunc func, gpointer user_data,
+ GError **err)
{
GObexPacket *req;

@@ -1446,7 +1451,7 @@ guint g_obex_delete(GObex *obex, const char *name, GObexResponseFunc func,
return g_obex_send_req(obex, req, -1, func, user_data, err);
}

-guint g_obex_copy(GObex *obex, const char *name, const char *dest,
+unsigned int g_obex_copy(GObex *obex, const char *name, const char *dest,
GObexResponseFunc func, gpointer user_data,
GError **err)
{
@@ -1463,7 +1468,7 @@ guint g_obex_copy(GObex *obex, const char *name, const char *dest,
return g_obex_send_req(obex, req, -1, func, user_data, err);
}

-guint g_obex_move(GObex *obex, const char *name, const char *dest,
+unsigned int g_obex_move(GObex *obex, const char *name, const char *dest,
GObexResponseFunc func, gpointer user_data,
GError **err)
{
@@ -1480,7 +1485,7 @@ guint g_obex_move(GObex *obex, const char *name, const char *dest,
return g_obex_send_req(obex, req, -1, func, user_data, err);
}

-guint8 g_obex_errno_to_rsp(int err)
+uint8_t g_obex_errno_to_rsp(int err)
{
switch (err) {
case 0:
diff --git a/gobex/gobex.h b/gobex/gobex.h
index 3ac7b13..8491193 100644
--- a/gobex/gobex.h
+++ b/gobex/gobex.h
@@ -23,6 +23,7 @@
#ifndef __GOBEX_H
#define __GOBEX_H

+#include <inttypes.h>
#include <stdarg.h>
#include <glib.h>

@@ -44,23 +45,23 @@ typedef void (*GObexResponseFunc) (GObex *obex, GError *err, GObexPacket *rsp,

gboolean g_obex_send(GObex *obex, GObexPacket *pkt, GError **err);

-guint g_obex_send_req(GObex *obex, GObexPacket *req, int timeout,
+unsigned int g_obex_send_req(GObex *obex, GObexPacket *req, int timeout,
GObexResponseFunc func, gpointer user_data,
GError **err);
-gboolean g_obex_cancel_req(GObex *obex, guint req_id,
+gboolean g_obex_cancel_req(GObex *obex, unsigned int req_id,
gboolean remove_callback);

gboolean g_obex_pending_req_abort(GObex *obex, GError **err);

-gboolean g_obex_send_rsp(GObex *obex, guint8 rspcode, GError **err,
- guint8 first_hdr_type, ...);
+gboolean g_obex_send_rsp(GObex *obex, uint8_t rspcode, GError **err,
+ uint8_t first_hdr_type, ...);

void g_obex_set_disconnect_function(GObex *obex, GObexFunc func,
gpointer user_data);
-guint g_obex_add_request_function(GObex *obex, guint8 opcode,
+unsigned int g_obex_add_request_function(GObex *obex, uint8_t opcode,
GObexRequestFunc func,
gpointer user_data);
-gboolean g_obex_remove_request_function(GObex *obex, guint id);
+gboolean g_obex_remove_request_function(GObex *obex, unsigned int id);

void g_obex_suspend(GObex *obex);
void g_obex_resume(GObex *obex);
@@ -74,61 +75,65 @@ void g_obex_unref(GObex *obex);

/* High level client functions */

-guint g_obex_connect(GObex *obex, GObexResponseFunc func, gpointer user_data,
- GError **err, guint8 first_hdr_id, ...);
+unsigned int g_obex_connect(GObex *obex, GObexResponseFunc func,
+ gpointer user_data, GError **err,
+ uint8_t first_hdr_id, ...);

-guint g_obex_setpath(GObex *obex, const char *path, GObexResponseFunc func,
+unsigned int g_obex_setpath(GObex *obex, const char *path,
+ GObexResponseFunc func,
gpointer user_data, GError **err);

-guint g_obex_mkdir(GObex *obex, const char *path, GObexResponseFunc func,
+unsigned int g_obex_mkdir(GObex *obex, const char *path,
+ GObexResponseFunc func,
gpointer user_data, GError **err);

-guint g_obex_delete(GObex *obex, const char *name, GObexResponseFunc func,
+unsigned int g_obex_delete(GObex *obex, const char *name,
+ GObexResponseFunc func,
gpointer user_data, GError **err);

-guint g_obex_copy(GObex *obex, const char *name, const char *dest,
+unsigned int g_obex_copy(GObex *obex, const char *name, const char *dest,
GObexResponseFunc func, gpointer user_data,
GError **err);

-guint g_obex_move(GObex *obex, const char *name, const char *dest,
+unsigned int g_obex_move(GObex *obex, const char *name, const char *dest,
GObexResponseFunc func, gpointer user_data,
GError **err);

/* Transfer related high-level functions */

-guint g_obex_put_req(GObex *obex, GObexDataProducer data_func,
+unsigned int g_obex_put_req(GObex *obex, GObexDataProducer data_func,
GObexFunc complete_func, gpointer user_data,
- GError **err, guint8 first_hdr_id, ...);
+ GError **err, uint8_t first_hdr_id, ...);

-guint g_obex_put_req_pkt(GObex *obex, GObexPacket *req,
+unsigned int g_obex_put_req_pkt(GObex *obex, GObexPacket *req,
GObexDataProducer data_func, GObexFunc complete_func,
gpointer user_data, GError **err);

-guint g_obex_get_req(GObex *obex, GObexDataConsumer data_func,
+unsigned int g_obex_get_req(GObex *obex, GObexDataConsumer data_func,
GObexFunc complete_func, gpointer user_data,
- GError **err, guint8 first_hdr_id, ...);
+ GError **err, uint8_t first_hdr_id, ...);

-guint g_obex_get_req_pkt(GObex *obex, GObexPacket *req,
+unsigned int g_obex_get_req_pkt(GObex *obex, GObexPacket *req,
GObexDataConsumer data_func, GObexFunc complete_func,
gpointer user_data, GError **err);

-guint g_obex_put_rsp(GObex *obex, GObexPacket *req,
+unsigned int g_obex_put_rsp(GObex *obex, GObexPacket *req,
GObexDataConsumer data_func, GObexFunc complete_func,
gpointer user_data, GError **err,
- guint8 first_hdr_id, ...);
+ uint8_t first_hdr_id, ...);

-guint g_obex_get_rsp(GObex *obex, GObexDataProducer data_func,
+unsigned int g_obex_get_rsp(GObex *obex, GObexDataProducer data_func,
GObexFunc complete_func, gpointer user_data,
- GError **err, guint8 first_hdr_id, ...);
+ GError **err, uint8_t first_hdr_id, ...);

-guint g_obex_get_rsp_pkt(GObex *obex, GObexPacket *rsp,
+unsigned int g_obex_get_rsp_pkt(GObex *obex, GObexPacket *rsp,
GObexDataProducer data_func, GObexFunc complete_func,
gpointer user_data, GError **err);

-gboolean g_obex_cancel_transfer(guint id, GObexFunc complete_func,
+gboolean g_obex_cancel_transfer(unsigned int id, GObexFunc complete_func,
gpointer user_data);

-const char *g_obex_strerror(guint8 err_code);
-guint8 g_obex_errno_to_rsp(int err);
+const char *g_obex_strerror(uint8_t err_code);
+uint8_t g_obex_errno_to_rsp(int err);

#endif /* __GOBEX_H */
--
1.8.2.2


2013-05-09 04:16:34

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 04/26] client: Get rid of guint* types

guint -> unsigned int
guint8 -> uint8_t
guint16 -> uint16_t
guint32 -> uint32_t
guint64 -> uint64_t

Add "#include <inttypes.h>" where appropriate.
---
client/main.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/client/main.c b/client/main.c
index b0a66d8..79660a7 100644
--- a/client/main.c
+++ b/client/main.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif

+#include <inttypes.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
@@ -1204,10 +1205,10 @@ static gboolean input_handler(GIOChannel *channel, GIOCondition condition,
return TRUE;
}

-static guint setup_standard_input(void)
+static unsigned int setup_standard_input(void)
{
GIOChannel *channel;
- guint source;
+ unsigned int source;

channel = g_io_channel_unix_new(fileno(stdin));

@@ -1260,10 +1261,10 @@ static gboolean signal_handler(GIOChannel *channel, GIOCondition condition,
return TRUE;
}

-static guint setup_signalfd(void)
+static unsigned int setup_signalfd(void)
{
GIOChannel *channel;
- guint source;
+ unsigned int source;
sigset_t mask;
int fd;

@@ -1324,7 +1325,7 @@ int main(int argc, char *argv[])
GOptionContext *context;
GError *error = NULL;
GDBusClient *client;
- guint signal, input;
+ unsigned int signal, input;

context = g_option_context_new(NULL);
g_option_context_add_main_entries(context, options, NULL);
--
1.8.2.2


2013-05-09 04:16:32

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ 02/26] obexd: Get rid of gint64

From: Lucas De Marchi <[email protected]>

Use C99's int64_t.
---
obexd/client/transfer.c | 8 ++++----
obexd/client/transfer.h | 3 ++-
2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/obexd/client/transfer.c b/obexd/client/transfer.c
index 4b1def3..ac0909d 100644
--- a/obexd/client/transfer.c
+++ b/obexd/client/transfer.c
@@ -80,9 +80,9 @@ struct obc_transfer {
char *type; /* Transfer object type */
int fd;
guint xfer;
- gint64 size;
- gint64 transferred;
- gint64 progress;
+ int64_t size;
+ int64_t transferred;
+ int64_t progress;
guint progress_id;
};

@@ -850,7 +850,7 @@ const char *obc_transfer_get_path(struct obc_transfer *transfer)
return transfer->path;
}

-gint64 obc_transfer_get_size(struct obc_transfer *transfer)
+int64_t obc_transfer_get_size(struct obc_transfer *transfer)
{
return transfer->size;
}
diff --git a/obexd/client/transfer.h b/obexd/client/transfer.h
index 0d54733..474900b 100644
--- a/obexd/client/transfer.h
+++ b/obexd/client/transfer.h
@@ -24,6 +24,7 @@

#include <dbus/dbus.h>
#include <glib.h>
+#include <inttypes.h>
#include <stdlib.h>

struct obc_transfer;
@@ -60,7 +61,7 @@ int obc_transfer_get_contents(struct obc_transfer *transfer, char **contents,
size_t *size);

const char *obc_transfer_get_path(struct obc_transfer *transfer);
-gint64 obc_transfer_get_size(struct obc_transfer *transfer);
+int64_t obc_transfer_get_size(struct obc_transfer *transfer);

DBusMessage *obc_transfer_create_dbus_reply(struct obc_transfer *transfer,
DBusMessage *message);
--
1.8.2.2