mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-04 13:49:08 +00:00
Eliminate some warnings
This commit is contained in:
parent
586b0aa7e0
commit
4a0db11565
4 changed files with 12 additions and 9 deletions
|
|
@ -119,12 +119,13 @@ static inline int tftp_parsedatapacket(const uint8_t *packet,
|
|||
*blockno = (uint16_t)packet[2] << 8 | (uint16_t)packet[3];
|
||||
return OK;
|
||||
}
|
||||
#if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_DEBUG_NET)
|
||||
#ifdef CONFIG_DEBUG_NET_WARN
|
||||
else if (*opcode == TFTP_ERR)
|
||||
{
|
||||
(void)tftp_parseerrpacket(packet);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ extern int tftp_sockinit(struct sockaddr_in *server, in_addr_t addr);
|
|||
extern int tftp_mkreqpacket(uint8_t *buffer, int opcode, const char *path, bool binary);
|
||||
extern int tftp_mkackpacket(uint8_t *buffer, uint16_t blockno);
|
||||
extern int tftp_mkerrpacket(uint8_t *buffer, uint16_t errorcode, const char *errormsg);
|
||||
#if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_DEBUG_NET)
|
||||
#ifdef CONFIG_DEBUG_NET_WARN
|
||||
extern int tftp_parseerrpacket(const uint8_t *packet);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -207,18 +207,19 @@ int tftp_mkerrpacket(uint8_t *buffer, uint16_t errorcode, const char *errormsg)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_DEBUG_NET)
|
||||
#ifdef CONFIG_DEBUG_NET_WARN
|
||||
int tftp_parseerrpacket(const uint8_t *buffer)
|
||||
{
|
||||
uint16_t opcode = (uint16_t)buffer[0] << 8 | (uint16_t)buffer[1];
|
||||
uint16_t errcode = (uint16_t)buffer[2] << 8 | (uint16_t)buffer[3];
|
||||
const char *errmsg = (const char *)&buffer[4];
|
||||
uint16_t opcode = (uint16_t)buffer[0] << 8 | (uint16_t)buffer[1];
|
||||
uint16_t errcode = (uint16_t)buffer[2] << 8 | (uint16_t)buffer[3];
|
||||
FAR const char *errmsg = (const char *)&buffer[4];
|
||||
|
||||
if (opcode == TFTP_ERR)
|
||||
{
|
||||
nerr("ERR message: %s (%d)\n", errmsg, errcode);
|
||||
ninfo("ERR message: %s (%d)\n", errmsg, errcode);
|
||||
return OK;
|
||||
}
|
||||
|
||||
return ERROR;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -270,8 +270,9 @@ static int tftp_rcvack(int sd, uint8_t *packet, struct sockaddr_in *server,
|
|||
|
||||
if (opcode != TFTP_ACK)
|
||||
{
|
||||
ninfo("Bad opcode\n");
|
||||
#if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_DEBUG_NET)
|
||||
nwarn("WARNING: Bad opcode\n");
|
||||
|
||||
#ifdef CONFIG_DEBUG_NET_WARN
|
||||
if (opcode == TFTP_ERR)
|
||||
{
|
||||
(void)tftp_parseerrpacket(packet);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue