I have got a problem when I try to compile a tool called netmate-0.9.5 which is written in C. Here is the following error, I get :
1 2 3 4
../../src/netmate/MetricData.h:101:34: error: cast from 'char*' to 'unsigned int' loses precision [-fpermissive]
(char*) (((unsignedint)(var) + DataTypeSize[type]-1)
I don't know very well the C language. I have tried to modify the line which launches an error as follows :
1 2
(char*) ((atoi(var) + DataTypeSize[type]-1)
This time the programm compiles, however when I execute the programm there is a "core dump". I don' know what to do.
By the way, I have got a 64 bits os (ubunutu 14.04) ? How can I solve this problem ? And if I don't succed in solving this problem, can somebody advice me another tool which can compute the metrics of a pcap file as easily as netmate.
Thanks in advance for any answer
I apologize for my bad english, it is not my native language.
It is really bad and old C code which will probably break on any 64bit PC. I do not know why it is done like that, but you may try to remove casts altogether: (var + DataTypeSize[type]-1)
When I try to compile, I have got this time the following error :
../../src/netmate/MetricData.h:102:25: error: invalid operands of types 'char*' and 'short unsigned int' to binary 'operator/'
DataTypeSize[type] * DataTypeSize[type]);
It does not like that I divise a char* with a short unsigned int. Any idea to overcome this pb.
Ok, I got it, it tries to align values. For quick fix, you can try replacing cast to unsignedint with cast to uintptr_t. Do not forget to include <stdint.h>