Merge pull request #695 from LudovicRousseau/master
Fix compiler warnings
This commit is contained in:
commit
bc812aa132
@ -15,7 +15,7 @@ SDKS_PATH="$(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs"
|
||||
SDK_PATH="${SDK_PATH:-$SDKS_PATH/$(ls -1 ${SDKS_PATH} | sort -n -k2 -t. -r | head -1)}"
|
||||
|
||||
# Set SDK path
|
||||
export CFLAGS="-isysroot $SDK_PATH -arch i386 -arch x86_64 -mmacosx-version-min=10.10"
|
||||
export CFLAGS="$CFLAGS -isysroot $SDK_PATH -arch i386 -arch x86_64 -mmacosx-version-min=10.10"
|
||||
|
||||
# OpenSSL is deprecated on OSX since 10.7 and that generates lots of
|
||||
# "false positive" warnings and there is no alternative option.
|
||||
|
@ -694,7 +694,7 @@ iasecc_sm_delete_file(struct sc_card *card, unsigned se_num, unsigned int file_i
|
||||
rv = iasecc_sm_initialize(card, se_num, SM_CMD_FILE_DELETE);
|
||||
LOG_TEST_RET(ctx, rv, "iasecc_sm_delete_file() SM INITIALIZE failed");
|
||||
|
||||
sm_info->cmd_data = (void *)file_id;
|
||||
sm_info->cmd_data = (void *)(long)file_id;
|
||||
|
||||
sc_remote_data_init(&rdata);
|
||||
rv = iasecc_sm_cmd(card, &rdata);
|
||||
|
@ -91,7 +91,7 @@ static void sc_do_log_va(sc_context_t *ctx, int level, const char *file, int lin
|
||||
gettimeofday (&tv, NULL);
|
||||
tm = localtime (&tv.tv_sec);
|
||||
strftime (time_string, sizeof(time_string), "%H:%M:%S", tm);
|
||||
r = snprintf(p, left, "0x%lx %s.%03ld ", (unsigned long)pthread_self(), time_string, tv.tv_usec / 1000);
|
||||
r = snprintf(p, left, "0x%lx %s.%03ld ", (unsigned long)pthread_self(), time_string, (long)tv.tv_usec / 1000);
|
||||
#endif
|
||||
p += r;
|
||||
left -= r;
|
||||
|
@ -1098,7 +1098,7 @@ static int pcsc_detect_readers(sc_context_t *ctx)
|
||||
else {
|
||||
rv = gpriv->SCardListReaders(gpriv->pcsc_ctx, NULL, NULL,
|
||||
(LPDWORD) &reader_buf_size);
|
||||
if (rv == SCARD_E_NO_SERVICE) {
|
||||
if (rv == (LONG)SCARD_E_NO_SERVICE) {
|
||||
gpriv->SCardReleaseContext(gpriv->pcsc_ctx);
|
||||
gpriv->pcsc_ctx = -1;
|
||||
gpriv->pcsc_wait_ctx = -1;
|
||||
|
@ -702,6 +702,7 @@ __pkcs15_create_data_object(struct pkcs15_fw_data *fw_data,
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_PKCS15_INIT
|
||||
static int
|
||||
__pkcs15_create_secret_key_object(struct pkcs15_fw_data *fw_data,
|
||||
struct sc_pkcs15_object *object, struct pkcs15_any_object **skey_object)
|
||||
@ -719,6 +720,7 @@ __pkcs15_create_secret_key_object(struct pkcs15_fw_data *fw_data,
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static int
|
||||
|
@ -256,7 +256,7 @@ enter(const char *function)
|
||||
gettimeofday (&tv, NULL);
|
||||
tm = localtime (&tv.tv_sec);
|
||||
strftime (time_string, sizeof(time_string), "%F %H:%M:%S", tm);
|
||||
fprintf(spy_output, "%s.%03ld\n", time_string, tv.tv_usec / 1000);
|
||||
fprintf(spy_output, "%s.%03ld\n", time_string, (long)tv.tv_usec / 1000);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ isoApplet_create_pin(sc_profile_t *profile, sc_pkcs15_card_t *p15card, sc_file_t
|
||||
|
||||
LOG_FUNC_CALLED(card->ctx);
|
||||
|
||||
if(!pin || !pin_len || !df || !&df->path)
|
||||
if(!pin || !pin_len || !df)
|
||||
{
|
||||
LOG_FUNC_RETURN(card->ctx, SC_ERROR_INVALID_ARGUMENTS);
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ static int do_userinfo(sc_card_t *card)
|
||||
for (i = 0; openpgp_data[i].ef != NULL; i++) {
|
||||
sc_path_t path;
|
||||
sc_file_t *file;
|
||||
unsigned int count;
|
||||
size_t count;
|
||||
int r;
|
||||
|
||||
sc_format_path(openpgp_data[i].ef, &path);
|
||||
@ -350,22 +350,22 @@ static int do_userinfo(sc_card_t *card)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
count = (unsigned int)file->size;
|
||||
count = file->size;
|
||||
if (!count)
|
||||
continue;
|
||||
|
||||
if (count > (unsigned int)sizeof(buf) - 1) {
|
||||
if (count > sizeof(buf) - 1) {
|
||||
fprintf(stderr, "Too small buffer to read the OpenPGP data\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
r = sc_read_binary(card, 0, buf, (size_t)count, 0);
|
||||
r = sc_read_binary(card, 0, buf, count, 0);
|
||||
if (r < 0) {
|
||||
fprintf(stderr, "%s: read failed - %s\n", openpgp_data[i].ef, sc_strerror(r));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (r != count) {
|
||||
fprintf(stderr, "%s: expecting %d, got only %d bytes\n", openpgp_data[i].ef, count, r);
|
||||
if (r != (signed)count) {
|
||||
fprintf(stderr, "%s: expecting %zd, got only %d bytes\n", openpgp_data[i].ef, count, r);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -1724,7 +1724,7 @@ static int do_asn1(int argc, char **argv)
|
||||
/* some cards return a bogus value for file length. As
|
||||
* long as the actual length is not higher than the expected
|
||||
* length, continue */
|
||||
if(r > len) {
|
||||
if(r > (signed)len) {
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
@ -2018,8 +2018,8 @@ static int write_object(CK_SESSION_HANDLE session)
|
||||
#endif
|
||||
}
|
||||
if (opt_object_class == CKO_PRIVATE_KEY || opt_object_class == CKO_PUBLIC_KEY) {
|
||||
int is_private = opt_object_class == CKO_PRIVATE_KEY;
|
||||
#ifdef ENABLE_OPENSSL
|
||||
int is_private = opt_object_class == CKO_PRIVATE_KEY;
|
||||
int rv;
|
||||
|
||||
rv = do_read_key(contents, contents_len, is_private, &evp_key);
|
||||
@ -2647,7 +2647,6 @@ derive_key(CK_SLOT_ID slot, CK_SESSION_HANDLE session, CK_OBJECT_HANDLE key)
|
||||
CK_BBOOL true = TRUE;
|
||||
CK_BBOOL false = FALSE;
|
||||
CK_OBJECT_HANDLE newkey = 0;
|
||||
CK_ECDH1_DERIVE_PARAMS ecdh_parms;
|
||||
CK_RV rv;
|
||||
int fd, r;
|
||||
CK_ATTRIBUTE newkey_template[] = {
|
||||
@ -2672,6 +2671,7 @@ derive_key(CK_SLOT_ID slot, CK_SESSION_HANDLE session, CK_OBJECT_HANDLE key)
|
||||
case CKM_ECDH1_DERIVE:
|
||||
/* Use OpenSSL to read the other public key, and get the raw verion */
|
||||
{
|
||||
CK_ECDH1_DERIVE_PARAMS ecdh_parms;
|
||||
unsigned char buf[512];
|
||||
int len;
|
||||
BIO *bio_in = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user