summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2008-11-08 18:44:39 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2008-11-08 18:44:39 (GMT)
commit1411b2f26b3d46b402c4774770fb5356cd47ef95 (patch)
tree080187f8a151cf82a630512856d2315e712cedf9 /generic
parent4f2679372f637fcd2f0d997b9d97165a6b558f12 (diff)
downloadtk-1411b2f26b3d46b402c4774770fb5356cd47ef95.zip
tk-1411b2f26b3d46b402c4774770fb5356cd47ef95.tar.gz
tk-1411b2f26b3d46b402c4774770fb5356cd47ef95.tar.bz2
Lots of small changes to make code more pretty and C89-like.
Diffstat (limited to 'generic')
-rw-r--r--generic/tk3d.c4
-rw-r--r--generic/tkArgv.c8
-rw-r--r--generic/tkBitmap.c4
-rw-r--r--generic/tkColor.c4
-rw-r--r--generic/tkCursor.c4
-rw-r--r--generic/tkError.c8
-rw-r--r--generic/tkEvent.c12
-rw-r--r--generic/tkFocus.c6
-rw-r--r--generic/tkGeometry.c6
-rw-r--r--generic/tkImage.c39
-rw-r--r--generic/tkMain.c4
-rw-r--r--generic/tkOldConfig.c16
-rw-r--r--generic/tkSelect.c14
-rw-r--r--generic/tkStyle.c4
-rw-r--r--generic/tkText.c108
-rw-r--r--generic/tkTextBTree.c14
-rw-r--r--generic/tkTextDisp.c453
-rw-r--r--generic/tkTextIndex.c6
-rw-r--r--generic/tkUndo.c4
-rw-r--r--generic/tkUtil.c4
-rw-r--r--generic/tkWindow.c4
21 files changed, 356 insertions, 370 deletions
diff --git a/generic/tk3d.c b/generic/tk3d.c
index 905e68d..9570ee4 100644
--- a/generic/tk3d.c
+++ b/generic/tk3d.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tk3d.c,v 1.21 2008/10/15 06:41:06 nijtmans Exp $
+ * RCS: @(#) $Id: tk3d.c,v 1.22 2008/11/08 18:44:39 dkf Exp $
*/
#include "tkInt.h"
@@ -1331,7 +1331,7 @@ InitBorderObj(
Tcl_GetString(objPtr);
typePtr = objPtr->typePtr;
if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
- (*typePtr->freeIntRepProc)(objPtr);
+ typePtr->freeIntRepProc(objPtr);
}
objPtr->typePtr = &tkBorderObjType;
objPtr->internalRep.twoPtrValue.ptr1 = NULL;
diff --git a/generic/tkArgv.c b/generic/tkArgv.c
index 2935183..8ad8331 100644
--- a/generic/tkArgv.c
+++ b/generic/tkArgv.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkArgv.c,v 1.16 2008/10/28 22:33:06 nijtmans Exp $
+ * RCS: @(#) $Id: tkArgv.c,v 1.17 2008/11/08 18:44:39 dkf Exp $
*/
#include "tkInt.h"
@@ -231,7 +231,7 @@ Tk_ParseArgv(
typedef int (ArgvFunc)(char *, const char *, const char *);
ArgvFunc *handlerProc = (ArgvFunc *) infoPtr->src;
- if ((*handlerProc)(infoPtr->dst, infoPtr->key, argv[srcIndex])) {
+ if (handlerProc(infoPtr->dst, infoPtr->key, argv[srcIndex])) {
srcIndex++;
argc--;
}
@@ -242,8 +242,8 @@ Tk_ParseArgv(
const char **);
ArgvGenFunc *handlerProc = (ArgvGenFunc *) infoPtr->src;
- argc = (*handlerProc)(infoPtr->dst, interp, infoPtr->key,
- argc, argv+srcIndex);
+ argc = handlerProc(infoPtr->dst, interp, infoPtr->key, argc,
+ argv+srcIndex);
if (argc < 0) {
return TCL_ERROR;
}
diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c
index bdbde01..ca40bbc 100644
--- a/generic/tkBitmap.c
+++ b/generic/tkBitmap.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkBitmap.c,v 1.23 2008/11/05 22:48:58 nijtmans Exp $
+ * RCS: @(#) $Id: tkBitmap.c,v 1.24 2008/11/08 18:44:39 dkf Exp $
*/
#include "tkInt.h"
@@ -967,7 +967,7 @@ InitBitmapObj(
Tcl_GetString(objPtr);
typePtr = objPtr->typePtr;
if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
- (*typePtr->freeIntRepProc)(objPtr);
+ typePtr->freeIntRepProc(objPtr);
}
objPtr->typePtr = &tkBitmapObjType;
objPtr->internalRep.twoPtrValue.ptr1 = NULL;
diff --git a/generic/tkColor.c b/generic/tkColor.c
index 518e4e0..1c9c792 100644
--- a/generic/tkColor.c
+++ b/generic/tkColor.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkColor.c,v 1.18 2008/10/15 06:41:06 nijtmans Exp $
+ * RCS: @(#) $Id: tkColor.c,v 1.19 2008/11/08 18:44:39 dkf Exp $
*/
#include "tkInt.h"
@@ -714,7 +714,7 @@ InitColorObj(
Tcl_GetString(objPtr);
typePtr = objPtr->typePtr;
if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
- (*typePtr->freeIntRepProc)(objPtr);
+ typePtr->freeIntRepProc(objPtr);
}
objPtr->typePtr = &tkColorObjType;
objPtr->internalRep.twoPtrValue.ptr1 = NULL;
diff --git a/generic/tkCursor.c b/generic/tkCursor.c
index 8d46854..047834d 100644
--- a/generic/tkCursor.c
+++ b/generic/tkCursor.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkCursor.c,v 1.20 2008/10/15 06:41:06 nijtmans Exp $
+ * RCS: @(#) $Id: tkCursor.c,v 1.21 2008/11/08 18:44:39 dkf Exp $
*/
#include "tkInt.h"
@@ -760,7 +760,7 @@ InitCursorObj(
Tcl_GetString(objPtr);
typePtr = objPtr->typePtr;
if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
- (*typePtr->freeIntRepProc)(objPtr);
+ typePtr->freeIntRepProc(objPtr);
}
objPtr->typePtr = &tkCursorObjType;
objPtr->internalRep.twoPtrValue.ptr1 = NULL;
diff --git a/generic/tkError.c b/generic/tkError.c
index 6144093..426c457 100644
--- a/generic/tkError.c
+++ b/generic/tkError.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkError.c,v 1.7 2008/08/19 15:52:11 georgeps Exp $
+ * RCS: @(#) $Id: tkError.c,v 1.8 2008/11/08 18:44:39 dkf Exp $
*/
#include "tkInt.h"
@@ -248,8 +248,8 @@ ErrorProc(
&& (errorPtr->lastRequest < errEventPtr->serial))) {
continue;
}
- if (errorPtr->errorProc == NULL || (*errorPtr->errorProc)(
- errorPtr->clientData, errEventPtr) == 0) {
+ if (errorPtr->errorProc == NULL ||
+ errorPtr->errorProc(errorPtr->clientData, errEventPtr) == 0) {
return 0;
}
}
@@ -281,7 +281,7 @@ ErrorProc(
*/
couldntHandle:
- return (*defaultHandler)(display, errEventPtr);
+ return defaultHandler(display, errEventPtr);
}
/*
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index 7446ef8..e3f925d 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkEvent.c,v 1.36 2008/08/05 20:31:08 jenglish Exp $
+ * RCS: @(#) $Id: tkEvent.c,v 1.37 2008/11/08 18:44:39 dkf Exp $
*/
#include "tkInt.h"
@@ -790,7 +790,7 @@ InvokeGenericHandlers(
int done;
tsdPtr->handlersActive++;
- done = (*curPtr->proc)(curPtr->clientData, eventPtr);
+ done = curPtr->proc(curPtr->clientData, eventPtr);
tsdPtr->handlersActive--;
if (done) {
return done;
@@ -1383,7 +1383,7 @@ Tk_HandleEvent(
for (handlerPtr = winPtr->handlerList; handlerPtr != NULL; ) {
if ((handlerPtr->mask & mask) != 0) {
ip.nextHandler = handlerPtr->nextPtr;
- (*(handlerPtr->proc))(handlerPtr->clientData, eventPtr);
+ handlerPtr->proc(handlerPtr->clientData, eventPtr);
handlerPtr = ip.nextHandler;
} else {
handlerPtr = handlerPtr->nextPtr;
@@ -1787,7 +1787,7 @@ WindowEventProc(
return 0;
}
if (tsdPtr->restrictProc != NULL) {
- result = (*tsdPtr->restrictProc)(tsdPtr->restrictArg, &wevPtr->event);
+ result = tsdPtr->restrictProc(tsdPtr->restrictArg, &wevPtr->event);
if (result != TK_PROCESS_EVENT) {
if (result == TK_DEFER_EVENT) {
return 0;
@@ -2053,7 +2053,7 @@ TkFinalize(
firstExitPtr = exitPtr->nextPtr;
Tcl_MutexUnlock(&exitMutex);
- (*exitPtr->proc)(exitPtr->clientData);
+ exitPtr->proc(exitPtr->clientData);
ckfree((char *) exitPtr);
Tcl_MutexLock(&exitMutex);
}
@@ -2103,7 +2103,7 @@ TkFinalizeThread(
*/
tsdPtr->firstExitPtr = exitPtr->nextPtr;
- (*exitPtr->proc)(exitPtr->clientData);
+ exitPtr->proc(exitPtr->clientData);
ckfree((char *) exitPtr);
}
}
diff --git a/generic/tkFocus.c b/generic/tkFocus.c
index 767244d..bce8191 100644
--- a/generic/tkFocus.c
+++ b/generic/tkFocus.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkFocus.c,v 1.18 2008/10/17 23:18:37 nijtmans Exp $
+ * RCS: @(#) $Id: tkFocus.c,v 1.19 2008/11/08 18:44:39 dkf Exp $
*/
#include "tkInt.h"
@@ -1059,8 +1059,8 @@ TkFocusFree(
*/
void
-TkFocusSplit(winPtr)
- TkWindow *winPtr; /* Window is the new toplevel. Any focus point
+TkFocusSplit(
+ TkWindow *winPtr) /* Window is the new toplevel. Any focus point
* at or below window must be moved to this
* new toplevel. */
{
diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c
index 2bd9ea7..53bd140 100644
--- a/generic/tkGeometry.c
+++ b/generic/tkGeometry.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkGeometry.c,v 1.13 2008/04/27 22:38:56 dkf Exp $
+ * RCS: @(#) $Id: tkGeometry.c,v 1.14 2008/11/08 18:44:40 dkf Exp $
*/
#include "tkInt.h"
@@ -98,7 +98,7 @@ Tk_ManageGeometry(
&& ((winPtr->geomMgrPtr != mgrPtr)
|| (winPtr->geomData != clientData))
&& (winPtr->geomMgrPtr->lostSlaveProc != NULL)) {
- (*winPtr->geomMgrPtr->lostSlaveProc)(winPtr->geomData, tkwin);
+ winPtr->geomMgrPtr->lostSlaveProc(winPtr->geomData, tkwin);
}
winPtr->geomMgrPtr = mgrPtr;
@@ -154,7 +154,7 @@ Tk_GeometryRequest(
winPtr->reqHeight = reqHeight;
if ((winPtr->geomMgrPtr != NULL)
&& (winPtr->geomMgrPtr->requestProc != NULL)) {
- (*winPtr->geomMgrPtr->requestProc)(winPtr->geomData, tkwin);
+ winPtr->geomMgrPtr->requestProc(winPtr->geomData, tkwin);
}
}
diff --git a/generic/tkImage.c b/generic/tkImage.c
index 0fb673b..0f25906 100644
--- a/generic/tkImage.c
+++ b/generic/tkImage.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkImage.c,v 1.39 2008/10/17 23:18:37 nijtmans Exp $
+ * RCS: @(#) $Id: tkImage.c,v 1.40 2008/11/08 18:44:40 dkf Exp $
*/
#include "tkInt.h"
@@ -283,13 +283,13 @@ Tk_ImageObjCmd(
if (masterPtr->typePtr != NULL) {
for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
imagePtr = imagePtr->nextPtr) {
- (*masterPtr->typePtr->freeProc)(imagePtr->instanceData,
+ masterPtr->typePtr->freeProc(imagePtr->instanceData,
imagePtr->display);
- (*imagePtr->changeProc)(imagePtr->widgetClientData,
- 0, 0, masterPtr->width, masterPtr->height,
+ imagePtr->changeProc(imagePtr->widgetClientData, 0, 0,
+ masterPtr->width, masterPtr->height,
masterPtr->width, masterPtr->height);
}
- (*masterPtr->typePtr->deleteProc)(masterPtr->masterData);
+ masterPtr->typePtr->deleteProc(masterPtr->masterData);
masterPtr->typePtr = NULL;
}
masterPtr->deleted = 0;
@@ -314,8 +314,8 @@ Tk_ImageObjCmd(
args[objc] = NULL;
}
Tcl_Preserve(masterPtr);
- if ((*typePtr->createProc)(interp, name, objc, args, typePtr,
- (Tk_ImageMaster)masterPtr, &masterPtr->masterData) != TCL_OK) {
+ if (typePtr->createProc(interp, name, objc, args, typePtr,
+ (Tk_ImageMaster)masterPtr, &masterPtr->masterData) != TCL_OK){
EventuallyDeleteImage(masterPtr, 0);
Tcl_Release(masterPtr);
if (oldimage) {
@@ -330,7 +330,7 @@ Tk_ImageObjCmd(
masterPtr->typePtr = typePtr;
for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
imagePtr = imagePtr->nextPtr) {
- imagePtr->instanceData = (*typePtr->getProc)(imagePtr->tkwin,
+ imagePtr->instanceData = typePtr->getProc(imagePtr->tkwin,
masterPtr->masterData);
}
Tcl_SetResult(interp,
@@ -479,8 +479,8 @@ Tk_ImageChanged(
masterPtr->height = imageHeight;
for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
imagePtr = imagePtr->nextPtr) {
- (*imagePtr->changeProc)(imagePtr->widgetClientData, x, y,
- width, height, imageWidth, imageHeight);
+ imagePtr->changeProc(imagePtr->widgetClientData, x, y, width, height,
+ imageWidth, imageHeight);
}
}
@@ -567,7 +567,7 @@ Tk_GetImage(
imagePtr->display = Tk_Display(tkwin);
imagePtr->masterPtr = masterPtr;
imagePtr->instanceData =
- (*masterPtr->typePtr->getProc)(tkwin, masterPtr->masterData);
+ masterPtr->typePtr->getProc(tkwin, masterPtr->masterData);
imagePtr->changeProc = changeProc;
imagePtr->widgetClientData = clientData;
imagePtr->nextPtr = masterPtr->instancePtr;
@@ -613,7 +613,7 @@ Tk_FreeImage(
*/
if (masterPtr->typePtr != NULL) {
- (*masterPtr->typePtr->freeProc)(imagePtr->instanceData,
+ masterPtr->typePtr->freeProc(imagePtr->instanceData,
imagePtr->display);
}
prevPtr = masterPtr->instancePtr;
@@ -691,7 +691,7 @@ Tk_PostscriptImage(
*/
if (imagePtr->masterPtr->typePtr->postscriptProc != NULL) {
- return (*imagePtr->masterPtr->typePtr->postscriptProc)(
+ return imagePtr->masterPtr->typePtr->postscriptProc(
imagePtr->masterPtr->masterData, interp, tkwin, psinfo,
x, y, width, height, prepass);
}
@@ -801,9 +801,9 @@ Tk_RedrawImage(
if ((imageY + height) > imagePtr->masterPtr->height) {
height = imagePtr->masterPtr->height - imageY;
}
- (*imagePtr->masterPtr->typePtr->displayProc)(
- imagePtr->instanceData, imagePtr->display, drawable,
- imageX, imageY, width, height, drawableX, drawableY);
+ imagePtr->masterPtr->typePtr->displayProc(imagePtr->instanceData,
+ imagePtr->display, drawable, imageX, imageY, width, height,
+ drawableX, drawableY);
}
/*
@@ -902,13 +902,12 @@ DeleteImage(
if (typePtr != NULL) {
for (imagePtr = masterPtr->instancePtr; imagePtr != NULL;
imagePtr = imagePtr->nextPtr) {
- (*typePtr->freeProc)(imagePtr->instanceData,
- imagePtr->display);
- (*imagePtr->changeProc)(imagePtr->widgetClientData, 0, 0,
+ typePtr->freeProc(imagePtr->instanceData, imagePtr->display);
+ imagePtr->changeProc(imagePtr->widgetClientData, 0, 0,
masterPtr->width, masterPtr->height, masterPtr->width,
masterPtr->height);
}
- (*typePtr->deleteProc)(masterPtr->masterData);
+ typePtr->deleteProc(masterPtr->masterData);
}
if (masterPtr->instancePtr == NULL) {
if (masterPtr->hPtr != NULL) {
diff --git a/generic/tkMain.c b/generic/tkMain.c
index 396c93f..b008f41 100644
--- a/generic/tkMain.c
+++ b/generic/tkMain.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMain.c,v 1.30 2008/04/27 22:38:56 dkf Exp $
+ * RCS: @(#) $Id: tkMain.c,v 1.31 2008/11/08 18:44:40 dkf Exp $
*/
#include <ctype.h>
@@ -255,7 +255,7 @@ Tk_MainEx(
* Invoke application-specific initialization.
*/
- if ((*appInitProc)(interp) != TCL_OK) {
+ if (appInitProc(interp) != TCL_OK) {
TkpDisplayWarning(Tcl_GetStringResult(interp),
"Application initialization failed");
}
diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c
index 0639817..51c16c6 100644
--- a/generic/tkOldConfig.c
+++ b/generic/tkOldConfig.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkOldConfig.c,v 1.25 2008/10/30 23:18:59 nijtmans Exp $
+ * RCS: @(#) $Id: tkOldConfig.c,v 1.26 2008/11/08 18:44:40 dkf Exp $
*/
#include "tkPort.h"
@@ -543,9 +543,8 @@ DoConfig(
break;
}
case TK_CONFIG_CUSTOM:
- if ((*specPtr->customPtr->parseProc)(
- specPtr->customPtr->clientData, interp, tkwin, value,
- widgRec, specPtr->offset) != TCL_OK) {
+ if (specPtr->customPtr->parseProc(specPtr->customPtr->clientData,
+ interp, tkwin, value, widgRec, specPtr->offset)!=TCL_OK) {
return TCL_ERROR;
}
break;
@@ -723,7 +722,7 @@ FormatConfigInfo(
if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) {
ckfree((char *) argv[4]);
} else {
- (*freeProc)((char *) argv[4]);
+ freeProc((char *) argv[4]);
}
}
return result;
@@ -872,9 +871,8 @@ FormatConfigValue(
break;
}
case TK_CONFIG_CUSTOM:
- result = (*specPtr->customPtr->printProc)(
- specPtr->customPtr->clientData, tkwin, widgRec,
- specPtr->offset, freeProcPtr);
+ result = specPtr->customPtr->printProc(specPtr->customPtr->clientData,
+ tkwin, widgRec, specPtr->offset, freeProcPtr);
break;
default:
result = "?? unknown type ??";
@@ -945,7 +943,7 @@ Tk_ConfigureValue(
if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) {
ckfree((char *) result);
} else {
- (*freeProc)((char *) result);
+ freeProc((char *) result);
}
}
return TCL_OK;
diff --git a/generic/tkSelect.c b/generic/tkSelect.c
index f510478..bf31e5b 100644
--- a/generic/tkSelect.c
+++ b/generic/tkSelect.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkSelect.c,v 1.25 2008/10/28 22:33:06 nijtmans Exp $
+ * RCS: @(#) $Id: tkSelect.c,v 1.26 2008/11/08 18:44:40 dkf Exp $
*/
#include "tkInt.h"
@@ -435,7 +435,7 @@ Tk_OwnSelection(
*/
if (clearProc != NULL) {
- (*clearProc)(clearData);
+ clearProc(clearData);
}
}
@@ -499,7 +499,7 @@ Tk_ClearSelection(
XSetSelectionOwner(winPtr->display, selection, None, CurrentTime);
if (clearProc != NULL) {
- (*clearProc)(clearData);
+ clearProc(clearData);
}
}
@@ -604,7 +604,7 @@ Tk_GetSelection(
goto cantget;
}
buffer[count] = 0;
- result = (*proc)(clientData, interp, buffer);
+ result = proc(clientData, interp, buffer);
} else {
offset = 0;
result = TCL_OK;
@@ -612,7 +612,7 @@ Tk_GetSelection(
ip.nextPtr = tsdPtr->pendingPtr;
tsdPtr->pendingPtr = &ip;
while (1) {
- count = (selPtr->proc)(selPtr->clientData, offset, buffer,
+ count = selPtr->proc(selPtr->clientData, offset, buffer,
TK_SEL_BYTES_AT_ONCE);
if ((count < 0) || (ip.selPtr == NULL)) {
tsdPtr->pendingPtr = ip.nextPtr;
@@ -622,7 +622,7 @@ Tk_GetSelection(
Tcl_Panic("selection handler returned too many bytes");
}
buffer[count] = '\0';
- result = (*proc)(clientData, interp, buffer);
+ result = proc(clientData, interp, buffer);
if ((result != TCL_OK) || (count < TK_SEL_BYTES_AT_ONCE)
|| (ip.selPtr == NULL)) {
break;
@@ -1259,7 +1259,7 @@ TkSelClearSelection(
*/
if (infoPtr->clearProc != NULL) {
- (*infoPtr->clearProc)(infoPtr->clearData);
+ infoPtr->clearProc(infoPtr->clearData);
}
ckfree((char *) infoPtr);
}
diff --git a/generic/tkStyle.c b/generic/tkStyle.c
index b4815a5..a3262bf 100644
--- a/generic/tkStyle.c
+++ b/generic/tkStyle.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkStyle.c,v 1.10 2008/10/15 06:41:06 nijtmans Exp $
+ * RCS: @(#) $Id: tkStyle.c,v 1.11 2008/11/08 18:44:40 dkf Exp $
*/
#include "tkInt.h"
@@ -1497,7 +1497,7 @@ SetStyleFromAny(
name = Tcl_GetString(objPtr);
typePtr = objPtr->typePtr;
if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
- (*typePtr->freeIntRepProc)(objPtr);
+ typePtr->freeIntRepProc(objPtr);
}
objPtr->typePtr = &styleObjType;
diff --git a/generic/tkText.c b/generic/tkText.c
index eed86c5..59a855f 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkText.c,v 1.83 2008/10/30 23:18:59 nijtmans Exp $
+ * RCS: @(#) $Id: tkText.c,v 1.84 2008/11/08 18:44:40 dkf Exp $
*/
#include "default.h"
@@ -443,7 +443,7 @@ Tk_TextObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = (Tk_Window) clientData;
+ Tk_Window tkwin = clientData;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?");
@@ -513,7 +513,7 @@ CreateWidget(
textPtr->interp = interp;
textPtr->widgetCmd = Tcl_CreateObjCommand(interp,
Tk_PathName(textPtr->tkwin), TextWidgetObjCmd,
- (ClientData) textPtr, TextCmdDeletedProc);
+ textPtr, TextCmdDeletedProc);
if (sharedPtr == NULL) {
sharedPtr = (TkSharedText *) ckalloc(sizeof(TkSharedText));
@@ -628,18 +628,18 @@ CreateWidget(
optionTable = Tk_CreateOptionTable(interp, optionSpecs);
Tk_SetClass(textPtr->tkwin, "Text");
- Tk_SetClassProcs(textPtr->tkwin, &textClass, (ClientData) textPtr);
+ Tk_SetClassProcs(textPtr->tkwin, &textClass, textPtr);
textPtr->optionTable = optionTable;
Tk_CreateEventHandler(textPtr->tkwin,
ExposureMask|StructureNotifyMask|FocusChangeMask,
- TextEventProc, (ClientData) textPtr);
+ TextEventProc, textPtr);
Tk_CreateEventHandler(textPtr->tkwin, KeyPressMask|KeyReleaseMask
|ButtonPressMask|ButtonReleaseMask|EnterWindowMask
|LeaveWindowMask|PointerMotionMask|VirtualEventMask,
- TkTextBindProc, (ClientData) textPtr);
+ TkTextBindProc, textPtr);
Tk_CreateSelHandler(textPtr->tkwin, XA_PRIMARY, XA_STRING,
- TextFetchSelection, (ClientData) textPtr, XA_STRING);
+ TextFetchSelection, textPtr, XA_STRING);
if (Tk_InitOptions(interp, (char *) textPtr, optionTable, textPtr->tkwin)
!= TCL_OK) {
@@ -651,8 +651,7 @@ CreateWidget(
return TCL_ERROR;
}
- Tcl_SetObjResult(interp,
- Tcl_NewStringObj(Tk_PathName(textPtr->tkwin),-1));
+ Tcl_SetObjResult(interp, TkNewWindowObj(textPtr->tkwin));
return TCL_OK;
}
@@ -681,7 +680,7 @@ TextWidgetObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- register TkText *textPtr = (TkText *) clientData;
+ register TkText *textPtr = clientData;
int result = TCL_OK;
int index;
@@ -1532,7 +1531,7 @@ SharedTextObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- register TkSharedText *sharedPtr = (TkSharedText *) clientData;
+ register TkSharedText *sharedPtr = clientData;
int result = TCL_OK;
int index;
@@ -2197,7 +2196,7 @@ ConfigureText(
if (TkBTreeCharTagged(&first, textPtr->selTagPtr)
|| TkBTreeNextTag(&search)) {
Tk_OwnSelection(textPtr->tkwin, XA_PRIMARY, TkTextLostSelection,
- (ClientData) textPtr);
+ textPtr);
textPtr->flags |= GOT_SELECTION;
}
}
@@ -2209,7 +2208,7 @@ ConfigureText(
if (textPtr->flags & GOT_FOCUS) {
Tcl_DeleteTimerHandler(textPtr->insertBlinkHandler);
textPtr->insertBlinkHandler = (Tcl_TimerToken) NULL;
- TextBlinkProc((ClientData) textPtr);
+ TextBlinkProc(textPtr);
}
/*
@@ -2252,9 +2251,8 @@ static void
TextWorldChangedCallback(
ClientData instanceData) /* Information about widget. */
{
- TkText *textPtr;
+ TkText *textPtr = instanceData;
- textPtr = (TkText *) instanceData;
TextWorldChanged(textPtr, TK_TEXT_LINE_GEOMETRY);
}
@@ -2340,7 +2338,7 @@ TextEventProc(
ClientData clientData, /* Information about window. */
register XEvent *eventPtr) /* Information about event. */
{
- register TkText *textPtr = (TkText *) clientData;
+ register TkText *textPtr = clientData;
TkTextIndex index, index2;
if (eventPtr->type == Expose) {
@@ -2400,8 +2398,7 @@ TextEventProc(
textPtr->flags |= GOT_FOCUS | INSERT_ON;
if (textPtr->insertOffTime != 0) {
textPtr->insertBlinkHandler = Tcl_CreateTimerHandler(
- textPtr->insertOnTime, TextBlinkProc,
- (ClientData) textPtr);
+ textPtr->insertOnTime, TextBlinkProc, textPtr);
}
} else {
textPtr->flags &= ~(GOT_FOCUS | INSERT_ON);
@@ -2450,7 +2447,7 @@ static void
TextCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- TkText *textPtr = (TkText *) clientData;
+ TkText *textPtr = clientData;
Tk_Window tkwin = textPtr->tkwin;
/*
@@ -2718,13 +2715,13 @@ TextPushUndoAction(
* underlying data shared by all peers.
*/
- iAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback,
- (ClientData)textPtr->sharedTextPtr, insertCmdObj, NULL);
+ iAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback, textPtr->sharedTextPtr,
+ insertCmdObj, NULL);
TkUndoMakeCmdSubAtom(NULL, markSet2InsertObj, iAtom);
TkUndoMakeCmdSubAtom(NULL, seeInsertObj, iAtom);
- dAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback,
- (ClientData)textPtr->sharedTextPtr, deleteCmdObj, NULL);
+ dAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback, textPtr->sharedTextPtr,
+ deleteCmdObj, NULL);
TkUndoMakeCmdSubAtom(NULL, markSet1InsertObj, dAtom);
TkUndoMakeCmdSubAtom(NULL, seeInsertObj, dAtom);
@@ -2773,7 +2770,7 @@ TextUndoRedoCallback(
Tcl_Obj *objPtr) /* Arguments of a command to be handled by the
* shared text data structure. */
{
- TkSharedText *sharedPtr = (TkSharedText *) clientData;
+ TkSharedText *sharedPtr = clientData;
int res, objc;
Tcl_Obj **objv;
TkText *textPtr;
@@ -2838,7 +2835,7 @@ TextUndoRedoCallback(
* the Tcl level.
*/
- return SharedTextObjCmd((ClientData)sharedPtr, interp, objc+1, objv-1);
+ return SharedTextObjCmd(sharedPtr, interp, objc+1, objv-1);
}
/*
@@ -3199,7 +3196,7 @@ TextFetchSelection(
* not including terminating NULL
* character. */
{
- register TkText *textPtr = (TkText *) clientData;
+ register TkText *textPtr = clientData;
TkTextIndex eof;
int count, chunkSize, offsetInSeg;
TkTextSearch search;
@@ -3330,7 +3327,7 @@ void
TkTextLostSelection(
ClientData clientData) /* Information about text widget. */
{
- register TkText *textPtr = (TkText *) clientData;
+ register TkText *textPtr = clientData;
if (TkpAlwaysShowSelection(textPtr->tkwin)) {
TkTextIndex start, end;
@@ -3424,7 +3421,7 @@ static void
TextBlinkProc(
ClientData clientData) /* Pointer to record describing text. */
{
- register TkText *textPtr = (TkText *) clientData;
+ register TkText *textPtr = clientData;
TkTextIndex index;
int x, y, w, h, charWidth;
@@ -3444,11 +3441,11 @@ TextBlinkProc(
if (textPtr->flags & INSERT_ON) {
textPtr->flags &= ~INSERT_ON;
textPtr->insertBlinkHandler = Tcl_CreateTimerHandler(
- textPtr->insertOffTime, TextBlinkProc, (ClientData) textPtr);
+ textPtr->insertOffTime, TextBlinkProc, textPtr);
} else {
textPtr->flags |= INSERT_ON;
textPtr->insertBlinkHandler = Tcl_CreateTimerHandler(
- textPtr->insertOnTime, TextBlinkProc, (ClientData) textPtr);
+ textPtr->insertOnTime, TextBlinkProc, textPtr);
}
redrawInsert:
TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index);
@@ -3604,7 +3601,7 @@ TextSearchCmd(
searchSpec.strictLimits = 0;
searchSpec.numLines =
TkBTreeNumLines(textPtr->sharedTextPtr->tree, textPtr);
- searchSpec.clientData = (ClientData)textPtr;
+ searchSpec.clientData = textPtr;
searchSpec.addLineProc = &TextSearchAddNextLine;
searchSpec.foundMatchProc = &TextSearchFoundMatch;
searchSpec.lineIndexProc = &TextSearchGetLineIndex;
@@ -3789,7 +3786,7 @@ TextSearchGetLineIndex(
{
const TkTextIndex *indexPtr;
int line;
- TkText *textPtr = (TkText *) searchSpecPtr->clientData;
+ TkText *textPtr = searchSpecPtr->clientData;
indexPtr = TkTextGetIndexFromObj(interp, textPtr, objPtr);
if (indexPtr == NULL) {
@@ -3854,7 +3851,7 @@ TextSearchIndexInLine(
TkTextSegment *segPtr;
TkTextIndex curIndex;
int index, leftToScan;
- TkText *textPtr = (TkText *) searchSpecPtr->clientData;
+ TkText *textPtr = searchSpecPtr->clientData;
index = 0;
curIndex.tree = textPtr->sharedTextPtr->tree;
@@ -3924,7 +3921,7 @@ TextSearchAddNextLine(
TkTextLine *linePtr, *thisLinePtr;
TkTextIndex curIndex;
TkTextSegment *segPtr;
- TkText *textPtr = (TkText *) searchSpecPtr->clientData;
+ TkText *textPtr = searchSpecPtr->clientData;
int nothingYet = 1;
/*
@@ -4001,7 +3998,7 @@ TextSearchAddNextLine(
*lenPtr = Tcl_GetCharLength(theLine);
}
}
- return (ClientData)linePtr;
+ return linePtr;
}
/*
@@ -4045,7 +4042,7 @@ TextSearchFoundMatch(
TkTextIndex curIndex, foundIndex;
TkTextSegment *segPtr;
TkTextLine *linePtr;
- TkText *textPtr = (TkText *) searchSpecPtr->clientData;
+ TkText *textPtr = searchSpecPtr->clientData;
if (lineNum == searchSpecPtr->stopLine) {
/*
@@ -4096,7 +4093,7 @@ TextSearchFoundMatch(
* reached the end of the match or we have reached the end of the line.
*/
- linePtr = (TkTextLine *)clientData;
+ linePtr = clientData;
if (linePtr == NULL) {
linePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree, textPtr,
lineNum);
@@ -5240,7 +5237,7 @@ SearchPerform(
* for regexp search, utf-8 bytes for exact search).
*/
- if ((*searchSpecPtr->lineIndexProc)(interp, fromPtr, searchSpecPtr,
+ if (searchSpecPtr->lineIndexProc(interp, fromPtr, searchSpecPtr,
&searchSpecPtr->startLine,
&searchSpecPtr->startOffset) != TCL_OK) {
return TCL_ERROR;
@@ -5252,7 +5249,7 @@ SearchPerform(
if (toPtr != NULL) {
const TkTextIndex *indexToPtr, *indexFromPtr;
- TkText *textPtr = (TkText *) searchSpecPtr->clientData;
+ TkText *textPtr = searchSpecPtr->clientData;
indexToPtr = TkTextGetIndexFromObj(interp, textPtr, toPtr);
if (indexToPtr == NULL) {
@@ -5276,7 +5273,7 @@ SearchPerform(
}
}
- if ((*searchSpecPtr->lineIndexProc)(interp, toPtr, searchSpecPtr,
+ if (searchSpecPtr->lineIndexProc(interp, toPtr, searchSpecPtr,
&searchSpecPtr->stopLine,
&searchSpecPtr->stopOffset) != TCL_OK) {
return TCL_ERROR;
@@ -5462,8 +5459,8 @@ SearchCore(
* this line, which is what 'lastOffset' represents.
*/
- lineInfo = (*searchSpecPtr->addLineProc)(lineNum, searchSpecPtr,
- theLine, &lastOffset, &linesSearched);
+ lineInfo = searchSpecPtr->addLineProc(lineNum, searchSpecPtr, theLine,
+ &lastOffset, &linesSearched);
if (lineInfo == NULL) {
/*
@@ -5647,7 +5644,7 @@ SearchCore(
*/
if (extraLines > maxExtraLines) {
- if ((*searchSpecPtr->addLineProc)(lineNum
+ if (searchSpecPtr->addLineProc(lineNum
+ extraLines, searchSpecPtr, theLine,
&lastTotal, &extraLines) == NULL) {
p = NULL;
@@ -5727,9 +5724,8 @@ SearchCore(
matchOffset = p - startOfLine;
if (searchSpecPtr->all &&
- !(*searchSpecPtr->foundMatchProc)(lineNum,
- searchSpecPtr, lineInfo, theLine, matchOffset,
- matchLength)) {
+ !searchSpecPtr->foundMatchProc(lineNum, searchSpecPtr,
+ lineInfo, theLine, matchOffset, matchLength)) {
/*
* We reached the end of the search.
*/
@@ -5870,7 +5866,7 @@ SearchCore(
*/
if (extraLines > maxExtraLines) {
- if ((*searchSpecPtr->addLineProc)(lineNum
+ if (searchSpecPtr->addLineProc(lineNum
+ extraLines, searchSpecPtr, theLine,
&lastTotal, &extraLines) == NULL) {
/*
@@ -6049,9 +6045,9 @@ SearchCore(
if (lastBackwardsLineMatch != -1) {
recordBackwardsMatch:
- (*searchSpecPtr->foundMatchProc)(
- lastBackwardsLineMatch, searchSpecPtr, NULL,
- NULL, lastBackwardsMatchOffset, matchLength);
+ searchSpecPtr->foundMatchProc(lastBackwardsLineMatch,
+ searchSpecPtr, NULL, NULL,
+ lastBackwardsMatchOffset, matchLength);
lastBackwardsLineMatch = -1;
if (!searchSpecPtr->all) {
goto searchDone;
@@ -6116,7 +6112,7 @@ SearchCore(
*/
if (searchSpecPtr->all &&
- !(*searchSpecPtr->foundMatchProc)(lineNum,
+ !searchSpecPtr->foundMatchProc(lineNum,
searchSpecPtr, lineInfo, theLine, matchOffset,
matchLength)) {
/*
@@ -6207,7 +6203,7 @@ SearchCore(
continue;
}
}
- (*searchSpecPtr->foundMatchProc)(lineNum, searchSpecPtr,
+ searchSpecPtr->foundMatchProc(lineNum, searchSpecPtr,
lineInfo, theLine, matchOffset, matchLength);
if (!searchSpecPtr->all) {
goto searchDone;
@@ -6222,7 +6218,7 @@ SearchCore(
* non-all case.
*/
- (*searchSpecPtr->foundMatchProc)(lineNum, searchSpecPtr,
+ searchSpecPtr->foundMatchProc(lineNum, searchSpecPtr,
lineInfo, theLine, matchOffset, matchLength);
} else {
lastBackwardsLineMatch = lineNum;
@@ -6241,7 +6237,7 @@ SearchCore(
if ((lastBackwardsLineMatch == -1) && (matchOffset >= 0)
&& !searchSpecPtr->all) {
- (*searchSpecPtr->foundMatchProc)(lineNum, searchSpecPtr, lineInfo,
+ searchSpecPtr->foundMatchProc(lineNum, searchSpecPtr, lineInfo,
theLine, matchOffset, matchLength);
goto searchDone;
}
@@ -6268,7 +6264,7 @@ SearchCore(
if (lastBackwardsLineMatch != -1
&& ((lineNum < 0)
|| (lineNum + 2 < lastBackwardsLineMatch))) {
- (*searchSpecPtr->foundMatchProc)(lastBackwardsLineMatch,
+ searchSpecPtr->foundMatchProc(lastBackwardsLineMatch,
searchSpecPtr, NULL, NULL,
lastBackwardsMatchOffset, matchLength);
lastBackwardsLineMatch = -1;
@@ -6314,7 +6310,7 @@ SearchCore(
searchDone:
if (lastBackwardsLineMatch != -1) {
- (*searchSpecPtr->foundMatchProc)(lastBackwardsLineMatch, searchSpecPtr,
+ searchSpecPtr->foundMatchProc(lastBackwardsLineMatch, searchSpecPtr,
NULL, NULL, lastBackwardsMatchOffset, matchLength);
}
diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c
index cb608e4..1afcf76 100644
--- a/generic/tkTextBTree.c
+++ b/generic/tkTextBTree.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTextBTree.c,v 1.27 2007/12/13 15:24:17 dgp Exp $
+ * RCS: @(#) $Id: tkTextBTree.c,v 1.28 2008/11/08 18:44:40 dkf Exp $
*/
#include "tkInt.h"
@@ -867,7 +867,7 @@ DestroyNode(
while (linePtr->segPtr != NULL) {
segPtr = linePtr->segPtr;
linePtr->segPtr = segPtr->nextPtr;
- (*segPtr->typePtr->deleteProc)(segPtr, linePtr, 1);
+ segPtr->typePtr->deleteProc(segPtr, linePtr, 1);
}
ckfree((char *) linePtr->pixels);
ckfree((char *) linePtr);
@@ -1207,7 +1207,7 @@ SplitSeg(
if (count == 0) {
return prevPtr;
}
- segPtr = (*segPtr->typePtr->splitProc)(segPtr, count);
+ segPtr = segPtr->typePtr->splitProc(segPtr, count);
if (prevPtr == NULL) {
indexPtr->linePtr->segPtr = segPtr;
} else {
@@ -1282,7 +1282,7 @@ CleanupLine(
segPtr != NULL;
prevPtrPtr = &(*prevPtrPtr)->nextPtr, segPtr = *prevPtrPtr) {
if (segPtr->typePtr->cleanupProc != NULL) {
- *prevPtrPtr = (*segPtr->typePtr->cleanupProc)(segPtr, linePtr);
+ *prevPtrPtr = segPtr->typePtr->cleanupProc(segPtr, linePtr);
if (segPtr != *prevPtrPtr) {
anyChanges = 1;
}
@@ -1452,7 +1452,7 @@ TkBTreeDeleteIndexRange(
}
nextPtr = segPtr->nextPtr;
- if ((*segPtr->typePtr->deleteProc)(segPtr, curLinePtr, 0) != 0) {
+ if (segPtr->typePtr->deleteProc(segPtr, curLinePtr, 0) != 0) {
/*
* This segment refuses to die. Move it to prevPtr and advance
* prevPtr if the segment has left gravity.
@@ -1483,7 +1483,7 @@ TkBTreeDeleteIndexRange(
for (segPtr = lastPtr; segPtr != NULL;
segPtr = segPtr->nextPtr) {
if (segPtr->typePtr->lineChangeProc != NULL) {
- (*segPtr->typePtr->lineChangeProc)(segPtr, index2Ptr->linePtr);
+ segPtr->typePtr->lineChangeProc(segPtr, index2Ptr->linePtr);
}
}
curNodePtr = index2Ptr->linePtr->parentPtr;
@@ -3935,7 +3935,7 @@ CheckNodeConsistency(
for (segPtr = linePtr->segPtr; segPtr != NULL;
segPtr = segPtr->nextPtr) {
if (segPtr->typePtr->checkProc != NULL) {
- (*segPtr->typePtr->checkProc)(segPtr, linePtr);
+ segPtr->typePtr->checkProc(segPtr, linePtr);
}
if ((segPtr->size == 0) && (!segPtr->typePtr->leftGravity)
&& (segPtr->nextPtr != NULL)
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 89da5e4..ac6f138 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTextDisp.c,v 1.70 2008/10/17 23:18:37 nijtmans Exp $
+ * RCS: @(#) $Id: tkTextDisp.c,v 1.71 2008/11/08 18:44:40 dkf Exp $
*/
#include "tkInt.h"
@@ -446,6 +446,7 @@ typedef struct BaseCharInfo {
* LayoutDLine(). */
} BaseCharInfo;
+/* TODO: Thread safety */
static TkTextDispChunk *baseCharChunkPtr = NULL;
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
@@ -661,10 +662,10 @@ TkTextCreateDInfo(
textPtr->refCount++;
dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(0,
- AsyncUpdateLineMetrics, (ClientData) textPtr);
+ AsyncUpdateLineMetrics, textPtr);
textPtr->refCount++;
dInfoPtr->scrollbarTimer = Tcl_CreateTimerHandler(200,
- AsyncUpdateYScrollbar, (ClientData) textPtr);
+ AsyncUpdateYScrollbar, textPtr);
textPtr->dInfoPtr = dInfoPtr;
}
@@ -706,7 +707,7 @@ TkTextFreeDInfo(
}
Tk_FreeGC(textPtr->display, dInfoPtr->scrollGC);
if (dInfoPtr->flags & REDRAW_PENDING) {
- Tcl_CancelIdleCall(DisplayText, (ClientData) textPtr);
+ Tcl_CancelIdleCall(DisplayText, textPtr);
}
if (dInfoPtr->lineUpdateTimer != NULL) {
Tcl_DeleteTimerHandler(dInfoPtr->lineUpdateTimer);
@@ -1265,14 +1266,14 @@ LayoutDLine(
*/
TkTextLine *linePtr = TkBTreeNextLine(NULL, curIndex.linePtr);
- if (linePtr != NULL) {
- dlPtr->logicalLinesMerged++;
- curIndex.byteIndex = 0;
- curIndex.linePtr = linePtr;
- segPtr = curIndex.linePtr->segPtr;
- } else {
+ if (linePtr == NULL) {
break;
}
+
+ dlPtr->logicalLinesMerged++;
+ curIndex.byteIndex = 0;
+ curIndex.linePtr = linePtr;
+ segPtr = curIndex.linePtr->segPtr;
}
}
@@ -1459,7 +1460,7 @@ LayoutDLine(
code = 1;
} else {
- code = (*segPtr->typePtr->layoutProc)(textPtr, &curIndex, segPtr,
+ code = segPtr->typePtr->layoutProc(textPtr, &curIndex, segPtr,
byteOffset, maxX-tabSize, maxBytes, noCharsYet, wrapMode,
chunkPtr);
}
@@ -1611,18 +1612,18 @@ LayoutDLine(
FreeStyle(textPtr, chunkPtr->stylePtr);
breakChunkPtr->nextPtr = chunkPtr->nextPtr;
if (chunkPtr->undisplayProc != NULL) {
- (*chunkPtr->undisplayProc)(textPtr, chunkPtr);
+ chunkPtr->undisplayProc(textPtr, chunkPtr);
}
ckfree((char *) chunkPtr);
}
if (breakByteOffset != breakChunkPtr->numBytes) {
if (breakChunkPtr->undisplayProc != NULL) {
- (*breakChunkPtr->undisplayProc)(textPtr, breakChunkPtr);
+ breakChunkPtr->undisplayProc(textPtr, breakChunkPtr);
}
segPtr = TkTextIndexToSeg(&breakIndex, &byteOffset);
- (*segPtr->typePtr->layoutProc)(textPtr, &breakIndex,
- segPtr, byteOffset, maxX, breakByteOffset, 0,
- wrapMode, breakChunkPtr);
+ segPtr->typePtr->layoutProc(textPtr, &breakIndex, segPtr,
+ byteOffset, maxX, breakByteOffset, 0, wrapMode,
+ breakChunkPtr);
#if TK_LAYOUT_WITH_BASE_CHUNKS
FinalizeBaseChunk(NULL);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
@@ -2306,7 +2307,7 @@ FreeDLines(
for (chunkPtr = firstPtr->chunkPtr; chunkPtr != NULL;
chunkPtr = nextChunkPtr) {
if (chunkPtr->undisplayProc != NULL) {
- (*chunkPtr->undisplayProc)(textPtr, chunkPtr);
+ chunkPtr->undisplayProc(textPtr, chunkPtr);
}
FreeStyle(textPtr, chunkPtr->stylePtr);
nextChunkPtr = chunkPtr->nextPtr;
@@ -2404,7 +2405,7 @@ DisplayDLine(
if (chunkPtr->displayProc == TkTextInsertDisplayProc) {
int x = chunkPtr->x + dInfoPtr->x - dInfoPtr->curXPixelOffset;
- (*chunkPtr->displayProc)(textPtr, chunkPtr, x,
+ chunkPtr->displayProc(textPtr, chunkPtr, x,
y + dlPtr->spaceAbove,
dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow,
dlPtr->baseline - dlPtr->spaceAbove, display, pixmap,
@@ -2452,7 +2453,7 @@ DisplayDLine(
x = -chunkPtr->width;
}
- (*chunkPtr->displayProc)(textPtr, chunkPtr, x,
+ chunkPtr->displayProc(textPtr, chunkPtr, x,
y + dlPtr->spaceAbove, dlPtr->height - dlPtr->spaceAbove -
dlPtr->spaceBelow, dlPtr->baseline - dlPtr->spaceAbove,
display, pixmap, dlPtr->y + dlPtr->spaceAbove);
@@ -2878,7 +2879,7 @@ static void
AsyncUpdateLineMetrics(
ClientData clientData) /* Information about widget. */
{
- register TkText *textPtr = (TkText *) clientData;
+ register TkText *textPtr = clientData;
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
int lineNum;
@@ -2948,7 +2949,7 @@ AsyncUpdateLineMetrics(
*/
dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(1,
- AsyncUpdateLineMetrics, (ClientData) textPtr);
+ AsyncUpdateLineMetrics, textPtr);
}
/*
@@ -3049,86 +3050,82 @@ TkTextUpdateLineMetrics(
*/
if (TkBTreeLinePixelEpoch(textPtr, linePtr)
- != textPtr->dInfoPtr->lineMetricUpdateEpoch) {
- if (doThisMuch == -1) {
- count += 8 * TkTextUpdateOneLine(textPtr, linePtr, 0,
- NULL, 0);
- } else {
- TkTextIndex index;
- TkTextIndex *indexPtr;
- int pixelHeight;
+ == textPtr->dInfoPtr->lineMetricUpdateEpoch) {
+ /*
+ * This line is already up to date. That means there's nothing
+ * to do here.
+ */
+ } else if (doThisMuch == -1) {
+ count += 8 * TkTextUpdateOneLine(textPtr, linePtr, 0,NULL,0);
+ } else {
+ TkTextIndex index;
+ TkTextIndex *indexPtr;
+ int pixelHeight;
+ /*
+ * If the metric epoch is the same as the widget's epoch, then
+ * we know that indexPtrs are still valid, and if the cached
+ * metricIndex (if any) is for the same line as we wish to
+ * examine, then we are looking at a long line wrapped many
+ * times, which we will examine in pieces.
+ */
+
+ if (textPtr->dInfoPtr->metricEpoch ==
+ textPtr->sharedTextPtr->stateEpoch &&
+ textPtr->dInfoPtr->metricIndex.linePtr==linePtr) {
+ indexPtr = &textPtr->dInfoPtr->metricIndex;
+ pixelHeight = textPtr->dInfoPtr->metricPixelHeight;
+ } else {
/*
- * If the metric epoch is the same as the widget's epoch,
- * then we know that indexPtrs are still valid, and if the
- * cached metricIndex (if any) is for the same line as we
- * wish to examine, then we are looking at a long line
- * wrapped many times, which we will examine in pieces.
+ * We must reset the partial line height calculation data
+ * here, so we don't use it when it is out of date.
*/
- if (textPtr->dInfoPtr->metricEpoch ==
- textPtr->sharedTextPtr->stateEpoch &&
- textPtr->dInfoPtr->metricIndex.linePtr==linePtr) {
- indexPtr = &textPtr->dInfoPtr->metricIndex;
- pixelHeight = textPtr->dInfoPtr->metricPixelHeight;
- } else {
- /*
- * We must reset the partial line height calculation
- * data here, so we don't use it when it is out of
- * date.
- */
+ textPtr->dInfoPtr->metricEpoch = -1;
+ index.tree = textPtr->sharedTextPtr->tree;
+ index.linePtr = linePtr;
+ index.byteIndex = 0;
+ index.textPtr = NULL;
+ indexPtr = &index;
+ pixelHeight = 0;
+ }
- textPtr->dInfoPtr->metricEpoch = -1;
- index.tree = textPtr->sharedTextPtr->tree;
- index.linePtr = linePtr;
- index.byteIndex = 0;
- index.textPtr = NULL;
- indexPtr = &index;
- pixelHeight = 0;
- }
+ /*
+ * Update the line and update the counter, counting 8 for each
+ * display line we actually re-layout.
+ */
+ count += 8 * TkTextUpdateOneLine(textPtr, linePtr,
+ pixelHeight, indexPtr, 1);
+
+ if (indexPtr->linePtr == linePtr) {
/*
- * Update the line and update the counter, counting 8 for
- * each display line we actually re-layout.
+ * We didn't complete the logical line, because it
+ * produced very many display lines, which must be because
+ * it must be a long line wrapped many times. So we must
+ * cache as far as we got for next time around.
*/
- count += 8 * TkTextUpdateOneLine(textPtr, linePtr,
- pixelHeight, indexPtr, 1);
-
- if (indexPtr->linePtr == linePtr) {
- /*
- * We didn't complete the logical line, because it
- * produced very many display lines - it must be a
- * long line wrapped many times. So we must cache as
- * far as we got for next time around.
- */
-
- if (pixelHeight == 0) {
- /*
- * These have already been stored, unless we just
- * started the new line.
- */
-
- textPtr->dInfoPtr->metricIndex = index;
- textPtr->dInfoPtr->metricEpoch =
- textPtr->sharedTextPtr->stateEpoch;
- }
- textPtr->dInfoPtr->metricPixelHeight =
- TkBTreeLinePixelCount(textPtr, linePtr);
- break;
- } else {
+ if (pixelHeight == 0) {
/*
- * We're done with this long line.
+ * These have already been stored, unless we just
+ * started the new line.
*/
- textPtr->dInfoPtr->metricEpoch = -1;
+ textPtr->dInfoPtr->metricIndex = index;
+ textPtr->dInfoPtr->metricEpoch =
+ textPtr->sharedTextPtr->stateEpoch;
}
+ textPtr->dInfoPtr->metricPixelHeight =
+ TkBTreeLinePixelCount(textPtr, linePtr);
+ break;
}
- } else {
+
/*
- * This line is already up to date. That means there's nothing
- * to do here.
+ * We're done with this long line.
*/
+
+ textPtr->dInfoPtr->metricEpoch = -1;
}
} else {
/*
@@ -3329,7 +3326,7 @@ TextInvalidateLineMetrics(
if (dInfoPtr->lineUpdateTimer == NULL) {
textPtr->refCount++;
dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(1,
- AsyncUpdateLineMetrics, (ClientData) textPtr);
+ AsyncUpdateLineMetrics, textPtr);
}
}
@@ -3379,6 +3376,8 @@ TkTextFindDisplayLineEnd(
* of the original index within its display
* line. */
{
+ TkTextIndex index;
+
if (!end && indexPtr->byteIndex == 0) {
/*
* Nothing to do.
@@ -3388,95 +3387,93 @@ TkTextFindDisplayLineEnd(
*xOffset = 0;
}
return;
- } else {
- TkTextIndex index = *indexPtr;
-
- index.byteIndex = 0;
- index.textPtr = NULL;
-
- while (1) {
- TkTextIndex endOfLastLine;
+ }
- if (TkTextIndexBackBytes(textPtr, &index, 1, &endOfLastLine)) {
- /*
- * Reached beginning of text.
- */
+ index = *indexPtr;
+ index.byteIndex = 0;
+ index.textPtr = NULL;
- break;
- }
+ while (1) {
+ TkTextIndex endOfLastLine;
- if (!TkTextIsElided(textPtr, &endOfLastLine, NULL)) {
- /*
- * The eol is not elided, so 'index' points to the start of a
- * display line (as well as logical line).
- */
+ if (TkTextIndexBackBytes(textPtr, &index, 1, &endOfLastLine)) {
+ /*
+ * Reached beginning of text.
+ */
- break;
- }
+ break;
+ }
+ if (!TkTextIsElided(textPtr, &endOfLastLine, NULL)) {
/*
- * indexPtr's logical line is actually merged with the previous
- * logical line whose eol is elided. Continue searching back to
- * get a real line start.
+ * The eol is not elided, so 'index' points to the start of a
+ * display line (as well as logical line).
*/
- index = endOfLastLine;
- index.byteIndex = 0;
+ break;
}
- while (1) {
- DLine *dlPtr;
- int byteCount;
- TkTextIndex nextLineStart;
+ /*
+ * indexPtr's logical line is actually merged with the previous
+ * logical line whose eol is elided. Continue searching back to get a
+ * real line start.
+ */
- dlPtr = LayoutDLine(textPtr, &index);
- byteCount = dlPtr->byteCount;
+ index = endOfLastLine;
+ index.byteIndex = 0;
+ }
+
+ while (1) {
+ DLine *dlPtr;
+ int byteCount;
+ TkTextIndex nextLineStart;
- TkTextIndexForwBytes(textPtr, &index, byteCount, &nextLineStart);
+ dlPtr = LayoutDLine(textPtr, &index);
+ byteCount = dlPtr->byteCount;
+
+ TkTextIndexForwBytes(textPtr, &index, byteCount, &nextLineStart);
+
+ /*
+ * 'byteCount' goes up to the beginning of the next display line, so
+ * equality here says we need one more line. We try to perform a quick
+ * comparison which is valid for the case where the logical line is
+ * the same, but otherwise fall back on a full TkTextIndexCmp.
+ */
+ if (((index.linePtr == indexPtr->linePtr)
+ && (index.byteIndex + byteCount > indexPtr->byteIndex))
+ || (dlPtr->logicalLinesMerged > 0
+ && TkTextIndexCmp(&nextLineStart, indexPtr) > 0)) {
/*
- * 'byteCount' goes up to the beginning of the next display line,
- * so equality here says we need one more line. We try to perform
- * a quick comparison which is valid for the case where the
- * logical line is the same, but otherwise fall back on a full
- * TkTextIndexCmp.
+ * It's on this display line.
*/
- if (((index.linePtr == indexPtr->linePtr)
- && (index.byteIndex + byteCount > indexPtr->byteIndex))
- || (dlPtr->logicalLinesMerged > 0
- && TkTextIndexCmp(&nextLineStart, indexPtr) > 0)) {
+ if (xOffset != NULL) {
/*
- * It's on this display line.
+ * This call takes a byte index relative to the start of the
+ * current _display_ line, not logical line. We are about to
+ * overwrite indexPtr->byteIndex, so we must do this now.
*/
- if (xOffset != NULL) {
- /*
- * This call takes a byte index relative to the start of
- * the current _display_ line, not logical line. We are
- * about to overwrite indexPtr->byteIndex, so we must do
- * this now.
- */
-
- *xOffset = DlineXOfIndex(textPtr, dlPtr,
- indexPtr->byteIndex - dlPtr->index.byteIndex);
- }
- if (end) {
- /*
- * The index we want is one less than the number of bytes
- * in the display line.
- */
+ *xOffset = DlineXOfIndex(textPtr, dlPtr,
+ indexPtr->byteIndex - dlPtr->index.byteIndex);
+ }
+ if (end) {
+ /*
+ * The index we want is one less than the number of bytes in
+ * the display line.
+ */
- TkTextIndexBackBytes(textPtr, &nextLineStart, 1, indexPtr);
- } else {
- *indexPtr = index;
- }
- FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP);
- return;
+ TkTextIndexBackBytes(textPtr, &nextLineStart, 1, indexPtr);
+ } else {
+ *indexPtr = index;
}
FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP);
- index = nextLineStart;
+ return;
}
+
+ FreeDLines(textPtr, dlPtr, NULL, DLINE_FREE_TEMP);
+ index = nextLineStart;
}
}
@@ -3860,7 +3857,7 @@ TkTextUpdateOneLine(
if (textPtr->dInfoPtr->scrollbarTimer == NULL) {
textPtr->refCount++;
textPtr->dInfoPtr->scrollbarTimer = Tcl_CreateTimerHandler(200,
- AsyncUpdateYScrollbar, (ClientData) textPtr);
+ AsyncUpdateYScrollbar, textPtr);
}
return displayLines;
}
@@ -3886,7 +3883,7 @@ static void
DisplayText(
ClientData clientData) /* Information about widget. */
{
- register TkText *textPtr = (TkText *) clientData;
+ register TkText *textPtr = clientData;
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
register DLine *dlPtr;
DLine *prevPtr;
@@ -3905,7 +3902,7 @@ DisplayText(
}
interp = textPtr->interp;
- Tcl_Preserve((ClientData) interp);
+ Tcl_Preserve(interp);
if (tkTextDebug) {
Tcl_SetVar2(interp, "tk_textRelayout", NULL, "", TCL_GLOBAL_ONLY);
@@ -4343,7 +4340,7 @@ DisplayText(
}
end:
- Tcl_Release((ClientData) interp);
+ Tcl_Release(interp);
}
/*
@@ -4372,7 +4369,7 @@ TkTextEventuallyRepick(
dInfoPtr->flags |= REPICK_NEEDED;
if (!(dInfoPtr->flags & REDRAW_PENDING)) {
dInfoPtr->flags |= REDRAW_PENDING;
- Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
+ Tcl_DoWhenIdle(DisplayText, textPtr);
}
}
@@ -4416,7 +4413,7 @@ TkTextRedrawRegion(
if (!(dInfoPtr->flags & REDRAW_PENDING)) {
dInfoPtr->flags |= REDRAW_PENDING;
- Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
+ Tcl_DoWhenIdle(DisplayText, textPtr);
}
TkDestroyRegion(damageRgn);
}
@@ -4553,7 +4550,7 @@ TextChanged(
*/
if (!(dInfoPtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
+ Tcl_DoWhenIdle(DisplayText, textPtr);
}
dInfoPtr->flags |= REDRAW_PENDING|DINFO_OUT_OF_DATE|REPICK_NEEDED;
@@ -4735,7 +4732,7 @@ TextRedrawTag(
*/
if (!(dInfoPtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
+ Tcl_DoWhenIdle(DisplayText, textPtr);
}
dInfoPtr->flags |= REDRAW_PENDING|DINFO_OUT_OF_DATE|REPICK_NEEDED;
@@ -4840,7 +4837,7 @@ TkTextRelayoutWindow(
*/
if (!(dInfoPtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
+ Tcl_DoWhenIdle(DisplayText, textPtr);
}
dInfoPtr->flags |= REDRAW_PENDING|REDRAW_BORDERS|DINFO_OUT_OF_DATE
|REPICK_NEEDED;
@@ -4935,7 +4932,7 @@ TkTextRelayoutWindow(
if (dInfoPtr->lineUpdateTimer == NULL) {
textPtr->refCount++;
dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(1,
- AsyncUpdateLineMetrics, (ClientData) textPtr);
+ AsyncUpdateLineMetrics, textPtr);
}
}
}
@@ -5119,7 +5116,7 @@ TkTextSetYView(
scheduleUpdate:
if (!(dInfoPtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
+ Tcl_DoWhenIdle(DisplayText, textPtr);
}
dInfoPtr->flags |= REDRAW_PENDING|DINFO_OUT_OF_DATE|REPICK_NEEDED;
}
@@ -5385,7 +5382,7 @@ TkTextSeeCmd(
*/
if (chunkPtr != NULL) {
- (*chunkPtr->bboxProc)(textPtr, chunkPtr, byteCount,
+ chunkPtr->bboxProc(textPtr, chunkPtr, byteCount,
dlPtr->y + dlPtr->spaceAbove,
dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow,
dlPtr->baseline - dlPtr->spaceAbove, &x, &y, &width,
@@ -5399,22 +5396,20 @@ TkTextSeeCmd(
dInfoPtr->newXPixelOffset -= ((-delta) );
}
} else {
- delta -= (lineWidth - width);
- if (delta > 0) {
- if (delta > oneThird) {
- dInfoPtr->newXPixelOffset = (x - lineWidth/2);
- } else {
- dInfoPtr->newXPixelOffset += (delta );
- }
- } else {
+ delta -= lineWidth - width;
+ if (delta <= 0) {
return TCL_OK;
+ } else if (delta > oneThird) {
+ dInfoPtr->newXPixelOffset = (x - lineWidth/2);
+ } else {
+ dInfoPtr->newXPixelOffset += (delta );
}
}
}
dInfoPtr->flags |= DINFO_OUT_OF_DATE;
if (!(dInfoPtr->flags & REDRAW_PENDING)) {
dInfoPtr->flags |= REDRAW_PENDING;
- Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
+ Tcl_DoWhenIdle(DisplayText, textPtr);
}
return TCL_OK;
}
@@ -5495,7 +5490,7 @@ TkTextXviewCmd(
dInfoPtr->flags |= DINFO_OUT_OF_DATE;
if (!(dInfoPtr->flags & REDRAW_PENDING)) {
dInfoPtr->flags |= REDRAW_PENDING;
- Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
+ Tcl_DoWhenIdle(DisplayText, textPtr);
}
return TCL_OK;
}
@@ -5580,7 +5575,7 @@ YScrollByPixels(
return;
}
if (!(dInfoPtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
+ Tcl_DoWhenIdle(DisplayText, textPtr);
}
dInfoPtr->flags |= REDRAW_PENDING|DINFO_OUT_OF_DATE|REPICK_NEEDED;
}
@@ -5697,7 +5692,7 @@ YScrollByLines(
scheduleUpdate:
if (!(dInfoPtr->flags & REDRAW_PENDING)) {
- Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
+ Tcl_DoWhenIdle(DisplayText, textPtr);
}
dInfoPtr->flags |= REDRAW_PENDING|DINFO_OUT_OF_DATE|REPICK_NEEDED;
}
@@ -5977,7 +5972,7 @@ TkTextScanCmd(
dInfoPtr->flags |= DINFO_OUT_OF_DATE;
if (!(dInfoPtr->flags & REDRAW_PENDING)) {
dInfoPtr->flags |= REDRAW_PENDING;
- Tcl_DoWhenIdle(DisplayText, (ClientData) textPtr);
+ Tcl_DoWhenIdle(DisplayText, textPtr);
}
} else if (c=='m' && strncmp(Tcl_GetString(objv[2]), "mark", length)==0) {
dInfoPtr->scanMarkXPixel = dInfoPtr->newXPixelOffset;
@@ -6190,9 +6185,8 @@ GetYPixelCount(
notFirst = 1;
}
break;
- } else {
- dlPtr = dlPtr->nextPtr;
}
+ dlPtr = dlPtr->nextPtr;
} while (dlPtr->index.linePtr == linePtr);
return count;
@@ -6378,7 +6372,7 @@ static void
AsyncUpdateYScrollbar(
ClientData clientData) /* Information about widget. */
{
- register TkText *textPtr = (TkText *) clientData;
+ register TkText *textPtr = clientData;
textPtr->dInfoPtr->scrollbarTimer = NULL;
@@ -6543,25 +6537,26 @@ TkTextPixelIndex(
}
*indexPtr = textPtr->topIndex;
return;
- } else {
- for (dlPtr = validDlPtr = dInfoPtr->dLinePtr;
- y >= (dlPtr->y + dlPtr->height);
- dlPtr = dlPtr->nextPtr) {
- if (dlPtr->chunkPtr != NULL) {
- validDlPtr = dlPtr;
- }
- if (dlPtr->nextPtr == NULL) {
- /*
- * Y-coordinate is off the bottom of the displayed text. Use
- * the last character on the last line.
- */
+ }
+ for (dlPtr = validDlPtr = dInfoPtr->dLinePtr;
+ y >= (dlPtr->y + dlPtr->height);
+ dlPtr = dlPtr->nextPtr) {
+ if (dlPtr->chunkPtr != NULL) {
+ validDlPtr = dlPtr;
+ }
+ if (dlPtr->nextPtr == NULL) {
+ /*
+ * Y-coordinate is off the bottom of the displayed text. Use the
+ * last character on the last line.
+ */
- x = dInfoPtr->maxX - 1;
- nearby = 1;
- break;
- }
+ x = dInfoPtr->maxX - 1;
+ nearby = 1;
+ break;
}
- if (dlPtr->chunkPtr == NULL) dlPtr = validDlPtr;
+ }
+ if (dlPtr->chunkPtr == NULL) {
+ dlPtr = validDlPtr;
}
if (nearest != NULL) {
@@ -6654,7 +6649,7 @@ DlineIndexOfX(
*/
if (chunkPtr->numBytes > 1) {
- indexPtr->byteIndex += (*chunkPtr->measureProc)(chunkPtr, x);
+ indexPtr->byteIndex += chunkPtr->measureProc(chunkPtr, x);
}
}
@@ -6742,15 +6737,14 @@ DlineXOfIndex(
if (byteIndex < chunkPtr->numBytes) {
int y, width, height;
- (*chunkPtr->bboxProc)(textPtr, chunkPtr, byteIndex,
+ chunkPtr->bboxProc(textPtr, chunkPtr, byteIndex,
dlPtr->y + dlPtr->spaceAbove,
dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow,
dlPtr->baseline - dlPtr->spaceAbove, &x, &y, &width,
&height);
break;
- } else {
- byteIndex -= chunkPtr->numBytes;
}
+ byteIndex -= chunkPtr->numBytes;
if (chunkPtr->nextPtr == NULL || byteIndex == 0) {
x = chunkPtr->x + chunkPtr->width;
break;
@@ -6838,7 +6832,7 @@ TkTextIndexBbox(
* coordinate on the screen. Translate it to reflect horizontal scrolling.
*/
- (*chunkPtr->bboxProc)(textPtr, chunkPtr, byteIndex,
+ chunkPtr->bboxProc(textPtr, chunkPtr, byteIndex,
dlPtr->y + dlPtr->spaceAbove,
dlPtr->height - dlPtr->spaceAbove - dlPtr->spaceBelow,
dlPtr->baseline - dlPtr->spaceAbove, xPtr, yPtr, widthPtr,
@@ -7079,7 +7073,7 @@ TkTextCharLayoutProc(
ciPtr = &bciPtr->ci;
} else {
- bciPtr = (BaseCharInfo *) baseCharChunkPtr->clientData;
+ bciPtr = baseCharChunkPtr->clientData;
ciPtr = (CharInfo *) ckalloc(sizeof(CharInfo));
baseString = &bciPtr->baseChars;
}
@@ -7087,7 +7081,7 @@ TkTextCharLayoutProc(
lineOffset = Tcl_DStringLength(baseString);
line = Tcl_DStringAppend(baseString,p,maxBytes);
- chunkPtr->clientData = (ClientData) ciPtr;
+ chunkPtr->clientData = ciPtr;
ciPtr->baseChunkPtr = baseCharChunkPtr;
ciPtr->baseOffset = lineOffset;
ciPtr->chars = NULL;
@@ -7171,7 +7165,7 @@ TkTextCharLayoutProc(
#if !TK_LAYOUT_WITH_BASE_CHUNKS
ciPtr = (CharInfo *)
ckalloc((unsigned) bytesThatFit + Tk_Offset(CharInfo, chars) + 1);
- chunkPtr->clientData = (ClientData) ciPtr;
+ chunkPtr->clientData = ciPtr;
memcpy(ciPtr->chars, p, (unsigned) bytesThatFit);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
@@ -7273,7 +7267,7 @@ CharChunkMeasureChars(
* here. */
{
Tk_Font tkfont = chunkPtr->stylePtr->sValuePtr->tkfont;
- CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData;
+ CharInfo *ciPtr = chunkPtr->clientData;
#if !TK_LAYOUT_WITH_BASE_CHUNKS
if (chars == NULL) {
@@ -7362,7 +7356,7 @@ CharDisplayProc(
int screenY) /* Y-coordinate in text window that
* corresponds to y. */
{
- CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData;
+ CharInfo *ciPtr = chunkPtr->clientData;
const char *string;
TextStyle *stylePtr;
StyleValues *sValuePtr;
@@ -7380,7 +7374,7 @@ CharDisplayProc(
}
#if TK_DRAW_IN_CONTEXT
- bciPtr = (BaseCharInfo *) ciPtr->baseChunkPtr->clientData;
+ bciPtr = ciPtr->baseChunkPtr->clientData;
numBytes = Tcl_DStringLength(&bciPtr->baseChars);
string = Tcl_DStringValue(&bciPtr->baseChars);
@@ -7513,7 +7507,7 @@ CharUndisplayProc(
TkText *textPtr, /* Overall information about text widget. */
TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */
{
- CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData;
+ CharInfo *ciPtr = chunkPtr->clientData;
if (ciPtr) {
#if TK_LAYOUT_WITH_BASE_CHUNKS
@@ -7616,7 +7610,7 @@ CharBboxProc(
int *heightPtr) /* Gets filled in with height of character, in
* pixels. */
{
- CharInfo *ciPtr = (CharInfo *) chunkPtr->clientData;
+ CharInfo *ciPtr = chunkPtr->clientData;
int maxX;
maxX = chunkPtr->width + chunkPtr->x;
@@ -7779,7 +7773,7 @@ AdjustForTab(
if (chunkPtr2->displayProc != CharDisplayProc) {
continue;
}
- ciPtr = (CharInfo *) chunkPtr2->clientData;
+ ciPtr = chunkPtr2->clientData;
for (p = ciPtr->chars, i = 0; i < ciPtr->numBytes; p++, i++) {
if (isdigit(UCHAR(*p))) {
gotDigit = 1;
@@ -7800,23 +7794,23 @@ AdjustForTab(
if (decimalChunkPtr != NULL) {
int curX;
- ciPtr = (CharInfo *) decimalChunkPtr->clientData;
+ ciPtr = decimalChunkPtr->clientData;
CharChunkMeasureChars(decimalChunkPtr, NULL, 0, 0, decimal,
decimalChunkPtr->x, -1, 0, &curX);
desired = tabX - (curX - x);
goto update;
- } else {
- /*
- * There wasn't a decimal point. Right justify the text.
- */
+ }
- width = 0;
- for (chunkPtr2 = chunkPtr->nextPtr; chunkPtr2 != NULL;
- chunkPtr2 = chunkPtr2->nextPtr) {
- width += chunkPtr2->width;
- }
- desired = tabX - width;
+ /*
+ * There wasn't a decimal point. Right justify the text.
+ */
+
+ width = 0;
+ for (chunkPtr2 = chunkPtr->nextPtr; chunkPtr2 != NULL;
+ chunkPtr2 = chunkPtr2->nextPtr) {
+ width += chunkPtr2->width;
}
+ desired = tabX - width;
/*
* Shift all of the chunks to the right so that the left edge is at the
@@ -8116,11 +8110,10 @@ MeasureChars(
break;
}
if (special < end) {
- if (ch == '\t') {
- start++;
- } else {
+ if (ch != '\t') {
break;
}
+ start++;
}
}
@@ -8280,7 +8273,7 @@ FinalizeBaseChunk(
if (chunkPtr->displayProc != CharDisplayProc) {
continue;
}
- ciPtr = (CharInfo *)chunkPtr->clientData;
+ ciPtr = chunkPtr->clientData;
if (ciPtr->baseChunkPtr != baseCharChunkPtr) {
break;
}
@@ -8297,7 +8290,7 @@ FinalizeBaseChunk(
}
if (addChunkPtr != NULL) {
- ciPtr = (CharInfo *)addChunkPtr->clientData;
+ ciPtr = addChunkPtr->clientData;
ciPtr->chars = baseChars + ciPtr->baseOffset;
#if TK_DRAW_IN_CONTEXT
@@ -8348,7 +8341,7 @@ FreeBaseChunk(
if (chunkPtr->undisplayProc != CharUndisplayProc) {
continue;
}
- ciPtr = (CharInfo *) chunkPtr->clientData;
+ ciPtr = chunkPtr->clientData;
if (ciPtr->baseChunkPtr != baseChunkPtr) {
break;
}
@@ -8466,14 +8459,14 @@ RemoveFromBaseChunk(
* Reinstitute this base chunk for re-layout.
*/
- ciPtr = (CharInfo *) chunkPtr->clientData;
+ ciPtr = chunkPtr->clientData;
baseCharChunkPtr = ciPtr->baseChunkPtr;
/*
* Remove the chunk data from the base chunk data.
*/
- bciPtr = (BaseCharInfo *) baseCharChunkPtr->clientData;
+ bciPtr = baseCharChunkPtr->clientData;
if ((ciPtr->baseOffset + ciPtr->numBytes)
!= Tcl_DStringLength(&bciPtr->baseChars)) {
diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c
index b9763d6..b6eba35 100644
--- a/generic/tkTextIndex.c
+++ b/generic/tkTextIndex.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkTextIndex.c,v 1.31 2008/10/15 06:41:06 nijtmans Exp $
+ * RCS: @(#) $Id: tkTextIndex.c,v 1.32 2008/11/08 18:44:40 dkf Exp $
*/
#include "default.h"
@@ -239,8 +239,8 @@ TkTextGetIndexFromObj(
if (objPtr->bytes == NULL) {
objPtr->typePtr->updateStringProc(objPtr);
}
- if ((objPtr->typePtr->freeIntRepProc) != NULL) {
- (*objPtr->typePtr->freeIntRepProc)(objPtr);
+ if (objPtr->typePtr->freeIntRepProc != NULL) {
+ objPtr->typePtr->freeIntRepProc(objPtr);
}
}
diff --git a/generic/tkUndo.c b/generic/tkUndo.c
index e875bf3..ceb6e51 100644
--- a/generic/tkUndo.c
+++ b/generic/tkUndo.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUndo.c,v 1.13 2007/12/13 15:24:21 dgp Exp $
+ * RCS: @(#) $Id: tkUndo.c,v 1.14 2008/11/08 18:44:40 dkf Exp $
*/
#include "tkInt.h"
@@ -656,7 +656,7 @@ EvaluateActionList(
while (action != NULL) {
if (action->funcPtr != NULL) {
- result = (*action->funcPtr)(interp, action->clientData,
+ result = action->funcPtr(interp, action->clientData,
action->action);
} else if (action->command != NULL) {
Tcl_Obj *cmdNameObj, *evalObj;
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index 7072009..84a448a 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUtil.c,v 1.23 2008/10/30 21:39:16 nijtmans Exp $
+ * RCS: @(#) $Id: tkUtil.c,v 1.24 2008/11/08 18:44:40 dkf Exp $
*/
#include "tkInt.h"
@@ -950,7 +950,7 @@ TkFindStateNumObj(
if (strcmp(key, mPtr->strKey) == 0) {
typePtr = keyPtr->typePtr;
if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) {
- (*typePtr->freeIntRepProc)(keyPtr);
+ typePtr->freeIntRepProc(keyPtr);
}
keyPtr->internalRep.twoPtrValue.ptr1 = (void *) mapPtr;
keyPtr->internalRep.twoPtrValue.ptr2 = INT2PTR(mPtr->numKey);
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 87bb2f7..5e4fabb 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWindow.c,v 1.98 2008/10/28 22:33:06 nijtmans Exp $
+ * RCS: @(#) $Id: tkWindow.c,v 1.99 2008/11/08 18:44:40 dkf Exp $
*/
#include "tkInt.h"
@@ -1706,7 +1706,7 @@ Tk_MakeWindowExist(
createProc = Tk_GetClassProc(winPtr->classProcsPtr, createProc);
if (createProc != NULL && parent != None) {
- winPtr->window = (*createProc)(tkwin, parent, winPtr->instanceData);
+ winPtr->window = createProc(tkwin, parent, winPtr->instanceData);
} else {
winPtr->window = TkpMakeWindow(winPtr, parent);
}