Fix compiler warnings:

tftpc_get.c: In function 'tftp_write': tftpc_get.c:307:12: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   int fd = (int)ctx;
            ^
tftpc_get.c: In function 'tftpget': tftpc_get.c:368:57: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   result = tftpget_cb(remote, addr, binary, tftp_write, (void*)fd);
                                                         ^
This commit is contained in:
Xiang Xiao 2019-12-05 07:14:29 -06:00 committed by Gregory Nutt
parent 3bf17d602e
commit 0218a2fcc7
2 changed files with 6 additions and 4 deletions

View File

@ -304,7 +304,7 @@ errout:
static ssize_t tftp_write(FAR void *ctx, uint32_t offset, FAR uint8_t *buf,
size_t len)
{
int fd = (int)ctx;
int fd = (intptr_t)ctx;
size_t left = len;
ssize_t nbyteswritten;
@ -365,7 +365,8 @@ int tftpget(FAR const char *remote, FAR const char *local, in_addr_t addr,
goto errout;
}
result = tftpget_cb(remote, addr, binary, tftp_write, (void*)fd);
result = tftpget_cb(remote, addr, binary, tftp_write,
(FAR void *)(intptr_t)fd);
close(fd);

View File

@ -431,7 +431,7 @@ errout:
static ssize_t tftp_read(FAR void *ctx, uint32_t offset, FAR uint8_t *buf,
size_t buflen)
{
int fd = (int)ctx;
int fd = (intptr_t)ctx;
off_t tmp;
ssize_t nbytesread;
ssize_t totalread = 0;
@ -512,7 +512,8 @@ int tftpput(FAR const char *local, FAR const char *remote, in_addr_t addr,
goto errout;
}
result = tftpput_cb(remote, addr, binary, tftp_read, (FAR void *)fd);
result = tftpput_cb(remote, addr, binary, tftp_read,
(FAR void *)(intptr_t)fd);
close(fd);