Linux bluetooth development
 help / color / mirror / Atom feed
From: "David Stockwell" <dstockwell@frequency-one.com>
To: "Johan Hedberg" <johan.hedberg@gmail.com>
Cc: <linux-bluetooth@vger.kernel.org>,
	<lucas.demarchi@profusion.mobi>, <luiz.dentz@gmail.com>
Subject: Re: [PATCH 3/3] AVRCP: Add Passthrough Signal
Date: Wed, 24 Aug 2011 07:37:51 -0500	[thread overview]
Message-ID: <07CDC387B225419A9CBFD865FA80E0EA@freqoneremote> (raw)
In-Reply-To: <20110824083658.GC19274@dell>

Johan,

Good suggestions (I guess I am an old assembly-language programmer)

-----Original Message----- 
From: Johan Hedberg
Sent: Wednesday, August 24, 2011 3:36 AM
To: David Stockwell
Cc: linux-bluetooth@vger.kernel.org ; lucas.demarchi@profusion.mobi ; 
luiz.dentz@gmail.com
Subject: Re: [PATCH 3/3] AVRCP: Add Passthrough Signal

Hi David,

On Tue, Aug 23, 2011, David Stockwell wrote:
> + if (key_pressed == VENDOR_UNIQUE_OP) {
> + if (operands[1] == 0 || operand_count < 5) {
> + pass_company_id = 0;
> + pass_string = g_malloc0(1);

The above is a quite obscure way to allocate an empty string. Could you
change it to g_strdup(""). That requires a second or two less thinking
to figure out what the line is supposed to do :)

+++++OK

> + } else if (operands[1] == 3 && operand_count == 5) {
> + pass_company_id = get_company_id(operands + 2);
> + pass_string = g_malloc0(1);

Same here.

> + } else { /* op_length does not match operand_count */
> + DBG("Passthrough: Malformed message");
> + DBG("op_len %u, op_cnt %u", operands[1], operand_count);
> + pass_company_id = 0;
> + pass_string = g_malloc0(1);

And here. +++++

> + }
>  } else {
> - status = "pressed";
> - pressed = 1;
> + pass_company_id = 0;
> + pass_string = g_malloc0(1);

And here.

> + g_dbus_emit_signal(control->dev->conn, control->dev->path,
> +    AUDIO_CONTROL_INTERFACE, "Passthrough",
> +    DBUS_TYPE_BYTE, &key_pressed,
> +    DBUS_TYPE_BOOLEAN, &key_state,
> +    DBUS_TYPE_UINT32, &pass_company_id,
> +    DBUS_TYPE_STRING, &pass_string,
> +    DBUS_TYPE_INVALID);

The above lines still mix tabs and spaces for indentation. Just use
tabs.

++++ Sorry, thought I had fixed this in Kate.  checkpatch.pl did not catch 
it...will fix.

Johan 


  reply	other threads:[~2011-08-24 12:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-24  3:27 [PATCH 3/3] AVRCP: Add Passthrough Signal David Stockwell
2011-08-24  8:36 ` Johan Hedberg
2011-08-24 12:37   ` David Stockwell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-08-24 13:07 David Stockwell
2011-08-24 22:47 ` Luiz Augusto von Dentz
2011-08-24 23:58   ` David Stockwell
2011-08-25  7:44     ` Luiz Augusto von Dentz
2011-08-25 12:45       ` David Stockwell
2011-08-25 13:14         ` David Stockwell

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=07CDC387B225419A9CBFD865FA80E0EA@freqoneremote \
    --to=dstockwell@frequency-one.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=lucas.demarchi@profusion.mobi \
    --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