linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: David Stockwell <dstockwell@frequency-one.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 11:36:58 +0300	[thread overview]
Message-ID: <20110824083658.GC19274@dell> (raw)
In-Reply-To: <201108232227.12124.dstockwell@frequency-one.com>

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 :)

> +		} 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.

Johan

  reply	other threads:[~2011-08-24  8:36 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 [this message]
2011-08-24 12:37   ` David Stockwell
  -- 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=20110824083658.GC19274@dell \
    --to=johan.hedberg@gmail.com \
    --cc=dstockwell@frequency-one.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;
as well as URLs for NNTP newsgroup(s).