summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authornijtmans <nijtmans>2008-10-30 21:39:16 (GMT)
committernijtmans <nijtmans>2008-10-30 21:39:16 (GMT)
commitbc7cc1de3c6e12a43abe48282f8eeb413b3bb22a (patch)
tree9b240e7e0a446a742160201af095d711ba73aa70 /generic
parentc1f0473e3354fd5c7471d0389e6bcd9a200ec8c7 (diff)
downloadtk-bc7cc1de3c6e12a43abe48282f8eeb413b3bb22a.zip
tk-bc7cc1de3c6e12a43abe48282f8eeb413b3bb22a.tar.gz
tk-bc7cc1de3c6e12a43abe48282f8eeb413b3bb22a.tar.bz2
[Bug 2190619] Warnings due to Tk_SmoothMethod
name constness change. Although dkf's solution (simply adding a type cast) is correct as well, changing the return value (as das suggested) has the advantage that all Tk_OptionPrintProc implementations don't need a type cast any more in its code. This makes all those functions robust against the -Wwrite-strings warning option. Further on, the customPtr field of Tk_ConfigSpec can be a constant, without any danger of source incompatibility.
Diffstat (limited to 'generic')
-rw-r--r--generic/tk.decls4
-rw-r--r--generic/tk.h6
-rw-r--r--generic/tkCanvArc.c36
-rw-r--r--generic/tkCanvLine.c55
-rw-r--r--generic/tkCanvUtil.c12
-rw-r--r--generic/tkDecls.h6
-rw-r--r--generic/tkInt.h16
-rw-r--r--generic/tkUtil.c10
8 files changed, 65 insertions, 80 deletions
diff --git a/generic/tk.decls b/generic/tk.decls
index 262b922..a71c1e8 100644
--- a/generic/tk.decls
+++ b/generic/tk.decls
@@ -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: tk.decls,v 1.41 2008/10/28 22:33:06 nijtmans Exp $
+# RCS: @(#) $Id: tk.decls,v 1.42 2008/10/30 21:39:16 nijtmans Exp $
library tk
@@ -106,7 +106,7 @@ declare 18 generic {
Tk_Window tkwin, const char *value, char *widgRec, int offset)
}
declare 19 generic {
- char * Tk_CanvasTagsPrintProc(ClientData clientData, Tk_Window tkwin,
+ CONST86 char * Tk_CanvasTagsPrintProc(ClientData clientData, Tk_Window tkwin,
char *widgRec, int offset, Tcl_FreeProc **freeProcPtr)
}
declare 20 generic {
diff --git a/generic/tk.h b/generic/tk.h
index 98df8f8..3a52ad6 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -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: tk.h,v 1.121 2008/10/28 22:33:06 nijtmans Exp $
+ * RCS: @(#) $Id: tk.h,v 1.122 2008/10/30 21:39:16 nijtmans Exp $
*/
#ifndef _TK
@@ -312,7 +312,7 @@ typedef struct Tk_SavedOptions {
typedef int (Tk_OptionParseProc) (ClientData clientData, Tcl_Interp *interp,
Tk_Window tkwin, CONST84 char *value, char *widgRec, int offset);
-typedef char *(Tk_OptionPrintProc) (ClientData clientData, Tk_Window tkwin,
+typedef CONST86 char *(Tk_OptionPrintProc) (ClientData clientData, Tk_Window tkwin,
char *widgRec, int offset, Tcl_FreeProc **freeProcPtr);
typedef struct Tk_CustomOption {
@@ -350,7 +350,7 @@ typedef struct Tk_ConfigSpec {
int specFlags; /* Any combination of the values defined
* below; other bits are used internally by
* tkConfig.c. */
- Tk_CustomOption *customPtr; /* If type is TK_CONFIG_CUSTOM then this is a
+ CONST86 Tk_CustomOption *customPtr; /* If type is TK_CONFIG_CUSTOM then this is a
* pointer to info about how to parse and
* print the option. Otherwise it is
* irrelevant. */
diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c
index eb2217f..03496f0 100644
--- a/generic/tkCanvArc.c
+++ b/generic/tkCanvArc.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: tkCanvArc.c,v 1.17 2008/04/27 22:38:55 dkf Exp $
+ * RCS: @(#) $Id: tkCanvArc.c,v 1.18 2008/10/30 21:39:16 nijtmans Exp $
*/
#include <stdio.h>
@@ -83,32 +83,26 @@ typedef struct ArcItem {
static int StyleParseProc(ClientData clientData, Tcl_Interp *interp,
Tk_Window tkwin, const char *value,
char *widgRec, int offset);
-static char * StylePrintProc(ClientData clientData, Tk_Window tkwin,
+static const char * StylePrintProc(ClientData clientData, Tk_Window tkwin,
char *widgRec, int offset, Tcl_FreeProc **freeProcPtr);
-static Tk_CustomOption stateOption = {
- (Tk_OptionParseProc *) TkStateParseProc,
- TkStatePrintProc, (ClientData) 2
+static const Tk_CustomOption stateOption = {
+ TkStateParseProc, TkStatePrintProc, (ClientData) 2
};
-static Tk_CustomOption styleOption = {
- (Tk_OptionParseProc *) StyleParseProc,
- StylePrintProc, (ClientData) NULL
+static const Tk_CustomOption styleOption = {
+ StyleParseProc, StylePrintProc, (ClientData) NULL
};
-static Tk_CustomOption tagsOption = {
- (Tk_OptionParseProc *) Tk_CanvasTagsParseProc,
- Tk_CanvasTagsPrintProc, (ClientData) NULL
+static const Tk_CustomOption tagsOption = {
+ Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, (ClientData) NULL
};
-static Tk_CustomOption dashOption = {
- (Tk_OptionParseProc *) TkCanvasDashParseProc,
- TkCanvasDashPrintProc, (ClientData) NULL
+static const Tk_CustomOption dashOption = {
+ TkCanvasDashParseProc, TkCanvasDashPrintProc, (ClientData) NULL
};
-static Tk_CustomOption offsetOption = {
- (Tk_OptionParseProc *) TkOffsetParseProc,
- TkOffsetPrintProc, (ClientData) (TK_OFFSET_RELATIVE)
+static const Tk_CustomOption offsetOption = {
+ TkOffsetParseProc, TkOffsetPrintProc, (ClientData) (TK_OFFSET_RELATIVE)
};
-static Tk_CustomOption pixelOption = {
- (Tk_OptionParseProc *) TkPixelParseProc,
- TkPixelPrintProc, (ClientData) NULL
+static const Tk_CustomOption pixelOption = {
+ TkPixelParseProc, TkPixelPrintProc, (ClientData) NULL
};
static Tk_ConfigSpec configSpecs[] = {
@@ -2061,7 +2055,7 @@ StyleParseProc(
*--------------------------------------------------------------
*/
-static char *
+static const char *
StylePrintProc(
ClientData clientData, /* Ignored. */
Tk_Window tkwin, /* Ignored. */
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index 21f7fc5..e3977fd 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.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: tkCanvLine.c,v 1.23 2008/04/27 22:38:55 dkf Exp $
+ * RCS: @(#) $Id: tkCanvLine.c,v 1.24 2008/10/30 21:39:16 nijtmans Exp $
*/
#include <stdio.h>
@@ -111,13 +111,13 @@ static int LineToPostscript(Tcl_Interp *interp,
static int ArrowParseProc(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
const char *value, char *recordPtr, int offset);
-static char * ArrowPrintProc(ClientData clientData,
+static const char * ArrowPrintProc(ClientData clientData,
Tk_Window tkwin, char *recordPtr, int offset,
Tcl_FreeProc **freeProcPtr);
static int ParseArrowShape(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
const char *value, char *recordPtr, int offset);
-static char * PrintArrowShape(ClientData clientData,
+static const char * PrintArrowShape(ClientData clientData,
Tk_Window tkwin, char *recordPtr, int offset,
Tcl_FreeProc **freeProcPtr);
static void ScaleLine(Tk_Canvas canvas,
@@ -132,38 +132,30 @@ static void TranslateLine(Tk_Canvas canvas,
* CreateLine.
*/
-static Tk_CustomOption arrowShapeOption = {
- (Tk_OptionParseProc *) ParseArrowShape,
- PrintArrowShape, (ClientData) NULL
+static const Tk_CustomOption arrowShapeOption = {
+ ParseArrowShape, PrintArrowShape, (ClientData) NULL
};
-static Tk_CustomOption arrowOption = {
- (Tk_OptionParseProc *) ArrowParseProc,
- ArrowPrintProc, (ClientData) NULL
+static const Tk_CustomOption arrowOption = {
+ ArrowParseProc, ArrowPrintProc, (ClientData) NULL
};
-static Tk_CustomOption smoothOption = {
- (Tk_OptionParseProc *) TkSmoothParseProc,
- TkSmoothPrintProc, (ClientData) NULL
+static const Tk_CustomOption smoothOption = {
+ TkSmoothParseProc, TkSmoothPrintProc, (ClientData) NULL
};
-static Tk_CustomOption stateOption = {
- (Tk_OptionParseProc *) TkStateParseProc,
- TkStatePrintProc, (ClientData) 2
+static const Tk_CustomOption stateOption = {
+ TkStateParseProc, TkStatePrintProc, (ClientData) 2
};
-static Tk_CustomOption tagsOption = {
- (Tk_OptionParseProc *) Tk_CanvasTagsParseProc,
- Tk_CanvasTagsPrintProc, (ClientData) NULL
+static const Tk_CustomOption tagsOption = {
+ Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, (ClientData) NULL
};
-static Tk_CustomOption dashOption = {
- (Tk_OptionParseProc *) TkCanvasDashParseProc,
- TkCanvasDashPrintProc, (ClientData) NULL
+static const Tk_CustomOption dashOption = {
+ TkCanvasDashParseProc, TkCanvasDashPrintProc, (ClientData) NULL
};
-static Tk_CustomOption offsetOption = {
- (Tk_OptionParseProc *) TkOffsetParseProc,
- TkOffsetPrintProc,
+static const Tk_CustomOption offsetOption = {
+ TkOffsetParseProc, TkOffsetPrintProc,
(ClientData) (TK_OFFSET_RELATIVE|TK_OFFSET_INDEX)
};
-static Tk_CustomOption pixelOption = {
- (Tk_OptionParseProc *) TkPixelParseProc,
- TkPixelPrintProc, (ClientData) NULL
+static const Tk_CustomOption pixelOption = {
+ TkPixelParseProc, TkPixelPrintProc, (ClientData) NULL
};
static Tk_ConfigSpec configSpecs[] = {
@@ -524,7 +516,7 @@ ConfigureLine(
newGC = Tk_GetGC(tkwin, mask, &gcValues);
#ifdef MAC_OSX_TK
/*
- * Mac OS X CG drawing needs access to linewidth even for
+ * Mac OS X CG drawing needs access to linewidth even for
* arrow fills (as linewidth controls antialiasing).
*/
mask |= GCLineWidth;
@@ -1923,7 +1915,7 @@ ParseArrowShape(
*/
/* ARGSUSED */
-static char *
+static const char *
PrintArrowShape(
ClientData clientData, /* Not used. */
Tk_Window tkwin, /* Window associated with linePtr's widget. */
@@ -1943,7 +1935,6 @@ PrintArrowShape(
return buffer;
}
-
/*
*--------------------------------------------------------------
*
@@ -2028,7 +2019,7 @@ ArrowParseProc(
*--------------------------------------------------------------
*/
-static char *
+static const char *
ArrowPrintProc(
ClientData clientData, /* Ignored. */
Tk_Window tkwin, /* Window containing canvas widget. */
@@ -2242,7 +2233,7 @@ LineToPostscript(
{
LineItem *linePtr = (LineItem *) itemPtr;
char buffer[64 + TCL_INTEGER_SPACE];
- char *style;
+ const char *style;
double width;
XColor *color;
diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c
index 6d84ad2..8647975 100644
--- a/generic/tkCanvUtil.c
+++ b/generic/tkCanvUtil.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: tkCanvUtil.c,v 1.21 2008/10/24 06:00:22 dkf Exp $
+ * RCS: @(#) $Id: tkCanvUtil.c,v 1.22 2008/10/30 21:39:16 nijtmans Exp $
*/
#include "tkInt.h"
@@ -457,7 +457,7 @@ Tk_CanvasTagsParseProc(
*--------------------------------------------------------------
*/
-char *
+const char *
Tk_CanvasTagsPrintProc(
ClientData clientData, /* Ignored. */
Tk_Window tkwin, /* Window containing canvas widget. */
@@ -475,7 +475,7 @@ Tk_CanvasTagsPrintProc(
}
if (itemPtr->numTags == 1) {
*freeProcPtr = NULL;
- return (char *) itemPtr->tagPtr[0];
+ return (const char *) itemPtr->tagPtr[0];
}
*freeProcPtr = TCL_DYNAMIC;
return Tcl_Merge(itemPtr->numTags, (const char **) itemPtr->tagPtr);
@@ -533,7 +533,7 @@ TkCanvasDashParseProc(
*--------------------------------------------------------------
*/
-char *
+const char *
TkCanvasDashPrintProc(
ClientData clientData, /* Ignored. */
Tk_Window tkwin, /* Window containing canvas widget. */
@@ -809,7 +809,7 @@ TkSmoothParseProc(
*--------------------------------------------------------------
*/
-char *
+const char *
TkSmoothPrintProc(
ClientData clientData, /* Ignored. */
Tk_Window tkwin, /* Window containing canvas widget. */
@@ -822,7 +822,7 @@ TkSmoothPrintProc(
register const Tk_SmoothMethod *smoothPtr =
* (Tk_SmoothMethod **) (widgRec + offset);
- return smoothPtr ? (char *) smoothPtr->name : "0";
+ return smoothPtr ? smoothPtr->name : "0";
}
/*
*--------------------------------------------------------------
diff --git a/generic/tkDecls.h b/generic/tkDecls.h
index a888168..b51a4a6 100644
--- a/generic/tkDecls.h
+++ b/generic/tkDecls.h
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkDecls.h,v 1.36 2008/10/28 22:33:06 nijtmans Exp $
+ * RCS: @(#) $Id: tkDecls.h,v 1.37 2008/10/30 21:39:16 nijtmans Exp $
*/
#ifndef _TKDECLS
@@ -154,7 +154,7 @@ EXTERN int Tk_CanvasTagsParseProc (ClientData clientData,
#ifndef Tk_CanvasTagsPrintProc_TCL_DECLARED
#define Tk_CanvasTagsPrintProc_TCL_DECLARED
/* 19 */
-EXTERN char * Tk_CanvasTagsPrintProc (ClientData clientData,
+EXTERN CONST86 char * Tk_CanvasTagsPrintProc (ClientData clientData,
Tk_Window tkwin, char * widgRec, int offset,
Tcl_FreeProc ** freeProcPtr);
#endif
@@ -1725,7 +1725,7 @@ typedef struct TkStubs {
double (*tk_CanvasPsY) (Tk_Canvas canvas, double y); /* 16 */
void (*tk_CanvasSetStippleOrigin) (Tk_Canvas canvas, GC gc); /* 17 */
int (*tk_CanvasTagsParseProc) (ClientData clientData, Tcl_Interp * interp, Tk_Window tkwin, const char * value, char * widgRec, int offset); /* 18 */
- char * (*tk_CanvasTagsPrintProc) (ClientData clientData, Tk_Window tkwin, char * widgRec, int offset, Tcl_FreeProc ** freeProcPtr); /* 19 */
+ CONST86 char * (*tk_CanvasTagsPrintProc) (ClientData clientData, Tk_Window tkwin, char * widgRec, int offset, Tcl_FreeProc ** freeProcPtr); /* 19 */
Tk_Window (*tk_CanvasTkwin) (Tk_Canvas canvas); /* 20 */
void (*tk_CanvasWindowCoords) (Tk_Canvas canvas, double x, double y, short * screenXPtr, short * screenYPtr); /* 21 */
void (*tk_ChangeWindowAttributes) (Tk_Window tkwin, unsigned long valueMask, XSetWindowAttributes * attsPtr); /* 22 */
diff --git a/generic/tkInt.h b/generic/tkInt.h
index d4fc5e8..77bd915 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -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: tkInt.h,v 1.89 2008/10/28 22:33:06 nijtmans Exp $
+ * RCS: $Id: tkInt.h,v 1.90 2008/10/30 21:39:16 nijtmans Exp $
*/
#ifndef _TKINT
@@ -1127,7 +1127,7 @@ MODULE_SCOPE int TkCanvasGetCoordObj(Tcl_Interp *interp,
MODULE_SCOPE int TkCanvasDashParseProc(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
const char *value, char *widgRec, int offset);
-MODULE_SCOPE char * TkCanvasDashPrintProc(ClientData clientData,
+MODULE_SCOPE CONST86 char * TkCanvasDashPrintProc(ClientData clientData,
Tk_Window tkwin, char *widgRec, int offset,
Tcl_FreeProc **freeProcPtr);
MODULE_SCOPE int TkGetDoublePixels(Tcl_Interp *interp, Tk_Window tkwin,
@@ -1135,19 +1135,19 @@ MODULE_SCOPE int TkGetDoublePixels(Tcl_Interp *interp, Tk_Window tkwin,
MODULE_SCOPE int TkOffsetParseProc(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
const char *value, char *widgRec, int offset);
-MODULE_SCOPE char * TkOffsetPrintProc(ClientData clientData,
+MODULE_SCOPE CONST86 char * TkOffsetPrintProc(ClientData clientData,
Tk_Window tkwin, char *widgRec, int offset,
Tcl_FreeProc **freeProcPtr);
MODULE_SCOPE int TkOrientParseProc(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
const char *value, char *widgRec, int offset);
-MODULE_SCOPE char * TkOrientPrintProc(ClientData clientData,
+MODULE_SCOPE CONST86 char * TkOrientPrintProc(ClientData clientData,
Tk_Window tkwin, char *widgRec, int offset,
Tcl_FreeProc **freeProcPtr);
MODULE_SCOPE int TkPixelParseProc(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
const char *value, char *widgRec, int offset);
-MODULE_SCOPE char * TkPixelPrintProc(ClientData clientData,
+MODULE_SCOPE CONST86 char * TkPixelPrintProc(ClientData clientData,
Tk_Window tkwin, char *widgRec, int offset,
Tcl_FreeProc **freeProcPtr);
MODULE_SCOPE int TkPostscriptImage(Tcl_Interp *interp, Tk_Window tkwin,
@@ -1156,19 +1156,19 @@ MODULE_SCOPE int TkPostscriptImage(Tcl_Interp *interp, Tk_Window tkwin,
MODULE_SCOPE int TkSmoothParseProc(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
const char *value, char *recordPtr, int offset);
-MODULE_SCOPE char * TkSmoothPrintProc(ClientData clientData,
+MODULE_SCOPE CONST86 char * TkSmoothPrintProc(ClientData clientData,
Tk_Window tkwin, char *recordPtr, int offset,
Tcl_FreeProc **freeProcPtr);
MODULE_SCOPE int TkStateParseProc(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
const char *value, char *widgRec, int offset);
-MODULE_SCOPE char * TkStatePrintProc(ClientData clientData,
+MODULE_SCOPE CONST86 char * TkStatePrintProc(ClientData clientData,
Tk_Window tkwin, char *widgRec, int offset,
Tcl_FreeProc **freeProcPtr);
MODULE_SCOPE int TkTileParseProc(ClientData clientData,
Tcl_Interp *interp, Tk_Window tkwin,
const char *value, char *widgRec, int offset);
-MODULE_SCOPE char * TkTilePrintProc(ClientData clientData, Tk_Window tkwin,
+MODULE_SCOPE CONST86 char * TkTilePrintProc(ClientData clientData, Tk_Window tkwin,
char *widgRec, int offset,
Tcl_FreeProc **freeProcPtr);
MODULE_SCOPE void TkMapTopFrame(Tk_Window tkwin);
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index 5786362..7072009 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.22 2008/10/15 06:41:06 nijtmans Exp $
+ * RCS: @(#) $Id: tkUtil.c,v 1.23 2008/10/30 21:39:16 nijtmans Exp $
*/
#include "tkInt.h"
@@ -123,7 +123,7 @@ TkStateParseProc(
*--------------------------------------------------------------
*/
-char *
+const char *
TkStatePrintProc(
ClientData clientData, /* Ignored. */
Tk_Window tkwin, /* Window containing canvas widget. */
@@ -224,7 +224,7 @@ TkOrientParseProc(
*--------------------------------------------------------------
*/
-char *
+const char *
TkOrientPrintProc(
ClientData clientData, /* Ignored. */
Tk_Window tkwin, /* Window containing canvas widget. */
@@ -396,7 +396,7 @@ TkOffsetParseProc(
*----------------------------------------------------------------------
*/
-char *
+const char *
TkOffsetPrintProc(
ClientData clientData, /* not used */
Tk_Window tkwin, /* not used */
@@ -495,7 +495,7 @@ TkPixelParseProc(
*----------------------------------------------------------------------
*/
-char *
+const char *
TkPixelPrintProc(
ClientData clientData, /* not used */
Tk_Window tkwin, /* not used */