summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjoye <joye>2014-07-03 18:33:24 (GMT)
committerjoye <joye>2014-07-03 18:33:24 (GMT)
commitf67f85f61194df82158d8b2e35eea14406017ddf (patch)
tree85a525fb075355c1fd98ad611380237e8342870b /src
parenta061bf5344ab2413170cb2f2104008a69795391e (diff)
downloadblt-f67f85f61194df82158d8b2e35eea14406017ddf.zip
blt-f67f85f61194df82158d8b2e35eea14406017ddf.tar.gz
blt-f67f85f61194df82158d8b2e35eea14406017ddf.tar.bz2
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/bltGrElem.h2
-rw-r--r--src/bltGrElemBar.C47
-rw-r--r--src/bltGrElemLine.C42
3 files changed, 43 insertions, 48 deletions
diff --git a/src/bltGrElem.h b/src/bltGrElem.h
index e778df7..12b17fb 100644
--- a/src/bltGrElem.h
+++ b/src/bltGrElem.h
@@ -60,8 +60,8 @@ namespace Blt {
typedef struct {
Segment2d *segments;
- int length;
int *map;
+ int length;
} GraphSegments;
typedef struct {
diff --git a/src/bltGrElemBar.C b/src/bltGrElemBar.C
index 738b78b..96cbb17 100644
--- a/src/bltGrElemBar.C
+++ b/src/bltGrElemBar.C
@@ -184,11 +184,11 @@ BarElement::BarElement(Graph* graphPtr, const char* name, Tcl_HashEntry* hPtr)
nActive_ =0;
xeb_.segments =NULL;
- xeb_.length =0;
xeb_.map =NULL;
+ xeb_.length =0;
yeb_.segments =NULL;
- yeb_.length =0;
yeb_.map =NULL;
+ yeb_.length =0;
ops_ = (BarElementOptions*)calloc(1, sizeof(BarElementOptions));
BarElementOptions* ops = (BarElementOptions*)ops_;
@@ -920,9 +920,9 @@ void BarElement::mergePens(BarStyle** dataToStyle)
}
if (xeb_.length > 0) {
- Segment2d* bars = (Segment2d*)malloc(xeb_.length * sizeof(Segment2d));
- int* map = (int*)malloc(xeb_.length * sizeof(int));
+ Segment2d* bars = new Segment2d[xeb_.length];
Segment2d *sp = bars;
+ int* map = new int[xeb_.length];
int* ip = map;
for (Blt_ChainLink link = Blt_Chain_FirstLink(ops->stylePalette);
link; link = Blt_Chain_NextLink(link)) {
@@ -937,16 +937,16 @@ void BarElement::mergePens(BarStyle** dataToStyle)
}
stylePtr->xeb.length = sp - stylePtr->xeb.segments;
}
- free(xeb_.segments);
+ delete [] xeb_.segments;
xeb_.segments = bars;
- free(xeb_.map);
+ delete [] xeb_.map;
xeb_.map = map;
}
if (yeb_.length > 0) {
- Segment2d* bars = (Segment2d*)malloc(yeb_.length * sizeof(Segment2d));
- int* map = (int*)malloc(yeb_.length * sizeof(int));
+ Segment2d* bars = new Segment2d[yeb_.length];
Segment2d* sp = bars;
+ int* map = new int[yeb_.length];
int* ip = map;
for (Blt_ChainLink link = Blt_Chain_FirstLink(ops->stylePalette); link;
link = Blt_Chain_NextLink(link)) {
@@ -961,9 +961,9 @@ void BarElement::mergePens(BarStyle** dataToStyle)
}
stylePtr->yeb.length = sp - stylePtr->yeb.segments;
}
- free(yeb_.segments);
+ delete [] yeb_.segments;
yeb_.segments = bars;
- free(yeb_.map);
+ delete [] yeb_.map;
yeb_.map = map;
}
}
@@ -1016,32 +1016,29 @@ void BarElement::reset()
activeToData_ = NULL;
if (xeb_.segments)
- free(xeb_.segments);
+ delete [] xeb_.segments;
xeb_.segments = NULL;
-
if (xeb_.map)
- free(xeb_.map);
+ delete [] xeb_.map;
xeb_.map = NULL;
+ xeb_.length = 0;
if (yeb_.segments)
- free(yeb_.segments);
+ delete [] yeb_.segments;
yeb_.segments = NULL;
-
if (yeb_.map)
- free(yeb_.map);
+ delete [] yeb_.map;
yeb_.map = NULL;
+ yeb_.length = 0;
if (bars_)
- free(bars_);
+ delete [] bars_;
bars_ = NULL;
-
if (barToData_)
- free(barToData_);
+ delete [] barToData_;
barToData_ = NULL;
nActive_ = 0;
- xeb_.length = 0;
- yeb_.length = 0;
nBars_ = 0;
}
@@ -1063,9 +1060,9 @@ void BarElement::mapErrorBars(BarStyle **dataToStyle)
}
if (nn) {
- Segment2d*bars = (Segment2d*)malloc(nn * 3 * sizeof(Segment2d));
+ Segment2d* bars = new Segment2d[nn * 3];
Segment2d* segPtr = bars;
- int* map = (int*)malloc(nn * 3 * sizeof(int));
+ int* map = new int[nn * 3];
int* indexPtr = map;
for (int ii=0; ii<nn; ii++) {
@@ -1128,9 +1125,9 @@ void BarElement::mapErrorBars(BarStyle **dataToStyle)
}
if (nn) {
- Segment2d* bars = (Segment2d*)malloc(nn * 3 * sizeof(Segment2d));
+ Segment2d* bars = new Segment2d[nn * 3];
Segment2d* segPtr = bars;
- int* map = (int*)malloc(nn * 3 * sizeof(int));
+ int* map = new int[nn * 3];
int* indexPtr = map;
for (int ii=0; ii<nn; ii++) {
diff --git a/src/bltGrElemLine.C b/src/bltGrElemLine.C
index cc1b295..5f702a5 100644
--- a/src/bltGrElemLine.C
+++ b/src/bltGrElemLine.C
@@ -231,11 +231,11 @@ LineElement::LineElement(Graph* graphPtr, const char* name, Tcl_HashEntry* hPtr)
activePts_.map =NULL;
xeb_.segments =NULL;
- xeb_.length =0;
xeb_.map =NULL;
+ xeb_.length =0;
yeb_.segments =NULL;
- yeb_.length =0;
yeb_.map =NULL;
+ yeb_.length =0;
symbolInterval_ =0;
symbolCounter_ =0;
@@ -1393,9 +1393,9 @@ void LineElement::mergePens(LineStyle **styleMap)
}
if (xeb_.length > 0) {
- Segment2d *segments = (Segment2d*)malloc(xeb_.length * sizeof(Segment2d));
- int* map = (int*)malloc(xeb_.length * sizeof(int));
+ Segment2d* segments = new Segment2d[xeb_.length];
Segment2d *sp = segments;
+ int* map = new int[xeb_.length];
int* ip = map;
for (Blt_ChainLink link = Blt_Chain_FirstLink(ops->stylePalette);
link; link = Blt_Chain_NextLink(link)) {
@@ -1410,16 +1410,16 @@ void LineElement::mergePens(LineStyle **styleMap)
}
stylePtr->xeb.length = sp - stylePtr->xeb.segments;
}
- free(xeb_.segments);
- free(xeb_.map);
+ delete [] xeb_.segments;
xeb_.segments = segments;
+ delete [] xeb_.map;
xeb_.map = map;
}
if (yeb_.length > 0) {
- Segment2d *segments = (Segment2d*)malloc(yeb_.length * sizeof(Segment2d));
- int* map = (int*)malloc(yeb_.length * sizeof(int));
- Segment2d *sp = segments;
+ Segment2d* segments = new Segment2d[yeb_.length];
+ Segment2d* sp = segments;
+ int* map = new int [yeb_.length];
int* ip = map;
for (Blt_ChainLink link = Blt_Chain_FirstLink(ops->stylePalette);
link; link = Blt_Chain_NextLink(link)) {
@@ -1434,9 +1434,9 @@ void LineElement::mergePens(LineStyle **styleMap)
}
stylePtr->yeb.length = sp - stylePtr->yeb.segments;
}
- free(yeb_.segments);
+ delete [] yeb_.segments;
yeb_.segments = segments;
- free(yeb_.map);
+ delete [] yeb_.map;
yeb_.map = map;
}
}
@@ -1711,22 +1711,20 @@ void LineElement::reset()
activePts_.map = NULL;
if (xeb_.segments)
- free(xeb_.segments);
+ delete [] xeb_.segments;
xeb_.segments = NULL;
-
if (xeb_.map)
- free(xeb_.map);
+ delete [] xeb_.map;
xeb_.map = NULL;
xeb_.length = 0;
if (yeb_.segments)
- free(yeb_.segments);
+ delete [] yeb_.segments;
yeb_.segments = NULL;
- yeb_.length = 0;
-
if (yeb_.map)
- free(yeb_.map);
+ delete [] yeb_.map;
yeb_.map = NULL;
+ yeb_.length = 0;
}
void LineElement::mapErrorBars(LineStyle **styleMap)
@@ -1747,9 +1745,9 @@ void LineElement::mapErrorBars(LineStyle **styleMap)
}
if (nn) {
- Segment2d* errorBars = (Segment2d*)malloc(nn * 3 * sizeof(Segment2d));
+ Segment2d* errorBars = new Segment2d[nn * 3];
Segment2d* segPtr = errorBars;
- int* errorToData = (int*)malloc(nn * 3 * sizeof(int));
+ int* errorToData = new int[nn * 3];
int* indexPtr = errorToData;
for (int ii=0; ii<nn; ii++) {
@@ -1814,9 +1812,9 @@ void LineElement::mapErrorBars(LineStyle **styleMap)
}
if (nn) {
- Segment2d* errorBars = (Segment2d*)malloc(nn * 3 * sizeof(Segment2d));
+ Segment2d* errorBars = new Segment2d[nn * 3];
Segment2d* segPtr = errorBars;
- int* errorToData = (int*)malloc(nn * 3 * sizeof(int));
+ int* errorToData = new int[nn * 3];
int* indexPtr = errorToData;
for (int ii=0; ii<nn; ii++) {