From 866c5d22436853398b078226064f655c6dd69eea Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 19 Sep 2007 17:28:21 +0000 Subject: merge updates from HEAD --- ChangeLog | 68 +++++++++--- changes | 35 +++++- generic/tkImgGIF.c | 307 +++++++++++++++++++++++++++++----------------------- generic/tkStubLib.c | 21 +++- tests/all.tcl | 4 +- tests/ttk/all.tcl | 28 +++-- unix/configure | 25 +---- unix/configure.in | 9 +- unix/tcl.m4 | 18 +-- 9 files changed, 304 insertions(+), 211 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ce2733..ae42790 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,43 @@ +2007-09-19 Pat Thoyts + + * generic/tkStubLib.: Replaced isdigit with internal implementation. + +2007-09-18 Don Porter + + * generic/tkStubLib.c: Remove C library calls from Tk_InitStubs() + * win/makefile.vc: so that we don't need the C library linked + in to libtkStub. + +2007-09-18 Donal K. Fellows + + * generic/tkImgGIF.c (FileReadGIF, StringReadGIF): Rewrite for greater + clarity (more comments, saner code arrangement, etc.) + +2007-09-18 Pat Thoyts + + * tests/all.tcl: Made ttk/all.tcl be the same as tk's all.tcl and + * tests/ttk/all.tcl: make use of file normalize (bugs noted by + mjanssen and GPS with msys) + +2007-09-17 Pat Thoyts + + * win/makefile.vc: Add crt flags for tkStubLib now it uses C-library + functions. + +2007-09-17 Joe English + + * unix/tcl.m4: use '${CC} -shared' instead of 'ld -Bshareable' to + build shared libraries on current NetBSDs. [#1749251] + * unix/configure: regenerated (autoconf-2.59). + 2007-09-17 Don Porter * generic/tkConsole.c: Revised callers of Tcl_InitStubs() to account * generic/tkMain.c: for restored compatible support for the call * generic/tkWindow.c: Tcl_InitStubs(interp, TCL_VERSION, 1). Also revised Tcl_PkgRequire() call for Tcl so that, for example, a Tk - library built against Tcl 8.5.1 headers will not refuse to [load] - into a Tcl 8.5.0 interpreter. [Tcl Bug 1578344]. + library built against Tcl 8.5.1 headers will not refuse to [load] into + a Tcl 8.5.0 interpreter. [Tcl Bug 1578344] * generic/tk.h: Revised Tk_InitStubs() to restore Tk 8.4 * generic/tkStubLib.c: source compatibility with callers of @@ -13,8 +45,8 @@ 2007-09-17 Joe English - * library/ttk/combobox.tcl: Try to improve combobox appearance - on OSX + Tk 8.5 [#1780286]. + * library/ttk/combobox.tcl: Try to improve combobox appearance on + OSX + Tk 8.5 [#1780286]. 2007-09-15 Daniel Steffen @@ -35,23 +67,23 @@ * win/Makefile.in (install-binaries): Fixed missing brace in the * win/makefile.vc (install-binaries): generated package index file. - Note: unix/Makefile.in is good. + Note: unix/Makefile.in is good. 2007-09-11 Reinhard Max * generic/tkImgGIF.c: Fixed a buffer overrun that got triggered by - multi-frame interlaced GIFs that contain subsequent frames that - are smaller than the first one. + multi-frame interlaced GIFs that contain subsequent frames that are + smaller than the first one. * tests/imgPhoto.test: Added a test for the above. 2007-09-11 Don Porter * generic/tkConsole.c: Revised calls to Tcl_InitStubs() and - * generic/tkMain.c: [package require Tcl] so that Tk Says What - * generic/tkWindow.c: It Means using the new facilties of [package] - * library/tk.tcl: in Tcl 8.5 about what version(s) of Tcl it - * unix/Makefile.in: is willing to work with. [Bug 1578344]. + * generic/tkMain.c: [package require Tcl] so that Tk Says What It + * generic/tkWindow.c: Means using the new facilties of [package] in + * library/tk.tcl: Tcl 8.5 about what version(s) of Tcl it is + * unix/Makefile.in: willing to work with. [Bug 1578344] * win/Makefile.in: * win/makefile.vc: @@ -64,8 +96,8 @@ * generic/tkConsole.c: Revise all Tcl_InitStubs() calls to restore * generic/tkMain.c: the traditional practice that a Tk shared * generic/tkWindow.c: library may [load] into a Tcl 8.5 interp at - any patchlevel. This practice also matches the compile time checks - of TCL_MAJOR_VERSION and TCL_MINOR_VERSION in tk.h. [Bug 1723622] + any patchlevel. This practice also matches the compile time checks of + TCL_MAJOR_VERSION and TCL_MINOR_VERSION in tk.h. [Bug 1723622] 2007-09-06 Don Porter @@ -73,11 +105,11 @@ * generic/tkInitScript.h (removed): script out of tkInitScript.h * macosx/tkMacOSXInit.c: and multiple TkpInit() routines and * unix/Makefile.in: into the common Initialize() routine in - * unix/tkUnixInit.c: generic code. Also removed constraint on + * unix/tkUnixInit.c: generic code. Also removed constraint on * win/tkWinInit.c: ability to define a custom [tkInit] before - calling Tk_Init(). Until now the custom [tkInit] had to be a proc. - Now it can be any command. Removal of tkInitScript.h also fixes - [Bug 1656283]. + calling Tk_Init(). Until now the custom [tkInit] had to be a proc. Now + it can be any command. Removal of tkInitScript.h also fixes [Bug + 1656283]. 2007-09-06 Daniel Steffen @@ -100,7 +132,7 @@ 2007-09-04 Don Porter * unix/Makefile.in: It's unreliable to count on the release - manager to remember to `make genstubs` before `make dist`. Let the + manager to remember to `make genstubs` before `make dist`. Let the Makefile remember the dependency for us. * unix/Makefile.in: Corrections to `make dist` dependencies to be diff --git a/changes b/changes index 5edf981..0f8d294 100644 --- a/changes +++ b/changes @@ -2,7 +2,7 @@ This file summarizes all changes made to Tk since version 1.0 was released on March 13, 1991. Changes that aren't backward compatible are marked specially. -RCS: @(#) $Id: changes,v 1.107 2007/05/16 22:14:37 das Exp $ +RCS: @(#) $Id: changes,v 1.107.2.1 2007/09/19 17:28:21 dgp Exp $ 3/16/91 (bug fix) Modified tkWindow.c to remove Tk's Tcl commands from the interpreter when the main window is deleted (otherwise there will @@ -6325,3 +6325,36 @@ window class of already existing windows. to Wish.app's Info.plist. --- Released 8.5a6, April 25, 2007 --- See ChangeLog for details --- + +2007-05-31 (platform support) Aqua: improve interaction of Expose events and +idle-time redraws. + +2007-05-31 (bug fix) Aqua: gridded window max-size calculation. + +2007-06-02 (bug fix)[1731734] Aqua: menu cascades outside menubar. + +2007-06-06 (platform support) Aqua: enable MouseWheel events in background +windows. + +2007-06-23 (bug fix) Aqua: nav dialog sheet crash. + +2007-06-29 (platform support) Aqua: remove private internal declarations from +installed tkMacOSXInt.h header. + +2007-06-29 (bug fix) Aqua: scrollbar thumb size calculation. + +2007-07-09 (bug fix) Aqua: app-is-frontmost detection. + +2007-07-09 (bug fix) Aqua: window click activation & titlebar click handling +in presence of grabs or modal windows. + +2007-07-25 (bug fix)[1743786] Aqua: tk_getOpenFile result. + +2007-08-27 (bug fix)[1782105] Aqua: tk_chooseColor result. + +2007-09-06 (platform support) Aqua: drop support for Xcode 1.5 project, add +project for Xcode 3.0. + +2007-09-15 (platform support) SunOS-5.1x link with cc, not ld. + +--- Released 8.5b1, September ??, 2007 --- See ChangeLog for details --- diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index 78cd4f9..1e8cc16 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -13,8 +13,8 @@ * Copyright (c) 1997 Australian National University * Copyright (c) 2005 Donal K. Fellows * - * See the file "license.terms" for information on usage and redistribution - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * This file also contains code from the giftoppm program, which is * copyrighted as follows: @@ -32,9 +32,11 @@ * This file also contains code from miGIF. See lower down in file for the * applicable copyright notice for that portion. * - * RCS: @(#) $Id: tkImgGIF.c,v 1.35.2.2 2007/09/11 18:32:35 dgp Exp $ + * RCS: @(#) $Id: tkImgGIF.c,v 1.35.2.3 2007/09/19 17:28:21 dgp Exp $ */ +#include "tkInt.h" + /* * GIF's are represented as data in either binary or base64 format. base64 * strings consist of 4 6-bit characters -> 3 8 bit bytes. A-Z, a-z, 0-9, + @@ -61,8 +63,6 @@ typedef struct mFile { int length; /* Total amount of bytes in data */ } MFile; -#include "tkInt.h" - /* * Non-ASCII encoding support: * Most data in a GIF image is binary and is treated as such. However, a few @@ -73,16 +73,22 @@ typedef struct mFile { * independant. */ -static CONST char GIF87a[] = { /* ASCII GIF87a */ +static const char GIF87a[] = { /* ASCII GIF87a */ 0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x00 }; -static CONST char GIF89a[] = { /* ASCII GIF89a */ +static const char GIF89a[] = { /* ASCII GIF89a */ 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x00 }; #define GIF_TERMINATOR 0x3b /* ASCII ; */ #define GIF_EXTENSION 0x21 /* ASCII ! */ #define GIF_START 0x2c /* ASCII , */ +/* + * Flags used to notify that we've got inline data instead of a file to read + * from. Note that we need to figure out which type of inline data we've got + * before handing off to the GIF reading code; this is done in StringReadGIF. + */ + #define INLINE_DATA_BINARY ((const char *) 0x01) #define INLINE_DATA_BASE64 ((const char *) 0x02) @@ -109,11 +115,11 @@ typedef struct { * The format record for the GIF file format: */ -static int FileMatchGIF(Tcl_Channel chan, CONST char *fileName, +static int FileMatchGIF(Tcl_Channel chan, const char *fileName, Tcl_Obj *format, int *widthPtr, int *heightPtr, Tcl_Interp *interp); static int FileReadGIF(Tcl_Interp *interp, Tcl_Channel chan, - CONST char *fileName, Tcl_Obj *format, + const char *fileName, Tcl_Obj *format, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY); static int StringMatchGIF(Tcl_Obj *dataObj, Tcl_Obj *format, @@ -122,7 +128,7 @@ static int StringReadGIF(Tcl_Interp *interp, Tcl_Obj *dataObj, Tcl_Obj *format, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY); -static int FileWriteGIF(Tcl_Interp *interp, CONST char *filename, +static int FileWriteGIF(Tcl_Interp *interp, const char *filename, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr); static int CommonWriteGIF(Tcl_Interp *interp, Tcl_Channel handle, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr); @@ -165,11 +171,10 @@ static int ReadColorMap(GIFImageConfig *gifConfPtr, static int ReadGIFHeader(GIFImageConfig *gifConfPtr, Tcl_Channel chan, int *widthPtr, int *heightPtr); static int ReadImage(GIFImageConfig *gifConfPtr, - Tcl_Interp *interp, char *imagePtr, + Tcl_Interp *interp, unsigned char *imagePtr, Tcl_Channel chan, int len, int rows, - unsigned char cmap[MAXCOLORMAPSIZE][4], - int width, int height, int srcX, int srcY, - int interlace, int transparent); + unsigned char cmap[MAXCOLORMAPSIZE][4], int srcX, + int srcY, int interlace, int transparent); /* * these are for the BASE64 image reader code only @@ -205,7 +210,7 @@ static void mInit(unsigned char *string, MFile *handle, static int FileMatchGIF( Tcl_Channel chan, /* The image file, open for reading. */ - CONST char *fileName, /* The name of the image file. */ + const char *fileName, /* The name of the image file. */ Tcl_Obj *format, /* User-specified format object, or NULL. */ int *widthPtr, int *heightPtr, /* The dimensions of the image are returned @@ -241,7 +246,7 @@ static int FileReadGIF( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ Tcl_Channel chan, /* The image file, open for reading. */ - CONST char *fileName, /* The name of the image file. */ + const char *fileName, /* The name of the image file. */ Tcl_Obj *format, /* User-specified format object, or NULL. */ Tk_PhotoHandle imageHandle, /* The photo image to write into. */ int destX, int destY, /* Coordinates of top-left pixel in photo @@ -252,15 +257,14 @@ FileReadGIF( * image being read. */ { int fileWidth, fileHeight, imageWidth, imageHeight; - int nBytes, index = 0, argc = 0, i; + int nBytes, index = 0, argc = 0, i, result = TCL_ERROR; Tcl_Obj **objv; - Tk_PhotoImageBlock block; unsigned char buf[100]; unsigned char *trashBuffer = NULL; int bitPixel; unsigned char colorMap[MAXCOLORMAPSIZE][4]; int transparent = -1; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "-index", NULL }; GIFImageConfig gifConf, *gifConfPtr = &gifConf; @@ -276,6 +280,10 @@ FileReadGIF( fileName = "inline data"; } + /* + * Parse the format string to get options. + */ + if (format && Tcl_ListObjGetElements(interp, format, &argc, &objv) != TCL_OK) { return TCL_ERROR; @@ -294,6 +302,11 @@ FileReadGIF( return TCL_ERROR; } } + + /* + * Read the GIF file header and check for some sanity. + */ + if (!ReadGIFHeader(gifConfPtr, chan, &fileWidth, &fileHeight)) { Tcl_AppendResult(interp, "couldn't read GIF header from file \"", fileName, "\"", NULL); @@ -305,10 +318,14 @@ FileReadGIF( return TCL_ERROR; } + /* + * Get the general colormap information. + */ + if (Fread(gifConfPtr, buf, 1, 3, chan) != 3) { return TCL_OK; } - bitPixel = 2<<(buf[0]&0x07); + bitPixel = 2 << (buf[0] & 0x07); if (BitSet(buf[0], LOCALCOLORMAP)) { /* Global Colormap */ if (!ReadColorMap(gifConfPtr, chan, bitPixel, colorMap)) { @@ -328,20 +345,19 @@ FileReadGIF( return TCL_OK; } + /* + * Make sure we have enough space in the photo image to hold the data from + * the GIF. + */ + if (Tk_PhotoExpand(interp, imageHandle, destX + width, destY + height) != TCL_OK) { return TCL_ERROR; } - block.width = width; - block.height = height; - block.pixelSize = 4; - block.pitch = block.pixelSize * block.width; - block.offset[0] = 0; - block.offset[1] = 1; - block.offset[2] = 2; - block.offset[3] = 3; - block.pixelPtr = NULL; + /* + * Search for the frame from the GIF to display. + */ while (1) { if (Fread(gifConfPtr, buf, 1, 1, chan) != 1) { @@ -354,16 +370,12 @@ FileReadGIF( goto error; } - if (buf[0] == GIF_TERMINATOR) { - /* - * GIF terminator. - */ - + switch (buf[0]) { + case GIF_TERMINATOR: Tcl_AppendResult(interp, "no image data for this index", NULL); goto error; - } - if (buf[0] == GIF_EXTENSION) { + case GIF_EXTENSION: /* * This is a GIF extension. */ @@ -381,9 +393,15 @@ FileReadGIF( goto error; } continue; - } - - if (buf[0] != GIF_START) { + case GIF_START: + if (Fread(gifConfPtr, buf, 1, 9, chan) != 9) { + Tcl_SetResult(interp, + "couldn't read left/top/width/height in GIF image", + TCL_STATIC); + goto error; + } + break; + default: /* * Not a valid start character; ignore it. */ @@ -391,21 +409,18 @@ FileReadGIF( continue; } - if (Fread(gifConfPtr, buf, 1, 9, chan) != 9) { - Tcl_SetResult(interp, - "couldn't read left/top/width/height in GIF image", - TCL_STATIC); - goto error; - } + /* + * We've read the header for a GIF frame. Work out what we are going + * to do about it. + */ imageWidth = LM_to_uint(buf[4], buf[5]); imageHeight = LM_to_uint(buf[6], buf[7]); - - bitPixel = 1<<((buf[8]&0x07)+1); + bitPixel = 1 << ((buf[8] & 0x07) + 1); if (index--) { /* - * This is not the image we want to read: skip it. + * This is not the GIF frame we want to read: skip it. */ if (BitSet(buf[8], LOCALCOLORMAP)) { @@ -421,7 +436,7 @@ FileReadGIF( if (trashBuffer == NULL) { nBytes = fileWidth * fileHeight * 3; - trashBuffer = (unsigned char *) ckalloc((unsigned int) nBytes); + trashBuffer = (unsigned char *) ckalloc((unsigned) nBytes); } /* @@ -441,81 +456,93 @@ FileReadGIF( * common case. */ - if (ReadImage(gifConfPtr, interp, (char *)trashBuffer, chan, - imageWidth, imageHeight, colorMap, 0, 0, 0, 0, 0, - -1) != TCL_OK) { + if (ReadImage(gifConfPtr, interp, trashBuffer, chan, imageWidth, + imageHeight, colorMap, 0, 0, 0, -1) != TCL_OK) { goto error; } continue; } + break; + } - if (BitSet(buf[8], LOCALCOLORMAP)) { - if (!ReadColorMap(gifConfPtr, chan, bitPixel, colorMap)) { - Tcl_AppendResult(interp, "error reading color map", NULL); - goto error; - } - } + /* + * Found the frame we want to read. Next, check for a local color map for + * this frame. + */ - index = LM_to_uint(buf[0], buf[1]); - srcX -= index; - if (srcX<0) { - destX -= srcX; width += srcX; - srcX = 0; + if (BitSet(buf[8], LOCALCOLORMAP)) { + if (!ReadColorMap(gifConfPtr, chan, bitPixel, colorMap)) { + Tcl_AppendResult(interp, "error reading color map", NULL); + goto error; } + } - if (width > imageWidth) { - width = imageWidth; - } + /* + * Extract the location within the overall visible image to put the data + * in this frame, together with the size of this frame. + */ - index = LM_to_uint(buf[2], buf[3]); - srcY -= index; - if (index > srcY) { - destY -= srcY; height += srcY; - srcY = 0; - } - if (height > imageHeight) { - height = imageHeight; - } + index = LM_to_uint(buf[0], buf[1]); + srcX -= index; + if (srcX<0) { + destX -= srcX; width += srcX; + srcX = 0; + } - if ((width <= 0) || (height <= 0)) { - block.pixelPtr = 0; - goto noerror; - } + if (width > imageWidth) { + width = imageWidth; + } + + index = LM_to_uint(buf[2], buf[3]); + srcY -= index; + if (index > srcY) { + destY -= srcY; height += srcY; + srcY = 0; + } + if (height > imageHeight) { + height = imageHeight; + } + + if ((width > 0) && (height > 0)) { + Tk_PhotoImageBlock block; + + /* + * Read the data and put it into the photo buffer for display by the + * general image machinery. + */ block.width = width; block.height = height; block.pixelSize = (transparent>=0) ? 4 : 3; + block.offset[0] = 0; + block.offset[1] = 1; + block.offset[2] = 2; block.offset[3] = (transparent>=0) ? 3 : 0; block.pitch = block.pixelSize * imageWidth; nBytes = block.pitch * imageHeight; block.pixelPtr = (unsigned char *) ckalloc((unsigned) nBytes); - if (ReadImage(gifConfPtr, interp, (char *) block.pixelPtr, chan, - imageWidth,imageHeight, colorMap, fileWidth,fileHeight, - srcX,srcY, BitSet(buf[8],INTERLACE), transparent) != TCL_OK) { + if (ReadImage(gifConfPtr, interp, block.pixelPtr, chan, imageWidth, + imageHeight, colorMap, srcX, srcY, BitSet(buf[8],INTERLACE), + transparent) != TCL_OK) { + ckfree((char *) block.pixelPtr); goto error; } - break; - } - - if (Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY, - width, height, TK_PHOTO_COMPOSITE_SET) != TCL_OK) { - goto error; + if (Tk_PhotoPutBlock(interp, imageHandle, &block, destX, destY, + width, height, TK_PHOTO_COMPOSITE_SET) != TCL_OK) { + ckfree((char *) block.pixelPtr); + goto error; + } + ckfree((char *) block.pixelPtr); } - noerror: /* - * If a trash buffer has been allocated, free it now. + * We've successfully read the GIF frame (or there was nothing to read, + * which suits as well). We're done. */ - if (trashBuffer != NULL) { - ckfree((char *)trashBuffer); - } - if (block.pixelPtr) { - ckfree((char *) block.pixelPtr); - } Tcl_AppendResult(interp, tkImgFmtGIF.name, NULL); - return TCL_OK; + result = TCL_OK; error: /* @@ -523,12 +550,9 @@ FileReadGIF( */ if (trashBuffer != NULL) { - ckfree((char *)trashBuffer); + ckfree((char *) trashBuffer); } - if (block.pixelPtr) { - ckfree((char *) block.pixelPtr); - } - return TCL_ERROR; + return result; } /* @@ -589,7 +613,7 @@ StringMatchGIF( return 0; } } else { - memcpy((void *) header, (void *) data, 10); + memcpy(header, data, 10); } *widthPtr = LM_to_uint(header[6], header[7]); *heightPtr = LM_to_uint(header[8], header[9]); @@ -628,24 +652,32 @@ StringReadGIF( { MFile handle, *hdlPtr = &handle; int length; - char *data = (char *) Tcl_GetByteArrayFromObj(dataObj, &length); + const char *xferFormat; + unsigned char *data = Tcl_GetByteArrayFromObj(dataObj, &length); - mInit((unsigned char *)data, hdlPtr, length); + mInit(data, hdlPtr, length); - if (strncmp(GIF87a, data, 6) && strncmp(GIF89a, data, 6)) { - /* - * Check whether the data is Base64 encoded by doing a - * character-by-charcter comparison with the binary-format headers; - * BASE64-encoded never matches (matching the other way is harder - * because of potential padding). - */ + /* + * Check whether the data is Base64 encoded by doing a character-by- + * charcter comparison with the binary-format headers; BASE64-encoded + * never matches (matching the other way is harder because of potential + * padding of the BASE64 data). + */ - return FileReadGIF(interp, (Tcl_Channel) hdlPtr, INLINE_DATA_BASE64, - format, imageHandle, destX, destY, width, height, srcX, srcY); + if (strncmp(GIF87a, (char *) data, 6) + && strncmp(GIF89a, (char *) data, 6)) { + xferFormat = INLINE_DATA_BASE64; } else { - return FileReadGIF(interp, (Tcl_Channel) hdlPtr, INLINE_DATA_BINARY, - format, imageHandle, destX, destY, width, height, srcX, srcY); + xferFormat = INLINE_DATA_BINARY; } + + /* + * Fall through to the file reader now that we have a correctly-configured + * pseudo-channel to pull the data from. + */ + + return FileReadGIF(interp, (Tcl_Channel) hdlPtr, xferFormat, format, + imageHandle, destX, destY, width, height, srcX, srcY); } /* @@ -694,8 +726,8 @@ ReadGIFHeader( /* *----------------------------------------------------------------- - * The code below is copied from the giftoppm program and modified - * just slightly. + * The code below is copied from the giftoppm program and modified just + * slightly. *----------------------------------------------------------------- */ @@ -818,20 +850,19 @@ static int ReadImage( GIFImageConfig *gifConfPtr, Tcl_Interp *interp, - char *imagePtr, + unsigned char *imagePtr, Tcl_Channel chan, int len, int rows, unsigned char cmap[MAXCOLORMAPSIZE][4], - int width, int height, int srcX, int srcY, int interlace, int transparent) { unsigned char initialCodeSize; int xpos = 0, ypos = 0, pass = 0, i; - register char *pixelPtr; - static CONST int interlaceStep[] = { 8, 8, 4, 2 }; - static CONST int interlaceStart[] = { 0, 4, 2, 1 }; + register unsigned char *pixelPtr; + static const int interlaceStep[] = { 8, 8, 4, 2 }; + static const int interlaceStart[] = { 0, 4, 2, 1 }; unsigned short prefix[(1 << MAX_LWZ_BITS)]; unsigned char append[(1 << MAX_LWZ_BITS)]; unsigned char stack[(1 << MAX_LWZ_BITS)*2]; @@ -874,8 +905,8 @@ ReadImage( oldCode = -1; firstCode = -1; - memset((void *)prefix, 0, (1 << MAX_LWZ_BITS) * sizeof(short)); - memset((void *)append, 0, (1 << MAX_LWZ_BITS) * sizeof(char)); + memset(prefix, 0, (1 << MAX_LWZ_BITS) * sizeof(short)); + memset(append, 0, (1 << MAX_LWZ_BITS) * sizeof(char)); for (i = 0; i < clearCode; i++) { append[i] = i; } @@ -1346,18 +1377,17 @@ Fread( size_t hunk, size_t count, /* how many */ Tcl_Channel chan) { - MFile *handle; - if (gifConfPtr->fromData == INLINE_DATA_BASE64) { return Mread(dst, hunk, count, (MFile *) chan); } if (gifConfPtr->fromData == INLINE_DATA_BINARY) { - handle = (MFile *) chan; - if (handle->length <= 0 || (size_t)handle->length < hunk*count) { + MFile *handle = (MFile *) chan; + + if (handle->length <= 0 || (size_t) handle->length < hunk*count) { return -1; } - memcpy((void *)dst, (void *) handle->data, (size_t) (hunk * count)); + memcpy(dst, handle->data, (size_t) (hunk * count)); handle->data += hunk * count; return (int)(hunk * count); } @@ -1442,7 +1472,7 @@ static int ReadValue(ClientData clientData); static int FileWriteGIF( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ - CONST char *filename, + const char *filename, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr) { @@ -1612,8 +1642,9 @@ color( int red, int green, int blue, unsigned char mapa[MAXCOLORMAPSIZE][3]) { - int x; - for (x=(statePtr->alphaOffset != 0) ; x<=MAXCOLORMAPSIZE ; x++) { + int x = (statePtr->alphaOffset != 0); + + for (; x<=MAXCOLORMAPSIZE ; x++) { if ((mapa[x][CM_RED] == red) && (mapa[x][CM_GREEN] == green) && (mapa[x][CM_BLUE] == blue)) { return x; @@ -1629,6 +1660,7 @@ nuevo( unsigned char mapa[MAXCOLORMAPSIZE][3]) { int x = (statePtr->alphaOffset != 0); + for (; x<=statePtr->num ; x++) { if ((mapa[x][CM_RED] == red) && (mapa[x][CM_GREEN] == green) && (mapa[x][CM_BLUE] == blue)) { @@ -1657,9 +1689,9 @@ savemap( statePtr->num = -1; } - for(y=0 ; yheight ; y++) { + for (y=0 ; yheight ; y++) { colores = blockPtr->pixelPtr + blockPtr->offset[0] + y*blockPtr->pitch; - for(x=0 ; xwidth ; x++) { + for (x=0 ; xwidth ; x++) { if (!statePtr->alphaOffset || colores[statePtr->alphaOffset]!=0) { red = colores[0]; green = colores[statePtr->greenOffset]; @@ -1677,7 +1709,6 @@ savemap( colores += statePtr->pixelSize; } } - return; } static int @@ -1972,8 +2003,8 @@ computeTriangleCount( count -= perrep; } if (count > 0) { - unsigned int n; - n = isqrt(count); + unsigned int n = isqrt(count); + while (n*(n+1) >= 2*count) { n--; } diff --git a/generic/tkStubLib.c b/generic/tkStubLib.c index fc1995a..54491ff 100644 --- a/generic/tkStubLib.c +++ b/generic/tkStubLib.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkStubLib.c,v 1.14.2.2 2007/09/17 15:22:01 dgp Exp $ + * RCS: @(#) $Id: tkStubLib.c,v 1.14.2.3 2007/09/19 17:28:22 dgp Exp $ */ /* @@ -55,6 +55,15 @@ TkIntPlatStubs *tkIntPlatStubsPtr; TkIntXlibStubs *tkIntXlibStubsPtr; /* + * Use our own isdigit to avoid linking to libc on windows + */ + +static int isDigit(const int c) +{ + return (c >= '0' && c <= '9'); +} + +/* *---------------------------------------------------------------------- * * Tk_InitStubs -- @@ -95,10 +104,16 @@ Tk_InitStubs( int count = 0; while (*p) { - count += !isdigit(*p++); + count += !isDigit(*p++); } if (count == 1) { - if (0 != strncmp(version, actualVersion, strlen(version))) { + CONST char *q = actualVersion; + + p = version; + while (*p && (*p == *q)) { + p++; q++; + } + if (*p) { return NULL; } } else { diff --git a/tests/all.tcl b/tests/all.tcl index f3706fe..4f20ac0 100644 --- a/tests/all.tcl +++ b/tests/all.tcl @@ -9,13 +9,13 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: all.tcl,v 1.9.2.1 2007/09/04 17:44:23 dgp Exp $ +# RCS: @(#) $Id: all.tcl,v 1.9.2.2 2007/09/19 17:28:25 dgp Exp $ package require Tcl 8.5 package require tcltest 2.2 package require Tk ;# This is the Tk test suite; fail early if no Tk! tcltest::configure {*}$argv -tcltest::configure -testdir [file join [pwd] [file dirname [info script]]] +tcltest::configure -testdir [file normalize [file dirname [info script]]] tcltest::configure -loadfile \ [file join [tcltest::testsDirectory] constraints.tcl] tcltest::configure -singleproc 1 diff --git a/tests/ttk/all.tcl b/tests/ttk/all.tcl index 75aa035..b119ef4 100644 --- a/tests/ttk/all.tcl +++ b/tests/ttk/all.tcl @@ -1,15 +1,23 @@ +# all.tcl -- # -# source all tests. +# This file contains a top-level script to run all of the ttk +# tests. Execute it by invoking "source all.tcl" when running tktest +# in this directory. # -package require tcltest 2.1 - -package require Tk 8.5 ;# This is the Tk test suite; fail early if no Tk! - -tcltest::configure -testdir [file join [pwd] [file dirname [info script]]] +# Copyright (c) 2007 by the Tk developers. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# RCS: @(#) $Id: all.tcl,v 1.1.2.1 2007/09/19 17:28:25 dgp Exp $ -eval tcltest::configure $::argv +package require Tcl 8.5 +package require tcltest 2.2 +package require Tk ;# This is the Tk test suite; fail early if no Tk! +tcltest::configure {*}$argv +tcltest::configure -testdir [file normalize [file dirname [info script]]] +tcltest::configure -loadfile \ + [file join [file dirname [tcltest::testsDirectory]] constraints.tcl] +tcltest::configure -singleproc 1 tcltest::runAllTests -if {![catch { package present Tk }]} { - destroy . -} diff --git a/unix/configure b/unix/configure index 9f34a00..6a2b8f5 100755 --- a/unix/configure +++ b/unix/configure @@ -5587,8 +5587,7 @@ _ACEOF CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; - NetBSD-*|FreeBSD-[1-2].*) - # NetBSD/SPARC needs -fPIC, -fpic will not do. + NetBSD-1.*|FreeBSD-[1-2].*) SHLIB_CFLAGS="-fPIC" SHLIB_LD="ld -Bshareable -x" SHLIB_LD_LIBS='${LIBS}' @@ -5638,13 +5637,7 @@ echo "${ECHO_T}$tcl_cv_ld_elf" >&6 TCL_LIB_VERSIONS_OK=nodots ;; OpenBSD-*) - # OpenBSD/SPARC[64] needs -fPIC, -fpic will not do. - case `machine` in - sparc|sparc64) - SHLIB_CFLAGS="-fPIC";; - *) - SHLIB_CFLAGS="-fpic";; - esac + SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" @@ -5692,17 +5685,18 @@ echo "${ECHO_T}$tcl_cv_ld_elf" >&6 UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; - FreeBSD-*) + NetBSD-*|FreeBSD-*) # FreeBSD 3.* and greater have ELF. + # NetBSD 2.* has ELF and can use 'cc -shared' to build shared libs SHLIB_CFLAGS="-fPIC" - SHLIB_LD="ld -Bshareable -x" + SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="$LDFLAGS -export-dynamic" CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} if test "${TCL_THREADS}" = "1" ; then # The -pthread needs to go in the CFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` @@ -9150,13 +9144,6 @@ if test "${TCL_LD_SEARCH_FLAGS}" = '-L${LIB_RUNTIME_DIR}'; then LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -L/g'` fi -# The statement below is very tricky! It actually *evaluates* the -# string in TCL_CC_SEARCH_FLAGS and TCL_LD_SEARCH_FLAGS which -# causes a substitution of the variable LIB_RUNTIME_DIR. - -eval "CC_SEARCH_FLAGS=\"$TCL_CC_SEARCH_FLAGS\"" -eval "LD_SEARCH_FLAGS=\"$TCL_LD_SEARCH_FLAGS\"" - #-------------------------------------------------------------------- # Check for the existence of various libraries. The order here # is important, so that then end up in the right order in the diff --git a/unix/configure.in b/unix/configure.in index a0e05ff..eaf61d6 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -3,7 +3,7 @@ dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tk installation dnl to configure the system for the local environment. # -# RCS: @(#) $Id: configure.in,v 1.134.2.4 2007/09/04 17:44:25 dgp Exp $ +# RCS: @(#) $Id: configure.in,v 1.134.2.5 2007/09/19 17:28:25 dgp Exp $ AC_INIT([tk],[8.5]) AC_PREREQ(2.59) @@ -316,13 +316,6 @@ if test "${TCL_LD_SEARCH_FLAGS}" = '-L${LIB_RUNTIME_DIR}'; then LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -L/g'` fi -# The statement below is very tricky! It actually *evaluates* the -# string in TCL_CC_SEARCH_FLAGS and TCL_LD_SEARCH_FLAGS which -# causes a substitution of the variable LIB_RUNTIME_DIR. - -eval "CC_SEARCH_FLAGS=\"$TCL_CC_SEARCH_FLAGS\"" -eval "LD_SEARCH_FLAGS=\"$TCL_LD_SEARCH_FLAGS\"" - #-------------------------------------------------------------------- # Check for the existence of various libraries. The order here # is important, so that then end up in the right order in the diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 6844843..73c1606 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -1507,8 +1507,7 @@ dnl AC_CHECK_TOOL(AR, ar) CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; - NetBSD-*|FreeBSD-[[1-2]].*) - # NetBSD/SPARC needs -fPIC, -fpic will not do. + NetBSD-1.*|FreeBSD-[[1-2]].*) SHLIB_CFLAGS="-fPIC" SHLIB_LD="ld -Bshareable -x" SHLIB_LD_LIBS='${LIBS}' @@ -1535,13 +1534,7 @@ dnl AC_CHECK_TOOL(AR, ar) TCL_LIB_VERSIONS_OK=nodots ;; OpenBSD-*) - # OpenBSD/SPARC[64] needs -fPIC, -fpic will not do. - case `machine` in - sparc|sparc64) - SHLIB_CFLAGS="-fPIC";; - *) - SHLIB_CFLAGS="-fpic";; - esac + SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" @@ -1566,17 +1559,18 @@ dnl AC_CHECK_TOOL(AR, ar) UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; - FreeBSD-*) + NetBSD-*|FreeBSD-*) # FreeBSD 3.* and greater have ELF. + # NetBSD 2.* has ELF and can use 'cc -shared' to build shared libs SHLIB_CFLAGS="-fPIC" - SHLIB_LD="ld -Bshareable -x" + SHLIB_LD='${CC} -shared ${SHLIB_CFLAGS}' SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="$LDFLAGS -export-dynamic" CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} if test "${TCL_THREADS}" = "1" ; then # The -pthread needs to go in the CFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` -- cgit v0.12