initialize new memebers in station_config and scan_config (#2309)
Initialize new members in station_config and scan_config
This commit is contained in:
parent
f8311855d1
commit
6218b9263b
|
@ -664,6 +664,8 @@ static int enduser_setup_http_handle_credentials(char *data, unsigned short data
|
||||||
|
|
||||||
struct station_config *cnf = luaM_malloc(lua_getstate(), sizeof(struct station_config));
|
struct station_config *cnf = luaM_malloc(lua_getstate(), sizeof(struct station_config));
|
||||||
c_memset(cnf, 0, sizeof(struct station_config));
|
c_memset(cnf, 0, sizeof(struct station_config));
|
||||||
|
cnf->threshold.rssi = -127;
|
||||||
|
cnf->threshold.authmode = AUTH_OPEN;
|
||||||
|
|
||||||
int err;
|
int err;
|
||||||
err = enduser_setup_http_urldecode(cnf->ssid, name_str_start, name_str_len, sizeof(cnf->ssid));
|
err = enduser_setup_http_urldecode(cnf->ssid, name_str_start, name_str_len, sizeof(cnf->ssid));
|
||||||
|
|
|
@ -722,10 +722,7 @@ static int wifi_station_clear_config ( lua_State* L )
|
||||||
bool auto_connect=true;
|
bool auto_connect=true;
|
||||||
bool save_to_flash=true;
|
bool save_to_flash=true;
|
||||||
|
|
||||||
memset(sta_conf.ssid, 0, sizeof(sta_conf.ssid));
|
memset(&sta_conf, 0, sizeof(sta_conf));
|
||||||
memset(sta_conf.password, 0, sizeof(sta_conf.password));
|
|
||||||
memset(sta_conf.bssid, 0, sizeof(sta_conf.bssid));
|
|
||||||
sta_conf.bssid_set=0;
|
|
||||||
|
|
||||||
wifi_station_disconnect();
|
wifi_station_disconnect();
|
||||||
|
|
||||||
|
@ -753,10 +750,9 @@ static int wifi_station_config( lua_State* L )
|
||||||
bool save_to_flash=true;
|
bool save_to_flash=true;
|
||||||
size_t sl, pl, ml;
|
size_t sl, pl, ml;
|
||||||
|
|
||||||
memset(sta_conf.ssid, 0, sizeof(sta_conf.ssid));
|
memset(&sta_conf, 0, sizeof(sta_conf));
|
||||||
memset(sta_conf.password, 0, sizeof(sta_conf.password));
|
sta_conf.threshold.rssi = -127;
|
||||||
memset(sta_conf.bssid, 0, sizeof(sta_conf.bssid));
|
sta_conf.threshold.authmode = AUTH_OPEN;
|
||||||
sta_conf.bssid_set=0;
|
|
||||||
|
|
||||||
if(lua_istable(L, 1))
|
if(lua_istable(L, 1))
|
||||||
{
|
{
|
||||||
|
@ -1032,6 +1028,8 @@ static int wifi_station_listap( lua_State* L )
|
||||||
return luaL_error( L, "Can't list ap in SOFTAP mode" );
|
return luaL_error( L, "Can't list ap in SOFTAP mode" );
|
||||||
}
|
}
|
||||||
struct scan_config scan_cfg;
|
struct scan_config scan_cfg;
|
||||||
|
memset(&scan_cfg, 0, sizeof(scan_cfg));
|
||||||
|
|
||||||
getap_output_format=0;
|
getap_output_format=0;
|
||||||
|
|
||||||
if (lua_type(L, 1)==LUA_TTABLE)
|
if (lua_type(L, 1)==LUA_TTABLE)
|
||||||
|
@ -1061,10 +1059,6 @@ static int wifi_station_listap( lua_State* L )
|
||||||
return luaL_error( L, "wrong arg type" );
|
return luaL_error( L, "wrong arg type" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
scan_cfg.ssid=NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
lua_getfield(L, 1, "bssid");
|
lua_getfield(L, 1, "bssid");
|
||||||
if (!lua_isnil(L, -1)) /* found? */
|
if (!lua_isnil(L, -1)) /* found? */
|
||||||
|
@ -1085,10 +1079,6 @@ static int wifi_station_listap( lua_State* L )
|
||||||
return luaL_error( L, "wrong arg type" );
|
return luaL_error( L, "wrong arg type" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
scan_cfg.bssid=NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
lua_getfield(L, 1, "channel");
|
lua_getfield(L, 1, "channel");
|
||||||
|
@ -1107,10 +1097,6 @@ static int wifi_station_listap( lua_State* L )
|
||||||
return luaL_error( L, "wrong arg type" );
|
return luaL_error( L, "wrong arg type" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
scan_cfg.channel=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
lua_getfield(L, 1, "show_hidden");
|
lua_getfield(L, 1, "show_hidden");
|
||||||
if (!lua_isnil(L, -1)) /* found? */
|
if (!lua_isnil(L, -1)) /* found? */
|
||||||
|
@ -1129,10 +1115,6 @@ static int wifi_station_listap( lua_State* L )
|
||||||
return luaL_error( L, "wrong arg type" );
|
return luaL_error( L, "wrong arg type" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
scan_cfg.show_hidden=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lua_type(L, 2) == LUA_TFUNCTION || lua_type(L, 2) == LUA_TLIGHTFUNCTION)
|
if (lua_type(L, 2) == LUA_TFUNCTION || lua_type(L, 2) == LUA_TLIGHTFUNCTION)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue