summaryrefslogtreecommitdiffstats
path: root/generic/tkCanvPoly.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2011-03-12 17:45:37 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2011-03-12 17:45:37 (GMT)
commite0b895874d5fa39f6d4134b407e930b80ee3ecd7 (patch)
tree08a6b50f74f697e9ebc1f689f06d7318c0aa83a2 /generic/tkCanvPoly.c
parent77d7867fd5b20233f0fa9163bd8a44d2ac274b0e (diff)
downloadtk-e0b895874d5fa39f6d4134b407e930b80ee3ecd7.zip
tk-e0b895874d5fa39f6d4134b407e930b80ee3ecd7.tar.gz
tk-e0b895874d5fa39f6d4134b407e930b80ee3ecd7.tar.bz2
Remove casts from uses of ckalloc/ckfree/... now that Tcl declares them to be
using useful casts internally.
Diffstat (limited to 'generic/tkCanvPoly.c')
-rw-r--r--generic/tkCanvPoly.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c
index c64dcc1..b043aad 100644
--- a/generic/tkCanvPoly.c
+++ b/generic/tkCanvPoly.c
@@ -367,7 +367,7 @@ PolygonCoords(
numPoints = objc/2;
if (polyPtr->pointsAllocated <= numPoints) {
if (polyPtr->coordPtr != NULL) {
- ckfree((char *) polyPtr->coordPtr);
+ ckfree(polyPtr->coordPtr);
}
/*
@@ -375,8 +375,7 @@ PolygonCoords(
* another point to close the polygon.
*/
- polyPtr->coordPtr = (double *)
- ckalloc(sizeof(double) * (unsigned)(objc+2));
+ polyPtr->coordPtr = ckalloc(sizeof(double) * (objc+2));
polyPtr->pointsAllocated = numPoints+1;
}
for (i = objc-1; i >= 0; i--) {
@@ -572,7 +571,7 @@ DeletePolygon(
Tk_DeleteOutline(display, &polyPtr->outline);
if (polyPtr->coordPtr != NULL) {
- ckfree((char *) polyPtr->coordPtr);
+ ckfree(polyPtr->coordPtr);
}
if (polyPtr->fillColor != NULL) {
Tk_FreeColor(polyPtr->fillColor);
@@ -825,7 +824,7 @@ TkFillPolygon(
if (numPoints <= MAX_STATIC_POINTS) {
pointPtr = staticPoints;
} else {
- pointPtr = (XPoint *) ckalloc((unsigned) numPoints * sizeof(XPoint));
+ pointPtr = ckalloc(numPoints * sizeof(XPoint));
}
for (i=0, pPtr=pointPtr ; i<numPoints; i+=1, coordPtr+=2, pPtr++) {
@@ -847,7 +846,7 @@ TkFillPolygon(
CoordModeOrigin);
}
if (pointPtr != staticPoints) {
- ckfree((char *) pointPtr);
+ ckfree(pointPtr);
}
}
@@ -971,8 +970,7 @@ DisplayPolygon(
if (numPoints <= MAX_STATIC_POINTS) {
pointPtr = staticPoints;
} else {
- pointPtr = (XPoint *)
- ckalloc((unsigned) numPoints * sizeof(XPoint));
+ pointPtr = ckalloc(numPoints * sizeof(XPoint));
}
numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr,
polyPtr->numPoints, polyPtr->splineSteps, pointPtr, NULL);
@@ -985,7 +983,7 @@ DisplayPolygon(
numPoints, CoordModeOrigin);
}
if (pointPtr != staticPoints) {
- ckfree((char *) pointPtr);
+ ckfree(pointPtr);
}
}
Tk_ResetOutlineGC(canvas, itemPtr, &polyPtr->outline);
@@ -1039,15 +1037,14 @@ PolygonInsert(
while (beforeThis < 0) {
beforeThis += length;
}
- newCoordPtr = (double *)
- ckalloc(sizeof(double) * (unsigned)(length + 2 + objc));
+ newCoordPtr = ckalloc(sizeof(double) * (length + 2 + objc));
for (i=0; i<beforeThis; i++) {
newCoordPtr[i] = polyPtr->coordPtr[i];
}
for (i=0; i<objc; i++) {
if (Tcl_GetDoubleFromObj(NULL, objv[i],
&newCoordPtr[i+beforeThis]) != TCL_OK){
- ckfree((char *) newCoordPtr);
+ ckfree(newCoordPtr);
return;
}
}
@@ -1056,7 +1053,7 @@ PolygonInsert(
newCoordPtr[i+objc] = polyPtr->coordPtr[i];
}
if (polyPtr->coordPtr) {
- ckfree((char *) polyPtr->coordPtr);
+ ckfree(polyPtr->coordPtr);
}
length += objc;
polyPtr->coordPtr = newCoordPtr;
@@ -1200,7 +1197,7 @@ PolygonDeleteCoords(
if (count >= length) {
polyPtr->numPoints = 0;
if (polyPtr->coordPtr != NULL) {
- ckfree((char *) polyPtr->coordPtr);
+ ckfree(polyPtr->coordPtr);
}
ComputePolygonBbox(canvas, polyPtr);
return;
@@ -1289,8 +1286,7 @@ PolygonToPoint(
if (numPoints <= MAX_STATIC_POINTS) {
polyPoints = staticSpace;
} else {
- polyPoints = (double *)
- ckalloc((unsigned) 2*numPoints*sizeof(double));
+ polyPoints = ckalloc(2 * numPoints * sizeof(double));
}
numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr,
polyPtr->numPoints, polyPtr->splineSteps, NULL, polyPoints);
@@ -1408,7 +1404,7 @@ PolygonToPoint(
donepoint:
if (polyPoints != staticSpace && polyPoints != polyPtr->coordPtr) {
- ckfree((char *) polyPoints);
+ ckfree(polyPoints);
}
return bestDist;
}
@@ -1499,8 +1495,7 @@ PolygonToArea(
if (numPoints <= MAX_STATIC_POINTS) {
polyPoints = staticSpace;
} else {
- polyPoints = (double *)
- ckalloc((unsigned) 2*numPoints*sizeof(double));
+ polyPoints = ckalloc(2 * numPoints * sizeof(double));
}
numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr,
polyPtr->numPoints, polyPtr->splineSteps, NULL, polyPoints);
@@ -1603,7 +1598,7 @@ PolygonToArea(
donearea:
if ((polyPoints != staticSpace) && (polyPoints != polyPtr->coordPtr)) {
- ckfree((char *) polyPoints);
+ ckfree(polyPoints);
}
return inside;
}