Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sscanf] use rt_sscanf to replace sscanf #9700

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bsp/nuvoton/libraries/m460/rtt_port/drv_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@ void devmem(int argc, char *argv[])

if (argc == 3)
{
if (sscanf(argv[2], "0x%x", &value) != 1)
if (rt_sscanf(argv[2], "0x%x", &value) != 1)
goto exit_devmem;
mode = 1; /*Write*/
}

if (sscanf(argv[1], "0x%x", &u32Addr) != 1)
if (rt_sscanf(argv[1], "0x%x", &u32Addr) != 1)
goto exit_devmem;
else if (!u32Addr || u32Addr & (4 - 1))
goto exit_devmem;
Expand Down Expand Up @@ -203,12 +203,12 @@ void devmem2(int argc, char *argv[])

if (argc == 3)
{
if (sscanf(argv[2], "%u", &value) != 1)
if (rt_sscanf(argv[2], "%u", &value) != 1)
goto exit_devmem;
word_count = value;
}

if (sscanf(argv[1], "0x%x", &u32Addr) != 1)
if (rt_sscanf(argv[1], "0x%x", &u32Addr) != 1)
goto exit_devmem;
else if (!u32Addr || u32Addr & (4 - 1))
goto exit_devmem;
Expand Down
4 changes: 2 additions & 2 deletions bsp/nuvoton/libraries/ma35/rtt_port/drv_disp.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ static rt_err_t lcd_set_overlay_colkey(int argc, char **argv)

for (index = 0; index < (len - 1); index ++)
{
if (sscanf(argv[index + 1], "%x", &arg[index]) != 1)
if (rt_sscanf(argv[index + 1], "%x", &arg[index]) != 1)
return -1;
}
rt_kprintf("colkeylow:0x%08x colkeyhigh:0x%08x\n", arg[0], arg[1]);
Expand Down Expand Up @@ -459,7 +459,7 @@ static rt_err_t lcd_set_alphablend_opmode(int argc, char **argv)

for (index = 0; index < (len - 1); index ++)
{
if (sscanf(argv[index + 1], "%x", &arg[index]) != 1)
if (rt_sscanf(argv[index + 1], "%x", &arg[index]) != 1)
return -1;
}

Expand Down
8 changes: 4 additions & 4 deletions bsp/nuvoton/libraries/ma35/rtt_port/drv_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,12 @@ void devmem(int argc, char *argv[])

if (argc == 3)
{
if (sscanf(argv[2], "0x%x", &value) != 1)
if (rt_sscanf(argv[2], "0x%x", &value) != 1)
goto exit_devmem;
mode = 1; //Write
}

if (sscanf(argv[1], "0x%x", &u32Addr) != 1)
if (rt_sscanf(argv[1], "0x%x", &u32Addr) != 1)
goto exit_devmem;
else if (u32Addr & (4 - 1))
goto exit_devmem;
Expand Down Expand Up @@ -343,12 +343,12 @@ void devmem2(int argc, char *argv[])

if (argc == 3)
{
if (sscanf(argv[2], "%d", &value) != 1)
if (rt_sscanf(argv[2], "%d", &value) != 1)
goto exit_devmem;
word_count = value;
}

if (sscanf(argv[1], "0x%x", &u32Addr) != 1)
if (rt_sscanf(argv[1], "0x%x", &u32Addr) != 1)
goto exit_devmem;
else if (u32Addr & (4 - 1))
goto exit_devmem;
Expand Down
4 changes: 2 additions & 2 deletions bsp/nuvoton/libraries/n9h30/rtt_port/drv_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ void devmem(int argc, char *argv[])

if (argc == 3)
{
if (sscanf(argv[2], "0x%x", &value) != 1)
if (rt_sscanf(argv[2], "0x%x", &value) != 1)
goto exit_devmem;
mode = 1; //Write
}

if (sscanf(argv[1], "0x%x", &u32Addr) != 1)
if (rt_sscanf(argv[1], "0x%x", &u32Addr) != 1)
goto exit_devmem;
else if (!u32Addr || u32Addr & (4 - 1))
goto exit_devmem;
Expand Down
4 changes: 2 additions & 2 deletions bsp/nuvoton/libraries/nu_packages/Demo/wormhole_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,12 @@ void whc_devmem(int argc, char *argv[])

if (argc == 3)
{
if (sscanf(argv[2], "0x%x", &value) != 1)
if (rt_sscanf(argv[2], "0x%x", &value) != 1)
goto exit_devmem;
mode = 1; //Write
}

if (sscanf(argv[1], "0x%x", &u32Addr) != 1)
if (rt_sscanf(argv[1], "0x%x", &u32Addr) != 1)
goto exit_devmem;
else if (u32Addr & (4 - 1))
goto exit_devmem;
Expand Down
2 changes: 1 addition & 1 deletion components/drivers/phy/ofw.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ rt_err_t rt_ofw_get_phyid(struct rt_ofw_node *np,rt_uint32_t *id)
if (ret)
return ret;

ret = sscanf(phy_id,"ethernet-phy-id%4x.%4x",&upper, &lower);
ret = rt_sscanf(phy_id,"ethernet-phy-id%4x.%4x",&upper, &lower);
if(ret != 2)
return -RT_ERROR;

Expand Down
4 changes: 2 additions & 2 deletions components/net/at/at_socket/at_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ static void at_connect_notice_cb(struct at_socket *sock, at_socket_evt_t event,
}
new_sock = at_get_socket(new_socket);
new_sock->state = AT_SOCKET_CONNECT;
sscanf(buff, "SOCKET:%d", &base_socket);
rt_sscanf(buff, "SOCKET:%d", &base_socket);
LOG_D("ACCEPT BASE SOCKET: %d", base_socket);
new_sock->user_data = (void *)base_socket;

Expand Down Expand Up @@ -985,7 +985,7 @@ int at_accept(int socket, struct sockaddr *name, socklen_t *namelen)
at_do_event_changes(sock, AT_EVENT_RECV, RT_FALSE);
}

sscanf(&receive_buff[0], "SOCKET:%d", &new_socket);
rt_sscanf(&receive_buff[0], "SOCKET:%d", &new_socket);
new_sock = at_get_socket(new_socket);
ip4_addr_set_any(&remote_addr);
ipaddr_port_to_socketaddr(name, &remote_addr, &remote_port);
Expand Down
2 changes: 1 addition & 1 deletion examples/test/avl.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ int main(int argc, char *argv[])
{
if (argc == 2)
{
sscanf(argv[1], "%d", &loop_count);
rt_sscanf(argv[1], "%d", &loop_count);
}
else
{
Expand Down
Loading