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
This commit is contained in:
parent
e917aa9088
commit
3787d34ade
1 changed files with 19 additions and 13 deletions
|
@ -1,7 +1,7 @@
|
||||||
/* packet-diameter.c
|
/* packet-diameter.c
|
||||||
* Routines for DIAMETER packet disassembly
|
* 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>
|
* 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);
|
sprintf(buffer,"%u", intval);
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case DIAMETER_INTEGER64:
|
||||||
{
|
{
|
||||||
long long llval;
|
gint64 llval;
|
||||||
llval = *((long long *)input);
|
llval = pntohll(input);
|
||||||
sprintf(buffer,"%lld (Unsupported Conversion. Byte ordering probably incorrect)",
|
sprintf(buffer,"%lld", llval);
|
||||||
llval);
|
|
||||||
}
|
|
||||||
case DIAMETER_UNSIGNED64:
|
|
||||||
{
|
|
||||||
long long llval;
|
|
||||||
llval = *((long long *)input);
|
|
||||||
sprintf(buffer,"%llu (Unsupported Conversion. Byte ordering probably incorrect)",
|
|
||||||
llval);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case DIAMETER_UNSIGNED64:
|
||||||
|
{
|
||||||
|
guint64 llval;
|
||||||
|
llval = pntohll(input);
|
||||||
|
sprintf(buffer,"%llu", llval);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case DIAMETER_TIME:
|
case DIAMETER_TIME:
|
||||||
{
|
{
|
||||||
struct tm lt;
|
struct tm lt;
|
||||||
|
@ -686,7 +692,7 @@ static gchar *rd_value_to_str(e_avphdr *avph, const u_char *input, int length)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
/* Do nothing */
|
/* Do nothing */
|
||||||
|
;
|
||||||
}
|
}
|
||||||
return buffer;
|
return buffer;
|
||||||
} /* rd value to str */
|
} /* rd value to str */
|
||||||
|
|
Loading…
Reference in a new issue