Index: pjproject/trunk/pjsip/src/pjsip/sip_dialog.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_dialog.c	(revision 1227)
+++ pjproject/trunk/pjsip/src/pjsip/sip_dialog.c	(revision 1240)
@@ -70,5 +70,5 @@
 	return PJ_ENOMEM;
 
-    dlg = pj_pool_zalloc(pool, sizeof(pjsip_dialog));
+    dlg = PJ_POOL_ZALLOC_T(pool, pjsip_dialog);
     PJ_ASSERT_RETURN(dlg != NULL, PJ_ENOMEM);
 
@@ -155,5 +155,6 @@
 	    param->value.ptr[param->value.slen] = '\0';
 
-	    hdr = pjsip_parse_hdr(dlg->pool, &param->name, param->value.ptr,
+	    hdr = (pjsip_hdr*)
+	    	  pjsip_parse_hdr(dlg->pool, &param->name, param->value.ptr,
 				  param->value.slen, NULL);
 
@@ -223,5 +224,6 @@
 	PJSIP_URI_SCHEME_IS_SIPS(dlg->remote.info->uri))
     {
-	pjsip_sip_uri *sip_uri = pjsip_uri_get_uri(dlg->remote.info->uri);
+	pjsip_sip_uri *sip_uri = (pjsip_sip_uri *) 
+				 pjsip_uri_get_uri(dlg->remote.info->uri);
 	if (!pj_list_empty(&sip_uri->header_param)) {
 	    pj_str_t tmp;
@@ -231,5 +233,6 @@
 
 	    /* Print URI */
-	    tmp.ptr = pj_pool_alloc(dlg->pool, dlg->remote.info_str.slen);
+	    tmp.ptr = (char*) pj_pool_alloc(dlg->pool, 
+	    				    dlg->remote.info_str.slen);
 	    tmp.slen = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR,
 				       sip_uri, tmp.ptr, 
@@ -331,8 +334,9 @@
      * both local and remote URI.
      */
-    tmp.ptr = pj_pool_alloc(rdata->tp_info.pool, TMP_LEN);
+    tmp.ptr = (char*) pj_pool_alloc(rdata->tp_info.pool, TMP_LEN);
 
     /* Init local info from the To header. */
-    dlg->local.info = pjsip_hdr_clone(dlg->pool, rdata->msg_info.to);
+    dlg->local.info = (pjsip_fromto_hdr*)
+    		      pjsip_hdr_clone(dlg->pool, rdata->msg_info.to);
     pjsip_fromto_hdr_set_from(dlg->local.info);
 
@@ -389,5 +393,6 @@
 
     /* Init remote info from the From header. */
-    dlg->remote.info = pjsip_hdr_clone(dlg->pool, rdata->msg_info.from);
+    dlg->remote.info = (pjsip_fromto_hdr*) 
+    		       pjsip_hdr_clone(dlg->pool, rdata->msg_info.from);
     pjsip_fromto_hdr_set_to(dlg->remote.info);
 
@@ -406,5 +411,6 @@
 
     /* Init remote's contact from Contact header. */
-    contact_hdr = pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, 
+    contact_hdr = (pjsip_hdr*)
+    		  pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, 
 				     NULL);
     if (!contact_hdr) {
@@ -412,5 +418,6 @@
 	goto on_error;
     }
-    dlg->remote.contact = pjsip_hdr_clone(dlg->pool, contact_hdr);
+    dlg->remote.contact = (pjsip_contact_hdr*) 
+    			  pjsip_hdr_clone(dlg->pool, contact_hdr);
 
     /* Init remote's CSeq from CSeq header */
@@ -432,5 +439,6 @@
 
     /* Call-ID */
-    dlg->call_id = pjsip_hdr_clone(dlg->pool, rdata->msg_info.cid);
+    dlg->call_id = (pjsip_cid_hdr*) 
+    		   pjsip_hdr_clone(dlg->pool, rdata->msg_info.cid);
 
     /* Route set. 
@@ -447,5 +455,5 @@
 
 	/* Clone the Record-Route, change the type to Route header. */
-	route = pjsip_hdr_clone(dlg->pool, rr);
+	route = (pjsip_route_hdr*) pjsip_hdr_clone(dlg->pool, rr);
 	pjsip_routing_hdr_set_route(route);
 
@@ -457,5 +465,6 @@
 	if (rr == (void*)&rdata->msg_info.msg->hdr)
 	    break;
-	rr = pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_RECORD_ROUTE, rr);
+	rr = (pjsip_route_hdr*) pjsip_msg_find_hdr(rdata->msg_info.msg, 
+						   PJSIP_H_RECORD_ROUTE, rr);
     }
 
@@ -570,8 +579,9 @@
 
     /* Clone remote target. */
-    dlg->target = pjsip_uri_clone(dlg->pool, first_dlg->target);
+    dlg->target = (pjsip_uri*) pjsip_uri_clone(dlg->pool, first_dlg->target);
 
     /* Clone local info. */
-    dlg->local.info = pjsip_hdr_clone(dlg->pool, first_dlg->local.info);
+    dlg->local.info = (pjsip_fromto_hdr*) 
+    		      pjsip_hdr_clone(dlg->pool, first_dlg->local.info);
 
     /* Clone local tag. */
@@ -584,8 +594,10 @@
 
     /* Clone local Contact. */
-    dlg->local.contact = pjsip_hdr_clone(dlg->pool, first_dlg->local.contact);
+    dlg->local.contact = (pjsip_contact_hdr*) 
+    			 pjsip_hdr_clone(dlg->pool, first_dlg->local.contact);
 
     /* Clone remote info. */
-    dlg->remote.info = pjsip_hdr_clone(dlg->pool, first_dlg->remote.info);
+    dlg->remote.info = (pjsip_fromto_hdr*) 
+    		       pjsip_hdr_clone(dlg->pool, first_dlg->remote.info);
 
     /* Set remote tag from the response. */
@@ -611,5 +623,6 @@
 
     /* Clone Call-ID header. */
-    dlg->call_id = pjsip_hdr_clone(dlg->pool, first_dlg->call_id);
+    dlg->call_id = (pjsip_cid_hdr*) 
+    		   pjsip_hdr_clone(dlg->pool, first_dlg->call_id);
 
     /* Duplicate Route-Set. */
@@ -619,5 +632,5 @@
 	pjsip_route_hdr *h;
 
-	h = pjsip_hdr_clone(dlg->pool, r);
+	h = (pjsip_route_hdr*) pjsip_hdr_clone(dlg->pool, r);
 	pj_list_push_back(&dlg->route_set, h);
 
@@ -721,5 +734,5 @@
 	pjsip_route_hdr *new_r;
 
-	new_r = pjsip_hdr_clone(dlg->pool, r);
+	new_r = (pjsip_route_hdr*) pjsip_hdr_clone(dlg->pool, r);
 	pj_list_push_back(&dlg->route_set, new_r);
 
@@ -980,5 +993,5 @@
     for (; route != end_list; route = route->next ) {
 	pjsip_route_hdr *r;
-	r = pjsip_hdr_shallow_clone( tdata->pool, route );
+	r = (pjsip_route_hdr*) pjsip_hdr_shallow_clone( tdata->pool, route );
 	pjsip_routing_hdr_set_route(r);
 	pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)r);
@@ -1177,5 +1190,6 @@
 		pjsip_msg_find_hdr_by_name(tdata->msg, &hcontact, NULL) == 0) 
 	    {
-		hdr = pjsip_hdr_clone(tdata->pool, dlg->local.contact);
+		hdr = (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, 
+						   dlg->local.contact);
 		pjsip_msg_add_hdr(tdata->msg, hdr);
 	    }
@@ -1189,5 +1203,5 @@
 					       PJSIP_H_ALLOW, NULL);
 	    if (c_hdr) {
-		hdr = pjsip_hdr_clone(tdata->pool, c_hdr);
+		hdr = (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, c_hdr);
 		pjsip_msg_add_hdr(tdata->msg, hdr);
 	    }
@@ -1201,5 +1215,5 @@
 					       PJSIP_H_SUPPORTED, NULL);
 	    if (c_hdr) {
-		hdr = pjsip_hdr_clone(tdata->pool, c_hdr);
+		hdr = (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, c_hdr);
 		pjsip_msg_add_hdr(tdata->msg, hdr);
 	    }
@@ -1286,5 +1300,5 @@
      * 180 and then 302, the Contact in 302 will not get updated).
      */
-    hdr = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CONTACT, NULL);
+    hdr = (pjsip_hdr*) pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CONTACT, NULL);
     if (hdr)
 	pj_list_erase(hdr);
@@ -1399,5 +1413,5 @@
 	while (hdr != hdr_list) {
 	    pjsip_msg_add_hdr(tdata->msg,
-			      pjsip_hdr_clone(tdata->pool, hdr));
+			      (pjsip_hdr*)pjsip_hdr_clone(tdata->pool, hdr));
 	    hdr = hdr->next;
 	}
@@ -1527,5 +1541,5 @@
 	if (hdr->type == PJSIP_H_RECORD_ROUTE) {
 	    pjsip_route_hdr *r;
-	    r = pjsip_hdr_clone(dlg->pool, hdr);
+	    r = (pjsip_route_hdr*) pjsip_hdr_clone(dlg->pool, hdr);
 	    pjsip_routing_hdr_set_route(r);
 	    pj_list_push_back(&dlg->route_set, r);
@@ -1599,8 +1613,10 @@
 	 * field of the response.
 	 */
-	contact = pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, 
+	contact = (pjsip_contact_hdr*)
+		  pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, 
 				     NULL);
 	if (contact) {
-	    dlg->remote.contact = pjsip_hdr_clone(dlg->pool, contact);
+	    dlg->remote.contact = (pjsip_contact_hdr*) 
+	    			  pjsip_hdr_clone(dlg->pool, contact);
 	    dlg->target = dlg->remote.contact->uri;
 	}
@@ -1643,8 +1659,10 @@
 	pjsip_contact_hdr *contact;
 
-	contact = pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, 
-				     NULL);
+	contact = (pjsip_contact_hdr*) pjsip_msg_find_hdr(rdata->msg_info.msg,
+							  PJSIP_H_CONTACT, 
+				     			  NULL);
 	if (contact) {
-	    dlg->remote.contact = pjsip_hdr_clone(dlg->pool, contact);
+	    dlg->remote.contact = (pjsip_contact_hdr*) 
+	    			  pjsip_hdr_clone(dlg->pool, contact);
 	    dlg->target = dlg->remote.contact->uri;
 	}
