diff --git a/src/libopensc/ctx.c b/src/libopensc/ctx.c index cd32cd33..5b6d3bbd 100644 --- a/src/libopensc/ctx.c +++ b/src/libopensc/ctx.c @@ -147,7 +147,7 @@ static void add_drv(struct _sc_ctx_options *opts, const char *name) { struct _sc_driver_entry *lst; int *cp, max, i; - + lst = opts->cdrv; cp = &opts->ccount; max = SC_MAX_CARD_DRIVERS; @@ -232,7 +232,7 @@ static int load_parameters(sc_context_t *ctx, scconf_block *block, sc_ctx_log_to_file(ctx, val); ctx->paranoid_memory = scconf_get_bool (block, "paranoid-memory", - ctx->paranoid_memory); + ctx->paranoid_memory); val = scconf_get_str(block, "force_card_driver", NULL); if (val) { @@ -259,12 +259,12 @@ static void load_reader_driver_options(sc_context_t *ctx) { struct sc_reader_driver *driver = ctx->reader_driver; scconf_block *conf_block = NULL; - + driver->max_send_size = 0; driver->max_recv_size = 0; conf_block = sc_get_conf_block(ctx, "reader_driver", driver->short_name, 1); - + if (conf_block != NULL) { driver->max_send_size = scconf_get_int(conf_block, "max_send_size", driver->max_send_size); driver->max_recv_size = scconf_get_int(conf_block, "max_recv_size", driver->max_recv_size); @@ -564,12 +564,12 @@ static void process_config_file(sc_context_t *ctx, struct _sc_ctx_options *opts) } blocks = scconf_find_blocks(ctx->conf, NULL, "app", ctx->app_name); if (blocks[0]) - ctx->conf_blocks[count++] = blocks[0]; + ctx->conf_blocks[count++] = blocks[0]; free(blocks); if (strcmp(ctx->app_name, "default") != 0) { blocks = scconf_find_blocks(ctx->conf, NULL, "app", "default"); if (blocks[0]) - ctx->conf_blocks[count] = blocks[0]; + ctx->conf_blocks[count] = blocks[0]; free(blocks); } /* Above we add 2 blocks at most, but conf_blocks has 3 elements, @@ -587,7 +587,7 @@ int sc_ctx_detect_readers(sc_context_t *ctx) if (drv->ops->detect_readers != NULL) r = drv->ops->detect_readers(ctx); - + sc_mutex_unlock(ctx, ctx->mutex); return r; @@ -646,7 +646,7 @@ int sc_context_create(sc_context_t **ctx_out, const sc_context_param_t *parm) sc_release_context(ctx); return SC_ERROR_OUT_OF_MEMORY; } - + set_defaults(ctx, &opts); list_init(&ctx->readers); list_attributes_seeker(&ctx->readers, reader_list_seeker); @@ -688,7 +688,7 @@ int sc_context_create(sc_context_t **ctx_out, const sc_context_param_t *parm) load_reader_driver_options(ctx); ctx->reader_driver->ops->init(ctx); - + load_card_drivers(ctx, &opts); load_card_atrs(ctx); if (opts.forced_card_driver) { @@ -728,7 +728,7 @@ int sc_wait_for_event(sc_context_t *ctx, unsigned int event_mask, sc_reader_t ** SC_FUNC_CALLED(ctx, SC_LOG_DEBUG_NORMAL); if (ctx->reader_driver->ops->wait_for_event != NULL) return ctx->reader_driver->ops->wait_for_event(ctx, event_mask, event_reader, event, timeout, reader_states); - + return SC_ERROR_NOT_SUPPORTED; } diff --git a/src/libopensc/sc.c b/src/libopensc/sc.c index 25509b86..35e01d03 100644 --- a/src/libopensc/sc.c +++ b/src/libopensc/sc.c @@ -158,7 +158,7 @@ int sc_format_oid(struct sc_object_id *oid, const char *in) oid->value[ii] = -1; p = in; - + for (ii=0; ii < SC_MAX_OBJECT_ID_OCTETS; ii++) { oid->value[ii] = strtol(p, &q, 10); if (!*q) @@ -200,7 +200,7 @@ int sc_detect_card_presence(sc_reader_t *reader) SC_FUNC_RETURN(reader->ctx, SC_LOG_DEBUG_NORMAL, r); } -int sc_path_set(sc_path_t *path, int type, const u8 *id, size_t id_len, +int sc_path_set(sc_path_t *path, int type, const u8 *id, size_t id_len, int idx, int count) { if (path == NULL || id == NULL || id_len == 0 || id_len > SC_MAX_PATH_SIZE) @@ -212,7 +212,7 @@ int sc_path_set(sc_path_t *path, int type, const u8 *id, size_t id_len, path->type = type; path->index = idx; path->count = count; - + return SC_SUCCESS; } @@ -340,11 +340,11 @@ int sc_compare_path_prefix(const sc_path_t *prefix, const sc_path_t *path) const sc_path_t *sc_get_mf_path(void) { - static const sc_path_t mf_path = { - {0x3f, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 2, - 0, - 0, - SC_PATH_TYPE_PATH, + static const sc_path_t mf_path = { + {0x3f, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 2, + 0, + 0, + SC_PATH_TYPE_PATH, {{0},0} }; return &mf_path; @@ -687,7 +687,7 @@ int _sc_parse_atr(sc_reader_t *reader) atr_len--; } else tx[i] = -1; - } + } } if (atr_len <= 0) return 0; @@ -752,8 +752,8 @@ int sc_mem_reverse(unsigned char *buf, size_t len) return 0; } -static int -sc_remote_apdu_allocate(struct sc_remote_data *rdata, +static int +sc_remote_apdu_allocate(struct sc_remote_data *rdata, struct sc_remote_apdu **new_rapdu) { struct sc_remote_apdu *rapdu = NULL, *rr; @@ -786,7 +786,7 @@ sc_remote_apdu_allocate(struct sc_remote_data *rdata, return SC_SUCCESS; } -static void +static void sc_remote_apdu_free (struct sc_remote_data *rdata) { struct sc_remote_apdu *rapdu = NULL; @@ -857,7 +857,7 @@ int sc_mutex_destroy(const sc_context_t *ctx, void *mutex) unsigned long sc_thread_id(const sc_context_t *ctx) { - if (ctx == NULL || ctx->thread_ctx == NULL || + if (ctx == NULL || ctx->thread_ctx == NULL || ctx->thread_ctx->thread_id == NULL) return 0UL; else