compile warnings: resolve 'comparison between signed and unsigned' compiler warnings

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5534 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
vtarasov 2011-06-02 16:59:39 +00:00
parent 31a56bb374
commit f026db6f84
5 changed files with 13 additions and 12 deletions

View File

@ -1859,7 +1859,8 @@ iasecc_pin_get_policy (struct sc_card *card, struct sc_pin_cmd_data *data)
struct sc_file *save_current_df = NULL, *save_current_ef = NULL;
struct iasecc_sdo sdo;
struct sc_path path;
int ii, rv;
unsigned ii;
int rv;
LOG_FUNC_CALLED(ctx);
sc_log(ctx, "iasecc_pin_get_policy(card:%p)", card);
@ -1918,7 +1919,7 @@ iasecc_pin_get_policy (struct sc_card *card, struct sc_pin_cmd_data *data)
if (scb==0 || scb==0xFF)
continue;
if (se.reference != acl->key_ref) {
if (se.reference != (int)acl->key_ref) {
memset(&se, 0, sizeof(se));
se.reference = acl->key_ref;
@ -2135,7 +2136,7 @@ iasecc_pin_cmd(struct sc_card *card, struct sc_pin_cmd_data *data, int *tries_le
sc_log(ctx, "iasecc_pin_cmd(SC_PIN_CMD_CHANGE) pin_verify returned %i", rv);
LOG_TEST_RET(ctx, rv, "PIN verification error");
if (data->pin1.len + data->pin2.len > sizeof(pin_data))
if ((unsigned)(data->pin1.len + data->pin2.len) > sizeof(pin_data))
LOG_TEST_RET(ctx, SC_ERROR_BUFFER_TOO_SMALL, "Buffer too small for the 'Change PIN' data");
if (data->pin1.data)
@ -2766,7 +2767,7 @@ iasecc_qsign_data_sha1(struct sc_context *ctx, const unsigned char *in, size_t i
out->counter[ii] = (sha.Nh >> 8*(hh_size-1-ii)) &0xFF;
out->counter[hh_size+ii] = (pre_hash_Nl >> 8*(hh_size-1-ii)) &0xFF;
}
for (ii=0, out->counter_long=0; ii<sizeof(out->counter); ii++)
for (ii=0, out->counter_long=0; ii<(int)sizeof(out->counter); ii++)
out->counter_long = out->counter_long*0x100 + out->counter[ii];
sc_log(ctx, "Pre counter(%li):%s", out->counter_long, sc_dump_hex(out->counter, sizeof(out->counter)));
@ -2815,7 +2816,7 @@ iasecc_qsign_data_sha256(struct sc_context *ctx, const unsigned char *in, size_t
out->counter[ii] = (sha256.Nh >> 8*(hh_size-1-ii)) &0xFF;
out->counter[hh_size+ii] = (pre_hash_Nl >> 8*(hh_size-1-ii)) &0xFF;
}
for (ii=0, out->counter_long=0; ii<sizeof(out->counter); ii++)
for (ii=0, out->counter_long=0; ii<(int)sizeof(out->counter); ii++)
out->counter_long = out->counter_long*0x100 + out->counter[ii];
sc_log(ctx, "Pre counter(%li):%s", out->counter_long, sc_dump_hex(out->counter, sizeof(out->counter)));

View File

@ -1168,8 +1168,8 @@ int
iasecc_sdo_parse_card_answer(struct sc_context *ctx, unsigned char *data, size_t data_len,
struct iasecc_sm_card_answer *out)
{
int offs, have_mac = 0, have_status = 0;
size_t size = 0, size_size;
int have_mac = 0, have_status = 0;
size_t size = 0, size_size, offs;
LOG_FUNC_CALLED(ctx);
if (!data || !data_len || !out)

View File

@ -304,8 +304,7 @@ sc_oberthur_read_file(struct sc_pkcs15_card *p15card, const char *in_path,
pinfo = (struct sc_pkcs15_pin_info *) objs[ii]->data;
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "compare PIN/ACL refs:%i/%i, method:%i/%i",
pinfo->reference, acl->key_ref, pinfo->auth_method, acl->method);
if (pinfo->reference == acl->key_ref
&& pinfo->auth_method == acl->method) {
if (pinfo->reference == (int)acl->key_ref && pinfo->auth_method == (unsigned)acl->method) {
pin_obj = objs[ii];
break;
}

View File

@ -96,7 +96,7 @@ int authentic_pkcs15_delete_file(struct sc_pkcs15_card *p15card, struct sc_profi
static void
authentic_reference_to_pkcs15_id (unsigned int ref, struct sc_pkcs15_id *id)
{
int ii, sz;
unsigned ii, sz;
for (ii=0, sz = 0; ii<sizeof(unsigned int); ii++)
if (ref >> 8*ii)
@ -294,7 +294,7 @@ authentic_docp_set_acls(struct sc_card *card, struct sc_file *file,
struct sc_authentic_sdo_docp *docp)
{
struct sc_context *ctx = card->ctx;
int ii, offs;
unsigned ii, offs;
LOG_FUNC_CALLED(ctx);
if (ops_len > sizeof(docp->acl_data) / 2)

View File

@ -557,7 +557,8 @@ iasecc_sdo_convert_to_file(struct sc_card *card, struct iasecc_sdo *sdo, struct
{
struct sc_context *ctx = card->ctx;
struct sc_file *file = sc_file_new();
int rv, ii;
unsigned ii;
int rv;
LOG_FUNC_CALLED(ctx);
if (file == NULL)