aboutsummaryrefslogtreecommitdiffstats
path: root/packet-diameter.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-02-20 01:20:24 +0000
committerGuy Harris <guy@alum.mit.edu>2001-02-20 01:20:24 +0000
commit3787d34ade9660a55f546ec7fc11c34b0451fa57 (patch)
tree381b00c5266de6742441d3a036d9de6c19ede97f /packet-diameter.c
parente917aa9088678533b62b50eddf2bedc57400585a (diff)
Don't do anything with 64-bit integral types if G_HAVE_GINT64 isn't
defined. Use "gint64" and "guint64", not "long long int", for 64-bit integral types, so that this code works with compilers (such as Microsoft Visual C++) that have 64-bit integral types but that don't call them "long long". Use "pntohll()" to extract 64-bit integral types from a field. Put a "break;" into a "default:" clause - MSVC++ doesn't like switch (XXX) { ... default: } svn path=/trunk/; revision=3051
Diffstat (limited to 'packet-diameter.c')
-rw-r--r--packet-diameter.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/packet-diameter.c b/packet-diameter.c
index 2de12232cf..a4de029f56 100644
--- a/packet-diameter.c
+++ b/packet-diameter.c
@@ -1,7 +1,7 @@
/* packet-diameter.c
* Routines for DIAMETER packet disassembly
*
- * $Id: packet-diameter.c,v 1.17 2001/02/19 23:16:36 guy Exp $
+ * $Id: packet-diameter.c,v 1.18 2001/02/20 01:20:24 guy Exp $
*
* Copyright (c) 2001 by David Frascone <dave@frascone.com>
*
@@ -660,21 +660,27 @@ static gchar *rd_value_to_str(e_avphdr *avph, const u_char *input, int length)
sprintf(buffer,"%u", intval);
}
break;
+#ifdef G_HAVE_GINT64
+ /* XXX - have to handle platforms without 64-bit integral
+ types.
+ Have to handle platforms where "%lld" and "%llu"
+ aren't the right formats to use to print 64-bit integral
+ types. */
case DIAMETER_INTEGER64:
{
- long long llval;
- llval = *((long long *)input);
- sprintf(buffer,"%lld (Unsupported Conversion. Byte ordering probably incorrect)",
- llval);
+ gint64 llval;
+ llval = pntohll(input);
+ sprintf(buffer,"%lld", llval);
}
+ break;
case DIAMETER_UNSIGNED64:
{
- long long llval;
- llval = *((long long *)input);
- sprintf(buffer,"%llu (Unsupported Conversion. Byte ordering probably incorrect)",
- llval);
+ guint64 llval;
+ llval = pntohll(input);
+ sprintf(buffer,"%llu", llval);
}
break;
+#endif
case DIAMETER_TIME:
{
struct tm lt;
@@ -686,7 +692,7 @@ static gchar *rd_value_to_str(e_avphdr *avph, const u_char *input, int length)
}
default:
/* Do nothing */
-
+ ;
}
return buffer;
} /* rd value to str */