mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-23 08:09:34 -05:00
"const"ify some static arrays, and related parameters/variables
This commit is contained in:
parent
c2a0632e63
commit
b6d85256e7
11 changed files with 48 additions and 48 deletions
|
|
@ -106,7 +106,7 @@ lber_log_bprint(int errlvl, int loglvl, char *data, int len )
|
|||
void
|
||||
ber_bprint(char *data, int len )
|
||||
{
|
||||
static char hexdig[] = "0123456789abcdef";
|
||||
static const char hexdig[] = "0123456789abcdef";
|
||||
#define BPLEN 48
|
||||
char out[ BPLEN ];
|
||||
char buf[ BPLEN + sizeof("\t%s\n") ];
|
||||
|
|
|
|||
|
|
@ -163,9 +163,9 @@ typedef struct { Byte a, b; } Couple;
|
|||
/* Prototypes without LDAP_P():
|
||||
* 'Byte' in definition incompatible with unprototyped declaration. */
|
||||
static Byte *c_to_hh ( Byte *o, Byte c );
|
||||
static Byte *c_to_cc ( Byte *o, Couple *cc, Byte c );
|
||||
static int hh_to_c ( Byte *h );
|
||||
static Byte *cc_to_t61 ( Byte *o, Byte *s );
|
||||
static Byte *c_to_cc ( Byte *o, const Couple *cc, Byte c );
|
||||
static int hh_to_c ( const Byte *h );
|
||||
static Byte *cc_to_t61 ( Byte *o, const Byte *s );
|
||||
|
||||
/*
|
||||
Character choosed as base in diacritics alone: NO-BREAK SPACE.
|
||||
|
|
@ -173,7 +173,7 @@ static Byte *cc_to_t61 ( Byte *o, Byte *s );
|
|||
*/
|
||||
#define ALONE 0xA0
|
||||
|
||||
static Couple diacritic[16] = {
|
||||
static const Couple diacritic[16] = {
|
||||
#if (ISO_8859 == 1) || (ISO_8859 == 9)
|
||||
{0,0}, {'`',0}, {0xb4,0}, {'^',0},
|
||||
{'~',0}, {0xaf,0}, {'(',ALONE}, {'.',ALONE},
|
||||
|
|
@ -208,7 +208,7 @@ static Couple diacritic[16] = {
|
|||
L, N, O, R, S, T, U, W, Y, Z.
|
||||
-----------------------------------------------------------------------
|
||||
*/
|
||||
static int letter_w_diacritic[16][38] = {
|
||||
static const int letter_w_diacritic[16][38] = {
|
||||
#if (ISO_8859 == 1)
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
|
@ -670,7 +670,7 @@ static int letter_w_diacritic[16][38] = {
|
|||
/*
|
||||
--- T.61 characters [0xA0 .. 0xBF] -----------------
|
||||
*/
|
||||
static Couple trans_t61a_iso8859[32] = {
|
||||
static const Couple trans_t61a_iso8859[32] = {
|
||||
#if (ISO_8859 == 1) || (ISO_8859 == 9)
|
||||
{'N','S'}, {0xa1,0}, {0xa2,0}, {0xa3,0},
|
||||
{'D','O'}, {0xa5,0}, {'C','u'}, {0xa7,0},
|
||||
|
|
@ -722,7 +722,7 @@ static Couple trans_t61a_iso8859[32] = {
|
|||
/*
|
||||
--- T.61 characters [0xE0 .. 0xFF] -----------------
|
||||
*/
|
||||
static Couple trans_t61b_iso8859[48] = {
|
||||
static const Couple trans_t61b_iso8859[48] = {
|
||||
#if (ISO_8859 == 1)
|
||||
{'-','M'}, {0xb9,0}, {0xae,0}, {0xa9,0},
|
||||
{'T','M'}, {'M','8'}, {0xac,0}, {0xa6,0},
|
||||
|
|
@ -821,7 +821,7 @@ static Couple trans_t61b_iso8859[48] = {
|
|||
--- ISO 8859-n characters <0xA0 .. 0xFF> -------------------
|
||||
*/
|
||||
#if (ISO_8859 == 1)
|
||||
static Couple trans_iso8859_t61[96] = {
|
||||
static const Couple trans_iso8859_t61[96] = {
|
||||
{0xa0,0}, {0xa1,0}, {0xa2,0}, {0xa3,0},
|
||||
{0xa8,0}, {0xa5,0}, {0xd7,0}, {0xa7,0},
|
||||
{0xc8,ALONE}, {0xd3,0}, {0xe3,0}, {0xab,0},
|
||||
|
|
@ -848,7 +848,7 @@ static Couple trans_iso8859_t61[96] = {
|
|||
{0xc8,'u'}, {0xc2,'y'}, {0xfc,0}, {0xc8,'y'}
|
||||
};
|
||||
#elif (ISO_8859 == 2)
|
||||
static Couple trans_iso8859_t61[96] = {
|
||||
static const Couple trans_iso8859_t61[96] = {
|
||||
{0xa0,0}, {0xce,'A'}, {0xc6,ALONE}, {0xe8,0},
|
||||
{0xa8,0}, {0xcf,'L'}, {0xc2,'S'}, {0xa7,0},
|
||||
{0xc8,ALONE}, {0xcf,'S'}, {0xcb,'S'}, {0xcf,'T'},
|
||||
|
|
@ -875,7 +875,7 @@ static Couple trans_iso8859_t61[96] = {
|
|||
{0xc8,'u'}, {0xc2,'y'}, {0xcb,'t'}, {0xc7,ALONE}
|
||||
};
|
||||
#elif (ISO_8859 == 3)
|
||||
static Couple trans_iso8859_t61[96] = {
|
||||
static const Couple trans_iso8859_t61[96] = {
|
||||
{0xa0,0}, {0xe4,0}, {0xc6,ALONE}, {0xa3,0},
|
||||
{0xa8,0}, {0,0}, {0xc3,'H'}, {0xa7,0},
|
||||
{0xc8,ALONE}, {0xc7,'I'}, {0xcb,'S'}, {0xc6,'G'},
|
||||
|
|
@ -902,7 +902,7 @@ static Couple trans_iso8859_t61[96] = {
|
|||
{0xc8,'u'}, {0xc6,'u'}, {0xc3,'s'}, {0xc7,ALONE}
|
||||
};
|
||||
#elif (ISO_8859 == 4)
|
||||
static Couple trans_iso8859_t61[96] = {
|
||||
static const Couple trans_iso8859_t61[96] = {
|
||||
{0xa0,0}, {0xce,'A'}, {0xf0,0}, {0xcb,'R'},
|
||||
{0xa8,0}, {0xc4,'I'}, {0xcb,'L'}, {0xa7,0},
|
||||
{0xc8,ALONE}, {0xcf,'S'}, {0xc5,'E'}, {0xcb,'G'},
|
||||
|
|
@ -929,7 +929,7 @@ static Couple trans_iso8859_t61[96] = {
|
|||
{0xc8,'u'}, {0xc4,'u'}, {0xc5,'u'}, {0xc7,ALONE}
|
||||
};
|
||||
#elif (ISO_8859 == 9)
|
||||
static Couple trans_iso8859_t61[96] = {
|
||||
static const Couple trans_iso8859_t61[96] = {
|
||||
{0xa0,0}, {0xa1,0}, {0xa2,0}, {0xa3,0},
|
||||
{0xa8,0}, {0xa5,0}, {0xd7,0}, {0xa7,0},
|
||||
{0xc8,ALONE}, {0xd3,0}, {0xe3,0}, {0xab,0},
|
||||
|
|
@ -956,7 +956,7 @@ static Couple trans_iso8859_t61[96] = {
|
|||
{0xc8,'u'}, {0xf5,0}, {0xcb,'s'}, {0xc8,'y'}
|
||||
};
|
||||
#elif (ISO_8859 == 10)
|
||||
static Couple trans_iso8859_t61[96] = {
|
||||
static const Couple trans_iso8859_t61[96] = {
|
||||
{0xa0,0}, {0xce,'A'}, {0xc5,'E'}, {0xcb,'G'},
|
||||
{0xc5,'I'}, {0xc4,'I'}, {0xcb,'K'}, {0xa7,0},
|
||||
{0xcb,'L'}, {0xe2,0}, {0xcf,'S'}, {0xed,0},
|
||||
|
|
@ -1001,7 +1001,7 @@ c_to_hh( Byte *o, Byte c )
|
|||
|
||||
|
||||
static Byte *
|
||||
c_to_cc( Byte *o, Couple *cc, Byte c )
|
||||
c_to_cc( Byte *o, const Couple *cc, Byte c )
|
||||
{
|
||||
if ( (*cc).a != 0 ) {
|
||||
if ( (*cc).b == 0 )
|
||||
|
|
@ -1151,7 +1151,7 @@ ldap_t61_to_8859( char **bufp, unsigned long *buflenp, int free_input )
|
|||
|
||||
|
||||
static int
|
||||
hh_to_c( Byte *h )
|
||||
hh_to_c( const Byte *h )
|
||||
{
|
||||
Byte c;
|
||||
|
||||
|
|
@ -1172,7 +1172,7 @@ hh_to_c( Byte *h )
|
|||
|
||||
|
||||
static Byte *
|
||||
cc_to_t61( Byte *o, Byte *s )
|
||||
cc_to_t61( Byte *o, const Byte *s )
|
||||
{
|
||||
int n, c = 0;
|
||||
|
||||
|
|
@ -1563,7 +1563,7 @@ ldap_8859_to_t61( char **bufp, unsigned long *buflenp, int free_input )
|
|||
Byte *s, *oo, *o, *aux;
|
||||
int c;
|
||||
unsigned long len;
|
||||
Couple *cc;
|
||||
const Couple *cc;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_8859_to_t61 input length: %ld\n",
|
||||
*buflenp, 0, 0 );
|
||||
|
|
@ -1689,7 +1689,7 @@ char *s;
|
|||
/* --- routine to convert 8bits characters to the "escaped" (\hh) form --- */
|
||||
|
||||
char *convert_8bit_to_escaped( s )
|
||||
Byte *s;
|
||||
const Byte *s;
|
||||
{
|
||||
Byte *o, *oo;
|
||||
Byte n;
|
||||
|
|
@ -1730,7 +1730,7 @@ Byte *s;
|
|||
that conversion is language dependent.
|
||||
*/
|
||||
|
||||
static Couple last_t61_printabled[32] = {
|
||||
static const Couple last_t61_printabled[32] = {
|
||||
{0,0}, {'A','E'}, {'D',0}, {0,0},
|
||||
{'H',0}, {0,0}, {'I','J'}, {'L',0},
|
||||
{'L',0}, {'O',0}, {'O','E'}, {0,0},
|
||||
|
|
@ -1746,7 +1746,7 @@ Byte *s;
|
|||
{
|
||||
Byte *o, *oo;
|
||||
Byte n;
|
||||
Couple *cc;
|
||||
const Couple *cc;
|
||||
|
||||
if ( (o = oo = (Byte *)malloc( 2 * strlen( s ) + 64 )) == NULL ) {
|
||||
return( NULL );
|
||||
|
|
|
|||
|
|
@ -38,20 +38,20 @@ static void free_disptmpl LDAP_P(( struct ldap_disptmpl *tmpl ));
|
|||
static int read_next_tmpl LDAP_P(( char **bufp, long *blenp,
|
||||
struct ldap_disptmpl **tmplp, int dtversion ));
|
||||
|
||||
static char *tmploptions[] = {
|
||||
static const char *const tmploptions[] = {
|
||||
"addable", "modrdn",
|
||||
"altview",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
static unsigned long tmploptvals[] = {
|
||||
static const unsigned long tmploptvals[] = {
|
||||
LDAP_DTMPL_OPT_ADDABLE, LDAP_DTMPL_OPT_ALLOWMODRDN,
|
||||
LDAP_DTMPL_OPT_ALTVIEW,
|
||||
};
|
||||
|
||||
|
||||
static char *itemtypes[] = {
|
||||
static const char *const itemtypes[] = {
|
||||
"cis", "mls", "dn",
|
||||
"bool", "jpeg", "jpegbtn",
|
||||
"fax", "faxbtn", "audiobtn",
|
||||
|
|
@ -61,7 +61,7 @@ static char *itemtypes[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
static unsigned long itemsynids[] = {
|
||||
static const unsigned long itemsynids[] = {
|
||||
LDAP_SYN_CASEIGNORESTR, LDAP_SYN_MULTILINESTR, LDAP_SYN_DN,
|
||||
LDAP_SYN_BOOLEAN, LDAP_SYN_JPEGIMAGE, LDAP_SYN_JPEGBUTTON,
|
||||
LDAP_SYN_FAXIMAGE, LDAP_SYN_FAXBUTTON, LDAP_SYN_AUDIOBUTTON,
|
||||
|
|
@ -71,7 +71,7 @@ static unsigned long itemsynids[] = {
|
|||
};
|
||||
|
||||
|
||||
static char *itemoptions[] = {
|
||||
static const char *const itemoptions[] = {
|
||||
"ro", "sort",
|
||||
"1val", "hide",
|
||||
"required", "hideiffalse",
|
||||
|
|
@ -79,7 +79,7 @@ static char *itemoptions[] = {
|
|||
};
|
||||
|
||||
|
||||
static unsigned long itemoptvals[] = {
|
||||
static const unsigned long itemoptvals[] = {
|
||||
LDAP_DITEM_OPT_READONLY, LDAP_DITEM_OPT_SORTVALUES,
|
||||
LDAP_DITEM_OPT_SINGLEVALUED, LDAP_DITEM_OPT_HIDEIFEMPTY,
|
||||
LDAP_DITEM_OPT_VALUEREQUIRED, LDAP_DITEM_OPT_HIDEIFFALSE,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ struct ldaperror {
|
|||
char *e_reason;
|
||||
};
|
||||
|
||||
static struct ldaperror ldap_errlist[] = {
|
||||
static const struct ldaperror ldap_errlist[] = {
|
||||
{LDAP_SUCCESS, "Success" },
|
||||
{LDAP_OPERATIONS_ERROR, "Operations error" },
|
||||
{LDAP_PROTOCOL_ERROR, "Protocol error" },
|
||||
|
|
|
|||
|
|
@ -29,11 +29,11 @@ int openldap_ldap_initialized = 0;
|
|||
#define ATTR_STRING 4
|
||||
|
||||
struct ol_keyvalue {
|
||||
char* key;
|
||||
const char * key;
|
||||
int value;
|
||||
};
|
||||
|
||||
static struct ol_keyvalue deref_kv[] = {
|
||||
static const struct ol_keyvalue deref_kv[] = {
|
||||
{"never", LDAP_DEREF_NEVER},
|
||||
{"searching", LDAP_DEREF_SEARCHING},
|
||||
{"finding", LDAP_DEREF_FINDING},
|
||||
|
|
@ -41,10 +41,10 @@ static struct ol_keyvalue deref_kv[] = {
|
|||
{NULL, 0}
|
||||
};
|
||||
|
||||
static struct ol_attribute {
|
||||
static const struct ol_attribute {
|
||||
int type;
|
||||
char* name;
|
||||
void* data;
|
||||
const char * name;
|
||||
const void * data;
|
||||
size_t offset;
|
||||
} attrs[] = {
|
||||
{ATTR_KV, "DEREF", deref_kv, /* or &deref_kv[0] */
|
||||
|
|
@ -150,9 +150,9 @@ static void openldap_ldap_init_w_conf(const char *file)
|
|||
break;
|
||||
|
||||
case ATTR_KV: {
|
||||
struct ol_keyvalue *kv;
|
||||
const struct ol_keyvalue *kv;
|
||||
|
||||
for(kv = (struct ol_keyvalue *) attrs[i].data;
|
||||
for(kv = attrs[i].data;
|
||||
kv->key != NULL;
|
||||
kv++) {
|
||||
|
||||
|
|
@ -255,9 +255,9 @@ static void openldap_ldap_init_w_env(const char *prefix)
|
|||
break;
|
||||
|
||||
case ATTR_KV: {
|
||||
struct ol_keyvalue *kv;
|
||||
const struct ol_keyvalue *kv;
|
||||
|
||||
for(kv = (struct ol_keyvalue *) attrs[i].data;
|
||||
for(kv = attrs[i].data;
|
||||
kv->key != NULL;
|
||||
kv++) {
|
||||
|
||||
|
|
|
|||
|
|
@ -41,13 +41,13 @@ static int read_next_searchobj LDAP_P(( char **bufp, long *blenp,
|
|||
struct ldap_searchobj **sop, int soversion ));
|
||||
|
||||
|
||||
static char *sobjoptions[] = {
|
||||
static const char *const sobjoptions[] = {
|
||||
"internal",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
static unsigned long sobjoptvals[] = {
|
||||
static const unsigned long sobjoptvals[] = {
|
||||
LDAP_SEARCHOBJ_OPT_INTERNAL,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -938,7 +938,7 @@ time2text( char *ldtimestr, int dateonly )
|
|||
This routine was supplied by Mike Accetta at CMU many years ago.
|
||||
*/
|
||||
|
||||
static int dmsize[] = {
|
||||
static const int dmsize[] = {
|
||||
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -82,13 +82,13 @@ main( int argc, char **argv )
|
|||
}
|
||||
|
||||
|
||||
static char *syn_name[] = {
|
||||
static const char *const syn_name[] = {
|
||||
"?", "CIS", "MLS", "DN", "BOOL", "JPEG", "JPEGBTN", "FAX", "FAXBTN",
|
||||
"AUDIOBTN", "TIME", "DATE", "URL", "SEARCHACT", "LINKACT", "ADDDNACT",
|
||||
"VERIFYACT",
|
||||
};
|
||||
|
||||
static char *syn_type[] = {
|
||||
static const char *const syn_type[] = {
|
||||
"?", "txt", "img", "?", "bool", "?", "?", "?", "btn",
|
||||
"?", "?", "?", "?", "?", "?", "?",
|
||||
"action", "?"
|
||||
|
|
@ -96,11 +96,11 @@ static char *syn_type[] = {
|
|||
|
||||
static char *includeattrs[] = { "objectClass", "sn", NULL };
|
||||
|
||||
static char *item_opts[] = {
|
||||
static const char *const item_opts[] = {
|
||||
"ro", "sort", "1val", "hide", "required", "hideiffalse", NULL
|
||||
};
|
||||
|
||||
static unsigned long item_opt_vals[] = {
|
||||
static const unsigned long item_opt_vals[] = {
|
||||
LDAP_DITEM_OPT_READONLY, LDAP_DITEM_OPT_SORTVALUES,
|
||||
LDAP_DITEM_OPT_SINGLEVALUED, LDAP_DITEM_OPT_HIDEIFEMPTY,
|
||||
LDAP_DITEM_OPT_VALUEREQUIRED, LDAP_DITEM_OPT_HIDEIFFALSE,
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ int ldif_debug = 0;
|
|||
#define RIGHT4 0x0f
|
||||
#define CONTINUED_LINE_MARKER '\001'
|
||||
|
||||
static char nib2b64[0x40f] =
|
||||
static const char nib2b64[0x40f] =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
static unsigned char b642nib[0x80] = {
|
||||
static const unsigned char b642nib[0x80] = {
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
void
|
||||
bprint( char *data, int len )
|
||||
{
|
||||
static char hexdig[] = "0123456789abcdef";
|
||||
static const char hexdig[] = "0123456789abcdef";
|
||||
char out[ BPLEN ];
|
||||
int i = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ phonetic( char *s )
|
|||
*/
|
||||
|
||||
/* Character coding array */
|
||||
static char vsvfn[26] = {
|
||||
static const char vsvfn[26] = {
|
||||
1, 16, 4, 16, 9, 2, 4, 16, 9, 2, 0, 2, 2,
|
||||
/* A B C D E F G H I J K L M */
|
||||
2, 1, 4, 0, 2, 4, 4, 1, 0, 0, 0, 8, 0};
|
||||
|
|
|
|||
Loading…
Reference in a new issue