From f8885dbad07582457513affbf1138d0c8444c766 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Mon, 18 Oct 2010 11:09:27 -0400 Subject: [PATCH] warnings from WDK 6000 fixed a few cases of warning 4242: possible loss of data wincrypt.h appears to come with windows.h in later versions of the ddk, but nfs41_client.c fails to compile in WDK 6001 without #include Signed-off-by: Casey Bodley --- daemon/lookup.c | 2 +- daemon/name_cache.c | 2 +- daemon/nfs41_client.c | 1 + daemon/open.c | 2 +- daemon/pnfs.h | 2 +- daemon/service.c | 4 ++-- daemon/util.c | 7 ++++--- 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/daemon/lookup.c b/daemon/lookup.c index 15020b4..0cb14b3 100644 --- a/daemon/lookup.c +++ b/daemon/lookup.c @@ -429,7 +429,7 @@ static int referral_resolve( AcquireSRWLockExclusive(&path_out->lock); abs_path_copy(path_out, &location->path); StringCchCatA(path_out->path, NFS41_MAX_PATH_LEN, rest_of_path); - path_out->len += (unsigned short)strlen(rest_of_path); + path_out->len = path_out->len + (unsigned short)strlen(rest_of_path); ReleaseSRWLockExclusive(&path_out->lock); if (session_out) *session_out = client->session; diff --git a/daemon/name_cache.c b/daemon/name_cache.c index 757ae1c..e166a6b 100644 --- a/daemon/name_cache.c +++ b/daemon/name_cache.c @@ -283,7 +283,7 @@ static void attr_cache_update( /* update the attributes present in mask */ if (info->attrmask.count >= 1) { if (info->attrmask.arr[0] & FATTR4_WORD0_TYPE) - entry->type = info->type & NFS_FTYPE_MASK; + entry->type = (unsigned char)(info->type & NFS_FTYPE_MASK); if (info->attrmask.arr[0] & FATTR4_WORD0_CHANGE) { entry->change = info->change; /* revalidate whenever we get a change attribute */ diff --git a/daemon/nfs41_client.c b/daemon/nfs41_client.c index 87ea2e6..ad88096 100644 --- a/daemon/nfs41_client.c +++ b/daemon/nfs41_client.c @@ -26,6 +26,7 @@ #include #include #include /* for GetAdaptersAddresses() */ +#include /* for Crypt*() functions */ #include "rbtree.h" #include "daemon_debug.h" diff --git a/daemon/open.c b/daemon/open.c index fe81639..2b77e68 100644 --- a/daemon/open.c +++ b/daemon/open.c @@ -368,7 +368,7 @@ int handle_open(nfs41_upcall *upcall) status = nfs41_create(state->session, NF4DIR, args->mode, NULL, &state->parent, &state->file); args->std_info.Directory = 1; - args->created = status == NFS4_OK; + args->created = status == NFS4_OK ? TRUE : FALSE; } else { status = nfs41_open(state->session, allow, deny, create, args->mode, state, &info); diff --git a/daemon/pnfs.h b/daemon/pnfs.h index b3806f2..d136db5 100644 --- a/daemon/pnfs.h +++ b/daemon/pnfs.h @@ -316,7 +316,7 @@ __inline uint32_t stripe_index( IN uint64_t sui, IN uint32_t stripe_count) { - return (sui + layout->first_index) % stripe_count; + return (uint32_t)((sui + layout->first_index) % stripe_count); } __inline uint32_t data_server_index( IN pnfs_file_device *device, diff --git a/daemon/service.c b/daemon/service.c index d38061c..af3a819 100644 --- a/daemon/service.c +++ b/daemon/service.c @@ -20,9 +20,9 @@ FUNCTIONS: ControlHandler ( DWORD dwCtrlType ); GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize ); ----------------------------------------------------------------------------*/ -#ifndef STANDALONE_NFSD + ---------------------------------------------------------------------------*/ #include +#ifndef STANDALONE_NFSD #include #include #include diff --git a/daemon/util.c b/daemon/util.c index 32d232f..55377c6 100644 --- a/daemon/util.c +++ b/daemon/util.c @@ -170,7 +170,8 @@ void nfs_to_standard_info( std_out->EndOfFile.QuadPart = (LONGLONG)info->size; std_out->NumberOfLinks = info->numlinks; std_out->DeletePending = FALSE; - std_out->Directory = FileAttributes & FILE_ATTRIBUTE_DIRECTORY; + std_out->Directory = FileAttributes & FILE_ATTRIBUTE_DIRECTORY ? + TRUE : FALSE; } @@ -430,8 +431,8 @@ int create_silly_rename( for (i = 0; i < fh->len; i++, tmp += 2) StringCchPrintf(tmp, end - tmp, "%02x", fh->fh[i]); - path->len += extra_len; - silly->len += extra_len; + path->len = path->len + extra_len; + silly->len = silly->len + extra_len; out: return status; }