reader-pcsc - minor cleanups in reader features

1. Indent fix.
2. Reorder conditions.
3. Do not print error if SCardControl fails.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3676 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
alonbl 2009-04-03 19:17:15 +00:00
parent 0f050d9cec
commit ef4b1e1410
1 changed files with 23 additions and 21 deletions

View File

@ -551,9 +551,14 @@ static int pcsc_connect(sc_reader_t *reader, sc_slot_info_t *slot)
rv = priv->gpriv->SCardControl(pslot->pcsc_card, CM_IOCTL_GET_FEATURE_REQUEST, NULL,
0, feature_buf, sizeof(feature_buf), &feature_len);
if (rv == SCARD_S_SUCCESS) {
if (!(feature_len % sizeof(PCSC_TLV_STRUCTURE))) {
if (rv != SCARD_S_SUCCESS) {
sc_debug(reader->ctx, "SCardControl failed", rv);
}
else {
if ((feature_len % sizeof(PCSC_TLV_STRUCTURE)) != 0) {
sc_debug(reader->ctx, "Inconsistent TLV from reader!");
}
else {
char *log_disabled = "but it's disabled in configuration file";
/* get the number of elements instead of the complete size */
feature_len /= sizeof(PCSC_TLV_STRUCTURE);
@ -598,7 +603,6 @@ static int pcsc_connect(sc_reader_t *reader, sc_slot_info_t *slot)
} else {
sc_debug(reader->ctx, "%s %s", log_text, log_disabled);
}
}
if (display_ioctl) {
u8 rbuf[SC_MAX_APDU_BUFFER_SIZE];
@ -617,10 +621,8 @@ static int pcsc_connect(sc_reader_t *reader, sc_slot_info_t *slot)
}
}
}
} else
sc_debug(reader->ctx, "Inconsistent TLV from reader!");
} else {
PCSC_ERROR(reader->ctx, "SCardControl failed", rv);
}
}
}
}
return SC_SUCCESS;