tcp_cmd
Remov some casting warnings
This commit is contained in:
@@ -208,8 +208,8 @@ static err_t tcp_cmd_recv_new(void* arg, struct tcp_pcb* pcb, struct pbuf* p, er
|
||||
if (p->len >= MAX_CMD_LEN) {
|
||||
LOG_WARN(TAG, "Command too long");
|
||||
}
|
||||
size_t len = p->tot_len >= MAX_CMD_LEN ? MAX_CMD_LEN : p->tot_len;
|
||||
|
||||
uint16_t len = p->tot_len >= MAX_CMD_LEN ? MAX_CMD_LEN : p->tot_len;
|
||||
|
||||
pbuf_copy_partial(p, cmd, len, 0);
|
||||
cmd[len] = '\0';
|
||||
|
||||
@@ -242,39 +242,55 @@ TEST(TCP_CMD, tcp_data_cb) {
|
||||
char* cmd = (char*)calloc(50, 1);
|
||||
pbuf p = {.next = NULL, .payload = (void*)cmd, .tot_len = 4, .len = 0, .type_internal = 0, .flags = 0, .if_idx = 0};
|
||||
strcpy(cmd, "help");
|
||||
p.tot_len = strlen(cmd);
|
||||
p.tot_len = (uint16_t)strlen(cmd);
|
||||
tcp_cmd_recv_new(NULL, NULL, &p, ERR_OK);
|
||||
|
||||
strcpy(cmd, "text \"This is printed on the display\"");
|
||||
p.tot_len = strlen(cmd);
|
||||
p.tot_len = (uint16_t)strlen(cmd);
|
||||
tcp_cmd_recv_new(NULL, NULL, &p, ERR_OK);
|
||||
|
||||
strcpy(cmd, "color 0xffffff");
|
||||
p.tot_len = strlen(cmd);
|
||||
strcpy(cmd, "color 0x555555");
|
||||
p.tot_len = (uint16_t)strlen(cmd);
|
||||
tcp_cmd_recv_new(NULL, NULL, &p, ERR_OK);
|
||||
|
||||
strcpy(cmd, "bgcolor 0xAAAAAA");
|
||||
p.tot_len = (uint16_t)strlen(cmd);
|
||||
tcp_cmd_recv_new(NULL, NULL, &p, ERR_OK);
|
||||
|
||||
strcpy(cmd, "text \"This is printed on the display\"");
|
||||
p.tot_len = strlen(cmd);
|
||||
p.tot_len = (uint16_t)strlen(cmd);
|
||||
tcp_cmd_recv_new(NULL, NULL, &p, ERR_OK);
|
||||
|
||||
strcpy(cmd, "color 255 255 255");
|
||||
p.tot_len = (uint16_t)strlen(cmd);
|
||||
tcp_cmd_recv_new(NULL, NULL, &p, ERR_OK);
|
||||
|
||||
strcpy(cmd, "bgcolor 255 255 255");
|
||||
p.tot_len = (uint16_t)strlen(cmd);
|
||||
tcp_cmd_recv_new(NULL, NULL, &p, ERR_OK);
|
||||
|
||||
strcpy(cmd, "text \"This is printed on the display\"");
|
||||
p.tot_len = (uint16_t)strlen(cmd);
|
||||
tcp_cmd_recv_new(NULL, NULL, &p, ERR_OK);
|
||||
|
||||
strcpy(cmd, "setImage \"test.bmp\"");
|
||||
p.tot_len = strlen(cmd);
|
||||
p.tot_len = (uint16_t)strlen(cmd);
|
||||
tcp_cmd_recv_new(NULL, NULL, &p, ERR_OK);
|
||||
|
||||
strcpy(cmd, "setImage \"test.gif\"");
|
||||
p.tot_len = strlen(cmd);
|
||||
p.tot_len = (uint16_t)strlen(cmd);
|
||||
tcp_cmd_recv_new(NULL, NULL, &p, ERR_OK);
|
||||
|
||||
strcpy(cmd, "setGif \"test.gif\"");
|
||||
p.tot_len = strlen(cmd);
|
||||
p.tot_len = (uint16_t)strlen(cmd);
|
||||
tcp_cmd_recv_new(NULL, NULL, &p, ERR_OK);
|
||||
|
||||
strcpy(cmd, "setGif \"test.bmp\"");
|
||||
p.tot_len = strlen(cmd);
|
||||
p.tot_len = (uint16_t)strlen(cmd);
|
||||
tcp_cmd_recv_new(NULL, NULL, &p, ERR_OK);
|
||||
|
||||
strcpy(cmd, "exit");
|
||||
p.tot_len = strlen(cmd);
|
||||
p.tot_len = (uint16_t)strlen(cmd);
|
||||
tcp_cmd_recv_new(NULL, NULL, &p, ERR_OK);
|
||||
|
||||
free(cmd);
|
||||
|
||||
Reference in New Issue
Block a user