[SLOF] [PATCH] dhcp: fix warning messages when calling strtoip()
Thomas Huth
thuth at redhat.com
Tue Feb 9 20:12:25 AEDT 2016
On 09.02.2016 07:05, Nikunj A Dadhania wrote:
> With the removal of dupicate strtoip in patch "dhcp: Remove duplicated
> strtoip()" (commit 896e31da2cc260bf5311a89b63683def20329c5b), we get
> following warnings messages:
>
> dhcp.c: In function ‘dhcpv4’:
> dhcp.c:215:16: warning: pointer targets in passing argument 1 of ‘strtoip’ differ in signedness [-Wpointer-sign]
> if (!strtoip(dhcp_tftp_name, (uint8_t *)&dhcp_tftp_ip)) {
> ^
> In file included from dhcp.c:51:0:
> ../netapps/args.h:20:5: note: expected ‘const char *’ but argument is of type ‘int8_t * {aka signed char *}’
> int strtoip(const char *, char[4]);
> ^
> dhcp.c:215:32: warning: pointer targets in passing argument 2 of ‘strtoip’ differ in signedness [-Wpointer-sign]
> if (!strtoip(dhcp_tftp_name, (uint8_t *)&dhcp_tftp_ip)) {
> ^
> In file included from dhcp.c:51:0:
> ../netapps/args.h:20:5: note: expected ‘char *’ but argument is of type ‘uint8_t * {aka unsigned char *}’
> int strtoip(const char *, char[4]);
> ^
>
> Signed-off-by: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>
> ---
> clients/net-snk/app/netlib/dhcp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/clients/net-snk/app/netlib/dhcp.c b/clients/net-snk/app/netlib/dhcp.c
> index 28aa488..a0e3b5d 100644
> --- a/clients/net-snk/app/netlib/dhcp.c
> +++ b/clients/net-snk/app/netlib/dhcp.c
> @@ -212,7 +212,7 @@ int32_t dhcpv4(char *ret_buffer, filename_ip_t *fn_ip)
> }
> else {
> // TFTP server defined by its name
> - if (!strtoip(dhcp_tftp_name, (uint8_t *)&dhcp_tftp_ip)) {
> + if (!strtoip((char *)dhcp_tftp_name, (char *)&dhcp_tftp_ip)) {
> if (!dns_get_ip(fd, dhcp_tftp_name, (uint8_t *)&dhcp_tftp_ip, 4)) {
> // DNS error - can't obtain TFTP-server name
> // Use TFTP-ip from siaddr field, if presented
If you look for dhc_tftp_name, you see these ugly typecasts there all
over the place. So I think it would be nicer to switch the declaration
static int8_t dhcp_tftp_name[256];
into
static char dhcp_tftp_name[256];
And maybe do the same for dhcp_filename ... what do you think?
Thomas
More information about the SLOF
mailing list