mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-19 12:40:20 +00:00
minor: fixed coding style in ip4addr_aton()
This commit is contained in:
parent
f950bf4362
commit
dae73e21b8
@ -168,7 +168,7 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
|
||||
* 0x=hex, 0=octal, 1-9=decimal.
|
||||
*/
|
||||
if (!isdigit(c))
|
||||
return (0);
|
||||
return 0;
|
||||
val = 0;
|
||||
base = 10;
|
||||
if (c == '0') {
|
||||
@ -197,7 +197,7 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
|
||||
* a.b (with b treated as 24 bits)
|
||||
*/
|
||||
if (pp >= parts + 3) {
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
*pp++ = val;
|
||||
c = *++cp;
|
||||
@ -208,7 +208,7 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
|
||||
* Check for trailing characters.
|
||||
*/
|
||||
if (c != '\0' && !isspace(c)) {
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* Concoct the address according to
|
||||
@ -217,28 +217,28 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
|
||||
switch (pp - parts + 1) {
|
||||
|
||||
case 0:
|
||||
return (0); /* initial nondigit */
|
||||
return 0; /* initial nondigit */
|
||||
|
||||
case 1: /* a -- 32 bits */
|
||||
break;
|
||||
|
||||
case 2: /* a.b -- 8.24 bits */
|
||||
if (val > 0xffffffUL) {
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
val |= parts[0] << 24;
|
||||
break;
|
||||
|
||||
case 3: /* a.b.c -- 8.8.16 bits */
|
||||
if (val > 0xffff) {
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
val |= (parts[0] << 24) | (parts[1] << 16);
|
||||
break;
|
||||
|
||||
case 4: /* a.b.c.d -- 8.8.8.8 bits */
|
||||
if (val > 0xff) {
|
||||
return (0);
|
||||
return 0;
|
||||
}
|
||||
val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
|
||||
break;
|
||||
@ -249,7 +249,7 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
|
||||
if (addr) {
|
||||
ip4_addr_set_u32(addr, htonl(val));
|
||||
}
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user