Index: pjproject/trunk/build.symbian/pjsip_simple.mmp
===================================================================
--- pjproject/trunk/build.symbian/pjsip_simple.mmp	(revision 1240)
+++ pjproject/trunk/build.symbian/pjsip_simple.mmp	(revision 1241)
@@ -10,5 +10,5 @@
 MACRO		PJ_IMPORTING
 
-//OPTION		CW -lang c++
+OPTION		CW -lang c++
 
 
Index: pjproject/trunk/pjsip/src/pjsip-simple/evsub.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip-simple/evsub.c	(revision 1240)
+++ pjproject/trunk/pjsip/src/pjsip-simple/evsub.c	(revision 1241)
@@ -52,5 +52,5 @@
 const pjsip_method pjsip_subscribe_method = 
 {
-    PJSIP_SUBSCRIBE_METHOD,
+    (pjsip_method_e) PJSIP_SUBSCRIBE_METHOD,
     { "SUBSCRIBE", 9 }
 };
@@ -58,5 +58,5 @@
 const pjsip_method pjsip_notify_method = 
 {
-    PJSIP_NOTIFY_METHOD,
+    (pjsip_method_e) PJSIP_NOTIFY_METHOD,
     { "NOTIFY", 6 }
 };
@@ -328,5 +328,5 @@
 PJ_DEF(pjsip_evsub*) pjsip_tsx_get_evsub(pjsip_transaction *tsx)
 {
-    return tsx->mod_data[mod_evsub.mod.id];
+    return (pjsip_evsub*) tsx->mod_data[mod_evsub.mod.id];
 }
 
@@ -396,5 +396,5 @@
     /* Create new event package: */
 
-    pkg = pj_pool_alloc(mod_evsub.pool, sizeof(struct evpkg));
+    pkg = PJ_POOL_ALLOC_T(mod_evsub.pool, struct evpkg);
     pkg->pkg_mod = pkg_mod;
     pkg->pkg_expires = expires;
@@ -509,6 +509,6 @@
     set_timer(sub, TIMER_TYPE_NONE, 0);
 
-    /* Remote this session from dialog's list of subscription */
-    dlgsub_head = sub->dlg->mod_data[mod_evsub.mod.id];
+    /* Remove this session from dialog's list of subscription */
+    dlgsub_head = (struct dlgsub *) sub->dlg->mod_data[mod_evsub.mod.id];
     dlgsub = dlgsub_head->next;
     while (dlgsub != dlgsub_head) {
@@ -573,5 +573,5 @@
     PJ_UNUSED_ARG(timer_heap);
 
-    sub = entry->user_data;
+    sub = (pjsip_evsub*) entry->user_data;
 
     pjsip_dlg_inc_lock(sub->dlg);
@@ -674,5 +674,5 @@
     /* Init attributes: */
 
-    sub = pj_pool_zalloc(dlg->pool, sizeof(struct pjsip_evsub));
+    sub = PJ_POOL_ZALLOC_T(dlg->pool, struct pjsip_evsub);
     sub->pool = dlg->pool;
     sub->endpt = dlg->endpt;
@@ -685,5 +685,6 @@
     sub->state_str = evsub_state_names[sub->state];
     sub->expires = pjsip_expires_hdr_create(sub->pool, pkg->pkg_expires);
-    sub->accept = pjsip_hdr_clone(sub->pool, pkg->pkg_accept);
+    sub->accept = (pjsip_accept_hdr*) 
+    		  pjsip_hdr_clone(sub->pool, pkg->pkg_accept);
 
     sub->timer.user_data = sub;
@@ -707,6 +708,6 @@
     /* Create subcription list: */
 
-    dlgsub_head = pj_pool_alloc(sub->pool, sizeof(struct dlgsub));
-    dlgsub = pj_pool_alloc(sub->pool, sizeof(struct dlgsub));
+    dlgsub_head = PJ_POOL_ALLOC_T(sub->pool, struct dlgsub);
+    dlgsub = PJ_POOL_ALLOC_T(sub->pool, struct dlgsub);
     dlgsub->sub = sub;
 
@@ -829,5 +830,5 @@
 
     /* Just duplicate Event header from the request */
-    sub->event = pjsip_hdr_clone(sub->pool, event_hdr);
+    sub->event = (pjsip_event_hdr*) pjsip_hdr_clone(sub->pool, event_hdr);
 
     /* Set the method: */
@@ -851,5 +852,5 @@
 	pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_ACCEPT, NULL);
     if (accept_hdr)
-	sub->accept = pjsip_hdr_clone(sub->pool, accept_hdr);
+	sub->accept = (pjsip_accept_hdr*)pjsip_hdr_clone(sub->pool,accept_hdr);
 
     /* We can start the session: */
@@ -942,5 +943,5 @@
 
     /* Add Event header: */
-    pjsip_msg_add_hdr( tdata->msg,
+    pjsip_msg_add_hdr( tdata->msg, (pjsip_hdr*)
 		       pjsip_hdr_shallow_clone(tdata->pool, sub->event));
 
@@ -948,14 +949,14 @@
     if (expires >= 0)
 	sub->expires->ivalue = expires;
-    pjsip_msg_add_hdr( tdata->msg,
+    pjsip_msg_add_hdr( tdata->msg, (pjsip_hdr*)
 		       pjsip_hdr_shallow_clone(tdata->pool, sub->expires));
 
     /* Add Accept header: */
-    pjsip_msg_add_hdr( tdata->msg,
+    pjsip_msg_add_hdr( tdata->msg, (pjsip_hdr*)
 		       pjsip_hdr_shallow_clone(tdata->pool, sub->accept));
     
 
     /* Add Allow-Events header: */
-    pjsip_msg_add_hdr( tdata->msg,
+    pjsip_msg_add_hdr( tdata->msg, (pjsip_hdr*)
 		       pjsip_hdr_shallow_clone(tdata->pool, 
 					       mod_evsub.allow_events_hdr));
@@ -1012,5 +1013,5 @@
 
     /* Add expires header: */
-    pjsip_msg_add_hdr( tdata->msg,
+    pjsip_msg_add_hdr( tdata->msg, (pjsip_hdr*)
 		       pjsip_hdr_shallow_clone(tdata->pool, sub->expires));
 
@@ -1019,5 +1020,5 @@
 	const pjsip_hdr *hdr = hdr_list->next;
 	while (hdr != hdr_list) {
-	    pjsip_msg_add_hdr( tdata->msg,
+	    pjsip_msg_add_hdr( tdata->msg, (pjsip_hdr*)
 			       pjsip_hdr_clone(tdata->pool, hdr));
 	    hdr = hdr->next;
@@ -1118,5 +1119,5 @@
 
     /* Add Event header */
-    pjsip_msg_add_hdr(tdata->msg,
+    pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)
 		      pjsip_hdr_shallow_clone(tdata->pool, sub->event));
 
@@ -1127,5 +1128,5 @@
 
     /* Add Allow-Events header */
-    pjsip_msg_add_hdr(tdata->msg,
+    pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)
 		      pjsip_hdr_shallow_clone(tdata->pool, mod_evsub.allow_events_hdr));
 
@@ -1259,5 +1260,6 @@
     }
 
-    event_hdr = pjsip_msg_find_hdr_by_name(msg, &STR_EVENT, NULL);
+    event_hdr = (pjsip_event_hdr*)
+    		pjsip_msg_find_hdr_by_name(msg, &STR_EVENT, NULL);
     if (!event_hdr) {
 	/* Not subscription related message */
@@ -1269,7 +1271,7 @@
      */
 
-    dlgsub_head = dlg->mod_data[mod_evsub.mod.id];
+    dlgsub_head = (struct dlgsub*) dlg->mod_data[mod_evsub.mod.id];
     if (dlgsub_head == NULL) {
-	dlgsub_head = pj_pool_alloc(dlg->pool, sizeof(struct dlgsub));
+	dlgsub_head = PJ_POOL_ALLOC_T(dlg->pool, struct dlgsub);
 	pj_list_init(dlgsub_head);
 	dlg->mod_data[mod_evsub.mod.id] = dlgsub_head;
@@ -1417,5 +1419,5 @@
     hdr = res_hdr->next;
     while (hdr != res_hdr) {
-	pjsip_msg_add_hdr( tdata->msg, 
+	pjsip_msg_add_hdr( tdata->msg, (pjsip_hdr*)
 			   pjsip_hdr_clone(tdata->pool, hdr));
 	hdr = hdr->next;
@@ -1550,5 +1552,6 @@
 
 		msg = event->body.tsx_state.src.rdata->msg_info.msg;
-		expires = pjsip_msg_find_hdr(msg, PJSIP_H_EXPIRES, NULL);
+		expires = (pjsip_expires_hdr*)
+			  pjsip_msg_find_hdr(msg, PJSIP_H_EXPIRES, NULL);
 		if (expires) {
 		    sub->expires->ivalue = expires->ivalue;
@@ -1656,5 +1659,6 @@
 
 	/* Get subscription state header. */
-	sub_state = pjsip_msg_find_hdr_by_name(msg, &STR_SUB_STATE, NULL);
+	sub_state = (pjsip_sub_state_hdr*)
+		    pjsip_msg_find_hdr_by_name(msg, &STR_SUB_STATE, NULL);
 	if (sub_state == NULL) {
 
@@ -1804,6 +1808,8 @@
 	 * or package default expiration time.
 	 */
-	event_hdr = pjsip_msg_find_hdr_by_name(msg, &STR_EVENT, NULL);
-	expires = pjsip_msg_find_hdr(msg, PJSIP_H_EXPIRES, NULL);
+	event_hdr = (pjsip_event_hdr*)
+		    pjsip_msg_find_hdr_by_name(msg, &STR_EVENT, NULL);
+	expires = (pjsip_expires_hdr*)
+		  pjsip_msg_find_hdr(msg, PJSIP_H_EXPIRES, NULL);
 	if (event_hdr && expires) {
 	    struct evpkg *evpkg;
@@ -1860,5 +1866,5 @@
 	if (status == PJ_SUCCESS) {
 	    /* Add expires header: */
-	    pjsip_msg_add_hdr( tdata->msg,
+	    pjsip_msg_add_hdr( tdata->msg, (pjsip_hdr*)
 			       pjsip_hdr_shallow_clone(tdata->pool, 
 						       sub->expires));
Index: pjproject/trunk/pjsip/src/pjsip-simple/evsub_msg.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip-simple/evsub_msg.c	(revision 1240)
+++ pjproject/trunk/pjsip/src/pjsip-simple/evsub_msg.c	(revision 1241)
@@ -44,5 +44,5 @@
 PJ_DEF(pjsip_event_hdr*) pjsip_event_hdr_create(pj_pool_t *pool)
 {
-    pjsip_event_hdr *hdr = pj_pool_zalloc(pool, sizeof(*hdr));
+    pjsip_event_hdr *hdr = PJ_POOL_ZALLOC_T(pool, pjsip_event_hdr);
     hdr->type = PJSIP_H_OTHER;
     hdr->name.ptr = "Event";
@@ -94,5 +94,5 @@
 			       const pjsip_event_hdr *rhs )
 {
-    pjsip_event_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr));
+    pjsip_event_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_event_hdr);
     pj_memcpy(hdr, rhs, sizeof(*hdr));
     pjsip_param_shallow_clone(pool, &hdr->other_param, &rhs->other_param);
@@ -143,5 +143,5 @@
 {
     pj_str_t sub_state = { "Subscription-State", 18 };
-    pjsip_sub_state_hdr *hdr = pj_pool_zalloc(pool, sizeof(*hdr));
+    pjsip_sub_state_hdr *hdr = PJ_POOL_ZALLOC_T(pool, pjsip_sub_state_hdr);
     hdr->type = PJSIP_H_OTHER;
     hdr->name = hdr->sname = sub_state;
@@ -209,5 +209,5 @@
 				  const pjsip_sub_state_hdr *rhs)
 {
-    pjsip_sub_state_hdr *hdr = pj_pool_alloc(pool, sizeof(*hdr));
+    pjsip_sub_state_hdr *hdr = PJ_POOL_ALLOC_T(pool, pjsip_sub_state_hdr);
     pj_memcpy(hdr, rhs, sizeof(*hdr));
     pjsip_param_shallow_clone(pool, &hdr->other_param, &rhs->other_param);
@@ -235,5 +235,5 @@
 	    hdr->id_param = pvalue;
 	} else {
-	    pjsip_param *param = pj_pool_alloc(ctx->pool, sizeof(pjsip_param));
+	    pjsip_param *param = PJ_POOL_ALLOC_T(ctx->pool, pjsip_param);
 	    param->name = pname;
 	    param->value = pvalue;
@@ -272,5 +272,5 @@
 
 	} else {
-	    pjsip_param *param = pj_pool_alloc(ctx->pool, sizeof(pjsip_param));
+	    pjsip_param *param = PJ_POOL_ALLOC_T(ctx->pool, pjsip_param);
 	    param->name = pname;
 	    param->value = pvalue;
Index: pjproject/trunk/pjsip/src/pjsip-simple/iscomposing.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip-simple/iscomposing.c	(revision 1240)
+++ pjproject/trunk/pjsip/src/pjsip-simple/iscomposing.c	(revision 1241)
@@ -96,5 +96,5 @@
     if (is_composing && refresh > 1 && refresh < 3601) {
 	node = pj_xml_node_new(pool, &STR_REFRESH);
-	node->content.ptr = pj_pool_alloc(pool, 10);
+	node->content.ptr = (char*) pj_pool_alloc(pool, 10);
 	node->content.slen = pj_utoa(refresh, node->content.ptr);
 	pj_xml_add_node(doc, node);
@@ -114,5 +114,6 @@
 			   char *buf, pj_size_t size)
 {
-    return pj_xml_print(msg_body->data, buf, size, PJ_TRUE);
+    return pj_xml_print((const pj_xml_node*)msg_body->data, buf, size, 
+    			PJ_TRUE);
 }
 
@@ -124,5 +125,5 @@
 {
     PJ_UNUSED_ARG(len);
-    return pj_xml_clone( pool, data);
+    return pj_xml_clone( pool, (const pj_xml_node*)data);
 }
 
@@ -144,5 +145,5 @@
 
 
-    body = pj_pool_zalloc(pool, sizeof(pjsip_msg_body));
+    body = PJ_POOL_ZALLOC_T(pool, pjsip_msg_body);
     body->content_type.type = STR_MIME_TYPE;
     body->content_type.subtype = STR_MIME_SUBTYPE;
Index: pjproject/trunk/pjsip/src/pjsip-simple/pidf.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip-simple/pidf.c	(revision 1240)
+++ pjproject/trunk/pjsip/src/pjsip-simple/pidf.c	(revision 1241)
@@ -89,5 +89,5 @@
 				    const pj_str_t *value)
 {
-    pj_xml_attr *attr = pj_pool_alloc(pool, sizeof(*attr));
+    pj_xml_attr *attr = PJ_POOL_ALLOC_T(pool, pj_xml_attr);
     attr->name = *name;
     pj_strdup(pool, &attr->value, value);
@@ -111,5 +111,5 @@
 					    const pj_str_t *id)
 {
-    pjpidf_tuple *t = pj_pool_alloc(pool, sizeof(*t));
+    pjpidf_tuple *t = PJ_POOL_ALLOC_T(pool, pjpidf_tuple);
     pjpidf_tuple_construct(pool, t, id);
     pj_xml_add_node(pres, t);
@@ -130,5 +130,5 @@
 static pj_bool_t find_tuple_by_id(pj_xml_node *node, const void *id)
 {
-    return pj_xml_find_attr(node, &ID, id) != NULL;
+    return pj_xml_find_attr(node, &ID, (const pj_str_t*)id) != NULL;
 }
 
@@ -147,5 +147,5 @@
 					  const pj_str_t *text)
 {
-    pjpidf_note *note = pj_pool_alloc(pool, sizeof(*note));
+    pjpidf_note *note = PJ_POOL_ALLOC_T(pool, pjpidf_note);
     xml_init_node(pool, note, &NOTE, text);
     pj_xml_add_node(pres, note);
@@ -174,5 +174,5 @@
     attr = xml_create_attr(pool, &ID, id);
     pj_xml_add_attr(t, attr);
-    st = pj_pool_alloc(pool, sizeof(*st));
+    st = PJ_POOL_ALLOC_T(pool, pjpidf_status);
     pjpidf_status_construct(pool, st);
     pj_xml_add_node(t, st);
@@ -215,5 +215,5 @@
     pj_xml_node *node = pj_xml_find_node(t, &CONTACT);
     if (!node) {
-	node = pj_pool_alloc(pool, sizeof(*node));
+	node = PJ_POOL_ALLOC_T(pool, pj_xml_node);
 	xml_init_node(pool, node, &CONTACT, contact);
 	pj_xml_add_node(t, node);
@@ -230,5 +230,5 @@
 
     if (!node) {
-	node = pj_pool_alloc(pool, sizeof(*node));
+	node = PJ_POOL_ALLOC_T(pool, pj_xml_node);
 	xml_init_node(pool, node, &CONTACT, NULL);
 	pj_xml_add_node(t, node);
@@ -260,5 +260,5 @@
 					   const pj_str_t *text)
 {
-    pjpidf_note *note = pj_pool_alloc(pool, sizeof(*note));
+    pjpidf_note *note = PJ_POOL_ALLOC_T(pool, pjpidf_note);
     xml_init_node(pool, note, &NOTE, text);
     pj_xml_add_node(t, note);
@@ -288,5 +288,5 @@
     pj_xml_node *node = pj_xml_find_node(t, &TIMESTAMP);
     if (!node) {
-	node = pj_pool_alloc(pool, sizeof(*node));
+	node = PJ_POOL_ALLOC_T(pool, pj_xml_node);
 	xml_init_node(pool, node, &TIMESTAMP, ts);
     } else {
@@ -301,5 +301,5 @@
     pj_xml_node *node = pj_xml_find_node(t, &TIMESTAMP);
     if (!node) {
-	node = pj_pool_alloc(pool, sizeof(*node));
+	node = PJ_POOL_ALLOC_T(pool, pj_xml_node);
 	xml_init_node(pool, node, &TIMESTAMP, ts);
     } else {
@@ -315,5 +315,5 @@
 
     xml_init_node(pool, st, &STATUS, NULL);
-    node = pj_pool_alloc(pool, sizeof(*node));
+    node = PJ_POOL_ALLOC_T(pool, pj_xml_node);
     xml_init_node(pool, node, &BASIC, &CLOSED);
     pj_xml_add_node(st, node);
@@ -336,5 +336,5 @@
 PJ_DEF(pjpidf_pres*) pjpidf_create(pj_pool_t *pool, const pj_str_t *entity)
 {
-    pjpidf_pres *pres = pj_pool_alloc(pool, sizeof(*pres));
+    pjpidf_pres *pres = PJ_POOL_ALLOC_T(pool, pjpidf_pres);
     pjpidf_pres_construct(pool, pres, entity);
     return pres;
Index: pjproject/trunk/pjsip/src/pjsip-simple/presence.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip-simple/presence.c	(revision 1240)
+++ pjproject/trunk/pjsip/src/pjsip-simple/presence.c	(revision 1241)
@@ -198,5 +198,5 @@
 
     /* Create presence */
-    pres = pj_pool_zalloc(dlg->pool, sizeof(pjsip_pres));
+    pres = PJ_POOL_ZALLOC_T(dlg->pool, pjsip_pres);
     pres->dlg = dlg;
     pres->sub = sub;
@@ -245,5 +245,6 @@
 
     /* Check that Event header contains "presence" */
-    event = pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &STR_EVENT, NULL);
+    event = (pjsip_event_hdr*)
+    	    pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &STR_EVENT, NULL);
     if (!event) {
 	return PJSIP_ERRNO_FROM_SIP_STATUS(PJSIP_SC_BAD_REQUEST);
@@ -254,5 +255,6 @@
 
     /* Check that request contains compatible Accept header. */
-    accept = pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_ACCEPT, NULL);
+    accept = (pjsip_accept_hdr*)
+    	     pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_ACCEPT, NULL);
     if (accept) {
 	unsigned i;
@@ -281,5 +283,6 @@
 
     /* Check that expires is not too short. */
-    expires_hdr=pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_EXPIRES, NULL);
+    expires_hdr=(pjsip_expires_hdr*)
+    		pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_EXPIRES, NULL);
     if (expires_hdr) {
 	if (expires_hdr->ivalue < 5) {
@@ -305,5 +308,5 @@
 
     /* Create server presence subscription */
-    pres = pj_pool_zalloc(dlg->pool, sizeof(pjsip_pres));
+    pres = PJ_POOL_ZALLOC_T(dlg->pool, pjsip_pres);
     pres->dlg = dlg;
     pres->sub = sub;
@@ -367,5 +370,5 @@
     PJ_ASSERT_RETURN(sub && status, PJ_EINVAL);
 
-    pres = pjsip_evsub_get_mod_data(sub, mod_presence.id);
+    pres = (pjsip_pres*) pjsip_evsub_get_mod_data(sub, mod_presence.id);
     PJ_ASSERT_RETURN(pres!=NULL, PJSIP_SIMPLE_ENOPRESENCE);
 
@@ -390,5 +393,5 @@
     PJ_ASSERT_RETURN(sub && status, PJ_EINVAL);
 
-    pres = pjsip_evsub_get_mod_data(sub, mod_presence.id);
+    pres = (pjsip_pres*) pjsip_evsub_get_mod_data(sub, mod_presence.id);
     PJ_ASSERT_RETURN(pres!=NULL, PJSIP_SIMPLE_ENOPRESENCE);
 
@@ -423,5 +426,5 @@
 
     /* Get publisher URI */
-    entity.ptr = pj_pool_alloc(tdata->pool, PJSIP_MAX_URL_SIZE);
+    entity.ptr = (char*) pj_pool_alloc(tdata->pool, PJSIP_MAX_URL_SIZE);
     entity.slen = pjsip_uri_print(PJSIP_URI_IN_REQ_URI,
 				  pres->dlg->local.info->uri,
@@ -463,5 +466,5 @@
 
     /* Get the presence object. */
-    pres = pjsip_evsub_get_mod_data(sub, mod_presence.id);
+    pres = (pjsip_pres*) pjsip_evsub_get_mod_data(sub, mod_presence.id);
     PJ_ASSERT_RETURN(pres != NULL, PJSIP_SIMPLE_ENOPRESENCE);
 
@@ -509,5 +512,5 @@
 
     /* Get the presence object. */
-    pres = pjsip_evsub_get_mod_data(sub, mod_presence.id);
+    pres = (pjsip_pres*) pjsip_evsub_get_mod_data(sub, mod_presence.id);
     PJ_ASSERT_RETURN(pres != NULL, PJSIP_SIMPLE_ENOPRESENCE);
 
@@ -559,5 +562,5 @@
     pjsip_pres *pres;
 
-    pres = pjsip_evsub_get_mod_data(sub, mod_presence.id);
+    pres = (pjsip_pres*) pjsip_evsub_get_mod_data(sub, mod_presence.id);
     PJ_ASSERT_ON_FAIL(pres!=NULL, {return;});
 
@@ -574,5 +577,5 @@
     pjsip_pres *pres;
 
-    pres = pjsip_evsub_get_mod_data(sub, mod_presence.id);
+    pres = (pjsip_pres*) pjsip_evsub_get_mod_data(sub, mod_presence.id);
     PJ_ASSERT_ON_FAIL(pres!=NULL, {return;});
 
@@ -594,5 +597,5 @@
     pjsip_pres *pres;
 
-    pres = pjsip_evsub_get_mod_data(sub, mod_presence.id);
+    pres = (pjsip_pres*) pjsip_evsub_get_mod_data(sub, mod_presence.id);
     PJ_ASSERT_ON_FAIL(pres!=NULL, {return;});
 
@@ -722,5 +725,5 @@
     pj_status_t status;
 
-    pres = pjsip_evsub_get_mod_data(sub, mod_presence.id);
+    pres = (pjsip_pres*) pjsip_evsub_get_mod_data(sub, mod_presence.id);
     PJ_ASSERT_ON_FAIL(pres!=NULL, {return;});
 
@@ -774,5 +777,5 @@
     pjsip_pres *pres;
 
-    pres = pjsip_evsub_get_mod_data(sub, mod_presence.id);
+    pres = (pjsip_pres*) pjsip_evsub_get_mod_data(sub, mod_presence.id);
     PJ_ASSERT_ON_FAIL(pres!=NULL, {return;});
 
@@ -796,5 +799,5 @@
     pjsip_pres *pres;
 
-    pres = pjsip_evsub_get_mod_data(sub, mod_presence.id);
+    pres = (pjsip_pres*) pjsip_evsub_get_mod_data(sub, mod_presence.id);
     PJ_ASSERT_ON_FAIL(pres!=NULL, {return;});
 
Index: pjproject/trunk/pjsip/src/pjsip-simple/presence_body.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip-simple/presence_body.c	(revision 1240)
+++ pjproject/trunk/pjsip/src/pjsip-simple/presence_body.c	(revision 1241)
@@ -43,5 +43,6 @@
 			   char *buf, pj_size_t size)
 {
-    return pj_xml_print(msg_body->data, buf, size, PJ_TRUE);
+    return pj_xml_print((const pj_xml_node*)msg_body->data, buf, size, 
+    			PJ_TRUE);
 }
 
@@ -53,5 +54,5 @@
 {
     PJ_UNUSED_ARG(len);
-    return pj_xml_clone( pool, data);
+    return pj_xml_clone( pool, (const pj_xml_node*) data);
 }
 
@@ -101,5 +102,5 @@
     }
 
-    body = pj_pool_zalloc(pool, sizeof(pjsip_msg_body));
+    body = PJ_POOL_ZALLOC_T(pool, pjsip_msg_body);
     body->data = pidf;
     body->content_type.type = STR_APPLICATION;
@@ -140,5 +141,5 @@
 	pjxpidf_set_status( xpidf, PJ_FALSE);
 
-    body = pj_pool_zalloc(pool, sizeof(pjsip_msg_body));
+    body = PJ_POOL_ZALLOC_T(pool, pjsip_msg_body);
     body->data = xpidf;
     body->content_type.type = STR_APPLICATION;
@@ -165,5 +166,5 @@
 
     pidf = pjpidf_parse(rdata->tp_info.pool, 
-			rdata->msg_info.msg->body->data,
+			(char*)rdata->msg_info.msg->body->data,
 			rdata->msg_info.msg->body->len);
     if (pidf == NULL)
@@ -210,5 +211,5 @@
 
     xpidf = pjxpidf_parse(rdata->tp_info.pool, 
-			  rdata->msg_info.msg->body->data,
+			  (char*)rdata->msg_info.msg->body->data,
 			  rdata->msg_info.msg->body->len);
     if (xpidf == NULL)
Index: pjproject/trunk/pjsip/src/pjsip-simple/publishc.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip-simple/publishc.c	(revision 1240)
+++ pjproject/trunk/pjsip/src/pjsip-simple/publishc.c	(revision 1241)
@@ -51,5 +51,5 @@
 const pjsip_method pjsip_publish_method = 
 {
-    PJSIP_PUBLISH_METHOD,
+    (pjsip_method_e)PJSIP_PUBLISH_METHOD,
     { "PUBLISH", 7 }
 };
@@ -123,5 +123,5 @@
     PJ_ASSERT_RETURN(pool != NULL, PJ_ENOMEM);
 
-    pubc = pj_pool_zalloc(pool, sizeof(struct pjsip_publishc));
+    pubc = PJ_POOL_ZALLOC_T(pool, pjsip_publishc);
 
     pubc->pool = pool;
@@ -292,5 +292,6 @@
 	const pjsip_route_hdr *route;
 
-	route_pos = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL);
+	route_pos = (pjsip_hdr*)
+		    pjsip_msg_find_hdr(tdata->msg, PJSIP_H_VIA, NULL);
 	if (!route_pos)
 	    route_pos = &tdata->msg->hdr;
@@ -298,5 +299,6 @@
 	route = pubc->route_set.next;
 	while (route != &pubc->route_set) {
-	    pjsip_hdr *new_hdr = pjsip_hdr_shallow_clone(tdata->pool, route);
+	    pjsip_hdr *new_hdr = (pjsip_hdr*)
+	    			 pjsip_hdr_shallow_clone(tdata->pool, route);
 	    pj_list_insert_after(route_pos, new_hdr);
 	    route_pos = new_hdr;
@@ -346,5 +348,6 @@
 	pjsip_hdr *dup;
 
-	dup = pjsip_hdr_shallow_clone(tdata->pool, pubc->expires_hdr);
+	dup = (pjsip_hdr*)
+	      pjsip_hdr_shallow_clone(tdata->pool, pubc->expires_hdr);
 	if (dup)
 	    pjsip_msg_add_hdr(tdata->msg, dup);
@@ -425,5 +428,5 @@
 				   struct pj_timer_entry *entry)
 {
-    pjsip_publishc *pubc = entry->user_data;
+    pjsip_publishc *pubc = (pjsip_publishc*) entry->user_data;
     pjsip_tx_data *tdata;
     pj_status_t status;
@@ -447,5 +450,5 @@
 {
     pj_status_t status;
-    pjsip_publishc *pubc = token;
+    pjsip_publishc *pubc = (pjsip_publishc*) token;
     pjsip_transaction *tsx = event->body.tsx_state.tsx;
     
@@ -508,5 +511,6 @@
 
 	    /* Update expires value */
-	    expires = pjsip_msg_find_hdr(msg, PJSIP_H_EXPIRES, NULL);
+	    expires = (pjsip_expires_hdr*)
+	    	      pjsip_msg_find_hdr(msg, PJSIP_H_EXPIRES, NULL);
 
 	    if (expires)
@@ -575,5 +579,6 @@
     /* Increment CSeq */
     cseq = ++pubc->cseq_hdr->cseq;
-    cseq_hdr = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CSEQ, NULL);
+    cseq_hdr = (pjsip_cseq_hdr*)
+    	       pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CSEQ, NULL);
     cseq_hdr->cseq = cseq;
 
Index: pjproject/trunk/pjsip/src/pjsip-simple/xpidf.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip-simple/xpidf.c	(revision 1240)
+++ pjproject/trunk/pjsip/src/pjsip-simple/xpidf.c	(revision 1241)
@@ -41,5 +41,5 @@
     pj_xml_node *node;
 
-    node = pj_pool_alloc(pool, sizeof(pj_xml_node));
+    node = PJ_POOL_ALLOC_T(pool, pj_xml_node);
     pj_list_init(&node->attr_head);
     pj_list_init(&node->node_head);
@@ -54,5 +54,5 @@
 				    const pj_str_t *value)
 {
-    pj_xml_attr *attr = pj_pool_alloc(pool, sizeof(*attr));
+    pj_xml_attr *attr = PJ_POOL_ALLOC_T(pool, pj_xml_attr);
     attr->name = *name;
     pj_strdup(pool, &attr->value, value);
@@ -80,5 +80,6 @@
 
     /* uri attribute */
-    uri.ptr = pj_pool_alloc(pool, uri_cstr->slen + STR_SUBSCRIBE_PARAM.slen);
+    uri.ptr = (char*) pj_pool_alloc(pool, uri_cstr->slen + 
+    					   STR_SUBSCRIBE_PARAM.slen);
     pj_strcpy( &uri, uri_cstr);
     pj_strcat( &uri, &STR_SUBSCRIBE_PARAM);
Index: pjproject/trunk/pjsip/src/pjsip/sip_tel_uri.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_tel_uri.c	(revision 1240)
+++ pjproject/trunk/pjsip/src/pjsip/sip_tel_uri.c	(revision 1241)
@@ -76,17 +76,19 @@
 				     pj_bool_t parse_params);
 
-#ifdef __GNUC__
-#  define HAPPY_FLAG	(void*)
-#else
-#  define HAPPY_FLAG
-#endif
+typedef const pj_str_t* (*P_GET_SCHEME)(const void*);
+typedef void* 		(*P_GET_URI)(void*);
+typedef pj_ssize_t 	(*P_PRINT_URI)(pjsip_uri_context_e,const void *,
+				       char*,unsigned);
+typedef int 		(*P_CMP_URI)(pjsip_uri_context_e, const void*, 
+				     const void*);
+typedef void* 		(*P_CLONE)(pj_pool_t*, const void*);
 
 static pjsip_uri_vptr tel_uri_vptr = 
 {
-    HAPPY_FLAG &tel_uri_get_scheme,
-    HAPPY_FLAG &tel_uri_get_uri,
-    HAPPY_FLAG &tel_uri_print,
-    HAPPY_FLAG &tel_uri_cmp,
-    HAPPY_FLAG &tel_uri_clone
+    (P_GET_SCHEME)	&tel_uri_get_scheme,
+    (P_GET_URI) 	&tel_uri_get_uri,
+    (P_PRINT_URI) 	&tel_uri_print,
+    (P_CMP_URI)		&tel_uri_cmp,
+    (P_CLONE)		&tel_uri_clone
 };
 
@@ -94,5 +96,5 @@
 PJ_DEF(pjsip_tel_uri*) pjsip_tel_uri_create(pj_pool_t *pool)
 {
-    pjsip_tel_uri *uri = pj_pool_zalloc(pool, sizeof(pjsip_tel_uri));
+    pjsip_tel_uri *uri = PJ_POOL_ZALLOC_T(pool, pjsip_tel_uri);
     uri->vptr = &tel_uri_vptr;
     pj_list_init(&uri->other_param);
@@ -427,5 +429,5 @@
 		uri->context = pvalue;
 	    } else {
-		pjsip_param *param = pj_pool_alloc(pool, sizeof(pjsip_param));
+		pjsip_param *param = PJ_POOL_ALLOC_T(pool, pjsip_param);
 		param->name = pname;
 		param->value = pvalue;
Index: pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_transaction.c	(revision 1240)
+++ pjproject/trunk/pjsip/src/pjsip/sip_transaction.c	(revision 1241)
@@ -289,5 +289,5 @@
 		   9 +			    /* Via port. */
 		   16;			    /* Separator+Allowance. */
-    key = p = pj_pool_alloc(pool, len_required);
+    key = p = (char*) pj_pool_alloc(pool, len_required);
     end = p + len_required;
 
@@ -356,5 +356,6 @@
     PJ_ASSERT_RETURN(pool && key && method && branch, PJ_EINVAL);
 
-    p = key->ptr = pj_pool_alloc(pool, branch->slen + method->name.slen + 4 );
+    p = key->ptr = (char*) 
+    		   pj_pool_alloc(pool, branch->slen + method->name.slen + 4 );
     
     /* Add role. */
@@ -594,5 +595,6 @@
 
     pj_mutex_lock(mod_tsx_layer.mutex);
-    tsx = pj_hash_get( mod_tsx_layer.htable, key->ptr, key->slen, &hval );
+    tsx = (pjsip_transaction*)
+    	  pj_hash_get( mod_tsx_layer.htable, key->ptr, key->slen, &hval );
     pj_mutex_unlock(mod_tsx_layer.mutex);
 
@@ -645,5 +647,6 @@
     it = pj_hash_first(mod_tsx_layer.htable, &it_buf);
     while (it) {
-	pjsip_transaction *tsx = pj_hash_this(mod_tsx_layer.htable, it);
+	pjsip_transaction *tsx = (pjsip_transaction*) 
+				 pj_hash_this(mod_tsx_layer.htable, it);
 	pj_hash_iterator_t *next = pj_hash_next(mod_tsx_layer.htable, it);
 	if (tsx) {
@@ -706,5 +709,6 @@
     pj_mutex_lock( mod_tsx_layer.mutex );
 
-    tsx = pj_hash_get( mod_tsx_layer.htable, key.ptr, key.slen, &hval );
+    tsx = (pjsip_transaction*) 
+    	  pj_hash_get( mod_tsx_layer.htable, key.ptr, key.slen, &hval );
 
 
@@ -754,5 +758,6 @@
     pj_mutex_lock( mod_tsx_layer.mutex );
 
-    tsx = pj_hash_get( mod_tsx_layer.htable, key.ptr, key.slen, &hval );
+    tsx = (pjsip_transaction*) 
+    	  pj_hash_get( mod_tsx_layer.htable, key.ptr, key.slen, &hval );
 
 
@@ -792,5 +797,6 @@
 PJ_DEF(pjsip_transaction*) pjsip_rdata_get_tsx( pjsip_rx_data *rdata )
 {
-    return rdata->endpt_info.mod_data[mod_tsx_layer.mod.id];
+    return (pjsip_transaction*) 
+    	   rdata->endpt_info.mod_data[mod_tsx_layer.mod.id];
 }
 
@@ -817,5 +823,6 @@
 	} else {
 	    while (it != NULL) {
-		pjsip_transaction *tsx = pj_hash_this(mod_tsx_layer.htable,it);
+		pjsip_transaction *tsx = (pjsip_transaction*) 
+					 pj_hash_this(mod_tsx_layer.htable,it);
 
 		PJ_LOG(3, (THIS_FILE, " %s %s|%d|%s",
@@ -895,5 +902,5 @@
 	return PJ_ENOMEM;
 
-    tsx = pj_pool_zalloc(pool, sizeof(pjsip_transaction));
+    tsx = PJ_POOL_ZALLOC_T(pool, pjsip_transaction);
     tsx->pool = pool;
     tsx->tsx_user = tsx_user;
@@ -966,5 +973,5 @@
 
     /* Clear TLS, so that mutex will not be unlocked */
-    lck = pj_thread_local_get(pjsip_tsx_lock_tls_id);
+    lck = (struct tsx_lock_data*) pj_thread_local_get(pjsip_tsx_lock_tls_id);
     while (lck) {
 	if (lck->tsx == tsx) {
@@ -990,5 +997,5 @@
 {
     pjsip_event event;
-    pjsip_transaction *tsx = entry->user_data;
+    pjsip_transaction *tsx = (pjsip_transaction*) entry->user_data;
     struct tsx_lock_data lck;
 
@@ -1043,5 +1050,5 @@
      */
     if (event_src_type==PJSIP_EVENT_RX_MSG && tsx->tsx_user) {
-	pjsip_rx_data *rdata = event_src;
+	pjsip_rx_data *rdata = (pjsip_rx_data*) event_src;
 
 	pj_assert(rdata != NULL);
@@ -1124,5 +1131,5 @@
 
     /* Make sure CSeq header is present. */
-    cseq = pjsip_msg_find_hdr(msg, PJSIP_H_CSEQ, NULL);
+    cseq = (pjsip_cseq_hdr*) pjsip_msg_find_hdr(msg, PJSIP_H_CSEQ, NULL);
     if (!cseq) {
 	pj_assert(!"CSeq header not present in outgoing message!");
@@ -1150,5 +1157,5 @@
 
     /* Generate Via header if it doesn't exist. */
-    via = pjsip_msg_find_hdr(msg, PJSIP_H_VIA, NULL);
+    via = (pjsip_via_hdr*) pjsip_msg_find_hdr(msg, PJSIP_H_VIA, NULL);
     if (via == NULL) {
 	via = pjsip_via_hdr_create(tdata->pool);
@@ -1159,5 +1166,6 @@
     if (via->branch_param.slen == 0) {
 	pj_str_t tmp;
-	via->branch_param.ptr = pj_pool_alloc(tsx->pool, PJSIP_MAX_BRANCH_LEN);
+	via->branch_param.ptr = (char*)
+				pj_pool_alloc(tsx->pool, PJSIP_MAX_BRANCH_LEN);
 	via->branch_param.slen = PJSIP_MAX_BRANCH_LEN;
 	pj_memcpy(via->branch_param.ptr, PJSIP_RFC3261_BRANCH_ID, 
@@ -1510,5 +1518,5 @@
 			       pj_ssize_t sent, pj_bool_t *cont )
 {
-    pjsip_transaction *tsx = send_state->token;
+    pjsip_transaction *tsx = (pjsip_transaction*) send_state->token;
     struct tsx_lock_data lck;
 
@@ -1630,5 +1638,5 @@
 {
     if (sent < 0) {
-	pjsip_transaction *tsx = token;
+	pjsip_transaction *tsx = (pjsip_transaction*) token;
 	struct tsx_lock_data lck;
 	char errmsg[PJ_ERR_MSG_SIZE];
@@ -2274,5 +2282,6 @@
 	     */
 	    if (!tsx->is_reliable) {
-		pjsip_cseq_hdr *cseq = pjsip_msg_find_hdr( msg, PJSIP_H_CSEQ,
+		pjsip_cseq_hdr *cseq = (pjsip_cseq_hdr*)
+				       pjsip_msg_find_hdr( msg, PJSIP_H_CSEQ,
                                                            NULL);
 		if (cseq->method.id == PJSIP_INVITE_METHOD) {
Index: pjproject/trunk/pjsip/src/pjsip/sip_transport.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_transport.c	(revision 1240)
+++ pjproject/trunk/pjsip/src/pjsip/sip_transport.c	(revision 1241)
@@ -315,5 +315,5 @@
 	return PJ_ENOMEM;
 
-    tdata = pj_pool_zalloc(pool, sizeof(pjsip_tx_data));
+    tdata = PJ_POOL_ZALLOC_T(pool, pjsip_tx_data);
     tdata->pool = pool;
     tdata->mgr = mgr;
@@ -397,5 +397,5 @@
     int len;
 
-    cseq = pjsip_msg_find_hdr(msg, PJSIP_H_CSEQ, NULL);
+    cseq = (const pjsip_cseq_hdr*) pjsip_msg_find_hdr(msg, PJSIP_H_CSEQ, NULL);
     PJ_ASSERT_RETURN(cseq != NULL, "INVALID MSG");
 
@@ -419,5 +419,5 @@
     }
 
-    info = pj_pool_alloc(pool, len+1);
+    info = (char*) pj_pool_alloc(pool, len+1);
     pj_memcpy(info, info_buf, len+1);
 
@@ -493,5 +493,5 @@
 				    pj_ssize_t size)
 {
-    pjsip_tx_data *tdata = token;
+    pjsip_tx_data *tdata = (pjsip_tx_data*) token;
 
     PJ_UNUSED_ARG(transport);
@@ -518,5 +518,6 @@
     /* Allocate buffer if necessary. */
     if (tdata->buf.start == NULL) {
-	tdata->buf.start = pj_pool_alloc( tdata->pool, PJSIP_MAX_PKT_LEN);
+	tdata->buf.start = (char*) 
+			   pj_pool_alloc( tdata->pool, PJSIP_MAX_PKT_LEN);
 	tdata->buf.cur = tdata->buf.start;
 	tdata->buf.end = tdata->buf.start + PJSIP_MAX_PKT_LEN;
@@ -613,5 +614,5 @@
 				    struct pj_timer_entry *entry)
 {
-    pjsip_transport *tp = entry->user_data;
+    pjsip_transport *tp = (pjsip_transport*) entry->user_data;
     pj_assert(tp != NULL);
 
@@ -901,5 +902,5 @@
 
     /* Create and initialize transport manager. */
-    mgr = pj_pool_zalloc(pool, sizeof(*mgr));
+    mgr = PJ_POOL_ZALLOC_T(pool, pjsip_tpmgr);
     mgr->endpt = endpt;
     mgr->on_rx_msg = rx_cb;
@@ -1036,5 +1037,5 @@
 	pjsip_transport *transport;
 	
-	transport = pj_hash_this(mgr->table, itr);
+	transport = (pjsip_transport*) pj_hash_this(mgr->table, itr);
 
 	next = pj_hash_next(mgr->table, itr);
@@ -1344,5 +1345,6 @@
 	pj_memcpy(&key.addr, remote, addr_len);
 
-	transport = pj_hash_get(mgr->table, &key, key_len, NULL);
+	transport = (pjsip_transport*)
+		    pj_hash_get(mgr->table, &key, key_len, NULL);
 	if (transport == NULL) {
 	    unsigned flag = pjsip_transport_get_flag_from_type(type);
@@ -1357,5 +1359,6 @@
 		pj_bzero(addr, sizeof(pj_sockaddr_in));
 		key_len = sizeof(key.type) + sizeof(pj_sockaddr_in);
-		transport = pj_hash_get(mgr->table, &key, key_len, NULL);
+		transport = (pjsip_transport*) 
+			    pj_hash_get(mgr->table, &key, key_len, NULL);
 	    }
 	    /* For datagram INET transports, try lookup with zero address.
@@ -1370,5 +1373,6 @@
 
 		key_len = sizeof(key.type) + sizeof(pj_sockaddr_in);
-		transport = pj_hash_get(mgr->table, &key, key_len, NULL);
+		transport = (pjsip_transport*)
+			    pj_hash_get(mgr->table, &key, key_len, NULL);
 	    }
 	}
@@ -1411,5 +1415,6 @@
     /* Request factory to create transport. */
     status = factory->create_transport(factory, mgr, mgr->endpt,
-				       remote, addr_len, tp);
+				       (const pj_sockaddr*) remote, addr_len,
+				       tp);
     if (status == PJ_SUCCESS) {
 	PJ_ASSERT_ON_FAIL(tp!=NULL, 
@@ -1455,5 +1460,6 @@
 
 	do {
-	    pjsip_transport *t = pj_hash_this(mgr->table, itr);
+	    pjsip_transport *t = (pjsip_transport*) 
+	    			 pj_hash_this(mgr->table, itr);
 
 	    PJ_LOG(3, (THIS_FILE, "  %s %s (refcnt=%d%s)", 
Index: pjproject/trunk/pjsip/src/pjsip/sip_transport_loop.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_transport_loop.c	(revision 1240)
+++ pjproject/trunk/pjsip/src/pjsip/sip_transport_loop.c	(revision 1241)
@@ -79,5 +79,5 @@
 	return NULL;
 
-    pkt = pj_pool_zalloc(pool, sizeof(struct recv_list));
+    pkt = PJ_POOL_ZALLOC_T(pool, struct recv_list);
 
     /* Initialize rdata. */
@@ -121,5 +121,5 @@
     pjsip_tx_data_add_ref(tdata);
     pj_lock_acquire(tdata->lock);
-    sent_status = pj_pool_alloc(tdata->pool, sizeof(struct send_list));
+    sent_status = PJ_POOL_ALLOC_T(tdata->pool, struct send_list);
     pj_lock_release(tdata->lock);
 
@@ -254,5 +254,5 @@
 static int loop_transport_worker_thread(void *arg)
 {
-    struct loop_transport *loop = arg;
+    struct loop_transport *loop = (struct loop_transport*) arg;
     struct recv_list r;
     struct send_list s;
@@ -357,5 +357,5 @@
 
     /* Create the loop structure. */
-    loop = pj_pool_zalloc(pool, sizeof(struct loop_transport));
+    loop = PJ_POOL_ZALLOC_T(pool, struct loop_transport);
     
     /* Initialize transport properties. */
Index: pjproject/trunk/pjsip/src/pjsip/sip_transport_tcp.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_transport_tcp.c	(revision 1240)
+++ pjproject/trunk/pjsip/src/pjsip/sip_transport_tcp.c	(revision 1241)
@@ -171,5 +171,5 @@
 {
     enum { M = 48 };
-    host_port->host.ptr = pj_pool_alloc(pool, M);
+    host_port->host.ptr = (char*) pj_pool_alloc(pool, M);
     host_port->host.slen = pj_ansi_snprintf( host_port->host.ptr, M, "%s", 
 					    pj_inet_ntoa(addr->sin_addr));
@@ -223,5 +223,5 @@
 
 
-    listener = pj_pool_zalloc(pool, sizeof(struct tcp_listener));
+    listener = PJ_POOL_ZALLOC_T(pool, struct tcp_listener);
     listener->factory.pool = pool;
     listener->factory.type = PJSIP_TRANSPORT_TCP;
@@ -346,6 +346,6 @@
 	}
 
-	listener->accept_op[i] = pj_pool_zalloc(pool, 
-						sizeof(struct pending_accept));
+	listener->accept_op[i] = PJ_POOL_ZALLOC_T(pool, 
+						  struct pending_accept);
 	pj_ioqueue_op_key_init(&listener->accept_op[i]->op_key, 
 				sizeof(listener->accept_op[i]->op_key));
@@ -508,5 +508,5 @@
      * Create and initialize basic transport structure.
      */
-    tcp = pj_pool_zalloc(pool, sizeof(*tcp));
+    tcp = PJ_POOL_ZALLOC_T(pool, struct tcp_transport);
     tcp->sock = sock;
     tcp->is_server = is_server;
@@ -533,5 +533,5 @@
     tcp->base.flag = pjsip_transport_get_flag_from_type(PJSIP_TRANSPORT_TCP);
 
-    tcp->base.info = pj_pool_alloc(pool, 64);
+    tcp->base.info = (char*) pj_pool_alloc(pool, 64);
     pj_ansi_snprintf(tcp->base.info, 64, "TCP to %s:%d",
 		     pj_inet_ntoa(remote->sin_addr), 
@@ -890,5 +890,5 @@
     int err_cnt = 0;
 
-    listener = pj_ioqueue_get_user_data(key);
+    listener = (struct tcp_listener*) pj_ioqueue_get_user_data(key);
     accept_op = (struct pending_accept*) op_key;
 
@@ -949,5 +949,5 @@
 	    pool = pjsip_endpt_create_pool(listener->endpt, "tcps%p", 
 					   POOL_TP_INIT, POOL_TP_INC);
-	    new_op = pj_pool_zalloc(pool, sizeof(struct pending_accept));
+	    new_op = PJ_POOL_ZALLOC_T(pool, struct pending_accept);
 	    new_op->pool = pool;
 	    new_op->listener = listener;
@@ -1003,5 +1003,6 @@
                               pj_ssize_t bytes_sent)
 {
-    struct tcp_transport *tcp = pj_ioqueue_get_user_data(key);
+    struct tcp_transport *tcp = (struct tcp_transport*) 
+    				pj_ioqueue_get_user_data(key);
     pjsip_tx_data_op_key *tdata_op_key = (pjsip_tx_data_op_key*)op_key;
 
@@ -1082,6 +1083,6 @@
 	     * the delayed list.
 	     */
-	    delayed_tdata = pj_pool_alloc(tdata->pool, 
-					  sizeof(*delayed_tdata));
+	    delayed_tdata = PJ_POOL_ALLOC_T(tdata->pool, 
+					    struct delayed_tdata);
 	    delayed_tdata->tdata_op_key = &tdata->op_key;
 
@@ -1293,5 +1294,5 @@
     int addrlen;
 
-    tcp = pj_ioqueue_get_user_data(key);
+    tcp = (struct tcp_transport*) pj_ioqueue_get_user_data(key);
 
     /* Mark that pending connect() operation has completed. */
Index: pjproject/trunk/pjsip/src/pjsip/sip_transport_udp.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_transport_udp.c	(revision 1240)
+++ pjproject/trunk/pjsip/src/pjsip/sip_transport_udp.c	(revision 1241)
@@ -83,5 +83,5 @@
     //pj_pool_reset(pool);
 
-    rdata = pj_pool_zalloc(pool, sizeof(pjsip_rx_data));
+    rdata = PJ_POOL_ZALLOC_T(pool, pjsip_rx_data);
 
     /* Init tp_info part. */
@@ -262,5 +262,6 @@
 				   pj_ssize_t bytes_sent)
 {
-    struct udp_transport *tp = pj_ioqueue_get_user_data(key);
+    struct udp_transport *tp = (struct udp_transport*) 
+    			       pj_ioqueue_get_user_data(key);
     pjsip_tx_data_op_key *tdata_op_key = (pjsip_tx_data_op_key*)op_key;
 
@@ -447,5 +448,5 @@
 
     /* Create the UDP transport object. */
-    tp = pj_pool_zalloc(pool, sizeof(struct udp_transport));
+    tp = PJ_POOL_ZALLOC_T(pool, struct udp_transport);
 
     /* Save pool. */
@@ -497,5 +498,5 @@
 
     /* Transport info. */
-    tp->base.info = pj_pool_alloc(pool, M);
+    tp->base.info = (char*) pj_pool_alloc(pool, M);
     pj_ansi_snprintf( 
 	tp->base.info, M, "udp %s:%d [published as %s:%d]",
@@ -543,5 +544,6 @@
     /* Create rdata and put it in the array. */
     tp->rdata_cnt = 0;
-    tp->rdata = pj_pool_calloc(tp->base.pool, async_cnt, 
+    tp->rdata = (pjsip_rx_data**)
+    		pj_pool_calloc(tp->base.pool, async_cnt, 
 			       sizeof(pjsip_rx_data*));
     for (i=0; i<async_cnt; ++i) {
Index: pjproject/trunk/pjsip/src/pjsip/sip_ua_layer.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_ua_layer.c	(revision 1240)
+++ pjproject/trunk/pjsip/src/pjsip/sip_ua_layer.c	(revision 1241)
@@ -166,5 +166,5 @@
 
     /* Get the dialog where this transaction belongs. */
-    dlg = tsx->mod_data[mod_ua.mod.id];
+    dlg = (pjsip_dialog*) tsx->mod_data[mod_ua.mod.id];
     
     /* If dialog instance has gone, it could mean that the dialog
@@ -245,5 +245,5 @@
 
     set_key->slen = call_id->slen + local_tag->slen + 1;
-    set_key->ptr = pj_pool_alloc(pool, set_key->slen);
+    set_key->ptr = (char*) pj_pool_alloc(pool, set_key->slen);
     pj_assert(set_key->ptr != NULL);
 
@@ -268,5 +268,5 @@
 	return set;
     } else {
-	set = pj_pool_alloc(mod_ua.pool, sizeof(struct dlg_set));
+	set = PJ_POOL_ALLOC_T(mod_ua.pool, struct dlg_set);
 	return set;
     }
@@ -299,5 +299,6 @@
 	struct dlg_set *dlg_set;
 
-	dlg_set = pj_hash_get( mod_ua.dlg_table, dlg->local.info->tag.ptr, 
+	dlg_set = (struct dlg_set*)
+		  pj_hash_get( mod_ua.dlg_table, dlg->local.info->tag.ptr, 
 			       dlg->local.info->tag.slen,
 			       &dlg->local.tag_hval);
@@ -367,5 +368,5 @@
 
     /* Find this dialog from the dialog set. */
-    dlg_set = dlg->dlg_set;
+    dlg_set = (struct dlg_set*) dlg->dlg_set;
     d = dlg_set->dlg_list.next;
     while (d != (pjsip_dialog*)&dlg_set->dlg_list && d != dlg) {
@@ -401,10 +402,10 @@
 PJ_DEF(pjsip_dialog*) pjsip_rdata_get_dlg( pjsip_rx_data *rdata )
 {
-    return rdata->endpt_info.mod_data[mod_ua.mod.id];
+    return (pjsip_dialog*) rdata->endpt_info.mod_data[mod_ua.mod.id];
 }
 
 PJ_DEF(pjsip_dialog*) pjsip_tsx_get_dlg( pjsip_transaction *tsx )
 {
-    return tsx->mod_data[mod_ua.mod.id];
+    return (pjsip_dialog*) tsx->mod_data[mod_ua.mod.id];
 }
 
@@ -427,5 +428,6 @@
 
     /* Lookup the dialog set. */
-    dlg_set = pj_hash_get(mod_ua.dlg_table, local_tag->ptr, local_tag->slen,
+    dlg_set = (struct dlg_set*)
+    	      pj_hash_get(mod_ua.dlg_table, local_tag->ptr, local_tag->slen,
 			  NULL);
     if (dlg_set == NULL) {
@@ -517,5 +519,5 @@
 	/* We should find the dialog attached to the INVITE transaction */
 	if (tsx) {
-	    dlg = tsx->mod_data[mod_ua.mod.id];
+	    dlg = (pjsip_dialog*) tsx->mod_data[mod_ua.mod.id];
 	    pj_mutex_unlock(tsx->mutex);
 
@@ -523,5 +525,5 @@
 	     * (e.g. during debugging where initially there is a dialog)
 	     */
-	    return dlg ? dlg->dlg_set : NULL;
+	    return dlg ? (struct dlg_set*) dlg->dlg_set : NULL;
 
 	} else {
@@ -540,5 +542,6 @@
 
 	/* Lookup the dialog set. */
-	dlg_set = pj_hash_get(mod_ua.dlg_table, tag->ptr, tag->slen, NULL);
+	dlg_set = (struct dlg_set*)
+		  pj_hash_get(mod_ua.dlg_table, tag->ptr, tag->slen, NULL);
 	return dlg_set;
     }
@@ -705,5 +708,5 @@
 
 	/* Get the dialog set. */
-	dlg_set = dlg->dlg_set;
+	dlg_set = (struct dlg_set*) dlg->dlg_set;
 
 	/* Even if transaction is found and (candidate) dialog has been 
@@ -733,5 +736,6 @@
 
 	/* Get the dialog set. */
-	dlg_set = pj_hash_get(mod_ua.dlg_table, 
+	dlg_set = (struct dlg_set*)
+		  pj_hash_get(mod_ua.dlg_table, 
 			      rdata->msg_info.from->tag.ptr,
 			      rdata->msg_info.from->tag.slen,
@@ -918,5 +922,5 @@
 	    const char *title;
 
-	    dlg_set = pj_hash_this(mod_ua.dlg_table, it);
+	    dlg_set = (struct dlg_set*) pj_hash_this(mod_ua.dlg_table, it);
 	    if (!dlg_set || pj_list_empty(&dlg_set->dlg_list)) continue;
 
Index: pjproject/trunk/pjsip/src/pjsip/sip_uri.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_uri.c	(revision 1240)
+++ pjproject/trunk/pjsip/src/pjsip/sip_uri.c	(revision 1241)
@@ -61,5 +61,5 @@
     pj_list_init(dst_list);
     while (p != src_list) {
-	pjsip_param *new_param = pj_pool_alloc(pool, sizeof(pjsip_param));
+	pjsip_param *new_param = PJ_POOL_ALLOC_T(pool, pjsip_param);
 	pj_strdup(pool, &new_param->name, &p->name);
 	pj_strdup(pool, &new_param->value, &p->value);
@@ -78,5 +78,5 @@
     pj_list_init(dst_list);
     while (p != src_list) {
-	pjsip_param *new_param = pj_pool_alloc(pool, sizeof(pjsip_param));
+	pjsip_param *new_param = PJ_POOL_ALLOC_T(pool, pjsip_param);
 	new_param->name = p->name;
 	new_param->value = p->value;
@@ -137,10 +137,4 @@
 static pj_str_t sip_str = { "sip", 3 };
 static pj_str_t sips_str = { "sips", 4 };
-
-#ifdef __GNUC__
-#  define HAPPY_FLAG	(void*)
-#else
-#  define HAPPY_FLAG
-#endif
 
 static pjsip_name_addr* pjsip_name_addr_clone( pj_pool_t *pool, 
@@ -161,29 +155,38 @@
 				      const pjsip_sip_uri *rhs);
 
+typedef const pj_str_t* (*P_GET_SCHEME)(const void*);
+typedef void* 		(*P_GET_URI)(void*);
+typedef pj_ssize_t 	(*P_PRINT_URI)(pjsip_uri_context_e,const void *,
+				       char*,unsigned);
+typedef int 		(*P_CMP_URI)(pjsip_uri_context_e, const void*, 
+				     const void*);
+typedef void* 		(*P_CLONE)(pj_pool_t*, const void*);
+
+
 static pjsip_uri_vptr sip_url_vptr = 
 {
-    HAPPY_FLAG &pjsip_url_get_scheme,
-    HAPPY_FLAG &pjsip_get_uri,
-    HAPPY_FLAG &pjsip_url_print,
-    HAPPY_FLAG &pjsip_url_compare,
-    HAPPY_FLAG &pjsip_url_clone
+    (P_GET_SCHEME)	&pjsip_url_get_scheme,
+    (P_GET_URI)		&pjsip_get_uri,
+    (P_PRINT_URI) 	&pjsip_url_print,
+    (P_CMP_URI) 	&pjsip_url_compare,
+    (P_CLONE) 		&pjsip_url_clone
 };
 
 static pjsip_uri_vptr sips_url_vptr = 
 {
-    HAPPY_FLAG &pjsips_url_get_scheme,
-    HAPPY_FLAG &pjsip_get_uri,
-    HAPPY_FLAG &pjsip_url_print,
-    HAPPY_FLAG &pjsip_url_compare,
-    HAPPY_FLAG &pjsip_url_clone
+    (P_GET_SCHEME)	&pjsips_url_get_scheme,
+    (P_GET_URI)		&pjsip_get_uri,
+    (P_PRINT_URI) 	&pjsip_url_print,
+    (P_CMP_URI) 	&pjsip_url_compare,
+    (P_CLONE) 		&pjsip_url_clone
 };
 
 static pjsip_uri_vptr name_addr_vptr = 
 {
-    HAPPY_FLAG &pjsip_name_addr_get_scheme,
-    HAPPY_FLAG &pjsip_name_addr_get_uri,
-    HAPPY_FLAG &pjsip_name_addr_print,
-    HAPPY_FLAG &pjsip_name_addr_compare,
-    HAPPY_FLAG &pjsip_name_addr_clone
+    (P_GET_SCHEME)	&pjsip_name_addr_get_scheme,
+    (P_GET_URI)		&pjsip_name_addr_get_uri,
+    (P_PRINT_URI) 	&pjsip_name_addr_print,
+    (P_CMP_URI) 	&pjsip_name_addr_compare,
+    (P_CLONE) 		&pjsip_name_addr_clone
 };
 
@@ -228,5 +231,5 @@
 					     pj_bool_t secure )
 {
-    pjsip_sip_uri *url = pj_pool_alloc(pool, sizeof(pjsip_sip_uri));
+    pjsip_sip_uri *url = PJ_POOL_ALLOC_T(pool, pjsip_sip_uri);
     pjsip_sip_uri_init(url, secure);
     return url;
@@ -497,5 +500,5 @@
 static pjsip_sip_uri* pjsip_url_clone(pj_pool_t *pool, const pjsip_sip_uri *rhs)
 {
-    pjsip_sip_uri *url = pj_pool_alloc(pool, sizeof(pjsip_sip_uri));
+    pjsip_sip_uri *url = PJ_POOL_ALLOC_T(pool, pjsip_sip_uri);
     if (!url)
 	return NULL;
@@ -521,5 +524,5 @@
 PJ_DEF(pjsip_name_addr*) pjsip_name_addr_create(pj_pool_t *pool)
 {
-    pjsip_name_addr *name_addr = pj_pool_alloc(pool, sizeof(pjsip_name_addr));
+    pjsip_name_addr *name_addr = PJ_POOL_ALLOC_T(pool, pjsip_name_addr);
     pjsip_name_addr_init(name_addr);
     return name_addr;
@@ -535,5 +538,5 @@
     pjsip_uri *uri;
 
-    uri = pjsip_uri_get_uri(name->uri);
+    uri = (pjsip_uri*) pjsip_uri_get_uri(name->uri);
     pj_assert(uri != NULL);
 
@@ -566,5 +569,5 @@
 {
     pj_strdup( pool, &dst->display, &src->display);
-    dst->uri = pjsip_uri_clone(pool, src->uri);
+    dst->uri = (pjsip_uri*) pjsip_uri_clone(pool, src->uri);
 }
 
@@ -572,5 +575,5 @@
 					       const pjsip_name_addr *rhs)
 {
-    pjsip_name_addr *addr = pj_pool_alloc(pool, sizeof(pjsip_name_addr));
+    pjsip_name_addr *addr = PJ_POOL_ALLOC_T(pool, pjsip_name_addr);
     if (!addr)
 	return NULL;
Index: pjproject/trunk/pjsip/src/pjsip/sip_util.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_util.c	(revision 1240)
+++ pjproject/trunk/pjsip/src/pjsip/sip_util.c	(revision 1241)
@@ -85,5 +85,6 @@
     endpt_hdr = pjsip_endpt_get_request_headers(endpt)->next;
     while (endpt_hdr != pjsip_endpt_get_request_headers(endpt)) {
-	pjsip_hdr *hdr = pjsip_hdr_shallow_clone(tdata->pool, endpt_hdr);
+	pjsip_hdr *hdr = (pjsip_hdr*) 
+			 pjsip_hdr_shallow_clone(tdata->pool, endpt_hdr);
 	pjsip_msg_add_hdr( tdata->msg, hdr );
 	endpt_hdr = endpt_hdr->next;
@@ -93,24 +94,24 @@
     if (param_from->tag.slen == 0)
 	pj_create_unique_string(tdata->pool, &param_from->tag);
-    pjsip_msg_add_hdr(msg, (void*)param_from);
+    pjsip_msg_add_hdr(msg, (pjsip_hdr*)param_from);
 
     /* Add To header. */
-    pjsip_msg_add_hdr(msg, (void*)param_to);
+    pjsip_msg_add_hdr(msg, (pjsip_hdr*)param_to);
 
     /* Add Contact header. */
     if (param_contact) {
-	pjsip_msg_add_hdr(msg, (void*)param_contact);
+	pjsip_msg_add_hdr(msg, (pjsip_hdr*)param_contact);
     }
 
     /* Add Call-ID header. */
-    pjsip_msg_add_hdr(msg, (void*)param_call_id);
+    pjsip_msg_add_hdr(msg, (pjsip_hdr*)param_call_id);
 
     /* Add CSeq header. */
-    pjsip_msg_add_hdr(msg, (void*)param_cseq);
+    pjsip_msg_add_hdr(msg, (pjsip_hdr*)param_cseq);
 
     /* Add a blank Via header in the front of the message. */
     via = pjsip_via_hdr_create(tdata->pool);
     via->rport_param = 0;
-    pjsip_msg_insert_first_hdr(msg, (void*)via);
+    pjsip_msg_insert_first_hdr(msg, (pjsip_hdr*)via);
 
     /* Add header params as request headers */
@@ -135,5 +136,5 @@
     /* Create message body. */
     if (param_text) {
-	body = pj_pool_calloc(tdata->pool, 1, sizeof(pjsip_msg_body));
+	body = PJ_POOL_ZALLOC_T(tdata->pool, pjsip_msg_body);
 	body->content_type.type = str_TEXT;
 	body->content_type.subtype = str_PLAIN;
@@ -297,14 +298,16 @@
     PJ_TRY {
 	/* Duplicate target URI and headers. */
-	target = pjsip_uri_clone(tdata->pool, param_target);
-	from = pjsip_hdr_clone(tdata->pool, param_from);
+	target = (pjsip_uri*) pjsip_uri_clone(tdata->pool, param_target);
+	from = (pjsip_from_hdr*) pjsip_hdr_clone(tdata->pool, param_from);
 	pjsip_fromto_hdr_set_from(from);
-	to = pjsip_hdr_clone(tdata->pool, param_to);
+	to = (pjsip_to_hdr*) pjsip_hdr_clone(tdata->pool, param_to);
 	pjsip_fromto_hdr_set_to(to);
-	if (param_contact)
-	    contact = pjsip_hdr_clone(tdata->pool, param_contact);
-	else
+	if (param_contact) {
+	    contact = (pjsip_contact_hdr*) 
+	    	      pjsip_hdr_clone(tdata->pool, param_contact);
+	} else {
 	    contact = NULL;
-	call_id = pjsip_hdr_clone(tdata->pool, param_call_id);
+	}
+	call_id = (pjsip_cid_hdr*) pjsip_hdr_clone(tdata->pool, param_call_id);
 	cseq = pjsip_cseq_hdr_create(tdata->pool);
 	if (param_cseq >= 0)
@@ -386,8 +389,9 @@
     via = rdata->msg_info.via;
     while (via) {
-	pjsip_msg_add_hdr( msg, pjsip_hdr_clone(tdata->pool, via));
+	pjsip_msg_add_hdr( msg, (pjsip_hdr*)pjsip_hdr_clone(tdata->pool, via));
 	via = via->next;
 	if (via != (void*)&req_msg->hdr)
-	    via = pjsip_msg_find_hdr(req_msg, PJSIP_H_VIA, via);
+	    via = (pjsip_via_hdr*) 
+	    	  pjsip_msg_find_hdr(req_msg, PJSIP_H_VIA, via);
 	else
 	    break;
@@ -395,10 +399,12 @@
 
     /* Copy all Record-Route headers, in order. */
-    rr = pjsip_msg_find_hdr(req_msg, PJSIP_H_RECORD_ROUTE, NULL);
+    rr = (pjsip_rr_hdr*) 
+    	 pjsip_msg_find_hdr(req_msg, PJSIP_H_RECORD_ROUTE, NULL);
     while (rr) {
-	pjsip_msg_add_hdr(msg, pjsip_hdr_clone(tdata->pool, rr));
+	pjsip_msg_add_hdr(msg, (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, rr));
 	rr = rr->next;
 	if (rr != (void*)&req_msg->hdr)
-	    rr = pjsip_msg_find_hdr(req_msg, PJSIP_H_RECORD_ROUTE, rr);
+	    rr = (pjsip_rr_hdr*) pjsip_msg_find_hdr(req_msg, 
+	    					    PJSIP_H_RECORD_ROUTE, rr);
 	else
 	    break;
@@ -406,17 +412,17 @@
 
     /* Copy Call-ID header. */
-    hdr = pjsip_msg_find_hdr( req_msg, PJSIP_H_CALL_ID, NULL);
-    pjsip_msg_add_hdr(msg, pjsip_hdr_clone(tdata->pool, hdr));
+    hdr = (pjsip_hdr*) pjsip_msg_find_hdr( req_msg, PJSIP_H_CALL_ID, NULL);
+    pjsip_msg_add_hdr(msg, (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, hdr));
 
     /* Copy From header. */
-    hdr = pjsip_hdr_clone(tdata->pool, rdata->msg_info.from);
+    hdr = (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, rdata->msg_info.from);
     pjsip_msg_add_hdr( msg, hdr);
 
     /* Copy To header. */
-    hdr = pjsip_hdr_clone(tdata->pool, rdata->msg_info.to);
+    hdr = (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, rdata->msg_info.to);
     pjsip_msg_add_hdr( msg, hdr);
 
     /* Copy CSeq header. */
-    hdr = pjsip_hdr_clone(tdata->pool, rdata->msg_info.cseq);
+    hdr = (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, rdata->msg_info.cseq);
     pjsip_msg_add_hdr( msg, hdr);
 
@@ -495,21 +501,23 @@
 
     /* Clear Via headers in the new request. */
-    while ((via=pjsip_msg_find_hdr(ack->msg, PJSIP_H_VIA, NULL)) != NULL)
+    while ((via=(pjsip_hdr*)pjsip_msg_find_hdr(ack->msg, PJSIP_H_VIA, NULL)) != NULL)
 	pj_list_erase(via);
 
     /* Must contain single Via, just as the original INVITE. */
-    hdr = pjsip_msg_find_hdr( invite_msg, PJSIP_H_VIA, NULL);
-    pjsip_msg_insert_first_hdr( ack->msg, pjsip_hdr_clone(ack->pool,hdr) );
+    hdr = (pjsip_hdr*) pjsip_msg_find_hdr( invite_msg, PJSIP_H_VIA, NULL);
+    pjsip_msg_insert_first_hdr( ack->msg, 
+    			        (pjsip_hdr*) pjsip_hdr_clone(ack->pool,hdr) );
 
     /* If the original INVITE has Route headers, those header fields MUST 
      * appear in the ACK.
      */
-    hdr = pjsip_msg_find_hdr( invite_msg, PJSIP_H_ROUTE, NULL);
+    hdr = (pjsip_hdr*) pjsip_msg_find_hdr( invite_msg, PJSIP_H_ROUTE, NULL);
     while (hdr != NULL) {
-	pjsip_msg_add_hdr( ack->msg, pjsip_hdr_clone(ack->pool, hdr) );
+	pjsip_msg_add_hdr( ack->msg, 
+			   (pjsip_hdr*) pjsip_hdr_clone(ack->pool, hdr) );
 	hdr = hdr->next;
 	if (hdr == &invite_msg->hdr)
 	    break;
-	hdr = pjsip_msg_find_hdr( invite_msg, PJSIP_H_ROUTE, hdr);
+	hdr = (pjsip_hdr*) pjsip_msg_find_hdr( invite_msg, PJSIP_H_ROUTE, hdr);
     }
 
@@ -579,5 +587,5 @@
 
     /* Clear Via headers in the new request. */
-    while ((via=pjsip_msg_find_hdr(cancel_tdata->msg, PJSIP_H_VIA, NULL)) != NULL)
+    while ((via=(pjsip_hdr*)pjsip_msg_find_hdr(cancel_tdata->msg, PJSIP_H_VIA, NULL)) != NULL)
 	pj_list_erase(via);
 
@@ -586,8 +594,8 @@
      * request being cancelled. 
      */
-    hdr = pjsip_msg_find_hdr(req_tdata->msg, PJSIP_H_VIA, NULL);
+    hdr = (pjsip_hdr*) pjsip_msg_find_hdr(req_tdata->msg, PJSIP_H_VIA, NULL);
     if (hdr) {
 	pjsip_msg_insert_first_hdr(cancel_tdata->msg, 
-				   pjsip_hdr_clone(cancel_tdata->pool, hdr));
+				   (pjsip_hdr*)pjsip_hdr_clone(cancel_tdata->pool, hdr));
     }
 
@@ -596,11 +604,12 @@
      * Copy "Route" header from the request.
      */
-    hdr = pjsip_msg_find_hdr(req_tdata->msg, PJSIP_H_ROUTE, NULL);
+    hdr = (pjsip_hdr*) pjsip_msg_find_hdr(req_tdata->msg, PJSIP_H_ROUTE, NULL);
     while (hdr != NULL) {
 	pjsip_msg_add_hdr(cancel_tdata->msg, 
-			  pjsip_hdr_clone(cancel_tdata->pool, hdr));
+			  (pjsip_hdr*) pjsip_hdr_clone(cancel_tdata->pool, hdr));
 	hdr = hdr->next;
 	if (hdr != &req_tdata->msg->hdr)
-	    hdr = pjsip_msg_find_hdr(req_tdata->msg, PJSIP_H_ROUTE, hdr);
+	    hdr = (pjsip_hdr*) pjsip_msg_find_hdr(req_tdata->msg, 
+	    					  PJSIP_H_ROUTE, hdr);
 	else
 	    break;
@@ -638,5 +647,6 @@
     /* Get the first "Route" header from the message.
      */
-    first_route_hdr = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_ROUTE, NULL);
+    first_route_hdr = (const pjsip_route_hdr*) 
+    		      pjsip_msg_find_hdr(tdata->msg, PJSIP_H_ROUTE, NULL);
     if (first_route_hdr) {
 	target_uri = first_route_hdr->name_addr.uri;
@@ -698,5 +708,5 @@
 
     /* Find the first and last "Route" headers from the message. */
-    last_route_hdr = first_route_hdr = 
+    last_route_hdr = first_route_hdr = (pjsip_route_hdr*)
 	pjsip_msg_find_hdr(tdata->msg, PJSIP_H_ROUTE, NULL);
     if (first_route_hdr) {
@@ -704,5 +714,6 @@
 	while (last_route_hdr->next != (void*)&tdata->msg->hdr) {
 	    pjsip_route_hdr *hdr;
-	    hdr = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_ROUTE, 
+	    hdr = (pjsip_route_hdr*)
+	    	  pjsip_msg_find_hdr(tdata->msg, PJSIP_H_ROUTE, 
                                      last_route_hdr->next);
 	    if (!hdr)
@@ -729,5 +740,5 @@
 	    PJSIP_URI_SCHEME_IS_SIPS(topmost_route_uri))
 	{
-	    const pjsip_sip_uri *url = 
+	    const pjsip_sip_uri *url = (const pjsip_sip_uri*)
 		pjsip_uri_get_uri((void*)topmost_route_uri);
 	    has_lr_param = url->lr_param;
@@ -748,5 +759,6 @@
 	    */
 	} else {
-	    new_request_uri = pjsip_uri_get_uri((void*)topmost_route_uri);
+	    new_request_uri = (const pjsip_uri*) 
+	    		      pjsip_uri_get_uri((pjsip_uri*)topmost_route_uri);
 	    pj_list_erase(first_route_hdr);
 	    if (first_route_hdr == last_route_hdr)
@@ -794,5 +806,6 @@
     if (new_request_uri && new_request_uri!=tdata->msg->line.req.uri) {
 	pjsip_route_hdr *route = pjsip_route_hdr_create(tdata->pool);
-	route->name_addr.uri = pjsip_uri_get_uri(tdata->msg->line.req.uri);
+	route->name_addr.uri = (pjsip_uri*) 
+			       pjsip_uri_get_uri(tdata->msg->line.req.uri);
 	if (last_route_hdr)
 	    pj_list_insert_after(last_route_hdr, route);
@@ -815,5 +828,5 @@
 					 pj_ssize_t sent )
 {
-    pjsip_send_state *stateless_data = token;
+    pjsip_send_state *stateless_data = (pjsip_send_state*) token;
 
     PJ_UNUSED_ARG(tdata);
@@ -916,6 +929,6 @@
 	if (via->branch_param.slen == 0) {
 	    pj_str_t tmp;
-	    via->branch_param.ptr = pj_pool_alloc(tdata->pool,
-						  PJSIP_MAX_BRANCH_LEN);
+	    via->branch_param.ptr = (char*)pj_pool_alloc(tdata->pool,
+						  	 PJSIP_MAX_BRANCH_LEN);
 	    via->branch_param.slen = PJSIP_MAX_BRANCH_LEN;
 	    pj_memcpy(via->branch_param.ptr, PJSIP_RFC3261_BRANCH_ID,
@@ -961,5 +974,5 @@
 				  const struct pjsip_server_addresses *addr)
 {
-    pjsip_send_state *stateless_data = token;
+    pjsip_send_state *stateless_data = (pjsip_send_state*) token;
 
     /* Fail on server resolution. */
@@ -1009,5 +1022,5 @@
 
     /* Keep stateless data. */
-    stateless_data = pj_pool_zalloc(tdata->pool, sizeof(pjsip_send_state));
+    stateless_data = PJ_POOL_ZALLOC_T(tdata->pool, pjsip_send_state);
     stateless_data->token = token;
     stateless_data->endpt = endpt;
@@ -1136,5 +1149,5 @@
 				       pj_ssize_t sent)
 {
-    pjsip_send_state *send_state = token;
+    pjsip_send_state *send_state = (pjsip_send_state*) token;
     pj_bool_t cont = PJ_FALSE;
 
@@ -1156,5 +1169,5 @@
 				       const pjsip_server_addresses *addr )
 {
-    pjsip_send_state *send_state = token;
+    pjsip_send_state *send_state = (pjsip_send_state*) token;
 
     if (status != PJ_SUCCESS) {
@@ -1225,5 +1238,5 @@
 
     /* Create structure to keep the sending state. */
-    send_state = pj_pool_zalloc(tdata->pool, sizeof(pjsip_send_state));
+    send_state = PJ_POOL_ZALLOC_T(tdata->pool, pjsip_send_state);
     send_state->endpt = endpt;
     send_state->tdata = tdata;
@@ -1318,5 +1331,6 @@
 	const pjsip_hdr *hdr = hdr_list->next;
 	while (hdr != hdr_list) {
-	    pjsip_msg_add_hdr( tdata->msg, pjsip_hdr_clone(tdata->pool, hdr) );
+	    pjsip_msg_add_hdr(tdata->msg, 
+	    		      (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, hdr) );
 	    hdr = hdr->next;
 	}
Index: pjproject/trunk/pjsip/src/pjsip/sip_util_proxy.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_util_proxy.c	(revision 1240)
+++ pjproject/trunk/pjsip/src/pjsip/sip_util_proxy.c	(revision 1241)
@@ -129,7 +129,9 @@
 	/* Set request URI */
 	if (uri) {
-	    dst->line.req.uri = pjsip_uri_clone(tdata->pool, uri);
+	    dst->line.req.uri = (pjsip_uri*) 
+	    			pjsip_uri_clone(tdata->pool, uri);
 	} else {
-	    dst->line.req.uri = pjsip_uri_clone(tdata->pool, src->line.req.uri);
+	    dst->line.req.uri= (pjsip_uri*)
+	    		       pjsip_uri_clone(tdata->pool, src->line.req.uri);
 	}
 
@@ -193,5 +195,5 @@
 
 	    /* Clone the header */
-	    hdst = pjsip_hdr_clone(tdata->pool, hsrc);
+	    hdst = (pjsip_hdr*) pjsip_hdr_clone(tdata->pool, hsrc);
 
 	    /* If this is Max-Forward header, decrement the value */
@@ -292,5 +294,6 @@
 	    }
 
-	    pjsip_msg_add_hdr(dst, pjsip_hdr_clone(tdata->pool, hsrc));
+	    pjsip_msg_add_hdr(dst, 
+	    		      (pjsip_hdr*)pjsip_hdr_clone(tdata->pool, hsrc));
 
 	    hsrc = hsrc->next;
@@ -342,5 +345,6 @@
     pj_md5_final(&ctx, digest);
 
-    branch.ptr = pj_pool_alloc(rdata->tp_info.pool, 
+    branch.ptr = (char*)
+    		 pj_pool_alloc(rdata->tp_info.pool, 
 			       32 + PJSIP_RFC3261_BRANCH_LEN);
     pj_memcpy(branch.ptr, PJSIP_RFC3261_BRANCH_ID, PJSIP_RFC3261_BRANCH_LEN);
Index: pjproject/trunk/pjsip/src/pjsip/sip_util_statefull.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_util_statefull.c	(revision 1240)
+++ pjproject/trunk/pjsip/src/pjsip/sip_util_statefull.c	(revision 1241)
@@ -62,5 +62,5 @@
 	return;
 
-    tsx_data = tsx->mod_data[mod_stateful_util.id];
+    tsx_data = (struct tsx_data*) tsx->mod_data[mod_stateful_util.id];
     if (tsx_data == NULL)
 	return;
@@ -103,5 +103,5 @@
     }
 
-    tsx_data = pj_pool_alloc(tsx->pool, sizeof(struct tsx_data));
+    tsx_data = PJ_POOL_ALLOC_T(tsx->pool, struct tsx_data);
     tsx_data->token = token;
     tsx_data->cb = cb;
@@ -148,5 +148,6 @@
 	const pjsip_hdr *hdr = hdr_list->next;
 	while (hdr != hdr_list) {
-	    pjsip_msg_add_hdr( tdata->msg, pjsip_hdr_clone(tdata->pool, hdr) );
+	    pjsip_msg_add_hdr(tdata->msg, (pjsip_hdr*)
+	    		      pjsip_hdr_clone(tdata->pool, hdr) );
 	    hdr = hdr->next;
 	}
