All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: James Courtier-Dutton <James@superbug.demon.co.uk>
Cc: BlueZ Mailing List <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] [PATCH] Fix some bugs in hcidump.
Date: Mon, 23 Feb 2004 15:04:45 +0100	[thread overview]
Message-ID: <1077545085.13454.1.camel@pegasus> (raw)
In-Reply-To: <403A02FA.60008@superbug.demon.co.uk>

Hi James,

> Each call to parse_de_hdr and print_uuid changes the value of frm->len.
> So, each time round the while loop (len - frm->len) becomes larger.
> 
> The n1 value is set by the previous line
> "if (parse_de_hdr(frm, &n1) == SDP_DE_SEQ) {"
> 
> This means we have n1 bytes of data we wish to parse inside the while loop.
> So, we want to start the while loop with (len - frm->len) == 0
> Each time round the loop (len - frm->len) will increase( due to calls to 
> parse_de_hdr and print_uuid) , and the loop will exit when (len - 
> frm->len) >= n1, which is what we want.
> 
> If we fail to set "len = frm->len;" just before the while loop, the 
> previous line
> "if (parse_de_hdr(frm, &n1) == SDP_DE_SEQ) {"
> changes frm->len, so the "int len = frm->len;" at the beginning of the 
> function is no longer correct.
> I.E. len != frm->len after the "if (parse_de_hdr(frm, &n1) == 
> SDP_DE_SEQ) {" statement.
> 
> I hope this explanation is clear.
> 
> Do you want me to resubmit the patch as a "cvs -u diff" ?

yes. And please remove the initial assignment of len.

Regards

Marcel




-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

  reply	other threads:[~2004-02-23 14:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-23  3:18 [Bluez-devel] [PATCH] Fix some bugs in hcidump James Courtier-Dutton
2004-02-23  7:42 ` Marcel Holtmann
2004-02-23 13:41   ` James Courtier-Dutton
2004-02-23 14:04     ` Marcel Holtmann [this message]
2004-02-23 15:04       ` James Courtier-Dutton
2004-02-23 17:39         ` Marcel Holtmann

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=1077545085.13454.1.camel@pegasus \
    --to=marcel@holtmann.org \
    --cc=James@superbug.demon.co.uk \
    --cc=bluez-devel@lists.sourceforge.net \
    /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 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.