diff options
-rw-r--r-- | generic/tkFont.c | 2 | ||||
-rw-r--r-- | generic/tkInt.h | 5 | ||||
-rw-r--r-- | generic/tkPointer.c | 2 | ||||
-rw-r--r-- | generic/tkSelect.c | 2 | ||||
-rw-r--r-- | generic/tkText.h | 4 | ||||
-rw-r--r-- | generic/tkTextDisp.c | 2 | ||||
-rw-r--r-- | unix/tkUnixWm.c | 2 | ||||
-rw-r--r-- | win/tkWinFont.c | 35 | ||||
-rw-r--r-- | win/tkWinWm.c | 2 |
9 files changed, 29 insertions, 27 deletions
diff --git a/generic/tkFont.c b/generic/tkFont.c index ab431a0..3aed702 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -96,7 +96,7 @@ typedef struct TextLayout { * layout. */ int numChunks; /* Number of chunks actually used in following * array. */ - LayoutChunk chunks[1]; /* Array of chunks. The actual size will be + LayoutChunk chunks[TKFLEXARRAY];/* Array of chunks. The actual size will be * maxChunks. THIS FIELD MUST BE THE LAST IN * THE STRUCTURE. */ } TextLayout; diff --git a/generic/tkInt.h b/generic/tkInt.h index f4bb23f..9f22b99 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -84,6 +84,11 @@ # endif #endif +#if defined(__GNUC__) && (__GNUC__ > 2) +# define TKFLEXARRAY 0 +#else +# define TKFLEXARRAY 1 +#endif #ifndef Tcl_GetParent # define Tcl_GetParent Tcl_GetMaster diff --git a/generic/tkPointer.c b/generic/tkPointer.c index c17367a..cc67401 100644 --- a/generic/tkPointer.c +++ b/generic/tkPointer.c @@ -26,7 +26,7 @@ typedef struct { TkWindow *grabWinPtr; /* Window that defines the top of the grab * tree in a global grab. */ - int lastState; /* Last known state flags. */ + unsigned lastState; /* Last known state flags. */ XPoint lastPos; /* Last reported mouse position. */ TkWindow *lastWinPtr; /* Last reported mouse window. */ TkWindow *restrictWinPtr; /* Window to which all mouse events will be diff --git a/generic/tkSelect.c b/generic/tkSelect.c index 91f0836..9584be4 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -28,7 +28,7 @@ typedef struct { * chunk. */ char buffer[4]; /* A buffer to hold part of a UTF character * that is split across chunks. */ - char command[1]; /* Command to invoke. Actual space is + char command[TKFLEXARRAY]; /* Command to invoke. Actual space is * allocated as large as necessary. This must * be the last entry in the structure. */ } CommandInfo; diff --git a/generic/tkText.h b/generic/tkText.h index a8a17da..9a9495a 100644 --- a/generic/tkText.h +++ b/generic/tkText.h @@ -168,7 +168,7 @@ typedef struct TkTextSegment { int size; /* Size of this segment (# of bytes of index * space it occupies). */ union { - char chars[2]; /* Characters that make up character info. + char chars[TKFLEXARRAY]; /* Characters that make up character info. * Actual length varies to hold as many * characters as needed.*/ TkTextToggle toggle; /* Information about tag toggle. */ @@ -489,7 +489,7 @@ typedef struct TkTextTabArray { double tabIncrement; /* The accurate fractional pixel increment * between interpolated tabs we have to create * when we exceed numTabs. */ - TkTextTab tabs[1]; /* Array of tabs. The actual size will be + TkTextTab tabs[TKFLEXARRAY];/* Array of tabs. The actual size will be * numTabs. THIS FIELD MUST BE THE LAST IN THE * STRUCTURE. */ } TkTextTabArray; diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 6ab8508..0eae4a9 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -444,7 +444,7 @@ typedef struct TextDInfo { typedef struct CharInfo { int numBytes; /* Number of bytes to display. */ - char chars[1]; /* UTF characters to display. + char chars[TKFLEXARRAY]; /* UTF characters to display. * Allocated as large as necessary. THIS MUST BE THE LAST * FIELD IN THE STRUCTURE. */ } CharInfo; diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index 029f3aa..f1d1fe0 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -28,7 +28,7 @@ typedef struct ProtocolHandler { * same top-level window, or NULL for end of * list. */ Tcl_Interp *interp; /* Interpreter in which to invoke command. */ - char command[1]; /* Tcl command to invoke when a client message + char command[TKFLEXARRAY]; /* Tcl command to invoke when a client message * for this protocol arrives. The actual size * of the structure varies to accommodate the * needs of the actual command. THIS MUST BE diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 7967a61..1e1403f 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -654,8 +654,8 @@ TkpGetFontFamilies( static int CALLBACK WinFontFamilyEnumProc( ENUMLOGFONTW *lfPtr, /* Logical-font data. */ - NEWTEXTMETRIC *tmPtr, /* Physical-font data (not used). */ - int fontType, /* Type of font (not used). */ + TCL_UNUSED(NEWTEXTMETRIC *), /* Physical-font data (not used). */ + TCL_UNUSED(int), /* Type of font (not used). */ LPARAM lParam) /* Result object to hold result. */ { WCHAR *faceName = lfPtr->elfLogFont.lfFaceName; @@ -1016,7 +1016,7 @@ TkpMeasureCharsInContext( Tk_Font tkfont, /* Font in which characters will be drawn. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ - int numBytes, /* Maximum number of bytes to consider from + TCL_UNUSED(int), /* Maximum number of bytes to consider from * source string in all. */ int rangeStart, /* Index of first byte to measure. */ int rangeLength, /* Length of range to measure in bytes. */ @@ -1038,8 +1038,6 @@ TkpMeasureCharsInContext( int *lengthPtr) /* Filled with x-location just after the * terminating character. */ { - (void) numBytes; /*unused*/ - return Tk_MeasureChars(tkfont, source + rangeStart, rangeLength, maxLength, flags, lengthPtr); } @@ -1065,7 +1063,7 @@ Tk_DrawChars( Display *display, /* Display on which to draw. */ Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */ - Tk_Font tkfont, /* Font in which characters will be drawn; + TCL_UNUSED(Tk_Font), /* Font in which characters will be drawn; * must be the same as font used in GC. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters @@ -1212,7 +1210,7 @@ TkDrawAngledChars( Display *display, /* Display on which to draw. */ Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */ - Tk_Font tkfont, /* Font in which characters will be drawn; + TCL_UNUSED(Tk_Font), /* Font in which characters will be drawn; * must be the same as font used in GC. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters @@ -1390,7 +1388,7 @@ TkpDrawCharsInContext( * is passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ - int numBytes, /* Number of bytes in string. */ + TCL_UNUSED(int), /* Number of bytes in string. */ int rangeStart, /* Index of first byte to draw. */ int rangeLength, /* Length of range to draw in bytes. */ int x, int y) /* Coordinates at which to place origin of the @@ -1398,7 +1396,6 @@ TkpDrawCharsInContext( * drawing. */ { int widthUntilStart; - (void) numBytes; /*unused*/ Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart); Tk_DrawChars(display, drawable, gc, tkfont, source + rangeStart, @@ -1498,9 +1495,9 @@ MultiFontTextOut( familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternalDString(familyPtr->encoding, source, (int) (p - source), &runString); - familyPtr->textOutProc(hdc, x-(tm.tmOverhang/2), y, + familyPtr->textOutProc(hdc, x-((double)tm.tmOverhang/2), y, (WCHAR *)Tcl_DStringValue(&runString), - Tcl_DStringLength(&runString)>>familyPtr->isWideFont); + Tcl_DStringLength(&runString) >> familyPtr->isWideFont); familyPtr->getTextExtentPoint32Proc(hdc, (WCHAR *)Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont, @@ -1520,7 +1517,7 @@ MultiFontTextOut( familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternalDString(familyPtr->encoding, source, (int) (p - source), &runString); - familyPtr->textOutProc(hdc, x-(tm.tmOverhang/2), y, + familyPtr->textOutProc(hdc, x-((double)tm.tmOverhang/2), y, (WCHAR *)Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont); Tcl_DStringFree(&runString); @@ -1771,7 +1768,7 @@ AllocFontFamily( HDC hdc, /* HDC in which font can be selected. */ HFONT hFont, /* Screen font whose FontFamily is to be * returned. */ - int base) /* Non-zero if this font family is to be used + TCL_UNUSED(int)) /* Non-zero if this font family is to be used * in the base font of a font object. */ { Tk_Uid faceName; @@ -2069,8 +2066,8 @@ FindSubFontForChar( static int CALLBACK WinFontCanUseProc( ENUMLOGFONTW *lfPtr, /* Logical-font data. */ - NEWTEXTMETRIC *tmPtr, /* Physical-font data (not used). */ - int fontType, /* Type of font (not used). */ + TCL_UNUSED(NEWTEXTMETRIC *), /* Physical-font data (not used). */ + TCL_UNUSED(int), /* Type of font (not used). */ LPARAM lParam) /* Result object to hold result. */ { int ch; @@ -2606,10 +2603,10 @@ FamilyOrAliasExists( static int CALLBACK WinFontExistProc( - ENUMLOGFONTW *lfPtr, /* Logical-font data. */ - NEWTEXTMETRIC *tmPtr, /* Physical-font data (not used). */ - int fontType, /* Type of font (not used). */ - LPARAM lParam) /* EnumFontData to hold result. */ + TCL_UNUSED(ENUMLOGFONTW *), /* Logical-font data. */ + TCL_UNUSED(NEWTEXTMETRIC *), /* Physical-font data (not used). */ + TCL_UNUSED(int), /* Type of font (not used). */ + TCL_UNUSED(LPARAM)) /* EnumFontData to hold result. */ { return 0; } diff --git a/win/tkWinWm.c b/win/tkWinWm.c index ff3f07f..ff83ad2 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -58,7 +58,7 @@ typedef struct ProtocolHandler { * same top-level window, or NULL for end of * list. */ Tcl_Interp *interp; /* Interpreter in which to invoke command. */ - char command[1]; /* Tcl command to invoke when a client message + char command[TKFLEXARRAY]; /* Tcl command to invoke when a client message * for this protocol arrives. The actual size * of the structure varies to accommodate the * needs of the actual command. THIS MUST BE |