diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-04-24 21:53:05 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-04-24 21:53:05 +0000 |
commit | ed02576048c720c39a36ce746ee480672a340430 (patch) | |
tree | 28f11dfa7bce80675d7d156dc6386188c4f061a8 /epan | |
parent | 1be3f38a96447972db892bd47cf0cfea3c7a083c (diff) | |
download | wireshark-ed02576048c720c39a36ce746ee480672a340430.tar.gz wireshark-ed02576048c720c39a36ce746ee480672a340430.tar.bz2 wireshark-ed02576048c720c39a36ce746ee480672a340430.zip |
Use "gfloat" and "gdouble", rather than "float" and "double", as the
return types of the tvbuff accessors for floating-point types, to more
closely match the tvbuff accessors for integral types.
Fix an error in the code for fetching doubles on VAXes, and get rid of
unused union members on VAXes.
svn path=/trunk/; revision=5245
Diffstat (limited to 'epan')
-rw-r--r-- | epan/tvbuff.c | 28 | ||||
-rw-r--r-- | epan/tvbuff.h | 10 |
2 files changed, 18 insertions, 20 deletions
diff --git a/epan/tvbuff.c b/epan/tvbuff.c index 817ab8b9a3..6af9f46caf 100644 --- a/epan/tvbuff.c +++ b/epan/tvbuff.c @@ -9,7 +9,7 @@ * the data of a backing tvbuff, or can be a composite of * other tvbuffs. * - * $Id: tvbuff.c,v 1.33 2002/04/24 21:19:38 guy Exp $ + * $Id: tvbuff.c,v 1.34 2002/04/24 21:53:05 guy Exp $ * * Copyright (c) 2000 by Gilbert Ramirez <gram@alumni.rice.edu> * @@ -1055,7 +1055,7 @@ ieee_float_is_zero(guint32 w) return ((w & ~IEEE_SP_SIGN_MASK) == 0); } -static float +static gfloat get_ieee_float(guint32 w) { long sign; @@ -1116,7 +1116,7 @@ ieee_double_is_zero(guint64 w) return ((w & ~IEEE_SP_SIGN_MASK) == 0); } -static double +static gdouble get_ieee_double(guint64 w) { gint64 sign; @@ -1162,14 +1162,14 @@ get_ieee_double(guint64 w) * precision numbers that won't fit in some platform's native * "float" format? */ -float +gfloat tvb_get_ntohieee_float(tvbuff_t *tvb, int offset) { #if defined(vax) return get_ieee_float(tvb_get_ntohl(tvb, offset)); #else union { - float f; + gfloat f; guint32 w; } ieee_fp_union; @@ -1182,18 +1182,17 @@ tvb_get_ntohieee_float(tvbuff_t *tvb, int offset) * Fetches an IEEE double-precision floating-point number, in * big-endian form, and returns a "double". */ -double +gdouble tvb_get_ntohieee_double(tvbuff_t *tvb, int offset) { #if defined(vax) union { - double d; guint32 w[2]; guint64 dw; } ieee_fp_union; #else union { - double d; + gdouble d; guint32 w[2]; } ieee_fp_union; #endif @@ -1206,7 +1205,7 @@ tvb_get_ntohieee_double(tvbuff_t *tvb, int offset) ieee_fp_union.w[1] = tvb_get_ntohl(tvb, offset); #endif #if defined(vax) - return get_ieee_double(dw); + return get_ieee_double(ieee_fp_union.dw); #else return ieee_fp_union.d; #endif @@ -1247,14 +1246,14 @@ tvb_get_letohl(tvbuff_t *tvb, gint offset) * precision numbers that won't fit in some platform's native * "float" format? */ -float +gfloat tvb_get_letohieee_float(tvbuff_t *tvb, int offset) { #if defined(vax) return get_ieee_float(tvb_get_letohl(tvb, offset)); #else union { - float f; + gfloat f; guint32 w; } ieee_fp_union; @@ -1267,18 +1266,17 @@ tvb_get_letohieee_float(tvbuff_t *tvb, int offset) * Fetches an IEEE double-precision floating-point number, in * little-endian form, and returns a "double". */ -double +gdouble tvb_get_letohieee_double(tvbuff_t *tvb, int offset) { #if defined(vax) union { - double d; guint32 w[2]; guint64 dw; } ieee_fp_union; #else union { - double d; + gdouble d; guint32 w[2]; } ieee_fp_union; #endif @@ -1291,7 +1289,7 @@ tvb_get_letohieee_double(tvbuff_t *tvb, int offset) ieee_fp_union.w[1] = tvb_get_letohl(tvb, offset+4); #endif #if defined(vax) - return get_ieee_double(dw); + return get_ieee_double(ieee_fp_union.dw); #else return ieee_fp_union.d; #endif diff --git a/epan/tvbuff.h b/epan/tvbuff.h index 610ea545f5..8f419f9e2d 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.24 2002/04/12 23:25:24 guy Exp $ + * $Id: tvbuff.h,v 1.25 2002/04/24 21:53:05 guy Exp $ * * Copyright (c) 2000 by Gilbert Ramirez <gram@alumni.rice.edu> * @@ -230,14 +230,14 @@ extern guint8 tvb_get_guint8(tvbuff_t*, gint offset); extern guint16 tvb_get_ntohs(tvbuff_t*, gint offset); extern guint32 tvb_get_ntoh24(tvbuff_t*, gint offset); extern guint32 tvb_get_ntohl(tvbuff_t*, gint offset); -extern float tvb_get_ntohieee_float(tvbuff_t*, gint offset); -extern double tvb_get_ntohieee_double(tvbuff_t*, gint offset); +extern gfloat tvb_get_ntohieee_float(tvbuff_t*, gint offset); +extern gdouble tvb_get_ntohieee_double(tvbuff_t*, gint offset); extern guint16 tvb_get_letohs(tvbuff_t*, gint offset); extern guint32 tvb_get_letoh24(tvbuff_t*, gint offset); extern guint32 tvb_get_letohl(tvbuff_t*, gint offset); -extern float tvb_get_letohieee_float(tvbuff_t*, gint offset); -extern double tvb_get_letohieee_double(tvbuff_t*, gint offset); +extern gfloat tvb_get_letohieee_float(tvbuff_t*, gint offset); +extern gdouble tvb_get_letohieee_double(tvbuff_t*, gint offset); /* Returns target for convenience. Does not suffer from possible * expense of tvb_get_ptr(), since this routine is smart enough |