aboutsummaryrefslogtreecommitdiffstats
path: root/epan/tvbuff.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-04-24 21:53:05 +0000
committerGuy Harris <guy@alum.mit.edu>2002-04-24 21:53:05 +0000
commited02576048c720c39a36ce746ee480672a340430 (patch)
tree28f11dfa7bce80675d7d156dc6386188c4f061a8 /epan/tvbuff.c
parent1be3f38a96447972db892bd47cf0cfea3c7a083c (diff)
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/tvbuff.c')
-rw-r--r--epan/tvbuff.c28
1 files changed, 13 insertions, 15 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