From 2de66fa92b783d8956a5df8852deba5fc3af6aa3 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 25 Jun 2024 17:17:36 +0000 Subject: Don't use -encoding "binary" any more in Tk. Backport some more formatting changes --- generic/tkImgBmap.c | 46 +++++++-------- generic/tkImgGIF.c | 45 +++++++-------- generic/tkImgPNG.c | 21 +++---- generic/tkImgPPM.c | 13 ++--- generic/tkImgPhoto.c | 155 ++++++++++++++++++++++++--------------------------- win/tkWinWm.c | 65 +++++++++++---------- 6 files changed, 162 insertions(+), 183 deletions(-) diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index a7fd14e..f02b560 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -77,15 +77,15 @@ static int GetByte(Tcl_Channel chan); static int ImgBmapCreate(Tcl_Interp *interp, const char *name, int objc, Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageModel model, - ClientData *clientDataPtr); -static ClientData ImgBmapGet(Tk_Window tkwin, ClientData clientData); -static void ImgBmapDisplay(ClientData clientData, + void **clientDataPtr); +static void *ImgBmapGet(Tk_Window tkwin, void *clientData); +static void ImgBmapDisplay(void *clientData, Display *display, Drawable drawable, int imageX, int imageY, int width, int height, int drawableX, int drawableY); -static void ImgBmapFree(ClientData clientData, Display *display); -static void ImgBmapDelete(ClientData clientData); -static int ImgBmapPostscript(ClientData clientData, +static void ImgBmapFree(void *clientData, Display *display); +static void ImgBmapDelete(void *clientData); +static int ImgBmapPostscript(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo, int x, int y, int width, int height, int prepass); @@ -145,9 +145,9 @@ typedef struct ParseInfo { * Prototypes for procedures used only locally in this file: */ -static int ImgBmapCmd(ClientData clientData, Tcl_Interp *interp, +static int ImgBmapCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static void ImgBmapCmdDeletedProc(ClientData clientData); +static void ImgBmapCmdDeletedProc(void *clientData); static void ImgBmapConfigureInstance(BitmapInstance *instancePtr); static int ImgBmapConfigureModel(BitmapModel *modelPtr, int objc, Tcl_Obj *const objv[], int flags); @@ -180,7 +180,7 @@ ImgBmapCreate( TCL_UNUSED(const Tk_ImageType *),/* Pointer to our type record (not used). */ Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ - ClientData *clientDataPtr) /* Store manager's token for image here; it + void **clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { BitmapModel *modelPtr = (BitmapModel *)ckalloc(sizeof(BitmapModel)); @@ -513,10 +513,6 @@ TkGetBitmapData( != TCL_OK) { return NULL; } - if (Tcl_SetChannelOption(interp, pi.chan, "-encoding", "binary") - != TCL_OK) { - return NULL; - } } else { pi.chan = NULL; } @@ -744,7 +740,7 @@ NextBitmapWord( static int ImgBmapCmd( - ClientData clientData, /* Information about the image model. */ + void *clientData, /* Information about the image model. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -768,14 +764,14 @@ ImgBmapCmd( return TCL_ERROR; } return Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs, - (char *) modelPtr, Tcl_GetString(objv[2]), 0); + (char *)modelPtr, Tcl_GetString(objv[2]), 0); case 1: /* configure */ if (objc == 2) { return Tk_ConfigureInfo(interp, Tk_MainWindow(interp), - configSpecs, (char *) modelPtr, NULL, 0); + configSpecs, (char *)modelPtr, NULL, 0); } else if (objc == 3) { return Tk_ConfigureInfo(interp, Tk_MainWindow(interp), - configSpecs, (char *) modelPtr, + configSpecs, (char *)modelPtr, Tcl_GetString(objv[2]), 0); } else { return ImgBmapConfigureModel(modelPtr, objc-2, objv+2, @@ -805,11 +801,11 @@ ImgBmapCmd( *---------------------------------------------------------------------- */ -static ClientData +static void * ImgBmapGet( Tk_Window tkwin, /* Window in which the instance will be * used. */ - ClientData modelData) /* Pointer to our model structure for the + void *modelData) /* Pointer to our model structure for the * image. */ { BitmapModel *modelPtr = (BitmapModel *)modelData; @@ -876,7 +872,7 @@ ImgBmapGet( static void ImgBmapDisplay( - ClientData clientData, /* Pointer to BitmapInstance structure for + void *clientData, /* Pointer to BitmapInstance structure for * instance to be displayed. */ Display *display, /* Display on which to draw image. */ Drawable drawable, /* Pixmap or window in which to draw image. */ @@ -937,7 +933,7 @@ ImgBmapDisplay( static void ImgBmapFree( - ClientData clientData, /* Pointer to BitmapInstance structure for + void *clientData, /* Pointer to BitmapInstance structure for * instance to be displayed. */ Display *display) /* Display containing window that used image. */ { @@ -999,7 +995,7 @@ ImgBmapFree( static void ImgBmapDelete( - ClientData modelData) /* Pointer to BitmapModel structure for + void *modelData) /* Pointer to BitmapModel structure for * image. Must not have any more instances. */ { BitmapModel *modelPtr = (BitmapModel *)modelData; @@ -1017,7 +1013,7 @@ ImgBmapDelete( if (modelPtr->maskData != NULL) { ckfree(modelPtr->maskData); } - Tk_FreeOptions(configSpecs, (char *) modelPtr, NULL, 0); + Tk_FreeOptions(configSpecs, (char *)modelPtr, NULL, 0); ckfree(modelPtr); } @@ -1040,7 +1036,7 @@ ImgBmapDelete( static void ImgBmapCmdDeletedProc( - ClientData clientData) /* Pointer to BitmapModel structure for + void *clientData) /* Pointer to BitmapModel structure for * image. */ { BitmapModel *modelPtr = (BitmapModel *)clientData; @@ -1181,7 +1177,7 @@ ImgBmapPsImagemask( static int ImgBmapPostscript( - ClientData clientData, + void *clientData, Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psinfo, diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index 549a997..5cb43bb 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -111,7 +111,7 @@ typedef struct { * serializing in the GIF format. */ -typedef int (WriteBytesFunc) (ClientData clientData, const char *bytes, +typedef int (WriteBytesFunc) (void *clientData, const char *bytes, int byteCount); /* @@ -135,7 +135,7 @@ static int FileWriteGIF(Tcl_Interp *interp, const char *filename, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr); static int StringWriteGIF(Tcl_Interp *interp, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr); -static int CommonWriteGIF(Tcl_Interp *interp, ClientData clientData, +static int CommonWriteGIF(Tcl_Interp *interp, void *clientData, WriteBytesFunc *writeProc, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr); @@ -280,7 +280,7 @@ typedef struct { */ int initialBits; - ClientData destination; + void *destination; WriteBytesFunc *writeProc; int clearCode; @@ -308,7 +308,7 @@ typedef struct { static int ColorNumber(GifWriterState *statePtr, int red, int green, int blue); -static void Compress(int initBits, ClientData handle, +static void Compress(int initBits, void *handle, WriteBytesFunc *writeProc, ifunptr readValue, GifWriterState *statePtr); static int IsNewColor(GifWriterState *statePtr, @@ -351,7 +351,7 @@ FileMatchGIF( int *widthPtr, int *heightPtr, /* The dimensions of the image are returned * here if the file is a valid raw GIF file. */ - Tcl_Interp *interp) /* not used */ + TCL_UNUSED(Tcl_Interp *), /* not used */ { GIFImageConfig gifConf; @@ -603,7 +603,7 @@ FileReadGIF( goto error; } nBytes = fileWidth * fileHeight * 3; - trashBuffer = ckalloc(nBytes); + trashBuffer = (unsigned char *)ckalloc(nBytes); if (trashBuffer) { memset(trashBuffer, 0, nBytes); } @@ -706,7 +706,7 @@ FileReadGIF( goto error; } nBytes = block.pitch * imageHeight; - pixelPtr = ckalloc(nBytes); + pixelPtr = (unsigned char*)ckalloc(nBytes); if (pixelPtr) { memset(pixelPtr, 0, nBytes); } @@ -1050,7 +1050,8 @@ ReadImage( Tcl_Channel chan, int len, int rows, unsigned char cmap[MAXCOLORMAPSIZE][4], - int srcX, int srcY, + TCL_UNUSED(int), + TCL_UNUSED(int), int interlace, int transparent) { @@ -1446,8 +1447,8 @@ Mread( size_t numChunks, /* number of chunks */ MFile *handle) /* mmdecode "file" handle */ { - int i, c; - int count = chunkSize * numChunks; + int c; + int i, count = chunkSize * numChunks; for (i=0; ifromData == INLINE_DATA_BINARY) { MFile *handle = (MFile *) chan; - if (handle->length <= 0 || (size_t) handle->length < hunk*count) { + if ((handle->length <= 0) || ((size_t)handle->length < hunk*count)) { return -1; } - memcpy(dst, handle->data, (size_t) (hunk * count)); + memcpy(dst, handle->data, hunk * count); handle->data += hunk * count; handle->length -= hunk * count; - return (int)(hunk * count); + return hunk * count; } /* * Otherwise we've got a real file to read. */ - return Tcl_Read(chan, (char *) dst, (int) (hunk * count)); + return Tcl_Read(chan, (char *) dst, hunk * count); } /* @@ -1660,8 +1661,8 @@ FileWriteGIF( if (!chan) { return TCL_ERROR; } - if (Tcl_SetChannelOption(interp, chan, "-translation", - "binary") != TCL_OK) { + if (Tcl_SetChannelOption(interp, chan, "-translation", "binary") + != TCL_OK) { Tcl_Close(NULL, chan); return TCL_ERROR; } @@ -1696,22 +1697,22 @@ StringWriteGIF( static int WriteToChannel( - ClientData clientData, + void *clientData, const char *bytes, int byteCount) { - Tcl_Channel handle = clientData; + Tcl_Channel handle = (Tcl_Channel)clientData; return Tcl_Write(handle, bytes, byteCount); } static int WriteToByteArray( - ClientData clientData, + void *clientData, const char *bytes, int byteCount) { - Tcl_Obj *objPtr = clientData; + Tcl_Obj *objPtr = (Tcl_Obj *)clientData; Tcl_Obj *tmpObj = Tcl_NewByteArrayObj((unsigned char *) bytes, byteCount); Tcl_IncrRefCount(tmpObj); @@ -1723,7 +1724,7 @@ WriteToByteArray( static int CommonWriteGIF( Tcl_Interp *interp, - ClientData handle, + void *handle, WriteBytesFunc *writeProc, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr) @@ -1979,7 +1980,7 @@ ReadValue( static void Compress( int initialBits, - ClientData handle, + void *handle, WriteBytesFunc *writeProc, ifunptr readValue, GifWriterState *statePtr) diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c index fccb465..99ba37a 100644 --- a/generic/tkImgPNG.c +++ b/generic/tkImgPNG.c @@ -2387,7 +2387,8 @@ DecodePNG( * image being read. */ { unsigned long chunkType; - int result, chunkSz; + int result; + int chunkSz; unsigned long crc; /* @@ -2525,11 +2526,11 @@ DecodePNG( pngPtr->thisLineObj = Tcl_NewObj(); Tcl_IncrRefCount(pngPtr->thisLineObj); - pngPtr->block.pixelPtr = attemptckalloc(pngPtr->blockLen); + pngPtr->block.pixelPtr = (unsigned char *)attemptckalloc(pngPtr->blockLen); if (!pngPtr->block.pixelPtr) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "memory allocation failed", -1)); - Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); + Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); return TCL_ERROR; } @@ -2852,7 +2853,7 @@ WriteData( int srcSz, unsigned long *crcPtr) { - if (!srcPtr || !srcSz) { + if (!srcPtr || srcSz <= 0) { return TCL_OK; } @@ -3135,9 +3136,10 @@ WriteIDAT( PNGImage *pngPtr, Tk_PhotoImageBlock *blockPtr) { - int rowNum, flush = TCL_ZLIB_NO_FLUSH, outputSize, result; + int rowNum, flush = TCL_ZLIB_NO_FLUSH, result; Tcl_Obj *outputObj; unsigned char *outputBytes; + int outputSize; /* * Filter and compress each row one at a time. @@ -3483,13 +3485,8 @@ FileWritePNG( goto cleanup; } - /* - * Set the translation mode to binary so that CR and LF are not to the - * platform's EOL sequence. - */ - - if (Tcl_SetChannelOption(interp, chan, "-translation", - "binary") != TCL_OK) { + if (Tcl_SetChannelOption(interp, chan, "-translation", "binary") + != TCL_OK) { goto cleanup; } diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c index fe76e36..9d62a66 100644 --- a/generic/tkImgPPM.c +++ b/generic/tkImgPPM.c @@ -145,7 +145,8 @@ FileReadPPM( * image being read. */ { int fileWidth, fileHeight, maxIntensity; - int nLines, nBytes, h, type, count, bytesPerChannel = 1; + int nLines, h, type, bytesPerChannel = 1; + int nBytes, count; unsigned char *pixelPtr; Tk_PhotoImageBlock block; @@ -303,11 +304,6 @@ FileWritePPM( Tcl_Close(NULL, chan); return TCL_ERROR; } - if (Tcl_SetChannelOption(interp, chan, "-encoding", "binary") - != TCL_OK) { - Tcl_Close(NULL, chan); - return TCL_ERROR; - } snprintf(header, sizeof(header), "P6\n%d %d\n255\n", blockPtr->width, blockPtr->height); Tcl_Write(chan, header, -1); @@ -326,7 +322,7 @@ FileWritePPM( for (h = blockPtr->height; h > 0; h--) { pixelPtr = pixLinePtr; for (w = blockPtr->width; w > 0; w--) { - if ( Tcl_Write(chan,(char *)&pixelPtr[0], 1) == -1 || + if (Tcl_Write(chan,(char *)&pixelPtr[0], 1) == -1 || Tcl_Write(chan,(char *)&pixelPtr[greenOffset],1) == -1 || Tcl_Write(chan,(char *)&pixelPtr[blueOffset],1) == -1) { goto writeerror; @@ -765,7 +761,8 @@ ReadPPMStringHeader( { #define BUFFER_SIZE 1000 char buffer[BUFFER_SIZE], c; - int i, numFields, dataSize, type = 0; + int i, numFields, type = 0; + int dataSize; unsigned char *dataBuffer; dataBuffer = Tcl_GetByteArrayFromObj(dataPtr, &dataSize); diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index e619910..5d5921b 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -102,9 +102,9 @@ static const char *const optionNames[] = { static int ImgPhotoCreate(Tcl_Interp *interp, const char *name, int objc, Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageModel model, - ClientData *clientDataPtr); -static void ImgPhotoDelete(ClientData clientData); -static int ImgPhotoPostscript(ClientData clientData, + void **clientDataPtr); +static void ImgPhotoDelete(void *clientData); +static int ImgPhotoPostscript(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, int x, int y, int width, int height, int prepass); @@ -172,14 +172,14 @@ static const Tk_ConfigSpec configSpecs[] = { * Forward declarations */ -static void PhotoFormatThreadExitProc(ClientData clientData); -static int ImgPhotoCmd(ClientData clientData, Tcl_Interp *interp, +static void PhotoFormatThreadExitProc(void *clientData); +static int ImgPhotoCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int ParseSubcommandOptions( struct SubcommandOptions *optPtr, Tcl_Interp *interp, int allowedOptions, int *indexPtr, int objc, Tcl_Obj *const objv[]); -static void ImgPhotoCmdDeletedProc(ClientData clientData); +static void ImgPhotoCmdDeletedProc(void *clientData); static int ImgPhotoConfigureModel(Tcl_Interp *interp, PhotoModel *modelPtr, int objc, Tcl_Obj *const objv[], int flags); @@ -335,9 +335,9 @@ ImgPhotoCreate( Tcl_Obj *const objv[], /* Argument objects for options (doesn't * include image name or type). */ TCL_UNUSED(const Tk_ImageType *),/* Pointer to our type record (not used). */ - Tk_ImageModel model, /* Token for image, to be used by us in later + Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ - ClientData *clientDataPtr) /* Store manager's token for image here; it + void **clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { PhotoModel *modelPtr; @@ -390,7 +390,7 @@ ImgPhotoCreate( static int ImgPhotoCmd( - ClientData clientData, /* Information about photo model. */ + void *clientData, /* Information about photo model. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -405,15 +405,16 @@ ImgPhotoCmd( PHOTO_WRITE }; - PhotoModel *modelPtr = clientData; - int result, index, x, y, width, height, dataWidth, dataHeight, listObjc; + PhotoModel *modelPtr = (PhotoModel *)clientData; + int result, x, y, width, height, dataWidth, dataHeight, listObjc; + int index; struct SubcommandOptions options; Tcl_Obj **listObjv, **srcObjv; unsigned char *pixelPtr; Tk_PhotoImageBlock block; Tk_Window tkwin; Tk_PhotoImageFormat *imageFormat; - size_t length; + int length; int imageWidth, imageHeight, matched, oldformat = 0; Tcl_Channel chan; Tk_PhotoHandle srcHandle; @@ -463,7 +464,7 @@ ImgPhotoCmd( } } else { Tk_ConfigureValue(interp, Tk_MainWindow(interp), configSpecs, - (char *) modelPtr, Tcl_GetString(objv[2]), 0); + (char *)modelPtr, Tcl_GetString(objv[2]), 0); } return TCL_OK; } @@ -477,7 +478,7 @@ ImgPhotoCmd( Tcl_Obj *obj, *subobj; result = Tk_ConfigureInfo(interp, Tk_MainWindow(interp), - configSpecs, (char *) modelPtr, NULL, 0); + configSpecs, (char *)modelPtr, NULL, 0); if (result != TCL_OK) { return result; } @@ -486,14 +487,14 @@ ImgPhotoCmd( if (modelPtr->dataString) { Tcl_ListObjAppendElement(NULL, subobj, modelPtr->dataString); } else { - Tcl_AppendStringsToObj(subobj, " {}", NULL); + Tcl_AppendStringsToObj(subobj, " {}", (char *)NULL); } Tcl_ListObjAppendElement(interp, obj, subobj); subobj = Tcl_NewStringObj("-format {} {} {}", 16); if (modelPtr->format) { Tcl_ListObjAppendElement(NULL, subobj, modelPtr->format); } else { - Tcl_AppendStringsToObj(subobj, " {}", NULL); + Tcl_AppendStringsToObj(subobj, " {}", (char *)NULL); } Tcl_ListObjAppendElement(interp, obj, subobj); Tcl_ListObjAppendList(interp, obj, Tcl_GetObjResult(interp)); @@ -505,7 +506,7 @@ ImgPhotoCmd( length = objv[2]->length; if (length > 1 && !strncmp(arg, "-data", length)) { - Tcl_AppendResult(interp, "-data {} {} {}", NULL); + Tcl_AppendResult(interp, "-data {} {} {}", (char *)NULL); if (modelPtr->dataString) { /* * TODO: Modifying result is bad! @@ -514,12 +515,12 @@ ImgPhotoCmd( Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp), modelPtr->dataString); } else { - Tcl_AppendResult(interp, " {}", NULL); + Tcl_AppendResult(interp, " {}", (char *)NULL); } return TCL_OK; } else if (length > 1 && !strncmp(arg, "-format", length)) { - Tcl_AppendResult(interp, "-format {} {} {}", NULL); + Tcl_AppendResult(interp, "-format {} {} {}", (char *)NULL); if (modelPtr->format) { /* * TODO: Modifying result is bad! @@ -528,7 +529,7 @@ ImgPhotoCmd( Tcl_ListObjAppendElement(NULL, Tcl_GetObjResult(interp), modelPtr->format); } else { - Tcl_AppendResult(interp, " {}", NULL); + Tcl_AppendResult(interp, " {}", (char *)NULL); } return TCL_OK; } else { @@ -573,7 +574,7 @@ ImgPhotoCmd( "image \"%s\" doesn't exist or is not a photo image", Tcl_GetString(options.name))); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO", - Tcl_GetString(options.name), NULL); + Tcl_GetString(options.name), (char *)NULL); return TCL_ERROR; } Tk_PhotoGetImage(srcHandle, &block); @@ -583,7 +584,7 @@ ImgPhotoCmd( Tcl_SetObjResult(interp, Tcl_NewStringObj( "coordinates for -from option extend outside source image", -1)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", (char *)NULL); return TCL_ERROR; } @@ -658,7 +659,7 @@ ImgPhotoCmd( options.toY2) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); - Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); + Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); return TCL_ERROR; } } @@ -701,7 +702,7 @@ ImgPhotoCmd( || (options.fromY2 > modelPtr->height)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "coordinates for -from option extend outside image", -1)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", (char *)NULL); if (options.background) { Tk_FreeColor(options.background); } @@ -822,7 +823,7 @@ ImgPhotoCmd( "%s get: coordinates out of range", Tcl_GetString(objv[0]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "COORDINATES", - NULL); + (char *)NULL); return TCL_ERROR; } @@ -1051,7 +1052,7 @@ ImgPhotoCmd( if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't get image from a file in a safe interpreter", -1)); - Tcl_SetErrorCode(interp, "TK", "SAFE", "PHOTO_FILE", NULL); + Tcl_SetErrorCode(interp, "TK", "SAFE", "PHOTO_FILE", (char *)NULL); return TCL_ERROR; } @@ -1069,11 +1070,6 @@ ImgPhotoCmd( Tcl_Close(NULL, chan); return TCL_ERROR; } - if (Tcl_SetChannelOption(interp, chan, "-encoding", "binary") - != TCL_OK) { - Tcl_Close(NULL, chan); - return TCL_ERROR; - } if (MatchFileFormat(interp, chan, Tcl_GetString(options.name), options.format, &imageFormat, @@ -1092,7 +1088,7 @@ ImgPhotoCmd( Tcl_SetObjResult(interp, Tcl_NewStringObj( "coordinates for -from option extend outside source image", -1)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", (char *)NULL); Tcl_Close(NULL, chan); return TCL_ERROR; } @@ -1114,7 +1110,7 @@ ImgPhotoCmd( Tcl_ResetResult(interp); Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); - Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); + Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); Tcl_Close(NULL, chan); return TCL_ERROR; } @@ -1207,7 +1203,7 @@ ImgPhotoCmd( "%s transparency get: coordinates out of range", Tcl_GetString(objv[0]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "COORDINATES", - NULL); + (char *)NULL); return TCL_ERROR; } @@ -1237,7 +1233,7 @@ ImgPhotoCmd( "%s transparency set: coordinates out of range", Tcl_GetString(objv[0]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "COORDINATES", - NULL); + (char *)NULL); return TCL_ERROR; } @@ -1302,7 +1298,7 @@ ImgPhotoCmd( if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't write image to a file in a safe interpreter", -1)); - Tcl_SetErrorCode(interp, "TK", "SAFE", "PHOTO_FILE", NULL); + Tcl_SetErrorCode(interp, "TK", "SAFE", "PHOTO_FILE", (char *)NULL); return TCL_ERROR; } @@ -1332,7 +1328,7 @@ ImgPhotoCmd( || (options.fromY2 > modelPtr->height)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "coordinates for -from option extend outside image", -1)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", (char *)NULL); if (options.background) { Tk_FreeColor(options.background); } @@ -1414,7 +1410,7 @@ ImgPhotoCmd( fmtString)); } Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO_FORMAT", - fmtString, NULL); + fmtString, (char *)NULL); if (options.background) { Tk_FreeColor(options.background); } @@ -1513,9 +1509,9 @@ ParseSubcommandOptions( * TK_PHOTO_COMPOSITE_* constants. */ NULL }; - size_t length; - int index, c, bit, currentBit; - int values[4], numValues, maxValues, argIndex; + int index, length, argIndex; + int c, bit, currentBit; + int values[4], numValues, maxValues; const char *option, *expandedOption, *needed; const char *const *listPtr; Tcl_Obj *msgObj; @@ -1526,8 +1522,7 @@ ParseSubcommandOptions( * optPtr->name. */ - expandedOption = option = Tcl_GetString(objv[index]); - length = objv[index]->length; + expandedOption = option = Tcl_GetStringFromObj(objv[index], &length); if (option[0] != '-') { if (optPtr->name == NULL) { optPtr->name = objv[index]; @@ -1724,20 +1719,20 @@ ParseSubcommandOptions( oneValueRequired: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "the \"%s\" option requires a value", expandedOption)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "MISSING_VALUE", NULL); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "MISSING_VALUE", (char *)NULL); return TCL_ERROR; manyValuesRequired: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "the \"%s\" option requires one %s integer values", expandedOption, (maxValues == 2) ? "or two": "to four")); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "MISSING_VALUE", NULL); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "MISSING_VALUE", (char *)NULL); return TCL_ERROR; numberOutOfRange: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "value(s) for the %s option must be %s", expandedOption, needed)); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_VALUE", NULL); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_VALUE", (char *)NULL); return TCL_ERROR; unknownOrAmbiguousOption: @@ -1757,7 +1752,7 @@ ParseSubcommandOptions( bit <<= 1; } Tcl_SetObjResult(interp, msgObj); - Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", NULL); + Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", (char *)NULL); return TCL_ERROR; } @@ -1795,15 +1790,14 @@ ImgPhotoConfigureModel( const char *oldFileString, *oldPaletteString; Tcl_Obj *oldData, *data = NULL, *oldFormat, *format = NULL; Tcl_Obj *tempdata, *tempformat; - size_t length; - int i, result, imageWidth, imageHeight, oldformat; + int i, length; + int result, imageWidth, imageHeight, oldformat; double oldGamma; Tcl_Channel chan; Tk_PhotoImageFormat *imageFormat; for (i = 0; i < objc; i++) { - const char *arg = Tcl_GetString(objv[i]); - length = objv[i]->length; + const char *arg = Tcl_GetStringFromObj(objv[i], &length); if ((length > 1) && (arg[0] == '-')) { if ((arg[1] == 'd') && !strncmp(arg, "-data", length)) { @@ -1813,7 +1807,7 @@ ImgPhotoConfigureModel( Tcl_SetObjResult(interp, Tcl_NewStringObj( "value for \"-data\" missing", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "MISSING_VALUE", NULL); + "MISSING_VALUE", (char *)NULL); return TCL_ERROR; } } else if ((arg[1] == 'f') && @@ -1824,7 +1818,7 @@ ImgPhotoConfigureModel( Tcl_SetObjResult(interp, Tcl_NewStringObj( "value for \"-format\" missing", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "MISSING_VALUE", NULL); + "MISSING_VALUE", (char *)NULL); return TCL_ERROR; } } @@ -1915,7 +1909,7 @@ ImgPhotoConfigureModel( modelPtr->height) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); - Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); + Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); goto errorExit; } @@ -1936,7 +1930,7 @@ ImgPhotoConfigureModel( Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't get image from a file in a safe interpreter", -1)); - Tcl_SetErrorCode(interp, "TK", "SAFE", "PHOTO_FILE", NULL); + Tcl_SetErrorCode(interp, "TK", "SAFE", "PHOTO_FILE", (char *)NULL); goto errorExit; } @@ -1945,12 +1939,8 @@ ImgPhotoConfigureModel( goto errorExit; } - /* - * -translation binary also sets -encoding binary - */ - - if ((Tcl_SetChannelOption(interp, chan, - "-translation", "binary") != TCL_OK) || + if ((Tcl_SetChannelOption(interp, chan, "-translation", "binary") + != TCL_OK) || (MatchFileFormat(interp, chan, modelPtr->fileString, modelPtr->format, &imageFormat, &imageWidth, &imageHeight, &oldformat) != TCL_OK)) { @@ -1962,7 +1952,7 @@ ImgPhotoConfigureModel( Tcl_Close(NULL, chan); Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); - Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); + Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); goto errorExit; } tempformat = modelPtr->format; @@ -1993,7 +1983,7 @@ ImgPhotoConfigureModel( if (ImgPhotoSetSize(modelPtr, imageWidth, imageHeight) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); - Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); + Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); goto errorExit; } tempformat = modelPtr->format; @@ -2133,7 +2123,7 @@ ToggleComplexAlphaIfNeeded( static void ImgPhotoDelete( - ClientData modelData) /* Pointer to PhotoModel structure for image. + void *modelData) /* Pointer to PhotoModel structure for image. * Must not have any more instances. */ { PhotoModel *modelPtr = (PhotoModel *)modelData; @@ -2185,7 +2175,7 @@ ImgPhotoDelete( static void ImgPhotoCmdDeletedProc( - ClientData clientData) /* Pointer to PhotoModel structure for + void *clientData) /* Pointer to PhotoModel structure for * image. */ { PhotoModel *modelPtr = (PhotoModel *)clientData; @@ -2422,7 +2412,8 @@ MatchFileFormat( * here. */ int *oldformat) /* Returns 1 if the old image API is used. */ { - int matched = 0, useoldformat = 0; + int matched = 0; + int useoldformat = 0; Tk_PhotoImageFormat *formatPtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); @@ -2450,7 +2441,7 @@ MatchFileFormat( "-file option isn't supported for %s images", formatString)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "NOT_FILE_FORMAT", NULL); + "NOT_FILE_FORMAT", (char *)NULL); return TCL_ERROR; } } @@ -2484,7 +2475,7 @@ MatchFileFormat( "-file option isn't supported for %s images", formatString)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "NOT_FILE_FORMAT", NULL); + "NOT_FILE_FORMAT", (char *)NULL); return TCL_ERROR; } } @@ -2510,13 +2501,13 @@ MatchFileFormat( "image file format \"%s\" is not supported", formatString)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO_FORMAT", - formatString, NULL); + formatString, (char *)NULL); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "couldn't recognize data in image file \"%s\"", fileName)); Tcl_SetErrorCode(interp, "TK", "PHOTO", "IMAGE", - "UNRECOGNIZED_DATA", NULL); + "UNRECOGNIZED_DATA", (char *)NULL); } return TCL_ERROR; } @@ -2590,7 +2581,7 @@ MatchStringFormat( "-data option isn't supported for %s images", formatString)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "NOT_DATA_FORMAT", NULL); + "NOT_DATA_FORMAT", (char *)NULL); return TCL_ERROR; } } @@ -2617,7 +2608,7 @@ MatchStringFormat( "-data option isn't supported for %s images", formatString)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "NOT_DATA_FORMAT", NULL); + "NOT_DATA_FORMAT", (char *)NULL); return TCL_ERROR; } } @@ -2636,12 +2627,12 @@ MatchStringFormat( Tcl_SetObjResult(interp, Tcl_ObjPrintf( "image format \"%s\" is not supported", formatString)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO_FORMAT", - formatString, NULL); + formatString, (char *)NULL); } else { Tcl_SetObjResult(interp, Tcl_NewStringObj( "couldn't recognize image data", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", - "UNRECOGNIZED_DATA", NULL); + "UNRECOGNIZED_DATA", (char *)NULL); } return TCL_ERROR; } @@ -2678,7 +2669,7 @@ Tk_FindPhoto( const char *imageName) /* Name of the desired photo image. */ { const Tk_ImageType *typePtr; - ClientData clientData = + void *clientData = Tk_GetImageMasterData(interp, imageName, &typePtr); if ((typePtr == NULL) || (typePtr->name != tkPhotoImageType.name)) { @@ -2789,7 +2780,7 @@ Tk_PhotoPutBlock( if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); - Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); + Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); } return TCL_ERROR; } @@ -2806,7 +2797,7 @@ Tk_PhotoPutBlock( if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); - Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); + Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); } goto errorExit; } @@ -3235,7 +3226,7 @@ Tk_PhotoPutZoomedBlock( if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); - Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); + Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); } return TCL_ERROR; } @@ -3251,7 +3242,7 @@ Tk_PhotoPutZoomedBlock( if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); - Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); + Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); } goto errorExit; } @@ -3656,7 +3647,7 @@ Tk_PhotoExpand( if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); - Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); + Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); } return TCL_ERROR; } @@ -3731,7 +3722,7 @@ Tk_PhotoSetSize( if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); - Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); + Tcl_SetErrorCode(interp, "TK", "MALLOC", (char *)NULL); } return TCL_ERROR; } @@ -4074,7 +4065,7 @@ Tk_PhotoGetImage( static int ImgPhotoPostscript( - ClientData clientData, /* Handle for the photo image. */ + void *clientData, /* Handle for the photo image. */ Tcl_Interp *interp, /* Interpreter. */ TCL_UNUSED(Tk_Window), /* (unused) */ Tk_PostscriptInfo psInfo, /* Postscript info. */ diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 90503a6..60554c4 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -423,14 +423,14 @@ static void TkWmStackorderToplevelWrapperMap(TkWindow *winPtr, Display *display, Tcl_HashTable *table); static LRESULT CALLBACK TopLevelProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); -static void TopLevelEventProc(ClientData clientData, +static void TopLevelEventProc(void *clientData, XEvent *eventPtr); -static void TopLevelReqProc(ClientData dummy, Tk_Window tkwin); -static void UpdateGeometryInfo(ClientData clientData); +static void TopLevelReqProc(void *dummy, Tk_Window tkwin); +static void UpdateGeometryInfo(void *clientData); static void UpdateWrapper(TkWindow *winPtr); static LRESULT CALLBACK WmProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); -static void WmWaitVisibilityOrMapProc(ClientData clientData, +static void WmWaitVisibilityOrMapProc(void *clientData, XEvent *eventPtr); static BlockOfIconImagesPtr ReadIconOrCursorFromFile(Tcl_Interp *interp, Tcl_Obj* fileName, BOOL isIcon); @@ -1583,11 +1583,6 @@ ReadIconOrCursorFromFile( Tcl_Close(NULL, channel); return NULL; } - if (Tcl_SetChannelOption(interp, channel, "-encoding", "binary") - != TCL_OK) { - Tcl_Close(NULL, channel); - return NULL; - } /* * Allocate memory for the resource structure @@ -1671,7 +1666,7 @@ ReadIconOrCursorFromFile( */ dwBytesRead = Tcl_Read(channel, (char *)lpIR->IconImages[i].lpBits, - (int) lpIDE[i].dwBytesInRes); + (int)lpIDE[i].dwBytesInRes); if (dwBytesRead != lpIDE[i].dwBytesInRes) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "error reading file: %s", Tcl_PosixError(interp))); @@ -2765,7 +2760,7 @@ TkWmSetClass( int Tk_WmObjCmd( - ClientData clientData, /* Main window associated with interpreter. */ + void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -3023,8 +3018,8 @@ WmAttributesCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; LONG style, exStyle, styleBit, *stylePtr = NULL; const char *string; - int i, boolean; - int length; + int boolValue; + int i, length; int config_fullscreen = 0, updatewrapper = 0; int fullscreen_attr_changed = 0, fullscreen_attr = 0; @@ -3054,19 +3049,19 @@ WmAttributesCmd( Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj("-disabled", -1)); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewBooleanObj((style & WS_DISABLED))); + Tcl_NewBooleanObj(style & WS_DISABLED)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj("-fullscreen", -1)); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewBooleanObj((wmPtr->flags & WM_FULLSCREEN))); + Tcl_NewBooleanObj(wmPtr->flags & WM_FULLSCREEN)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj("-toolwindow", -1)); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewBooleanObj((exStyle & WS_EX_TOOLWINDOW))); + Tcl_NewBooleanObj(exStyle & WS_EX_TOOLWINDOW)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj("-topmost", -1)); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewBooleanObj((exStyle & WS_EX_TOPMOST))); + Tcl_NewBooleanObj(exStyle & WS_EX_TOPMOST)); Tcl_SetObjResult(interp, objPtr); return TCL_OK; } @@ -3199,7 +3194,7 @@ WmAttributesCmd( } } else { if ((i < objc-1) - && Tcl_GetBooleanFromObj(interp, objv[i+1], &boolean) + && Tcl_GetBooleanFromObj(interp, objv[i+1], &boolValue) != TCL_OK) { return TCL_ERROR; } @@ -3209,13 +3204,13 @@ WmAttributesCmd( wmPtr->flags & WM_FULLSCREEN)); } else { fullscreen_attr_changed = 1; - fullscreen_attr = boolean; + fullscreen_attr = boolValue; } config_fullscreen = 0; } else if (objc == 4) { Tcl_SetObjResult(interp, Tcl_NewBooleanObj(*stylePtr & styleBit)); - } else if (boolean) { + } else if (boolValue) { *stylePtr |= styleBit; } else { *stylePtr &= ~styleBit; @@ -3313,7 +3308,7 @@ WmAttributesCmd( static int WmClientCmd( - TCL_UNUSED(Tk_Window), /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -3358,7 +3353,7 @@ WmClientCmd( != 0) { XSetWMClientMachine(winPtr->display, winPtr->window, &textProp); - XFree((char *) textProp.value); + XFree((char *)textProp.value); } } return TCL_OK; @@ -3391,7 +3386,8 @@ WmColormapwindowsCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow **cmapList, *winPtr2, **winPtr2Ptr = &winPtr2; - int i, windowObjc, gotToplevel; + int i, windowObjc; + int gotToplevel; Tcl_Obj **windowObjv, *resultObj; if ((objc != 3) && (objc != 4)) { @@ -3656,7 +3652,7 @@ static int WmForgetCmd( TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel or Frame to work with */ - Tcl_Interp *interp, /* Current interpreter. */ + TCL_UNUSED(Tcl_Interp *), /* Current interpreter. */ TCL_UNUSED(int), /* Number of arguments. */ TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */ { @@ -4296,7 +4292,8 @@ WmIconphotoCmd( TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */ Tk_PhotoHandle photo; Tk_PhotoImageBlock block; - int i, width, height, idx, bufferSize, startObj = 3; + int i; + int width, height, idx, bufferSize, startObj = 3; union {unsigned char *ptr; void *voidPtr;} bgraPixel; union {unsigned char *ptr; void *voidPtr;} bgraMask; BlockOfIconImagesPtr lpIR; @@ -4809,7 +4806,7 @@ WmOverrideredirectCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; - int boolean, curValue; + int boolValue, curValue; XSetWindowAttributes atts; if ((objc != 3) && (objc != 4)) { @@ -4831,19 +4828,19 @@ WmOverrideredirectCmd( Tcl_SetObjResult(interp, Tcl_NewBooleanObj(curValue)); return TCL_OK; } - if (Tcl_GetBooleanFromObj(interp, objv[3], &boolean) != TCL_OK) { + if (Tcl_GetBooleanFromObj(interp, objv[3], &boolValue) != TCL_OK) { return TCL_ERROR; } - if (curValue != boolean) { + if (curValue != boolValue) { if (winPtr->flags & TK_EMBEDDED) { - SendMessageW(wmPtr->wrapper, TK_OVERRIDEREDIRECT, boolean, 0); + SendMessageW(wmPtr->wrapper, TK_OVERRIDEREDIRECT, boolValue, 0); } else { /* * Only do this if we are really changing value, because it causes * some funky stuff to occur. */ - atts.override_redirect = (boolean) ? True : False; + atts.override_redirect = boolValue ? True : False; Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, &atts); if (!(wmPtr->flags & (WM_NEVER_MAPPED)) @@ -5695,7 +5692,7 @@ WmUpdateGeom( static void WmWaitVisibilityOrMapProc( - ClientData clientData, /* Pointer to window. */ + void *clientData, /* Pointer to window. */ XEvent *eventPtr) /* Information about event. */ { TkWindow *winPtr = (TkWindow *)clientData; @@ -5911,7 +5908,7 @@ Tk_UnsetGrid( static void TopLevelEventProc( - ClientData clientData, /* Window for which event occurred. */ + void *clientData, /* Window for which event occurred. */ XEvent *eventPtr) /* Event that just happened. */ { TkWindow *winPtr = (TkWindow *)clientData; @@ -5998,7 +5995,7 @@ TopLevelReqProc( static void UpdateGeometryInfo( - ClientData clientData) /* Pointer to the window's record. */ + void *clientData) /* Pointer to the window's record. */ { int x, y; /* Position of border on desktop. */ int width, height; /* Size of client area. */ @@ -6673,7 +6670,7 @@ TkWmStackorderToplevelEnumProc( /*fprintf(stderr, "Looking up HWND %d\n", hwnd);*/ - hPtr = Tcl_FindHashEntry(pair->table, (char *) hwnd); + hPtr = Tcl_FindHashEntry(pair->table, (char *)hwnd); if (hPtr != NULL) { childWinPtr = (TkWindow *)Tcl_GetHashValue(hPtr); -- cgit v0.12