diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-10 09:20:36 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-09-10 09:20:36 (GMT) |
commit | 8cca8f728893dae5f606e95672a5c6c752b295fe (patch) | |
tree | 8649fb819161058527993acef2ba2152e59f48a7 /generic | |
parent | 00b8a9b7dca2e057f57acf088bb0792edc77769a (diff) | |
parent | 0e5885d7fab885a2ef6ee3d709a6745b0bf585fb (diff) | |
download | tk-8cca8f728893dae5f606e95672a5c6c752b295fe.zip tk-8cca8f728893dae5f606e95672a5c6c752b295fe.tar.gz tk-8cca8f728893dae5f606e95672a5c6c752b295fe.tar.bz2 |
Merge 8.6
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkFont.c | 12 | ||||
-rw-r--r-- | generic/tkSelect.c | 4 | ||||
-rw-r--r-- | generic/tkText.c | 53 | ||||
-rw-r--r-- | generic/tkTextDisp.c | 47 |
4 files changed, 44 insertions, 72 deletions
diff --git a/generic/tkFont.c b/generic/tkFont.c index 67d0b36..b230fff 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -1362,11 +1362,10 @@ Tk_GetFontFromObj( static int SetFontFromAny( - Tcl_Interp *dummy, /* Used for error reporting if not NULL. */ + TCL_UNUSED(Tcl_Interp *), /* Used for error reporting if not NULL. */ Tcl_Obj *objPtr) /* The object to convert. */ { const Tcl_ObjType *typePtr; - (void)dummy; /* * Free the old internalRep before setting the new one. @@ -2002,8 +2001,8 @@ Tk_ComputeTextLayout( maxChunks = 1; - layoutPtr = (TextLayout *)ckalloc(sizeof(TextLayout) - + (maxChunks-1) * sizeof(LayoutChunk)); + layoutPtr = (TextLayout *)ckalloc(offsetof(TextLayout, chunks) + + maxChunks * sizeof(LayoutChunk)); layoutPtr->tkfont = tkfont; layoutPtr->string = string; layoutPtr->numChunks = 0; @@ -3400,7 +3399,7 @@ noMapping: ; static int ConfigAttributesObj( Tcl_Interp *interp, /* Interp for error return. */ - Tk_Window tkwin, /* For display on which font will be used. */ + TCL_UNUSED(Tk_Window), /* For display on which font will be used. */ int objc, /* Number of elements in argv. */ Tcl_Obj *const objv[], /* Command line options. */ TkFontAttributes *faPtr) /* Font attributes structure whose fields are @@ -3410,7 +3409,6 @@ ConfigAttributesObj( int i, n, index; Tcl_Obj *optionPtr, *valuePtr; const char *value; - (void)tkwin; for (i = 0; i < objc; i += 2) { optionPtr = objv[i]; @@ -3827,7 +3825,7 @@ NewChunk( maxChunks = *maxPtr; if (layoutPtr->numChunks == maxChunks) { maxChunks *= 2; - s = sizeof(TextLayout) + ((maxChunks - 1) * sizeof(LayoutChunk)); + s = offsetof(TextLayout, chunks) + (maxChunks * sizeof(LayoutChunk)); layoutPtr = (TextLayout *)ckrealloc(layoutPtr, s); *layoutPtrPtr = layoutPtr; diff --git a/generic/tkSelect.c b/generic/tkSelect.c index a45aa4b..a2a6018 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -1289,12 +1289,10 @@ static int SelGetProc( ClientData clientData, /* Dynamic string holding partially assembled * selection. */ - Tcl_Interp *dummy, /* Interpreter used for error reporting (not + TCL_UNUSED(Tcl_Interp *), /* Interpreter used for error reporting (not * used). */ const char *portion) /* New information to be appended. */ { - (void)dummy; - Tcl_DStringAppend((Tcl_DString *)clientData, portion, -1); return TCL_OK; } diff --git a/generic/tkText.c b/generic/tkText.c index 0eb256f..990ffb3 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -298,10 +298,10 @@ typedef struct SearchSpec { int all; /* Whether all or the first match should be * reported. */ int startLine; /* First line to examine. */ - TkSizeT startOffset1; /* Index in first line to start at. */ + TkSizeT startOffset; /* Index in first line to start at. */ int stopLine; /* Last line to examine, or -1 when we search * all available text. */ - TkSizeT stopOffset1; /* Index to stop at, provided stopLine is not + TkSizeT stopOffset; /* Index to stop at, provided stopLine is not * -1. */ int numLines; /* Total lines which are available. */ int backwards; /* Searching forwards or backwards. */ @@ -1161,7 +1161,7 @@ TextWidgetObjCmd( * first to maintain index consistency. */ - qsort(indices, objc / 2, + qsort(indices, (size_t) objc / 2, 2 * sizeof(TkTextIndex), TextIndexSortProc); lastStart = NULL; @@ -4288,7 +4288,7 @@ TextSearchFoundMatch( */ if (searchSpecPtr->backwards ^ - (matchOffset + 1 >= searchSpecPtr->stopOffset1 + 1)) { + (matchOffset + 1 >= searchSpecPtr->stopOffset + 1)) { return 0; } } @@ -4313,7 +4313,7 @@ TextSearchFoundMatch( if (searchSpecPtr->strictLimits && lineNum == searchSpecPtr->stopLine) { if (searchSpecPtr->backwards ^ - ((matchOffset + numChars + 1) > searchSpecPtr->stopOffset1 + 1)) { + ((matchOffset + numChars + 1) > searchSpecPtr->stopOffset + 1)) { return 0; } } @@ -4539,8 +4539,8 @@ TkTextGetTabs( * Parse the elements of the list one at a time to fill in the array. */ - tabArrayPtr = (TkTextTabArray *)ckalloc(sizeof(TkTextTabArray) - + (count - 1) * sizeof(TkTextTab)); + tabArrayPtr = (TkTextTabArray *)ckalloc(offsetof(TkTextTabArray, tabs) + + count * sizeof(TkTextTab)); tabArrayPtr->numTabs = 0; prevStop = 0.0; lastStop = 0.0; @@ -5060,11 +5060,10 @@ DumpSegment( const char *value, /* Segment value. */ Tcl_Obj *command, /* Script callback. */ const TkTextIndex *index, /* index with line/byte position info. */ - int what) /* Look for TK_DUMP_INDEX bit. */ + TCL_UNUSED(int)) /* Look for TK_DUMP_INDEX bit. */ { char buffer[TK_POS_CHARS]; Tcl_Obj *values[3], *tuple; - (void)what; TkTextPrintIndex(textPtr, index, buffer); values[0] = Tcl_NewStringObj(key, -1); @@ -5664,7 +5663,7 @@ SearchPerform( if (searchSpecPtr->lineIndexProc(interp, fromPtr, searchSpecPtr, &searchSpecPtr->startLine, - &searchSpecPtr->startOffset1) != TCL_OK) { + &searchSpecPtr->startOffset) != TCL_OK) { return TCL_ERROR; } @@ -5695,7 +5694,7 @@ SearchPerform( if (searchSpecPtr->lineIndexProc(interp, toPtr, searchSpecPtr, &searchSpecPtr->stopLine, - &searchSpecPtr->stopOffset1) != TCL_OK) { + &searchSpecPtr->stopOffset) != TCL_OK) { return TCL_ERROR; } } else { @@ -5894,7 +5893,7 @@ SearchCore( } if (lineNum == searchSpecPtr->stopLine && searchSpecPtr->backwards) { - firstOffset = searchSpecPtr->stopOffset1; + firstOffset = searchSpecPtr->stopOffset; } else { firstOffset = 0; } @@ -5928,8 +5927,8 @@ SearchCore( * Only use the last part of the line. */ - if (searchSpecPtr->startOffset1 + 1 > (TkSizeT)firstOffset + 1) { - firstOffset = searchSpecPtr->startOffset1; + if (searchSpecPtr->startOffset + 1 > (TkSizeT)firstOffset + 1) { + firstOffset = searchSpecPtr->startOffset; } if ((firstOffset >= lastOffset) && ((lastOffset != 0) || searchSpecPtr->exact)) { @@ -5940,8 +5939,8 @@ SearchCore( * Use only the first part of the line. */ - if (searchSpecPtr->startOffset1 + 1 < (TkSizeT)lastOffset + 1) { - lastOffset = searchSpecPtr->startOffset1; + if (searchSpecPtr->startOffset + 1 < (TkSizeT)lastOffset + 1) { + lastOffset = searchSpecPtr->startOffset; } } } @@ -6777,15 +6776,13 @@ SearchCore( static Tcl_Obj * GetLineStartEnd( - ClientData dummy, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), char *recordPtr, /* Pointer to widget record. */ TkSizeT internalOffset) /* Offset within *recordPtr containing the * line value. */ { TkTextLine *linePtr = *(TkTextLine **)(recordPtr + internalOffset); - (void)dummy; - (void)tkwin; if (linePtr == NULL) { return Tcl_NewObj(); @@ -6814,9 +6811,9 @@ GetLineStartEnd( static int SetLineStartEnd( - ClientData dummy, + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interp; may be used for errors. */ - Tk_Window tkwin, /* Window for which option is being set. */ + TCL_UNUSED(Tk_Window), /* Window for which option is being set. */ Tcl_Obj **value, /* Pointer to the pointer to the value object. * We use a pointer to the pointer because we * may need to return a value (NULL). */ @@ -6829,8 +6826,6 @@ SetLineStartEnd( TkTextLine *linePtr = NULL; char *internalPtr; TkText *textPtr = (TkText *) recordPtr; - (void)dummy; - (void)tkwin; if (internalOffset != TCL_INDEX_NONE) { internalPtr = (char *)recordPtr + internalOffset; @@ -6875,14 +6870,11 @@ SetLineStartEnd( static void RestoreLineStartEnd( - ClientData dummy, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), char *internalPtr, /* Pointer to storage for value. */ char *oldInternalPtr) /* Pointer to old value. */ { - (void)dummy; - (void)tkwin; - *(TkTextLine **)internalPtr = *(TkTextLine **)oldInternalPtr; } @@ -6937,7 +6929,7 @@ ObjectIsEmpty( int TkpTesttextCmd( - ClientData dummy, /* Main window for application. */ + TCL_UNUSED(void *), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -6948,7 +6940,6 @@ TkpTesttextCmd( TkTextIndex index; char buf[64]; Tcl_CmdInfo info; - (void)dummy; if (objc < 3) { return TCL_ERROR; diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index abcd3e3..61b0a8b 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -444,8 +444,8 @@ typedef struct TextDInfo { typedef struct CharInfo { int numBytes; /* Number of bytes to display. */ - char chars[1]; /* UTF characters to display. Actual size will - * be numBytes, not 1. THIS MUST BE THE LAST + char chars[1]; /* UTF characters to display. + * Allocated as large as necessary. THIS MUST BE THE LAST * FIELD IN THE STRUCTURE. */ } CharInfo; @@ -7542,14 +7542,14 @@ TkTextDLineInfo( static void ElideBboxProc( - TkText *textPtr, + TCL_UNUSED(TkText *), 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. */ - int lineHeight, /* Height of line, in pixels. */ - int baseline, /* Location of line's baseline, in pixels + TCL_UNUSED(int), /* Height of line, in pixels. */ + TCL_UNUSED(int), /* Location of line's baseline, in pixels * measured down from y. */ int *xPtr, int *yPtr, /* Gets filled in with coords of character's * upper-left pixel. X-coord is in same @@ -7559,10 +7559,6 @@ ElideBboxProc( int *heightPtr) /* Gets filled in with height of character, in * pixels. */ { - (void)textPtr; - (void)index; - (void)lineHeight; - (void)baseline; *xPtr = chunkPtr->x; *yPtr = y; @@ -7575,13 +7571,10 @@ ElideBboxProc( static int ElideMeasureProc( - TkTextDispChunk *chunkPtr, /* Chunk containing desired coord. */ - int x) /* X-coordinate, in same coordinate system as + TCL_UNUSED(TkTextDispChunk *), /* Chunk containing desired coord. */ + TCL_UNUSED(int)) /* X-coordinate, in same coordinate system as * chunkPtr->x. */ { - (void)chunkPtr; - (void)x; - return 0 /*chunkPtr->numBytes - 1*/; } @@ -7608,8 +7601,8 @@ ElideMeasureProc( int TkTextCharLayoutProc( - TkText *textPtr, /* Text widget being layed out. */ - TkTextIndex *indexPtr, /* Index of first character to lay out + TCL_UNUSED(TkText *), /* Text widget being layed out. */ + TCL_UNUSED(TkTextIndex *), /* Index of first character to lay out * (corresponds to segPtr and offset). */ TkTextSegment *segPtr, /* Segment being layed out. */ TkSizeT byteOffset, /* Byte offset within segment of first @@ -7641,8 +7634,6 @@ TkTextCharLayoutProc( BaseCharInfo *bciPtr; Tcl_DString *baseString; #endif - (void)textPtr; - (void)indexPtr; /* * Figure out how many characters will fit in the space we've got. Include @@ -7965,18 +7956,18 @@ CharChunkMeasureChars( static void CharDisplayProc( - TkText *textPtr, + TCL_UNUSED(TkText *), TkTextDispChunk *chunkPtr, /* Chunk that is to be drawn. */ int x, /* X-position in dst at which to draw this * chunk (may differ from the x-position in * the chunk because of scrolling). */ int y, /* Y-position at which to draw this chunk in * dst. */ - int height, /* Total height of line. */ + TCL_UNUSED(int), /* Total height of line. */ int baseline, /* Offset of baseline from y. */ Display *display, /* Display to use for drawing. */ Drawable dst, /* Pixmap or window in which to draw chunk. */ - int screenY) /* Y-coordinate in text window that + TCL_UNUSED(int)) /* Y-coordinate in text window that * corresponds to y. */ { CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; @@ -7987,9 +7978,6 @@ CharDisplayProc( #if TK_DRAW_IN_CONTEXT BaseCharInfo *bciPtr; #endif /* TK_DRAW_IN_CONTEXT */ - (void)textPtr; - (void)height; - (void)screenY; if ((x + chunkPtr->width) <= 0) { /* @@ -8130,11 +8118,10 @@ CharDisplayProc( static void CharUndisplayProc( - TkText *textPtr, /* Overall information about text widget. */ + TCL_UNUSED(TkText *), /* Overall information about text widget. */ TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */ { CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; - (void)textPtr; if (ciPtr) { #if TK_LAYOUT_WITH_BASE_CHUNKS @@ -8220,13 +8207,13 @@ CharMeasureProc( static void CharBboxProc( - TkText *textPtr, + TCL_UNUSED(TkText *), TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */ int byteIndex, /* Byte offset of desired character within the * chunk. */ int y, /* Topmost pixel in area allocated for this * line. */ - int lineHeight, /* Height of line, in pixels. */ + TCL_UNUSED(int), /* Height of line, in pixels. */ int baseline, /* Location of line's baseline, in pixels * measured down from y. */ int *xPtr, int *yPtr, /* Gets filled in with coords of character's @@ -8239,8 +8226,6 @@ CharBboxProc( { CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; int maxX; - (void)textPtr; - (void)lineHeight; maxX = chunkPtr->width + chunkPtr->x; CharChunkMeasureChars(chunkPtr, NULL, 0, 0, byteIndex, |