ymodem:fix compile warnings
rb_main.c:219:42: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=] 219 | snprintf(temp, PATH_MAX, "%s/%s", priv->foldname, Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
parent
55b0d4a110
commit
c08feedcfd
@ -171,7 +171,7 @@ static int handler(FAR struct ymodem_ctx_s *ctx)
|
||||
|
||||
if (ctx->packet_type == YMODEM_FILENAME_PACKET)
|
||||
{
|
||||
char temp[PATH_MAX];
|
||||
char temp[PATH_MAX + 1];
|
||||
FAR char *filename;
|
||||
|
||||
if (priv->fd > 0)
|
||||
@ -216,7 +216,7 @@ static int handler(FAR struct ymodem_ctx_s *ctx)
|
||||
|
||||
if (priv->foldname != NULL)
|
||||
{
|
||||
snprintf(temp, PATH_MAX, "%s/%s", priv->foldname,
|
||||
snprintf(temp, sizeof(temp), "%s/%s", priv->foldname,
|
||||
filename);
|
||||
filename = temp;
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ recv_packet:
|
||||
if ((total_seq & 0xff) - 1 == ctx->header[1])
|
||||
{
|
||||
ymodem_debug("recv_file: Received the previous packet that has"
|
||||
"been received, continue %lu %u\n", total_seq,
|
||||
"been received, continue %" PRIu32 " %u\n", total_seq,
|
||||
ctx->header[1]);
|
||||
|
||||
ctx->header[0] = ACK;
|
||||
@ -239,7 +239,7 @@ recv_packet:
|
||||
}
|
||||
else if ((total_seq & 0xff) != ctx->header[1])
|
||||
{
|
||||
ymodem_debug("recv_file: total seq error:%lu %u\n", total_seq,
|
||||
ymodem_debug("recv_file: total seq error:%" PRIu32 " %u\n", total_seq,
|
||||
ctx->header[1]);
|
||||
ctx->header[0] = CRC;
|
||||
goto recv_packet;
|
||||
|
Loading…
x
Reference in New Issue
Block a user