summaryrefslogtreecommitdiff
path: root/pjlib-util
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-05-01 12:25:01 +0000
committerBenny Prijono <bennylp@teluu.com>2007-05-01 12:25:01 +0000
commitb93717c9a39a0755f65df6b252b1e3506d7a42c8 (patch)
treeeda8b2d7372c7c8c2e13a387f63fefb238aa2374 /pjlib-util
parente4d10ec39863e84681c5b685d8b46e9c7351f5b4 (diff)
Ported PJLIB-UTIL and PJNATH to Symbian
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1239 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib-util')
-rw-r--r--pjlib-util/src/pjlib-util/dns.c84
-rw-r--r--pjlib-util/src/pjlib-util/resolver.c36
-rw-r--r--pjlib-util/src/pjlib-util/srv_resolver.c2
-rw-r--r--pjlib-util/src/pjlib-util/string.c2
-rw-r--r--pjlib-util/src/pjlib-util/stun_simple.c2
-rw-r--r--pjlib-util/src/pjlib-util/stun_simple_client.c9
-rw-r--r--pjlib-util/src/pjlib-util/xml.c6
7 files changed, 79 insertions, 62 deletions
diff --git a/pjlib-util/src/pjlib-util/dns.c b/pjlib-util/src/pjlib-util/dns.c
index a3c3217b..27163b20 100644
--- a/pjlib-util/src/pjlib-util/dns.c
+++ b/pjlib-util/src/pjlib-util/dns.c
@@ -66,7 +66,7 @@ PJ_DEF(pj_status_t) pj_dns_make_query( void *packet,
PJ_ASSERT_RETURN(*size >= d, PJLIB_UTIL_EDNSQRYTOOSMALL);
/* Initialize header */
- hdr = packet;
+ hdr = (pj_dns_hdr*) packet;
pj_bzero(hdr, sizeof(struct pj_dns_hdr));
hdr->id = pj_htons(id);
hdr->flags = pj_htons(PJ_DNS_SET_RD(1));
@@ -110,11 +110,11 @@ PJ_DEF(pj_status_t) pj_dns_make_query( void *packet,
/* Get a name length (note: name consists of multiple labels and
* 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;
/* Limit the number of recursion */
@@ -180,11 +180,11 @@ static pj_status_t get_name_len(int rec_counter, const char *pkt,
/* Parse and copy name (note: name consists of multiple labels and
* 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;
/* Limit the number of recursion */
@@ -241,10 +241,10 @@ static pj_status_t get_name(int rec_counter, const char *pkt,
/* 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 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;
@@ -254,7 +254,7 @@ static pj_status_t parse_query(pj_dns_parsed_query *q, pj_pool_t *pool,
return status;
/* 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;
/* Get the name */
@@ -282,11 +282,11 @@ static pj_status_t parse_query(pj_dns_parsed_query *q, pj_pool_t *pool,
/* 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;
@@ -296,7 +296,7 @@ static pj_status_t parse_rr(pj_dns_parsed_rr *rr, pj_pool_t *pool,
return status;
/* 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;
/* Get the name */
@@ -354,7 +354,7 @@ static pj_status_t parse_rr(pj_dns_parsed_rr *rr, pj_pool_t *pool,
return status;
/* 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;
/* Get the name */
@@ -387,7 +387,7 @@ static pj_status_t parse_rr(pj_dns_parsed_rr *rr, pj_pool_t *pool,
return status;
/* 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;
/* Get the name */
@@ -418,7 +418,7 @@ PJ_DEF(pj_status_t) pj_dns_parse_packet( pj_pool_t *pool,
pj_dns_parsed_packet **p_res)
{
pj_dns_parsed_packet *res;
- char *start, *end;
+ const pj_uint8_t *start, *end;
pj_status_t status;
unsigned i;
@@ -430,7 +430,7 @@ PJ_DEF(pj_status_t) pj_dns_parse_packet( pj_pool_t *pool,
return PJLIB_UTIL_EDNSINSIZE;
/* 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 */
pj_memcpy(&res->hdr, packet, sizeof(pj_dns_hdr));
@@ -442,19 +442,20 @@ PJ_DEF(pj_status_t) pj_dns_parse_packet( pj_pool_t *pool,
res->hdr.arcount = pj_ntohs(res->hdr.arcount);
/* 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;
@@ -464,14 +465,15 @@ PJ_DEF(pj_status_t) pj_dns_parse_packet( pj_pool_t *pool,
/* 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));
for (i=0; i<res->hdr.anscount; ++i) {
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;
@@ -481,14 +483,15 @@ PJ_DEF(pj_status_t) pj_dns_parse_packet( pj_pool_t *pool,
/* 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));
for (i=0; i<res->hdr.nscount; ++i) {
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;
@@ -498,14 +501,15 @@ PJ_DEF(pj_status_t) pj_dns_parse_packet( pj_pool_t *pool,
/* 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));
for (i=0; i<res->hdr.arcount; ++i) {
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;
@@ -613,7 +617,7 @@ PJ_DEF(void) pj_dns_packet_dup(pj_pool_t *pool,
PJ_ASSERT_ON_FAIL(pool && p && p_dst, return);
/* 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));
/* Initialize section counts in the target packet to zero.
@@ -628,7 +632,8 @@ PJ_DEF(void) pj_dns_packet_dup(pj_pool_t *pool,
/* 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) {
copy_query(pool, &dst->q[i], &p->q[i],
@@ -639,7 +644,8 @@ PJ_DEF(void) pj_dns_packet_dup(pj_pool_t *pool,
/* 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) {
copy_rr(pool, &dst->ans[i], &p->ans[i],
@@ -650,7 +656,8 @@ PJ_DEF(void) pj_dns_packet_dup(pj_pool_t *pool,
/* 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) {
copy_rr(pool, &dst->ns[i], &p->ns[i],
@@ -661,7 +668,8 @@ PJ_DEF(void) pj_dns_packet_dup(pj_pool_t *pool,
/* 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) {
copy_rr(pool, &dst->arr[i], &p->arr[i],
diff --git a/pjlib-util/src/pjlib-util/resolver.c b/pjlib-util/src/pjlib-util/resolver.c
index d4a950e2..f2578e48 100644
--- a/pjlib-util/src/pjlib-util/resolver.c
+++ b/pjlib-util/src/pjlib-util/resolver.c
@@ -243,7 +243,7 @@ PJ_DEF(pj_status_t) pj_dns_resolver_create( pj_pool_factory *pf,
return PJ_ENOMEM;
/* Create pool and name */
- resv = pj_pool_zalloc(pool, sizeof(struct pj_dns_resolver));
+ resv = PJ_POOL_ZALLOC_T(pool, struct pj_dns_resolver);
resv->pool = pool;
resv->udp_sock = PJ_INVALID_SOCKET;
pj_strdup2_with_null(pool, &resv->name, name);
@@ -337,7 +337,8 @@ PJ_DEF(pj_status_t) pj_dns_resolver_destroy( pj_dns_resolver *resolver,
it = pj_hash_first(resolver->hquerybyid, &it_buf);
while (it) {
- pj_dns_async_query *q = pj_hash_this(resolver->hquerybyid, it);
+ pj_dns_async_query *q = (pj_dns_async_query *)
+ pj_hash_this(resolver->hquerybyid, it);
pj_dns_async_query *cq;
if (q->cb)
(*q->cb)(q->user_data, PJ_ECANCELLED, NULL);
@@ -497,7 +498,7 @@ static pj_dns_async_query *alloc_qnode(pj_dns_resolver *resolver,
pj_list_erase(q);
pj_bzero(q, sizeof(*q));
} else {
- q = pj_pool_zalloc(resolver->pool, sizeof(*q));
+ q = PJ_POOL_ZALLOC_T(resolver->pool, pj_dns_async_query);
}
/* Init query */
@@ -657,7 +658,8 @@ PJ_DEF(pj_status_t) pj_dns_resolver_start_query( pj_dns_resolver *resolver,
* and the cached entry has not expired.
*/
hval = 0;
- cache = pj_hash_get(resolver->hrescache, &key, sizeof(key), &hval);
+ cache = (struct cached_res *) pj_hash_get(resolver->hrescache, &key,
+ sizeof(key), &hval);
if (cache) {
/* We've found a cached entry. */
@@ -702,7 +704,8 @@ PJ_DEF(pj_status_t) pj_dns_resolver_start_query( pj_dns_resolver *resolver,
}
/* Next, check if we have pending query on the same resource */
- q = pj_hash_get(resolver->hquerybyres, &key, sizeof(key), NULL);
+ q = (pj_dns_async_query *) pj_hash_get(resolver->hquerybyres, &key,
+ sizeof(key), NULL);
if (q) {
/* Yes, there's another pending query to the same key.
* Just create a new child query and add this query to
@@ -941,7 +944,8 @@ static void update_res_cache(pj_dns_resolver *resolver,
/* If status is unsuccessful, clear the same entry from the cache */
if (status != PJ_SUCCESS) {
- cache = pj_hash_get(resolver->hrescache, key, sizeof(*key), &hval);
+ cache = (struct cached_res *) pj_hash_get(resolver->hrescache, key,
+ sizeof(*key), &hval);
if (cache)
pj_list_push_back(&resolver->res_free_nodes, cache);
pj_hash_set(NULL, resolver->hrescache, key, sizeof(*key), hval, NULL);
@@ -976,7 +980,8 @@ static void update_res_cache(pj_dns_resolver *resolver,
/* If TTL is zero, clear the same entry in the hash table */
if (ttl == 0) {
- cache = pj_hash_get(resolver->hrescache, key, sizeof(*key), &hval);
+ cache = (struct cached_res *) pj_hash_get(resolver->hrescache, key,
+ sizeof(*key), &hval);
if (cache)
pj_list_push_back(&resolver->res_free_nodes, cache);
pj_hash_set(NULL, resolver->hrescache, key, sizeof(*key), hval, NULL);
@@ -984,13 +989,14 @@ static void update_res_cache(pj_dns_resolver *resolver,
}
/* Get a cache response entry */
- cache = pj_hash_get(resolver->hrescache, key, sizeof(*key), &hval);
+ cache = (struct cached_res *) pj_hash_get(resolver->hrescache, key,
+ sizeof(*key), &hval);
if (cache == NULL) {
if (!pj_list_empty(&resolver->res_free_nodes)) {
cache = resolver->res_free_nodes.next;
pj_list_erase(cache);
} else {
- cache = pj_pool_zalloc(resolver->pool, sizeof(*cache));
+ cache = PJ_POOL_ZALLOC_T(resolver->pool, struct cached_res);
}
}
@@ -1040,7 +1046,7 @@ static void on_timeout( pj_timer_heap_t *timer_heap,
PJ_UNUSED_ARG(timer_heap);
- q = entry->user_data;
+ q = (pj_dns_async_query *) entry->user_data;
resolver = q->resolver;
pj_mutex_lock(resolver->mutex);
@@ -1124,7 +1130,7 @@ static void on_read_complete(pj_ioqueue_key_t *key,
PJ_USE_EXCEPTION;
- resolver = pj_ioqueue_get_user_data(key);
+ resolver = (pj_dns_resolver *) pj_ioqueue_get_user_data(key);
pj_mutex_lock(resolver->mutex);
@@ -1187,7 +1193,8 @@ static void on_read_complete(pj_ioqueue_key_t *key,
}
/* Find the query based on the transaction ID */
- q = pj_hash_get(resolver->hquerybyid, &dns_pkt->hdr.id,
+ q = (pj_dns_async_query*)
+ pj_hash_get(resolver->hquerybyid, &dns_pkt->hdr.id,
sizeof(dns_pkt->hdr.id), NULL);
if (!q) {
PJ_LOG(5,(resolver->name.ptr,
@@ -1371,7 +1378,8 @@ PJ_DEF(void) pj_dns_resolver_dump(pj_dns_resolver *resolver,
pj_hash_iterator_t itbuf, *it;
it = pj_hash_first(resolver->hrescache, &itbuf);
while (it) {
- struct cached_res *cache = pj_hash_this(resolver->hrescache, it);
+ struct cached_res *cache;
+ cache = (struct cached_res*)pj_hash_this(resolver->hrescache, it);
PJ_LOG(3,(resolver->name.ptr,
" Type %s: %s",
pj_dns_get_type_name(cache->key.qtype),
@@ -1389,7 +1397,7 @@ PJ_DEF(void) pj_dns_resolver_dump(pj_dns_resolver *resolver,
it = pj_hash_first(resolver->hquerybyid, &itbuf);
while (it) {
struct pj_dns_async_query *q;
- q = pj_hash_this(resolver->hquerybyid, it);
+ q = (pj_dns_async_query*) pj_hash_this(resolver->hquerybyid, it);
PJ_LOG(3,(resolver->name.ptr,
" Type %s: %s",
pj_dns_get_type_name(q->key.qtype),
diff --git a/pjlib-util/src/pjlib-util/srv_resolver.c b/pjlib-util/src/pjlib-util/srv_resolver.c
index 0eb084f3..df518781 100644
--- a/pjlib-util/src/pjlib-util/srv_resolver.c
+++ b/pjlib-util/src/pjlib-util/srv_resolver.c
@@ -381,7 +381,7 @@ static void dns_callback(void *user_data,
pj_status_t status,
pj_dns_parsed_packet *pkt)
{
- pj_dns_srv_resolver_job *query_job = user_data;
+ pj_dns_srv_resolver_job *query_job = (pj_dns_srv_resolver_job*) user_data;
unsigned i;
/* Proceed to next stage */
diff --git a/pjlib-util/src/pjlib-util/string.c b/pjlib-util/src/pjlib-util/string.c
index 860d1bca..f37e71e8 100644
--- a/pjlib-util/src/pjlib-util/string.c
+++ b/pjlib-util/src/pjlib-util/string.c
@@ -31,7 +31,7 @@ PJ_DEF(pj_str_t) pj_str_unescape( pj_pool_t *pool, const pj_str_t *src_str)
if (pj_strchr(src_str, '%')==NULL)
return *src_str;
- dst = dst_str.ptr = pj_pool_alloc(pool, src_str->slen);
+ dst = dst_str.ptr = (char*) pj_pool_alloc(pool, src_str->slen);
while (src != end) {
if (*src == '%' && src < end-2 && pj_isxdigit(*(src+1)) &&
diff --git a/pjlib-util/src/pjlib-util/stun_simple.c b/pjlib-util/src/pjlib-util/stun_simple.c
index 6ab6dbbe..e06d0b1e 100644
--- a/pjlib-util/src/pjlib-util/stun_simple.c
+++ b/pjlib-util/src/pjlib-util/stun_simple.c
@@ -35,7 +35,7 @@ PJ_DEF(pj_status_t) pjstun_create_bind_req( pj_pool_t *pool,
PJ_CHECK_STACK();
- hdr = pj_pool_calloc(pool, 1, sizeof(pjstun_msg_hdr));
+ hdr = PJ_POOL_ZALLOC_T(pool, pjstun_msg_hdr);
if (!hdr)
return PJ_ENOMEM;
diff --git a/pjlib-util/src/pjlib-util/stun_simple_client.c b/pjlib-util/src/pjlib-util/stun_simple_client.c
index 7d6e472b..7ec5b14d 100644
--- a/pjlib-util/src/pjlib-util/stun_simple_client.c
+++ b/pjlib-util/src/pjlib-util/stun_simple_client.c
@@ -41,7 +41,7 @@ PJ_DECL(pj_status_t) pjstun_get_mapped_addr( pj_pool_factory *pf,
pj_sockaddr_in srv_addr[2];
int i, j, send_cnt = 0;
pj_pool_t *pool;
- struct {
+ struct query_rec {
struct {
pj_uint32_t mapped_addr;
pj_uint32_t mapped_port;
@@ -61,7 +61,7 @@ PJ_DECL(pj_status_t) pjstun_get_mapped_addr( pj_pool_factory *pf,
/* Allocate client records */
- rec = pj_pool_calloc(pool, sock_cnt, sizeof(*rec));
+ rec = (struct query_rec*) pj_pool_calloc(pool, sock_cnt, sizeof(*rec));
if (!rec) {
status = PJ_ENOMEM;
goto on_error;
@@ -97,7 +97,7 @@ PJ_DECL(pj_status_t) pjstun_get_mapped_addr( pj_pool_factory *pf,
/* Send messages to servers that has not given us response. */
for (i=0; i<sock_cnt && status==PJ_SUCCESS; ++i) {
for (j=0; j<2 && status==PJ_SUCCESS; ++j) {
- pjstun_msg_hdr *msg_hdr = out_msg;
+ pjstun_msg_hdr *msg_hdr = (pjstun_msg_hdr*) out_msg;
pj_ssize_t sent_len;
if (rec[i].srv[j].mapped_port != 0)
@@ -194,7 +194,8 @@ PJ_DECL(pj_status_t) pjstun_get_mapped_addr( pj_pool_factory *pf,
continue;
}
- attr = (void*)pjstun_msg_find_attr(&msg, PJSTUN_ATTR_MAPPED_ADDR);
+ attr = (pjstun_mapped_addr_attr*)
+ pjstun_msg_find_attr(&msg, PJSTUN_ATTR_MAPPED_ADDR);
if (!attr) {
status = PJLIB_UTIL_ESTUNNOMAP;
continue;
diff --git a/pjlib-util/src/pjlib-util/xml.c b/pjlib-util/src/pjlib-util/xml.c
index 8480f0ef..77abf341 100644
--- a/pjlib-util/src/pjlib-util/xml.c
+++ b/pjlib-util/src/pjlib-util/xml.c
@@ -37,7 +37,7 @@ static pj_xml_node *alloc_node( pj_pool_t *pool )
{
pj_xml_node *node;
- node = pj_pool_zalloc(pool, sizeof(pj_xml_node));
+ node = PJ_POOL_ZALLOC_T(pool, pj_xml_node);
pj_list_init( &node->attr_head );
pj_list_init( &node->node_head );
@@ -46,7 +46,7 @@ static pj_xml_node *alloc_node( pj_pool_t *pool )
static pj_xml_attr *alloc_attr( pj_pool_t *pool )
{
- return pj_pool_zalloc(pool, sizeof(pj_xml_attr));
+ return PJ_POOL_ZALLOC_T(pool, pj_xml_attr);
}
/* This is a recursive function! */
@@ -393,7 +393,7 @@ PJ_DEF(pj_xml_node*) pj_xml_find( pj_xml_node *parent, const pj_str_t *name,
const void *data,
pj_bool_t (*match)(pj_xml_node *, const void*))
{
- pj_xml_node *head = (void*)&parent->node_head, *node = head->next;
+ pj_xml_node *head = (pj_xml_node*) &parent->node_head, *node = head->next;
while (node != (void*)head) {
if (name && pj_stricmp(&node->name, name)==0) {