From 6e28de8050664387cb7ca410694265417df8b60d Mon Sep 17 00:00:00 2001 From: Russell Bryant <russell@russellbryant.com> Date: Fri, 7 Jul 2006 06:55:48 +0000 Subject: [PATCH] fix various pointer signedness issues git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@37286 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- dns.c | 14 +++++++------- enum.c | 14 +++++++------- include/asterisk/dns.h | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dns.c b/dns.c index 83b27c3d22..d3393267eb 100644 --- a/dns.c +++ b/dns.c @@ -91,7 +91,7 @@ struct dn_answer { unsigned short size; } __attribute__ ((__packed__)); -static int skip_name(char *s, int len) +static int skip_name(unsigned char *s, int len) { int x = 0; @@ -116,10 +116,10 @@ static int skip_name(char *s, int len) /*! \brief Parse DNS lookup result, call callback */ static int dns_parse_answer(void *context, - int class, int type, char *answer, int len, - int (*callback)(void *context, char *answer, int len, char *fullanswer)) + int class, int type, unsigned char *answer, int len, + int (*callback)(void *context, unsigned char *answer, int len, unsigned char *fullanswer)) { - char *fullanswer = answer; + unsigned char *fullanswer = answer; struct dn_answer *ans; dns_HEADER *h; int res; @@ -192,12 +192,12 @@ not work properly, Asterisk might not start properly or a channel may lock. */ int ast_search_dns(void *context, const char *dname, int class, int type, - int (*callback)(void *context, char *answer, int len, char *fullanswer)) + int (*callback)(void *context, unsigned char *answer, int len, unsigned char *fullanswer)) { #ifdef HAS_RES_NINIT struct __res_state dnsstate; #endif - char answer[MAX_SIZE]; + unsigned char answer[MAX_SIZE]; int res, ret = -1; #ifdef HAS_RES_NINIT @@ -205,7 +205,7 @@ int ast_search_dns(void *context, memset(&dnsstate, 0, sizeof(dnsstate)); #endif res_ninit(&dnsstate); - res = res_nsearch(&dnsstate, dname, class, type, (unsigned char *)answer, sizeof(answer)); + res = res_nsearch(&dnsstate, dname, class, type, answer, sizeof(answer)); #else ast_mutex_lock(&res_lock); res_init(); diff --git a/enum.c b/enum.c index 1cf76ef1a5..1ec5589b1b 100644 --- a/enum.c +++ b/enum.c @@ -95,7 +95,7 @@ struct naptr { } __attribute__ ((__packed__)); /*! \brief Parse NAPTR record information elements */ -static unsigned int parse_ie(char *data, unsigned int maxdatalen, char *src, unsigned int srclen) +static unsigned int parse_ie(char *data, unsigned int maxdatalen, unsigned char *src, unsigned int srclen) { unsigned int len, olen; @@ -116,10 +116,10 @@ static unsigned int parse_ie(char *data, unsigned int maxdatalen, char *src, uns } /*! \brief Parse DNS NAPTR record used in ENUM ---*/ -static int parse_naptr(unsigned char *dst, int dstsize, char *tech, int techsize, unsigned char *answer, int len, unsigned char *naptrinput) +static int parse_naptr(char *dst, int dstsize, char *tech, int techsize, unsigned char *answer, int len, char *naptrinput) { char tech_return[80]; - char *oanswer = answer; + unsigned char *oanswer = answer; char flags[512] = ""; char services[512] = ""; char *p; @@ -167,7 +167,7 @@ static int parse_naptr(unsigned char *dst, int dstsize, char *tech, int techsize len -= res; } - if ((res = dn_expand((unsigned char *)oanswer, (unsigned char *)answer + len, (unsigned char *)answer, repl, sizeof(repl) - 1)) < 0) { + if ((res = dn_expand(oanswer, answer + len, answer, repl, sizeof(repl) - 1)) < 0) { ast_log(LOG_WARNING, "Failed to expand hostname\n"); return -1; } @@ -324,7 +324,7 @@ struct enum_context { }; /*! \brief Callback for TXT record lookup */ -static int txt_callback(void *context, char *answer, int len, char *fullanswer) +static int txt_callback(void *context, unsigned char *answer, int len, unsigned char *fullanswer) { struct enum_context *c = (struct enum_context *)context; #if 0 @@ -350,7 +350,7 @@ static int txt_callback(void *context, char *answer, int len, char *fullanswer) len +=1; /* finally, copy the answer into c->txt */ - ast_copy_string(c->txt, answer, len < c->txtlen ? len : (c->txtlen)); + ast_copy_string(c->txt, (const char *) answer, len < c->txtlen ? len : (c->txtlen)); /* just to be safe, let's make sure c->txt is null terminated */ c->txt[(c->txtlen)-1] = '\0'; @@ -359,7 +359,7 @@ static int txt_callback(void *context, char *answer, int len, char *fullanswer) } /*! \brief Callback from ENUM lookup function */ -static int enum_callback(void *context, char *answer, int len, char *fullanswer) +static int enum_callback(void *context, unsigned char *answer, int len, unsigned char *fullanswer) { struct enum_context *c = context; void *p = NULL; diff --git a/include/asterisk/dns.h b/include/asterisk/dns.h index a549f5edbf..60209509d1 100644 --- a/include/asterisk/dns.h +++ b/include/asterisk/dns.h @@ -36,6 +36,6 @@ struct ast_channel; services does not work, Asterisk may lock while waiting for response. */ int ast_search_dns(void *context, const char *dname, int class, int type, - int (*callback)(void *context, char *answer, int len, char *fullanswer)); + int (*callback)(void *context, unsigned char *answer, int len, unsigned char *fullanswer)); #endif /* _ASTERISK_DNS_H */ -- GitLab