diff options
author | Guy Harris <guy@alum.mit.edu> | 2013-02-20 00:09:41 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2013-02-20 00:09:41 +0000 |
commit | 75168f6bf7288858ec86e9c995ca6e0ff2abdd1a (patch) | |
tree | 5250fd352aec729f31b17e97363e004f8b37da4e /epan | |
parent | bd7c0171a9fc3a196323781c086308a9915bfb2b (diff) | |
download | wireshark-75168f6bf7288858ec86e9c995ca6e0ff2abdd1a.tar.gz |
No more tvb_new(), so no more need for tvb_set_real_data() or
tvb_set_subset(); code should use tvb_new_real_data() and various
tvb_new_subset routines. (Neither tvb_new() nor tvb_set_real_data() nor
tvb_set_subset() were exported in libwireshark.def, nor were they used
outside tvbuff.c; tvb_set_real_data() and tvb_set_subset() weren't even
being used *inside* tvbuff.c.)
svn path=/trunk/; revision=47753
Diffstat (limited to 'epan')
-rw-r--r-- | epan/tvbuff.c | 29 | ||||
-rw-r--r-- | epan/tvbuff.h | 27 |
2 files changed, 10 insertions, 46 deletions
diff --git a/epan/tvbuff.c b/epan/tvbuff.c index dc714a675a..133c965092 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -235,18 +235,6 @@ tvb_set_real_data_no_exceptions(tvbuff_t *tvb, const guint8* data, const guint l tvb->initialized = TRUE; } -void -tvb_set_real_data(tvbuff_t *tvb, const guint8* data, const guint length, const gint reported_length) -{ - DISSECTOR_ASSERT(tvb); - DISSECTOR_ASSERT(tvb->type == TVBUFF_REAL_DATA); - DISSECTOR_ASSERT(!tvb->initialized); - - THROW_ON(reported_length < -1, ReportedBoundsError); - - tvb_set_real_data_no_exceptions(tvb, data, length, reported_length); -} - tvbuff_t * tvb_new_real_data(const guint8* data, const guint length, const gint reported_length) { @@ -510,23 +498,6 @@ tvb_set_subset_no_exceptions(tvbuff_t *tvb, tvbuff_t *backing, const gint report } } -void -tvb_set_subset(tvbuff_t *tvb, tvbuff_t *backing, - const gint backing_offset, const gint backing_length, const gint reported_length) -{ - DISSECTOR_ASSERT(tvb); - DISSECTOR_ASSERT(tvb->type == TVBUFF_SUBSET); - DISSECTOR_ASSERT(!tvb->initialized); - - THROW_ON(reported_length < -1, ReportedBoundsError); - - check_offset_length(backing->length, backing->reported_length, backing_offset, backing_length, - &tvb->tvbuffs.subset.offset, - &tvb->tvbuffs.subset.length); - - tvb_set_subset_no_exceptions(tvb, backing, reported_length); -} - tvbuff_t * tvb_new_subset(tvbuff_t *backing, const gint backing_offset, const gint backing_length, const gint reported_length) { diff --git a/epan/tvbuff.h b/epan/tvbuff.h index f71b315e0a..8e3485d3b6 100644 --- a/epan/tvbuff.h +++ b/epan/tvbuff.h @@ -156,35 +156,28 @@ extern void tvb_set_child_real_data_tvbuff(tvbuff_t* parent, tvbuff_t* child); extern tvbuff_t* tvb_new_child_real_data(tvbuff_t* parent, const guint8* data, const guint length, const gint reported_length); -/** Sets parameters for TVBUFF_REAL_DATA. Can throw ReportedBoundsError. */ -extern void tvb_set_real_data(tvbuff_t*, const guint8* data, const guint length, - const gint reported_length); - -/** Combination of tvb_new() and tvb_set_real_data(). Can throw ReportedBoundsError. +/** Create a tvbuff backed by existing data. Can throw ReportedBoundsError. * Normally, a callback to free the data should be registered using tvb_set_free_cb(); * when this tvbuff is freed, then your callback will be called, and at that time * you can free your original data. */ extern tvbuff_t* tvb_new_real_data(const guint8* data, const guint length, const gint reported_length); -/** Define the subset of the backing buffer to use. - * - * 'backing_offset' can be negative, to indicate bytes from - * the end of the backing buffer. +/** Create a tvbuff that's a subset of another tvbuff. * - * 'backing_length' can be 0, although the usefulness of the buffer would - * be rather limited. + * 'backing_offset', if positive, is the offset from the beginning of + * the backing tvbuff at which the new tvbuff's data begins, and, if + * negative, is the offset from the end of the backing tvbuff at which + * the new tvbuff's data begins. * - * 'backing_length' of -1 means "to the end of the backing buffer" + * 'backing_length' is the length of the data to include in the new + * tvbuff, starting with the byte at 'backing_offset"; if -1, it + * means "to the end of the backing tvbuff". It can be 0, although + * the usefulness of the buffer would be rather limited. * * Will throw BoundsError if 'backing_offset'/'length' * is beyond the bounds of the backing tvbuff. * Can throw ReportedBoundsError. */ -extern void tvb_set_subset(tvbuff_t* tvb, tvbuff_t* backing, - const gint backing_offset, const gint backing_length, const gint reported_length); - -/** Combination of tvb_new() and tvb_set_subset() - * Can throw ReportedBoundsError. */ extern tvbuff_t* tvb_new_subset(tvbuff_t* backing, const gint backing_offset, const gint backing_length, const gint reported_length); |