fix compile warnings for ipaddr_aton

This commit is contained in:
devsaurus 2019-06-21 18:01:20 +02:00
parent 5f3c05bde8
commit 4c1d46c742
2 changed files with 117 additions and 107 deletions

View File

@ -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);

View File

@ -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);