Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
4c1d46c7
Commit
4c1d46c7
authored
Jun 21, 2019
by
devsaurus
Browse files
fix compile warnings for ipaddr_aton
parent
5f3c05bd
Changes
2
Show whitespace changes
Inline
Side-by-side
components/modules/wifi_ap.c
View file @
4c1d46c7
...
@@ -131,30 +131,36 @@ static int wifi_ap_setip(lua_State *L)
...
@@ -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
,
&
ip
Info
.
ip
))
if
(
!
ipaddr_aton
(
str
,
&
ip
Addr
))
{
{
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
,
&
ip
Info
.
gw
))
if
(
!
ipaddr_aton
(
str
,
&
ip
Addr
))
{
{
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
,
&
ip
Info
.
netmask
))
if
(
!
ipaddr_aton
(
str
,
&
ip
Addr
))
{
{
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)
...
@@ -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
);
...
...
components/modules/wifi_sta.c
View file @
4c1d46c7
...
@@ -170,30 +170,36 @@ static int wifi_sta_setip(lua_State *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
,
&
ip
Info
.
ip
))
if
(
!
ipaddr_aton
(
str
,
&
ip
Addr
))
{
{
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
,
&
ip
Info
.
netmask
))
if
(
!
ipaddr_aton
(
str
,
&
ip
Addr
))
{
{
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
,
&
ip
Info
.
gw
))
if
(
!
ipaddr_aton
(
str
,
&
ip
Addr
))
{
{
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)
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment