diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-01-03 20:53:24 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-01-03 20:53:24 (GMT) |
commit | d2747a371058fa4128dbd7896fe040f0b3ee6be7 (patch) | |
tree | 636e7fd05c44d1f45b621dad17cfeed7d672199b | |
parent | f2b5a87d6dc6d3468828d48929583d950690a40b (diff) | |
download | tk-d2747a371058fa4128dbd7896fe040f0b3ee6be7.zip tk-d2747a371058fa4128dbd7896fe040f0b3ee6be7.tar.gz tk-d2747a371058fa4128dbd7896fe040f0b3ee6be7.tar.bz2 |
Bring back more original "None" usages, and fix other warnings which gradually slipped in.
Wherever possible, pragma's are used in MSVC to silence useless compiler warnings.
52 files changed, 174 insertions, 160 deletions
diff --git a/generic/tk3d.c b/generic/tk3d.c index eebe122..ddb48b3 100644 --- a/generic/tk3d.c +++ b/generic/tk3d.c @@ -237,9 +237,9 @@ Tk_Get3DBorder( borderPtr->darkColorPtr = NULL; borderPtr->lightColorPtr = NULL; borderPtr->shadow = None; - borderPtr->bgGC = 0; - borderPtr->darkGC = 0; - borderPtr->lightGC = 0; + borderPtr->bgGC = NULL; + borderPtr->darkGC = NULL; + borderPtr->lightGC = NULL; borderPtr->hashPtr = hashPtr; borderPtr->nextPtr = existingBorderPtr; Tcl_SetHashValue(hashPtr, borderPtr); @@ -392,7 +392,7 @@ Tk_3DBorderGC( * compilers happy. */ - return (GC) None; + return NULL; } /* diff --git a/generic/tk3d.h b/generic/tk3d.h index 5e0a0cf..30a35c5 100644 --- a/generic/tk3d.h +++ b/generic/tk3d.h @@ -60,10 +60,10 @@ typedef struct TkBorder { GC bgGC; /* Used (if necessary) to draw areas in the * background color. */ GC darkGC; /* Used to draw darker parts of the border. - * None means the shadow colors haven't been + * NULL means the shadow colors haven't been * allocated yet.*/ GC lightGC; /* Used to draw lighter parts of the border. - * None means the shadow colors haven't been + * NULL means the shadow colors haven't been * allocated yet. */ Tcl_HashEntry *hashPtr; /* Entry in borderTable (needed in order to * delete structure). */ diff --git a/generic/tkBind.c b/generic/tkBind.c index c4f8226..98c491a 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -3870,7 +3870,7 @@ DoWarp( { TkDisplay *dispPtr = (TkDisplay *) clientData; - XWarpPointer(dispPtr->display, (Window) None, (Window) dispPtr->warpWindow, + XWarpPointer(dispPtr->display, None, (Window) dispPtr->warpWindow, 0, 0, 0, 0, (int) dispPtr->warpX, (int) dispPtr->warpY); XForceScreenSaver(dispPtr->display, ScreenSaverReset); dispPtr->flags &= ~TK_DISPLAY_IN_WARP; diff --git a/generic/tkButton.h b/generic/tkButton.h index 09aaee2..d669b02 100644 --- a/generic/tkButton.h +++ b/generic/tkButton.h @@ -235,7 +235,7 @@ typedef struct { * Miscellaneous information: */ - Tk_Cursor cursor; /* Value of -cursor option: if not None, + Tk_Cursor cursor; /* Value of -cursor option: if not NULL, * specifies current cursor for window. */ Tcl_Obj *takeFocusPtr; /* Value of -takefocus option; not used in the * C code, but used by keyboard traversal diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c index 33367de..ae62147 100644 --- a/generic/tkCanvArc.c +++ b/generic/tkCanvArc.c @@ -526,7 +526,9 @@ ConfigureArc( } } - if ((arcPtr->style == ARC_STYLE) || (!color)) { + if (arcPtr->style == ARC_STYLE) { + newGC = NULL; + } else if (color == NULL) { newGC = NULL; } else { gcValues.foreground = color->pixel; diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c index 5f97ef2..59e2494 100644 --- a/generic/tkCanvBmap.c +++ b/generic/tkCanvBmap.c @@ -376,7 +376,7 @@ ConfigureBitmap( } } - if (!bitmap) { + if (bitmap == None) { newGC = NULL; } else { gcValues.foreground = fgColor->pixel; diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c index fea2103..5f67175 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.c @@ -533,10 +533,10 @@ ConfigureLine( } else { newGC = arrowGC = NULL; } - if (linePtr->outline.gc) { + if (linePtr->outline.gc != None) { Tk_FreeGC(Tk_Display(tkwin), linePtr->outline.gc); } - if (linePtr->arrowGC) { + if (linePtr->arrowGC != None) { Tk_FreeGC(Tk_Display(tkwin), linePtr->arrowGC); } linePtr->outline.gc = newGC; @@ -2251,7 +2251,7 @@ LineToPostscript( * being created. */ { LineItem *linePtr = (LineItem *) itemPtr; - char buffer[64 + TCL_INTEGER_SPACE]; + char buffer[64 + 4*TCL_INTEGER_SPACE]; char *style; double width; diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index 0810ab6..4ab4339 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -486,7 +486,7 @@ ConfigurePolygon( } else { newGC = NULL; } - if (polyPtr->outline.gc) { + if (polyPtr->outline.gc != None) { Tk_FreeGC(Tk_Display(tkwin), polyPtr->outline.gc); } polyPtr->outline.gc = newGC; @@ -509,12 +509,12 @@ ConfigurePolygon( } } - if (!color) { + if (color == NULL) { newGC = NULL; } else { gcValues.foreground = color->pixel; mask = GCForeground; - if (stipple) { + if (stipple != None) { gcValues.stipple = stipple; gcValues.fill_style = FillStippled; mask |= GCStipple|GCFillStyle; diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index 187ec40..6dd1c9f 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -446,7 +446,7 @@ ConfigureText( if (textPtr->tkfont != NULL) { gcValues.font = Tk_FontId(textPtr->tkfont); mask = GCFont; - if (color) { + if (color != NULL) { gcValues.foreground = color->pixel; mask |= GCForeground; if (stipple != None) { @@ -457,7 +457,7 @@ ConfigureText( newGC = Tk_GetGC(tkwin, mask, &gcValues); } mask &= ~(GCTile|GCFillStyle|GCStipple); - if (stipple) { + if (stipple != None) { gcValues.stipple = stipple; gcValues.fill_style = FillStippled; mask |= GCStipple|GCFillStyle; @@ -467,7 +467,7 @@ ConfigureText( } newSelGC = Tk_GetGC(tkwin, mask|GCForeground, &gcValues); } - if (textPtr->gc) { + if (textPtr->gc != None) { Tk_FreeGC(Tk_Display(tkwin), textPtr->gc); } textPtr->gc = newGC; @@ -488,7 +488,7 @@ ConfigureText( } else { newGC = NULL; } - if (textPtr->cursorOffGC) { + if (textPtr->cursorOffGC != None) { Tk_FreeGC(Tk_Display(tkwin), textPtr->cursorOffGC); } textPtr->cursorOffGC = newGC; diff --git a/generic/tkCanvas.h b/generic/tkCanvas.h index d009cfa..5e784e3 100644 --- a/generic/tkCanvas.h +++ b/generic/tkCanvas.h @@ -206,7 +206,7 @@ typedef struct TkCanvas { * Miscellaneous information: */ - Tk_Cursor cursor; /* Current cursor for window, or None. */ + Tk_Cursor cursor; /* Current cursor for window, or NULL. */ char *takeFocus; /* Value of -takefocus option; not used in the * C code, but used by keyboard traversal * scripts. Malloc'ed, but may be NULL. */ diff --git a/generic/tkColor.c b/generic/tkColor.c index bde08cf..c2b7732 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.c @@ -242,7 +242,7 @@ Tk_GetColor( */ tkColPtr->magic = COLOR_MAGIC; - tkColPtr->gc = 0; + tkColPtr->gc = NULL; tkColPtr->screen = Tk_Screen(tkwin); tkColPtr->colormap = Tk_Colormap(tkwin); tkColPtr->visual = Tk_Visual(tkwin); @@ -323,7 +323,7 @@ Tk_GetColorByValue( tkColPtr = TkpGetColorByValue(tkwin, colorPtr); tkColPtr->magic = COLOR_MAGIC; - tkColPtr->gc = 0; + tkColPtr->gc = NULL; tkColPtr->screen = Tk_Screen(tkwin); tkColPtr->colormap = valueKey.colormap; tkColPtr->visual = Tk_Visual(tkwin); @@ -471,7 +471,7 @@ Tk_FreeColor( if (tkColPtr->gc != None) { XFreeGC(DisplayOfScreen(screen), tkColPtr->gc); - tkColPtr->gc = 0; + tkColPtr->gc = NULL; } TkpFreeColor(tkColPtr); diff --git a/generic/tkColor.h b/generic/tkColor.h index d4679cf..12c6662 100644 --- a/generic/tkColor.h +++ b/generic/tkColor.h @@ -37,7 +37,7 @@ typedef struct TkColor { * COLOR_MAGIC. */ GC gc; /* Simple gc with this color as foreground * color and all other fields defaulted. May - * be None. */ + * be NULL. */ Screen *screen; /* Screen where this color is valid. Used to * delete it, and to find its display. */ Colormap colormap; /* Colormap from which this entry was diff --git a/generic/tkConfig.c b/generic/tkConfig.c index ace7135..1a49026 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -854,7 +854,7 @@ DoObjConfig( Tk_Cursor newCursor; if (nullOK && ObjectIsEmpty(valuePtr)) { - newCursor = 0; + newCursor = NULL; valuePtr = NULL; } else { newCursor = Tk_AllocCursorFromObj(interp, tkwin, valuePtr); @@ -916,7 +916,7 @@ DoObjConfig( if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; - newWin = 0; + newWin = NULL; } else { if (TkGetWindowFromObj(interp, tkwin, valuePtr, &newWin) != TCL_OK) { @@ -1702,7 +1702,7 @@ FreeResources( if (internalFormExists) { if (*((Tk_Cursor *) internalPtr) != None) { Tk_FreeCursor(Tk_Display(tkwin), *((Tk_Cursor *) internalPtr)); - *((Tk_Cursor *) internalPtr) = 0; + *((Tk_Cursor *) internalPtr) = NULL; } } else if (objPtr != NULL) { Tk_FreeCursorFromObj(tkwin, objPtr); diff --git a/generic/tkCursor.c b/generic/tkCursor.c index a1c2723..e5b5df5 100644 --- a/generic/tkCursor.c +++ b/generic/tkCursor.c @@ -149,7 +149,7 @@ Tk_AllocCursorFromObj( cursorPtr = TkcGetCursor(interp, tkwin, Tcl_GetString(objPtr)); objPtr->internalRep.twoPtrValue.ptr1 = (void *) cursorPtr; if (cursorPtr == NULL) { - return 0; + return NULL; } cursorPtr->objRefCount++; return cursorPtr->cursor; @@ -188,7 +188,7 @@ Tk_GetCursor( { TkCursor *cursorPtr = TkcGetCursor(interp, tkwin, string); if (cursorPtr == NULL) { - return 0; + return NULL; } return cursorPtr->cursor; } @@ -382,7 +382,7 @@ Tk_GetCursorFromData( error: Tcl_DeleteHashEntry(dataHashPtr); - return 0; + return NULL; } /* diff --git a/generic/tkEntry.c b/generic/tkEntry.c index f5b4339..7b95fc9 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -2453,7 +2453,7 @@ EntryEventProc( } else { cursor = NULL; } - if (cursor) { + if (cursor != None) { Tk_DefineCursor(entryPtr->tkwin, cursor); } else { Tk_UndefineCursor(entryPtr->tkwin); diff --git a/generic/tkEntry.h b/generic/tkEntry.h index 7f8aa1f..da06408 100644 --- a/generic/tkEntry.h +++ b/generic/tkEntry.h @@ -87,7 +87,7 @@ typedef struct { * in readonly state, plus used for * background. */ int borderWidth; /* Width of 3-D border around window. */ - Tk_Cursor cursor; /* Current cursor for window, or None. */ + Tk_Cursor cursor; /* Current cursor for window, or NULL. */ int exportSelection; /* Non-zero means tie internal entry selection * to X selection. */ Tk_Font tkfont; /* Information about text font, or NULL. */ @@ -197,7 +197,7 @@ typedef struct { Tk_3DBorder activeBorder; /* Used for drawing border around active * buttons. */ Tk_3DBorder buttonBorder; /* Used for drawing border around buttons. */ - Tk_Cursor bCursor; /* cursor for buttons, or None. */ + Tk_Cursor bCursor; /* cursor for buttons, or NULL. */ int bdRelief; /* 3-D effect: TK_RELIEF_RAISED, etc. */ int buRelief; /* 3-D effect: TK_RELIEF_RAISED, etc. */ char *command; /* Command to invoke for spin buttons. NULL @@ -226,7 +226,7 @@ typedef struct { * value that the users requests. Malloc'ed */ char *valueFormat; /* Sprintf conversion specifier used for the * value. */ - char digitFormat[10]; /* Sprintf conversion specifier computed from + char digitFormat[16]; /* Sprintf conversion specifier computed from * digits and other information; used for the * value. */ diff --git a/generic/tkEvent.c b/generic/tkEvent.c index 9b001e1..9758dbe 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -1436,7 +1436,7 @@ TkEventDeadWindow( ipPtr->nextHandler = NULL; } if (ipPtr->winPtr == winPtr) { - ipPtr->winPtr = 0; + ipPtr->winPtr = NULL; } } ckfree((char *) handlerPtr); diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index fab6afb..b37e7d5 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -400,18 +400,18 @@ ImgBmapConfigureInstance( (unsigned) masterPtr->height); } - if (oldMask) { + if (oldMask != None) { Tk_FreePixmap(Tk_Display(instancePtr->tkwin), oldMask); } - if (oldBitmap) { + if (oldBitmap != None) { Tk_FreePixmap(Tk_Display(instancePtr->tkwin), oldBitmap); } - if (masterPtr->data) { + if (masterPtr->data != NULL) { gcValues.foreground = instancePtr->fg->pixel; gcValues.graphics_exposures = False; mask = GCForeground|GCGraphicsExposures; - if (instancePtr->bg) { + if (instancePtr->bg != NULL) { gcValues.background = instancePtr->bg->pixel; mask |= GCBackground; if (instancePtr->mask != None) { @@ -426,7 +426,7 @@ ImgBmapConfigureInstance( } else { gc = NULL; } - if (instancePtr->gc) { + if (instancePtr->gc != None) { Tk_FreeGC(Tk_Display(instancePtr->tkwin), instancePtr->gc); } instancePtr->gc = gc; @@ -438,7 +438,7 @@ ImgBmapConfigureInstance( * it clear that this instance cannot be displayed. Then report the error. */ - if (instancePtr->gc) { + if (instancePtr->gc != None) { Tk_FreeGC(Tk_Display(instancePtr->tkwin), instancePtr->gc); } instancePtr->gc = NULL; diff --git a/generic/tkMenu.h b/generic/tkMenu.h index e8470ca..b1536df 100644 --- a/generic/tkMenu.h +++ b/generic/tkMenu.h @@ -80,8 +80,8 @@ typedef struct TkMenuEntry { * of character to underline (<0 means don't * underline anything). */ Tcl_Obj *underlinePtr; /* Index of character to underline. */ - Tcl_Obj *bitmapPtr; /* Bitmap to display in menu entry, or None. - * If not None then label is ignored. */ + Tcl_Obj *bitmapPtr; /* Bitmap to display in menu entry, or NULL. + * If not NULL then label is ignored. */ Tcl_Obj *imagePtr; /* Name of image to display, or NULL. If not * NULL, bitmap, text, and textVarName are * ignored. */ @@ -180,7 +180,7 @@ typedef struct TkMenuEntry { * NULL means use overall disabledGC from menu * structure. See comments for disabledFg in * menu structure for more information. */ - GC indicatorGC; /* For drawing indicators. None means use GC + GC indicatorGC; /* For drawing indicators. NULL means use GC * from menu. */ /* @@ -347,7 +347,7 @@ typedef struct TkMenu { Tcl_Obj *takeFocusPtr; /* Value of -takefocus option; not used in the * C code, but used by keyboard traversal * scripts. Malloc'ed, but may be NULL. */ - Tcl_Obj *cursorPtr; /* Current cursor for window, or None. */ + Tcl_Obj *cursorPtr; /* Current cursor for window, or NULL. */ Tcl_Obj *postCommandPtr; /* Used to detect cycles in cascade hierarchy * trees when preprocessing postcommands on * some platforms. See PostMenu for more diff --git a/generic/tkMenubutton.h b/generic/tkMenubutton.h index 41af675..f190c818 100644 --- a/generic/tkMenubutton.h +++ b/generic/tkMenubutton.h @@ -175,7 +175,7 @@ typedef struct { * "left" and "right" will pop the menu left * or right, and the active item will be next * to the button. */ - Tk_Cursor cursor; /* Current cursor for window, or None. */ + Tk_Cursor cursor; /* Current cursor for window, or NULL. */ char *takeFocus; /* Value of -takefocus option; not used in the * C code, but used by keyboard traversal * scripts. Malloc'ed, but may be NULL. */ diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index cf5612b..8f4c234 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -476,7 +476,7 @@ DoConfig( Tk_Cursor newCursor, oldCursor; if (nullValue) { - newCursor = 0; + newCursor = NULL; } else { uid = valueIsUid ? (Tk_Uid) value : Tk_GetUid(value); newCursor = Tk_GetCursor(interp, tkwin, uid); diff --git a/generic/tkPlace.c b/generic/tkPlace.c index c435b12..19af02c 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -397,7 +397,7 @@ CreateSlave( slavePtr = (Slave *) ckalloc(sizeof(Slave)); memset(slavePtr, 0, sizeof(Slave)); slavePtr->tkwin = tkwin; - slavePtr->inTkwin = 0; + slavePtr->inTkwin = NULL; slavePtr->anchor = TK_ANCHOR_NW; slavePtr->borderMode = BM_INSIDE; slavePtr->optionTable = table; diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c index 53ebe61..0e73dd3 100644 --- a/generic/tkRectOval.c +++ b/generic/tkRectOval.c @@ -475,7 +475,7 @@ ConfigureRectOval( } else { newGC = NULL; } - if (rectOvalPtr->outline.gc) { + if (rectOvalPtr->outline.gc != None) { Tk_FreeGC(Tk_Display(tkwin), rectOvalPtr->outline.gc); } rectOvalPtr->outline.gc = newGC; @@ -506,7 +506,7 @@ ConfigureRectOval( } } - if (!color) { + if (color == NULL) { newGC = NULL; } else { gcValues.foreground = color->pixel; @@ -522,13 +522,13 @@ ConfigureRectOval( * Mac OS X CG drawing needs access to the outline linewidth * even for fills (as linewidth controls antialiasing). */ - gcValues.line_width = rectOvalPtr->outline.gc ? + gcValues.line_width = rectOvalPtr->outline.gc != None ? rectOvalPtr->outline.gc->line_width : 0; mask |= GCLineWidth; #endif newGC = Tk_GetGC(tkwin, mask, &gcValues); } - if (rectOvalPtr->fillGC) { + if (rectOvalPtr->fillGC != None) { Tk_FreeGC(Tk_Display(tkwin), rectOvalPtr->fillGC); } rectOvalPtr->fillGC = newGC; diff --git a/generic/tkScale.h b/generic/tkScale.h index a2c5f2b..079e02c 100644 --- a/generic/tkScale.h +++ b/generic/tkScale.h @@ -78,7 +78,7 @@ typedef struct TkScale { * values. 0 means we get to choose the number * based on resolution and/or the range of the * scale. */ - char format[10]; /* Sprintf conversion specifier computed from + char format[16]; /* Sprintf conversion specifier computed from * digits and other information. */ double bigIncrement; /* Amount to use for large increments to scale * value. (0 means we pick a value). */ @@ -156,7 +156,7 @@ typedef struct TkScale { */ int fontHeight; /* Height of scale font. */ - Tk_Cursor cursor; /* Current cursor for window, or None. */ + Tk_Cursor cursor; /* Current cursor for window, or NULL. */ Tcl_Obj *takeFocusPtr; /* Value of -takefocus option; not used in the * C code, but used by keyboard traversal * scripts. May be NULL. */ diff --git a/generic/tkScrollbar.h b/generic/tkScrollbar.h index 126d590..fa0426f 100644 --- a/generic/tkScrollbar.h +++ b/generic/tkScrollbar.h @@ -119,7 +119,7 @@ typedef struct TkScrollbar { * Miscellaneous information: */ - Tk_Cursor cursor; /* Current cursor for window, or None. */ + Tk_Cursor cursor; /* Current cursor for window, or NULL. */ char *takeFocus; /* Value of -takefocus option; not used in the * C code, but used by keyboard traversal * scripts. Malloc'ed, but may be NULL. */ diff --git a/generic/tkText.h b/generic/tkText.h index 6f5f153..464bed5 100644 --- a/generic/tkText.h +++ b/generic/tkText.h @@ -654,7 +654,7 @@ typedef struct TkText { /* Color for drawing traversal highlight area * when highlight is off. */ XColor *highlightColorPtr; /* Color for drawing traversal highlight. */ - Tk_Cursor cursor; /* Current cursor for window, or None. */ + Tk_Cursor cursor; /* Current cursor for window, or NULL. */ XColor *fgColor; /* Default foreground color for text. */ Tk_Font tkfont; /* Default font for displaying text. */ int charWidth; /* Width of average character in default diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 904fa1a..73abffb 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -4335,7 +4335,7 @@ DisplayText( dlPtr->spaceAbove, dlPtr->height-dlPtr->spaceAbove-dlPtr->spaceBelow, dlPtr->baseline - dlPtr->spaceAbove, NULL, - (Drawable) None, dlPtr->y + dlPtr->spaceAbove); + None, dlPtr->y + dlPtr->spaceAbove); } } diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index ae43ae6..61bf31b 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -332,7 +332,7 @@ EntryFetchSelection( ClientData clientData, int offset, char *buffer, int maxBytes) { Entry *entryPtr = (Entry *) clientData; - size_t byteCount; + int byteCount; const char *string; const char *selStart, *selEnd; @@ -345,7 +345,7 @@ EntryFetchSelection( selEnd = Tcl_UtfAtIndex(selStart, entryPtr->entry.selectLast - entryPtr->entry.selectFirst); byteCount = selEnd - selStart - offset; - if (byteCount > (size_t)maxBytes) { + if (byteCount > maxBytes) { /* @@@POSSIBLE BUG: Can transfer partial UTF-8 sequences. Is this OK? */ byteCount = maxBytes; } diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c index 58c99eb..04dd86f 100644 --- a/generic/ttk/ttkLayout.c +++ b/generic/ttk/ttkLayout.c @@ -7,7 +7,7 @@ */ #include <string.h> -#include <tk.h> +#include "tkInt.h" #include "ttkThemeInt.h" #define MAX(a,b) (a > b ? a : b) diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index f0a3003..473d1e6 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -6,7 +6,7 @@ #include <string.h> #include <stdio.h> -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c index d5e0484..557ca8f 100644 --- a/generic/ttk/ttkWidget.c +++ b/generic/ttk/ttkWidget.c @@ -5,7 +5,7 @@ */ #include <string.h> -#include <tk.h> +#include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" diff --git a/unix/tkUnix3d.c b/unix/tkUnix3d.c index 14f5827..417866b 100644 --- a/unix/tkUnix3d.c +++ b/unix/tkUnix3d.c @@ -47,7 +47,7 @@ TkBorder * TkpGetBorder(void) { UnixBorder *borderPtr = (UnixBorder *) ckalloc(sizeof(UnixBorder)); - borderPtr->solidGC = NULL; + borderPtr->solidGC = None; return (TkBorder *) borderPtr; } @@ -215,7 +215,7 @@ Tk_3DHorizontalBevel( Display *display = Tk_Display(tkwin); int bottom, halfway, x1, x2, x1Delta, x2Delta; UnixBorder *unixBorderPtr = (UnixBorder *) borderPtr; - GC topGC = NULL, bottomGC = NULL; + GC topGC = None, bottomGC = None; /* Initializations needed only to prevent * compiler warnings. */ diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c index 95bee0a..48d3fb9 100644 --- a/unix/tkUnixMenubu.c +++ b/unix/tkUnixMenubu.c @@ -103,10 +103,10 @@ TkpDisplayMenuButton( border = mbPtr->normalBorder; } - if (mbPtr->image) { + if (mbPtr->image != None) { Tk_SizeOfImage(mbPtr->image, &width, &height); haveImage = 1; - } else if (mbPtr->bitmap) { + } else if (mbPtr->bitmap != None) { Tk_SizeOfBitmap(mbPtr->display, mbPtr->bitmap, &width, &height); haveImage = 1; } @@ -194,7 +194,7 @@ TkpDisplayMenuButton( if (mbPtr->image != NULL) { Tk_RedrawImage(mbPtr->image, 0, 0, width, height, pixmap, imageXOffset, imageYOffset); - } else if (mbPtr->bitmap) { + } else if (mbPtr->bitmap != None) { XSetClipOrigin(mbPtr->display, gc, imageXOffset, imageYOffset); XCopyPlane(mbPtr->display, mbPtr->bitmap, pixmap, gc, 0, 0, (unsigned) width, (unsigned) height, @@ -214,7 +214,7 @@ TkpDisplayMenuButton( if (mbPtr->image != NULL) { Tk_RedrawImage(mbPtr->image, 0, 0, width, height, pixmap, imageXOffset, imageYOffset); - } else if (mbPtr->bitmap) { + } else if (mbPtr->bitmap != None) { XSetClipOrigin(mbPtr->display, gc, x, y); XCopyPlane(mbPtr->display, mbPtr->bitmap, pixmap, gc, 0, 0, (unsigned) width, (unsigned) height, @@ -369,10 +369,10 @@ TkpComputeMenuButtonGeometry( txtHeight = 0; avgWidth = 0; - if (mbPtr->image) { + if (mbPtr->image != None) { Tk_SizeOfImage(mbPtr->image, &width, &height); haveImage = 1; - } else if (mbPtr->bitmap) { + } else if (mbPtr->bitmap != None) { Tk_SizeOfBitmap(mbPtr->display, mbPtr->bitmap, &width, &height); haveImage = 1; } diff --git a/win/stubs.c b/win/stubs.c index 7e791b5..4564639 100644 --- a/win/stubs.c +++ b/win/stubs.c @@ -397,7 +397,7 @@ XGetWindowProperty( unsigned long *bytes_after_return, unsigned char **prop_return) { - *actual_type_return = 0; + *actual_type_return = None; *actual_format_return = 0; *nitems_return = 0; *bytes_after_return = 0; diff --git a/win/tkWin3d.c b/win/tkWin3d.c index aa026e8..df6aa95 100644 --- a/win/tkWin3d.c +++ b/win/tkWin3d.c @@ -127,7 +127,7 @@ Tk_3DVerticalBevel( HDC dc = TkWinGetDrawableDC(display, drawable, &state); int half; - if (!borderPtr->lightGC && (relief != TK_RELIEF_FLAT)) { + if ((borderPtr->lightGC == None) && (relief != TK_RELIEF_FLAT)) { TkpGetShadows(borderPtr, tkwin); } @@ -222,7 +222,7 @@ Tk_3DHorizontalBevel( HDC dc = TkWinGetDrawableDC(display, drawable, &state); int topColor, bottomColor; - if (!borderPtr->lightGC && (relief != TK_RELIEF_FLAT)) { + if ((borderPtr->lightGC == None) && (relief != TK_RELIEF_FLAT)) { TkpGetShadows(borderPtr, tkwin); } @@ -339,7 +339,7 @@ TkpGetShadows( int r, g, b; XGCValues gcValues; - if (borderPtr->lightGC) { + if (borderPtr->lightGC != None) { return; } @@ -465,10 +465,10 @@ TkpGetShadows( return; } - if (!borderPtr->shadow) { + if (borderPtr->shadow == None) { borderPtr->shadow = Tk_GetBitmap((Tcl_Interp *) NULL, tkwin, Tk_GetUid("gray50")); - if (!borderPtr->shadow) { + if (borderPtr->shadow == None) { Tcl_Panic("TkpGetShadows couldn't allocate bitmap for border"); } } @@ -540,7 +540,7 @@ TkWinGetBorderPixels( { WinBorder *borderPtr = (WinBorder *) border; - if (!borderPtr->info.lightGC) { + if (borderPtr->info.lightGC == None) { TkpGetShadows(&borderPtr->info, tkwin); } switch (which) { diff --git a/win/tkWinButton.c b/win/tkWinButton.c index 0a11a20..c36932d 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.c @@ -127,7 +127,7 @@ InitBoxes(void) HRSRC hrsrc; HGLOBAL hblk; LPBITMAPINFOHEADER newBitmap; - DWORD size; + size_t size; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -146,8 +146,9 @@ InitBoxes(void) if (tsdPtr->boxesPtr != NULL && !(tsdPtr->boxesPtr->biWidth % 4) && !(tsdPtr->boxesPtr->biHeight % 2)) { - size = tsdPtr->boxesPtr->biSize + (1 << tsdPtr->boxesPtr->biBitCount) - * sizeof(RGBQUAD) + tsdPtr->boxesPtr->biSizeImage; + size = tsdPtr->boxesPtr->biSize + + (sizeof(RGBQUAD) << tsdPtr->boxesPtr->biBitCount) + + tsdPtr->boxesPtr->biSizeImage; newBitmap = (LPBITMAPINFOHEADER) ckalloc(size); memcpy(newBitmap, tsdPtr->boxesPtr, size); tsdPtr->boxesPtr = newBitmap; @@ -156,7 +157,7 @@ InitBoxes(void) tsdPtr->boxesPalette = (DWORD*) (((LPSTR) tsdPtr->boxesPtr) + tsdPtr->boxesPtr->biSize); tsdPtr->boxesBits = ((LPSTR) tsdPtr->boxesPalette) - + ((1 << tsdPtr->boxesPtr->biBitCount) * sizeof(RGBQUAD)); + + (sizeof(RGBQUAD) << tsdPtr->boxesPtr->biBitCount); } else { tsdPtr->boxesPtr = NULL; } @@ -433,10 +434,10 @@ TkpDisplayButton( * Display image or bitmap or text for button. */ - if (butPtr->image) { + if (butPtr->image != None) { Tk_SizeOfImage(butPtr->image, &width, &height); haveImage = 1; - } else if (butPtr->bitmap) { + } else if (butPtr->bitmap != None) { Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height); haveImage = 1; } @@ -839,7 +840,7 @@ TkpComputeButtonGeometry( if (butPtr->image != NULL) { Tk_SizeOfImage(butPtr->image, &imgWidth, &imgHeight); haveImage = 1; - } else if (butPtr->bitmap) { + } else if (butPtr->bitmap != None) { Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &imgWidth, &imgHeight); haveImage = 1; diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c index e94c893..1897bc8 100644 --- a/win/tkWinDraw.c +++ b/win/tkWinDraw.c @@ -631,7 +631,7 @@ XFillRectangles( TkWinDCState state; HBRUSH brush, oldBrush; - if (!d) { + if (d == None) { return BadDrawable; } @@ -641,7 +641,7 @@ XFillRectangles( if ((gc->fill_style == FillStippled || gc->fill_style == FillOpaqueStippled) - && gc->stipple) { + && gc->stipple != None) { TkWinDrawable *twdPtr = (TkWinDrawable *)gc->stipple; HBRUSH stipple; HBITMAP oldBitmap, bitmap; @@ -756,7 +756,7 @@ RenderObject( if ((gc->fill_style == FillStippled || gc->fill_style == FillOpaqueStippled) - && gc->stipple) { + && gc->stipple != None) { TkWinDrawable *twdPtr = (TkWinDrawable *)gc->stipple; HDC dcMem; @@ -882,7 +882,7 @@ XDrawLines( TkWinDCState state; HDC dc; - if (!d) { + if (d == None) { return BadDrawable; } @@ -927,7 +927,7 @@ XFillPolygon( TkWinDCState state; HDC dc; - if (!d) { + if (d == None) { return BadDrawable; } @@ -969,7 +969,7 @@ XDrawRectangle( HBRUSH oldBrush; HDC dc; - if (!d) { + if (d == None) { return BadDrawable; } @@ -1085,7 +1085,7 @@ DrawOrFillArc( int xstart, ystart, xend, yend; double radian_start, radian_end, xr, yr; - if (!d) { + if (d == None) { return BadDrawable; } diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c index 539349f..1b0d2cf 100644 --- a/win/tkWinEmbed.c +++ b/win/tkWinEmbed.c @@ -242,7 +242,7 @@ TkpUseWindow( */ /* - if (winPtr->window) { + if (winPtr->window != None) { Tcl_AppendResult(interp, "can't modify container after widget is created", NULL); return TCL_ERROR; @@ -298,9 +298,9 @@ TkpUseWindow( * order to avoid bug 1096074 in future. */ - char msg[260]; + char msg[256]; - sprintf(msg, "Unable to get information of window \"%.80s\". Attach to this\nwindow may have unpredictable results if it is not a valid container.\n\nPress Ok to proceed or Cancel to abort attaching.", string); + sprintf(msg, "Unable to get information of window \"%.79s\". Attach to this\nwindow may have unpredictable results if it is not a valid container.\n\nPress Ok to proceed or Cancel to abort attaching.", string); if (IDCANCEL == MessageBox(hwnd, msg, "Tk Warning", MB_OKCANCEL | MB_ICONWARNING)) { Tcl_SetResult(interp, "Operation has been canceled", TCL_STATIC); diff --git a/win/tkWinFont.c b/win/tkWinFont.c index b60a918..1292772 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -519,7 +519,7 @@ TkpGetFontFromAttributes( tkwin = (Tk_Window) ((TkWindow *) tkwin)->mainPtr->winPtr; window = Tk_WindowId(tkwin); - hwnd = window ? TkWinGetHWND(window) : NULL; + hwnd = (window == None) ? NULL : TkWinGetHWND(window); hdc = GetDC(hwnd); /* @@ -631,7 +631,7 @@ TkpGetFontFamilies( Window window; window = Tk_WindowId(tkwin); - hwnd = window ? TkWinGetHWND(window) : NULL; + hwnd = (window == None) ? NULL : TkWinGetHWND(window); hdc = GetDC(hwnd); /* @@ -1095,7 +1095,7 @@ Tk_DrawChars( fontPtr = (WinFont *) gc->font; display->request++; - if (!drawable) { + if (drawable == None) { return; } @@ -1103,14 +1103,14 @@ Tk_DrawChars( SetROP2(dc, tkpWinRopModes[gc->function]); - if (gc->clip_mask && + if ((gc->clip_mask != None) && ((TkpClipMask*)gc->clip_mask)->type == TKP_CLIP_REGION) { SelectClipRgn(dc, (HRGN)((TkpClipMask*)gc->clip_mask)->value.region); } if ((gc->fill_style == FillStippled || gc->fill_style == FillOpaqueStippled) - && gc->stipple) { + && gc->stipple != None) { TkWinDrawable *twdPtr = (TkWinDrawable *)gc->stipple; HBRUSH oldBrush, stipple; HBITMAP oldBitmap, bitmap; @@ -1395,7 +1395,7 @@ InitFont( char buf[LF_FACESIZE * sizeof(WCHAR)]; window = Tk_WindowId(tkwin); - hwnd = window ? TkWinGetHWND(window) : NULL; + hwnd = (window == None) ? NULL : TkWinGetHWND(window); hdc = GetDC(hwnd); oldFont = SelectObject(hdc, hFont); diff --git a/win/tkWinImage.c b/win/tkWinImage.c index 8e6ef38..07aa1d3 100644 --- a/win/tkWinImage.c +++ b/win/tkWinImage.c @@ -348,7 +348,7 @@ XGetImageZPixmap( size = sizeof(BITMAPINFO); if (depth <= 8) { - size += sizeof(unsigned short) * (1 << depth); + size += sizeof(unsigned short) << depth; } bmInfo = (BITMAPINFO *) ckalloc((unsigned)size); diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 6240ceb..9a35266 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -2345,7 +2345,7 @@ DrawMenuEntryLabel( XFillRectangle(menuPtr->display, d, menuPtr->disabledGC, x, y, (unsigned) width, (unsigned) height); } else if ((mePtr->image != NULL) - && menuPtr->disabledImageGC) { + && (menuPtr->disabledImageGC != None)) { XFillRectangle(menuPtr->display, d, menuPtr->disabledImageGC, leftEdge + imageXOffset, (int) (y + (mePtr->height - imageHeight)/2 + imageYOffset), @@ -2990,7 +2990,7 @@ MenuSelectEvent( Tk_MakeWindowExist(menuPtr->tkwin); event.event = Tk_WindowId(menuPtr->tkwin); event.root = XRootWindow(menuPtr->display, 0); - event.subwindow = 0; + event.subwindow = None; event.time = TkpGetMS(); root.msgpos = GetMessagePos(); diff --git a/win/tkWinPixmap.c b/win/tkWinPixmap.c index 60e218d..51f0f59 100644 --- a/win/tkWinPixmap.c +++ b/win/tkWinPixmap.c @@ -115,7 +115,7 @@ Tk_GetPixmap( if (newTwdPtr->bitmap.handle == NULL) { ckfree((char *) newTwdPtr); - return 0; + return None; } return (Pixmap) newTwdPtr; diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c index d5706ac..dcddb8f 100644 --- a/win/tkWinPointer.c +++ b/win/tkWinPointer.c @@ -387,7 +387,7 @@ XGetInputFocus( { Tk_Window tkwin = Tk_HWNDToWindow(GetFocus()); - *focus_return = tkwin ? Tk_WindowId(tkwin) : 0; + *focus_return = tkwin ? Tk_WindowId(tkwin) : None; *revert_to_return = RevertToParent; display->request++; return Success; @@ -418,7 +418,7 @@ XSetInputFocus( Time time) { display->request++; - if (focus) { + if (focus != None) { SetFocus(Tk_GetHWND(focus)); } return Success; @@ -465,7 +465,7 @@ TkpChangeFocus( } } - if (!winPtr->window) { + if (winPtr->window == None) { Tcl_Panic("ChangeXFocus got null X window"); } diff --git a/win/tkWinPort.h b/win/tkWinPort.h index aec5a66..2925dae 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -83,6 +83,11 @@ * See ticket [916c1095438eae56]: GetVersionExW triggers warnings */ #if defined(_MSC_VER) +# pragma warning(disable:4047) +# pragma warning(disable:4267) +# pragma warning(disable:4244) +# pragma warning(disable:4311) +# pragma warning(disable:4312) # pragma warning(disable:4996) #endif @@ -118,7 +123,7 @@ */ #define TkpDefineNativeBitmaps() -#define TkpCreateNativeBitmap(display, source) 0 -#define TkpGetNativeAppBitmap(display, name, w, h) 0 +#define TkpCreateNativeBitmap(display, source) None +#define TkpGetNativeAppBitmap(display, name, w, h) None #endif /* _WINPORT */ diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c index f30a957..fc9685d 100644 --- a/win/tkWinScrlbr.c +++ b/win/tkWinScrlbr.c @@ -238,7 +238,7 @@ CreateProc( for (winPtr = ((TkWindow*)tkwin)->nextPtr; winPtr != NULL; winPtr = winPtr->nextPtr) { - if ((winPtr->window) && !(winPtr->flags & TK_TOP_HIERARCHY)) { + if ((winPtr->window != None) && !(winPtr->flags & TK_TOP_HIERARCHY)) { TkWinSetWindowPos(scrollPtr->hwnd, Tk_GetHWND(winPtr->window), Below); break; diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c index 0675bc6..3dfc078 100644 --- a/win/tkWinWindow.c +++ b/win/tkWinWindow.c @@ -228,7 +228,7 @@ TkpScanWindowId( if (tkwin) { *idPtr = Tk_WindowId(tkwin); } else { - *idPtr = 0; + *idPtr = None; } return TCL_OK; } @@ -259,7 +259,7 @@ TkpMakeWindow( int style; HWND hwnd; - if (parent) { + if (parent != None) { parentWin = Tk_GetHWND(parent); style = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; } else { @@ -657,7 +657,7 @@ XConfigureWindow( if (valueMask & CWStackMode) { HWND sibling; - if ((valueMask & CWSibling) && values->sibling) { + if ((valueMask & CWSibling) && (values->sibling != None)) { sibling = Tk_GetHWND(values->sibling); } else { sibling = NULL; diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 8e6683f..9d706fa 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -1035,7 +1035,7 @@ WinSetIcon( "\" isn't a top-level window", NULL); return TCL_ERROR; } - if (!Tk_WindowId(tkw)) { + if (Tk_WindowId(tkw) == None) { Tk_MakeWindowExist(tkw); } @@ -1198,7 +1198,7 @@ TkWinGetIcon( } } - if (!Tk_WindowId(tkwin)) { + if (Tk_WindowId(tkwin) == None) { Tk_MakeWindowExist(tkwin); } @@ -1977,11 +1977,11 @@ TkWmNewWindow( wmPtr->hints.flags = InputHint | StateHint; wmPtr->hints.input = True; wmPtr->hints.initial_state = NormalState; - wmPtr->hints.icon_pixmap = 0; - wmPtr->hints.icon_window = 0; + wmPtr->hints.icon_pixmap = None; + wmPtr->hints.icon_window = None; wmPtr->hints.icon_x = wmPtr->hints.icon_y = 0; - wmPtr->hints.icon_mask = 0; - wmPtr->hints.window_group = 0; + wmPtr->hints.icon_mask = None; + wmPtr->hints.window_group = None; /* * Default the maximum dimensions to the size of the display. @@ -2062,7 +2062,7 @@ UpdateWrapper( ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - if (!winPtr->window) { + if (winPtr->window == None) { /* * Ensure existence of the window to update the wrapper for. */ @@ -2683,7 +2683,7 @@ TkWmDeadWindow( VisibilityChangeMask|StructureNotifyMask, WmWaitVisibilityOrMapProc, (ClientData) wmPtr2->winPtr); wmPtr2->masterPtr = NULL; - if (wmPtr2->wrapper + if ((wmPtr2->wrapper != None) && !(wmPtr2->flags & (WM_NEVER_MAPPED))) { UpdateWrapper(wmPtr2->winPtr); } @@ -3474,7 +3474,7 @@ WmColormapwindowsCmd( if (winPtr2 == winPtr) { gotToplevel = 1; } - if (!winPtr2->window) { + if (winPtr2->window == None) { Tk_MakeWindowExist((Tk_Window) winPtr2); } cmapList[i] = winPtr2; @@ -3750,7 +3750,7 @@ WmFrameCmd( Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } - if (!Tk_WindowId((Tk_Window) winPtr)) { + if (Tk_WindowId((Tk_Window) winPtr) == None) { Tk_MakeWindowExist((Tk_Window) winPtr); } hwnd = wmPtr->wrapper; @@ -4044,9 +4044,9 @@ WmIconbitmapCmd( string = Tcl_GetString(objv[objc-1]); if (*string == '\0') { - if (wmPtr->hints.icon_pixmap) { + if (wmPtr->hints.icon_pixmap != None) { Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap); - wmPtr->hints.icon_pixmap = 0; + wmPtr->hints.icon_pixmap = None; } wmPtr->hints.flags &= ~IconPixmapHint; if (WinSetIcon(interp, NULL, (Tk_Window) useWinPtr) != TCL_OK) { @@ -4098,7 +4098,7 @@ WmIconbitmapCmd( Pixmap pixmap; Tcl_ResetResult(interp); pixmap = Tk_GetBitmap(interp, (Tk_Window) winPtr, string); - if (!pixmap) { + if (pixmap == None) { return TCL_ERROR; } wmPtr->hints.icon_pixmap = pixmap; @@ -4217,13 +4217,13 @@ WmIconmaskCmd( } argv3 = Tcl_GetString(objv[3]); if (*argv3 == '\0') { - if (wmPtr->hints.icon_mask) { + if (wmPtr->hints.icon_mask != None) { Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_mask); } wmPtr->hints.flags &= ~IconMaskHint; } else { pixmap = Tk_GetBitmap(interp, tkwin, argv3); - if (!pixmap) { + if (pixmap == None) { return TCL_ERROR; } wmPtr->hints.icon_mask = pixmap; @@ -6388,7 +6388,7 @@ Tk_GetRootCoords( * If the window is mapped, let Windows figure out the translation. */ - if (winPtr->window) { + if (winPtr->window != None) { HWND hwnd = Tk_GetHWND(winPtr->window); POINT point; @@ -6816,7 +6816,7 @@ TkWmRestackToplevel( * (mapping it may give it a reparent window). */ - if (!winPtr->window) { + if (winPtr->window == None) { Tk_MakeWindowExist((Tk_Window) winPtr); } if (winPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) { @@ -6826,7 +6826,7 @@ TkWmRestackToplevel( ? winPtr->wmInfoPtr->wrapper : Tk_GetHWND(winPtr->window); if (otherPtr != NULL) { - if (!otherPtr->window) { + if (otherPtr->window == None) { Tk_MakeWindowExist((Tk_Window) otherPtr); } if (otherPtr->wmInfoPtr->flags & WM_NEVER_MAPPED) { @@ -6877,7 +6877,7 @@ TkWmAddToColormapWindows( TkWindow **oldPtr, **newPtr; int count, i; - if (!winPtr->window) { + if (winPtr->window == None) { return; } @@ -7312,7 +7312,7 @@ GenerateConfigureNotify( event.xconfigure.y = winPtr->changes.y; event.xconfigure.width = winPtr->changes.width; event.xconfigure.height = winPtr->changes.height; - event.xconfigure.above = 0; + event.xconfigure.above = None; Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); } @@ -8586,7 +8586,7 @@ TkpWinToplevelDetachWindow( SendMessage(wmPtr->wrapper, TK_DETACHWINDOW, 0, 0); winPtr->flags &= ~TK_EMBEDDED; winPtr->privatePtr = NULL; - wmPtr->wrapper = 0; + wmPtr->wrapper = NULL; if (state >= 0 && state <= 3) { wmPtr->hints.initial_state = state; } diff --git a/win/tkWinX.c b/win/tkWinX.c index ce639a0..2f9565d 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -573,10 +573,10 @@ TkWinDisplayChanged( screen->root_visual->bits_per_rgb = screen->root_depth; ReleaseDC(NULL, dc); - if (screen->cmap) { + if (screen->cmap != None) { XFreeColormap(display, screen->cmap); } - screen->cmap = XCreateColormap(display, 0, screen->root_visual, + screen->cmap = XCreateColormap(display, None, screen->root_visual, AllocNone); } @@ -636,7 +636,7 @@ TkpOpenDisplay( twdPtr = (TkWinDrawable*) ckalloc(sizeof(TkWinDrawable)); if (twdPtr == NULL) { - return 0; + return NULL; } twdPtr->type = TWD_WINDOW; twdPtr->window.winPtr = NULL; @@ -649,7 +649,7 @@ TkpOpenDisplay( screen->white_pixel = RGB(255, 255, 255); screen->black_pixel = RGB(0, 0, 0); - screen->cmap = 0; + screen->cmap = None; display->screens = screen; display->nscreens = 1; @@ -704,10 +704,10 @@ TkpCloseDisplay( if (display->screens->root_visual != NULL) { ckfree((char *) display->screens->root_visual); } - if (display->screens->root) { + if (display->screens->root != None) { ckfree((char *) display->screens->root); } - if (display->screens->cmap) { + if (display->screens->cmap != None) { XFreeColormap(display, display->screens->cmap); } ckfree((char *) display->screens); @@ -1018,7 +1018,7 @@ GenerateXEvent( Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); winPtr = (TkWindow *)Tk_HWNDToWindow(hwnd); - if (!winPtr || !winPtr->window) { + if (!winPtr || winPtr->window == None) { return; } @@ -1146,7 +1146,7 @@ GenerateXEvent( */ event.xbutton.root = RootWindow(winPtr->display, winPtr->screenNum); - event.xbutton.subwindow = 0; + event.xbutton.subwindow = None; event.xbutton.x = clientPoint.x; event.xbutton.y = clientPoint.y; event.xbutton.x_root = root.point.x; @@ -1654,7 +1654,7 @@ HandleIMEComposition( event.xkey.display = winPtr->display; event.xkey.window = winPtr->window; event.xkey.root = RootWindow(winPtr->display, winPtr->screenNum); - event.xkey.subwindow = 0; + event.xkey.subwindow = None; event.xkey.state = TkWinGetModifierState(); event.xkey.time = TkpGetMS(); event.xkey.same_screen = True; diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 65b7240..6359891 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -453,7 +453,7 @@ InitElementData(ElementData *elementData, Tk_Window tkwin, Drawable d) { Window win = Tk_WindowId(tkwin); - if (win) { + if (win != None) { elementData->hwnd = Tk_GetHWND(win); } else { elementData->hwnd = elementData->procs->stubWindow; diff --git a/xlib/X11/X.h b/xlib/X11/X.h index 316683b..b43967e 100644 --- a/xlib/X11/X.h +++ b/xlib/X11/X.h @@ -73,7 +73,9 @@ typedef unsigned long KeyCode; /* In order to use IME, the Macintosh needs * RESERVED RESOURCE AND CONSTANT DEFINITIONS *****************************************************************/ -/* define None 0L See bug [9e31fd9449] and below */ +#ifndef _WIN32 +# define None 0L /* See bug [9e31fd9449] and below */ +#endif #define ParentRelative 1L /* background pixmap in CreateWindow and ChangeWindowAttributes */ @@ -179,7 +181,9 @@ are reserved in the protocol for errors and replies. */ #define ShiftMask (1<<0) #define LockMask (1<<1) -/* define ControlMask (1<<2) See bug [9e31fd9449] and below */ +#ifndef _WIN32 +# define ControlMask (1<<2) /* See bug [9e31fd9449] and below */ +#endif #define Mod1Mask (1<<3) #define Mod2Mask (1<<4) #define Mod3Mask (1<<5) @@ -187,7 +191,9 @@ are reserved in the protocol for errors and replies. */ #define Mod5Mask (1<<7) /* See bug [9e31fd9449], this way prevents conflicts with Win32 headers */ +#ifdef _WIN32 enum _Bug9e31fd9449 { None = 0, ControlMask = (1<<2) }; +#endif /* modifier names. Used to build a SetModifierMapping request or to read a GetModifierMapping request. These correspond to the @@ -297,7 +303,7 @@ enum _Bug9e31fd9449 { None = 0, ControlMask = (1<<2) }; /* Used in SetInputFocus, GetInputFocus */ -#define RevertToNone 0 +#define RevertToNone (int)None #define RevertToPointerRoot (int)PointerRoot #define RevertToParent 2 @@ -50,7 +50,7 @@ static TkpClipMask *AllocClipMask(GC gc) { TkpClipMask *clip_mask = (TkpClipMask*) gc->clip_mask; - if (!clip_mask) { + if (clip_mask == None) { clip_mask = (TkpClipMask*) ckalloc(sizeof(TkpClipMask)); gc->clip_mask = (Pixmap) clip_mask; #ifdef MAC_OSX_TK @@ -78,14 +78,14 @@ static TkpClipMask *AllocClipMask(GC gc) { */ static void FreeClipMask(GC gc) { - if (gc->clip_mask) { + if (gc->clip_mask != None) { #ifdef MAC_OSX_TK if (((TkpClipMask*) gc->clip_mask)->type == TKP_CLIP_REGION) { TkpReleaseRegion(((TkpClipMask*) gc->clip_mask)->value.region); } #endif ckfree((char*) gc->clip_mask); - gc->clip_mask = 0; + gc->clip_mask = None; } } @@ -126,7 +126,7 @@ XCreateGC( gp = (XGCValues *) ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE + gcCacheSize); if (!gp) { - return 0; + return NULL; } #define InitField(name,maskbit,default) \ @@ -145,11 +145,11 @@ XCreateGC( InitField(fill_style, GCFillStyle, FillSolid); InitField(fill_rule, GCFillRule, WindingRule); InitField(arc_mode, GCArcMode, ArcPieSlice); - InitField(tile, GCTile, 0); - InitField(stipple, GCStipple, 0); + InitField(tile, GCTile, None); + InitField(stipple, GCStipple, None); InitField(ts_x_origin, GCTileStipXOrigin, 0); InitField(ts_y_origin, GCTileStipYOrigin, 0); - InitField(font, GCFont, 0); + InitField(font, GCFont, None); InitField(subwindow_mode, GCSubwindowMode, ClipByChildren); InitField(graphics_exposures, GCGraphicsExposures, True); InitField(clip_x_origin, GCClipXOrigin, 0); @@ -158,7 +158,7 @@ XCreateGC( InitField(dashes, GCDashList, 4); (&(gp->dashes))[1] = 0; - gp->clip_mask = 0; + gp->clip_mask = None; if (mask & GCClipMask) { TkpClipMask *clip_mask = AllocClipMask(gp); @@ -269,7 +269,7 @@ int XFreeGC( Display *d, GC gc) { - if (gc) { + if (gc != None) { FreeClipMask(gc); TkpFreeGCCache(gc); ckfree((char *) gc); @@ -465,7 +465,7 @@ TkSetRegion( GC gc, TkRegion r) { - if (!r) { + if (r == None) { Tcl_Panic("must not pass None to TkSetRegion for compatibility with X11; use XSetClipMask instead"); } else { TkpClipMask *clip_mask = AllocClipMask(gc); @@ -484,7 +484,7 @@ XSetClipMask( GC gc, Pixmap pixmap) { - if (!pixmap) { + if (pixmap == None) { FreeClipMask(gc); } else { TkpClipMask *clip_mask = AllocClipMask(gc); diff --git a/xlib/ximage.c b/xlib/ximage.c index f7bf1cc..aaab946 100644 --- a/xlib/ximage.c +++ b/xlib/ximage.c @@ -47,7 +47,7 @@ XCreateBitmapFromData( pix = Tk_GetPixmap(display, d, (int) width, (int) height, 1); gc = XCreateGC(display, pix, 0, NULL); if (gc == NULL) { - return 0; + return None; } ximage = XCreateImage(display, NULL, 1, XYBitmap, 0, (char*) data, width, height, 8, (width + 7) / 8); |