summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-10-06 06:01:14 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-10-06 06:01:14 (GMT)
commitcaa253fcf5871c9886ed214cfc4d68c5ab45d8f2 (patch)
treec01a35aae808a6f0fac17202ed40ba4815e544da /generic
parent121af720bc29f65b64fcdcf520cb2d00368eb258 (diff)
downloadtk-caa253fcf5871c9886ed214cfc4d68c5ab45d8f2.zip
tk-caa253fcf5871c9886ed214cfc4d68c5ab45d8f2.tar.gz
tk-caa253fcf5871c9886ed214cfc4d68c5ab45d8f2.tar.bz2
More elimination of the "register" keyword, and more explicit typecasts
Diffstat (limited to 'generic')
-rw-r--r--generic/tk3d.c29
-rw-r--r--generic/tkCanvLine.c6
2 files changed, 17 insertions, 18 deletions
diff --git a/generic/tk3d.c b/generic/tk3d.c
index 987bace..f1cc8f1 100644
--- a/generic/tk3d.c
+++ b/generic/tk3d.c
@@ -90,7 +90,7 @@ Tk_Alloc3DBorderFromObj(
if (objPtr->typePtr != &tkBorderObjType) {
InitBorderObj(objPtr);
}
- borderPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ borderPtr = (TkBorder *)objPtr->internalRep.twoPtrValue.ptr1;
/*
* If the object currently points to a TkBorder, see if it's the one we
@@ -127,7 +127,7 @@ Tk_Alloc3DBorderFromObj(
*/
if (borderPtr != NULL) {
- TkBorder *firstBorderPtr = Tcl_GetHashValue(borderPtr->hashPtr);
+ TkBorder *firstBorderPtr = (TkBorder *)Tcl_GetHashValue(borderPtr->hashPtr);
FreeBorderObj(objPtr);
for (borderPtr = firstBorderPtr ; borderPtr != NULL;
@@ -200,7 +200,7 @@ Tk_Get3DBorder(
hashPtr = Tcl_CreateHashEntry(&dispPtr->borderTable, colorName, &isNew);
if (!isNew) {
- existingBorderPtr = Tcl_GetHashValue(hashPtr);
+ existingBorderPtr = (TkBorder *)Tcl_GetHashValue(hashPtr);
for (borderPtr = existingBorderPtr; borderPtr != NULL;
borderPtr = borderPtr->nextPtr) {
if ((Tk_Screen(tkwin) == borderPtr->screen)
@@ -420,12 +420,11 @@ Tk_Free3DBorder(
Display *display = DisplayOfScreen(borderPtr->screen);
TkBorder *prevPtr;
- borderPtr->resourceRefCount--;
- if (borderPtr->resourceRefCount > 0) {
+ if (borderPtr->resourceRefCount-- > 1) {
return;
}
- prevPtr = Tcl_GetHashValue(borderPtr->hashPtr);
+ prevPtr = (TkBorder *)Tcl_GetHashValue(borderPtr->hashPtr);
TkpFreeBorder(borderPtr);
if (borderPtr->bgColorPtr != NULL) {
Tk_FreeColor(borderPtr->bgColorPtr);
@@ -527,7 +526,7 @@ static void
FreeBorderObj(
Tcl_Obj *objPtr) /* The object we are releasing. */
{
- TkBorder *borderPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ TkBorder *borderPtr = (TkBorder *)objPtr->internalRep.twoPtrValue.ptr1;
if (borderPtr != NULL) {
borderPtr->objRefCount--;
@@ -562,7 +561,7 @@ DupBorderObjProc(
Tcl_Obj *srcObjPtr, /* The object we are copying from. */
Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
- TkBorder *borderPtr = srcObjPtr->internalRep.twoPtrValue.ptr1;
+ TkBorder *borderPtr = (TkBorder *)srcObjPtr->internalRep.twoPtrValue.ptr1;
dupObjPtr->typePtr = srcObjPtr->typePtr;
dupObjPtr->internalRep.twoPtrValue.ptr1 = borderPtr;
@@ -594,7 +593,7 @@ Tk_SetBackgroundFromBorder(
Tk_Window tkwin, /* Window whose background is to be set. */
Tk_3DBorder border) /* Token for border. */
{
- register TkBorder *borderPtr = (TkBorder *) border;
+ TkBorder *borderPtr = (TkBorder *) border;
Tk_SetWindowBackground(tkwin, borderPtr->bgColorPtr->pixel);
}
@@ -759,7 +758,7 @@ Tk_Draw3DPolygon(
{
XPoint poly[4], b1, b2, newB1, newB2;
XPoint perp, c, shift1, shift2; /* Used for handling parallel lines. */
- register XPoint *p1Ptr, *p2Ptr;
+ XPoint *p1Ptr, *p2Ptr;
TkBorder *borderPtr = (TkBorder *) border;
GC gc;
int i, lightOnLeft, dx, dy, parallel, pointsSeen;
@@ -956,7 +955,7 @@ Tk_Fill3DRectangle(
int relief) /* Indicates 3D effect: TK_RELIEF_FLAT,
* TK_RELIEF_RAISED, or TK_RELIEF_SUNKEN. */
{
- register TkBorder *borderPtr = (TkBorder *) border;
+ TkBorder *borderPtr = (TkBorder *) border;
int doubleBorder;
/*
@@ -1027,7 +1026,7 @@ Tk_Fill3DPolygon(
* TK_RELIEF_FLAT, TK_RELIEF_RAISED, or
* TK_RELIEF_SUNKEN. */
{
- register TkBorder *borderPtr = (TkBorder *) border;
+ TkBorder *borderPtr = (TkBorder *) border;
XFillPolygon(Tk_Display(tkwin), drawable, borderPtr->bgGC,
pointPtr, numPoints, Complex, CoordModeOrigin);
@@ -1253,7 +1252,7 @@ Tk_Get3DBorderFromObj(
* cached in the internal representation of the Tcl_Obj. Check it out...
*/
- borderPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ borderPtr = (TkBorder *)objPtr->internalRep.twoPtrValue.ptr1;
if ((borderPtr != NULL)
&& (borderPtr->resourceRefCount > 0)
&& (Tk_Screen(tkwin) == borderPtr->screen)
@@ -1281,7 +1280,7 @@ Tk_Get3DBorderFromObj(
if (hashPtr == NULL) {
goto error;
}
- for (borderPtr = Tcl_GetHashValue(hashPtr); borderPtr != NULL;
+ for (borderPtr = (TkBorder *)Tcl_GetHashValue(hashPtr); borderPtr != NULL;
borderPtr = borderPtr->nextPtr) {
if ((Tk_Screen(tkwin) == borderPtr->screen)
&& (Tk_Colormap(tkwin) == borderPtr->colormap)) {
@@ -1371,7 +1370,7 @@ TkDebugBorder(
resultPtr = Tcl_NewObj();
hashPtr = Tcl_FindHashEntry(&dispPtr->borderTable, name);
if (hashPtr != NULL) {
- TkBorder *borderPtr = Tcl_GetHashValue(hashPtr);
+ TkBorder *borderPtr = (TkBorder *)Tcl_GetHashValue(hashPtr);
if (borderPtr == NULL) {
Tcl_Panic("TkDebugBorder found empty hash table entry");
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index ba7753e..ba4cda1 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.c
@@ -831,9 +831,9 @@ DisplayLine(
Display *display, /* Display on which to draw item. */
Drawable drawable, /* Pixmap or window in which to draw item. */
TCL_UNUSED(int), /* Describes region of canvas that must be */
- TCL_UNUSED(int), /* redisplayed (not used). */
+ TCL_UNUSED(int), /* redisplayed (not used). */
TCL_UNUSED(int),
- TCL_UNUSED(int))
+ TCL_UNUSED(int))
{
LineItem *linePtr = (LineItem *) itemPtr;
XPoint staticPoints[MAX_STATIC_POINTS*3];
@@ -1949,7 +1949,7 @@ PrintArrowShape(
* string here. */
{
LineItem *linePtr = (LineItem *) recordPtr;
- char *buffer = ckalloc(120);
+ char *buffer = (char *)ckalloc(120);
sprintf(buffer, "%.5g %.5g %.5g", linePtr->arrowShapeA,
linePtr->arrowShapeB, linePtr->arrowShapeC);