diff options
author | Guy Harris <guy@alum.mit.edu> | 2003-06-26 08:47:31 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2003-06-26 08:47:31 +0000 |
commit | 8fdb55e9e6b2a41a7b79e16a9dc386c49bb4204b (patch) | |
tree | 51f37ca82dbf182b94500994f1371a6e09ce8670 | |
parent | a9af7329b8d425732995327ab907b71e1b507a76 (diff) |
Make the definition of "fc32_to_str()" match its prototype.
Make it have the usual collection of 3 static buffers, just in case
somebody decides to call it more than once in the same
printf-like-routine call.
svn path=/trunk/; revision=7940
-rw-r--r-- | epan/to_str.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/epan/to_str.c b/epan/to_str.c index cd8e185640..215a1c757a 100644 --- a/epan/to_str.c +++ b/epan/to_str.c @@ -1,7 +1,7 @@ /* to_str.c * Routines for utilities to convert various other types to strings. * - * $Id: to_str.c,v 1.27 2003/06/24 15:37:31 sahlberg Exp $ + * $Id: to_str.c,v 1.28 2003/06/26 08:47:31 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -585,11 +585,21 @@ fc_to_str(const guint8 *ad) /* convert the fc id stored in the three high order bytes of a guint32 into a fc id string*/ gchar * -fc32_to_str(const guint32 ad32) +fc32_to_str(guint32 ad32) { - static gchar str[9]; - sprintf(str,"%02x.%02x.%02x", ad32&0xff, (ad32>>8)&0xff, (ad32>>16)&0xff); - return str; + static gchar *cur; + static gchar str[3][9]; + + if (cur == &str[0][0]) { + cur = &str[1][0]; + } else if (cur == &str[1][0]) { + cur = &str[2][0]; + } else { + cur = &str[0][0]; + } + + sprintf(cur,"%02x.%02x.%02x", ad32&0xff, (ad32>>8)&0xff, (ad32>>16)&0xff); + return cur; } /* FC Network Header Network Address Authority Identifiers */ |