ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Problem with uint preference

From: Jeff Morriss <jeff.morriss@xxxxxxxxxxx>
Date: Wed, 31 Jan 2007 10:05:41 +0800


Hal Lander wrote:
I registered a boolean preference and it worked.
However, when I try and follow the same process with a uint it fails when I try and edit the preference and 'apply' the change. The message I get is;

    "The value for "xxxxxxTitle" isn't a valid number."
[...]
The code I am using is given below, along with the edit I tried on preferences.

Should I be editing the preferences file by hand to add in the variable.

No, there should never be any need to edit the preferences file by hand.

Any ideas what I am doing wrong?
[...]
static gboolean prefTick;
static guint prefVer;

       prefTick=TRUE;
       prefVer=123;
prefs_register_bool_preference(foo_module,"tick","TickTitle","TickDescription",&prefTick); prefs_register_uint_preference(foo_module,"xxxxxx","xxxxxxTitle","xxxxxxDescription",BASE_DEC,&prefVer);

The 'base' field in 'prefs_register_uint_preference()' is the base used by 'strtoul()' when converting the string "123" into an unsigned integer. Don't use BASE_DEC (whose value is 1) here but rather 0 or 10 if you want to input a decimal number.

I just checked in a change to README.developer to explain what this parameter should be.