diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-25 12:52:45 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-25 12:52:45 (GMT) |
commit | e49c53fa60a2329599dc7dbd69ee4f841be994c8 (patch) | |
tree | de370306d5c18cf0e0217eb884ea8b6a01024080 /generic/tkTextWind.c | |
parent | 5a024656faa09acb77aa34603e41b1cd5e38fbe5 (diff) | |
download | tk-e49c53fa60a2329599dc7dbd69ee4f841be994c8.zip tk-e49c53fa60a2329599dc7dbd69ee4f841be994c8.tar.gz tk-e49c53fa60a2329599dc7dbd69ee4f841be994c8.tar.bz2 |
More usage of TCL_UNUSED() and implicit type-casts. Eliminate "register" keyword
Diffstat (limited to 'generic/tkTextWind.c')
-rw-r--r-- | generic/tkTextWind.c | 65 |
1 files changed, 31 insertions, 34 deletions
diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index a0e7089..c160083 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -35,7 +35,7 @@ static const Tk_GeomMgr textGeomType = { * Macro that determines the size of an embedded window segment: */ -#define EW_SEG_SIZE ((unsigned) (Tk_Offset(TkTextSegment, body) \ +#define EW_SEG_SIZE ((unsigned)(Tk_Offset(TkTextSegment, body) \ + sizeof(TkTextEmbWindow))) /* @@ -133,7 +133,7 @@ static const Tk_OptionSpec optionSpecs[] = { int TkTextWindowCmd( - register TkText *textPtr, /* Information about text widget. */ + TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already @@ -147,7 +147,7 @@ TkTextWindowCmd( enum windOptions { WIND_CGET, WIND_CONFIGURE, WIND_CREATE, WIND_NAMES }; - register TkTextSegment *ewPtr; + TkTextSegment *ewPtr; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "option ?arg ...?"); @@ -191,7 +191,7 @@ TkTextWindowCmd( ewPtr->body.ew.tkwin = NULL; } - objPtr = Tk_GetOptionValue(interp, (char *) &ewPtr->body.ew, + objPtr = Tk_GetOptionValue(interp, (char *)&ewPtr->body.ew, ewPtr->body.ew.optionTable, objv[4], textPtr->tkwin); if (objPtr == NULL) { return TCL_ERROR; @@ -233,7 +233,7 @@ TkTextWindowCmd( ewPtr->body.ew.tkwin = NULL; } - objPtr = Tk_GetOptionInfo(interp, (char *) &ewPtr->body.ew, + objPtr = Tk_GetOptionInfo(interp, (char *)&ewPtr->body.ew, ewPtr->body.ew.optionTable, (objc == 5) ? objv[4] : NULL, textPtr->tkwin); if (objPtr == NULL) { @@ -290,7 +290,7 @@ TkTextWindowCmd( * Create the new window segment and initialize it. */ - ewPtr = ckalloc(EW_SEG_SIZE); + ewPtr = (TkTextSegment *)ckalloc(EW_SEG_SIZE); ewPtr->typePtr = &tkTextEmbWindowType; ewPtr->size = 1; ewPtr->body.ew.sharedTextPtr = textPtr->sharedTextPtr; @@ -302,7 +302,7 @@ TkTextWindowCmd( ewPtr->body.ew.stretch = 0; ewPtr->body.ew.optionTable = Tk_CreateOptionTable(interp, optionSpecs); - client = ckalloc(sizeof(TkTextEmbWindowClient)); + client = (TkTextEmbWindowClient *)ckalloc(sizeof(TkTextEmbWindowClient)); client->next = NULL; client->textPtr = textPtr; client->tkwin = NULL; @@ -345,7 +345,7 @@ TkTextWindowCmd( for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->windowTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( - Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), + (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1)); } Tcl_SetObjResult(interp, resultObj); @@ -403,7 +403,7 @@ EmbWinConfigure( } oldWindow = ewPtr->body.ew.tkwin; - if (Tk_SetOptions(textPtr->interp, (char *) &ewPtr->body.ew, + if (Tk_SetOptions(textPtr->interp, (char *)&ewPtr->body.ew, ewPtr->body.ew.optionTable, objc, objv, textPtr->tkwin, NULL, NULL) != TCL_OK) { return TCL_ERROR; @@ -467,7 +467,7 @@ EmbWinConfigure( * Have to make the new client. */ - client = ckalloc(sizeof(TkTextEmbWindowClient)); + client = (TkTextEmbWindowClient *)ckalloc(sizeof(TkTextEmbWindowClient)); client->next = ewPtr->body.ew.clients; client->textPtr = textPtr; client->tkwin = NULL; @@ -526,7 +526,7 @@ EmbWinStructureProc( ClientData clientData, /* Pointer to record describing window item. */ XEvent *eventPtr) /* Describes what just happened. */ { - TkTextEmbWindowClient *client = clientData; + TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData; TkTextSegment *ewPtr = client->parent; TkTextIndex index; Tcl_HashEntry *hPtr; @@ -573,13 +573,12 @@ EmbWinStructureProc( *-------------------------------------------------------------- */ - /* ARGSUSED */ static void EmbWinRequestProc( ClientData clientData, /* Pointer to record for window item. */ - Tk_Window tkwin) /* Window that changed its desired size. */ + TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */ { - TkTextEmbWindowClient *client = clientData; + TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData; TkTextSegment *ewPtr = client->parent; TkTextIndex index; @@ -616,7 +615,7 @@ EmbWinLostContentProc( Tk_Window tkwin) /* Window that was claimed away by another * geometry manager. */ { - TkTextEmbWindowClient *client = clientData; + TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData; TkTextSegment *ewPtr = client->parent; TkTextIndex index; Tcl_HashEntry *hPtr; @@ -736,12 +735,11 @@ TkTextWinFreeClient( *-------------------------------------------------------------- */ - /* ARGSUSED */ static int EmbWinDeleteProc( TkTextSegment *ewPtr, /* Segment being deleted. */ - TkTextLine *linePtr, /* Line containing segment. */ - int treeGone) /* Non-zero means the entire tree is being + TCL_UNUSED(TkTextLine *), /* Line containing segment. */ + TCL_UNUSED(int)) /* Non-zero means the entire tree is being * deleted, so everything must get cleaned * up. */ { @@ -816,24 +814,23 @@ EmbWinCleanupProc( *-------------------------------------------------------------- */ - /*ARGSUSED*/ static int EmbWinLayoutProc( TkText *textPtr, /* Text widget being layed out. */ - TkTextIndex *indexPtr, /* Identifies first character in chunk. */ + TCL_UNUSED(TkTextIndex *), /* Identifies first character in chunk. */ TkTextSegment *ewPtr, /* Segment corresponding to indexPtr. */ int offset, /* Offset within segPtr corresponding to * indexPtr (always 0). */ int maxX, /* Chunk must not occupy pixels at this * position or higher. */ - int maxChars, /* Chunk must not include more than this many + TCL_UNUSED(int), /* Chunk must not include more than this many * characters. */ int noCharsYet, /* Non-zero means no characters have been * assigned to this line yet. */ - TkWrapMode wrapMode, /* Wrap mode to use for line: + TCL_UNUSED(TkWrapMode), /* Wrap mode to use for line: * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or * TEXT_WRAPMODE_WORD. */ - register TkTextDispChunk *chunkPtr) + TkTextDispChunk *chunkPtr) /* Structure to fill in with information about * this chunk. The x field has already been * set by the caller. */ @@ -959,7 +956,7 @@ EmbWinLayoutProc( * now need to add to our client list. */ - client = ckalloc(sizeof(TkTextEmbWindowClient)); + client = (TkTextEmbWindowClient *)ckalloc(sizeof(TkTextEmbWindowClient)); client->next = ewPtr->body.ew.clients; client->textPtr = textPtr; client->tkwin = NULL; @@ -1052,7 +1049,7 @@ EmbWinLayoutProc( static void EmbWinCheckProc( TkTextSegment *ewPtr, /* Segment to check. */ - TkTextLine *linePtr) /* Line containing segment. */ + TCL_UNUSED(TkTextLine *)) /* Line containing segment. */ { if (ewPtr->nextPtr == NULL) { Tcl_Panic("EmbWinCheckProc: embedded window is last segment in line"); @@ -1087,20 +1084,20 @@ TkTextEmbWinDisplayProc( int x, /* X-position in dst at which to draw this * chunk (differs from the x-position in the * chunk because of scrolling). */ - int y, /* Top of rectangular bounding box for line: + TCL_UNUSED(int), /* Top of rectangular bounding box for line: * tells where to draw this chunk in dst * (x-position is in the chunk itself). */ int lineHeight, /* Total height of line. */ int baseline, /* Offset of baseline from y. */ - Display *display, /* Display to use for drawing (unused). */ - Drawable dst, /* Pixmap or window in which to draw + TCL_UNUSED(Display *), /* Display to use for drawing (unused). */ + TCL_UNUSED(Drawable), /* Pixmap or window in which to draw * (unused). */ int screenY) /* Y-coordinate in text window that * corresponds to y. */ { int lineX, windowX, windowY, width, height; Tk_Window tkwin; - TkTextSegment *ewPtr = chunkPtr->clientData; + TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData; TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr); if (client == NULL) { @@ -1180,7 +1177,7 @@ EmbWinUndisplayProc( TkText *textPtr, /* Overall information about text widget. */ TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */ { - TkTextSegment *ewPtr = chunkPtr->clientData; + TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData; TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr); if (client == NULL) { @@ -1228,7 +1225,7 @@ static void EmbWinBboxProc( TkText *textPtr, /* Information about text widget. */ TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */ - int index, /* Index of desired character within the + TCL_UNUSED(int), /* Index of desired character within the * chunk. */ int y, /* Topmost pixel in area allocated for this * line. */ @@ -1243,7 +1240,7 @@ EmbWinBboxProc( * pixels. */ { Tk_Window tkwin; - TkTextSegment *ewPtr = chunkPtr->clientData; + TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData; TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr); if (client == NULL) { @@ -1305,7 +1302,7 @@ static void EmbWinDelayedUnmap( ClientData clientData) /* Token for the window to be unmapped. */ { - TkTextEmbWindowClient *client = clientData; + TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData; if (!client->displayed && (client->tkwin != NULL)) { if (client->textPtr->tkwin != Tk_Parent(client->tkwin)) { @@ -1353,7 +1350,7 @@ TkTextWindowIndex( return 0; } - ewPtr = Tcl_GetHashValue(hPtr); + ewPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); indexPtr->tree = textPtr->sharedTextPtr->tree; indexPtr->linePtr = ewPtr->body.ew.linePtr; indexPtr->byteIndex = TkTextSegToOffset(ewPtr, indexPtr->linePtr); |