some cleanup: 'int' -> 'unsigned int' for flags, 'int' -> 'size_t'

for length + remove some compiler warnings


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1940 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
nils 2004-10-17 20:20:59 +00:00
parent 912ddbdf57
commit 5985415603
2 changed files with 17 additions and 14 deletions

View File

@ -25,6 +25,7 @@
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <opensc/scdl.h>
static const struct sc_asn1_entry c_asn1_toki[] = {
@ -293,7 +294,7 @@ static const int odf_indexes[] = {
SC_PKCS15_AODF,
};
static int parse_odf(const u8 * buf, int buflen, struct sc_pkcs15_card *card)
static int parse_odf(const u8 * buf, size_t buflen, struct sc_pkcs15_card *card)
{
const u8 *p = buf;
size_t left = buflen;
@ -568,7 +569,7 @@ static int sc_pkcs15_bind_internal(sc_pkcs15_card_t *p15card)
err = SC_ERROR_PKCS15_APP_NOT_FOUND;
goto end;
}
parse_tokeninfo(p15card, buf, err);
parse_tokeninfo(p15card, buf, (size_t)err);
ok = 1;
end:
@ -646,6 +647,7 @@ error:
SC_FUNC_RETURN(ctx, 1, r);
}
#if 0
int sc_pkcs15_detect(struct sc_card *card)
{
int r;
@ -657,13 +659,14 @@ int sc_pkcs15_detect(struct sc_card *card)
return 0;
return 1;
}
#endif
int sc_pkcs15_unbind(struct sc_pkcs15_card *p15card)
{
assert(p15card != NULL && p15card->magic == SC_PKCS15_CARD_MAGIC);
SC_FUNC_CALLED(p15card->card->ctx, 1);
if (p15card->dll_handle)
sc_module_close(p15card->card->ctx, p15card->dll_handle);
scdl_close(p15card->dll_handle);
sc_pkcs15_card_free(p15card);
return 0;
}
@ -1094,8 +1097,8 @@ int sc_pkcs15_encode_df(struct sc_context *ctx,
u8 *buf = NULL, *tmp = NULL;
size_t bufsize = 0, tmpsize;
const struct sc_pkcs15_object *obj;
int (* func)(struct sc_context *, const struct sc_pkcs15_object *obj,
u8 **buf, size_t *bufsize) = NULL;
int (* func)(struct sc_context *, const struct sc_pkcs15_object *nobj,
u8 **nbuf, size_t *nbufsize) = NULL;
int r;
assert(p15card != NULL && p15card->magic == SC_PKCS15_CARD_MAGIC);
@ -1155,7 +1158,7 @@ int sc_pkcs15_parse_df(struct sc_pkcs15_card *p15card,
int r;
struct sc_pkcs15_object *obj = NULL;
int (* func)(struct sc_pkcs15_card *, struct sc_pkcs15_object *,
const u8 **buf, size_t *bufsize) = NULL;
const u8 **nbuf, size_t *nbufsize) = NULL;
switch (df->type) {
case SC_PKCS15_PRKDF:

View File

@ -66,7 +66,7 @@ typedef struct sc_pkcs15_id sc_pkcs15_id_t;
struct sc_pkcs15_pin_info {
struct sc_pkcs15_id auth_id;
int reference;
int flags, type;
unsigned int flags, type;
size_t min_length, stored_length, max_length;
u8 pad_char;
struct sc_path path;
@ -255,7 +255,7 @@ struct sc_pkcs15_pubkey_info {
struct sc_pkcs15_id id; /* correlates to private key id */
unsigned int usage, access_flags;
int native, key_reference;
int modulus_length;
size_t modulus_length;
struct sc_path path;
};
@ -280,17 +280,17 @@ typedef struct sc_pkcs15_pubkey_info sc_pkcs15_pubkey_info_t;
#define SC_PKCS15_TYPE_AUTH_PIN 0x601
#define SC_PKCS15_TYPE_TO_CLASS(t) (1 << ((t) >> 8))
#define SC_PKCS15_SEARCH_CLASS_PRKEY 0x0002
#define SC_PKCS15_SEARCH_CLASS_PUBKEY 0x0004
#define SC_PKCS15_SEARCH_CLASS_CERT 0x0010
#define SC_PKCS15_SEARCH_CLASS_DATA 0x0020
#define SC_PKCS15_SEARCH_CLASS_AUTH 0x0040
#define SC_PKCS15_SEARCH_CLASS_PRKEY 0x0002U
#define SC_PKCS15_SEARCH_CLASS_PUBKEY 0x0004U
#define SC_PKCS15_SEARCH_CLASS_CERT 0x0010U
#define SC_PKCS15_SEARCH_CLASS_DATA 0x0020U
#define SC_PKCS15_SEARCH_CLASS_AUTH 0x0040U
struct sc_pkcs15_object {
int type;
/* CommonObjectAttributes */
char label[SC_PKCS15_MAX_LABEL_SIZE]; /* zero terminated */
int flags;
unsigned int flags;
struct sc_pkcs15_id auth_id;
int user_consent;