fix compiler warnings

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1938 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
nils 2004-10-17 18:34:24 +00:00
parent 5b4730dabd
commit 912ddbdf57
1 changed files with 17 additions and 16 deletions

View File

@ -81,8 +81,8 @@ static int parse_dir_record(struct sc_card *card, u8 ** buf, size_t *buflen,
int r;
u8 aid[128], label[128], path[128];
u8 ddo[128];
int aid_len = sizeof(aid), label_len = sizeof(label),
path_len = sizeof(path), ddo_len = sizeof(ddo);
size_t aid_len = sizeof(aid), label_len = sizeof(label),
path_len = sizeof(path), ddo_len = sizeof(ddo);
sc_copy_asn1_entry(c_asn1_dirrecord, asn1_dirrecord);
sc_copy_asn1_entry(c_asn1_dir, asn1_dir);
@ -207,8 +207,8 @@ int sc_enum_apps(struct sc_card *card)
} else { /* record structure */
u8 buf[256], *p;
int rec_nr;
size_t rec_size;
unsigned int rec_nr;
size_t rec_size;
for (rec_nr = 1; ; rec_nr++) {
card->ctx->suppress_errors++;
@ -224,7 +224,7 @@ int sc_enum_apps(struct sc_card *card)
}
rec_size = r;
p = buf;
parse_dir_record(card, &p, &rec_size, rec_nr);
parse_dir_record(card, &p, &rec_size, (int)rec_nr);
}
}
return card->app_count;
@ -262,23 +262,24 @@ static int encode_dir_record(struct sc_context *ctx, const struct sc_app_info *a
u8 **buf, size_t *buflen)
{
struct sc_asn1_entry asn1_dirrecord[5], asn1_dir[2];
struct sc_app_info tapp = *app;
int r;
size_t label_len;
sc_copy_asn1_entry(c_asn1_dirrecord, asn1_dirrecord);
sc_copy_asn1_entry(c_asn1_dir, asn1_dir);
sc_format_asn1_entry(asn1_dir + 0, asn1_dirrecord, NULL, 1);
sc_format_asn1_entry(asn1_dirrecord + 0, (void *) app->aid, (void *) &app->aid_len, 1);
if (app->label != NULL) {
label_len = strlen(app->label);
sc_format_asn1_entry(asn1_dirrecord + 1, app->label, &label_len, 1);
sc_format_asn1_entry(asn1_dirrecord + 0, (void *) tapp.aid, (void *) &tapp.aid_len, 1);
if (tapp.label != NULL) {
label_len = strlen(tapp.label);
sc_format_asn1_entry(asn1_dirrecord + 1, tapp.label, &label_len, 1);
}
if (app->path.len)
sc_format_asn1_entry(asn1_dirrecord + 2, (void *) app->path.value,
(void *) &app->path.len, 1);
if (app->ddo != NULL)
sc_format_asn1_entry(asn1_dirrecord + 3, (void *) app->ddo,
(void *) &app->ddo_len, 1);
if (tapp.path.len)
sc_format_asn1_entry(asn1_dirrecord + 2, (void *) tapp.path.value,
(void *) &tapp.path.len, 1);
if (tapp.ddo != NULL)
sc_format_asn1_entry(asn1_dirrecord + 3, (void *) tapp.ddo,
(void *) &tapp.ddo_len, 1);
r = sc_asn1_encode(ctx, asn1_dir, buf, buflen);
if (r) {
sc_error(ctx, "sc_asn1_encode() failed: %s\n",
@ -343,7 +344,7 @@ static int update_single_record(struct sc_card *card, struct sc_file *file,
r = encode_dir_record(card->ctx, app, &rec, &rec_size);
if (r)
return r;
r = sc_update_record(card, app->rec_nr, rec, rec_size, 0);
r = sc_update_record(card, (unsigned int)app->rec_nr, rec, rec_size, 0);
free(rec);
SC_TEST_RET(card->ctx, r, "Unable to update EF(DIR) record");
return 0;