Additional changes to make -Wshadow build on Ubuntu 10.04.

Looks like they defined basename() in string.h and ntohs/htonl are
implemented in terms of __bswap16() which is a macro with tmp
variables and so one cannot embed one call to ntohs/htons in another.
Not good but we workaround this limitation in glibc.
This commit is contained in:
Roland C. Dowdeswell
2012-06-07 16:59:01 +01:00
parent 5459558dea
commit abdde6a608
6 changed files with 47 additions and 46 deletions

View File

@@ -706,14 +706,14 @@ define_asn1 (int level, Type *t)
}
static void
getnewbasename(char **newbasename, int typedefp, const char *basename, const char *name)
getnewbasename(char **newbasename, int typedefp, const char *base, const char *name)
{
if (typedefp)
*newbasename = strdup(name);
else {
if (name[0] == '*')
name++;
if (asprintf(newbasename, "%s_%s", basename, name) < 0)
if (asprintf(newbasename, "%s_%s", base, name) < 0)
errx(1, "malloc");
}
if (*newbasename == NULL)
@@ -721,7 +721,7 @@ getnewbasename(char **newbasename, int typedefp, const char *basename, const cha
}
static void
define_type (int level, const char *name, const char *basename, Type *t, int typedefp, int preservep)
define_type (int level, const char *name, const char *base, Type *t, int typedefp, int preservep)
{
char *newbasename = NULL;
@@ -779,7 +779,7 @@ define_type (int level, const char *name, const char *basename, Type *t, int typ
fprintf (headerfile, "heim_bit_string %s;\n", name);
else {
int pos = 0;
getnewbasename(&newbasename, typedefp, basename, name);
getnewbasename(&newbasename, typedefp, base, name);
fprintf (headerfile, "struct %s {\n", newbasename);
ASN1_TAILQ_FOREACH(m, t->members, members) {
@@ -838,7 +838,7 @@ define_type (int level, const char *name, const char *basename, Type *t, int typ
case TSequence: {
Member *m;
getnewbasename(&newbasename, typedefp, basename, name);
getnewbasename(&newbasename, typedefp, base, name);
space(level);
fprintf (headerfile, "struct %s {\n", newbasename);
@@ -868,7 +868,7 @@ define_type (int level, const char *name, const char *basename, Type *t, int typ
Type i;
struct range range = { 0, UINT_MAX };
getnewbasename(&newbasename, typedefp, basename, name);
getnewbasename(&newbasename, typedefp, base, name);
i.type = TInteger;
i.range = &range;
@@ -896,13 +896,13 @@ define_type (int level, const char *name, const char *basename, Type *t, int typ
fprintf (headerfile, "heim_general_string %s;\n", name);
break;
case TTag:
define_type (level, name, basename, t->subtype, typedefp, preservep);
define_type (level, name, base, t->subtype, typedefp, preservep);
break;
case TChoice: {
int first = 1;
Member *m;
getnewbasename(&newbasename, typedefp, basename, name);
getnewbasename(&newbasename, typedefp, base, name);
space(level);
fprintf (headerfile, "struct %s {\n", newbasename);

View File

@@ -40,13 +40,13 @@ static void generate_template_type(const char *, const char **, const char *, co
Type *, int, int, int);
static const char *
ttype_symbol(const char *basename, const Type *t)
ttype_symbol(const char *base, const Type *t)
{
return t->symbol->gen_name;
}
static const char *
integer_symbol(const char *basename, const Type *t)
integer_symbol(const char *base, const Type *t)
{
if (t->members)
return "int"; /* XXX enum foo */
@@ -67,89 +67,89 @@ integer_symbol(const char *basename, const Type *t)
}
static const char *
boolean_symbol(const char *basename, const Type *t)
boolean_symbol(const char *base, const Type *t)
{
return "int";
}
static const char *
octetstring_symbol(const char *basename, const Type *t)
octetstring_symbol(const char *base, const Type *t)
{
return "heim_octet_string";
}
static const char *
sequence_symbol(const char *basename, const Type *t)
sequence_symbol(const char *base, const Type *t)
{
return basename;
return base;
}
static const char *
time_symbol(const char *basename, const Type *t)
time_symbol(const char *base, const Type *t)
{
return "time_t";
}
static const char *
tag_symbol(const char *basename, const Type *t)
tag_symbol(const char *base, const Type *t)
{
return symbol_name(basename, t->subtype);
return symbol_name(base, t->subtype);
}
static const char *
generalstring_symbol(const char *basename, const Type *t)
generalstring_symbol(const char *base, const Type *t)
{
return "heim_general_string";
}
static const char *
printablestring_symbol(const char *basename, const Type *t)
printablestring_symbol(const char *base, const Type *t)
{
return "heim_printable_string";
}
static const char *
ia5string_symbol(const char *basename, const Type *t)
ia5string_symbol(const char *base, const Type *t)
{
return "heim_ia5_string";
}
static const char *
visiblestring_symbol(const char *basename, const Type *t)
visiblestring_symbol(const char *base, const Type *t)
{
return "heim_visible_string";
}
static const char *
utf8string_symbol(const char *basename, const Type *t)
utf8string_symbol(const char *base, const Type *t)
{
return "heim_utf8_string";
}
static const char *
bmpstring_symbol(const char *basename, const Type *t)
bmpstring_symbol(const char *base, const Type *t)
{
return "heim_bmp_string";
}
static const char *
universalstring_symbol(const char *basename, const Type *t)
universalstring_symbol(const char *base, const Type *t)
{
return "heim_universal_string";
}
static const char *
oid_symbol(const char *basename, const Type *t)
oid_symbol(const char *base, const Type *t)
{
return "heim_oid";
}
static const char *
bitstring_symbol(const char *basename, const Type *t)
bitstring_symbol(const char *base, const Type *t)
{
if (t->members)
return basename;
return base;
return "heim_bit_string";
}
@@ -210,13 +210,13 @@ is_template_compat (const Symbol *s)
}
static const char *
symbol_name(const char *basename, const Type *t)
symbol_name(const char *base, const Type *t)
{
size_t i;
for (i = 0; i < sizeof(types)/sizeof(types[0]); i++)
if (t->type == types[i].type)
return (types[i].symbol_name)(basename, t);
return (types[i].symbol_name)(base, t);
printf("unknown der type: %d\n", t->type);
exit(1);
}

View File

@@ -268,6 +268,7 @@ send_via_proxy (krb5_context context,
int ret;
krb5_socket_t s = rk_INVALID_SOCKET;
char portstr[NI_MAXSERV];
int tmp;
if (proxy == NULL)
return ENOMEM;
@@ -280,8 +281,8 @@ send_via_proxy (krb5_context context,
memset (&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
snprintf (portstr, sizeof(portstr), "%d",
ntohs(init_port (colon, htons(80))));
tmp = init_port (colon, htons(80));
snprintf (portstr, sizeof(portstr), "%d", ntohs(tmp));
ret = getaddrinfo (proxy, portstr, &hints, &ai);
free (proxy2);
if (ret)

View File

@@ -250,12 +250,12 @@ getent(char **cap, size_t *len, char **db_array, int fd,
* Check if we have a top record from cgetset().
*/
if (depth == 0 && toprec != NULL && cgetmatch(toprec, name) == 0) {
size_t len = topreclen + BFRAG;
if ((record = malloc (len)) == NULL) {
size_t tmplen = topreclen + BFRAG;
if ((record = malloc (tmplen)) == NULL) {
errno = ENOMEM;
return (-2);
}
(void)strlcpy(record, toprec, len);
(void)strlcpy(record, toprec, tmplen);
db_p = db_array;
rp = record + topreclen + 1;
r_end = rp + BFRAG;

View File

@@ -404,7 +404,7 @@ static int
glob0(const Char *pattern, glob_t *pglob)
{
const Char *qpatnext;
int c, err, oldpathc;
int c, ret, oldpathc;
Char *bufnext, patbuf[MaxPathLen+1];
size_t limit = 0;
@@ -464,8 +464,8 @@ glob0(const Char *pattern, glob_t *pglob)
qprintf("glob0:", patbuf);
#endif
if ((err = glob1(patbuf, pglob, &limit)) != 0)
return(err);
if ((ret = glob1(patbuf, pglob, &limit)) != 0)
return(ret);
/*
* If there was no match we are going to append the pattern
@@ -572,7 +572,7 @@ glob3(Char *pathbuf, Char *pathend, Char *pattern, Char *restpattern,
{
struct dirent *dp;
DIR *dirp;
int err;
int ret;
char buf[MaxPathLen];
/*
@@ -597,7 +597,7 @@ glob3(Char *pathbuf, Char *pathend, Char *pattern, Char *restpattern,
return(0);
}
err = 0;
ret = 0;
/* Search directory for matching names. */
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
@@ -618,8 +618,8 @@ glob3(Char *pathbuf, Char *pathend, Char *pattern, Char *restpattern,
*pathend = CHAR_EOS;
continue;
}
err = glob2(pathbuf, --dc, restpattern, pglob, limit);
if (err)
ret = glob2(pathbuf, --dc, restpattern, pglob, limit);
if (ret)
break;
}
@@ -627,7 +627,7 @@ glob3(Char *pathbuf, Char *pathend, Char *pattern, Char *restpattern,
(*pglob->gl_closedir)(dirp);
else
closedir(dirp);
return(err);
return(ret);
}

View File

@@ -74,13 +74,13 @@ pidfile_cleanup(void)
}
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
pidfile(const char *basename)
pidfile(const char *bname)
{
if(pidfile_path != NULL)
return;
if(basename == NULL)
basename = getprogname();
pidfile_path = pid_file_write(basename);
if(bname == NULL)
bname = getprogname();
pidfile_path = pid_file_write(bname);
#if defined(HAVE_ATEXIT)
atexit(pidfile_cleanup);
#elif defined(HAVE_ON_EXIT)