Wireshark-dev: [Wireshark-dev] where is the best place to do the calculation
From: Brian Oleksa <oleksab@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 21 Jul 2010 10:57:53 -0400

Wiresharkers

Where is the best place to do the calculation..??

I just put it in the proto_tree_add_item section....but I am getting an error.

Here is the java code:
double latitude = (double) BitByteUtil.getUnsignedInt(buffer) / 1000000 - 90.0;


Here is my C (wireshark code):

       { &hf_olsr_latitude,
{ "OLSR Latitude", "olsr.latitude", FT_UINT32, BASE_DEC, NULL, 0x0,
               NULL, HFILL}},


           //OLSR Latitude
proto_tree_add_item(olsr_sub_tree, hf_olsr_latitude / (1000000 - 90.0), tvb, offset, 4, FALSE);
           offset += 4;

Also...I am not seeing what type this should be.

Should latitude be a FT_FLOAT, FT_DOUBLE or what I have FT_UINT32. No matter what I try...I get the conversion from double to int possible loss of data error.

Any help is greatly appreciated.

Thanks,
Brian