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 <wincrypt.h>

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2010-10-18 11:09:27 -04:00 committed by unknown
parent 3613a75914
commit f8885dbad0
7 changed files with 11 additions and 9 deletions

View file

@ -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;

View file

@ -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 */

View file

@ -26,6 +26,7 @@
#include <time.h>
#include <winsock2.h>
#include <iphlpapi.h> /* for GetAdaptersAddresses() */
#include <wincrypt.h> /* for Crypt*() functions */
#include "rbtree.h"
#include "daemon_debug.h"

View file

@ -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);

View file

@ -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,

View file

@ -21,8 +21,8 @@ FUNCTIONS:
GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize );
---------------------------------------------------------------------------*/
#ifndef STANDALONE_NFSD
#include <windows.h>
#ifndef STANDALONE_NFSD
#include <stdio.h>
#include <stdlib.h>
#include <process.h>

View file

@ -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;
}