gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patch] unsigned ints for cell_id and LAC in gn_network_info struct


From: Pawel Kot
Subject: Re: [patch] unsigned ints for cell_id and LAC in gn_network_info structure
Date: Wed, 22 Jan 2003 23:12:47 +0100 (CET)

Hi Bertrik,

Thanks for the patch. One comment on it.

You define:
+       unsigned int cell_id;
+       unsigned int LAC;
and we have
unsigned char message[];
Now you do the assignments:
+         data->network_info->cell_id = (message[10] << 8) + message[11];
+         data->network_info->LAC = (message[12] << 8) + message[13];
+         data->network_info->cell_id = (blockstart[6] << 8) + blockstart[7];
+         data->network_info->LAC = (blockstart[2] << 8) + blockstart[3];
+         data->network_info->cell_id = (blockstart[4] << 8) + blockstart[5];
+         data->network_info->LAC = (blockstart[6] << 8) + blockstart[7];
blockstart[] is also unsigned char array.

Which is unfortunately incorrect what we recently experienced.

(blockstart[N] << 8) and (message[N] << 8) are also of the unsigned char
type! So it is not what we wanted. This is recently discivered by me and
not fixed yet all over gnokii.

The correct form would be:
LAC = message[12] * 256 + message[13]
or
LAC = (((unsigned int)message[12]) << 8) + message[13]

Would you mind to correct the patch?

pkot
-- 
mailto:address@hidden :: mailto:address@hidden
http://kt.linuxnews.pl/ :: Kernel Traffic po polsku






reply via email to

[Prev in Thread] Current Thread [Next in Thread]