[Olsr-cvs] olsrd-current/src hna_set.c, 1.24, 1.25 lq_avl.c, 1.15, 1.16 lq_packet.c, 1.30, 1.31 lq_packet.h, 1.9, 1.10 lq_route.c, 1.59, 1.60 rebuild_packet.c, 1.24, 1.25
Bernd Petrovitsch
(spam-protected)
Fri Nov 16 23:56:56 CET 2007
Update of /cvsroot/olsrd/olsrd-current/src
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15005/src
Modified Files:
hna_set.c lq_avl.c lq_packet.c lq_packet.h lq_route.c
rebuild_packet.c
Log Message:
* added -Wcast-qual: this killed lots of unnecessary type-casts
Index: lq_route.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/lq_route.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -d -r1.59 -r1.60
*** lq_route.c 16 Nov 2007 21:43:55 -0000 1.59
--- lq_route.c 16 Nov 2007 22:56:54 -0000 1.60
***************
*** 70,78 ****
avl_comp_etx (const void *etx1, const void *etx2)
{
! if (*(float *)etx1 < *(float *)etx2) {
return -1;
}
! if (*(float *)etx1 > *(float *)etx2) {
return +1;
}
--- 70,78 ----
avl_comp_etx (const void *etx1, const void *etx2)
{
! if (*(const float *)etx1 < *(const float *)etx2) {
return -1;
}
! if (*(const float *)etx1 > *(const float *)etx2) {
return +1;
}
Index: lq_packet.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/lq_packet.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** lq_packet.h 16 Nov 2007 21:43:55 -0000 1.9
--- lq_packet.h 16 Nov 2007 22:56:54 -0000 1.10
***************
*** 142,154 ****
};
! static INLINE void pkt_get_u8(const olsr_u8_t **p, olsr_u8_t *var) { *var = *(olsr_u8_t *)(*p); *p += sizeof(olsr_u8_t); }
! static INLINE void pkt_get_u16(const olsr_u8_t **p, olsr_u16_t *var) { *var = ntohs(*(olsr_u16_t *)(*p)); *p += sizeof(olsr_u16_t); }
! static INLINE void pkt_get_u32(const olsr_u8_t **p, olsr_u32_t *var) { *var = ntohl(*(olsr_u32_t *)(p)); *p += sizeof(olsr_u32_t); }
! static INLINE void pkt_get_s8(const olsr_u8_t **p, olsr_8_t *var) { *var = *(olsr_8_t *)(*p); *p += sizeof(olsr_8_t); }
! static INLINE void pkt_get_s16(const olsr_u8_t **p, olsr_16_t *var) { *var = ntohs(*(olsr_16_t *)(*p)); *p += sizeof(olsr_16_t); }
! static INLINE void pkt_get_s32(const olsr_u8_t **p, olsr_32_t *var) { *var = ntohl(*(olsr_32_t *)(*p)); *p += sizeof(olsr_32_t); }
! static INLINE void pkt_get_double(const olsr_u8_t **p, double *var) { *var = me_to_double(**p); *p += sizeof(olsr_u8_t); }
! static INLINE void pkt_get_ipaddress(const olsr_u8_t **p, union olsr_ip_addr *var) { memcpy(var, *p, olsr_cnf->ipsize); *p += olsr_cnf->ipsize; }
! static INLINE void pkt_get_lq(const olsr_u8_t **p, double *var) { *var = (double)**p / 255.0; *p += sizeof(olsr_u8_t); }
static INLINE void pkt_ignore_u8(const olsr_u8_t **p) { *p += sizeof(olsr_u8_t); }
--- 142,154 ----
};
! static INLINE void pkt_get_u8(const olsr_u8_t **p, olsr_u8_t *var) { *var = *(const olsr_u8_t *)(*p); *p += sizeof(olsr_u8_t); }
! static INLINE void pkt_get_u16(const olsr_u8_t **p, olsr_u16_t *var) { *var = ntohs(*(const olsr_u16_t *)(*p)); *p += sizeof(olsr_u16_t); }
! static INLINE void pkt_get_u32(const olsr_u8_t **p, olsr_u32_t *var) { *var = ntohl(*(const olsr_u32_t *)(p)); *p += sizeof(olsr_u32_t); }
! static INLINE void pkt_get_s8(const olsr_u8_t **p, olsr_8_t *var) { *var = *(const olsr_8_t *)(*p); *p += sizeof(olsr_8_t); }
! static INLINE void pkt_get_s16(const olsr_u8_t **p, olsr_16_t *var) { *var = ntohs(*(const olsr_16_t *)(*p)); *p += sizeof(olsr_16_t); }
! static INLINE void pkt_get_s32(const olsr_u8_t **p, olsr_32_t *var) { *var = ntohl(*(const olsr_32_t *)(*p)); *p += sizeof(olsr_32_t); }
! static INLINE void pkt_get_double(const olsr_u8_t **p, double *var) { *var = me_to_double(**p); *p += sizeof(olsr_u8_t); }
! static INLINE void pkt_get_ipaddress(const olsr_u8_t **p, union olsr_ip_addr *var) { memcpy(var, *p, olsr_cnf->ipsize); *p += olsr_cnf->ipsize; }
! static INLINE void pkt_get_lq(const olsr_u8_t **p, double *var) { *var = (const double)**p / 255.0; *p += sizeof(olsr_u8_t); }
static INLINE void pkt_ignore_u8(const olsr_u8_t **p) { *p += sizeof(olsr_u8_t); }
Index: rebuild_packet.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/rebuild_packet.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** rebuild_packet.c 16 Nov 2007 21:43:55 -0000 1.24
--- rebuild_packet.c 16 Nov 2007 22:56:54 -0000 1.25
***************
*** 139,143 ****
//COPY_IP(&hna_pairs->net, &haddr6->addr);
hna_pairs->net.v6 = haddr6->addr;
! hna_pairs->netmask.v6 = olsr_netmask_to_prefix((union olsr_ip_addr *)&haddr6->netmask);
hna_pairs->next = tmp_pairs;
--- 139,143 ----
//COPY_IP(&hna_pairs->net, &haddr6->addr);
hna_pairs->net.v6 = haddr6->addr;
! hna_pairs->netmask.v6 = olsr_netmask_to_prefix((const union olsr_ip_addr *)&haddr6->netmask);
hna_pairs->next = tmp_pairs;
***************
*** 362,366 ****
hello_chgestruct(struct hello_message *hmsg, const union olsr_message *m)
{
! union olsr_ip_addr *hadr;
struct hello_neighbor *nb;
--- 362,366 ----
hello_chgestruct(struct hello_message *hmsg, const union olsr_message *m)
{
! const union olsr_ip_addr *hadr;
struct hello_neighbor *nb;
***************
*** 392,402 ****
for (hinf = m->v4.message.hello.hell_info;
! (char *)hinf < ((char *)m + (ntohs(m->v4.olsr_msgsize)));
! hinf = (struct hellinfo *)((char *)hinf + ntohs(hinf->size)))
{
! for (hadr = (union olsr_ip_addr *)&hinf->neigh_addr;
! (char *)hadr < (char *)hinf + ntohs(hinf->size);
! hadr = (union olsr_ip_addr *)&hadr->v6.s6_addr[4])
{
nb = olsr_malloc(sizeof (struct hello_neighbor), "HELLO chgestruct");
--- 392,402 ----
for (hinf = m->v4.message.hello.hell_info;
! (const char *)hinf < ((const char *)m + (ntohs(m->v4.olsr_msgsize)));
! hinf = (const struct hellinfo *)((const char *)hinf + ntohs(hinf->size)))
{
! for (hadr = (const union olsr_ip_addr *)&hinf->neigh_addr;
! (const char *)hadr < (const char *)hinf + ntohs(hinf->size);
! hadr = (const union olsr_ip_addr *)&hadr->v6.s6_addr[4])
{
nb = olsr_malloc(sizeof (struct hello_neighbor), "HELLO chgestruct");
***************
*** 439,448 ****
for (hinf6 = m->v6.message.hello.hell_info;
! (char *)hinf6 < ((char *)m + (ntohs(m->v6.olsr_msgsize)));
! hinf6 = (struct hellinfo6 *)((char *)hinf6 + ntohs(hinf6->size)))
{
! for (hadr = (union olsr_ip_addr *)hinf6->neigh_addr;
! (char *)hadr < (char *)hinf6 + ntohs(hinf6->size);
hadr++)
{
--- 439,448 ----
for (hinf6 = m->v6.message.hello.hell_info;
! (const char *)hinf6 < ((const char *)m + (ntohs(m->v6.olsr_msgsize)));
! hinf6 = (const struct hellinfo6 *)((const char *)hinf6 + ntohs(hinf6->size)))
{
! for (hadr = (const union olsr_ip_addr *)hinf6->neigh_addr;
! (const char *)hadr < (const char *)hinf6 + ntohs(hinf6->size);
hadr++)
{
Index: lq_packet.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/lq_packet.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** lq_packet.c 16 Nov 2007 21:43:55 -0000 1.30
--- lq_packet.c 16 Nov 2007 22:56:54 -0000 1.31
***************
*** 589,596 ****
limit = ser + size;
while (curr < limit) {
! struct lq_hello_info_header *info_head = (struct lq_hello_info_header *)curr;
const unsigned char *limit2 = curr + ntohs(info_head->size);
! curr = (unsigned char *)(info_head + 1);
while (curr < limit2) {
struct hello_neighbor *neigh = olsr_malloc(sizeof (struct hello_neighbor),
--- 589,596 ----
limit = ser + size;
while (curr < limit) {
! const struct lq_hello_info_header *info_head = (const struct lq_hello_info_header *)curr;
const unsigned char *limit2 = curr + ntohs(info_head->size);
! curr = (const unsigned char *)(info_head + 1);
while (curr < limit2) {
struct hello_neighbor *neigh = olsr_malloc(sizeof (struct hello_neighbor),
Index: hna_set.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/hna_set.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** hna_set.c 8 Nov 2007 22:47:41 -0000 1.24
--- hna_set.c 16 Nov 2007 22:56:54 -0000 1.25
***************
*** 86,90 ****
{
if (olsr_cnf->ip_version == AF_INET) {
! return olsr_netmask_to_prefix((union olsr_ip_addr *)&hna->A_netmask.v4);
} else {
return hna->A_netmask.v6;
--- 86,90 ----
{
if (olsr_cnf->ip_version == AF_INET) {
! return olsr_netmask_to_prefix((const union olsr_ip_addr *)&hna->A_netmask.v4);
} else {
return hna->A_netmask.v6;
Index: lq_avl.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/lq_avl.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** lq_avl.c 11 Nov 2007 22:55:17 -0000 1.15
--- lq_avl.c 16 Nov 2007 22:56:54 -0000 1.16
***************
*** 86,90 ****
}
! else if (*(unsigned int *)key > *(unsigned int *)node->key)
{
if (node->right != NULL)
--- 86,90 ----
}
! else if (*(const unsigned int *)key > *(const unsigned int *)node->key)
{
if (node->right != NULL)
More information about the Olsr-cvs
mailing list