Ethereal-dev: RE: [Ethereal-dev] Move common routines to tvbuff(Patch)

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Biot Olivier <Olivier.Biot@xxxxxxxxxxx>
Date: Tue, 16 Dec 2003 13:50:51 +0100
Some comments:

tvb_skip_wsp() is confusing as there is a wsp dissector :)

Maybe the routine should define what is meant to be white space; it
currently only handles ' ', '\t' and '\n' but no '\r' or other white space
characters. Maybe we could add a function taking the white space characters
(or: characters to skip) as a string argument, such as in:

guint tvb_skip_bytes(tvbuff_t *tvb, guint32 offset, const guint8 *list,
guint8 list_len)
{
	gint tvb_len = tvb_len(tvb);
	guint8 c, i;

	while (offset < tvb_len) {
		c = tvb_get_guint8(tvb, offset);
		for (i=0; i < list_len; i++) {
			if (c == list[i]) {
				offset++; /* Skip matching byte */
				break;
			}
		}
		if (i == list_len) /* c not in list */
			break;
	}
	return offset;
}

You could write this function in such a way that negative offset values look
from the end of tvb to the start; this is left as an exercise to the reader
:)

Regards,

Olivier

| -----Original Message-----
| From: Anders Broman (TN/EAB)
| 
| Hi,
| Included patches moves the "tvb_skip_wsp.." routines to tvbuff.
| Please check in if acceptable.
| Best regards
| Anders