Index: pjproject/trunk/pjlib-util/src/pjlib-util/dns.c
===================================================================
--- pjproject/trunk/pjlib-util/src/pjlib-util/dns.c	(revision 1227)
+++ pjproject/trunk/pjlib-util/src/pjlib-util/dns.c	(revision 1239)
@@ -67,5 +67,5 @@
 
     /* Initialize header */
-    hdr = packet;
+    hdr = (pj_dns_hdr*) packet;
     pj_bzero(hdr, sizeof(struct pj_dns_hdr));
     hdr->id = pj_htons(id);
@@ -111,9 +111,9 @@
  * it may contain pointers when name compression is applied) 
  */
-static pj_status_t get_name_len(int rec_counter, const char *pkt, 
-				const char *start, const char *max, 
+static pj_status_t get_name_len(int rec_counter, const pj_uint8_t *pkt, 
+				const pj_uint8_t *start, const pj_uint8_t *max,
 				int *parsed_len, int *name_len)
 {
-    const char *p;
+    const pj_uint8_t *p;
     pj_status_t status;
 
@@ -181,9 +181,9 @@
  * it may contain pointers when compression is applied).
  */
-static pj_status_t get_name(int rec_counter, const char *pkt, 
-			    const char *start, const char *max,
+static pj_status_t get_name(int rec_counter, const pj_uint8_t *pkt, 
+			    const pj_uint8_t *start, const pj_uint8_t *max,
 			    pj_str_t *name)
 {
-    const char *p;
+    const pj_uint8_t *p;
     pj_status_t status;
 
@@ -242,8 +242,8 @@
 /* Skip query records. */
 static pj_status_t parse_query(pj_dns_parsed_query *q, pj_pool_t *pool,
-			       const char *pkt, const char *start, 
-			       const char *max, int *parsed_len)
-{
-    const char *p = start;
+			       const pj_uint8_t *pkt, const pj_uint8_t *start,
+			       const pj_uint8_t *max, int *parsed_len)
+{
+    const pj_uint8_t *p = start;
     int name_len, name_part_len;
     pj_status_t status;
@@ -255,5 +255,5 @@
 
     /* Allocate memory for the name */
-    q->name.ptr = pj_pool_alloc(pool, name_len+4);
+    q->name.ptr = (char*) pj_pool_alloc(pool, name_len+4);
     q->name.slen = 0;
 
@@ -283,9 +283,9 @@
 /* Parse RR records */
 static pj_status_t parse_rr(pj_dns_parsed_rr *rr, pj_pool_t *pool,
-			    const char *pkt,
-			    const char *start, const char *max, 
+			    const pj_uint8_t *pkt,
+			    const pj_uint8_t *start, const pj_uint8_t *max,
 			    int *parsed_len)
 {
-    const char *p = start;
+    const pj_uint8_t *p = start;
     int name_len, name_part_len;
     pj_status_t status;
@@ -297,5 +297,5 @@
 
     /* Allocate memory for the name */
-    rr->name.ptr = pj_pool_alloc(pool, name_len+4);
+    rr->name.ptr = (char*) pj_pool_alloc(pool, name_len+4);
     rr->name.slen = 0;
 
@@ -355,5 +355,5 @@
 
 	/* Allocate memory for the name */
-	rr->rdata.cname.name.ptr = pj_pool_alloc(pool, name_len);
+	rr->rdata.cname.name.ptr = (char*) pj_pool_alloc(pool, name_len);
 	rr->rdata.cname.name.slen = 0;
 
@@ -388,5 +388,5 @@
 
 	/* Allocate memory for the name */
-	rr->rdata.srv.target.ptr = pj_pool_alloc(pool, name_len);
+	rr->rdata.srv.target.ptr = (char*) pj_pool_alloc(pool, name_len);
 	rr->rdata.srv.target.slen = 0;
 
@@ -419,5 +419,5 @@
 {
     pj_dns_parsed_packet *res;
-    char *start, *end;
+    const pj_uint8_t *start, *end;
     pj_status_t status;
     unsigned i;
@@ -431,5 +431,5 @@
 
     /* Create the structure */
-    res = pj_pool_zalloc(pool, sizeof(pj_dns_parsed_packet));
+    res = PJ_POOL_ZALLOC_T(pool, pj_dns_parsed_packet);
 
     /* Copy the DNS header, and convert endianness to host byte order */
@@ -443,17 +443,18 @@
 
     /* Mark start and end of payload */
-    start = ((char*)packet) + sizeof(pj_dns_hdr);
-    end = ((char*)packet) + size;
+    start = ((const pj_uint8_t*)packet) + sizeof(pj_dns_hdr);
+    end = ((const pj_uint8_t*)packet) + size;
 
     /* Parse query records (if any).
      */
     if (res->hdr.qdcount) {
-	res->q = pj_pool_zalloc(pool, res->hdr.qdcount *
+	res->q = (pj_dns_parsed_query*)
+		 pj_pool_zalloc(pool, res->hdr.qdcount *
 				      sizeof(pj_dns_parsed_query));
 	for (i=0; i<res->hdr.qdcount; ++i) {
 	    int parsed_len = 0;
 	    
-	    status = parse_query(&res->q[i], pool, packet, start, end,
-				 &parsed_len);
+	    status = parse_query(&res->q[i], pool, (const pj_uint8_t*)packet, 
+	    			 start, end, &parsed_len);
 	    if (status != PJ_SUCCESS)
 		return status;
@@ -465,5 +466,6 @@
     /* Parse answer, if any */
     if (res->hdr.anscount) {
-	res->ans = pj_pool_zalloc(pool, res->hdr.anscount * 
+	res->ans = (pj_dns_parsed_rr*)
+		   pj_pool_zalloc(pool, res->hdr.anscount * 
 					sizeof(pj_dns_parsed_rr));
 
@@ -471,6 +473,6 @@
 	    int parsed_len;
 
-	    status = parse_rr(&res->ans[i], pool, packet, start, end, 
-			      &parsed_len);
+	    status = parse_rr(&res->ans[i], pool, (const pj_uint8_t*)packet, 
+	    		      start, end, &parsed_len);
 	    if (status != PJ_SUCCESS)
 		return status;
@@ -482,5 +484,6 @@
     /* Parse authoritative NS records, if any */
     if (res->hdr.nscount) {
-	res->ns = pj_pool_zalloc(pool, res->hdr.nscount *
+	res->ns = (pj_dns_parsed_rr*)
+		  pj_pool_zalloc(pool, res->hdr.nscount *
 				       sizeof(pj_dns_parsed_rr));
 
@@ -488,6 +491,6 @@
 	    int parsed_len;
 
-	    status = parse_rr(&res->ns[i], pool, packet, start, end, 
-			      &parsed_len);
+	    status = parse_rr(&res->ns[i], pool, (const pj_uint8_t*)packet, 
+	    		      start, end, &parsed_len);
 	    if (status != PJ_SUCCESS)
 		return status;
@@ -499,5 +502,6 @@
     /* Parse additional RR answer, if any */
     if (res->hdr.arcount) {
-	res->arr = pj_pool_zalloc(pool, res->hdr.arcount *
+	res->arr = (pj_dns_parsed_rr*)
+		   pj_pool_zalloc(pool, res->hdr.arcount *
 					sizeof(pj_dns_parsed_rr));
 
@@ -505,6 +509,6 @@
 	    int parsed_len;
 
-	    status = parse_rr(&res->arr[i], pool, packet, start, end, 
-			      &parsed_len);
+	    status = parse_rr(&res->arr[i], pool, (const pj_uint8_t*)packet, 
+	    		      start, end, &parsed_len);
 	    if (status != PJ_SUCCESS)
 		return status;
@@ -614,5 +618,5 @@
 
     /* Create packet and copy header */
-    *p_dst = dst = pj_pool_zalloc(pool, sizeof(pj_dns_parsed_packet));
+    *p_dst = dst = PJ_POOL_ZALLOC_T(pool, pj_dns_parsed_packet);
     pj_memcpy(&dst->hdr, &p->hdr, sizeof(p->hdr));
 
@@ -629,5 +633,6 @@
     /* Copy query section */
     if (p->hdr.qdcount && (options & PJ_DNS_NO_QD)==0) {
-	dst->q = pj_pool_alloc(pool, p->hdr.qdcount * 
+	dst->q = (pj_dns_parsed_query*)
+		 pj_pool_alloc(pool, p->hdr.qdcount * 
 				     sizeof(pj_dns_parsed_query));
 	for (i=0; i<p->hdr.qdcount; ++i) {
@@ -640,5 +645,6 @@
     /* Copy answer section */
     if (p->hdr.anscount && (options & PJ_DNS_NO_ANS)==0) {
-	dst->ans = pj_pool_alloc(pool, p->hdr.anscount * 
+	dst->ans = (pj_dns_parsed_rr*)
+		   pj_pool_alloc(pool, p->hdr.anscount * 
 				       sizeof(pj_dns_parsed_rr));
 	for (i=0; i<p->hdr.anscount; ++i) {
@@ -651,5 +657,6 @@
     /* Copy NS section */
     if (p->hdr.nscount && (options & PJ_DNS_NO_NS)==0) {
-	dst->ns = pj_pool_alloc(pool, p->hdr.nscount * 
+	dst->ns = (pj_dns_parsed_rr*)
+		  pj_pool_alloc(pool, p->hdr.nscount * 
 				      sizeof(pj_dns_parsed_rr));
 	for (i=0; i<p->hdr.nscount; ++i) {
@@ -662,5 +669,6 @@
     /* Copy additional info section */
     if (p->hdr.arcount && (options & PJ_DNS_NO_AR)==0) {
-	dst->arr = pj_pool_alloc(pool, p->hdr.arcount * 
+	dst->arr = (pj_dns_parsed_rr*)
+		   pj_pool_alloc(pool, p->hdr.arcount * 
 				       sizeof(pj_dns_parsed_rr));
 	for (i=0; i<p->hdr.arcount; ++i) {
