lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] inet_ntoa()


From: Mountifield, Tony
Subject: [lwip-devel] inet_ntoa()
Date: Wed, 21 Jul 2004 10:57:57 +0100

Leon,
 
I've been committing a few pretty trivial changes this morning, mainly to do 
with types and casts, and was just about to do an update to inet_ntoa() in 
inet.c when I noticed that they partially undo changes you made not too long 
ago, in versions 1.18 and 1.15.2.3. So I thought I'd raise it here first. I'm 
also aware of bug #8864, although I'm not sure whether any of your changes were 
to address that. I believe my suggestion would not (re-)introduce that bug, and 
may fix it if it still outstanding.
 
There is currently a bit of confusion between char and u8_t, which causes 
warnings with compilers that treat char as signed (the C standard says it is 
implementation dependent whether plain chars are signed or unsigned). I wanted 
to change the types so that u8_t is used to extract the bytes from the address, 
but plain char is used for the output string and the characters in it, to match 
the return type of the function. Here is my proposed diff, that I haven't 
committed yet:
 
Index: src/core/inet.c
===================================================================
RCS file: /cvsroot/lwip/lwip/src/core/inet.c,v
retrieving revision 1.18
diff -u -r1.18 inet.c
--- src/core/inet.c     28 Apr 2004 23:18:57 -0000      1.18
+++ src/core/inet.c     21 Jul 2004 09:39:29 -0000
@@ -302,17 +302,17 @@
  */
 char *inet_ntoa(struct in_addr addr)
 {
-  static u8_t str[16];
+  static char str[16];
   u32_t s_addr = addr.s_addr;
-  u8_t inv[3];
-  u8_t *rp;
+  char inv[3];
+  char *rp;
   u8_t *ap;
   u8_t rem;
   u8_t n;
   u8_t i;
 
   rp = str;
-  ap = (char *)&s_addr;
+  ap = (u8_t *)&s_addr;
   for(n = 0; n < 4; n++) {
     i = 0;
     do {

Cheers,
Tony (softins)
-- 
Tony Mountifield
Contractor @ Tandberg TV
Strategic Park, ext 3390
Tel: 023 8057 3390
 


***********************************************************************************
This email, its content and any attachments is PRIVATE AND
CONFIDENTIAL to TANDBERG Television. If received in error please
notify the sender and destroy the original message and attachments.

www.tandbergtv.com
***********************************************************************************





reply via email to

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