Bunch of constifications.
authorAndy Polyakov <appro@openssl.org>
Sat, 13 Oct 2007 15:51:32 +0000 (15:51 +0000)
committerAndy Polyakov <appro@openssl.org>
Sat, 13 Oct 2007 15:51:32 +0000 (15:51 +0000)
15 files changed:
crypto/asn1/a_gentm.c
crypto/asn1/a_strnid.c
crypto/asn1/a_utctm.c
crypto/asn1/asn1_gen.c
crypto/asn1/asn1_par.c
crypto/asn1/charmap.h
crypto/bio/bss_log.c
crypto/bio/bss_mem.c
crypto/des/set_key.c
crypto/des/xcbc_enc.c
crypto/evp/encode.c
crypto/ocsp/ocsp.h
crypto/ocsp/ocsp_ht.c
crypto/ocsp/ocsp_prn.c
crypto/x509/x509_obj.c

index 4114f7e31ac565eebd383a2a95494075757eb105..9a9caafe8f8b68647ae5ee951e33467bf2765149 100644 (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;
 
index 613bbc4a7da9b9416f2654ffd6ee213f2c78a436..ecf1d6004e3ac887c4be8bcf2b0c39c1958c4e51 100644 (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},
index d31c0281930b4ac504f168e30ae6492c162ce799..2d15ff3c14e0d78e82b794ff8395360398e17c77 100644 (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;
 
index a6cd1ad20e183c6c5232687c78633d2cbfd1a7b4..f73b65f9d59dc37919a114b3fc4f730e4b981781 100644 (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),
index 938a7915ef083dd17225dc72ac15a4fbf563fdca..c322dec2b299a4f3c16fa2802379390bf65296e0 100644 (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 */
index bd020a9562fd15c3c228ec6ec43a9849c4b08d59..b55e6387259c4c01ae81be29d761456626cf729b 100644 (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,
index 6360dbc820b45735493264b6aee6c7b4b8b6ac1c..bb676a83a9fe0e0e86d4a54c61747ab5154cae88 100644 (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];
index 5e89537557f914cd763880a5553b97ffa1b95eff..f7dbdf7bfa1174b7af3df43a6b57635aa60d2634 100644 (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;
index ccfad81c2e2fccafa68a060ce7f9cd2d28b9ebdc..3004cc3ab3cf3eb602a9da69b7966b68563b0786 100644 (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;
index 47246eb466497c0667c1221aa83bc5b7811a36a2..7b046f0988922e1cfa7471b968349b8b551be7af 100644 (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,
index 5921f0d710d8faed65c203cf180a7a4b320facb8..b42c74724936c6a9dc53e557cb96dd0ba6118e68 100644 (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,
index bbfc5055df98c5fe3a6e0ac7300424b1bf9bff66..1741e419c0b0ca2d7549f4886efeacbdf1d8b11b 100644 (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);
index a8e569b74a0c18fdc1791f975001b21d70800f9b..5059cf652eac27430ed8562f509aabd0374401ab 100644 (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";
 
index 3dfb51c1e41c6cf5ccf5644e3a3125f02df9ee8d..409a9777ad650171ef406a981ef62d615a5e101a 100644 (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" },
index 1e718f76eb2dd0b37582e22110f7b002db2512d9..21fed9f838d63959dab37b1d9c526494eb9c6708 100644 (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