www.pudn.com > leach.rar > ns227-gcc34.patch, change:2006-10-23,size:12691b
diff -ur ns-allinone-2.27.orig/nam-1.10/agent.h ns-allinone-2.27/nam-1.10/agent.h
--- ns-allinone-2.27.orig/nam-1.10/agent.h 2004-01-12 19:53:29.000000000 -0500
+++ ns-allinone-2.27/nam-1.10/agent.h 2004-12-16 08:44:17.264152976 -0500
@@ -70,7 +70,7 @@
inline double width() {return width_;}
inline double height() {return height_;}
virtual void findClosestCornertoPoint(double x, double y,
- double &corner_x, double &corner_y) const = NULL;
+ double &corner_x, double &corner_y) const = 0;
virtual void place(double x, double y);
void label(const char* name, int anchor);
void color(const char* name);
diff -ur ns-allinone-2.27.orig/ns-2.27/diffusion/diff_rate.cc ns-allinone-2.27/ns-2.27/diffusion/diff_rate.cc
--- ns-allinone-2.27.orig/ns-2.27/diffusion/diff_rate.cc 2004-01-12 19:57:58.000000000 -0500
+++ ns-allinone-2.27/ns-2.27/diffusion/diff_rate.cc 2004-12-16 08:43:45.585968792 -0500
@@ -370,7 +370,7 @@
INTF_INSERT(routing_table[dtype].active, OutPtr);
routing_table[dtype].num_active ++;
} else {
- GRAD_TMOUT(RetVal.cur) = max(GRAD_TMOUT(RetVal.cur),
+ GRAD_TMOUT(RetVal.cur) = MAX(GRAD_TMOUT(RetVal.cur),
dfh->ts_ + INTEREST_TIMEOUT);
}
@@ -789,7 +789,7 @@
if (RetVal.cur != NULL) {
cur_out = (Out_List *)(RetVal.cur);
GRADIENT(cur_out) = ORIGINAL;
- GRAD_TMOUT(RetVal.cur) = max(GRAD_TMOUT(RetVal.cur),
+ GRAD_TMOUT(RetVal.cur) = MAX(GRAD_TMOUT(RetVal.cur),
dfh->ts_ + INTEREST_TIMEOUT);
NUM_POS_RECV(cur_out)++;
} else {
diff -ur ns-allinone-2.27.orig/ns-2.27/diffusion/diffusion.h ns-allinone-2.27/ns-2.27/diffusion/diffusion.h
--- ns-allinone-2.27.orig/ns-2.27/diffusion/diffusion.h 2004-01-12 19:57:58.000000000 -0500
+++ ns-allinone-2.27/ns-2.27/diffusion/diffusion.h 2004-12-16 08:43:45.607965448 -0500
@@ -75,7 +75,7 @@
#define SEND_MESSAGE(x,y,z) send_to_dmux(prepare_message(x,y,z), 0)
-#define max(a,b) (((a)<(b))?(b):(a))
+#define MAX(a,b) (((a)<(b))?(b):(a))
class DiffusionAgent;
diff -ur ns-allinone-2.27.orig/ns-2.27/diffusion/routing_table.cc ns-allinone-2.27/ns-2.27/diffusion/routing_table.cc
--- ns-allinone-2.27.orig/ns-2.27/diffusion/routing_table.cc 2004-01-12 19:57:59.000000000 -0500
+++ ns-allinone-2.27/ns-2.27/diffusion/routing_table.cc 2004-12-16 08:43:45.608965296 -0500
@@ -129,7 +129,7 @@
int most = 0;
for (cur=iif; cur!=NULL; cur = IN_NEXT(cur)) {
- most = max(most,NEW_ORG_RECV(cur));
+ most = MAX(most,NEW_ORG_RECV(cur));
}
return most;
}
diff -ur ns-allinone-2.27.orig/ns-2.27/diffusion3/lib/nr/nr.hh ns-allinone-2.27/ns-2.27/diffusion3/lib/nr/nr.hh
--- ns-allinone-2.27.orig/ns-2.27/diffusion3/lib/nr/nr.hh 2004-01-12 19:58:05.000000000 -0500
+++ ns-allinone-2.27/ns-2.27/diffusion3/lib/nr/nr.hh 2004-12-16 08:43:45.631961800 -0500
@@ -43,7 +43,8 @@
typedef signed int int32_t;
#endif
typedef signed short int16_t;
-#if defined (sparc)
+// #if defined (sparc)
+#if defined (__SVR4) && defined (__sun)
typedef char int8_t;
#else
// Conflicts with system declaration of int8_t in Solaris
@@ -221,6 +222,7 @@
};
// string specialization
+template <>
class NRSimpleAttribute<char *>: public NRAttribute {
public:
NRSimpleAttribute(int key, int type, int op, char *val, int size = 0);
@@ -236,6 +238,7 @@
};
// blob specialization
+template <>
class NRSimpleAttribute<void *>: public NRAttribute {
public:
NRSimpleAttribute(int key, int type, int op, void *val, int size);
diff -ur ns-allinone-2.27.orig/ns-2.27/indep-utils/cmu-scen-gen/setdest/Makefile.in ns-allinone-2.27/ns-2.27/indep-utils/cmu-scen-gen/setdest/Makefile.in
--- ns-allinone-2.27.orig/ns-2.27/indep-utils/cmu-scen-gen/setdest/Makefile.in 2004-01-12 19:58:39.000000000 -0500
+++ ns-allinone-2.27/ns-2.27/indep-utils/cmu-scen-gen/setdest/Makefile.in 2004-12-16 08:43:45.632961648 -0500
@@ -37,7 +37,7 @@
MKDEP = ../../../conf/mkdep
# when including files from ns, we need to take care STL_NAMESPACE
-DEFINE = -Dstand_alone -DSTL_NAMESPACE=@STL_NAMESPACE@
+DEFINE = -Dstand_alone -DSTL_NAMESPACE=@STL_NAMESPACE@ -DCPP_NAMESPACE=@CPP_NAMESPACE@
CFLAGS = @V_CCOPT@
LDFLAGS = @V_STATIC@
LIBS = @V_LIB@ -lm @LIBS@
diff -ur ns-allinone-2.27.orig/ns-2.27/indep-utils/webtrace-conv/dec/Makefile.in ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/dec/Makefile.in
--- ns-allinone-2.27.orig/ns-2.27/indep-utils/webtrace-conv/dec/Makefile.in 2004-01-12 19:58:44.000000000 -0500
+++ ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/dec/Makefile.in 2004-12-16 08:43:45.657957848 -0500
@@ -38,7 +38,7 @@
# when including files from ns, we need to take care STL_NAMESPACE
CC = @CXX@
INCLUDE = -I. @V_INCLUDES@
-CFLAGS = @V_CCOPT@ -DSTL_NAMESPACE=@STL_NAMESPACE@
+CFLAGS = @V_CCOPT@ -DSTL_NAMESPACE=@STL_NAMESPACE@ -DCPP_NAMESPACE=@CPP_NAMESPACE@
LDFLAGS = @V_STATIC@
LIBS = @V_LIB_TCL@ @V_LIB@ @LIBS@
INSTALL = @INSTALL@
diff -ur ns-allinone-2.27.orig/ns-2.27/indep-utils/webtrace-conv/nlanr/Makefile.in ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/nlanr/Makefile.in
--- ns-allinone-2.27.orig/ns-2.27/indep-utils/webtrace-conv/nlanr/Makefile.in 2004-01-12 19:58:48.000000000 -0500
+++ ns-allinone-2.27/ns-2.27/indep-utils/webtrace-conv/nlanr/Makefile.in 2004-12-16 08:43:45.658957696 -0500
@@ -35,7 +35,7 @@
# when including files from ns, we need to take care STL_NAMESPACE
CC = @CXX@
INCLUDE = -I. -I../../.. @V_INCLUDES@
-CFLAGS = @V_CCOPT@ -DSTL_NAMESPACE=@STL_NAMESPACE@
+CFLAGS = @V_CCOPT@ -DSTL_NAMESPACE=@STL_NAMESPACE@ -DCPP_NAMESPACE=@CPP_NAMESPACE@
LDFLAGS = @V_STATIC@
LIBS = @V_LIB_TCL@ @V_LIB@ @LIBS@
INSTALL = @INSTALL@
diff -ur ns-allinone-2.27.orig/ns-2.27/linkstate/ls.h ns-allinone-2.27/ns-2.27/linkstate/ls.h
--- ns-allinone-2.27.orig/ns-2.27/linkstate/ls.h 2004-01-12 19:59:00.000000000 -0500
+++ ns-allinone-2.27/ns-2.27/linkstate/ls.h 2004-12-16 08:43:45.685953592 -0500
@@ -86,7 +86,7 @@
LsList() : baseList() {}
LsList(const _Tp& x) : baseList(1, x) {}
void eraseAll() {
- baseList::erase(begin(), end());
+ baseList::erase(baseList::begin(), baseList::end());
}
LsList<_Tp>& operator= (const LsList<_Tp> & x) {
return (LsList<_Tp> &)baseList::operator= (x);
@@ -109,7 +109,7 @@
return ib.second ? ib.first : baseMap::end();
}
- void eraseAll() { erase(begin(), end()); }
+ void eraseAll() { erase(baseMap::begin(), baseMap::end()); }
T* findPtr(Key key) {
iterator it = baseMap::find(key);
return (it == baseMap::end()) ? (T *)NULL : &((*it).second);
diff -ur ns-allinone-2.27.orig/ns-2.27/mac/wireless-phy.cc ns-allinone-2.27/ns-2.27/mac/wireless-phy.cc
--- ns-allinone-2.27.orig/ns-2.27/mac/wireless-phy.cc 2004-01-12 19:59:15.000000000 -0500
+++ ns-allinone-2.27/ns-2.27/mac/wireless-phy.cc 2004-12-16 08:43:45.687953288 -0500
@@ -55,7 +55,7 @@
#include "diffusion/diff_header.h"
-#define max(a,b) (((a)<(b))?(b):(a))
+#define MAX(a,b) (((a)<(b))?(b):(a))
void Idle_Timer::expire(Event *) {
a_->UpdateIdleEnergy();
@@ -200,8 +200,8 @@
if (em()->energy() > 0) {
//double txtime = (8.*hdr_cmn::access(p)->size())/bandwidth_;
double txtime = hdr_cmn::access(p)->txtime();
- double start_time = max(channel_idle_time_, NOW);
- double end_time = max(channel_idle_time_, NOW+txtime);
+ double start_time = MAX(channel_idle_time_, NOW);
+ double end_time = MAX(channel_idle_time_, NOW+txtime);
double actual_txtime = end_time-start_time;
if (start_time > update_energy_time_) {
@@ -220,7 +220,7 @@
*/
// Sanity check
- double temp = max(NOW,last_send_time_);
+ double temp = MAX(NOW,last_send_time_);
/*
if (NOW < last_send_time_) {
@@ -228,8 +228,8 @@
}
*/
- double begin_adjust_time = min(channel_idle_time_, temp);
- double finish_adjust_time = min(channel_idle_time_, NOW+txtime);
+ double begin_adjust_time = MIN(channel_idle_time_, temp);
+ double finish_adjust_time = MIN(channel_idle_time_, NOW+txtime);
double gap_adjust_time = finish_adjust_time - begin_adjust_time;
if (gap_adjust_time < 0.0) {
fprintf(stderr,"What the heck ! negative gap time.\n");
@@ -354,8 +354,8 @@
em()->DecrRcvEnergy(rcvtime,Pr_consume_);
*/
- double start_time = max(channel_idle_time_, NOW);
- double end_time = max(channel_idle_time_, NOW+rcvtime);
+ double start_time = MAX(channel_idle_time_, NOW);
+ double end_time = MAX(channel_idle_time_, NOW+rcvtime);
double actual_rcvtime = end_time-start_time;
if (start_time > update_energy_time_) {
diff -ur ns-allinone-2.27.orig/ns-2.27/mobile/god.cc ns-allinone-2.27/ns-2.27/mobile/god.cc
--- ns-allinone-2.27.orig/ns-2.27/mobile/god.cc 2004-01-12 19:59:06.000000000 -0500
+++ ns-allinone-2.27/ns-2.27/mobile/god.cc 2004-12-16 08:43:45.742944928 -0500
@@ -645,7 +645,7 @@
for(i = 0; i < num_nodes; i++) {
for(j = 0; j < num_nodes; j++) {
for(k = 0; k < num_nodes; k++) {
- MIN_HOPS(j,k) = min(MIN_HOPS(j,k), MIN_HOPS(j,i) + MIN_HOPS(i,k));
+ MIN_HOPS(j,k) = MIN(MIN_HOPS(j,k), MIN_HOPS(j,i) + MIN_HOPS(i,k));
}
}
}
diff -ur ns-allinone-2.27.orig/ns-2.27/mobile/gridkeeper.cc ns-allinone-2.27/ns-2.27/mobile/gridkeeper.cc
--- ns-allinone-2.27.orig/ns-2.27/mobile/gridkeeper.cc 2004-01-12 19:59:06.000000000 -0500
+++ ns-allinone-2.27/ns-2.27/mobile/gridkeeper.cc 2004-12-16 08:43:45.743944776 -0500
@@ -133,7 +133,7 @@
endy = mn->destY();
if (vx > 0) {
- endi = min(dim_x_-1, (int)endx);
+ endi = MIN(dim_x_-1, (int)endx);
for (i = (int)x+1; i <= endi; i++) {
tm = (i-x)/vx;
pother = vy*tm + y;
@@ -182,7 +182,7 @@
}
}
if (vy > 0) {
- endi = min(dim_y_-1, (int)endy);
+ endi = MIN(dim_y_-1, (int)endy);
for (j = (int)y+1; j <= endi; j++) {
tm = (j-y)/vy;
pother = vx*tm + x;
@@ -237,11 +237,11 @@
adj = (int)ceil(mnr);
- ulx = min(dim_x_-1, grid_x + adj);
- uly = min(dim_y_-1, grid_y + adj);
- lly = max(0, grid_y - adj);
+ ulx = MIN(dim_x_-1, grid_x + adj);
+ uly = MIN(dim_y_-1, grid_y + adj);
+ lly = MAX(0, grid_y - adj);
- for (i = max(0, grid_x - adj); i <= ulx; i++) {
+ for (i = MAX(0, grid_x - adj); i <= ulx; i++) {
for (j = lly; j <= uly; j++) {
for (pgd = grid_[i][j]; pgd != 0; pgd = pgd->next()) {
if (mn->address() == pgd->address())
diff -ur ns-allinone-2.27.orig/ns-2.27/mobile/gridkeeper.h ns-allinone-2.27/ns-2.27/mobile/gridkeeper.h
--- ns-allinone-2.27.orig/ns-2.27/mobile/gridkeeper.h 2004-01-12 19:59:06.000000000 -0500
+++ ns-allinone-2.27/ns-2.27/mobile/gridkeeper.h 2004-12-16 08:43:45.772940368 -0500
@@ -13,8 +13,8 @@
#include "mobilenode.h"
-#define min(a,b) (((a)>(b))?(b):(a))
-#define max(a,b) (((a)<(b))?(b):(a))
+#define MIN(a,b) (((a)>(b))?(b):(a))
+#define MAX(a,b) (((a)<(b))?(b):(a))
#define aligngrid(a,b) (((a)==(b))?((b)-1):((a)))
diff -ur ns-allinone-2.27.orig/ns-2.27/sctp/sctp.cc ns-allinone-2.27/ns-2.27/sctp/sctp.cc
--- ns-allinone-2.27.orig/ns-2.27/sctp/sctp.cc 2004-01-12 19:57:35.000000000 -0500
+++ ns-allinone-2.27/ns-2.27/sctp/sctp.cc 2004-12-16 08:43:45.805935352 -0500
@@ -151,7 +151,7 @@
Packet::free(spDest->opRoutingAssistPacket);
spDest->opRoutingAssistPacket = NULL;
delete (SctpDest_S *) spCurrNode->vpData; //spDest
- (SctpDest_S *) spCurrNode->vpData = NULL;
+ spCurrNode->vpData = NULL;
}
if(spSctpTrace != NULL)
diff -ur ns-allinone-2.27.orig/ns-2.27/webcache/webtraf.cc ns-allinone-2.27/ns-2.27/webcache/webtraf.cc
--- ns-allinone-2.27.orig/ns-2.27/webcache/webtraf.cc 2004-01-12 19:53:52.000000000 -0500
+++ ns-allinone-2.27/ns-2.27/webcache/webtraf.cc 2004-12-16 08:43:45.807935048 -0500
@@ -412,8 +412,11 @@
nServer_ = atoi(argv[2]);
if (server_ != NULL)
delete []server_;
- server_ = new WebServer[nServer_](this);
-
+ server_ = (WebServer*) malloc(nServer_ * sizeof(WebServer));
+ WebServer tmp(this);
+ for (int i = 0; i < nServer_; i++) {
+ memcpy(&server_[i], &tmp, sizeof(WebServer));
+ }
return (TCL_OK);
} else if (strcmp(argv[1], "set-num-client") == 0) {
nClient_ = atoi(argv[2]);
diff -ur ns-allinone-2.27.orig/tclcl-1.15/tclcl.h ns-allinone-2.27/tclcl-1.15/tclcl.h
--- ns-allinone-2.27.orig/tclcl-1.15/tclcl.h 2004-01-12 19:52:09.000000000 -0500
+++ ns-allinone-2.27/tclcl-1.15/tclcl.h 2004-12-16 08:43:45.838930336 -0500
@@ -45,7 +45,7 @@
}
#include "tclcl-config.h"
-#include "tclcl-mappings.h"
+// #include "tclcl-mappings.h"
#include "tracedvar.h"
struct Tk_Window_;
@@ -158,6 +158,8 @@
Tcl_HashTable objs_;
};
+#include "tclcl-mappings.h"
+
class InstVar;
class TclObject {