Commit f756fb43 authored by Justin Blanchard's avatar Justin Blanchard Committed by Rich Salz
Browse files

RT1815: More const'ness improvements



Add a dozen more const declarations where appropriate.
These are from Justin; while adding his patch, I noticed
ASN1_BIT_STRING_check could be fixed, too.

Reviewed-by: default avatarDr. Stephen Henson <steve@openssl.org>
parent defe438d
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -212,7 +212,7 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
	return(1);
	}

int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n)
int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n)
	{
	int w,v;

@@ -229,8 +229,8 @@ int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n)
 * which is not specified in 'flags', 1 otherwise.
 * 'len' is the length of 'flags'.
 */
int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
			  unsigned char *flags, int flags_len)
int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a,
			  const unsigned char *flags, int flags_len)
	{
	int i, ok;
	/* Check if there is one bit set at all. */
+3 −3
Original line number Diff line number Diff line
@@ -819,9 +819,9 @@ ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **p
int		ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,
			int length );
int		ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
int		ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
int            ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
                                     unsigned char *flags, int flags_len);
int		ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n);
int            ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a,
                                     const unsigned char *flags, int flags_len);

#ifndef OPENSSL_NO_BIO
int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ print <<EOF;
 * Mask of various character properties
 */

static unsigned char char_type[] = {
static const unsigned char char_type[] = {
EOF

for($i = 0; $i < 128; $i++) {
+2 −2
Original line number Diff line number Diff line
@@ -401,8 +401,8 @@ static int asn1_print_fsname(BIO *out, int indent,
			const char *fname, const char *sname,
			const ASN1_PCTX *pctx)
	{
	static char spaces[] = "                    ";
	const int nspaces = sizeof(spaces) - 1;
	static const char spaces[] = "                    ";
	static const int nspaces = sizeof(spaces) - 1;

#if 0
	if (!sname && !fname)
+3 −3
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@
#define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \
					CONF_PUNCTUATION)

#define KEYTYPES(c)		((unsigned short *)((c)->meth_data))
#define KEYTYPES(c)		((const unsigned short *)((c)->meth_data))
#ifndef CHARSET_EBCDIC
#define IS_COMMENT(c,a)		(KEYTYPES(c)[(a)&0xff]&CONF_COMMENT)
#define IS_FCOMMENT(c,a)	(KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT)
@@ -108,7 +108,7 @@
#define IS_HIGHBIT(c,a)		(KEYTYPES(c)[os_toascii[a]&0xff]&CONF_HIGHBIT)
#endif /*CHARSET_EBCDIC*/

static unsigned short CONF_type_default[256]={
static const unsigned short CONF_type_default[256]={
	0x0008,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0010,0x0010,0x0000,0x0000,0x0010,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
@@ -143,7 +143,7 @@ static unsigned short CONF_type_default[256]={
	0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
	};

static unsigned short CONF_type_win32[256]={
static const unsigned short CONF_type_win32[256]={
	0x0008,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
	0x0000,0x0010,0x0010,0x0000,0x0000,0x0010,0x0000,0x0000,
	0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
Loading