From 0218a2fcc7ea4fda7b53406303e94449aa18a392 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Thu, 5 Dec 2019 07:14:29 -0600 Subject: [PATCH] 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); ^ --- netutils/tftpc/tftpc_get.c | 5 +++-- netutils/tftpc/tftpc_put.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/netutils/tftpc/tftpc_get.c b/netutils/tftpc/tftpc_get.c index e6b945728..7d7fcda55 100644 --- a/netutils/tftpc/tftpc_get.c +++ b/netutils/tftpc/tftpc_get.c @@ -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); diff --git a/netutils/tftpc/tftpc_put.c b/netutils/tftpc/tftpc_put.c index e321a516f..6bc2b5d95 100644 --- a/netutils/tftpc/tftpc_put.c +++ b/netutils/tftpc/tftpc_put.c @@ -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);