aboutsummaryrefslogtreecommitdiffstats
path: root/epan/tvbuff.h
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>2002-02-01 04:34:17 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>2002-02-01 04:34:17 +0000
commitbd4a9c13eb557b93f3e80f2c66226cbfe6082a82 (patch)
tree65878dfe4ebb3e9f077e408a572bc9227a524ded /epan/tvbuff.h
parenta9f7ef50586b671e402cf24f7175d07e18e0f180 (diff)
Provide tvb_ensure_length_remaining(), which is like
tvb_length_remaining() except that it throws BoundsError if 'offset' is out-of-bounds. Allow a length argument of -1 for FT_STRING and FT_BYTES fields in proto_tree_add_item(). Change some dissectors to either use -1 for the length argument in calls to proto_tree_add_item(), or call tvb_ensure_length_remaining() instead of tvb_length_remaining(), or to check the return-value of tvb_length_remaining(). Changes to more dissectors are necessary, but will follow later. svn path=/trunk/; revision=4656
Diffstat (limited to 'epan/tvbuff.h')
-rw-r--r--epan/tvbuff.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/epan/tvbuff.h b/epan/tvbuff.h
index 08403b5011..2de3f63650 100644
--- a/epan/tvbuff.h
+++ b/epan/tvbuff.h
@@ -9,7 +9,7 @@
* the data of a backing tvbuff, or can be a composite of
* other tvbuffs.
*
- * $Id: tvbuff.h,v 1.20 2001/11/20 22:46:12 guy Exp $
+ * $Id: tvbuff.h,v 1.21 2002/02/01 04:34:17 gram Exp $
*
* Copyright (c) 2000 by Gilbert Ramirez <gram@alumni.rice.edu>
*
@@ -192,6 +192,9 @@ extern guint tvb_length(tvbuff_t*);
* indicate that offset is out of bounds. No exception is thrown. */
extern gint tvb_length_remaining(tvbuff_t*, gint offset);
+/* Same as above, but throws BoundsError if the offset is out of bounds. */
+extern gint tvb_ensure_length_remaining(tvbuff_t*, gint offset);
+
/* Checks (w/o throwing exception) that the bytes referred to by
* 'offset'/'length' actually exist in the buffer */
extern gboolean tvb_bytes_exist(tvbuff_t*, gint offset, gint length);