diff options
author | krj <krj@f5534014-38df-0310-8fa8-9805f1628bb7> | 2009-10-04 06:28:50 +0000 |
---|---|---|
committer | krj <krj@f5534014-38df-0310-8fa8-9805f1628bb7> | 2009-10-04 06:28:50 +0000 |
commit | 5a185e7e7b6a5db1cfdeff42e4a59e4bde3b9565 (patch) | |
tree | 44eb88401ede6c49ecdbfbf187f7b972a75ca11d /epan/tvbuff.c | |
parent | b74aaecb6652a11217a3f32b52721689baafeefc (diff) |
Use GLibs CLAMP(). The current inlined implementation seems to be wrong:
} else if (bufsiz > TVB_Z_MAX_BUFSIZ) {
bufsiz = TVB_Z_MIN_BUFSIZ;
}
This should probably have been 'bufsiz = TVB_Z_MAX_BUFSIZ;'
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@30276 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/tvbuff.c')
-rw-r--r-- | epan/tvbuff.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/epan/tvbuff.c b/epan/tvbuff.c index f2a861985a..5a1d67498b 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -2857,8 +2857,6 @@ tvb_find_tvb(tvbuff_t *haystack_tvb, tvbuff_t *needle_tvb, gint haystack_offset) tvbuff_t * tvb_uncompress(tvbuff_t *tvb, int offset, int comprlen) { - - gint err = Z_OK; guint bytes_out = 0; guint8 *compr = NULL; @@ -2889,12 +2887,7 @@ tvb_uncompress(tvbuff_t *tvb, int offset, int comprlen) * the compressed size. */ bufsiz = tvb_length_remaining(tvb, offset) * 2; - - if (bufsiz < TVB_Z_MIN_BUFSIZ) { - bufsiz = TVB_Z_MIN_BUFSIZ; - } else if (bufsiz > TVB_Z_MAX_BUFSIZ) { - bufsiz = TVB_Z_MIN_BUFSIZ; - } + bufsiz = CLAMP(bufsiz, TVB_Z_MIN_BUFSIZ, TVB_Z_MAX_BUFSIZ); #ifdef TVB_Z_DEBUG printf("bufsiz: %u bytes\n", bufsiz); |