Resolve warnings on Windows

Appease the compiler by resolving some of the reported warnings,
including:

- Control paths that don't return.

- Potentially uninitialized variables.

- Unused local variables.

- Unreachable code.

- Type safety.

- Synchronize declarations with definitions for functions.
This commit is contained in:
Asanka Herath
2010-06-02 21:23:52 -04:00
parent 869e970f5d
commit 24cbddd4b9
11 changed files with 12 additions and 12 deletions

View File

@@ -175,6 +175,7 @@ _hx509_expr_eval(hx509_context context, hx509_env env, struct hx_expr *expr)
return eval_comp(context, env, expr->arg1);
default:
_hx509_abort("hx509 eval expr with unknown op: %d", (int)expr->op);
UNREACHABLE(return 0);
}
}

View File

@@ -477,7 +477,7 @@ KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
krb5_cc_set_default_name(krb5_context context, const char *name)
{
krb5_error_code ret = 0;
char *p, *exp_p = NULL;
char *p = NULL, *exp_p = NULL;
if (name == NULL) {
const char *e = NULL;

View File

@@ -104,8 +104,6 @@ krb5_error_code
_krb5_get_default_principal_local(krb5_context context,
krb5_principal *princ)
{
krb5_error_code ret = 0;
/* See if we can get the principal first. We only expect this to
work if logged into a domain. */
{

View File

@@ -222,8 +222,6 @@ ret_string(krb5_storage *sp, int ucs2, struct sec_buffer *desc, char **s)
ret = 0;
out:
return ret;
return 0;
}
static krb5_error_code
@@ -485,6 +483,10 @@ heim_ntlm_encode_type1(const struct ntlm_type1 *type1, struct ntlm_buf *data)
domain.offset = base;
domain.length = len_string(0, type1->domain);
domain.allocated = domain.length;
} else {
domain.offset = 0;
domain.length = 0;
domain.allocated = 0;
}
if (type1->hostname) {
hostname.offset = domain.allocated + domain.offset;

View File

@@ -93,7 +93,7 @@ base64_encode(const void *data, int size, char **str)
}
*p = 0;
*str = s;
return strlen(s);
return (int) strlen(s);
}
#define DECODE_ERROR 0xffffffff

View File

@@ -100,7 +100,7 @@ roken_vmconcat (char **s, size_t max_len, va_list args)
ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL
roken_mconcat (char **s, size_t max_len, ...)
{
int ret;
size_t ret;
va_list args;
va_start(args, max_len);

View File

@@ -87,7 +87,7 @@ opendir(const char * filespec)
}
do {
long len = strlen(fd.name);
size_t len = strlen(fd.name);
struct dirent * e;
if (dp->n_entries == dp->nc_entries) {

View File

@@ -80,7 +80,6 @@ wait_for_process_timed(pid_t pid, time_t (*func)(void *),
hProcess = OpenProcess(SYNCHRONIZE, FALSE, pid);
if (hProcess == NULL) {
DWORD dw = GetLastError();
return SE_E_WAITPIDFAILED;
}

View File

@@ -498,7 +498,7 @@ xyzprintf (struct snprintf_state *state, const char *char_format, va_list ap)
break;
}
case 'p' : {
unsigned long arg = (unsigned long)va_arg(ap, void*);
u_longest arg = (u_longest)va_arg(ap, void*);
len += append_number (state, arg, 0x10, "0123456789ABCDEF",
width, prec, flags, 0);

View File

@@ -126,7 +126,7 @@ rk_unvis(char *cp, int c, int *astate, int flag)
*astate = S_OCTAL2;
return (0);
case 'M':
*cp = (char)0200;
*cp = (u_char)0200;
*astate = S_META;
return (0);
case '^':

View File

@@ -49,7 +49,7 @@ error_entry_cmp(const void *a, const void *b)
}
int
_wind_stringprep_error(uint32_t cp, wind_profile_flags flags)
_wind_stringprep_error(const uint32_t cp, wind_profile_flags flags)
{
struct error_entry ee = {cp};
const struct error_entry *s;