Fix warnings in msvc build
This commit is contained in:
+7
-7
@@ -599,7 +599,7 @@ void yc_log_event(uint32_t id, yc_log_level_t level, const char * sz_format, ...
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
HANDLE hLog = NULL;
|
HANDLE hLog = NULL;
|
||||||
LPCSTR sz_message = rgsz_message;
|
LPCSTR sz_message = rgsz_message;
|
||||||
DWORD dw_type = EVENTLOG_SUCCESS;
|
WORD w_type = EVENTLOG_SUCCESS;
|
||||||
#else
|
#else
|
||||||
int priority = LOG_INFO;
|
int priority = LOG_INFO;
|
||||||
#endif
|
#endif
|
||||||
@@ -610,20 +610,20 @@ void yc_log_event(uint32_t id, yc_log_level_t level, const char * sz_format, ...
|
|||||||
|
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case YC_LOG_LEVEL_ERROR:
|
case YC_LOG_LEVEL_ERROR:
|
||||||
dw_type = EVENTLOG_ERROR_TYPE;
|
w_type = EVENTLOG_ERROR_TYPE;
|
||||||
break;
|
break;
|
||||||
case YC_LOG_LEVEL_WARN:
|
case YC_LOG_LEVEL_WARN:
|
||||||
dw_type = EVENTLOG_WARNING_TYPE;
|
w_type = EVENTLOG_WARNING_TYPE;
|
||||||
break;
|
break;
|
||||||
case YC_LOG_LEVEL_INFO:
|
case YC_LOG_LEVEL_INFO:
|
||||||
dw_type = EVENTLOG_INFORMATION_TYPE;
|
w_type = EVENTLOG_INFORMATION_TYPE;
|
||||||
break;
|
break;
|
||||||
case YC_LOG_LEVEL_VERBOSE:
|
case YC_LOG_LEVEL_VERBOSE:
|
||||||
dw_type = EVENTLOG_INFORMATION_TYPE;
|
w_type = EVENTLOG_INFORMATION_TYPE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case YC_LOG_LEVEL_DEBUG:
|
case YC_LOG_LEVEL_DEBUG:
|
||||||
dw_type = EVENTLOG_SUCCESS;
|
w_type = EVENTLOG_SUCCESS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -645,7 +645,7 @@ void yc_log_event(uint32_t id, yc_log_level_t level, const char * sz_format, ...
|
|||||||
|
|
||||||
ReportEventA(
|
ReportEventA(
|
||||||
hLog,
|
hLog,
|
||||||
dw_type,
|
w_type,
|
||||||
0,
|
0,
|
||||||
(DWORD)id,
|
(DWORD)id,
|
||||||
NULL,
|
NULL,
|
||||||
|
|||||||
+9
-9
@@ -447,7 +447,7 @@ ykpiv_rc ykpiv_list_readers(ykpiv_state *state, char *readers, size_t *len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (num_readers > *len) {
|
if (num_readers > *len) {
|
||||||
num_readers = *len;
|
num_readers = (pcsc_word)*len;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = SCardListReaders(state->context, NULL, readers, &num_readers);
|
rc = SCardListReaders(state->context, NULL, readers, &num_readers);
|
||||||
@@ -520,7 +520,7 @@ ykpiv_rc ykpiv_transfer_data(ykpiv_state *state, const unsigned char *templ,
|
|||||||
if(state->verbose > 2) {
|
if(state->verbose > 2) {
|
||||||
fprintf(stderr, "Going to send %lu bytes in this go.\n", (unsigned long)this_size);
|
fprintf(stderr, "Going to send %lu bytes in this go.\n", (unsigned long)this_size);
|
||||||
}
|
}
|
||||||
apdu.st.lc = this_size;
|
apdu.st.lc = (unsigned char)this_size;
|
||||||
memcpy(apdu.st.data, in_ptr, this_size);
|
memcpy(apdu.st.data, in_ptr, this_size);
|
||||||
res = _send_data(state, &apdu, data, &recv_len, sw);
|
res = _send_data(state, &apdu, data, &recv_len, sw);
|
||||||
if(res != YKPIV_OK) {
|
if(res != YKPIV_OK) {
|
||||||
@@ -788,7 +788,7 @@ ykpiv_rc ykpiv_hex_decode(const char *hex_in, size_t in_len,
|
|||||||
char *ind_ptr = strchr(hex_translate, tolower(*hex_in++));
|
char *ind_ptr = strchr(hex_translate, tolower(*hex_in++));
|
||||||
int index = 0;
|
int index = 0;
|
||||||
if(ind_ptr) {
|
if(ind_ptr) {
|
||||||
index = ind_ptr - hex_translate;
|
index = (int)(ind_ptr - hex_translate);
|
||||||
} else {
|
} else {
|
||||||
return YKPIV_PARSE_ERROR;
|
return YKPIV_PARSE_ERROR;
|
||||||
}
|
}
|
||||||
@@ -861,7 +861,7 @@ static ykpiv_rc _general_authenticate(ykpiv_state *state,
|
|||||||
memcpy(dataptr, sign_in, (size_t)in_len);
|
memcpy(dataptr, sign_in, (size_t)in_len);
|
||||||
dataptr += in_len;
|
dataptr += in_len;
|
||||||
|
|
||||||
if((res = ykpiv_transfer_data(state, templ, indata, dataptr - indata, data,
|
if((res = ykpiv_transfer_data(state, templ, indata, (long)(dataptr - indata), data,
|
||||||
&recv_len, &sw)) != YKPIV_OK) {
|
&recv_len, &sw)) != YKPIV_OK) {
|
||||||
if(state->verbose) {
|
if(state->verbose) {
|
||||||
fprintf(stderr, "Sign command failed to communicate.\n");
|
fprintf(stderr, "Sign command failed to communicate.\n");
|
||||||
@@ -1265,7 +1265,7 @@ ykpiv_rc _ykpiv_fetch_object(ykpiv_state *state, int object_id,
|
|||||||
return YKPIV_INVALID_OBJECT;
|
return YKPIV_INVALID_OBJECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((res = ykpiv_transfer_data(state, templ, indata, inptr - indata, data, len, &sw))
|
if((res = ykpiv_transfer_data(state, templ, indata, (long)(inptr - indata), data, len, &sw))
|
||||||
!= YKPIV_OK) {
|
!= YKPIV_OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -1277,7 +1277,7 @@ ykpiv_rc _ykpiv_fetch_object(ykpiv_state *state, int object_id,
|
|||||||
return YKPIV_SIZE_ERROR;
|
return YKPIV_SIZE_ERROR;
|
||||||
}
|
}
|
||||||
memmove(data, data + 1 + offs, outlen);
|
memmove(data, data + 1 + offs, outlen);
|
||||||
*len = outlen;
|
*len = (unsigned long)outlen;
|
||||||
return YKPIV_OK;
|
return YKPIV_OK;
|
||||||
} else {
|
} else {
|
||||||
return YKPIV_GENERIC_ERROR;
|
return YKPIV_GENERIC_ERROR;
|
||||||
@@ -1319,7 +1319,7 @@ ykpiv_rc _ykpiv_save_object(ykpiv_state *state, int object_id,
|
|||||||
memcpy(dataptr, indata, len);
|
memcpy(dataptr, indata, len);
|
||||||
dataptr += len;
|
dataptr += len;
|
||||||
|
|
||||||
if((res = ykpiv_transfer_data(state, templ, data, dataptr - data, NULL, &outlen,
|
if((res = ykpiv_transfer_data(state, templ, data, (long)(dataptr - data), NULL, &outlen,
|
||||||
&sw)) != YKPIV_OK) {
|
&sw)) != YKPIV_OK) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -1463,7 +1463,7 @@ ykpiv_rc ykpiv_import_private_key(ykpiv_state *state, const unsigned char key, u
|
|||||||
if (YKPIV_OK != (res = _ykpiv_begin_transaction(state))) return YKPIV_PCSC_ERROR;
|
if (YKPIV_OK != (res = _ykpiv_begin_transaction(state))) return YKPIV_PCSC_ERROR;
|
||||||
if (YKPIV_OK != (res = _ykpiv_ensure_application_selected(state))) goto Cleanup;
|
if (YKPIV_OK != (res = _ykpiv_ensure_application_selected(state))) goto Cleanup;
|
||||||
|
|
||||||
if ((res = ykpiv_transfer_data(state, templ, key_data, in_ptr - key_data, data, &recv_len, &sw)) != YKPIV_OK) {
|
if ((res = ykpiv_transfer_data(state, templ, key_data, (long)(in_ptr - key_data), data, &recv_len, &sw)) != YKPIV_OK) {
|
||||||
goto Cleanup;
|
goto Cleanup;
|
||||||
}
|
}
|
||||||
if (SW_SUCCESS != sw) {
|
if (SW_SUCCESS != sw) {
|
||||||
@@ -1490,7 +1490,7 @@ ykpiv_rc ykpiv_attest(ykpiv_state *state, const unsigned char key, unsigned char
|
|||||||
return YKPIV_ARGUMENT_ERROR;
|
return YKPIV_ARGUMENT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul_data_len = *data_len;
|
ul_data_len = (unsigned long)*data_len;
|
||||||
|
|
||||||
if (YKPIV_OK != (res = _ykpiv_begin_transaction(state))) return YKPIV_PCSC_ERROR;
|
if (YKPIV_OK != (res = _ykpiv_begin_transaction(state))) return YKPIV_PCSC_ERROR;
|
||||||
if (YKPIV_OK != (res = _ykpiv_ensure_application_selected(state))) goto Cleanup;
|
if (YKPIV_OK != (res = _ykpiv_ensure_application_selected(state))) goto Cleanup;
|
||||||
|
|||||||
Reference in New Issue
Block a user