cleanup: declare local functions as static, renamed shadowed variables etc.

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2012 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
nils 2004-12-15 09:35:30 +00:00
parent 57cc65e485
commit e7a0b8f4eb
5 changed files with 19 additions and 19 deletions

View File

@ -209,7 +209,7 @@ static int jcop_select_file(struct sc_card *card, const struct sc_path *path,
struct sc_card_driver *iso_drv = sc_get_iso7816_driver();
const struct sc_card_operations *iso_ops = iso_drv->ops;
sc_path_t shortpath;
struct sc_file *tmpfile, **fileptr;
struct sc_file *tfile, **fileptr;
if (!drvdata)
return SC_ERROR_FILE_NOT_FOUND;
@ -220,7 +220,7 @@ static int jcop_select_file(struct sc_card *card, const struct sc_path *path,
if (file) {
fileptr=file;
} else {
fileptr=&tmpfile;
fileptr=&tfile;
}
/* Selecting the MF. return a copy of the constructed MF */
@ -320,7 +320,7 @@ static int jcop_read_binary(struct sc_card *card, unsigned int idx,
struct jcop_private_data *drvdata=DRVDATA(card);
struct sc_card_driver *iso_drv = sc_get_iso7816_driver();
const struct sc_card_operations *iso_ops = iso_drv->ops;
struct sc_file *tmpfile;
struct sc_file *tfile;
int r;
if (drvdata->selected == SELECT_MF) {
@ -334,12 +334,12 @@ static int jcop_read_binary(struct sc_card *card, unsigned int idx,
count=128-idx;
}
card->ctx->suppress_errors++;
r = iso_ops->select_file(card, &drvdata->aid, &tmpfile);
r = iso_ops->select_file(card, &drvdata->aid, &tfile);
card->ctx->suppress_errors--;
if (r < 0) { /* no pkcs15 app, so return empty DIR. */
memset(buf, 0, count);
} else {
sc_file_free(tmpfile);
sc_file_free(tfile);
memcpy(buf, (u8 *)(ef_dir_contents + idx), count);
}
return count;
@ -351,7 +351,7 @@ static int jcop_list_files(struct sc_card *card, u8 *buf, size_t buflen) {
struct jcop_private_data *drvdata=DRVDATA(card);
struct sc_card_driver *iso_drv = sc_get_iso7816_driver();
const struct sc_card_operations *iso_ops = iso_drv->ops;
struct sc_file *tmpfile;
struct sc_file *tfile;
int r;
if (drvdata->selected == SELECT_MF) {
@ -362,12 +362,12 @@ static int jcop_list_files(struct sc_card *card, u8 *buf, size_t buflen) {
return 2;
/* AppDF only exists if applet is selectable */
card->ctx->suppress_errors++;
r = iso_ops->select_file(card, &drvdata->aid, &tmpfile);
r = iso_ops->select_file(card, &drvdata->aid, &tfile);
card->ctx->suppress_errors--;
if (r < 0) {
return 2;
} else {
sc_file_free(tmpfile);
sc_file_free(tfile);
memcpy(buf+2, "\x50\x15", 2);
return 4;
}
@ -377,7 +377,7 @@ static int jcop_list_files(struct sc_card *card, u8 *buf, size_t buflen) {
return SC_ERROR_NOT_ALLOWED;
if (drvdata->nfiles == 0)
return 0;
if (buflen > 2 * drvdata->nfiles)
if (buflen > 2 * (size_t)drvdata->nfiles)
buflen=2*drvdata->nfiles;
memcpy(buf, drvdata->filelist, buflen);
return buflen;

View File

@ -185,7 +185,7 @@ sc_card_identify (struct sc_card *card, struct sc_card_atrs *atr_list)
* Sad side: not available without a NDA.
*/
int
static int
mcrd_delete_ref_to_authkey (struct sc_card *card)
{
struct sc_apdu apdu;
@ -205,7 +205,7 @@ mcrd_delete_ref_to_authkey (struct sc_card *card)
SC_FUNC_RETURN (card->ctx, 2, sc_check_sw (card, apdu.sw1, apdu.sw2));
}
int
static int
mcrd_delete_ref_to_signkey (struct sc_card *card)
{
struct sc_apdu apdu;
@ -226,7 +226,7 @@ mcrd_delete_ref_to_signkey (struct sc_card *card)
}
int
static int
mcrd_set_decipher_key_ref (struct sc_card *card, int key_reference)
{
struct sc_apdu apdu;
@ -1257,7 +1257,7 @@ static int mcrd_compute_signature(struct sc_card *card,
}
/* added by -mp */
int mcrd_decipher(struct sc_card *card,
static int mcrd_decipher(struct sc_card *card,
const u8 * crgram, size_t crgram_len, u8 * out,
size_t out_len)
{
@ -1303,7 +1303,7 @@ int mcrd_decipher(struct sc_card *card,
}
/* added by -mp, to give pin information in the card driver (pkcs15emu->driver needed) */
int mcrd_pin_cmd(struct sc_card *card, struct sc_pin_cmd_data *data,
static int mcrd_pin_cmd(struct sc_card *card, struct sc_pin_cmd_data *data,
int *tries_left)
{
SC_FUNC_CALLED(card->ctx, 3);

View File

@ -287,7 +287,7 @@ add_acl_entry(struct sc_card *card, struct sc_file *file, unsigned int op,
}
int
static int
tlv_get(unsigned char *msg, unsigned char tag, unsigned char *ret, int *ret_len)
{
int len = *(msg+1);
@ -501,7 +501,7 @@ check_path(struct sc_card *card, const u8 **pathptr, size_t *pathlen,
}
void
static void
auth_cache_path(struct sc_card *card, const struct sc_path *path)
{
struct sc_path *curpath = &card->cache.current_path;

View File

@ -76,7 +76,7 @@ const static struct sc_card_error iso7816_errors[] = {
{ 0x6A8A, SC_ERROR_FILE_ALREADY_EXISTS, "Application exists"},
};
int iso7816_check_sw(struct sc_card *card, int sw1, int sw2)
static int iso7816_check_sw(struct sc_card *card, int sw1, int sw2)
{
const int err_count = sizeof(iso7816_errors)/sizeof(iso7816_errors[0]);
int i;
@ -273,7 +273,7 @@ static int iso7816_update_binary(struct sc_card *card,
SC_FUNC_RETURN(card->ctx, 3, count);
}
int iso7816_process_fci(struct sc_card *card, struct sc_file *file,
static int iso7816_process_fci(struct sc_card *card, struct sc_file *file,
const u8 *buf, size_t buflen)
{
struct sc_context *ctx = card->ctx;

View File

@ -159,7 +159,7 @@ sc_pkcs15emu_infocamere_init(sc_pkcs15_card_t *p15card)
sc_bin_to_hex(buffer, len_iccsn , serial, sizeof(serial), 0);
if (file->size < (len_iccsn + 5))
if (file->size < (size_t)(len_iccsn + 5))
{
/* Not CHN */
r = SC_ERROR_WRONG_CARD;