Bunch of constifications.

This commit is contained in:
Andy Polyakov 2007-10-13 15:51:32 +00:00
parent e979c039f9
commit ebc06fba67
15 changed files with 28 additions and 28 deletions

View File

@ -117,8 +117,8 @@ err:
int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *d)
{
static int min[9]={ 0, 0, 1, 1, 0, 0, 0, 0, 0};
static int max[9]={99, 99,12,31,23,59,59,12,59};
static const int min[9]={ 0, 0, 1, 1, 0, 0, 0, 0, 0};
static const int max[9]={99, 99,12,31,23,59,59,12,59};
char *a;
int n,i,l,o;

View File

@ -158,7 +158,7 @@ ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, const unsigned char *in,
/* This table must be kept in NID order */
static ASN1_STRING_TABLE tbl_standard[] = {
static const ASN1_STRING_TABLE tbl_standard[] = {
{NID_commonName, 1, ub_common_name, DIRSTRING_TYPE, 0},
{NID_countryName, 2, 2, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK},
{NID_localityName, 1, ub_locality_name, DIRSTRING_TYPE, 0},

View File

@ -114,8 +114,8 @@ err:
int ASN1_UTCTIME_check(ASN1_UTCTIME *d)
{
static int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0};
static int max[8]={99,12,31,23,59,59,12,59};
static const int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0};
static const int max[8]={99,12,31,23,59,59,12,59};
char *a;
int n,i,l,o;

View File

@ -538,7 +538,7 @@ static int append_exp(tag_exp_arg *arg, int exp_tag, int exp_class, int exp_cons
static int asn1_str2tag(const char *tagstr, int len)
{
unsigned int i;
static struct tag_name_st *tntmp, tnst [] = {
static const struct tag_name_st *tntmp, tnst [] = {
ASN1_GEN_STR("BOOL", V_ASN1_BOOLEAN),
ASN1_GEN_STR("BOOLEAN", V_ASN1_BOOLEAN),
ASN1_GEN_STR("NULL", V_ASN1_NULL),

View File

@ -415,7 +415,7 @@ end:
const char *ASN1_tag2str(int tag)
{
static const char *tag2str[] = {
static const char * const tag2str[] = {
"EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING", /* 0-4 */
"NULL", "OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL", /* 5-9 */
"ENUMERATED", "<ASN1 11>", "UTF8STRING", "<ASN1 13>", /* 10-13 */

View File

@ -2,7 +2,7 @@
* Mask of various character properties
*/
static unsigned char char_type[] = {
static const unsigned char char_type[] = {
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
120, 0, 1,40, 0, 0, 0,16,16,16, 0,25,25,16,16,16,

View File

@ -175,7 +175,7 @@ static int MS_CALLBACK slg_write(BIO *b, const char *in, int inl)
char* buf;
char* pp;
int priority, i;
static struct
static const struct
{
int strl;
char str[10];

View File

@ -149,7 +149,7 @@ static int mem_read(BIO *b, char *out, int outl)
bm=(BUF_MEM *)b->ptr;
BIO_clear_retry_flags(b);
ret=(outl >=0 && (size_t)outl > bm->length)?bm->length:outl;
ret=(outl >=0 && (size_t)outl > bm->length)?(int)bm->length:outl;
if ((out != NULL) && (ret > 0)) {
memcpy(out,bm->data,ret);
bm->length-=ret;

View File

@ -336,7 +336,7 @@ int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule)
void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule)
{
static int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0};
static const int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0};
register DES_LONG c,d,t,s,t2;
register const unsigned char *in;
register DES_LONG *k;

View File

@ -60,7 +60,7 @@
/* RSA's DESX */
static unsigned char desx_white_in2out[256]={
static const unsigned char desx_white_in2out[256]={
0xBD,0x56,0xEA,0xF2,0xA2,0xF1,0xAC,0x2A,0xB0,0x93,0xD1,0x9C,0x1B,0x33,0xFD,0xD0,
0x30,0x04,0xB6,0xDC,0x7D,0xDF,0x32,0x4B,0xF7,0xCB,0x45,0x9B,0x31,0xBB,0x21,0x5A,
0x41,0x9F,0xE1,0xD9,0x4A,0x4D,0x9E,0xDA,0xA0,0x68,0x2C,0xC3,0x27,0x5F,0x80,0x36,

View File

@ -85,7 +85,7 @@
#define CHUNKS_PER_LINE (64/4)
#define CHAR_PER_LINE (64+1)
static unsigned char data_bin2ascii[65]="ABCDEFGHIJKLMNOPQRSTUVWXYZ\
static const unsigned char data_bin2ascii[65]="ABCDEFGHIJKLMNOPQRSTUVWXYZ\
abcdefghijklmnopqrstuvwxyz0123456789+/";
/* 0xF0 is a EOLN
@ -102,7 +102,7 @@ abcdefghijklmnopqrstuvwxyz0123456789+/";
#define B64_ERROR 0xFF
#define B64_NOT_BASE64(a) (((a)|0x13) == 0xF3)
static unsigned char data_ascii2bin[128]={
static const unsigned char data_ascii2bin[128]={
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xE0,0xF0,0xFF,0xFF,0xF1,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

View File

@ -543,9 +543,9 @@ DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO)
DECLARE_ASN1_FUNCTIONS(OCSP_CRLID)
DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC)
char *OCSP_response_status_str(long s);
char *OCSP_cert_status_str(long s);
char *OCSP_crl_reason_str(long s);
const char *OCSP_response_status_str(long s);
const char *OCSP_cert_status_str(long s);
const char *OCSP_crl_reason_str(long s);
int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST* a, unsigned long flags);
int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags);

View File

@ -120,7 +120,7 @@ void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx)
OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req,
int maxline)
{
static char post_hdr[] = "POST %s HTTP/1.0\r\n"
static const char post_hdr[] = "POST %s HTTP/1.0\r\n"
"Content-Type: application/ocsp-request\r\n"
"Content-Length: %d\r\n\r\n";

View File

@ -85,21 +85,21 @@ static int ocsp_certid_print(BIO *bp, OCSP_CERTID* a, int indent)
typedef struct
{
long t;
char *m;
const char *m;
} OCSP_TBLSTR;
static char *table2string(long s, OCSP_TBLSTR *ts, int len)
static const char *table2string(long s, const OCSP_TBLSTR *ts, int len)
{
OCSP_TBLSTR *p;
const OCSP_TBLSTR *p;
for (p=ts; p < ts + len; p++)
if (p->t == s)
return p->m;
return "(UNKNOWN)";
}
char *OCSP_response_status_str(long s)
const char *OCSP_response_status_str(long s)
{
static OCSP_TBLSTR rstat_tbl[] = {
static const OCSP_TBLSTR rstat_tbl[] = {
{ OCSP_RESPONSE_STATUS_SUCCESSFUL, "successful" },
{ OCSP_RESPONSE_STATUS_MALFORMEDREQUEST, "malformedrequest" },
{ OCSP_RESPONSE_STATUS_INTERNALERROR, "internalerror" },
@ -109,18 +109,18 @@ char *OCSP_response_status_str(long s)
return table2string(s, rstat_tbl, 6);
}
char *OCSP_cert_status_str(long s)
const char *OCSP_cert_status_str(long s)
{
static OCSP_TBLSTR cstat_tbl[] = {
static const OCSP_TBLSTR cstat_tbl[] = {
{ V_OCSP_CERTSTATUS_GOOD, "good" },
{ V_OCSP_CERTSTATUS_REVOKED, "revoked" },
{ V_OCSP_CERTSTATUS_UNKNOWN, "unknown" } };
return table2string(s, cstat_tbl, 3);
}
char *OCSP_crl_reason_str(long s)
const char *OCSP_crl_reason_str(long s)
{
OCSP_TBLSTR reason_tbl[] = {
static const OCSP_TBLSTR reason_tbl[] = {
{ OCSP_REVOKED_STATUS_UNSPECIFIED, "unspecified" },
{ OCSP_REVOKED_STATUS_KEYCOMPROMISE, "keyCompromise" },
{ OCSP_REVOKED_STATUS_CACOMPROMISE, "cACompromise" },

View File

@ -72,7 +72,7 @@ int i;
char *p;
unsigned char *q;
BUF_MEM *b=NULL;
static char hex[17]="0123456789ABCDEF";
static const char hex[17]="0123456789ABCDEF";
int gs_doit[4];
char tmp_buf[80];
#ifdef CHARSET_EBCDIC