daemon: cleaned up compiler warnings

raised warning level to /Wall
changed nfs41_file_info.owner, owner_group to char[] to avoid casting

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2011-07-06 10:53:39 -04:00 committed by unknown
parent e493d339c8
commit 2b5a5fb071
7 changed files with 30 additions and 28 deletions

View file

@ -100,7 +100,7 @@
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo> <RuntimeTypeInfo>false</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel> <WarningLevel>EnableAllWarnings</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat> <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<CompileAs>CompileAsC</CompileAs> <CompileAs>CompileAsC</CompileAs>
</ClCompile> </ClCompile>
@ -126,7 +126,7 @@
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>false</RuntimeTypeInfo> <RuntimeTypeInfo>false</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel> <WarningLevel>EnableAllWarnings</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsC</CompileAs> <CompileAs>CompileAsC</CompileAs>
</ClCompile> </ClCompile>
@ -149,7 +149,7 @@
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<RuntimeTypeInfo>false</RuntimeTypeInfo> <RuntimeTypeInfo>false</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel> <WarningLevel>EnableAllWarnings</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsC</CompileAs> <CompileAs>CompileAsC</CompileAs>
</ClCompile> </ClCompile>
@ -177,7 +177,7 @@
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<RuntimeTypeInfo>false</RuntimeTypeInfo> <RuntimeTypeInfo>false</RuntimeTypeInfo>
<WarningLevel>Level4</WarningLevel> <WarningLevel>EnableAllWarnings</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>CompileAsC</CompileAs> <CompileAs>CompileAsC</CompileAs>
</ClCompile> </ClCompile>

View file

@ -192,7 +192,7 @@ static int convert_nfs4acl_2_dacl(nfsacl41 *acl, int file_type,
goto out; goto out;
} }
for (i = 0; i < acl->count; i++) { for (i = 0; i < acl->count; i++) {
convert_nfs4name_2_user_domain((LPSTR)acl->aces[i].who, &domain); convert_nfs4name_2_user_domain(acl->aces[i].who, &domain);
dprintf(1, "handle_getacl: for user=%s domain=%s\n", dprintf(1, "handle_getacl: for user=%s domain=%s\n",
acl->aces[i].who, domain?domain:"<null>"); acl->aces[i].who, domain?domain:"<null>");
status = check_4_special_identifiers(acl->aces[i].who, &sids[i], status = check_4_special_identifiers(acl->aces[i].who, &sids[i],
@ -202,7 +202,7 @@ static int convert_nfs4acl_2_dacl(nfsacl41 *acl, int file_type,
goto out; goto out;
} }
if (!flag) { if (!flag) {
status = map_name_2_sid(&sid_len, &sids[i], (LPSTR)acl->aces[i].who); status = map_name_2_sid(&sid_len, &sids[i], acl->aces[i].who);
if (status) { if (status) {
free_sids(sids, i); free_sids(sids, i);
goto out; goto out;
@ -310,11 +310,11 @@ static int handle_getacl(nfs41_upcall *upcall)
*/ */
if (args->query & OWNER_SECURITY_INFORMATION) { if (args->query & OWNER_SECURITY_INFORMATION) {
// parse user@domain. currently ignoring domain part XX // parse user@domain. currently ignoring domain part XX
convert_nfs4name_2_user_domain((LPSTR)info.owner, &domain); convert_nfs4name_2_user_domain(info.owner, &domain);
dprintf(1, "handle_getacl: OWNER_SECURITY_INFORMATION: for user=%s " dprintf(1, "handle_getacl: OWNER_SECURITY_INFORMATION: for user=%s "
"domain=%s\n", info.owner, domain?domain:"<null>"); "domain=%s\n", info.owner, domain?domain:"<null>");
sid_len = 0; sid_len = 0;
status = map_name_2_sid(&sid_len, &osid, (LPSTR)info.owner); status = map_name_2_sid(&sid_len, &osid, info.owner);
if (status) if (status)
goto out; goto out;
status = SetSecurityDescriptorOwner(&sec_desc, osid, TRUE); status = SetSecurityDescriptorOwner(&sec_desc, osid, TRUE);
@ -326,11 +326,11 @@ static int handle_getacl(nfs41_upcall *upcall)
} }
} }
if (args->query & GROUP_SECURITY_INFORMATION) { if (args->query & GROUP_SECURITY_INFORMATION) {
convert_nfs4name_2_user_domain((LPSTR)info.owner_group, &domain); convert_nfs4name_2_user_domain(info.owner_group, &domain);
dprintf(1, "handle_getacl: GROUP_SECURITY_INFORMATION: for %s " dprintf(1, "handle_getacl: GROUP_SECURITY_INFORMATION: for %s "
"domain=%s\n", info.owner_group, domain?domain:"<null>"); "domain=%s\n", info.owner_group, domain?domain:"<null>");
sid_len = 0; sid_len = 0;
status = map_name_2_sid(&sid_len, &gsid, (LPSTR)info.owner_group); status = map_name_2_sid(&sid_len, &gsid, info.owner_group);
if (status) if (status)
goto out; goto out;
status = SetSecurityDescriptorGroup(&sec_desc, gsid, TRUE); status = SetSecurityDescriptorGroup(&sec_desc, gsid, TRUE);
@ -578,7 +578,7 @@ static int map_nfs4ace_who(PSID sid, PSID owner_sid, PSID group_sid, char *who_o
status = is_well_known_sid(sid, who_out); status = is_well_known_sid(sid, who_out);
if (status) { if (status) {
if (!strncmp(who_out, ACE4_NOBODY, strlen(ACE4_NOBODY))) { if (!strncmp(who_out, ACE4_NOBODY, strlen(ACE4_NOBODY))) {
size = strlen(ACE4_NOBODY); size = (DWORD)strlen(ACE4_NOBODY);
goto add_domain; goto add_domain;
} }
else else
@ -708,7 +708,7 @@ static int handle_setacl(nfs41_upcall *upcall)
nfs41_open_state *state = upcall->state_ref; nfs41_open_state *state = upcall->state_ref;
nfs41_file_info info; nfs41_file_info info;
stateid_arg stateid; stateid_arg stateid;
nfsacl41 nfs4_acl; nfsacl41 nfs4_acl = { 0 };
PSID sid = NULL, gsid = NULL; PSID sid = NULL, gsid = NULL;
BOOL sid_default, gsid_default; BOOL sid_default, gsid_default;
@ -722,12 +722,12 @@ static int handle_setacl(nfs41_upcall *upcall)
eprintf("GetSecurityDescriptorOwner failed with %d\n", status); eprintf("GetSecurityDescriptorOwner failed with %d\n", status);
goto out; goto out;
} }
status = map_nfs4ace_who(sid, NULL, NULL, (char *)info.owner, status = map_nfs4ace_who(sid, NULL, NULL, info.owner,
state->session->client->domain_name); state->session->client->domain_name);
if (status) if (status)
goto out; goto out;
else { else {
info.owner_len = strlen((const char *)info.owner); info.owner_len = (uint32_t)strlen(info.owner);
info.attrmask.arr[1] |= FATTR4_WORD1_OWNER; info.attrmask.arr[1] |= FATTR4_WORD1_OWNER;
info.attrmask.count = 2; info.attrmask.count = 2;
} }
@ -740,12 +740,12 @@ static int handle_setacl(nfs41_upcall *upcall)
eprintf("GetSecurityDescriptorOwner failed with %d\n", status); eprintf("GetSecurityDescriptorOwner failed with %d\n", status);
goto out; goto out;
} }
status = map_nfs4ace_who(sid, NULL, NULL, (char *)info.owner_group, status = map_nfs4ace_who(sid, NULL, NULL, info.owner_group,
state->session->client->domain_name); state->session->client->domain_name);
if (status) if (status)
goto out; goto out;
else { else {
info.owner_group_len = strlen((const char *)info.owner_group); info.owner_group_len = (uint32_t)strlen(info.owner_group);
info.attrmask.arr[1] |= FATTR4_WORD1_OWNER_GROUP; info.attrmask.arr[1] |= FATTR4_WORD1_OWNER_GROUP;
info.attrmask.count = 2; info.attrmask.count = 2;
} }

View file

@ -229,7 +229,10 @@ VOID ServiceStart(DWORD argc, LPTSTR *argv)
/* available only when built in debug mode under visual studio -cbodley */ /* available only when built in debug mode under visual studio -cbodley */
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
#pragma warning (push)
#pragma warning (disable : 4306) /* conversion from 'int' to '_HFILE' of greater size */
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
#pragma warning (pop)
dprintf(1, "debug mode. dumping memory leaks to stderr on exit.\n"); dprintf(1, "debug mode. dumping memory leaks to stderr on exit.\n");
#endif #endif

View file

@ -219,9 +219,9 @@ typedef struct __nfs41_file_info {
bool_t symlink_dir; bool_t symlink_dir;
bool_t symlink_support; bool_t symlink_support;
bool_t link_support; bool_t link_support;
unsigned char owner[NFS4_OPAQUE_LIMIT]; char owner[NFS4_OPAQUE_LIMIT];
uint32_t owner_len; uint32_t owner_len;
unsigned char owner_group[NFS4_OPAQUE_LIMIT]; char owner_group[NFS4_OPAQUE_LIMIT];
uint32_t owner_group_len; uint32_t owner_group_len;
uint32_t aclsupport; uint32_t aclsupport;
} nfs41_file_info; } nfs41_file_info;

View file

@ -1766,14 +1766,14 @@ static bool_t decode_file_attrs(
return FALSE; return FALSE;
} }
if (attrs->attrmask.arr[1] & FATTR4_WORD1_OWNER) { if (attrs->attrmask.arr[1] & FATTR4_WORD1_OWNER) {
unsigned char *ptr = &info->owner[0]; char *ptr = &info->owner[0];
if (!xdr_bytes(xdr, &(char *)ptr, &info->owner_len, if (!xdr_bytes(xdr, &ptr, &info->owner_len,
NFS4_OPAQUE_LIMIT)) NFS4_OPAQUE_LIMIT))
return FALSE; return FALSE;
} }
if (attrs->attrmask.arr[1] & FATTR4_WORD1_OWNER_GROUP) { if (attrs->attrmask.arr[1] & FATTR4_WORD1_OWNER_GROUP) {
unsigned char *ptr = &info->owner_group[0]; char *ptr = &info->owner_group[0];
if (!xdr_bytes(xdr, &(char *)ptr, &info->owner_group_len, if (!xdr_bytes(xdr, &ptr, &info->owner_group_len,
NFS4_OPAQUE_LIMIT)) NFS4_OPAQUE_LIMIT))
return FALSE; return FALSE;
} }
@ -2562,15 +2562,15 @@ static bool_t encode_file_attrs(
attrs->attrmask.arr[1] |= FATTR4_WORD1_TIME_MODIFY_SET; attrs->attrmask.arr[1] |= FATTR4_WORD1_TIME_MODIFY_SET;
} }
if (info->attrmask.arr[1] & FATTR4_WORD1_OWNER) { if (info->attrmask.arr[1] & FATTR4_WORD1_OWNER) {
unsigned char *ptr = &info->owner[0]; char *ptr = &info->owner[0];
if (!xdr_bytes(&localxdr, &(char *)ptr, &info->owner_len, if (!xdr_bytes(&localxdr, &ptr, &info->owner_len,
NFS4_OPAQUE_LIMIT)) NFS4_OPAQUE_LIMIT))
return FALSE; return FALSE;
attrs->attrmask.arr[1] |= FATTR4_WORD1_OWNER; attrs->attrmask.arr[1] |= FATTR4_WORD1_OWNER;
} }
if (info->attrmask.arr[1] & FATTR4_WORD1_OWNER_GROUP) { if (info->attrmask.arr[1] & FATTR4_WORD1_OWNER_GROUP) {
unsigned char *ptr = &info->owner_group[0]; char *ptr = &info->owner_group[0];
if (!xdr_bytes(&localxdr, &(char *)ptr, &info->owner_group_len, if (!xdr_bytes(&localxdr, &ptr, &info->owner_group_len,
NFS4_OPAQUE_LIMIT)) NFS4_OPAQUE_LIMIT))
return FALSE; return FALSE;
attrs->attrmask.arr[1] |= FATTR4_WORD1_OWNER_GROUP; attrs->attrmask.arr[1] |= FATTR4_WORD1_OWNER_GROUP;

View file

@ -140,7 +140,7 @@ static void readdir_copy_dir_info(
IN nfs41_readdir_entry *entry, IN nfs41_readdir_entry *entry,
IN PFILE_DIR_INFO_UNION info) IN PFILE_DIR_INFO_UNION info)
{ {
info->fdi.FileIndex = entry->attr_info.fileid; info->fdi.FileIndex = (ULONG)entry->attr_info.fileid;
nfs_time_to_file_time(&entry->attr_info.time_create, nfs_time_to_file_time(&entry->attr_info.time_create,
&info->fdi.CreationTime); &info->fdi.CreationTime);
nfs_time_to_file_time(&entry->attr_info.time_access, nfs_time_to_file_time(&entry->attr_info.time_access,

View file

@ -456,7 +456,6 @@ out:
static int handle_setattr(nfs41_upcall *upcall) static int handle_setattr(nfs41_upcall *upcall)
{ {
setattr_upcall_args *args = &upcall->args.setattr; setattr_upcall_args *args = &upcall->args.setattr;
nfs41_open_state *state = upcall->state_ref;
int status; int status;
switch (args->set_class) { switch (args->set_class) {