From 676f79f8d285631fc03eeaf38e0178a138d0499a Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Sun, 30 Nov 2014 18:11:16 +0000 Subject: [PATCH] smb.c: Fixed compilation warnings smb.c:311: warning: conversion from 'unsigned __int64' to 'u_short', possible loss of data smb.c:425: warning: conversion from '__int64' to 'unsigned short', possible loss of data smb.c:452: warning: conversion from '__int64' to 'unsigned short', possible loss of data --- lib/smb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/smb.c b/lib/smb.c index ee827e0f8..efd1f5de7 100644 --- a/lib/smb.c +++ b/lib/smb.c @@ -308,7 +308,8 @@ static void smb_format_message(struct connectdata *conn, struct smb_header *h, unsigned int pid; memset(h, 0, sizeof(*h)); - h->nbt_length = htons(sizeof(*h) - sizeof(unsigned int) + len); + h->nbt_length = htons((unsigned short) (sizeof(*h) - sizeof(unsigned int) + + len)); strncpy((char*)h->magic, "\xffSMB", 4); h->command = cmd; h->flags = SMB_FLAGS_CANONICAL_PATHNAMES | SMB_FLAGS_CASELESS_PATHNAMES; @@ -422,7 +423,7 @@ static CURLcode smb_send_setup(struct connectdata *conn) MSGCATNULL(smbc->domain); MSGCATNULL(OS); MSGCATNULL(CLIENTNAME); - setup.byte_count = smb_swap16(p - setup.bytes); + setup.byte_count = smb_swap16((unsigned short) (p - setup.bytes)); return smb_send_message(conn, SMB_COM_SETUP_ANDX, &setup, sizeof(setup) - sizeof(setup.bytes) + @@ -449,7 +450,7 @@ static CURLcode smb_send_tree_connect(struct connectdata *conn) MSGCAT("\\"); MSGCATNULL(req->share); MSGCATNULL(SERVICENAME); /* Match any type of service */ - tree.byte_count = smb_swap16(p - tree.bytes); + tree.byte_count = smb_swap16((unsigned short) (p - tree.bytes)); return smb_send_message(conn, SMB_COM_TREE_CONNECT_ANDX, &tree, sizeof(tree) - sizeof(tree.bytes) + tree.byte_count);