ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 27844: /trunk/epan/dissectors/ /trun

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 25 Mar 2009 02:46:36 -0700

On Mar 25, 2009, at 2:23 AM, Joerg Mayer wrote:

The problem seems to be that only the last two characters are shown instead
of the full length string. A problem with g_snprintf may be that it
doesn't like to use a rhs argument as its lhs result.

Not that you should be doing that anyway.

What they're doing is attempting to append to a string buffer.

There's a somewhat ugly idiom, used in a number of places, to do that with g_snprintf(); it's probably faster, as you don't have to copy the string on top of itself.

Then again, if they want capital letters for hex digits, they could just use bytes_to_str() in most if not all of those cases, and if they want lower-case letters, they could use bytestring_to_str(). (Yes, having all those routines for this is overkill.)