mirror of
https://github.com/nodemcu/nodemcu-firmware.git
synced 2025-01-16 20:52:57 +08:00
fix compile warnings for ipaddr_aton
This commit is contained in:
parent
5f3c05bde8
commit
4c1d46c742
@ -131,30 +131,36 @@ static int wifi_ap_setip(lua_State *L)
|
||||
size_t len;
|
||||
const char *str;
|
||||
|
||||
ip_addr_t ipAddr;
|
||||
ipAddr.type = IPADDR_TYPE_V4;
|
||||
|
||||
luaL_checkanytable (L, 1);
|
||||
|
||||
//memset(&ipInfo, 0, sizeof(tcpip_adapter_ip_info_t));
|
||||
|
||||
lua_getfield (L, 1, "ip");
|
||||
str = luaL_checklstring (L, -1, &len);
|
||||
if(!ipaddr_aton(str, &ipInfo.ip))
|
||||
if(!ipaddr_aton(str, &ipAddr))
|
||||
{
|
||||
return luaL_error(L, "Could not parse IP address, aborting");
|
||||
}
|
||||
ipInfo.ip = ipAddr.u_addr.ip4;
|
||||
|
||||
lua_getfield (L, 1, "gateway");
|
||||
str = luaL_checklstring (L, -1, &len);
|
||||
if(!ipaddr_aton(str, &ipInfo.gw))
|
||||
if(!ipaddr_aton(str, &ipAddr))
|
||||
{
|
||||
return luaL_error(L, "Could not parse Gateway address, aborting");
|
||||
}
|
||||
ipInfo.gw = ipAddr.u_addr.ip4;
|
||||
|
||||
lua_getfield (L, 1, "netmask");
|
||||
str = luaL_checklstring (L, -1, &len);
|
||||
if(!ipaddr_aton(str, &ipInfo.netmask))
|
||||
if(!ipaddr_aton(str, &ipAddr))
|
||||
{
|
||||
return luaL_error(L, "Could not parse Netmask, aborting");
|
||||
}
|
||||
ipInfo.netmask = ipAddr.u_addr.ip4;
|
||||
|
||||
ESP_ERROR_CHECK(tcpip_adapter_dhcps_stop(TCPIP_ADAPTER_IF_AP));
|
||||
|
||||
@ -178,7 +184,6 @@ static int wifi_ap_setip(lua_State *L)
|
||||
|
||||
static int wifi_ap_sethostname(lua_State *L)
|
||||
{
|
||||
|
||||
size_t l;
|
||||
esp_err_t err;
|
||||
const char *hostname = luaL_checklstring(L, 1, &l);
|
||||
|
@ -170,30 +170,36 @@ static int wifi_sta_setip(lua_State *L)
|
||||
size_t len;
|
||||
const char *str;
|
||||
|
||||
ip_addr_t ipAddr;
|
||||
ipAddr.type = IPADDR_TYPE_V4;
|
||||
|
||||
luaL_checkanytable (L, 1);
|
||||
|
||||
//memset(&ipInfo, 0, sizeof(tcpip_adapter_ip_info_t));
|
||||
|
||||
lua_getfield (L, 1, "ip");
|
||||
str = luaL_checklstring (L, -1, &len);
|
||||
if(!ipaddr_aton(str, &ipInfo.ip))
|
||||
if(!ipaddr_aton(str, &ipAddr))
|
||||
{
|
||||
return luaL_error(L, "Could not parse IP address, aborting");
|
||||
}
|
||||
ipInfo.ip = ipAddr.u_addr.ip4;
|
||||
|
||||
lua_getfield (L, 1, "netmask");
|
||||
str = luaL_checklstring (L, -1, &len);
|
||||
if(!ipaddr_aton(str, &ipInfo.netmask))
|
||||
if(!ipaddr_aton(str, &ipAddr))
|
||||
{
|
||||
return luaL_error(L, "Could not parse Netmask, aborting");
|
||||
}
|
||||
ipInfo.netmask = ipAddr.u_addr.ip4;
|
||||
|
||||
lua_getfield (L, 1, "gateway");
|
||||
str = luaL_checklstring (L, -1, &len);
|
||||
if(!ipaddr_aton(str, &ipInfo.gw))
|
||||
if(!ipaddr_aton(str, &ipAddr))
|
||||
{
|
||||
return luaL_error(L, "Could not parse Gateway address, aborting");
|
||||
}
|
||||
ipInfo.gw = ipAddr.u_addr.ip4;
|
||||
|
||||
lua_getfield (L, 1, "dns");
|
||||
str = luaL_optlstring(L, -1, str, &len);
|
||||
@ -211,7 +217,6 @@ static int wifi_sta_setip(lua_State *L)
|
||||
|
||||
static int wifi_sta_sethostname(lua_State *L)
|
||||
{
|
||||
|
||||
size_t l;
|
||||
esp_err_t err;
|
||||
const char *hostname = luaL_checklstring(L, 1, &l);
|
||||
|
Loading…
x
Reference in New Issue
Block a user