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:
parent
5b4730dabd
commit
912ddbdf57
|
@ -81,8 +81,8 @@ static int parse_dir_record(struct sc_card *card, u8 ** buf, size_t *buflen,
|
||||||
int r;
|
int r;
|
||||||
u8 aid[128], label[128], path[128];
|
u8 aid[128], label[128], path[128];
|
||||||
u8 ddo[128];
|
u8 ddo[128];
|
||||||
int aid_len = sizeof(aid), label_len = sizeof(label),
|
size_t aid_len = sizeof(aid), label_len = sizeof(label),
|
||||||
path_len = sizeof(path), ddo_len = sizeof(ddo);
|
path_len = sizeof(path), ddo_len = sizeof(ddo);
|
||||||
|
|
||||||
sc_copy_asn1_entry(c_asn1_dirrecord, asn1_dirrecord);
|
sc_copy_asn1_entry(c_asn1_dirrecord, asn1_dirrecord);
|
||||||
sc_copy_asn1_entry(c_asn1_dir, asn1_dir);
|
sc_copy_asn1_entry(c_asn1_dir, asn1_dir);
|
||||||
|
@ -207,8 +207,8 @@ int sc_enum_apps(struct sc_card *card)
|
||||||
|
|
||||||
} else { /* record structure */
|
} else { /* record structure */
|
||||||
u8 buf[256], *p;
|
u8 buf[256], *p;
|
||||||
int rec_nr;
|
unsigned int rec_nr;
|
||||||
size_t rec_size;
|
size_t rec_size;
|
||||||
|
|
||||||
for (rec_nr = 1; ; rec_nr++) {
|
for (rec_nr = 1; ; rec_nr++) {
|
||||||
card->ctx->suppress_errors++;
|
card->ctx->suppress_errors++;
|
||||||
|
@ -224,7 +224,7 @@ int sc_enum_apps(struct sc_card *card)
|
||||||
}
|
}
|
||||||
rec_size = r;
|
rec_size = r;
|
||||||
p = buf;
|
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;
|
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)
|
u8 **buf, size_t *buflen)
|
||||||
{
|
{
|
||||||
struct sc_asn1_entry asn1_dirrecord[5], asn1_dir[2];
|
struct sc_asn1_entry asn1_dirrecord[5], asn1_dir[2];
|
||||||
|
struct sc_app_info tapp = *app;
|
||||||
int r;
|
int r;
|
||||||
size_t label_len;
|
size_t label_len;
|
||||||
|
|
||||||
sc_copy_asn1_entry(c_asn1_dirrecord, asn1_dirrecord);
|
sc_copy_asn1_entry(c_asn1_dirrecord, asn1_dirrecord);
|
||||||
sc_copy_asn1_entry(c_asn1_dir, asn1_dir);
|
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_dir + 0, asn1_dirrecord, NULL, 1);
|
||||||
sc_format_asn1_entry(asn1_dirrecord + 0, (void *) app->aid, (void *) &app->aid_len, 1);
|
sc_format_asn1_entry(asn1_dirrecord + 0, (void *) tapp.aid, (void *) &tapp.aid_len, 1);
|
||||||
if (app->label != NULL) {
|
if (tapp.label != NULL) {
|
||||||
label_len = strlen(app->label);
|
label_len = strlen(tapp.label);
|
||||||
sc_format_asn1_entry(asn1_dirrecord + 1, app->label, &label_len, 1);
|
sc_format_asn1_entry(asn1_dirrecord + 1, tapp.label, &label_len, 1);
|
||||||
}
|
}
|
||||||
if (app->path.len)
|
if (tapp.path.len)
|
||||||
sc_format_asn1_entry(asn1_dirrecord + 2, (void *) app->path.value,
|
sc_format_asn1_entry(asn1_dirrecord + 2, (void *) tapp.path.value,
|
||||||
(void *) &app->path.len, 1);
|
(void *) &tapp.path.len, 1);
|
||||||
if (app->ddo != NULL)
|
if (tapp.ddo != NULL)
|
||||||
sc_format_asn1_entry(asn1_dirrecord + 3, (void *) app->ddo,
|
sc_format_asn1_entry(asn1_dirrecord + 3, (void *) tapp.ddo,
|
||||||
(void *) &app->ddo_len, 1);
|
(void *) &tapp.ddo_len, 1);
|
||||||
r = sc_asn1_encode(ctx, asn1_dir, buf, buflen);
|
r = sc_asn1_encode(ctx, asn1_dir, buf, buflen);
|
||||||
if (r) {
|
if (r) {
|
||||||
sc_error(ctx, "sc_asn1_encode() failed: %s\n",
|
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);
|
r = encode_dir_record(card->ctx, app, &rec, &rec_size);
|
||||||
if (r)
|
if (r)
|
||||||
return 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);
|
free(rec);
|
||||||
SC_TEST_RET(card->ctx, r, "Unable to update EF(DIR) record");
|
SC_TEST_RET(card->ctx, r, "Unable to update EF(DIR) record");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue