--- src/blt.h 2002-07-14 19:33:24.000000000 -0400 +++ src/blt.h 2010-01-16 22:52:09.000000000 -0500 @@ -56,7 +56,7 @@ typedef char *Blt_Uid; -EXTERN Blt_Uid Blt_GetUid _ANSI_ARGS_((char *string)); +EXTERN Blt_Uid Blt_GetUid _ANSI_ARGS_((const char *string)); EXTERN void Blt_FreeUid _ANSI_ARGS_((Blt_Uid uid)); -EXTERN Blt_Uid Blt_FindUid _ANSI_ARGS_((char *string)); +EXTERN Blt_Uid Blt_FindUid _ANSI_ARGS_((const char *string)); #if (TCL_MAJOR_VERSION >= 8) --- src/bltInt.h 2002-08-21 16:13:12.000000000 -0400 +++ src/bltInt.h 2010-01-17 00:04:42.000000000 -0500 @@ -714,5 +714,5 @@ extern int Blt_GetXY _ANSI_ARGS_((Tcl_Interp *interp, Tk_Window tkwin, - char *string, int *x, int *y)); + const char *string, int *x, int *y)); extern Point2D Blt_GetProjection _ANSI_ARGS_((int x, int y, Point2D *p, --- src/bltBgexec.c 2002-09-18 18:30:50.000000000 -0400 +++ src/bltBgexec.c 2010-01-16 13:02:33.000000000 -0500 @@ -56,5 +56,5 @@ } Process; #else -typedef int Process; +typedef pid_t Process; #endif @@ -125,5 +125,5 @@ typedef struct { int number; - char *name; + const char *name; } SignalId; @@ -646,5 +646,5 @@ sinkPtr->echo = FALSE; sinkPtr->fd = -1; - sinkPtr->file = (Tcl_File)NULL; + sinkPtr->file = 0; sinkPtr->byteArr = sinkPtr->staticSpace; sinkPtr->size = DEF_BUFFER_SIZE; @@ -704,5 +704,5 @@ } sinkPtr->fd = -1; - sinkPtr->file = (Tcl_File)NULL; + sinkPtr->file = 0; #if (TCL_MAJOR_VERSION >= 8) if (sinkPtr->objv != NULL) { @@ -856,5 +856,5 @@ Tcl_DeleteFileHandler(sinkPtr->fd); #endif - sinkPtr->file = (Tcl_File)NULL; + sinkPtr->file = 0; sinkPtr->fd = -1; @@ -1073,5 +1073,5 @@ timeout = (flags & WNOHANG) ? 0 : INFINITE; status = WaitForSingleObject(child.hProcess, timeout); - + #if WINDEBUG PurifyPrintf("WAITPID: wait status is %d\n", status); @@ -1310,5 +1310,5 @@ (sinkPtr->flags & SINK_NOTIFY)) { unsigned char *data; - int length; + int length = 0; if (sinkPtr->flags & SINK_BUFFERED) { @@ -1472,5 +1472,5 @@ Tcl_DetachPids(1, &bgPtr->procArr[i]); #else - Tcl_DetachPids(1, (Tcl_Pid *)bgPtr->procArr[i]); + Tcl_DetachPids(1, (Tcl_Pid *)(intptr_t)bgPtr->procArr[i]); #endif /* TCL_MAJOR_VERSION == 7 */ #endif /* WIN32 */ --- src/bltHash.h.in 2002-07-13 20:08:13.000000000 -0400 +++ src/bltHash.h.in 2010-01-16 19:38:20.000000000 -0500 @@ -89,5 +89,5 @@ */ #define BLT_STRING_KEYS 0 -#define BLT_ONE_WORD_KEYS ((size_t)-1) +#define BLT_ONE_WORD_KEYS ((unsigned int)-1) /* --- src/bltTree.c 2002-09-29 01:44:12.000000000 -0400 +++ src/bltTree.c 2010-01-16 19:42:48.000000000 -0500 @@ -404,5 +404,5 @@ UnlinkNode(nodePtr); treeObjPtr->nNodes--; - hPtr = Blt_FindHashEntry(&treeObjPtr->nodeTable, (char *)nodePtr->inode); + hPtr = Blt_FindHashEntry(&treeObjPtr->nodeTable, (char *)(uintptr_t)nodePtr->inode); assert(hPtr); Blt_DeleteHashEntry(&treeObjPtr->nodeTable, hPtr); @@ -837,5 +837,5 @@ do { inode = treeObjPtr->nextInode++; - hPtr = Blt_CreateHashEntry(&treeObjPtr->nodeTable,(char *)inode, + hPtr = Blt_CreateHashEntry(&treeObjPtr->nodeTable,(char *)(uintptr_t)inode, &isNew); } while (!isNew); @@ -892,5 +892,5 @@ treeObjPtr = parentPtr->treeObject; - hPtr = Blt_CreateHashEntry(&treeObjPtr->nodeTable,(char *)inode, &isNew); + hPtr = Blt_CreateHashEntry(&treeObjPtr->nodeTable,(char *)(uintptr_t)inode, &isNew); if (!isNew) { return NULL; @@ -998,5 +998,5 @@ Blt_HashEntry *hPtr; - hPtr = Blt_FindHashEntry(&treeObjPtr->nodeTable, (char *)inode); + hPtr = Blt_FindHashEntry(&treeObjPtr->nodeTable, (char *)(uintptr_t)inode); if (hPtr != NULL) { return (Blt_TreeNode)Blt_GetHashValue(hPtr); --- src/bltTreeCmd.c 2002-09-27 18:23:01.000000000 -0400 +++ src/bltTreeCmd.c 2010-01-16 22:43:52.000000000 -0500 @@ -951,5 +951,5 @@ Blt_Tree tree = cmdPtr->tree; char c; - Blt_TreeNode node; + Blt_TreeNode node = NULL; char *string; char *p; @@ -1284,6 +1284,6 @@ node = dataPtr->root; /* Create a mapping between the old id and the new node */ - hPtr = Blt_CreateHashEntry(&dataPtr->idTable, (char *)nodeId, - &isNew); + hPtr = Blt_CreateHashEntry(&dataPtr->idTable, + (char *)(uintptr_t)nodeId, &isNew); Blt_SetHashValue(hPtr, node); Blt_TreeRelabelNode(cmdPtr->tree, node, names[0]); @@ -1294,5 +1294,5 @@ * existing node. */ - hPtr = Blt_FindHashEntry(&dataPtr->idTable, (char *)parentId); + hPtr = Blt_FindHashEntry(&dataPtr->idTable, (char *)(uintptr_t)parentId); if (hPtr != NULL) { parent = Blt_GetHashValue(hPtr); @@ -1331,5 +1331,5 @@ node = Blt_TreeFindChild(parent, names[nNames - 1]); /* Create a mapping between the old id and the new node */ - hPtr = Blt_CreateHashEntry(&dataPtr->idTable, (char *)nodeId, + hPtr = Blt_CreateHashEntry(&dataPtr->idTable, (char *)(uintptr_t)nodeId, &isNew); Blt_SetHashValue(hPtr, node); @@ -1341,5 +1341,5 @@ names[nNames - 1], -1); /* Create a mapping between the old id and the new node */ - hPtr = Blt_CreateHashEntry(&dataPtr->idTable, (char *)nodeId, + hPtr = Blt_CreateHashEntry(&dataPtr->idTable, (char *)(uintptr_t)nodeId, &isNew); Blt_SetHashValue(hPtr, node); @@ -1668,5 +1668,5 @@ node = Blt_ListNextNode(node)) { - type = (int)Blt_ListGetValue(node); + type = (intptr_t)Blt_ListGetValue(node); pattern = (char *)Blt_ListGetKey(node); switch (type) { @@ -2603,5 +2603,5 @@ hPtr != NULL; hPtr = Blt_NextHashEntry(&cursor)) { node = Blt_GetHashValue(hPtr); - Blt_ChainAppend(chainPtr, (ClientData)Blt_TreeNodeId(node)); + Blt_ChainAppend(chainPtr, (ClientData)(uintptr_t)Blt_TreeNodeId(node)); } /* @@ -2613,5 +2613,5 @@ linkPtr = nextPtr) { nextPtr = Blt_ChainNextLink(linkPtr); - inode = (int)Blt_ChainGetValue(linkPtr); + inode = (intptr_t)Blt_ChainGetValue(linkPtr); node = Blt_TreeGetNode(cmdPtr->tree, inode); if (node != NULL) { --- src/bltUnixPipe.c 2002-06-22 15:21:05.000000000 -0400 +++ src/bltUnixPipe.c 2010-01-16 22:45:17.000000000 -0500 @@ -478,5 +478,5 @@ * startup. */ - Tcl_WaitPid((Tcl_Pid)pid, &status, WNOHANG); + Tcl_WaitPid((Tcl_Pid)(intptr_t)pid, &status, WNOHANG); } if (errPipeIn >= 0) { --- src/bltUtil.c 2002-08-21 16:13:12.000000000 -0400 +++ src/bltUtil.c 2010-01-16 22:53:55.000000000 -0500 @@ -780,9 +780,9 @@ Blt_Uid Blt_GetUid(string) - char *string; /* String to convert. */ + const char *string; /* String to convert. */ { int isNew; Blt_HashEntry *hPtr; - int refCount; + intptr_t refCount; if (!uidInitialized) { @@ -794,5 +794,5 @@ refCount = 0; } else { - refCount = (int)Blt_GetHashValue(hPtr); + refCount = (intptr_t)Blt_GetHashValue(hPtr); } refCount++; @@ -829,7 +829,7 @@ hPtr = Blt_FindHashEntry(&uidTable, uid); if (hPtr) { - int refCount; + intptr_t refCount; - refCount = (int)Blt_GetHashValue(hPtr); + refCount = (intptr_t)Blt_GetHashValue(hPtr); refCount--; if (refCount == 0) { @@ -857,5 +857,5 @@ Blt_Uid Blt_FindUid(string) - char *string; /* String to find. */ + const char *string; /* String to find. */ { Blt_HashEntry *hPtr; --- src/bltInit.c As of 2.4.2 +++ src/bltInit.c 2010-01-16 22:59:22.000000000 -0500 @@ -404,7 +404,7 @@ Tcl_Interp *interp; /* Interpreter to add extra commands */ { - int flags; + intptr_t flags; - flags = (int)Tcl_GetAssocData(interp, BLT_THREAD_KEY, NULL); + flags = (intptr_t)Tcl_GetAssocData(interp, BLT_THREAD_KEY, NULL); if ((flags & BLT_TCL_CMDS) == 0) { register Tcl_AppInitProc **p; @@ -416,5 +416,5 @@ * the same ones that BLT was compiled against. */ - if (Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, EXACT) == NULL) { + if (Tcl_PkgRequire(interp, "Tcl", TCL_PATCH_LEVEL, EXACT) == NULL) { return TCL_ERROR; } @@ -463,5 +463,5 @@ #if (TCL_VERSION_NUMBER >= _VERSION(8,1,0)) - if (Tcl_PkgPresent(interp, "Tk", TK_VERSION, EXACT) == NULL) { + if (Tcl_PkgPresent(interp, "Tk", TK_PATCH_LEVEL, EXACT) == NULL) { return TCL_OK; } @@ -515,5 +515,5 @@ * the same ones that BLT was compiled against. */ - if (Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, EXACT) == NULL) { + if (Tcl_PkgRequire(interp, "Tcl", TCL_PATCH_LEVEL, EXACT) == NULL) { return TCL_ERROR; } @@ -553,9 +553,9 @@ #if (TCL_VERSION_NUMBER >= _VERSION(8,1,0)) - if (Tcl_PkgPresent(interp, "Tk", TK_VERSION, EXACT) == NULL) { + if (Tcl_PkgPresent(interp, "Tk", TK_PATCH_LEVEL, EXACT) == NULL) { return TCL_OK; } #else - if (Tcl_PkgRequire(interp, "Tk", TK_VERSION, EXACT) == NULL) { + if (Tcl_PkgRequire(interp, "Tk", TK_PATCH_LEVEL, EXACT) == NULL) { Tcl_ResetResult(interp); return TCL_OK; --- src/bltGrAxis.c 2010-01-16 22:59:57.000000000 -0500 +++ src/bltGrAxis.c 2010-01-16 23:05:00.000000000 -0500 @@ -670,5 +670,5 @@ int offset; /* Offset of field in structure. */ { - unsigned int mask = (unsigned int)clientData; + unsigned int mask = (uintptr_t)clientData; Axis *axisPtr = (Axis *)widgRec; Ticks **ticksPtrPtr = (Ticks **) (widgRec + offset); @@ -1421,5 +1421,5 @@ { double range; - double tickMin, tickMax; + double tickMin = 0, tickMax = 0; double majorStep, minorStep; int nMajor, nMinor; @@ -1550,7 +1550,7 @@ double min, max; { - double range, step; + double range, step = 0; double tickMin, tickMax; - double axisMin, axisMax; + double axisMin = 0, axisMax = 0; int nTicks; @@ -3648,5 +3648,5 @@ int margin; - margin = (int)argv[-1]; + margin = (intptr_t)argv[-1]; chainPtr = graphPtr->margins[margin].axes; if (argc == 0) { @@ -4191,5 +4191,5 @@ return TCL_ERROR; } - argv[2] = (char *)margin; /* Hack. Slide a reference to the margin in + argv[2] = (char *)(intptr_t)margin; /* Hack. Slide a reference to the margin in * the argument list. Needed only for UseOp. */ --- src/bltGrBar.c 2002-09-18 18:30:51.000000000 -0400 +++ src/bltGrBar.c 2010-01-16 23:06:36.000000000 -0500 @@ -2148,5 +2148,6 @@ Blt_HashSearch cursor; Bar *barPtr; - int isNew, count; + int isNew; + intptr_t count; int nStacks, nSegs; int nPoints; @@ -2198,5 +2199,5 @@ count = 1; } else { - count = (int)Blt_GetHashValue(hPtr); + count = (intptr_t)Blt_GetHashValue(hPtr); if (count == 1) { nStacks++; @@ -2220,10 +2221,10 @@ for (hPtr = Blt_FirstHashEntry(&freqTable, &cursor); hPtr != NULL; hPtr = Blt_NextHashEntry(&cursor)) { - count = (int)Blt_GetHashValue(hPtr); + count = (intptr_t)Blt_GetHashValue(hPtr); keyPtr = (FreqKey *)Blt_GetHashKey(&freqTable, hPtr); if (count > 1) { h2Ptr = Blt_CreateHashEntry(&(graphPtr->freqTable), (char *)keyPtr, &isNew); - count = (int)Blt_GetHashValue(hPtr); + count = (intptr_t)Blt_GetHashValue(hPtr); infoPtr->freq = count; infoPtr->axes = keyPtr->axes; --- src/bltColor.c 2002-08-09 21:29:33.000000000 -0400 +++ src/bltColor.c 2010-01-16 23:43:28.000000000 -0500 @@ -78,57 +78,4 @@ #define NCOLORS 256 - -static void -GetPaletteSizes(nColors, nRedsPtr, nGreensPtr, nBluesPtr) - int nColors; /* Number of colors requested. */ - unsigned int *nRedsPtr; /* (out) Number of red components. */ - unsigned int *nGreensPtr; /* (out) Number of green components. */ - unsigned int *nBluesPtr; /* (out) Number of blue components. */ -{ - unsigned int nBlues, nReds, nGreens; - - assert(nColors > 1); - nBlues = nReds = nGreens = 0; - while ((nBlues * nBlues * nBlues) <= nColors) { - nBlues++; - } - nBlues--; - while ((nReds * nReds * nBlues) <= nColors) { - nReds++; - } - nReds--; - nGreens = nColors / (nBlues * nReds); - - *nRedsPtr = nReds; - *nGreensPtr = nGreens; - *nBluesPtr = nBlues; -} - -static void -BuildColorRamp(palettePtr, nColors) - Pix32 *palettePtr; - int nColors; -{ - register unsigned int r, g, b; - unsigned int short red, green, blue; - unsigned int nReds, nGreens, nBlues; - - GetPaletteSizes(nColors, &nReds, &nGreens, &nBlues); - for (r = 0; r < nReds; r++) { - red = (r * USHRT_MAX) / (nReds - 1); - for (g = 0; g < nGreens; g++) { - green = (g * USHRT_MAX) / (nGreens - 1); - for (b = 0; b < nBlues; b++) { - blue = (b * USHRT_MAX) / (nBlues - 1); - palettePtr->Red = red; - palettePtr->Green = green; - palettePtr->Blue = blue; - palettePtr++; - } - } - } - -} - /* *---------------------------------------------------------------------- @@ -201,147 +148,4 @@ } -static void -FindClosestColor(colorPtr, mapColors, numMapColors) - ColorInfo *colorPtr; - XColor mapColors[]; - int numMapColors; -{ - double r, g, b; - register int i; - double dist, min; - XColor *lastMatch; - register XColor *mapColorPtr; - - min = DBL_MAX; /* Any color is closer. */ - lastMatch = NULL; - - /* Linear search of color */ - - mapColorPtr = mapColors; - for (i = 0; i < numMapColors; i++, mapColorPtr++) { - r = (double)mapColorPtr->red - (double)colorPtr->exact.red; - g = (double)mapColorPtr->green - (double)colorPtr->exact.green; - b = (double)mapColorPtr->blue - (double)colorPtr->exact.blue; - - dist = (r * r) + (b * b) + (g * g); - if (dist < min) { - min = dist; - lastMatch = mapColorPtr; - } - } - colorPtr->best = *lastMatch; - colorPtr->best.flags = (DoRed | DoGreen | DoBlue); - colorPtr->error = (float)sqrt(min); -} - -static int -CompareColors(a, b) - void *a, *b; -{ - ColorInfo *i1Ptr, *i2Ptr; - - i1Ptr = *(ColorInfo **) a; - i2Ptr = *(ColorInfo **) b; - if (i2Ptr->error > i1Ptr->error) { - return 1; - } else if (i2Ptr->error < i1Ptr->error) { - return -1; - } - return 0; -} - -static float -MatchColors(colorTabPtr, rgbPtr, numColors, numAvailColors, numMapColors, - mapColors) - struct ColorTableStruct *colorTabPtr; - Pix32 *rgbPtr; - int numColors; - int numAvailColors; - int numMapColors; - XColor mapColors[NCOLORS]; -{ - int numMatched; - float sum; - register int i; - register ColorInfo *colorPtr; - - /* - * For each quantized color, compute and store the error (i.e - * the distance from a color that's already been allocated). - * We'll use this information to sort the colors based upon how - * badly they match and their frequency to the color image. - */ - colorPtr = colorTabPtr->colorInfo; - for (i = 0; i < numColors; i++, colorPtr++, rgbPtr++) { - colorPtr->index = i; - colorTabPtr->sortedColors[i] = colorPtr; - colorPtr->exact.red = rgbPtr->Red; - colorPtr->exact.green = rgbPtr->Green; - colorPtr->exact.blue = rgbPtr->Blue; - colorPtr->exact.flags = (DoRed | DoGreen | DoBlue); - FindClosestColor(colorPtr, mapColors, numMapColors); - } - - /* Sort the colors, first by frequency (most to least), then by - * matching error (worst to best). - */ - qsort(colorTabPtr->sortedColors, numColors, sizeof(ColorInfo *), - (QSortCompareProc *)CompareColors); - - for (i = 0; i < numColors; i++) { - colorPtr = colorTabPtr->sortedColors[i]; - fprintf(stderr, "%d. %04x%04x%04x / %04x%04x%04x = %f (%d)\n", i, - colorPtr->exact.red, colorPtr->exact.green, colorPtr->exact.blue, - colorPtr->best.red, colorPtr->best.green, colorPtr->best.blue, - colorPtr->error, colorPtr->freq); - } - sum = 0.0; - numMatched = 0; - for (i = numAvailColors; i < numColors; i++) { - colorPtr = colorTabPtr->sortedColors[i]; - sum += colorPtr->error; - numMatched++; - } - if (numMatched > 0) { - sum /= numMatched; - } - return sum; -} - - -static int -AllocateColors(nImageColors, colorTabPtr, matchOnly) - int nImageColors; - struct ColorTableStruct *colorTabPtr; - int matchOnly; -{ - register int i; - register ColorInfo *colorPtr; - unsigned long int pixelValue; - - for (i = 0; i < nImageColors; i++) { - colorPtr = colorTabPtr->sortedColors[i]; - if (matchOnly) { - XAllocColor(colorTabPtr->display, colorTabPtr->colorMap, - &colorPtr->best); - pixelValue = colorPtr->best.pixel; - } else { - colorPtr->allocated = XAllocColor(colorTabPtr->display, - colorTabPtr->colorMap, &colorPtr->exact); - - if (colorPtr->allocated) { - pixelValue = colorPtr->exact.pixel; - } else { - XAllocColor(colorTabPtr->display, colorTabPtr->colorMap, - &colorPtr->best); - pixelValue = colorPtr->best.pixel; - } - } - colorTabPtr->pixelValues[colorPtr->index] = pixelValue; - } - colorTabPtr->nPixels = nImageColors; - return 1; -} - ColorTable Blt_CreateColorTable(tkwin) @@ -511,47 +315,7 @@ } -/* - * First attempt: - * Allocate colors all the colors in the image (up to NCOLORS). Bail out - * on the first failure or if we need more than NCOLORS. - */ -static int -GetUniqueColors(image) - Blt_ColorImage image; -{ - register int i, nColors; - register Pix32 *pixelPtr; - Pix32 color; - Blt_HashEntry *hPtr; - int isNew, nPixels; - int refCount; - Blt_HashTable colorTable; - - Blt_InitHashTable(&colorTable, BLT_ONE_WORD_KEYS); - - nPixels = Blt_ColorImageWidth(image) * Blt_ColorImageHeight(image); - nColors = 0; - pixelPtr = Blt_ColorImageBits(image); - for (i = 0; i < nPixels; i++, pixelPtr++) { - color.value = pixelPtr->value; - color.Alpha = 0xFF; /* Ignore alpha-channel values */ - hPtr = Blt_CreateHashEntry(&colorTable, (char *)color.value, &isNew); - if (isNew) { - refCount = 1; - nColors++; - } else { - refCount = (int)Blt_GetHashValue(hPtr); - refCount++; - } - Blt_SetHashValue(hPtr, (ClientData)refCount); - } - Blt_DeleteHashTable(&colorTable); - return nColors; -} - #define Blt_DefaultColormap(tkwin) \ DefaultColormap(Tk_Display(tkwin), Tk_ScreenNumber(tkwin)) - static void PrivateColormap(interp, colorTabPtr, image, tkwin) --- src/bltConfig.c 2002-09-18 18:30:51.000000000 -0400 +++ src/bltConfig.c 2010-01-16 23:45:46.000000000 -0500 @@ -276,5 +276,5 @@ int offset; /* Offset of style in record */ { - unsigned int mask = (unsigned int)clientData; /* Bit to be tested */ + unsigned int mask = (uintptr_t)clientData; /* Bit to be tested */ int *flagPtr = (int *)(widgRec + offset); int bool; @@ -312,5 +312,5 @@ Tcl_FreeProc **freeProcPtr; /* Not Used. */ { - unsigned int mask = (unsigned int)clientData; /* Bit to be tested */ + unsigned int mask = (uintptr_t)clientData; /* Bit to be tested */ unsigned int bool = *(unsigned int *)(widgRec + offset); @@ -393,5 +393,5 @@ { int *valuePtr = (int *)(widgRec + offset); - return Blt_GetPixels(interp, tkwin, string, (int)clientData, valuePtr); + return Blt_GetPixels(interp, tkwin, string, (intptr_t)clientData, valuePtr); } @@ -482,5 +482,5 @@ { int *valuePtr = (int *)(widgRec + offset); - return Blt_GetInt(interp, string, (int)clientData, valuePtr); + return Blt_GetInt(interp, string, (intptr_t)clientData, valuePtr); } --- src/bltContainer.c 2002-07-14 19:33:24.000000000 -0400 +++ src/bltContainer.c 2010-01-16 23:47:10.000000000 -0500 @@ -823,5 +823,5 @@ int offset; /* Offset to field in structure */ { - unsigned int flags = (int)clientData; + unsigned int flags = (uintptr_t)clientData; Container *cntrPtr = (Container *)widgRec; Window *winPtr = (Window *) (widgRec + offset); --- src/bltGrMisc.c 2002-07-17 05:56:00.000000000 -0400 +++ src/bltGrMisc.c 2010-01-17 00:03:38.000000000 -0500 @@ -75,5 +75,5 @@ Tcl_Interp *interp; Tk_Window tkwin; - char *string; + const char *string; int *xPtr, *yPtr; { @@ -261,5 +261,5 @@ ColorPair *pairPtr = (ColorPair *)(widgRec + offset); ColorPair sample; - int allowDefault = (int)clientData; + int allowDefault = (intptr_t)clientData; sample.fgColor = sample.bgColor = NULL; --- src/bltHierbox.c 2002-09-18 23:02:09.000000000 -0400 +++ src/bltHierbox.c 2010-01-17 00:02:41.000000000 -0500 @@ -2078,5 +2078,5 @@ do { serial = hboxPtr->nextSerial++; - hPtr = Blt_CreateHashEntry(&(hboxPtr->nodeTable), (char *)serial, + hPtr = Blt_CreateHashEntry(&(hboxPtr->nodeTable), (char *)(intptr_t)serial, &isNew); } while (!isNew); @@ -2365,5 +2365,5 @@ GetNodeByIndex(hboxPtr, string) Hierbox *hboxPtr; - char *string; + const char *string; { if (isdigit(UCHAR(string[0]))) { @@ -2373,5 +2373,5 @@ Blt_HashEntry *hPtr; - hPtr = Blt_FindHashEntry(&(hboxPtr->nodeTable), (char *)serial); + hPtr = Blt_FindHashEntry(&(hboxPtr->nodeTable), (char *)(intptr_t)serial); if (hPtr != NULL) { return (Tree *) Blt_GetHashValue(hPtr); @@ -2403,9 +2403,9 @@ Tree *nodePtr; { - static char string[200]; + static char string[31]; int serial; /* Node table keys are integers. Convert them to strings. */ - serial = (int)Blt_GetHashKey(&(hboxPtr->nodeTable), + serial = (intptr_t)Blt_GetHashKey(&(hboxPtr->nodeTable), nodePtr->entryPtr->hashPtr); sprintf(string, "%d", serial); @@ -2458,5 +2458,5 @@ GetNode(hboxPtr, string, treePtrPtr) Hierbox *hboxPtr; - char *string; + const char *string; Tree **treePtrPtr; { --- src/bltImage.c 2002-08-15 01:22:10.000000000 -0400 +++ src/bltImage.c 2010-01-17 00:13:49.000000000 -0500 @@ -2419,11 +2419,11 @@ } -static unsigned int * -CreateColorLookupTable(s, cubes, nColors) +static void +CreateColorLookupTable(s, cubes, nColors, lut) ColorImageStatistics *s; Cube *cubes; int nColors; + unsigned int lut[33][33][33]; { - unsigned int *lut; Pix32 color; unsigned int red, green, blue; @@ -2432,7 +2432,4 @@ register int i; - lut = Blt_Calloc(sizeof(unsigned int), 33 * 33 * 33); - assert(lut); - color.Alpha = (unsigned char)-1; for (cubePtr = cubes, i = 0; i < nColors; i++, cubePtr++) { @@ -2451,5 +2448,4 @@ Mark(cubePtr, color.value, lut); } - return lut; } @@ -2514,5 +2510,5 @@ ColorImageStatistics *statistics; int nColors; - unsigned int *lut; + unsigned int lut[33][33][33]; /* @@ -2528,9 +2524,8 @@ assert(nColors <= reduceColors); - lut = CreateColorLookupTable(statistics, cubes, nColors); + CreateColorLookupTable(statistics, cubes, nColors, lut); Blt_Free(statistics); Blt_Free(cubes); MapColors(src, dest, lut); - Blt_Free(lut); return TCL_OK; } --- src/bltUnixImage.c 2002-08-16 00:15:04.000000000 -0400 +++ src/bltUnixImage.c 2010-01-17 00:15:52.000000000 -0500 @@ -575,5 +575,5 @@ endPtr = destPtr + nPixels; for (/* empty */; destPtr < endPtr; destPtr++) { - hPtr = Blt_FindHashEntry(&pixelTable, (char *)destPtr->value); + hPtr = Blt_FindHashEntry(&pixelTable, (char *)(intptr_t)destPtr->value); colorPtr = (XColor *)Blt_GetHashValue(hPtr); destPtr->Red = lut[colorPtr->red >> 8]; --- src/bltTable.c 2002-10-14 19:31:24.000000000 -0400 +++ src/bltTable.c 2010-01-21 23:11:06.000000000 -0500 @@ -2035,5 +2035,5 @@ for (node = Blt_ListFirstNode(list); node != NULL; node = Blt_ListNextNode(node)) { - key = (int)Blt_ListGetKey(node); + key = (intptr_t)Blt_ListGetKey(node); if (entryPtr->row.span <= key) { break; @@ -2047,5 +2047,5 @@ * span and and link it into the list of buckets. */ - newNode = Blt_ListCreateNode(list, (char *)entryPtr->row.span); + newNode = Blt_ListCreateNode(list, (char *)(intptr_t)entryPtr->row.span); Blt_ListSetValue(newNode, (char *)Blt_ChainCreate()); Blt_ListLinkBefore(list, newNode, node); @@ -2064,5 +2064,5 @@ for (node = Blt_ListFirstNode(list); node != NULL; node = Blt_ListNextNode(node)) { - key = (int)Blt_ListGetKey(node); + key = (intptr_t)Blt_ListGetKey(node); if (entryPtr->column.span <= key) { break; @@ -2076,5 +2076,5 @@ * span and and link it into the list of buckets. */ - newNode = Blt_ListCreateNode(list, (char *)entryPtr->column.span); + newNode = Blt_ListCreateNode(list, (char *)(intptr_t)entryPtr->column.span); Blt_ListSetValue(newNode, (char *)Blt_ChainCreate()); Blt_ListLinkBefore(list, newNode, node); --- src/bltTreeView.c 2010-01-17 00:06:38.000000000 -0500 +++ src/bltTreeView.c 2010-01-21 23:12:51.000000000 -0500 @@ -1050,5 +1050,5 @@ Blt_HashEntry *hPtr; int isNew; - int refCount; + intptr_t refCount; hPtr = Blt_CreateHashEntry(&tvPtr->uidTable, string, &isNew); @@ -1056,5 +1056,5 @@ refCount = 1; } else { - refCount = (int)Blt_GetHashValue(hPtr); + refCount = (intptr_t)Blt_GetHashValue(hPtr); refCount++; } @@ -1081,9 +1081,9 @@ { Blt_HashEntry *hPtr; - int refCount; + intptr_t refCount; hPtr = Blt_FindHashEntry(&tvPtr->uidTable, uid); assert(hPtr != NULL); - refCount = (int)Blt_GetHashValue(hPtr); + refCount = (intptr_t)Blt_GetHashValue(hPtr); refCount--; if (refCount > 0) { --- src/bltTreeView.h 2002-08-15 18:20:38.000000000 -0400 +++ src/bltTreeView.h 2010-01-21 23:17:42.000000000 -0500 @@ -1005,4 +1005,6 @@ extern void Blt_TreeViewDrawRule _ANSI_ARGS_((TreeView *tvPtr, TreeViewColumn *columnPtr, Drawable drawable)); +extern int Blt_TreeViewTextbox _ANSI_ARGS_((TreeView *tvPtr, + TreeViewEntry *entryPtr, TreeViewColumn *columnPtr)); extern int Blt_TreeViewTextOp _ANSI_ARGS_((TreeView *tvPtr, Tcl_Interp *interp, int objc, Tcl_Obj *CONST *objv)); --- src/bltTreeViewStyle.c 2002-07-22 18:18:40.000000000 -0400 +++ src/bltTreeViewStyle.c 2010-01-21 23:19:14.000000000 -0500 @@ -416,5 +416,5 @@ static StyleFreeProc FreeTextBox, FreeCheckBox, FreeComboBox; static StyleMeasureProc MeasureTextBox, MeasureCheckBox, MeasureComboBox; -static StylePickProc PickCheckBox, PickComboBox; +static StylePickProc PickComboBox; /* @@ -1264,58 +1264,4 @@ *---------------------------------------------------------------------- * - * PickCheckbox -- - * - * Draws the "checkbox" given the screen coordinates and the - * value to be displayed. - * - * Results: - * None. - * - * Side Effects: - * The checkbox value is drawn. - * - *---------------------------------------------------------------------- - */ -static int -PickCheckBox(entryPtr, valuePtr, stylePtr, worldX, worldY) - TreeViewEntry *entryPtr; - TreeViewValue *valuePtr; - TreeViewStyle *stylePtr; - int worldX, worldY; -{ - TreeViewColumn *columnPtr; - TreeViewCheckBox *cbPtr = (TreeViewCheckBox *)stylePtr; - int columnWidth; - int x, y, width, height; - - columnPtr = valuePtr->columnPtr; - columnWidth = columnPtr->width - - (2 * columnPtr->borderWidth + PADDING(columnPtr->pad)); - if (columnWidth > valuePtr->width) { - switch(columnPtr->justify) { - case TK_JUSTIFY_RIGHT: - worldX += (columnWidth - valuePtr->width); - break; - case TK_JUSTIFY_CENTER: - worldX += (columnWidth - valuePtr->width) / 2; - break; - case TK_JUSTIFY_LEFT: - break; - } - } - width = height = ODD(cbPtr->size) + 2 * cbPtr->lineWidth; - x = columnPtr->worldX + columnPtr->pad.side1 + cbPtr->gap - - cbPtr->lineWidth; - y = entryPtr->worldY + (entryPtr->height - height) / 2; - if ((worldX >= x) && (worldX < (x + width)) && - (worldY >= y) && (worldY < (y + height))) { - return TRUE; - } - return FALSE; -} - -/* - *---------------------------------------------------------------------- - * * EditCheckbox -- * --- src/bltObjConfig.c 2002-09-18 18:30:51.000000000 -0400 +++ src/bltObjConfig.c 2010-01-21 23:21:47.000000000 -0500 @@ -1220,5 +1220,5 @@ { int bool; - unsigned int flag; + uintptr_t flag; @@ -1226,5 +1226,5 @@ return TCL_ERROR; } - flag = (unsigned int)specPtr->customPtr; + flag = (uintptr_t)specPtr->customPtr; *(int *)ptr &= ~flag; if (bool) { @@ -1499,7 +1499,7 @@ case BLT_CONFIG_BITFLAG: { - unsigned int flag; + uintptr_t flag; - flag = (*(int *)ptr) & (unsigned int)specPtr->customPtr; + flag = (*(int *)ptr) & (uintptr_t)specPtr->customPtr; return Tcl_NewBooleanObj((flag != 0)); } --- src/bltTed.c 2002-05-16 16:46:00.000000000 -0400 +++ src/bltTed.c 2010-01-21 23:24:01.000000000 -0500 @@ -307,8 +307,6 @@ static void DestroyTed _ANSI_ARGS_((DestroyData destroyData)); static void DisplayEntry _ANSI_ARGS_((ClientData clientData)); -static void DestroyEntry _ANSI_ARGS_((DestroyData destoryData)); static Tcl_CmdProc TedCmd; -static Tk_EventProc EntryEventProc; static Tk_EventProc TedEventProc; @@ -343,72 +341,4 @@ /* - *---------------------------------------------------------------------- - * - * EventuallyRedraw -- - * - * Queues a request to redraw the text window at the next idle - * point. - * - * Results: - * None. - * - * Side effects: - * Information gets redisplayed. Right now we don't do selective - * redisplays: the whole window will be redrawn. This doesn't - * seem to hurt performance noticeably, but if it does then this - * could be changed. - * - *---------------------------------------------------------------------- - */ -static void -EventuallyRedrawEntry(repPtr) - EntryRep *repPtr; /* Information about editor. */ -{ - if ((repPtr->tkwin != NULL) && !(repPtr->flags & REDRAW_PENDING)) { - repPtr->flags |= REDRAW_PENDING; - Tcl_DoWhenIdle(DisplayEntry, repPtr); - } -} - -/* - * -------------------------------------------------------------- - * - * EntryEventProc -- - * - * This procedure is invoked by the Tk dispatcher for various - * events on the editing grid for the table. - * - * Results: - * None. - * - * Side effects: - * When the window gets deleted, internal structures get - * cleaned up. When it gets exposed, it is redisplayed. - * - * -------------------------------------------------------------- - */ -static void -EntryEventProc(clientData, eventPtr) - ClientData clientData; /* Information about window. */ - XEvent *eventPtr; /* Information about event. */ -{ - EntryRep *repPtr = (EntryRep *) clientData; - - if (eventPtr->type == ConfigureNotify) { - EventuallyRedrawEntry(repPtr); - } else if (eventPtr->type == Expose) { - if (eventPtr->xexpose.count == 0) { - EventuallyRedrawEntry(repPtr); - } - } else if (eventPtr->type == DestroyNotify) { - repPtr->tkwin = NULL; - if (repPtr->flags & REDRAW_PENDING) { - Tcl_CancelIdleCall(DisplayEntry, repPtr); - } - Tcl_EventuallyFree(repPtr, DestroyEntry); - } -} - -/* * -------------------------------------------------------------- * @@ -545,78 +475,4 @@ * ---------------------------------------------------------------------------- * - * CreateEntry -- - * - * ---------------------------------------------------------------------------- - */ -static int -CreateEntry(tedPtr, entryPtr) - Ted *tedPtr; - Entry *entryPtr; -{ - Tk_Window tkwin, master; - char string[200]; - EntryRep *repPtr; - Blt_ChainLink *linkPtr; - - repPtr = Blt_Calloc(1, sizeof(EntryRep)); - assert(repPtr); - repPtr->tablePtr = tedPtr->tablePtr; - repPtr->tedPtr = tedPtr; - repPtr->interp = tedPtr->interp; - repPtr->entryPtr = entryPtr; - repPtr->mapped = 0; - - /* - * Create a sibling window to cover the master window. It will - * be stacked just above the master window. - */ - - master = tedPtr->tablePtr->tkwin; - sprintf(string, "bltTed%d", tedPtr->nextWindowId); - tedPtr->nextWindowId++; - tkwin = Tk_CreateWindow(tedPtr->interp, master, string, (char *)NULL); - if (tkwin == NULL) { - Blt_Free(repPtr); - return TCL_ERROR; - } - Tk_SetClass(tkwin, "BltTed"); - Tk_CreateEventHandler(tkwin, ExposureMask | StructureNotifyMask, - EntryEventProc, repPtr); - repPtr->tkwin = tkwin; - linkPtr = Blt_ChainNewLink(); - Blt_ChainSetValue(linkPtr, repPtr); - Blt_ChainLinkAfter(tedPtr->chainPtr, linkPtr, (Blt_ChainLink *)NULL); - return TCL_OK; -} - -/* - * ---------------------------------------------------------------------------- - * - * DestroyEntry -- - * - * ---------------------------------------------------------------------------- - */ -static void -DestroyEntry(data) - DestroyData data; -{ - EntryRep *repPtr = (EntryRep *)data; - Blt_ChainLink *linkPtr; - Entry *entryPtr; - - for (linkPtr = Blt_ChainFirstLink(repPtr->tedPtr->chainPtr); - linkPtr != NULL; linkPtr = Blt_ChainNextLink(linkPtr)) { - entryPtr = Blt_ChainGetValue(linkPtr); - if (entryPtr == repPtr->entryPtr) { - Blt_ChainDeleteLink(repPtr->tedPtr->chainPtr, linkPtr); - Blt_Free(repPtr); - return; - } - } -} - -/* - * ---------------------------------------------------------------------------- - * * DisplayEntry -- *