at2 swap_nibbles

Sindunata Sudarmaji <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <20021122162334.A2281@top4>
Hi All,

I'm running kannel 1.2.1 (RH7.3) with Siemens TC35, and I think I've
found another bug in AT2 swap_nibbles handling. The MSB bit is not
correctly swapped because we're using signed char.

Please find below my patch against CVS HEAD:

Index: smsc_at2.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_at2.c,v
retrieving revision 1.11
diff -u -r1.11 smsc_at2.c
--- smsc_at2.c	14 Nov 2002 02:29:25 -0000	1.11
+++ smsc_at2.c	22 Nov 2002 09:14:36 -0000
@@ -2237,7 +2237,7 @@
 }
 
 
-int swap_nibbles(char byte)
+int swap_nibbles(unsigned char byte)
 {
     return ( ( byte & 15 ) * 10 ) + ( byte >> 4 );
 }
Index: smsc_at2.h
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_at2.h,v
retrieving revision 1.2
diff -u -r1.2 smsc_at2.h
--- smsc_at2.h	22 Aug 2002 17:29:39 -0000	1.2
+++ smsc_at2.h	22 Nov 2002 09:14:36 -0000
@@ -298,7 +298,7 @@
  * Implementation completly ripped off Dennis Malmstrom timestamp 
  * patches against 1.0.3. Thanks Dennis! 
  */
-int	swap_nibbles(char byte);
+int	swap_nibbles(unsigned char byte);
 
 /*
  * creates a buffer with a valid PDU address field as per [GSM 03.40]


ps. I'm not subscribed to the list, so please reply to me directly.

regards,
Sindu
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.