Ethereal-dev: Re: [ethereal-dev] 0.8.6: display bug

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Gilbert Ramirez Jr." <gram@xxxxxxxxxx>
Date: Tue, 11 Apr 2000 09:24:22 -0400
On Mon, Apr 10, 2000 at 09:29:17PM -0700, Guy Harris wrote:
> > Gilbert, is this a result of the issue mentioned here?
> 
> Yes, it does appear to be related.

(Sorry, I was offline for a few days with a family emergency)
 
> "fill_label_boolean()" "unshifts" the value in "fi->value.numeric"
> before handing it to "decode_bitfield_value()".
> 
> However, given that "proto_tree_set_boolean()" didn't shift the value in
> the first place, "unshifting" shifts the relevant bits out of the way.

Yeah, looking at the old proto.c, FT_BOOLEAN was the same case as
FT_UINT*:

                case FT_BOOLEAN:
                case FT_UINT8:
                case FT_UINT16:
                case FT_UINT24:
                case FT_UINT32:
                case FT_INT8:
                case FT_INT16:
                case FT_INT24:
                case FT_INT32:
                        fi->value.numeric = va_arg(ap, unsigned int);
                        if (hfinfo->bitmask) {
                                /* Mask out irrelevant portions */
                                fi->value.numeric &= hfinfo->bitmask;

                                /* Shift bits */
                                if (hfinfo->bitshift > 0) {
                                        fi->value.numeric >>= hfinfo->bitshift;
                                }
                        }
                        break;

> So I suspect the right fix is either to make "proto_tree_set_boolean()"
> do exactly what "proto_tree_set_uint()" does, or to nuke
> "proto_tree_set_boolean()" and use "proto_tree_set_uint()" for Boolean
> fields as well as integral fields.

We should keep proto_tree_set_boolean and make it call *set_uint(), as andreas
mentioned in his e-mail.

--gilbert