summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--macosx/tkMacOSXXStubs.c3
-rw-r--r--win/nmakehlp.c12
-rw-r--r--win/tkWinDialog.c12
-rw-r--r--win/tkWinFont.c2
-rw-r--r--win/tkWinGDI.c4
-rw-r--r--win/tkWinIco.c6
-rw-r--r--win/tkWinImage.c2
-rw-r--r--win/tkWinWm.c8
-rw-r--r--win/tkWinX.c19
-rw-r--r--xlib/X11/Xlib.h8
10 files changed, 43 insertions, 33 deletions
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index ff520f2..a3dc830 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.c
@@ -15,6 +15,7 @@
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+#define XLIB_ILLEGAL_ACCESS
#include "tkMacOSXPrivate.h"
#include "tkMacOSXInt.h"
@@ -189,7 +190,7 @@ TkpOpenDisplay(
NSAutoreleasePool *pool = [NSAutoreleasePool new];
if (gMacDisplay != NULL) {
- if (strcmp(gMacDisplay->display->display_name, display_name) == 0) {
+ if (strcmp(DisplayString(gMacDisplay->display), display_name) == 0) {
return gMacDisplay;
} else {
return NULL;
diff --git a/win/nmakehlp.c b/win/nmakehlp.c
index a7b7a07..224d55a 100644
--- a/win/nmakehlp.c
+++ b/win/nmakehlp.c
@@ -207,13 +207,13 @@ CheckForCompilerFeature(
hProcess = GetCurrentProcess();
- ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
- ZeroMemory(&si, sizeof(STARTUPINFO));
+ memset(&pi, 0, sizeof(PROCESS_INFORMATION));
+ memset(&si, 0, sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
si.dwFlags = STARTF_USESTDHANDLES;
si.hStdInput = INVALID_HANDLE_VALUE;
- ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES));
+ memset(&sa, 0, sizeof(SECURITY_ATTRIBUTES));
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = FALSE;
@@ -343,13 +343,13 @@ CheckForLinkerFeature(
hProcess = GetCurrentProcess();
- ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
- ZeroMemory(&si, sizeof(STARTUPINFO));
+ memset(&pi, 0, sizeof(PROCESS_INFORMATION));
+ memset(&si, 0, sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
si.dwFlags = STARTF_USESTDHANDLES;
si.hStdInput = INVALID_HANDLE_VALUE;
- ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES));
+ memset(&sa, 0, sizeof(SECURITY_ATTRIBUTES));
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = TRUE;
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index 72766f9..18f4cc9 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -1028,7 +1028,7 @@ ParseOFNOptions(
case OFN_FILE_OPEN: options = openOptions; break;
}
- ZeroMemory(optsPtr, sizeof(*optsPtr));
+ memset(optsPtr, 0, sizeof(*optsPtr));
/* optsPtr->forceXPStyle = 1; */
optsPtr->tkwin = (Tk_Window)clientData;
optsPtr->confirmOverwrite = 1; /* By default we ask for confirmation */
@@ -1520,7 +1520,7 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- ZeroMemory(&ofnData, sizeof(OFNData));
+ memset(&ofnData, 0, sizeof(OFNData));
Tcl_DStringInit(&utfFilterString);
Tcl_DStringInit(&dirString); /* XXX - original code was missing this
leaving dirString uninitialized for
@@ -1534,7 +1534,7 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper
Tk_MakeWindowExist(optsPtr->tkwin);
hWnd = Tk_GetHWND(Tk_WindowId(optsPtr->tkwin));
- ZeroMemory(&ofn, sizeof(OPENFILENAME));
+ memset(&ofn, 0, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hWnd;
ofn.hInstance = TkWinGetHInstance(ofn.hwndOwner);
@@ -2401,7 +2401,7 @@ Tk_ChooseDirectoryObjCmd(
/* Older dialogs */
path[0] = '\0';
- ZeroMemory(&cdCBData, sizeof(ChooseDir));
+ memset(&cdCBData, 0, sizeof(ChooseDir));
cdCBData.interp = interp;
cdCBData.mustExist = ofnOpts.mustExist;
@@ -3400,8 +3400,8 @@ FontchooserShowCmd(
Tk_MakeWindowExist(parent);
- ZeroMemory(&cf, sizeof(CHOOSEFONTW));
- ZeroMemory(&lf, sizeof(LOGFONTW));
+ memset(&cf, 0, sizeof(CHOOSEFONTW));
+ memset(&lf, 0, sizeof(LOGFONTW));
lf.lfCharSet = DEFAULT_CHARSET;
cf.lStructSize = sizeof(CHOOSEFONTW);
cf.hwndOwner = Tk_GetHWND(Tk_WindowId(parent));
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 5968146..d0d0e94 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -405,7 +405,7 @@ TkWinSetupSystemFonts(
* (i.e. WINVER=0x0600 and running on XP).
*/
- ZeroMemory(&ncMetrics, sizeof(ncMetrics));
+ memset(&ncMetrics, 0, sizeof(ncMetrics));
ncMetrics.cbSize = sizeof(ncMetrics);
if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS,
sizeof(ncMetrics), &ncMetrics, 0)) {
diff --git a/win/tkWinGDI.c b/win/tkWinGDI.c
index 54aadc4..75a000f 100644
--- a/win/tkWinGDI.c
+++ b/win/tkWinGDI.c
@@ -3601,7 +3601,7 @@ static int PrintSelectPrinter(
/* Set up print dialog and initalize property structure. */
- ZeroMemory(&pd, sizeof(pd));
+ memset(&pd, 0, sizeof(pd));
pd.lStructSize = sizeof(pd);
pd.hwndOwner = GetDesktopWindow();
pd.Flags = PD_HIDEPRINTTOFILE | PD_DISABLEPRINTTOFILE | PD_NOSELECTION;
@@ -3609,7 +3609,7 @@ static int PrintSelectPrinter(
if (PrintDlgW(&pd) == TRUE) {
/*Get document info.*/
- ZeroMemory(&di, sizeof(di));
+ memset(&di, 0, sizeof(di));
di.cbSize = sizeof(di);
di.lpszDocName = L"Tk Print Output";
diff --git a/win/tkWinIco.c b/win/tkWinIco.c
index 4485787..134e7f0 100644
--- a/win/tkWinIco.c
+++ b/win/tkWinIco.c
@@ -155,14 +155,14 @@ CreateIcoFromPhoto(
* converts them as required. Initialise icon info structure.
*/
- ZeroMemory(&iconInfo, sizeof(iconInfo));
+ memset(&iconInfo, 0, sizeof(iconInfo));
iconInfo.fIcon = TRUE;
/*
* Create device-independent color bitmap.
*/
- ZeroMemory(&bmInfo, sizeof bmInfo);
+ memset(&bmInfo, 0, sizeof bmInfo);
bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmInfo.bmiHeader.biWidth = width;
bmInfo.bmiHeader.biHeight = -height;
@@ -203,7 +203,7 @@ CreateIcoFromPhoto(
return NULL;
}
- ZeroMemory(bgraMask.ptr, width*height/8);
+ memset(bgraMask.ptr, 0, width*height/8);
/*
* Create an icon from the bitmaps.
diff --git a/win/tkWinImage.c b/win/tkWinImage.c
index e3054c6..00edae7 100644
--- a/win/tkWinImage.c
+++ b/win/tkWinImage.c
@@ -619,7 +619,7 @@ XGetImage(
width, height, 32, 0);
size = imagePtr->bytes_per_line * imagePtr->height;
imagePtr->data = (char *)ckalloc(size);
- ZeroMemory(imagePtr->data, size);
+ memset(imagePtr->data, 0, size);
for (yy = 0; yy < height; yy++) {
for (xx = 0; xx < width; xx++) {
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index f772d1c..b257848 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -655,7 +655,7 @@ InitWindowClass(
initialized = 1;
- ZeroMemory(&windowClass, sizeof(WNDCLASSW));
+ memset(&windowClass, 0, sizeof(WNDCLASSW));
windowClass.style = CS_HREDRAW | CS_VREDRAW;
windowClass.hInstance = Tk_GetHINSTANCE();
@@ -1053,7 +1053,7 @@ ReadIconFromFile(
Tcl_DStringFree(&ds2);
return NULL;
}
- ZeroMemory(lpIR, size);
+ memset(lpIR, 0, size);
lpIR->nNumImages = ((res != 0) ? 2 : 1);
lpIR->IconImages[0].Width = 16;
@@ -1770,7 +1770,7 @@ TkWmNewWindow(
* Initialize full structure, then set what isn't NULL
*/
- ZeroMemory(wmPtr, sizeof(WmInfo));
+ memset(wmPtr, 0, sizeof(WmInfo));
winPtr->wmInfoPtr = wmPtr;
wmPtr->winPtr = winPtr;
wmPtr->hints.flags = InputHint | StateHint;
@@ -4345,7 +4345,7 @@ WmIconphotoCmd(
if (lpIR == NULL) {
return TCL_ERROR;
}
- ZeroMemory(lpIR, size);
+ memset(lpIR, 0, size);
for (i = startObj; i < objc; i++) {
photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i]));
diff --git a/win/tkWinX.c b/win/tkWinX.c
index 0f6f48a..5e26822 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -11,6 +11,7 @@
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
+#define XLIB_ILLEGAL_ACCESS
#include "tkWinInt.h"
#include <commctrl.h>
@@ -519,7 +520,7 @@ TkpOpenDisplay(
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->winDisplay != NULL) {
- if (!strcmp(tsdPtr->winDisplay->display->display_name, display_name)) {
+ if (!strcmp(DisplayString(tsdPtr->winDisplay->display), display_name)) {
return tsdPtr->winDisplay;
} else {
return NULL;
@@ -530,7 +531,7 @@ TkpOpenDisplay(
TkWinDisplayChanged(display);
tsdPtr->winDisplay =(TkDisplay *) ckalloc(sizeof(TkDisplay));
- ZeroMemory(tsdPtr->winDisplay, sizeof(TkDisplay));
+ memset(tsdPtr->winDisplay, 0, sizeof(TkDisplay));
tsdPtr->winDisplay->display = display;
tsdPtr->updatingClipboard = FALSE;
tsdPtr->wheelTickPrev = GetTickCount();
@@ -563,8 +564,8 @@ XkbOpenDisplay(
Screen *screen = (Screen *)ckalloc(sizeof(Screen));
TkWinDrawable *twdPtr = (TkWinDrawable *)ckalloc(sizeof(TkWinDrawable));
- ZeroMemory(screen, sizeof(Screen));
- ZeroMemory(display, sizeof(Display));
+ memset(screen, 0, sizeof(Screen));
+ memset(display, 0, sizeof(Display));
/*
* Note that these pixel values are not palette relative.
@@ -582,7 +583,7 @@ XkbOpenDisplay(
twdPtr->window.winPtr = NULL;
twdPtr->window.handle = NULL;
screen->root = (Window)twdPtr;
- screen->display = display;
+ screen->display = (Display *)display;
display->display_name = (char *)ckalloc(strlen(name) + 1);
strcpy(display->display_name, name);
@@ -597,7 +598,7 @@ XkbOpenDisplay(
if (minor_rtrn) *minor_rtrn = 0;
if (reason) *reason = 0;
- return display;
+ return (Display *)display;
}
/*
@@ -643,7 +644,7 @@ TkpCloseDisplay(
ckfree((char *)ScreenOfDisplay(display, 0)->root);
}
if (ScreenOfDisplay(display, 0)->cmap != None) {
- XFreeColormap(display, ScreenOfDisplay(display, 0)->cmap);
+ XFreeColormap((Display *)display, ScreenOfDisplay(display, 0)->cmap);
}
ckfree(display->screens);
}
@@ -991,7 +992,7 @@ GenerateXEvent(
}
memset(&event.x, 0, sizeof(XEvent));
- event.x.xany.serial = winPtr->display->request++;
+ event.x.xany.serial = LastKnownRequestProcessed(winPtr->display)++;
event.x.xany.send_event = False;
event.x.xany.display = winPtr->display;
event.x.xany.window = winPtr->window;
@@ -1660,7 +1661,7 @@ HandleIMEComposition(
winPtr = (TkWindow *) Tk_HWNDToWindow(hwnd);
memset(&event, 0, sizeof(XEvent));
- event.xkey.serial = winPtr->display->request++;
+ event.xkey.serial = LastKnownRequestProcessed(winPtr->display)++;
event.xkey.send_event = -3;
event.xkey.display = winPtr->display;
event.xkey.window = winPtr->window;
diff --git a/xlib/X11/Xlib.h b/xlib/X11/Xlib.h
index a9042a4..967b815 100644
--- a/xlib/X11/Xlib.h
+++ b/xlib/X11/Xlib.h
@@ -492,11 +492,17 @@ typedef struct {
* The contents of this structure are implementation dependent.
* A Display should be treated as opaque by application code.
*/
+#ifndef XLIB_ILLEGAL_ACCESS
+typedef struct _XDisplay Display;
+#endif
+
struct _XPrivate; /* Forward declare before use for C++ */
struct _XrmHashBucketRec;
typedef struct
+#ifdef XLIB_ILLEGAL_ACCESS
_XDisplay
+#endif
{
XExtData *ext_data; /* hook for extension to hang data */
struct _XPrivate *private1;
@@ -547,7 +553,9 @@ _XDisplay
char *xdefaults; /* contents of defaults from server */
/* there is more to this structure, but it is private to Xlib */
}
+#ifdef XLIB_ILLEGAL_ACCESS
Display,
+#endif
*_XPrivDisplay;
#undef _XEVENT_