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:
@@ -706,14 +706,14 @@ define_asn1 (int level, Type *t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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)
|
if (typedefp)
|
||||||
*newbasename = strdup(name);
|
*newbasename = strdup(name);
|
||||||
else {
|
else {
|
||||||
if (name[0] == '*')
|
if (name[0] == '*')
|
||||||
name++;
|
name++;
|
||||||
if (asprintf(newbasename, "%s_%s", basename, name) < 0)
|
if (asprintf(newbasename, "%s_%s", base, name) < 0)
|
||||||
errx(1, "malloc");
|
errx(1, "malloc");
|
||||||
}
|
}
|
||||||
if (*newbasename == NULL)
|
if (*newbasename == NULL)
|
||||||
@@ -721,7 +721,7 @@ getnewbasename(char **newbasename, int typedefp, const char *basename, const cha
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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;
|
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);
|
fprintf (headerfile, "heim_bit_string %s;\n", name);
|
||||||
else {
|
else {
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
getnewbasename(&newbasename, typedefp, basename, name);
|
getnewbasename(&newbasename, typedefp, base, name);
|
||||||
|
|
||||||
fprintf (headerfile, "struct %s {\n", newbasename);
|
fprintf (headerfile, "struct %s {\n", newbasename);
|
||||||
ASN1_TAILQ_FOREACH(m, t->members, members) {
|
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: {
|
case TSequence: {
|
||||||
Member *m;
|
Member *m;
|
||||||
|
|
||||||
getnewbasename(&newbasename, typedefp, basename, name);
|
getnewbasename(&newbasename, typedefp, base, name);
|
||||||
|
|
||||||
space(level);
|
space(level);
|
||||||
fprintf (headerfile, "struct %s {\n", newbasename);
|
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;
|
Type i;
|
||||||
struct range range = { 0, UINT_MAX };
|
struct range range = { 0, UINT_MAX };
|
||||||
|
|
||||||
getnewbasename(&newbasename, typedefp, basename, name);
|
getnewbasename(&newbasename, typedefp, base, name);
|
||||||
|
|
||||||
i.type = TInteger;
|
i.type = TInteger;
|
||||||
i.range = ⦥
|
i.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);
|
fprintf (headerfile, "heim_general_string %s;\n", name);
|
||||||
break;
|
break;
|
||||||
case TTag:
|
case TTag:
|
||||||
define_type (level, name, basename, t->subtype, typedefp, preservep);
|
define_type (level, name, base, t->subtype, typedefp, preservep);
|
||||||
break;
|
break;
|
||||||
case TChoice: {
|
case TChoice: {
|
||||||
int first = 1;
|
int first = 1;
|
||||||
Member *m;
|
Member *m;
|
||||||
|
|
||||||
getnewbasename(&newbasename, typedefp, basename, name);
|
getnewbasename(&newbasename, typedefp, base, name);
|
||||||
|
|
||||||
space(level);
|
space(level);
|
||||||
fprintf (headerfile, "struct %s {\n", newbasename);
|
fprintf (headerfile, "struct %s {\n", newbasename);
|
||||||
|
@@ -40,13 +40,13 @@ static void generate_template_type(const char *, const char **, const char *, co
|
|||||||
Type *, int, int, int);
|
Type *, int, int, int);
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
ttype_symbol(const char *basename, const Type *t)
|
ttype_symbol(const char *base, const Type *t)
|
||||||
{
|
{
|
||||||
return t->symbol->gen_name;
|
return t->symbol->gen_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
integer_symbol(const char *basename, const Type *t)
|
integer_symbol(const char *base, const Type *t)
|
||||||
{
|
{
|
||||||
if (t->members)
|
if (t->members)
|
||||||
return "int"; /* XXX enum foo */
|
return "int"; /* XXX enum foo */
|
||||||
@@ -67,89 +67,89 @@ integer_symbol(const char *basename, const Type *t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
boolean_symbol(const char *basename, const Type *t)
|
boolean_symbol(const char *base, const Type *t)
|
||||||
{
|
{
|
||||||
return "int";
|
return "int";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
octetstring_symbol(const char *basename, const Type *t)
|
octetstring_symbol(const char *base, const Type *t)
|
||||||
{
|
{
|
||||||
return "heim_octet_string";
|
return "heim_octet_string";
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
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 *
|
static const char *
|
||||||
time_symbol(const char *basename, const Type *t)
|
time_symbol(const char *base, const Type *t)
|
||||||
{
|
{
|
||||||
return "time_t";
|
return "time_t";
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
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 *
|
static const char *
|
||||||
generalstring_symbol(const char *basename, const Type *t)
|
generalstring_symbol(const char *base, const Type *t)
|
||||||
{
|
{
|
||||||
return "heim_general_string";
|
return "heim_general_string";
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
printablestring_symbol(const char *basename, const Type *t)
|
printablestring_symbol(const char *base, const Type *t)
|
||||||
{
|
{
|
||||||
return "heim_printable_string";
|
return "heim_printable_string";
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
ia5string_symbol(const char *basename, const Type *t)
|
ia5string_symbol(const char *base, const Type *t)
|
||||||
{
|
{
|
||||||
return "heim_ia5_string";
|
return "heim_ia5_string";
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
visiblestring_symbol(const char *basename, const Type *t)
|
visiblestring_symbol(const char *base, const Type *t)
|
||||||
{
|
{
|
||||||
return "heim_visible_string";
|
return "heim_visible_string";
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
utf8string_symbol(const char *basename, const Type *t)
|
utf8string_symbol(const char *base, const Type *t)
|
||||||
{
|
{
|
||||||
return "heim_utf8_string";
|
return "heim_utf8_string";
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
bmpstring_symbol(const char *basename, const Type *t)
|
bmpstring_symbol(const char *base, const Type *t)
|
||||||
{
|
{
|
||||||
return "heim_bmp_string";
|
return "heim_bmp_string";
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
universalstring_symbol(const char *basename, const Type *t)
|
universalstring_symbol(const char *base, const Type *t)
|
||||||
{
|
{
|
||||||
return "heim_universal_string";
|
return "heim_universal_string";
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
oid_symbol(const char *basename, const Type *t)
|
oid_symbol(const char *base, const Type *t)
|
||||||
{
|
{
|
||||||
return "heim_oid";
|
return "heim_oid";
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
bitstring_symbol(const char *basename, const Type *t)
|
bitstring_symbol(const char *base, const Type *t)
|
||||||
{
|
{
|
||||||
if (t->members)
|
if (t->members)
|
||||||
return basename;
|
return base;
|
||||||
return "heim_bit_string";
|
return "heim_bit_string";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,13 +210,13 @@ is_template_compat (const Symbol *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
symbol_name(const char *basename, const Type *t)
|
symbol_name(const char *base, const Type *t)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(types)/sizeof(types[0]); i++)
|
for (i = 0; i < sizeof(types)/sizeof(types[0]); i++)
|
||||||
if (t->type == types[i].type)
|
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);
|
printf("unknown der type: %d\n", t->type);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@@ -268,6 +268,7 @@ send_via_proxy (krb5_context context,
|
|||||||
int ret;
|
int ret;
|
||||||
krb5_socket_t s = rk_INVALID_SOCKET;
|
krb5_socket_t s = rk_INVALID_SOCKET;
|
||||||
char portstr[NI_MAXSERV];
|
char portstr[NI_MAXSERV];
|
||||||
|
int tmp;
|
||||||
|
|
||||||
if (proxy == NULL)
|
if (proxy == NULL)
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
@@ -280,8 +281,8 @@ send_via_proxy (krb5_context context,
|
|||||||
memset (&hints, 0, sizeof(hints));
|
memset (&hints, 0, sizeof(hints));
|
||||||
hints.ai_family = PF_UNSPEC;
|
hints.ai_family = PF_UNSPEC;
|
||||||
hints.ai_socktype = SOCK_STREAM;
|
hints.ai_socktype = SOCK_STREAM;
|
||||||
snprintf (portstr, sizeof(portstr), "%d",
|
tmp = init_port (colon, htons(80));
|
||||||
ntohs(init_port (colon, htons(80))));
|
snprintf (portstr, sizeof(portstr), "%d", ntohs(tmp));
|
||||||
ret = getaddrinfo (proxy, portstr, &hints, &ai);
|
ret = getaddrinfo (proxy, portstr, &hints, &ai);
|
||||||
free (proxy2);
|
free (proxy2);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@@ -250,12 +250,12 @@ getent(char **cap, size_t *len, char **db_array, int fd,
|
|||||||
* Check if we have a top record from cgetset().
|
* Check if we have a top record from cgetset().
|
||||||
*/
|
*/
|
||||||
if (depth == 0 && toprec != NULL && cgetmatch(toprec, name) == 0) {
|
if (depth == 0 && toprec != NULL && cgetmatch(toprec, name) == 0) {
|
||||||
size_t len = topreclen + BFRAG;
|
size_t tmplen = topreclen + BFRAG;
|
||||||
if ((record = malloc (len)) == NULL) {
|
if ((record = malloc (tmplen)) == NULL) {
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return (-2);
|
return (-2);
|
||||||
}
|
}
|
||||||
(void)strlcpy(record, toprec, len);
|
(void)strlcpy(record, toprec, tmplen);
|
||||||
db_p = db_array;
|
db_p = db_array;
|
||||||
rp = record + topreclen + 1;
|
rp = record + topreclen + 1;
|
||||||
r_end = rp + BFRAG;
|
r_end = rp + BFRAG;
|
||||||
|
@@ -404,7 +404,7 @@ static int
|
|||||||
glob0(const Char *pattern, glob_t *pglob)
|
glob0(const Char *pattern, glob_t *pglob)
|
||||||
{
|
{
|
||||||
const Char *qpatnext;
|
const Char *qpatnext;
|
||||||
int c, err, oldpathc;
|
int c, ret, oldpathc;
|
||||||
Char *bufnext, patbuf[MaxPathLen+1];
|
Char *bufnext, patbuf[MaxPathLen+1];
|
||||||
size_t limit = 0;
|
size_t limit = 0;
|
||||||
|
|
||||||
@@ -464,8 +464,8 @@ glob0(const Char *pattern, glob_t *pglob)
|
|||||||
qprintf("glob0:", patbuf);
|
qprintf("glob0:", patbuf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((err = glob1(patbuf, pglob, &limit)) != 0)
|
if ((ret = glob1(patbuf, pglob, &limit)) != 0)
|
||||||
return(err);
|
return(ret);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If there was no match we are going to append the pattern
|
* 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;
|
struct dirent *dp;
|
||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
int err;
|
int ret;
|
||||||
char buf[MaxPathLen];
|
char buf[MaxPathLen];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -597,7 +597,7 @@ glob3(Char *pathbuf, Char *pathend, Char *pattern, Char *restpattern,
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
err = 0;
|
ret = 0;
|
||||||
|
|
||||||
/* Search directory for matching names. */
|
/* Search directory for matching names. */
|
||||||
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
|
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
|
||||||
@@ -618,8 +618,8 @@ glob3(Char *pathbuf, Char *pathend, Char *pattern, Char *restpattern,
|
|||||||
*pathend = CHAR_EOS;
|
*pathend = CHAR_EOS;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
err = glob2(pathbuf, --dc, restpattern, pglob, limit);
|
ret = glob2(pathbuf, --dc, restpattern, pglob, limit);
|
||||||
if (err)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -627,7 +627,7 @@ glob3(Char *pathbuf, Char *pathend, Char *pattern, Char *restpattern,
|
|||||||
(*pglob->gl_closedir)(dirp);
|
(*pglob->gl_closedir)(dirp);
|
||||||
else
|
else
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
return(err);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -74,13 +74,13 @@ pidfile_cleanup(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
|
ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
|
||||||
pidfile(const char *basename)
|
pidfile(const char *bname)
|
||||||
{
|
{
|
||||||
if(pidfile_path != NULL)
|
if(pidfile_path != NULL)
|
||||||
return;
|
return;
|
||||||
if(basename == NULL)
|
if(bname == NULL)
|
||||||
basename = getprogname();
|
bname = getprogname();
|
||||||
pidfile_path = pid_file_write(basename);
|
pidfile_path = pid_file_write(bname);
|
||||||
#if defined(HAVE_ATEXIT)
|
#if defined(HAVE_ATEXIT)
|
||||||
atexit(pidfile_cleanup);
|
atexit(pidfile_cleanup);
|
||||||
#elif defined(HAVE_ON_EXIT)
|
#elif defined(HAVE_ON_EXIT)
|
||||||
|
Reference in New Issue
Block a user