Re: [Wireshark-dev] Problem with uint preference
Hi Jeff, That did the trick :-) I had seen the defines for the various bases so when the function asked for a base I just plugged BASE_DEC in. The old documentation did misslead me but I could kick myself for not plugging in the obvious 10 ! Thanks for clearing that up. Hal From: Jeff Morriss [EMAIL PROTECTED] Reply-To: Developer support list for Wireshark wireshark-dev@wireshark.org To: Developer support list for Wireshark wireshark-dev@wireshark.org Subject: Re: [Wireshark-dev] Problem with uint preference 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 xxTitle 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,xx,xxTitle,xxDescription,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. ___ Wireshark-dev mailing list Wireshark-dev@wireshark.org http://www.wireshark.org/mailman/listinfo/wireshark-dev _ FREE online classifieds from Windows Live Expo buy and sell with people you know http://clk.atdmt.com/MSN/go/msnnkwex001001msn/direct/01/?href=http://expo.live.com?s_cid=Hotmail_tagline_12/06 ___ Wireshark-dev mailing list Wireshark-dev@wireshark.org http://www.wireshark.org/mailman/listinfo/wireshark-dev
[Wireshark-dev] Problem with uint preference
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 xxTitle isn't a valid number. If I comment out the call to prefs_register_uint_preference then registering the boolean works. To use the boolean I did not need to modify the preferences file by hand, the section for foo.tick appears by itself. I did try editing the preferences file by hand to add in the problem variable but that did not help. 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. Any ideas what I am doing wrong? # xxDescription # A decimal number. foo.xx: 99 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,xx,xxTitle,xxDescription,BASE_DEC,prefVer); TIA Hal P.S. Sometimes when I open the dialog box to edit the preference there is garbage in the uint field _ From predictions to trailers, check out the MSN Entertainment Guide to the Academy Awards® http://movies.msn.com/movies/oscars2007/?icid=ncoscartagline1 ___ Wireshark-dev mailing list Wireshark-dev@wireshark.org http://www.wireshark.org/mailman/listinfo/wireshark-dev
Re: [Wireshark-dev] Problem with uint preference
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 xxTitle 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,xx,xxTitle,xxDescription,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. ___ Wireshark-dev mailing list Wireshark-dev@wireshark.org http://www.wireshark.org/mailman/listinfo/wireshark-dev