Linux bluetooth development
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@profusion.mobi>
To: Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ 1/4] AVRCP: move MediaPlayer to adapter object
Date: Thu, 6 Oct 2011 11:26:54 -0300	[thread overview]
Message-ID: <20111006142654.GA4507@vigoh> (raw)
In-Reply-To: <20111006135256.GC15489@aemeltch-MOBL1>

Hi Andrei,

* Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com> [2011-10-06 16:52:59 +0300]:

> Hi Luiz,
> 
> On Thu, Oct 06, 2011 at 04:35:26PM +0300, Luiz Augusto von Dentz wrote:
> > Hi Andrei,
> > 
> > On Thu, Oct 6, 2011 at 3:24 PM, Andrei Emeltchenko
> > <andrei.emeltchenko.news@gmail.com> wrote:
> > > Hi guys,
> > >
> > > On Thu, Oct 06, 2011 at 11:16:47AM +0300, Johan Hedberg wrote:
> > >> Hi Luiz,
> > >>
> > >> On Wed, Oct 05, 2011, Luiz Augusto von Dentz wrote:
> > >> > This move the MediaPlayer registration to adapter object on Media
> > >> > interface so we can track players properly.
> > >> > ---
> > >> >  audio/avrcp.c     |  840 +++++++++++------------------------------------------
> > >> >  audio/avrcp.h     |   67 ++++-
> > >> >  audio/device.c    |    3 -
> > >> >  audio/device.h    |    2 -
> > >> >  audio/manager.c   |    7 -
> > >> >  audio/media.c     |  784 +++++++++++++++++++++++++++++++++++++++++++++++++
> > >> >  doc/media-api.txt |  163 +++++++++++
> > >> >  7 files changed, 1179 insertions(+), 687 deletions(-)
> > >>
> > >> All four patches have been applied. Thanks.
> > >
> > > Can it cause this:
> > >
> > > $ LANG=en make
> > > make --no-print-directory all-am
> > >  CC     audio/media.o
> > > cc1: warnings being treated as errors
> > > audio/media.c: In function 'get_setting':
> > > audio/media.c:1106:44: error: cast to pointer from integer of different
> > > size
> > > make[1]: *** [audio/media.o] Error 1
> > > make: *** [all] Error 2
> > >
> > > in the line below:
> > >        <------8<-------------------------------------------------------------
> > >        |  value = g_hash_table_lookup(mp->settings, GUINT_TO_POINTER(attr));
> > >        <------8<-------------------------------------------------------------
> > >
> > > Is patch below OK?
> > >
> > > @@ -1103,7 +1103,8 @@ static int get_setting(uint8_t attr, void
> > > *user_data)
> > >
> > >        DBG("%s", attr_to_str(attr));
> > >
> > > -       value = g_hash_table_lookup(mp->settings, GUINT_TO_POINTER(attr));
> > > +       value = g_hash_table_lookup(mp->settings,
> > > +                                       GUINT_TO_POINTER((uint32_t) attr));
> > >        if (!value)
> > >                return -EINVAL;
> > 
> > Are you using 32 bits? At least Im running 64 bit and Im not seeing
> > this problem.
> 
> Yes, 32 bits.
> 
> I found this define:
> 
> /usr/lib/i386-linux-gnu/glib-2.0/include/glibconfig.h:#define
> GUINT_TO_POINTER(u)	((gpointer)  (u))

Do you confirm that changing this header as below fixes your issue?
GUINT_TO_POINTER(u)	((gpointer) (guint) (u))

In that case we should send the patch below to glib:



>From db167c52918835aba947bb1a23bed3f62502244a Mon Sep 17 00:00:00 2001
From: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Date: Thu, 6 Oct 2011 11:18:03 -0300
Subject: [PATCH] Fix 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);
---
 configure.ac |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index e4235e0..95e3c06 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3361,8 +3361,8 @@ $ac_cv_sizeof_int)
   gintptr_modifier='""'
   gintptr_format='"i"'
   guintptr_format='"u"'
-  glib_gpi_cast=''
-  glib_gpui_cast=''
+  glib_gpi_cast='gint'
+  glib_gpui_cast='guint'
   ;;
 $ac_cv_sizeof_long)
   glib_intptr_type_define=long
-- 
1.7.7


  parent reply	other threads:[~2011-10-06 14:26 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-05 20:02 [PATCH BlueZ 1/4] AVRCP: move MediaPlayer to adapter object Luiz Augusto von Dentz
2011-10-05 20:02 ` [PATCH BlueZ 2/4] Add simple-player test script Luiz Augusto von Dentz
2011-10-05 20:02 ` [PATCH BlueZ 3/4] Remove MediaPlayer interface from control-api.txt Luiz Augusto von Dentz
2011-10-05 20:02 ` [PATCH BlueZ 4/4] Remove test-media-player Luiz Augusto von Dentz
2011-10-05 22:48 ` [PATCH BlueZ 1/4] AVRCP: move MediaPlayer to adapter object Lucas De Marchi
2011-10-06  6:49   ` Luiz Augusto von Dentz
2011-10-06  8:16 ` Johan Hedberg
2011-10-06 12:24   ` Andrei Emeltchenko
2011-10-06 12:28     ` Lucas De Marchi
2011-10-06 12:43       ` Andrei Emeltchenko
2011-10-06 13:35     ` Luiz Augusto von Dentz
2011-10-06 13:52       ` Andrei Emeltchenko
2011-10-06 14:12         ` Lucas De Marchi
2011-10-06 14:26         ` Lucas De Marchi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-09-30 13:10 [PATCH BlueZ 0/4] MediaPlayer agent registration Luiz Augusto von Dentz
2011-09-30 13:10 ` [PATCH BlueZ 1/4] AVRCP: move MediaPlayer to adapter object Luiz Augusto von Dentz
2011-10-01  0:51   ` David Stockwell
2011-10-01  4:25   ` Lucas De Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111006142654.GA4507@vigoh \
    --to=lucas.demarchi@profusion.mobi \
    --cc=andrei.emeltchenko.news@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox