diff options
author | Ben Laurie <ben@openssl.org> | 2008-11-01 14:37:00 +0000 |
---|---|---|
committer | Ben Laurie <ben@openssl.org> | 2008-11-01 14:37:00 +0000 |
commit | 4d6e1e4f29de455b5e644ea9cae5d5f5a2dbef33 (patch) | |
tree | 9b43a103ede688bfb7b006837387dacb02ec3dc5 /crypto/objects | |
parent | 122396f2dbeda0f25e9af1bb069a324ec793da57 (diff) |
size_tification.
Diffstat (limited to 'crypto/objects')
-rw-r--r-- | crypto/objects/o_names.c | 4 | ||||
-rw-r--r-- | crypto/objects/obj_dat.c | 20 | ||||
-rw-r--r-- | crypto/objects/objects.h | 3 |
3 files changed, 15 insertions, 12 deletions
diff --git a/crypto/objects/o_names.c b/crypto/objects/o_names.c index 84380a96a9..992a6ee983 100644 --- a/crypto/objects/o_names.c +++ b/crypto/objects/o_names.c @@ -289,7 +289,7 @@ void OBJ_NAME_do_all(int type,void (*fn)(const OBJ_NAME *,void *arg),void *arg) struct doall_sorted { int type; - int n; + size_t n; const OBJ_NAME **names; }; @@ -322,7 +322,7 @@ void OBJ_NAME_do_all_sorted(int type,void (*fn)(const OBJ_NAME *,void *arg), d.n=0; OBJ_NAME_do_all(type,do_all_sorted_fn,&d); - qsort((void *)d.names,d.n,sizeof *d.names,do_all_sorted_cmp); + qsort(d.names,d.n,sizeof *d.names,do_all_sorted_cmp); for(n=0 ; n < d.n ; ++n) fn(d.names[n],arg); diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c index e999ef7831..1582d61492 100644 --- a/crypto/objects/obj_dat.c +++ b/crypto/objects/obj_dat.c @@ -431,7 +431,8 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name) unsigned char *buf; unsigned char *p; const unsigned char *cp; - int i, j; + size_t i; + size_t j; if(!no_name) { if( ((nid = OBJ_sn2nid(s)) != NID_undef) || @@ -441,7 +442,7 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name) /* Work out size of content octets */ i=a2d_ASN1_OBJECT(NULL,0,s,-1); - if (i <= 0) { + if (i == 0) { /* Don't clear the error */ /*ERR_clear_error();*/ return NULL; @@ -449,7 +450,7 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name) /* Work out total size */ j = ASN1_object_size(0,i,V_ASN1_OBJECT); - if((buf=(unsigned char *)OPENSSL_malloc(j)) == NULL) return NULL; + if((buf=OPENSSL_malloc(j)) == NULL) return NULL; p = buf; /* Write out tag+length */ @@ -463,7 +464,7 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name) return op; } -int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) +int OBJ_obj2txt(char *buf, size_t buf_len, const ASN1_OBJECT *a, int no_name) { int i,n=0,len,nid, first, use_bn; BIGNUM *bl; @@ -508,7 +509,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name) goto err; if (use_bn) { - if (!BN_add_word(bl, c & 0x7f)) + if (!BN_add_word(bl, c & 0x7fU)) goto err; } else @@ -782,12 +783,13 @@ int OBJ_create(const char *oid, const char *sn, const char *ln) int ok=0; ASN1_OBJECT *op=NULL; unsigned char *buf; - int i; + size_t i; i=a2d_ASN1_OBJECT(NULL,0,oid,-1); - if (i <= 0) return(0); + if (i == 0) + return 0; - if ((buf=(unsigned char *)OPENSSL_malloc(i)) == NULL) + if ((buf=OPENSSL_malloc(i)) == NULL) { OBJerr(OBJ_F_OBJ_CREATE,ERR_R_MALLOC_FAILURE); return(0); @@ -795,7 +797,7 @@ int OBJ_create(const char *oid, const char *sn, const char *ln) i=a2d_ASN1_OBJECT(buf,i,oid,-1); if (i == 0) goto err; - op=(ASN1_OBJECT *)ASN1_OBJECT_create(OBJ_new_nid(1),buf,i,sn,ln); + op=ASN1_OBJECT_create(OBJ_new_nid(1),buf,i,sn,ln); if (op == NULL) goto err; ok=OBJ_add_object(op); diff --git a/crypto/objects/objects.h b/crypto/objects/objects.h index 65b6f01358..10c198ad47 100644 --- a/crypto/objects/objects.h +++ b/crypto/objects/objects.h @@ -1006,7 +1006,8 @@ const char * OBJ_nid2ln(int n); const char * OBJ_nid2sn(int n); int OBJ_obj2nid(const ASN1_OBJECT *o); ASN1_OBJECT * OBJ_txt2obj(const char *s, int no_name); -int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name); +int OBJ_obj2txt(char *buf, size_t buf_len, const ASN1_OBJECT *a, + int no_name); int OBJ_txt2nid(const char *s); int OBJ_ln2nid(const char *s); int OBJ_sn2nid(const char *s); |