All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH obexd v1 1/4] build: BlueZ version 4.100 or later is required
@ 2012-08-22 16:35 Syam Sidhardhan
  2012-08-22 16:35 ` [PATCH obexd v1 2/4] build: Require GLib 2.32 or later Syam Sidhardhan
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Syam Sidhardhan @ 2012-08-22 16:35 UTC (permalink / raw)
  To: linux-bluetooth

If we use the BlueZ version less than 4.100, then the following
compilation error happens.

Error:
======
btio/btio.c: In function ‘l2cap_connect’:
btio/btio.c:301:6: error: ‘struct sockaddr_l2’ has no member named
 ‘l2_bdaddr_type’
btio/btio.c: In function ‘parse_set_opts’:
btio/btio.c:707:19: error: ‘BDADDR_BREDR’ undeclared (first use in
 this function)
btio/btio.c:707:19: note: each undeclared identifier is reported only
 once for each function it appears in
make[1]: *** [btio/btio.o] Error 1
make: *** [all] Error 2
---

 configure.ac |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 69d71b2..c8e61ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,8 +79,8 @@ PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.4, dummy=yes,
 AC_SUBST(DBUS_CFLAGS)
 AC_SUBST(DBUS_LIBS)
 
-PKG_CHECK_MODULES(BLUEZ, bluez >= 4.99, dummy=yes,
-				AC_MSG_ERROR(BlueZ >= 4.99 is required))
+PKG_CHECK_MODULES(BLUEZ, bluez >= 4.100, dummy=yes,
+				AC_MSG_ERROR(BlueZ >= 4.100 is required))
 AC_SUBST(BLUEZ_CFLAGS)
 AC_SUBST(BLUEZ_LIBS)
 
-- 
1.7.4.1


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

* [PATCH obexd v1 2/4] build: Require GLib 2.32 or later
  2012-08-22 16:35 [PATCH obexd v1 1/4] build: BlueZ version 4.100 or later is required Syam Sidhardhan
@ 2012-08-22 16:35 ` Syam Sidhardhan
  2012-08-22 22:27   ` Luiz Augusto von Dentz
  2012-08-22 16:35 ` [PATCH obexd v1 3/4] plugins: Remove redundant include sys/stat.h Syam Sidhardhan
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Syam Sidhardhan @ 2012-08-22 16:35 UTC (permalink / raw)
  To: linux-bluetooth

If we use GLib version less than 2.32 (more precisely < 2.31.2) then
the following build error may occure in a 32 bit.

cc1: warnings being treated as errors
gobex/gobex-apparam.c: In function ‘g_obex_apparam_set_bytes’:
gobex/gobex-apparam.c:176:38: error: cast to pointer from integer of
different size
gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_uint8’:
gobex/gobex-apparam.c:243:43: error: cast to pointer from integer of
different size
gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_uint16’:
gobex/gobex-apparam.c:261:43: error: cast to pointer from integer of
different size
gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_uint32’:
gobex/gobex-apparam.c:282:43: error: cast to pointer from integer of
different size
gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_uint64’:
gobex/gobex-apparam.c:303:43: error: cast to pointer from integer of
different size
gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_string’:
gobex/gobex-apparam.c:324:43: error: cast to pointer from integer of
different size
gobex/gobex-apparam.c: In function ‘g_obex_apparam_get_bytes’:
gobex/gobex-apparam.c:342:43: error: cast to pointer from integer of
different size
make[1]: *** [gobex/gobex-apparam.o] Error 1
make: *** [all] Error 2
---

Reference:
GLib tree: Commit: 16292dd753cb63f8ccb2267644aefbd2632dd52c
Author: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Date:   Thu Oct 6 11:18:03 2011 -0300
	Fix G*_TO_POINTER casts on 32 bits

	If we don't do the cast to the proper size in 32 bits, things like below
	doesn't work:

	uint8_t u = 20;

	void *p;

	p = GUINT_TO_POINTER(u);

	Signed-off-by: Colin Walters <walters@verbum.org>


Thanks Luiz for giving this reference.

Btb I'm not very sure, is this the best way to solve this problem.

 configure.ac |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index c8e61ac..78da420 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,8 +69,8 @@ fi
 AC_CHECK_LIB(dl, dlopen, dummy=yes,
 			AC_MSG_ERROR(dynamic linking loader is required))
 
-PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.28, dummy=yes,
-				AC_MSG_ERROR(GLib >= 2.28 is required))
+PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.32, dummy=yes,
+				AC_MSG_ERROR(GLib >= 2.32 is required))
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)
 
-- 
1.7.4.1


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

* [PATCH obexd v1 3/4] plugins: Remove redundant include sys/stat.h
  2012-08-22 16:35 [PATCH obexd v1 1/4] build: BlueZ version 4.100 or later is required Syam Sidhardhan
  2012-08-22 16:35 ` [PATCH obexd v1 2/4] build: Require GLib 2.32 or later Syam Sidhardhan
@ 2012-08-22 16:35 ` Syam Sidhardhan
  2012-08-22 16:35 ` [PATCH obexd v1 4/4] core: Remove redundant include errno.h Syam Sidhardhan
  2012-08-23 14:04 ` [PATCH obexd v1 1/4] build: BlueZ version 4.100 or later is required Luiz Augusto von Dentz
  3 siblings, 0 replies; 12+ messages in thread
From: Syam Sidhardhan @ 2012-08-22 16:35 UTC (permalink / raw)
  To: linux-bluetooth

---
v1 => Corrected commit message typo

 plugins/filesystem.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/plugins/filesystem.c b/plugins/filesystem.c
index e664fc5..1132a34 100644
--- a/plugins/filesystem.c
+++ b/plugins/filesystem.c
@@ -32,7 +32,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <dirent.h>
-#include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/statvfs.h>
-- 
1.7.4.1


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

* [PATCH obexd v1 4/4] core: Remove redundant include errno.h
  2012-08-22 16:35 [PATCH obexd v1 1/4] build: BlueZ version 4.100 or later is required Syam Sidhardhan
  2012-08-22 16:35 ` [PATCH obexd v1 2/4] build: Require GLib 2.32 or later Syam Sidhardhan
  2012-08-22 16:35 ` [PATCH obexd v1 3/4] plugins: Remove redundant include sys/stat.h Syam Sidhardhan
@ 2012-08-22 16:35 ` Syam Sidhardhan
  2012-08-23 14:04 ` [PATCH obexd v1 1/4] build: BlueZ version 4.100 or later is required Luiz Augusto von Dentz
  3 siblings, 0 replies; 12+ messages in thread
From: Syam Sidhardhan @ 2012-08-22 16:35 UTC (permalink / raw)
  To: linux-bluetooth

---
v1 => Corrected commit message typo

 src/server.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/server.c b/src/server.c
index 52f7f1e..16be849 100644
--- a/src/server.c
+++ b/src/server.c
@@ -31,7 +31,6 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <errno.h>
 #include <string.h>
 #include <inttypes.h>
 
-- 
1.7.4.1


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

* Re: [PATCH obexd v1 2/4] build: Require GLib 2.32 or later
  2012-08-22 16:35 ` [PATCH obexd v1 2/4] build: Require GLib 2.32 or later Syam Sidhardhan
@ 2012-08-22 22:27   ` Luiz Augusto von Dentz
  2012-08-22 22:36     ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 12+ messages in thread
From: Luiz Augusto von Dentz @ 2012-08-22 22:27 UTC (permalink / raw)
  To: Syam Sidhardhan; +Cc: linux-bluetooth

Hi Syam,

On Wed, Aug 22, 2012 at 7:35 PM, Syam Sidhardhan <s.syam@samsung.com> wrote:
> If we use GLib version less than 2.32 (more precisely < 2.31.2) then
> the following build error may occure in a 32 bit.

We had the issue with BlueZ but we did not bump the glib version,
which makes me wonder if you are able to compile bluetoothd?

-- 
Luiz Augusto von Dentz

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

* Re: [PATCH obexd v1 2/4] build: Require GLib 2.32 or later
  2012-08-22 22:27   ` Luiz Augusto von Dentz
@ 2012-08-22 22:36     ` Luiz Augusto von Dentz
  2012-08-24  9:45       ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 12+ messages in thread
From: Luiz Augusto von Dentz @ 2012-08-22 22:36 UTC (permalink / raw)
  To: Syam Sidhardhan; +Cc: linux-bluetooth

Hi Syam,

On Thu, Aug 23, 2012 at 1:27 AM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> Hi Syam,
>
> On Wed, Aug 22, 2012 at 7:35 PM, Syam Sidhardhan <s.syam@samsung.com> wrote:
>> If we use GLib version less than 2.32 (more precisely < 2.31.2) then
>> the following build error may occure in a 32 bit.
>
> We had the issue with BlueZ but we did not bump the glib version,
> which makes me wonder if you are able to compile bluetoothd?

It looks like we fix it with use of a variable:

 commit e34836262ba6a46491b6a760520158d70e8b51b5
Author: Johan Hedberg <johan.hedberg@intel.com>
Date:   Wed Oct 12 00:48:59 2011 +0300

    Fix compilation error on 32-bit systems

    This fixes the following compilation error with GLib on 32-bit sytems:

    audio/media.c: In function 'get_setting':
    audio/media.c:1109:44: error: cast to pointer from integer of
different size [-Werror=int-to-pointer-cast]
    audio/media.c: In function 'set_setting':
    audio/media.c:1132:41: error: cast to pointer from integer of
different size [-Werror=int-to-pointer-cast]


-- 
Luiz Augusto von Dentz

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

* Re: [PATCH obexd v1 1/4] build: BlueZ version 4.100 or later is required
  2012-08-22 16:35 [PATCH obexd v1 1/4] build: BlueZ version 4.100 or later is required Syam Sidhardhan
                   ` (2 preceding siblings ...)
  2012-08-22 16:35 ` [PATCH obexd v1 4/4] core: Remove redundant include errno.h Syam Sidhardhan
@ 2012-08-23 14:04 ` Luiz Augusto von Dentz
  2012-08-23 14:12   ` Luiz Augusto von Dentz
  3 siblings, 1 reply; 12+ messages in thread
From: Luiz Augusto von Dentz @ 2012-08-23 14:04 UTC (permalink / raw)
  To: Syam Sidhardhan; +Cc: linux-bluetooth

Hi Syam,

On Wed, Aug 22, 2012 at 7:35 PM, Syam Sidhardhan <s.syam@samsung.com> wrote:
> If we use the BlueZ version less than 4.100, then the following
> compilation error happens.
>
> Error:
> ======
> btio/btio.c: In function ‘l2cap_connect’:
> btio/btio.c:301:6: error: ‘struct sockaddr_l2’ has no member named
>  ‘l2_bdaddr_type’
> btio/btio.c: In function ‘parse_set_opts’:
> btio/btio.c:707:19: error: ‘BDADDR_BREDR’ undeclared (first use in
>  this function)
> btio/btio.c:707:19: note: each undeclared identifier is reported only
>  once for each function it appears in
> make[1]: *** [btio/btio.o] Error 1
> make: *** [all] Error 2
> ---

Strange I don't get this error with 4.99, anyway I guess it is fine to
bump 4.100


-- 
Luiz Augusto von Dentz

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

* Re: [PATCH obexd v1 1/4] build: BlueZ version 4.100 or later is required
  2012-08-23 14:04 ` [PATCH obexd v1 1/4] build: BlueZ version 4.100 or later is required Luiz Augusto von Dentz
@ 2012-08-23 14:12   ` Luiz Augusto von Dentz
  2012-08-23 15:51     ` Syam Sidhardhan
  0 siblings, 1 reply; 12+ messages in thread
From: Luiz Augusto von Dentz @ 2012-08-23 14:12 UTC (permalink / raw)
  To: Syam Sidhardhan; +Cc: linux-bluetooth

Hi Syam,

On Thu, Aug 23, 2012 at 5:04 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> Hi Syam,
>
> On Wed, Aug 22, 2012 at 7:35 PM, Syam Sidhardhan <s.syam@samsung.com> wrote:
>> If we use the BlueZ version less than 4.100, then the following
>> compilation error happens.
>>
>> Error:
>> ======
>> btio/btio.c: In function ‘l2cap_connect’:
>> btio/btio.c:301:6: error: ‘struct sockaddr_l2’ has no member named
>>  ‘l2_bdaddr_type’
>> btio/btio.c: In function ‘parse_set_opts’:
>> btio/btio.c:707:19: error: ‘BDADDR_BREDR’ undeclared (first use in
>>  this function)
>> btio/btio.c:707:19: note: each undeclared identifier is reported only
>>  once for each function it appears in
>> make[1]: *** [btio/btio.o] Error 1
>> make: *** [all] Error 2
>> ---
>
> Strange I don't get this error with 4.99, anyway I guess it is fine to
> bump 4.100

Patches 1,3 and 4 are now upstream, for the issue about glib Im
figuring out how to fix it properly.


-- 
Luiz Augusto von Dentz

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

* Re: [PATCH obexd v1 1/4] build: BlueZ version 4.100 or later is required
  2012-08-23 14:12   ` Luiz Augusto von Dentz
@ 2012-08-23 15:51     ` Syam Sidhardhan
  0 siblings, 0 replies; 12+ messages in thread
From: Syam Sidhardhan @ 2012-08-23 15:51 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,
----- Original Message ----- 
From: "Luiz Augusto von Dentz" <luiz.dentz@gmail.com>
To: "Syam Sidhardhan" <s.syam@samsung.com>
Cc: <linux-bluetooth@vger.kernel.org>
Sent: Thursday, August 23, 2012 7:42 PM
Subject: Re: [PATCH obexd v1 1/4] build: BlueZ version 4.100 or later is 
required


> Hi Syam,
>
> On Thu, Aug 23, 2012 at 5:04 PM, Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
>> Hi Syam,
>>
>> On Wed, Aug 22, 2012 at 7:35 PM, Syam Sidhardhan <s.syam@samsung.com> 
>> wrote:
>>> If we use the BlueZ version less than 4.100, then the following
>>> compilation error happens.
>>>
>>> Error:
>>> ======
>>> btio/btio.c: In function ‘l2cap_connect’:
>>> btio/btio.c:301:6: error: ‘struct sockaddr_l2’ has no member named
>>>  ‘l2_bdaddr_type’
>>> btio/btio.c: In function ‘parse_set_opts’:
>>> btio/btio.c:707:19: error: ‘BDADDR_BREDR’ undeclared (first use in
>>>  this function)
>>> btio/btio.c:707:19: note: each undeclared identifier is reported only
>>>  once for each function it appears in
>>> make[1]: *** [btio/btio.o] Error 1
>>> make: *** [all] Error 2
>>> ---

>>
>> Strange I don't get this error with 4.99, anyway I guess it is fine to
>> bump 4.100


May be in your case bluetooth.h installed at different path.
You will get this error with BlueZ 4.99 as the changes related to 
sockaddr_l2 is added after
4.99 release. commit id: ba801fcd67e4fa5169e8c8b73fd87b6c08fca335.

>
> Patches 1,3 and 4 are now upstream, for the issue about glib Im
> figuring out how to fix it properly.
>

Regarding the glib issue, either we have to bump Glib 2.32 or fix it with an 
extra
variable similar to what Johan did for BlueZ. No other methods comes into my
mind. If you are ok with resolving the issue with an extra variable, then 
I'm ready to
send a patch. PLMKO.

Thanks for applying other patches.

Regards,
Syam. 


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

* Re: [PATCH obexd v1 2/4] build: Require GLib 2.32 or later
  2012-08-22 22:36     ` Luiz Augusto von Dentz
@ 2012-08-24  9:45       ` Luiz Augusto von Dentz
  2012-08-24 11:33         ` Syam Sidhardhan
  2012-08-24 13:46         ` Lucas De Marchi
  0 siblings, 2 replies; 12+ messages in thread
From: Luiz Augusto von Dentz @ 2012-08-24  9:45 UTC (permalink / raw)
  To: Syam Sidhardhan; +Cc: linux-bluetooth

Hi Syam,

On Thu, Aug 23, 2012 at 1:36 AM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> Hi Syam,
>
> On Thu, Aug 23, 2012 at 1:27 AM, Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
>> Hi Syam,
>>
>> On Wed, Aug 22, 2012 at 7:35 PM, Syam Sidhardhan <s.syam@samsung.com> wrote:
>>> If we use GLib version less than 2.32 (more precisely < 2.31.2) then
>>> the following build error may occure in a 32 bit.
>>
>> We had the issue with BlueZ but we did not bump the glib version,
>> which makes me wonder if you are able to compile bluetoothd?
>
> It looks like we fix it with use of a variable:
>
>  commit e34836262ba6a46491b6a760520158d70e8b51b5
> Author: Johan Hedberg <johan.hedberg@intel.com>
> Date:   Wed Oct 12 00:48:59 2011 +0300
>
>     Fix compilation error on 32-bit systems
>
>     This fixes the following compilation error with GLib on 32-bit sytems:
>
>     audio/media.c: In function 'get_setting':
>     audio/media.c:1109:44: error: cast to pointer from integer of
> different size [-Werror=int-to-pointer-cast]
>     audio/media.c: In function 'set_setting':
>     audio/media.c:1132:41: error: cast to pointer from integer of
> different size [-Werror=int-to-pointer-cast]

How about the following patch:

diff --git a/gobex/gobex-apparam.c b/gobex/gobex-apparam.c
index 8f72aa7..d29dfc1 100644
--- a/gobex/gobex-apparam.c
+++ b/gobex/gobex-apparam.c
@@ -112,12 +112,14 @@ GObexApparam *g_obex_apparam_decode(const void
*data, gsize size)
 	while (count < size) {
 		struct apparam_tag *tag;
 		gsize parsed;
+		guint id;

 		tag = apparam_tag_decode(data + count, size - count, &parsed);
 		if (tag == NULL)
 			break;

-		g_hash_table_insert(tags, GUINT_TO_POINTER(tag->id), tag);
+		id = tag->id;
+		g_hash_table_insert(tags, GUINT_TO_POINTER(id), tag);

 		count += parsed;
 	}
@@ -167,12 +169,14 @@ GObexApparam
*g_obex_apparam_set_bytes(GObexApparam *apparam, guint8 id,
 						const void *value, gsize len)
 {
 	struct apparam_tag *tag;
+	guint uid;

 	if (apparam == NULL)
 		apparam = g_obex_apparam_new();

 	tag = tag_new(id, len, value);
-	g_hash_table_replace(apparam->tags, GUINT_TO_POINTER(id), tag);
+	uid = id;
+	g_hash_table_replace(apparam->tags, GUINT_TO_POINTER(uid), tag);

 	return apparam;
 }
@@ -232,6 +236,12 @@ GObexApparam
*g_obex_apparam_set_string(GObexApparam *apparam, guint8 id,
 	return g_obex_apparam_set_bytes(apparam, id, value, len);
 }

+static struct apparam_tag *g_obex_apparam_find_tag(GObexApparam *apparam,
+								guint id)
+{
+	return g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
+}
+
 gboolean g_obex_apparam_get_uint8(GObexApparam *apparam, guint8 id,
 							guint8 *dest)
 {
@@ -239,7 +249,7 @@ gboolean g_obex_apparam_get_uint8(GObexApparam
*apparam, guint8 id,

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

-	tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
+	tag = g_obex_apparam_find_tag(apparam, id);
 	if (tag == NULL)
 		return FALSE;

@@ -257,7 +267,7 @@ gboolean g_obex_apparam_get_uint16(GObexApparam
*apparam, guint8 id,

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

-	tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
+	tag = g_obex_apparam_find_tag(apparam, id);
 	if (tag == NULL)
 		return FALSE;

@@ -278,7 +288,7 @@ gboolean g_obex_apparam_get_uint32(GObexApparam
*apparam, guint8 id,

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

-	tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
+	tag = g_obex_apparam_find_tag(apparam, id);
 	if (tag == NULL)
 		return FALSE;

@@ -299,7 +309,7 @@ gboolean g_obex_apparam_get_uint64(GObexApparam
*apparam, guint8 id,

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

-	tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
+	tag = g_obex_apparam_find_tag(apparam, id);
 	if (tag == NULL)
 		return FALSE;

@@ -320,7 +330,7 @@ char *g_obex_apparam_get_string(GObexApparam
*apparam, guint8 id)

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

-	tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
+	tag = g_obex_apparam_find_tag(apparam, id);
 	if (tag == NULL)
 		return NULL;

@@ -338,7 +348,7 @@ gboolean g_obex_apparam_get_bytes(GObexApparam
*apparam, guint8 id,

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

-	tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
+	tag = g_obex_apparam_find_tag(apparam, id);
 	if (tag == NULL)
 		return FALSE;

-- 
1.7.11.4



-- 
Luiz Augusto von Dentz

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

* Re: [PATCH obexd v1 2/4] build: Require GLib 2.32 or later
  2012-08-24  9:45       ` Luiz Augusto von Dentz
@ 2012-08-24 11:33         ` Syam Sidhardhan
  2012-08-24 13:46         ` Lucas De Marchi
  1 sibling, 0 replies; 12+ messages in thread
From: Syam Sidhardhan @ 2012-08-24 11:33 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

----- Original Message ----- 
From: "Luiz Augusto von Dentz" <luiz.dentz@gmail.com>
To: "Syam Sidhardhan" <s.syam@samsung.com>
Cc: <linux-bluetooth@vger.kernel.org>
Sent: Friday, August 24, 2012 3:15 PM
Subject: Re: [PATCH obexd v1 2/4] build: Require GLib 2.32 or later


> Hi Syam,
>
> On Thu, Aug 23, 2012 at 1:36 AM, Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
>> Hi Syam,
>>
>> On Thu, Aug 23, 2012 at 1:27 AM, Luiz Augusto von Dentz
>> <luiz.dentz@gmail.com> wrote:
>>> Hi Syam,
>>>
>>> On Wed, Aug 22, 2012 at 7:35 PM, Syam Sidhardhan <s.syam@samsung.com> 
>>> wrote:
>>>> If we use GLib version less than 2.32 (more precisely < 2.31.2) then
>>>> the following build error may occure in a 32 bit.
>>>
>>> We had the issue with BlueZ but we did not bump the glib version,
>>> which makes me wonder if you are able to compile bluetoothd?
>>
>> It looks like we fix it with use of a variable:
>>
>>  commit e34836262ba6a46491b6a760520158d70e8b51b5
>> Author: Johan Hedberg <johan.hedberg@intel.com>
>> Date:   Wed Oct 12 00:48:59 2011 +0300
>>
>>     Fix compilation error on 32-bit systems
>>
>>     This fixes the following compilation error with GLib on 32-bit 
>> sytems:
>>
>>     audio/media.c: In function 'get_setting':
>>     audio/media.c:1109:44: error: cast to pointer from integer of
>> different size [-Werror=int-to-pointer-cast]
>>     audio/media.c: In function 'set_setting':
>>     audio/media.c:1132:41: error: cast to pointer from integer of
>> different size [-Werror=int-to-pointer-cast]
>
> How about the following patch:
>
> diff --git a/gobex/gobex-apparam.c b/gobex/gobex-apparam.c
> index 8f72aa7..d29dfc1 100644
> --- a/gobex/gobex-apparam.c
> +++ b/gobex/gobex-apparam.c
> @@ -112,12 +112,14 @@ GObexApparam *g_obex_apparam_decode(const void
> *data, gsize size)
>  while (count < size) {
>  struct apparam_tag *tag;
>  gsize parsed;
> + guint id;
>
>  tag = apparam_tag_decode(data + count, size - count, &parsed);
>  if (tag == NULL)
>  break;
>
> - g_hash_table_insert(tags, GUINT_TO_POINTER(tag->id), tag);
> + id = tag->id;
> + g_hash_table_insert(tags, GUINT_TO_POINTER(id), tag);
>
>  count += parsed;
>  }
> @@ -167,12 +169,14 @@ GObexApparam
> *g_obex_apparam_set_bytes(GObexApparam *apparam, guint8 id,
>  const void *value, gsize len)
> {
>  struct apparam_tag *tag;
> + guint uid;
>
>  if (apparam == NULL)
>  apparam = g_obex_apparam_new();
>
>  tag = tag_new(id, len, value);
> - g_hash_table_replace(apparam->tags, GUINT_TO_POINTER(id), tag);
> + uid = id;

Its ok, but in this case assigning id during variable declaration looks good 
for me.
ie, guint uid = id;

> + g_hash_table_replace(apparam->tags, GUINT_TO_POINTER(uid), tag);
>
>  return apparam;
> }
> @@ -232,6 +236,12 @@ GObexApparam
> *g_obex_apparam_set_string(GObexApparam *apparam, guint8 id,
>  return g_obex_apparam_set_bytes(apparam, id, value, len);
> }
>
> +static struct apparam_tag *g_obex_apparam_find_tag(GObexApparam *apparam,
> + guint id)
> +{
> + return g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
> +}
> +
> gboolean g_obex_apparam_get_uint8(GObexApparam *apparam, guint8 id,
>  guint8 *dest)
> {
> @@ -239,7 +249,7 @@ gboolean g_obex_apparam_get_uint8(GObexApparam
> *apparam, guint8 id,
>
>  g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x", id);
>
> - tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
> + tag = g_obex_apparam_find_tag(apparam, id);
>  if (tag == NULL)
>  return FALSE;
>
> @@ -257,7 +267,7 @@ gboolean g_obex_apparam_get_uint16(GObexApparam
> *apparam, guint8 id,
>
>  g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x", id);
>
> - tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
> + tag = g_obex_apparam_find_tag(apparam, id);
>  if (tag == NULL)
>  return FALSE;
>
> @@ -278,7 +288,7 @@ gboolean g_obex_apparam_get_uint32(GObexApparam
> *apparam, guint8 id,
>
>  g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x", id);
>
> - tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
> + tag = g_obex_apparam_find_tag(apparam, id);
>  if (tag == NULL)
>  return FALSE;
>
> @@ -299,7 +309,7 @@ gboolean g_obex_apparam_get_uint64(GObexApparam
> *apparam, guint8 id,
>
>  g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x", id);
>
> - tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
> + tag = g_obex_apparam_find_tag(apparam, id);
>  if (tag == NULL)
>  return FALSE;
>
> @@ -320,7 +330,7 @@ char *g_obex_apparam_get_string(GObexApparam
> *apparam, guint8 id)
>
>  g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x", id);
>
> - tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
> + tag = g_obex_apparam_find_tag(apparam, id);
>  if (tag == NULL)
>  return NULL;
>
> @@ -338,7 +348,7 @@ gboolean g_obex_apparam_get_bytes(GObexApparam
> *apparam, guint8 id,
>
>  g_obex_debug(G_OBEX_DEBUG_APPARAM, "tag 0x%02x", id);
>
> - tag = g_hash_table_lookup(apparam->tags, GUINT_TO_POINTER(id));
> + tag = g_obex_apparam_find_tag(apparam, id);
>  if (tag == NULL)
>  return FALSE;
>

Apart form the above mention nitpick, this patch is ok for me. Its a better 
fix.

Thanks,
Syam 


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

* Re: [PATCH obexd v1 2/4] build: Require GLib 2.32 or later
  2012-08-24  9:45       ` Luiz Augusto von Dentz
  2012-08-24 11:33         ` Syam Sidhardhan
@ 2012-08-24 13:46         ` Lucas De Marchi
  1 sibling, 0 replies; 12+ messages in thread
From: Lucas De Marchi @ 2012-08-24 13:46 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: Syam Sidhardhan, linux-bluetooth

On Fri, Aug 24, 2012 at 6:45 AM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> Hi Syam,
>
> On Thu, Aug 23, 2012 at 1:36 AM, Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
>> Hi Syam,
>>
>> On Thu, Aug 23, 2012 at 1:27 AM, Luiz Augusto von Dentz
>> <luiz.dentz@gmail.com> wrote:
>>> Hi Syam,
>>>
>>> On Wed, Aug 22, 2012 at 7:35 PM, Syam Sidhardhan <s.syam@samsung.com> wrote:
>>>> If we use GLib version less than 2.32 (more precisely < 2.31.2) then
>>>> the following build error may occure in a 32 bit.
>>>
>>> We had the issue with BlueZ but we did not bump the glib version,
>>> which makes me wonder if you are able to compile bluetoothd?
>>
>> It looks like we fix it with use of a variable:
>>
>>  commit e34836262ba6a46491b6a760520158d70e8b51b5
>> Author: Johan Hedberg <johan.hedberg@intel.com>
>> Date:   Wed Oct 12 00:48:59 2011 +0300
>>
>>     Fix compilation error on 32-bit systems
>>
>>     This fixes the following compilation error with GLib on 32-bit sytems:
>>
>>     audio/media.c: In function 'get_setting':
>>     audio/media.c:1109:44: error: cast to pointer from integer of
>> different size [-Werror=int-to-pointer-cast]
>>     audio/media.c: In function 'set_setting':
>>     audio/media.c:1132:41: error: cast to pointer from integer of
>> different size [-Werror=int-to-pointer-cast]
>
> How about the following patch:

I will say the same thing when the other similar fix was committed to
BlueZ: creating an extra variable all over the repository because the
macro was not defined correctly is not good. Mainly because over the
time we would create the same problem in other places as well because
in general devs are using more recent versions of glib  (as shown in
the places this patch is fixing now) .

So, I'd propose the following: if we don't want to increase the
minimum required version of glib, lets define this macro ourselves. Or
make it a build-time conditional in glib-helper.h


Lucas De Marchi

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

end of thread, other threads:[~2012-08-24 13:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-22 16:35 [PATCH obexd v1 1/4] build: BlueZ version 4.100 or later is required Syam Sidhardhan
2012-08-22 16:35 ` [PATCH obexd v1 2/4] build: Require GLib 2.32 or later Syam Sidhardhan
2012-08-22 22:27   ` Luiz Augusto von Dentz
2012-08-22 22:36     ` Luiz Augusto von Dentz
2012-08-24  9:45       ` Luiz Augusto von Dentz
2012-08-24 11:33         ` Syam Sidhardhan
2012-08-24 13:46         ` Lucas De Marchi
2012-08-22 16:35 ` [PATCH obexd v1 3/4] plugins: Remove redundant include sys/stat.h Syam Sidhardhan
2012-08-22 16:35 ` [PATCH obexd v1 4/4] core: Remove redundant include errno.h Syam Sidhardhan
2012-08-23 14:04 ` [PATCH obexd v1 1/4] build: BlueZ version 4.100 or later is required Luiz Augusto von Dentz
2012-08-23 14:12   ` Luiz Augusto von Dentz
2012-08-23 15:51     ` Syam Sidhardhan

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