|
|
e662f13 |
From nobody Mon Sep 17 00:00:00 2001
|
|
|
e662f13 |
From: Paul P Komkoff Jr <i@stingr.net>
|
|
|
e662f13 |
Date: Sat, 10 Jun 2006 20:49:45 +0400
|
|
|
e662f13 |
Subject: [PATCH 2/8] Fix an "invalid lvalue in assignment" compile error.
|
|
|
e662f13 |
|
|
|
e662f13 |
---
|
|
|
e662f13 |
|
|
|
e662f13 |
lib/ftchash.c | 2 +-
|
|
|
e662f13 |
lib/ftio.c | 4 ++--
|
|
|
e662f13 |
lib/ftlib.h | 3 ++-
|
|
|
e662f13 |
lib/fttlv.c | 34 +++++++++++++++++-----------------
|
|
|
e662f13 |
lib/support.c | 5 +++++
|
|
|
e662f13 |
5 files changed, 27 insertions(+), 21 deletions(-)
|
|
|
e662f13 |
|
|
|
e662f13 |
075301dae1b92110e6cc339b0df88b7fc82c31a6
|
|
|
e662f13 |
diff --git a/lib/ftchash.c b/lib/ftchash.c
|
|
|
e662f13 |
index 9cc7efa..28bafbf 100644
|
|
|
e662f13 |
--- a/lib/ftchash.c
|
|
|
e662f13 |
+++ b/lib/ftchash.c
|
|
|
e662f13 |
@@ -326,7 +326,7 @@ void *ftchash_foreach(struct ftchash *ft
|
|
|
e662f13 |
(char*)ftch->traverse_chunk->base+ftch->traverse_chunk->next) {
|
|
|
e662f13 |
|
|
|
e662f13 |
ret = ftch->traverse_rec;
|
|
|
e662f13 |
- (char*)ftch->traverse_rec += ftch->d_size;
|
|
|
e662f13 |
+ ftch->traverse_rec = vpadd(ftch->traverse_rec, ftch->d_size);
|
|
|
e662f13 |
return ret;
|
|
|
e662f13 |
|
|
|
e662f13 |
} else {
|
|
|
e662f13 |
diff --git a/lib/ftio.c b/lib/ftio.c
|
|
|
e662f13 |
index f6c739c..1082416 100644
|
|
|
e662f13 |
--- a/lib/ftio.c
|
|
|
e662f13 |
+++ b/lib/ftio.c
|
|
|
e662f13 |
@@ -2267,7 +2267,7 @@ int readn(register int fd, register void
|
|
|
e662f13 |
break;
|
|
|
e662f13 |
|
|
|
e662f13 |
nleft -= nread;
|
|
|
e662f13 |
- (char*)ptr += nread;
|
|
|
e662f13 |
+ ptr = vpadd(ptr, nread);
|
|
|
e662f13 |
}
|
|
|
e662f13 |
return (nbytes - nleft);
|
|
|
e662f13 |
} /* readn */
|
|
|
e662f13 |
@@ -2292,7 +2292,7 @@ int writen(register int fd, register voi
|
|
|
e662f13 |
return(nwritten); /* error */
|
|
|
e662f13 |
|
|
|
e662f13 |
nleft -= nwritten;
|
|
|
e662f13 |
- (char*)ptr += nwritten;
|
|
|
e662f13 |
+ ptr = vpadd(ptr,nwritten);
|
|
|
e662f13 |
}
|
|
|
e662f13 |
return(nbytes - nleft);
|
|
|
e662f13 |
} /* writen */
|
|
|
e662f13 |
diff --git a/lib/ftlib.h b/lib/ftlib.h
|
|
|
e662f13 |
index f91ad0a..66bf2f3 100644
|
|
|
e662f13 |
--- a/lib/ftlib.h
|
|
|
e662f13 |
+++ b/lib/ftlib.h
|
|
|
e662f13 |
@@ -152,7 +152,6 @@ #define FT_PDU_V8_11_MAXFLOWS 44 /* max
|
|
|
e662f13 |
#define FT_PDU_V8_12_MAXFLOWS 44 /* max records in V8 DST_PREFIX_TOS packet */
|
|
|
e662f13 |
#define FT_PDU_V8_13_MAXFLOWS 35 /* max records in V8 PREFIX_TOS packet */
|
|
|
e662f13 |
#define FT_PDU_V8_14_MAXFLOWS 35 /* max records in V8 PREFIX_PORT_TOS packet */
|
|
|
e662f13 |
-
|
|
|
e662f13 |
#define FT_PDU_V8_1_VERSION 2 /* version of AS packet */
|
|
|
e662f13 |
#define FT_PDU_V8_2_VERSION 2 /* version of PROTO PORT packet */
|
|
|
e662f13 |
#define FT_PDU_V8_3_VERSION 2 /* version of SRC PREFIX packet */
|
|
|
e662f13 |
@@ -3029,6 +3028,8 @@ #ifndef IN_CLASSD_SSM
|
|
|
e662f13 |
#define IN_CLASSD_SSM(i) (((u_int32_t)(i) & 0xff000000) == 0xe8000000)
|
|
|
e662f13 |
#endif /* IN_CLASSD_SSM */
|
|
|
e662f13 |
|
|
|
e662f13 |
+void *vpadd(const void* v, const int change);
|
|
|
e662f13 |
+
|
|
|
e662f13 |
/* MACHINE DEPENDANT */
|
|
|
e662f13 |
#define fmt_uint fmt_uint32
|
|
|
e662f13 |
|
|
|
e662f13 |
diff --git a/lib/fttlv.c b/lib/fttlv.c
|
|
|
e662f13 |
index 7035813..330a783 100644
|
|
|
e662f13 |
--- a/lib/fttlv.c
|
|
|
e662f13 |
+++ b/lib/fttlv.c
|
|
|
e662f13 |
@@ -68,10 +68,10 @@ int fttlv_enc_uint32(void *buf, int buf_
|
|
|
e662f13 |
}
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(&t, buf, 2);
|
|
|
e662f13 |
- (char*)buf+= 2;
|
|
|
e662f13 |
+ buf = vpadd(buf, 2);
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(&len, buf, 2);
|
|
|
e662f13 |
- (char*)buf+= 2;
|
|
|
e662f13 |
+ buf = vpadd(buf, 2);
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(&v, buf, 4);
|
|
|
e662f13 |
|
|
|
e662f13 |
@@ -107,10 +107,10 @@ int fttlv_enc_uint16(void *buf, int buf_
|
|
|
e662f13 |
}
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(&t, buf, 2);
|
|
|
e662f13 |
- (char*)buf+= 2;
|
|
|
e662f13 |
+ buf = vpadd(buf, 2);
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(&len, buf, 2);
|
|
|
e662f13 |
- (char*)buf+= 2;
|
|
|
e662f13 |
+ buf = vpadd(buf, 2);
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(&v, buf, 2);
|
|
|
e662f13 |
|
|
|
e662f13 |
@@ -145,10 +145,10 @@ int fttlv_enc_uint8(void *buf, int buf_s
|
|
|
e662f13 |
}
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(&t, buf, 2);
|
|
|
e662f13 |
- (char*)buf+= 2;
|
|
|
e662f13 |
+ buf = vpadd(buf, 2);
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(&len, buf, 2);
|
|
|
e662f13 |
- (char*)buf+= 2;
|
|
|
e662f13 |
+ buf = vpadd(buf, 2);
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(&v, buf, 1);
|
|
|
e662f13 |
|
|
|
e662f13 |
@@ -183,10 +183,10 @@ int fttlv_enc_str(void *buf, int buf_siz
|
|
|
e662f13 |
}
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(&t, buf, 2);
|
|
|
e662f13 |
- (char*)buf+= 2;
|
|
|
e662f13 |
+ buf = vpadd(buf, 2);
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(&len, buf, 2);
|
|
|
e662f13 |
- (char*)buf+= 2;
|
|
|
e662f13 |
+ buf = vpadd(buf, 2);
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(v, buf, len);
|
|
|
e662f13 |
|
|
|
e662f13 |
@@ -230,16 +230,16 @@ int fttlv_enc_ifname(void *buf, int buf_
|
|
|
e662f13 |
return -1;
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(&t, buf, 2);
|
|
|
e662f13 |
- (char*)buf+= 2;
|
|
|
e662f13 |
+ buf = vpadd(buf, 2);
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(&len, buf, 2);
|
|
|
e662f13 |
- (char*)buf+= 2;
|
|
|
e662f13 |
+ buf = vpadd(buf, 2);
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(&ip, buf, 4);
|
|
|
e662f13 |
- (char*)buf += 4;
|
|
|
e662f13 |
+ buf = vpadd(buf, 4);
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(&ifIndex, buf, 2);
|
|
|
e662f13 |
- (char*)buf += 2;
|
|
|
e662f13 |
+ buf = vpadd(buf, 2);
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(name, buf, n);
|
|
|
e662f13 |
|
|
|
e662f13 |
@@ -287,19 +287,19 @@ int fttlv_enc_ifalias(void *buf, int buf
|
|
|
e662f13 |
}
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(&t, buf, 2);
|
|
|
e662f13 |
- (char*)buf+= 2;
|
|
|
e662f13 |
+ buf = vpadd(buf, 2);
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(&len, buf, 2);
|
|
|
e662f13 |
- (char*)buf+= 2;
|
|
|
e662f13 |
+ buf = vpadd(buf, 2);
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(&ip, buf, 4);
|
|
|
e662f13 |
- (char*)buf += 4;
|
|
|
e662f13 |
+ buf = vpadd(buf, 4);
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(&entries, buf, 2);
|
|
|
e662f13 |
- (char*)buf += 2;
|
|
|
e662f13 |
+ buf = vpadd(buf, 2);
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(ifIndex_list, buf, esize);
|
|
|
e662f13 |
- (char*)buf += esize;
|
|
|
e662f13 |
+ buf = vpadd(buf, esize);
|
|
|
e662f13 |
|
|
|
e662f13 |
bcopy(name, buf, n);
|
|
|
e662f13 |
|
|
|
e662f13 |
diff --git a/lib/support.c b/lib/support.c
|
|
|
e662f13 |
index a32ffe7..2e1db9f 100644
|
|
|
e662f13 |
--- a/lib/support.c
|
|
|
e662f13 |
+++ b/lib/support.c
|
|
|
e662f13 |
@@ -736,3 +736,8 @@ int udp_cksum(struct ip *ip, struct udph
|
|
|
e662f13 |
return sum;
|
|
|
e662f13 |
} /* udp_cksum */
|
|
|
e662f13 |
|
|
|
e662f13 |
+// void pointer add
|
|
|
e662f13 |
+
|
|
|
e662f13 |
+void * vpadd(const void *v, const int change) {
|
|
|
e662f13 |
+ return (void *) (((char*) v) + change);
|
|
|
e662f13 |
+}
|
|
|
e662f13 |
--
|
|
|
e662f13 |
1.3.3
|
|
|
e662f13 |
|