mirror of
https://github.com/nodemcu/nodemcu-firmware.git
synced 2025-01-30 21:12:55 +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;
|
size_t len;
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
|
ip_addr_t ipAddr;
|
||||||
|
ipAddr.type = IPADDR_TYPE_V4;
|
||||||
|
|
||||||
luaL_checkanytable (L, 1);
|
luaL_checkanytable (L, 1);
|
||||||
|
|
||||||
//memset(&ipInfo, 0, sizeof(tcpip_adapter_ip_info_t));
|
//memset(&ipInfo, 0, sizeof(tcpip_adapter_ip_info_t));
|
||||||
|
|
||||||
lua_getfield (L, 1, "ip");
|
lua_getfield (L, 1, "ip");
|
||||||
str = luaL_checklstring (L, -1, &len);
|
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");
|
return luaL_error(L, "Could not parse IP address, aborting");
|
||||||
}
|
}
|
||||||
|
ipInfo.ip = ipAddr.u_addr.ip4;
|
||||||
|
|
||||||
lua_getfield (L, 1, "gateway");
|
lua_getfield (L, 1, "gateway");
|
||||||
str = luaL_checklstring (L, -1, &len);
|
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");
|
return luaL_error(L, "Could not parse Gateway address, aborting");
|
||||||
}
|
}
|
||||||
|
ipInfo.gw = ipAddr.u_addr.ip4;
|
||||||
|
|
||||||
lua_getfield (L, 1, "netmask");
|
lua_getfield (L, 1, "netmask");
|
||||||
str = luaL_checklstring (L, -1, &len);
|
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");
|
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));
|
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)
|
static int wifi_ap_sethostname(lua_State *L)
|
||||||
{
|
{
|
||||||
|
|
||||||
size_t l;
|
size_t l;
|
||||||
esp_err_t err;
|
esp_err_t err;
|
||||||
const char *hostname = luaL_checklstring(L, 1, &l);
|
const char *hostname = luaL_checklstring(L, 1, &l);
|
||||||
|
@ -170,30 +170,36 @@ static int wifi_sta_setip(lua_State *L)
|
|||||||
size_t len;
|
size_t len;
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
|
ip_addr_t ipAddr;
|
||||||
|
ipAddr.type = IPADDR_TYPE_V4;
|
||||||
|
|
||||||
luaL_checkanytable (L, 1);
|
luaL_checkanytable (L, 1);
|
||||||
|
|
||||||
//memset(&ipInfo, 0, sizeof(tcpip_adapter_ip_info_t));
|
//memset(&ipInfo, 0, sizeof(tcpip_adapter_ip_info_t));
|
||||||
|
|
||||||
lua_getfield (L, 1, "ip");
|
lua_getfield (L, 1, "ip");
|
||||||
str = luaL_checklstring (L, -1, &len);
|
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");
|
return luaL_error(L, "Could not parse IP address, aborting");
|
||||||
}
|
}
|
||||||
|
ipInfo.ip = ipAddr.u_addr.ip4;
|
||||||
|
|
||||||
lua_getfield (L, 1, "netmask");
|
lua_getfield (L, 1, "netmask");
|
||||||
str = luaL_checklstring (L, -1, &len);
|
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");
|
return luaL_error(L, "Could not parse Netmask, aborting");
|
||||||
}
|
}
|
||||||
|
ipInfo.netmask = ipAddr.u_addr.ip4;
|
||||||
|
|
||||||
lua_getfield (L, 1, "gateway");
|
lua_getfield (L, 1, "gateway");
|
||||||
str = luaL_checklstring (L, -1, &len);
|
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");
|
return luaL_error(L, "Could not parse Gateway address, aborting");
|
||||||
}
|
}
|
||||||
|
ipInfo.gw = ipAddr.u_addr.ip4;
|
||||||
|
|
||||||
lua_getfield (L, 1, "dns");
|
lua_getfield (L, 1, "dns");
|
||||||
str = luaL_optlstring(L, -1, str, &len);
|
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)
|
static int wifi_sta_sethostname(lua_State *L)
|
||||||
{
|
{
|
||||||
|
|
||||||
size_t l;
|
size_t l;
|
||||||
esp_err_t err;
|
esp_err_t err;
|
||||||
const char *hostname = luaL_checklstring(L, 1, &l);
|
const char *hostname = luaL_checklstring(L, 1, &l);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user