summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-09-24 15:01:58 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-09-24 15:01:58 (GMT)
commitc1d2b9d95856fe913236eec23533b0bd522726d3 (patch)
treed2205c21c6895c4707b37d72ce3afbc98f0d3b4c
parent93a3e63b7e9a22f94f1101b7ba32ac79738e5b65 (diff)
downloadtk-c1d2b9d95856fe913236eec23533b0bd522726d3.zip
tk-c1d2b9d95856fe913236eec23533b0bd522726d3.tar.gz
tk-c1d2b9d95856fe913236eec23533b0bd522726d3.tar.bz2
Don't use "class" as (internal) struct field name or local variable name. Make it "c_class" (just as X11 does as well), in order to prevent conflict with C++ compilers.
-rw-r--r--generic/tkCanvPs.c4
-rw-r--r--generic/tkCmds.c14
-rw-r--r--generic/tkImgPhInstance.c22
-rw-r--r--generic/tkInt.h4
-rw-r--r--generic/tkVisual.c12
-rw-r--r--macosx/tkMacOSXXStubs.c2
-rw-r--r--unix/tkUnixColor.c2
-rw-r--r--unix/tkUnixWm.c8
-rw-r--r--win/tkWinButton.c8
-rw-r--r--win/tkWinTest.c6
-rw-r--r--win/tkWinWm.c22
-rw-r--r--win/tkWinX.c12
-rw-r--r--xlib/xutil.c4
13 files changed, 62 insertions, 58 deletions
diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c
index 4e41a2a..167f61f 100644
--- a/generic/tkCanvPs.c
+++ b/generic/tkCanvPs.c
@@ -1279,7 +1279,7 @@ TkPostscriptImage(
cdata.colors = ckalloc(sizeof(XColor) * ncolors);
cdata.ncolors = ncolors;
- if (visual->class == DirectColor || visual->class == TrueColor) {
+ if (visual->c_class == DirectColor || visual->c_class == TrueColor) {
cdata.separated = 1;
cdata.red_mask = visual->red_mask;
cdata.green_mask = visual->green_mask;
@@ -1311,7 +1311,7 @@ TkPostscriptImage(
}
}
- if (visual->class == StaticGray || visual->class == GrayScale) {
+ if (visual->c_class == StaticGray || visual->c_class == GrayScale) {
cdata.color = 0;
} else {
cdata.color = 1;
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index a64d2e1..8ba05f0 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -1285,7 +1285,7 @@ Tk_WinfoObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- int index, x, y, width, height, useX, useY, class, skip;
+ int index, x, y, width, height, useX, useY, c_class, skip;
const char *string;
TkWindow *winPtr;
Tk_Window tkwin = clientData;
@@ -1496,7 +1496,7 @@ Tk_WinfoObjCmd(
Tcl_NewIntObj(WidthMMOfScreen(Tk_Screen(tkwin))));
break;
case WIN_SCREENVISUAL:
- class = DefaultVisualOfScreen(Tk_Screen(tkwin))->class;
+ c_class = DefaultVisualOfScreen(Tk_Screen(tkwin))->c_class;
goto visual;
case WIN_SERVER:
TkGetServerInfo(interp, tkwin);
@@ -1524,10 +1524,10 @@ Tk_WinfoObjCmd(
break;
}
case WIN_VISUAL:
- class = Tk_Visual(tkwin)->class;
+ c_class = Tk_Visual(tkwin)->c_class;
visual:
- string = TkFindStateString(visualMap, class);
+ string = TkFindStateString(visualMap, c_class);
if (string == NULL) {
string = "unknown";
}
@@ -1790,15 +1790,15 @@ Tk_WinfoObjCmd(
}
resultPtr = Tcl_NewObj();
for (i = 0; i < count; i++) {
- string = TkFindStateString(visualMap, visInfoPtr[i].class);
+ string = TkFindStateString(visualMap, visInfoPtr[i].c_class);
if (string == NULL) {
strcpy(buf, "unknown");
} else {
sprintf(buf, "%s %d", string, visInfoPtr[i].depth);
}
if (includeVisualId) {
- sprintf(visualIdString, " 0x%x",
- (unsigned) visInfoPtr[i].visualid);
+ sprintf(visualIdString, " 0x%lx",
+ (unsigned long) visInfoPtr[i].visualid);
strcat(buf, visualIdString);
}
strPtr = Tcl_NewStringObj(buf, -1);
diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c
index 72ebcb8..b73ceeb 100644
--- a/generic/tkImgPhInstance.c
+++ b/generic/tkImgPhInstance.c
@@ -309,7 +309,7 @@ TkImgPhotoGet(
nGreen = nBlue = 0;
mono = 1;
instancePtr->visualInfo = *visInfoPtr;
- switch (visInfoPtr->class) {
+ switch (visInfoPtr->c_class) {
case DirectColor:
case TrueColor:
nRed = 1 << CountBits(visInfoPtr->red_mask);
@@ -645,7 +645,7 @@ TkImgPhotoDisplay(
if ((instancePtr->masterPtr->flags & COMPLEX_ALPHA)
&& visInfo.depth >= 15
- && (visInfo.class == DirectColor || visInfo.class == TrueColor)) {
+ && (visInfo.c_class == DirectColor || visInfo.c_class == TrueColor)) {
Tk_ErrorHandler handler;
XImage *bgImg = NULL;
@@ -948,7 +948,7 @@ IsValidPalette(
mono = 0;
}
- switch (instancePtr->visualInfo.class) {
+ switch (instancePtr->visualInfo.c_class) {
case DirectColor:
case TrueColor:
if ((nRed > (1 << CountBits(instancePtr->visualInfo.red_mask)))
@@ -1213,8 +1213,8 @@ AllocateColors(
* store them in *colors.
*/
- if ((colorPtr->visualInfo.class == DirectColor)
- || (colorPtr->visualInfo.class == TrueColor)) {
+ if ((colorPtr->visualInfo.c_class == DirectColor)
+ || (colorPtr->visualInfo.c_class == TrueColor)) {
/*
* Direct/True Color: allocate shades of red, green, blue
@@ -1368,8 +1368,8 @@ AllocateColors(
*/
#ifndef _WIN32
- if ((colorPtr->visualInfo.class != DirectColor)
- && (colorPtr->visualInfo.class != TrueColor)) {
+ if ((colorPtr->visualInfo.c_class != DirectColor)
+ && (colorPtr->visualInfo.c_class != TrueColor)) {
colorPtr->flags |= MAP_COLORS;
}
#endif /* _WIN32 */
@@ -1395,8 +1395,8 @@ AllocateColors(
} else {
g = (i * (nGreen - 1) + 127) / 255;
b = (i * (nBlue - 1) + 127) / 255;
- if ((colorPtr->visualInfo.class == DirectColor)
- || (colorPtr->visualInfo.class == TrueColor)) {
+ if ((colorPtr->visualInfo.c_class == DirectColor)
+ || (colorPtr->visualInfo.c_class == TrueColor)) {
colorPtr->redValues[i] =
colors[r].pixel & colorPtr->visualInfo.red_mask;
colorPtr->greenValues[i] =
@@ -1654,8 +1654,8 @@ TkImgDitherInstance(
* DirectColor with many colors).
*/
- if ((colorPtr->visualInfo.class == DirectColor)
- || (colorPtr->visualInfo.class == TrueColor)) {
+ if ((colorPtr->visualInfo.c_class == DirectColor)
+ || (colorPtr->visualInfo.c_class == TrueColor)) {
int nRed, nGreen, nBlue, result;
result = sscanf(colorPtr->id.palette, "%d/%d/%d", &nRed,
diff --git a/generic/tkInt.h b/generic/tkInt.h
index e4e49cb..c1bd562d 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -1267,6 +1267,10 @@ MODULE_SCOPE Status TkParseColor (Display * display,
MODULE_SCOPE void TkUnixSetXftClipRegion(TkRegion clipRegion);
#endif
+#if !defined(__cplusplus) && !defined(c_plusplus)
+# define c_class class
+#endif
+
#if TCL_UTF_MAX > 4
# define TkUtfToUniChar Tcl_UtfToUniChar
# define TkUniCharToUtf Tcl_UniCharToUtf
diff --git a/generic/tkVisual.c b/generic/tkVisual.c
index 8b0c155..567c552 100644
--- a/generic/tkVisual.c
+++ b/generic/tkVisual.c
@@ -23,7 +23,7 @@ typedef struct VisualDictionary {
const char *name; /* Textual name of class. */
int minLength; /* Minimum # characters that must be specified
* for an unambiguous match. */
- int class; /* X symbol for class. */
+ int c_class; /* X symbol for class. */
} VisualDictionary;
static const VisualDictionary visualNames[] = {
{"best", 1, 0},
@@ -145,7 +145,7 @@ Tk_GetVisual(
return visual;
}
template.depth = Tk_Depth(tkwin2);
- template.class = visual->class;
+ template.c_class = visual->c_class;
template.red_mask = visual->red_mask;
template.green_mask = visual->green_mask;
template.blue_mask = visual->blue_mask;
@@ -192,16 +192,16 @@ Tk_GetVisual(
}
}
length = p - string;
- template.class = -1;
+ template.c_class = -1;
for (dictPtr = visualNames; dictPtr->name != NULL; dictPtr++) {
if ((dictPtr->name[0] == c) && (length >= dictPtr->minLength)
&& (strncmp(string, dictPtr->name,
(size_t) length) == 0)) {
- template.class = dictPtr->class;
+ template.c_class = dictPtr->c_class;
break;
}
}
- if (template.class == -1) {
+ if (template.c_class == -1) {
Tcl_Obj *msgObj = Tcl_ObjPrintf(
"unknown or ambiguous visual name \"%s\": class must be ",
string);
@@ -262,7 +262,7 @@ Tk_GetVisual(
bestPrio = 0;
bestPtr = NULL;
for (i = 0; i < numVisuals; i++) {
- switch (visInfoList[i].class) {
+ switch (visInfoList[i].c_class) {
case DirectColor:
prio = 5; break;
case GrayScale:
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index b474817..63f5dba 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.c
@@ -202,7 +202,7 @@ TkpOpenDisplay(
screen->root_visual = ckalloc(sizeof(Visual));
screen->root_visual->visualid = 0;
- screen->root_visual->class = TrueColor;
+ screen->root_visual->c_class = TrueColor;
screen->root_visual->red_mask = 0x00FF0000;
screen->root_visual->green_mask = 0x0000FF00;
screen->root_visual->blue_mask = 0x000000FF;
diff --git a/unix/tkUnixColor.c b/unix/tkUnixColor.c
index ccc6f33..512b20c 100644
--- a/unix/tkUnixColor.c
+++ b/unix/tkUnixColor.c
@@ -85,7 +85,7 @@ TkpFreeColor(
*/
visual = tkColPtr->visual;
- if ((visual->class != StaticGray) && (visual->class != StaticColor)
+ if ((visual->c_class != StaticGray) && (visual->c_class != StaticColor)
&& (tkColPtr->color.pixel != BlackPixelOfScreen(screen))
&& (tkColPtr->color.pixel != WhitePixelOfScreen(screen))) {
Tk_ErrorHandler handler;
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index f09b59c..bc7f1cb 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -980,18 +980,18 @@ TkWmSetClass(
if (winPtr->classUid != NULL) {
XClassHint *classPtr;
- Tcl_DString name, class;
+ Tcl_DString name, ds;
Tcl_UtfToExternalDString(NULL, winPtr->nameUid, -1, &name);
- Tcl_UtfToExternalDString(NULL, winPtr->classUid, -1, &class);
+ Tcl_UtfToExternalDString(NULL, winPtr->classUid, -1, &ds);
classPtr = XAllocClassHint();
classPtr->res_name = Tcl_DStringValue(&name);
- classPtr->res_class = Tcl_DStringValue(&class);
+ classPtr->res_class = Tcl_DStringValue(&ds);
XSetClassHint(winPtr->display, winPtr->wmInfoPtr->wrapperPtr->window,
classPtr);
XFree((char *) classPtr);
Tcl_DStringFree(&name);
- Tcl_DStringFree(&class);
+ Tcl_DStringFree(&ds);
}
}
diff --git a/win/tkWinButton.c b/win/tkWinButton.c
index f7b8ed2..7332c93 100644
--- a/win/tkWinButton.c
+++ b/win/tkWinButton.c
@@ -242,18 +242,18 @@ CreateProc(
{
Window window;
HWND parent;
- LPCWSTR class;
+ LPCWSTR windowClass;
WinButton *butPtr = (WinButton *)instanceData;
parent = Tk_GetHWND(parentWin);
if (butPtr->info.type == TYPE_LABEL) {
- class = L"STATIC";
+ windowClass = L"STATIC";
butPtr->style = SS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS;
} else {
- class = L"BUTTON";
+ windowClass = L"BUTTON";
butPtr->style = BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS;
}
- butPtr->hwnd = CreateWindowW(class, NULL, butPtr->style,
+ butPtr->hwnd = CreateWindowW(windowClass, NULL, butPtr->style,
Tk_X(tkwin), Tk_Y(tkwin), Tk_Width(tkwin), Tk_Height(tkwin),
parent, NULL, Tk_GetHINSTANCE(), NULL);
SetWindowPos(butPtr->hwnd, HWND_TOP, 0, 0, 0, 0,
diff --git a/win/tkWinTest.c b/win/tkWinTest.c
index f5cb17c..6911334 100644
--- a/win/tkWinTest.c
+++ b/win/tkWinTest.c
@@ -432,7 +432,7 @@ TestfindwindowObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument values. */
{
- LPCWSTR title = NULL, class = NULL;
+ LPCWSTR title = NULL, windowClass = NULL;
Tcl_DString titleString, classString;
HWND hwnd = NULL;
int r = TCL_OK;
@@ -448,7 +448,7 @@ TestfindwindowObjCmd(
title = (LPCWSTR)Tcl_WinUtfToTChar(Tcl_GetString(objv[1]), -1, &titleString);
if (objc == 3) {
- class = (LPCWSTR)Tcl_WinUtfToTChar(Tcl_GetString(objv[2]), -1, &classString);
+ windowClass = (LPCWSTR)Tcl_WinUtfToTChar(Tcl_GetString(objv[2]), -1, &classString);
}
if (title[0] == 0)
title = NULL;
@@ -457,7 +457,7 @@ TestfindwindowObjCmd(
myPid = GetCurrentProcessId();
while (1) {
DWORD pid, tid;
- hwnd = FindWindowExW(NULL, hwnd, class, title);
+ hwnd = FindWindowExW(NULL, hwnd, windowClass, title);
if (hwnd == NULL)
break;
tid = GetWindowThreadProcessId(hwnd, &pid);
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index dcafd68..117b539 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -867,21 +867,21 @@ InitWindowClass(
if (!initialized) {
Tcl_MutexLock(&winWmMutex);
if (!initialized) {
- WNDCLASSW class;
+ WNDCLASSW windowClass;
initialized = 1;
- ZeroMemory(&class, sizeof(WNDCLASSW));
+ ZeroMemory(&windowClass, sizeof(WNDCLASSW));
- class.style = CS_HREDRAW | CS_VREDRAW;
- class.hInstance = Tk_GetHINSTANCE();
- class.lpszClassName = TK_WIN_TOPLEVEL_CLASS_NAME;
- class.lpfnWndProc = WmProc;
+ windowClass.style = CS_HREDRAW | CS_VREDRAW;
+ windowClass.hInstance = Tk_GetHINSTANCE();
+ windowClass.lpszClassName = TK_WIN_TOPLEVEL_CLASS_NAME;
+ windowClass.lpfnWndProc = WmProc;
if (titlebaricon == NULL) {
- class.hIcon = LoadIconW(Tk_GetHINSTANCE(), L"tk");
+ windowClass.hIcon = LoadIconW(Tk_GetHINSTANCE(), L"tk");
} else {
- class.hIcon = GetIcon(titlebaricon, ICON_BIG);
- if (class.hIcon == NULL) {
+ windowClass.hIcon = GetIcon(titlebaricon, ICON_BIG);
+ if (windowClass.hIcon == NULL) {
return TCL_ERROR;
}
@@ -892,9 +892,9 @@ InitWindowClass(
tsdPtr->iconPtr = titlebaricon;
}
- class.hCursor = LoadCursorW(NULL, (LPCWSTR)IDC_ARROW);
+ windowClass.hCursor = LoadCursorW(NULL, (LPCWSTR)IDC_ARROW);
- if (!RegisterClassW(&class)) {
+ if (!RegisterClassW(&windowClass)) {
Tcl_Panic("Unable to register TkTopLevel class");
}
}
diff --git a/win/tkWinX.c b/win/tkWinX.c
index 58fe754..c01096e 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -501,30 +501,30 @@ TkWinDisplayChanged(
screen->root_visual->visualid = 0;
if (GetDeviceCaps(dc, RASTERCAPS) & RC_PALETTE) {
screen->root_visual->map_entries = GetDeviceCaps(dc, SIZEPALETTE);
- screen->root_visual->class = PseudoColor;
+ screen->root_visual->c_class = PseudoColor;
screen->root_visual->red_mask = 0x0;
screen->root_visual->green_mask = 0x0;
screen->root_visual->blue_mask = 0x0;
} else if (screen->root_depth == 4) {
- screen->root_visual->class = StaticColor;
+ screen->root_visual->c_class = StaticColor;
screen->root_visual->map_entries = 16;
} else if (screen->root_depth == 8) {
- screen->root_visual->class = StaticColor;
+ screen->root_visual->c_class = StaticColor;
screen->root_visual->map_entries = 256;
} else if (screen->root_depth == 12) {
- screen->root_visual->class = TrueColor;
+ screen->root_visual->c_class = TrueColor;
screen->root_visual->map_entries = 32;
screen->root_visual->red_mask = 0xf0;
screen->root_visual->green_mask = 0xf000;
screen->root_visual->blue_mask = 0xf00000;
} else if (screen->root_depth == 16) {
- screen->root_visual->class = TrueColor;
+ screen->root_visual->c_class = TrueColor;
screen->root_visual->map_entries = 64;
screen->root_visual->red_mask = 0xf8;
screen->root_visual->green_mask = 0xfc00;
screen->root_visual->blue_mask = 0xf80000;
} else if (screen->root_depth >= 24) {
- screen->root_visual->class = TrueColor;
+ screen->root_visual->c_class = TrueColor;
screen->root_visual->map_entries = 256;
screen->root_visual->red_mask = 0xff;
screen->root_visual->green_mask = 0xff00;
diff --git a/xlib/xutil.c b/xlib/xutil.c
index 1e81549..d80b742 100644
--- a/xlib/xutil.c
+++ b/xlib/xutil.c
@@ -70,7 +70,7 @@ XGetVisualInfo(
info->visualid = info->visual->visualid;
info->screen = 0;
info->depth = info->visual->bits_per_rgb;
- info->class = info->visual->class;
+ info->c_class = info->visual->c_class;
info->colormap_size = info->visual->map_entries;
info->bits_per_rgb = info->visual->bits_per_rgb;
info->red_mask = info->visual->red_mask;
@@ -84,7 +84,7 @@ XGetVisualInfo(
|| ((vinfo_mask & VisualDepthMask)
&& (vinfo_template->depth != info->depth))
|| ((vinfo_mask & VisualClassMask)
- && (vinfo_template->class != info->class))
+ && (vinfo_template->c_class != info->c_class))
|| ((vinfo_mask & VisualColormapSizeMask)
&& (vinfo_template->colormap_size != info->colormap_size))
|| ((vinfo_mask & VisualBitsPerRGBMask)