diff options
author | mi <mi@FreeBSD.org> | 2005-06-10 09:21:05 +0800 |
---|---|---|
committer | mi <mi@FreeBSD.org> | 2005-06-10 09:21:05 +0800 |
commit | a1cfeda4b4077caf1223abcb8f081972f546c183 (patch) | |
tree | e2717a5da049943d4fda598925d3e6b64405a44e /graphics/libimg | |
parent | b113f2e2c1cdba6d1764e8cbdf5aec37fde0ec82 (diff) | |
download | freebsd-ports-gnome-a1cfeda4b4077caf1223abcb8f081972f546c183.tar.gz freebsd-ports-gnome-a1cfeda4b4077caf1223abcb8f081972f546c183.tar.zst freebsd-ports-gnome-a1cfeda4b4077caf1223abcb8f081972f546c183.zip |
A number of enhancements:
. compile cleanly against 8.4 with -Wall on i386 and amd64;
. use OS' run-time linker instead of dlopen-ing libpng,
libjpeg, libtiff inside;
. stop using TIFF's _internal_ headers for anything.
This changes are quite radical, but seem to work with anything I have.
Vendor's own tests pass except for some differences in PNG images --
most likely due to changes in PNG library since 2002.
Stop requiring specific versions of jpeg, tiff, png -- we don't really care.
Bump up PORTREVISION.
Diffstat (limited to 'graphics/libimg')
-rw-r--r-- | graphics/libimg/Makefile | 15 | ||||
-rw-r--r-- | graphics/libimg/files/Makefile.bsd | 9 | ||||
-rw-r--r-- | graphics/libimg/files/patch-jpeg | 625 | ||||
-rw-r--r-- | graphics/libimg/files/patch-png | 414 | ||||
-rw-r--r-- | graphics/libimg/files/patch-tiff | 592 | ||||
-rw-r--r-- | graphics/libimg/files/patch-tk84_Tk_PhotoPutBlock | 15 | ||||
-rw-r--r-- | graphics/libimg/files/patch-warnings | 229 |
7 files changed, 1880 insertions, 19 deletions
diff --git a/graphics/libimg/Makefile b/graphics/libimg/Makefile index bd17f9b53dcd..94d3a16755dc 100644 --- a/graphics/libimg/Makefile +++ b/graphics/libimg/Makefile @@ -7,7 +7,7 @@ PORTNAME= libimg PORTVERSION= 1.2.4 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= graphics tk84 MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= tkimg @@ -16,17 +16,16 @@ DISTNAME= img${PORTVERSION} MAINTAINER= ports@FreeBSD.org COMMENT= A library of image format handlers for Tk4.1 and later -LIB_DEPENDS= tk84.1:${PORTSDIR}/x11-toolkits/tk84 \ - png.5:${PORTSDIR}/graphics/png \ - jpeg.9:${PORTSDIR}/graphics/jpeg \ - tiff.4:${PORTSDIR}/graphics/tiff +LIB_DEPENDS= tk84:${PORTSDIR}/x11-toolkits/tk84 \ + png:${PORTSDIR}/graphics/png \ + jpeg:${PORTSDIR}/graphics/jpeg \ + tiff:${PORTSDIR}/graphics/tiff WRKSRC= ${WRKDIR}/img${PORTVERSION} -# We don't need the bundled libraries at all, except for a few headers -# from libtiff, see comment in files/Makefile.bsd: +# We don't need the bundled libraries: EXTRACT_AFTER_ARGS= | ${TAR} -xf - --exclude '*/libz/*' \ - --exclude '*/compat/*' --exclude '*/libtiff/*.c' \ + --exclude '*/compat/*' --exclude '*/libtiff/*' \ --exclude '*/libjpeg/*' --exclude '*/libpng/*' MAKEFILE= ${FILESDIR}/Makefile.bsd diff --git a/graphics/libimg/files/Makefile.bsd b/graphics/libimg/files/Makefile.bsd index ce3264438cab..cfc6bc1f3164 100644 --- a/graphics/libimg/files/Makefile.bsd +++ b/graphics/libimg/files/Makefile.bsd @@ -24,17 +24,12 @@ LDADD= -lm -lz -L${LOCALBASE}/lib -lpng -ljpeg -ltiff \ CFLAGS+= -I${LOCALBASE}/include/tcl${TCL_VER} CFLAGS+= -I${LOCALBASE}/include/tcl${TCL_VER}/generic -CFLAGS+= -D__X11__ -I${X11BASE}/include +CFLAGS+= -D__X11__ -I${X11BASE}/include -DALLOW_B64 CFLAGS+= -I${LOCALBASE}/include/tk${TCL_VER} CFLAGS+= -DNDEBUG -Wall -I. -DUSE_TCL_STUBS -DUSE_TK_STUBS CFLAGS+= -DVERSION=\"${PORTVERSION}\" -I${LOCALBASE}/include CFLAGS+= -DHAVE_JPEGLIB_H -DHAVE_TIFF_H -DHAVE_DLFCN_H -DHAVE_IMG_H -# This seems terrible... The package uses libtiff's interfaces, which are -# clearly marked as internal... It includes the libtiff's header files, which -# libtiff itself does NOT install. -mi -CFLAGS+= -I${.CURDIR}/libtiff - all: pkgIndex.tcl pkgIndex.tcl: pkgIndex.tcl.in @@ -60,7 +55,7 @@ environ: # fundamentals of this library SRCS = imgInit.c imgObj.c imgUtil.c imgPmap.c imgUnixPmap.c \ imgBMP.c imgGIF.c imgJPEG.c imgPNG.c imgPS.c \ - imgTIFF.c imgTIFFjpeg.c imgTIFFpixar.c imgTIFFzip.c \ + imgTIFF.c \ imgWindow.c imgXBM.c imgXPM.c test: $(SHLIB_NAME) diff --git a/graphics/libimg/files/patch-jpeg b/graphics/libimg/files/patch-jpeg new file mode 100644 index 000000000000..d4cdcfe42f93 --- /dev/null +++ b/graphics/libimg/files/patch-jpeg @@ -0,0 +1,625 @@ +--- imgJPEG.c Thu Jun 9 06:36:41 2005 ++++ imgJPEG.c Thu Jun 9 20:27:11 2005 +@@ -173,115 +173,4 @@ + j_common_ptr cinfo)); + static int load_jpeg_library _ANSI_ARGS_((Tcl_Interp *interp)); +-static int CreateCompress _ANSI_ARGS_((j_compress_ptr, int, size_t)); +-static int CreateDecompress _ANSI_ARGS_((j_decompress_ptr, int, size_t)); +- +-/* +- * Stuff to support dynamic loading of libjpeg +- */ +- +-static struct JpegFunctions { +- VOID *handle; +- int (* abort_decompress) _ANSI_ARGS_((j_decompress_ptr)); +- int (* destroy_compress) _ANSI_ARGS_((j_compress_ptr)); +- int (* destroy_decompress) _ANSI_ARGS_((j_decompress_ptr)); +- int (* finish_compress) _ANSI_ARGS_((j_compress_ptr)); +- int (* finish_decompress) _ANSI_ARGS_((j_decompress_ptr)); +- int (* read_header) _ANSI_ARGS_((j_decompress_ptr, int)); +- JDIMENSION (* read_scanlines) _ANSI_ARGS_((j_decompress_ptr, +- JSAMPARRAY, JDIMENSION)); +- boolean (* resync_to_restart) _ANSI_ARGS_((j_decompress_ptr, int)); +- int (* set_defaults) _ANSI_ARGS_((j_compress_ptr)); +- int (* start_compress) _ANSI_ARGS_((j_compress_ptr, int)); +- int (* start_decompress) _ANSI_ARGS_((j_decompress_ptr)); +- struct jpeg_error_mgr *(* std_error) _ANSI_ARGS_((struct jpeg_error_mgr *)); +- JDIMENSION (* write_scanlines) _ANSI_ARGS_((j_compress_ptr, +- JSAMPARRAY, JDIMENSION)); +- int (* set_colorspace) _ANSI_ARGS_((j_compress_ptr, J_COLOR_SPACE)); +- int (* set_quality) _ANSI_ARGS_((j_compress_ptr, int, int)); +- int (* simple_progression) _ANSI_ARGS_((j_compress_ptr)); +- int (* CreateCompress) _ANSI_ARGS_((j_compress_ptr, int, size_t)); +- int (* CreateDecompress) _ANSI_ARGS_((j_decompress_ptr, int, size_t)); +- int (* create_compress) _ANSI_ARGS_((j_compress_ptr)); +- int (* create_decompress) _ANSI_ARGS_((j_decompress_ptr)); +- void (* destroy) _ANSI_ARGS_((j_common_ptr)); +- JDIMENSION (* write_raw_data) _ANSI_ARGS_((j_compress_ptr, +- JSAMPIMAGE, JDIMENSION)); +- void (* suppress_tables) _ANSI_ARGS_((j_compress_ptr, boolean)); +- void (* write_tables) _ANSI_ARGS_((j_compress_ptr)); +- JDIMENSION (* read_raw_data) _ANSI_ARGS_((j_decompress_ptr, +- JSAMPIMAGE, JDIMENSION)); +- void (* abort) _ANSI_ARGS_((j_common_ptr)); +-} jpeg = {0}; +- +-static char *symbols[] = { +-#ifdef NEED_SHORT_EXTERNAL_NAMES +- "jAbrtDecompress", +- "jDestCompress", +- "jDestDecompress", +- "jFinCompress", +- "jFinDecompress", +- "jReadHeader", +- "jReadScanlines", +- "jResyncRestart", +- "jSetDefaults", +- "jStrtCompress", +- "jStrtDecompress", +- "jStdError", +- "jWrtScanlines", +- /* the following 3 symbols are not crucial. They implement +- resp. the "-grayscale", "-quality" and "-progressive" +- options. If any of the symbols are missing from the +- library, the corresponding option just has no effect. */ +- "jSetColorspace", +- "jSetQuality", +- "jSimProgress", +- "jCreaCompress", +- "jCreaDecompress", +- "jCreaCompress", +- "jCreaDecompress", +- "jDestroy", +- "jWrtRawData", +- "jSuppressTables", +- "jWrtTables", +- "jReadRawData", +- "jAbort", +-#else +- "jpeg_abort_decompress", +- "jpeg_destroy_compress", +- "jpeg_destroy_decompress", +- "jpeg_finish_compress", +- "jpeg_finish_decompress", +- "jpeg_read_header", +- "jpeg_read_scanlines", +- "jpeg_resync_to_restart", +- "jpeg_set_defaults", +- "jpeg_start_compress", +- "jpeg_start_decompress", +- "jpeg_std_error", +- "jpeg_write_scanlines", +- /* the following 3 symbols are not crucial. They implement +- resp. the "-grayscale", "-quality" and "-progressive" +- options. If any of the symbols are missing from the +- library, the corresponding option just has no effect. */ +- "jpeg_set_colorspace", +- "jpeg_set_quality", +- "jpeg_simple_progression", +- /* In later versions, jpeg_create_compress and jpeg_create_decompress +- are macros pointing to jpeg_CreateCompress and jpeg_CreateDecompres. +- Which one is found depends on the version. */ +- "jpeg_CreateCompress", +- "jpeg_CreateDecompress", +- "jpeg_create_compress", +- "jpeg_create_decompress", +- "jpeg_destroy", +- "jpeg_write_raw_data", +- "jpeg_suppress_tables", +- "jpeg_write_tables", +- "jpeg_read_raw_data", +- "jpeg_abort", +-#endif +- (char *) NULL +-}; +- + + static int +@@ -292,21 +181,10 @@ + struct my_error_mgr jerror; /* for controlling libjpeg error handling */ + int i; ++ static int initialized; + +- if (ImgLoadLib(interp, JPEG_LIB_NAME, &jpeg.handle, symbols, 13) +- != TCL_OK) { +- return TCL_ERROR; +- } +- if (jpeg.CreateCompress == NULL) { +- if (jpeg.create_compress == NULL) { +- goto load_failed; +- } +- jpeg.CreateCompress = CreateCompress; +- } +- if (jpeg.CreateDecompress == NULL) { +- if (jpeg.create_decompress == NULL) { +- goto load_failed; +- } +- jpeg.CreateDecompress = CreateDecompress; +- } ++ if (initialized) ++ return TCL_OK; ++ ++ initialized = 1; + + /* The followin code tries to determine if the JPEG library is +@@ -322,5 +200,5 @@ + cinfo = (struct jpeg_compress_struct *) + ckalloc(8*sizeof(struct jpeg_compress_struct)); +- cinfo->err = jpeg.std_error(&jerror.pub); ++ cinfo->err = jpeg_std_error(&jerror.pub); + jerror.pub.error_exit = my_error_exit; + jerror.pub.output_message = my_output_message; +@@ -328,18 +206,16 @@ + if (setjmp(jerror.setjmp_buffer)) { + /* If we get here, the JPEG library is invalid. */ +- jpeg.destroy_compress(cinfo); ++ jpeg_destroy_compress(cinfo); + ckfree((char *)cinfo); +-load_failed: + if (interp) { +- Tcl_AppendResult(interp, "couldn't load \"", JPEG_LIB_NAME, +- "\": please upgrade to at least version 6a", (char *) NULL); ++ Tcl_AppendResult(interp, "JPEG library mismatch, expecting \"", ++ JPEG_LIB_NAME, NULL); + } +- ImgLoadFailed(&jpeg.handle); + return TCL_ERROR; + } + +- /* Now we can initialize libjpeg. */ ++ /* Now we can initialize libjpeg_ */ + ((char *) cinfo)[sizeof(struct jpeg_compress_struct)] = 53; +- jpeg.CreateCompress(cinfo, JPEG_LIB_VERSION, ++ jpeg_CreateCompress(cinfo, JPEG_LIB_VERSION, + (size_t) sizeof(struct jpeg_compress_struct)); + if (((char *) cinfo)[sizeof(struct jpeg_compress_struct)] != 53) { +@@ -359,5 +235,5 @@ + cinfo->X_density = 0; + cinfo->Y_density = 0; +- jpeg.set_defaults(cinfo); ++ jpeg_set_defaults(cinfo); + + if ((cinfo->data_precision != BITS_IN_JSAMPLE) || +@@ -375,5 +251,5 @@ + } + } +- jpeg.destroy_compress(cinfo); ++ jpeg_destroy_compress(cinfo); + ckfree((char *) cinfo); + return TCL_OK; +@@ -383,13 +259,6 @@ + ImgLoadJpegLibrary() + { +- if ((load_jpeg_library(NULL) == TCL_OK) +- && jpeg.destroy +- && jpeg.write_raw_data +- && jpeg.suppress_tables +- && jpeg.write_tables +- && jpeg.read_raw_data +- && jpeg.abort) { ++ if (load_jpeg_library(NULL) == TCL_OK) + return TCL_OK; +- } + return TCL_ERROR; + } +@@ -420,179 +289,4 @@ + JSAMPARRAY, JDIMENSION)); + +-static int +-CreateCompress(cinfo, version, size) +- j_compress_ptr cinfo; +- int version; +- size_t size; +-{ +- return jpeg.create_compress(cinfo); +-} +- +-static int +-CreateDecompress(cinfo, version, size) +- j_decompress_ptr cinfo; +- int version; +- size_t size; +-{ +- return jpeg.create_decompress(cinfo); +-} +- +-int +-Imgjpeg_CreateCompress(cinfo, version, size) +- j_compress_ptr cinfo; +- int version; +- size_t size; +-{ +- return jpeg.CreateCompress(cinfo, version, size); +-} +- +-int +-Imgjpeg_CreateDecompress(cinfo, version, size) +- j_decompress_ptr cinfo; +- int version; +- size_t size; +-{ +- return jpeg.CreateDecompress(cinfo, version, size); +-} +- +-boolean +-Imgjpeg_resync_to_restart(a,b) +- j_decompress_ptr a; +- int b; +-{ +- return jpeg.resync_to_restart(a,b); +-} +- +-JDIMENSION +-Imgjpeg_read_scanlines(a,b,c) +- j_decompress_ptr a; +- JSAMPARRAY b; +- JDIMENSION c; +-{ +- return jpeg.read_scanlines(a,b,c); +-} +- +-int +-Imgjpeg_set_colorspace(a,b) +- j_compress_ptr a; +- J_COLOR_SPACE b; +-{ +- return jpeg.set_colorspace(a,b); +-} +- +-int +-Imgjpeg_set_defaults(a) +- j_compress_ptr a; +-{ +- return jpeg.set_defaults(a); +-} +- +-int +-Imgjpeg_start_decompress(a) +- j_decompress_ptr a; +-{ +- return jpeg.start_decompress(a); +-} +- +-void +-Imgjpeg_destroy(a) +- j_common_ptr a; +-{ +- jpeg.destroy(a); +-} +- +-struct jpeg_error_mgr * +-Imgjpeg_std_error(a) +- struct jpeg_error_mgr *a; +-{ +- return jpeg.std_error(a); +-} +- +-JDIMENSION Imgjpeg_write_raw_data(a,b,c) +- j_compress_ptr a; +- JSAMPIMAGE b; +- JDIMENSION c; +-{ +- return jpeg.write_raw_data(a,b,c); +-} +- +-void +-Imgjpeg_suppress_tables(a,b) +- j_compress_ptr a; +- boolean b; +-{ +- jpeg.suppress_tables(a,b); +-} +- +-void +-Imgjpeg_abort(a) +- j_common_ptr a; +-{ +- jpeg.abort(a); +-} +- +-int +-Imgjpeg_read_header(a,b) +- j_decompress_ptr a; +- int b; +-{ +- return jpeg.read_header(a,b); +-} +- +-int +-Imgjpeg_start_compress(a,b) +- j_compress_ptr a; +- int b; +-{ +- return jpeg.start_compress(a,b); +-} +- +-void +-Imgjpeg_write_tables(a) +- j_compress_ptr a; +-{ +- jpeg.write_tables(a); +-} +- +-int +-Imgjpeg_finish_decompress(a) +- j_decompress_ptr a; +-{ +- return jpeg.finish_decompress(a); +-} +- +-int +-Imgjpeg_finish_compress(a) +- j_compress_ptr a; +-{ +- return jpeg.finish_compress(a); +-} +- +-JDIMENSION +-Imgjpeg_read_raw_data(a,b,c) +- j_decompress_ptr a; +- JSAMPIMAGE b; +- JDIMENSION c; +-{ +- return jpeg.read_raw_data(a,b,c); +-} +- +-int +-Imgjpeg_set_quality(a,b,c) +- j_compress_ptr a; +- int b; +- int c; +-{ +- return jpeg.set_quality(a,b,c); +-} +- +-JDIMENSION +-Imgjpeg_write_scanlines(a,b,c) +- j_compress_ptr a; +- JSAMPARRAY b; +- JDIMENSION c; +-{ +- return jpeg.write_scanlines(a,b,c); +-} + + +@@ -715,5 +409,5 @@ + } + /* look for SOF0, SOF1, or SOF2, which are the only JPEG variants +- * currently accepted by libjpeg. ++ * currently accepted by libjpeg_ + */ + if (buf[0] == (char) 0xc0 || buf[0] == (char) 0xc1 +@@ -794,5 +488,5 @@ + /* Initialize JPEG error handler */ + /* We set up the normal JPEG error routines, then override error_exit. */ +- cinfo.err = jpeg.std_error(&jerror.pub); ++ cinfo.err = jpeg_std_error(&jerror.pub); + jerror.pub.error_exit = my_error_exit; + jerror.pub.output_message = my_output_message; +@@ -803,10 +497,10 @@ + Tcl_AppendResult(interp, "couldn't read JPEG string: ", (char *) NULL); + append_jpeg_message(interp, (j_common_ptr) &cinfo); +- jpeg.destroy_decompress(&cinfo); ++ jpeg_destroy_decompress(&cinfo); + return TCL_ERROR; + } + +- /* Now we can initialize libjpeg. */ +- jpeg.CreateDecompress(&cinfo, JPEG_LIB_VERSION, ++ /* Now we can initialize libjpeg_ */ ++ jpeg_CreateDecompress(&cinfo, JPEG_LIB_VERSION, + (size_t) sizeof(struct jpeg_decompress_struct)); + jpeg_channel_src(&cinfo, chan); +@@ -817,5 +511,5 @@ + + /* Reclaim libjpeg's internal resources. */ +- jpeg.destroy_decompress(&cinfo); ++ jpeg_destroy_decompress(&cinfo); + + return result; +@@ -865,5 +559,5 @@ + /* Initialize JPEG error handler */ + /* We set up the normal JPEG error routines, then override error_exit. */ +- cinfo.err = jpeg.std_error(&jerror.pub); ++ cinfo.err = jpeg_std_error(&jerror.pub); + jerror.pub.error_exit = my_error_exit; + jerror.pub.output_message = my_output_message; +@@ -874,10 +568,10 @@ + Tcl_AppendResult(interp, "couldn't read JPEG string: ", (char *) NULL); + append_jpeg_message(interp, (j_common_ptr) &cinfo); +- jpeg.destroy_decompress(&cinfo); ++ jpeg_destroy_decompress(&cinfo); + return TCL_ERROR; + } + +- /* Now we can initialize libjpeg. */ +- jpeg.CreateDecompress(&cinfo, JPEG_LIB_VERSION, ++ /* Now we can initialize libjpeg_ */ ++ jpeg_CreateDecompress(&cinfo, JPEG_LIB_VERSION, + (size_t) sizeof(struct jpeg_decompress_struct)); + jpeg_obj_src(&cinfo, data); +@@ -888,5 +582,5 @@ + + /* Reclaim libjpeg's internal resources. */ +- jpeg.destroy_decompress(&cinfo); ++ jpeg_destroy_decompress(&cinfo); + + return result; +@@ -926,5 +620,5 @@ + * in image being read. */ + { +- static char *jpegReadOptions[] = {"-fast", "-grayscale", NULL}; ++ static const char *jpegReadOptions[] = {"-fast", "-grayscale", NULL}; + int fileWidth, fileHeight, stopY, curY, outY, outWidth, outHeight; + myblock bl; +@@ -935,5 +629,5 @@ + + /* Ready to read header data. */ +- jpeg.read_header(cinfo, TRUE); ++ jpeg_read_header(cinfo, TRUE); + + /* This code only supports 8-bit-precision JPEG files. */ +@@ -972,5 +666,5 @@ + } + +- jpeg.start_decompress(cinfo); ++ jpeg_start_decompress(cinfo); + + /* Check dimensions. */ +@@ -1002,5 +696,5 @@ + break; + case JCS_RGB: +- /* note: this pixel layout assumes default configuration of libjpeg. */ ++ /* note: this pixel layout assumes default configuration of libjpeg_ */ + block.pixelSize = 3; + block.offset[0] = 0; +@@ -1029,5 +723,5 @@ + outY = destY; + for (curY = 0; curY < stopY; curY++) { +- jpeg.read_scanlines(cinfo, buffer, 1); ++ jpeg_read_scanlines(cinfo, buffer, 1); + if (curY >= srcY) { + Tk_PhotoPutBlock(imageHandle, &block, destX, outY, outWidth, 1, TK_PHOTO_COMPOSITE_SET); +@@ -1038,7 +732,7 @@ + /* Do normal cleanup if we read the whole image; else early abort */ + if (cinfo->output_scanline == cinfo->output_height) +- jpeg.finish_decompress(cinfo); ++ jpeg_finish_decompress(cinfo); + else +- jpeg.abort_decompress(cinfo); ++ jpeg_abort_decompress(cinfo); + + return TCL_OK; +@@ -1086,5 +780,5 @@ + /* Initialize JPEG error handler */ + /* We set up the normal JPEG error routines, then override error_exit. */ +- cinfo.err = jpeg.std_error(&jerror.pub); ++ cinfo.err = jpeg_std_error(&jerror.pub); + jerror.pub.error_exit = my_error_exit; + jerror.pub.output_message = my_output_message; +@@ -1096,11 +790,11 @@ + "\": ", (char *) NULL); + append_jpeg_message(interp, (j_common_ptr) &cinfo); +- jpeg.destroy_compress(&cinfo); ++ jpeg_destroy_compress(&cinfo); + Tcl_Close(interp, chan); + return TCL_ERROR; + } + +- /* Now we can initialize libjpeg. */ +- jpeg.CreateCompress(&cinfo, JPEG_LIB_VERSION, ++ /* Now we can initialize libjpeg_ */ ++ jpeg_CreateCompress(&cinfo, JPEG_LIB_VERSION, + (size_t) sizeof(struct jpeg_compress_struct)); + jpeg_channel_dest(&cinfo, chan); +@@ -1109,5 +803,5 @@ + result = CommonWriteJPEG(interp, &cinfo, format, blockPtr); + +- jpeg.destroy_compress(&cinfo); ++ jpeg_destroy_compress(&cinfo); + if (Tcl_Close(interp, chan) == TCL_ERROR) { + return TCL_ERROR; +@@ -1154,5 +848,5 @@ + /* Initialize JPEG error handler */ + /* We set up the normal JPEG error routines, then override error_exit. */ +- cinfo.err = jpeg.std_error(&jerror.pub); ++ cinfo.err = jpeg_std_error(&jerror.pub); + jerror.pub.error_exit = my_error_exit; + jerror.pub.output_message = my_output_message; +@@ -1167,6 +861,6 @@ + } + +- /* Now we can initialize libjpeg. */ +- jpeg.CreateCompress(&cinfo, JPEG_LIB_VERSION, ++ /* Now we can initialize libjpeg_ */ ++ jpeg_CreateCompress(&cinfo, JPEG_LIB_VERSION, + (size_t) sizeof(struct jpeg_compress_struct)); + jpeg_string_dest(&cinfo, dataPtr); +@@ -1177,5 +871,5 @@ + writeend: + +- jpeg.destroy_compress(&cinfo); ++ jpeg_destroy_compress(&cinfo); + if (dataPtr == &data) { + if (result == TCL_OK) { +@@ -1210,5 +904,5 @@ + Tk_PhotoImageBlock *blockPtr; + { +- static char *jpegWriteOptions[] = {"-grayscale", "-optimize", ++ static const char *jpegWriteOptions[] = {"-grayscale", "-optimize", + "-progressive", "-quality", "-smooth", NULL}; + JSAMPROW row_pointer[1]; /* pointer to original data scanlines */ +@@ -1239,5 +933,5 @@ + cinfo->in_color_space = JCS_RGB; + +- jpeg.set_defaults(cinfo); ++ jpeg_set_defaults(cinfo); + + /* Parse options, if any, and alter default parameters */ +@@ -1262,7 +956,7 @@ + } + case 2: { +- if (jpeg.simple_progression != NULL) { ++ if (jpeg_simple_progression != NULL) { + /* Select simple progressive mode. */ +- jpeg.simple_progression(cinfo); ++ jpeg_simple_progression(cinfo); + } + break; +@@ -1278,5 +972,5 @@ + return TCL_ERROR; + } +- jpeg.set_quality(cinfo, quality, FALSE); ++ jpeg_set_quality(cinfo, quality, FALSE); + break; + } +@@ -1301,11 +995,11 @@ + greenOffset = blockPtr->offset[1] - blockPtr->offset[0]; + blueOffset = blockPtr->offset[2] - blockPtr->offset[0]; +- if ((jpeg.set_colorspace != NULL) && ++ if ((jpeg_set_colorspace != NULL) && + (grayscale || (!greenOffset && !blueOffset))) { + /* Generate monochrome JPEG file if source block is grayscale. */ +- jpeg.set_colorspace(cinfo, JCS_GRAYSCALE); ++ jpeg_set_colorspace(cinfo, JCS_GRAYSCALE); + } + +- jpeg.start_compress(cinfo, TRUE); ++ jpeg_start_compress(cinfo, TRUE); + + /* note: we assume libjpeg is configured for standard RGB pixel order. */ +@@ -1315,5 +1009,5 @@ + for (h = blockPtr->height; h > 0; h--) { + row_pointer[0] = (JSAMPROW) pixLinePtr; +- jpeg.write_scanlines(cinfo, row_pointer, 1); ++ jpeg_write_scanlines(cinfo, row_pointer, 1); + pixLinePtr += blockPtr->pitch; + } +@@ -1341,10 +1035,10 @@ + pixelPtr += blockPtr->pixelSize; + } +- jpeg.write_scanlines(cinfo, buffer, 1); ++ jpeg_write_scanlines(cinfo, buffer, 1); + pixLinePtr += blockPtr->pitch; + } + } + +- jpeg.finish_compress(cinfo); ++ jpeg_finish_compress(cinfo); + return TCL_OK; + } +@@ -1370,5 +1064,5 @@ + src->pub.fill_input_buffer = fill_input_buffer; + src->pub.skip_input_data = skip_input_data; +- src->pub.resync_to_restart = jpeg.resync_to_restart; /* use default method */ ++ src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */ + src->pub.term_source = dummy_source; + +@@ -1443,5 +1137,5 @@ + src->pub.fill_input_buffer = fill_input_buffer; + src->pub.skip_input_data = skip_input_data; +- src->pub.resync_to_restart = jpeg.resync_to_restart; /* use default method */ ++ src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */ + src->pub.term_source = dummy_source; + diff --git a/graphics/libimg/files/patch-png b/graphics/libimg/files/patch-png new file mode 100644 index 000000000000..05041d90273b --- /dev/null +++ b/graphics/libimg/files/patch-png @@ -0,0 +1,414 @@ +--- imgPNG.c Tue Jan 15 16:00:08 2002 ++++ imgPNG.c Thu Jun 9 20:11:01 2005 +@@ -104,5 +104,4 @@ + static void tk_png_error _ANSI_ARGS_((png_structp, png_const_charp)); + static void tk_png_warning _ANSI_ARGS_((png_structp, png_const_charp)); +-static int load_png_library _ANSI_ARGS_((Tcl_Interp *interp)); + + /* +@@ -116,87 +115,4 @@ + static void tk_png_flush _ANSI_ARGS_((png_structp)); + +-static struct PngFunctions { +- VOID *handle; +- png_structp (* create_read_struct) _ANSI_ARGS_((png_const_charp, +- png_voidp, png_error_ptr, png_error_ptr)); +- png_infop (* create_info_struct) _ANSI_ARGS_((png_structp)); +- png_structp (* create_write_struct) _ANSI_ARGS_((png_const_charp, +- png_voidp, png_error_ptr, png_error_ptr)); +- void (* destroy_read_struct) _ANSI_ARGS_((png_structpp, +- png_infopp, png_infopp)); +- void (* destroy_write_struct) _ANSI_ARGS_((png_structpp, png_infopp)); +- void (* error) _ANSI_ARGS_((png_structp, png_charp)); +- png_byte (* get_channels) _ANSI_ARGS_((png_structp, png_infop)); +- png_voidp (* get_error_ptr) _ANSI_ARGS_((png_structp)); +- png_voidp (* get_progressive_ptr) _ANSI_ARGS_((png_structp)); +- png_uint_32 (* get_rowbytes) _ANSI_ARGS_((png_structp, png_infop)); +- png_uint_32 (* get_IHDR) _ANSI_ARGS_((png_structp, png_infop, +- png_uint_32*, png_uint_32*, int*, int*, int*, int*, int*)); +- png_uint_32 (* get_valid) _ANSI_ARGS_((png_structp, png_infop, png_uint_32)); +- void (* read_image) _ANSI_ARGS_((png_structp, png_bytepp)); +- void (* read_info) _ANSI_ARGS_((png_structp, png_infop)); +- void (* read_update_info) _ANSI_ARGS_((png_structp, png_infop)); +- int (* set_interlace_handling) _ANSI_ARGS_ ((png_structp)); +- void (* set_read_fn) _ANSI_ARGS_((png_structp, png_voidp, png_rw_ptr)); +- void (* set_text) _ANSI_ARGS_((png_structp, png_infop, png_textp, int)); +- void (* set_write_fn) _ANSI_ARGS_((png_structp, png_voidp, +- png_rw_ptr, png_voidp)); +- void (* set_IHDR) _ANSI_ARGS_((png_structp, png_infop, png_uint_32, +- png_uint_32, int, int, int, int, int)); +- void (* write_end) _ANSI_ARGS_((png_structp, png_infop)); +- void (* write_info) _ANSI_ARGS_((png_structp, png_infop)); +- void (* write_row) _ANSI_ARGS_((png_structp, png_bytep)); +- void (* set_expand) _ANSI_ARGS_((png_structp)); +- void (* set_filler) _ANSI_ARGS_((png_structp, png_uint_32, int)); +- void (* set_strip_16) _ANSI_ARGS_((png_structp)); +- png_uint_32 (* get_sRGB) _ANSI_ARGS_((png_structp, png_infop, int *)); +- void (* set_sRGB) _ANSI_ARGS_((png_structp, png_infop, int)); +- png_uint_32 (* get_gAMA) _ANSI_ARGS_((png_structp, png_infop, double *)); +- void (* set_gAMA) PNGARG((png_structp png_ptr, png_infop, double)); +- void (* set_gamma) _ANSI_ARGS_((png_structp, double, double)); +- void (* set_sRGB_gAMA_and_cHRM) _ANSI_ARGS_((png_structp, png_infop, int)); +- void (* write_iTXt) _ANSI_ARGS_((png_structp, int, png_charp, png_charp, +- png_charp, png_charp)); +-} png = {0}; +- +-static char *symbols[] = { +- "png_create_read_struct", +- "png_create_info_struct", +- "png_create_write_struct", +- "png_destroy_read_struct", +- "png_destroy_write_struct", +- "png_error", +- "png_get_channels", +- "png_get_error_ptr", +- "png_get_progressive_ptr", +- "png_get_rowbytes", +- "png_get_IHDR", +- "png_get_valid", +- "png_read_image", +- "png_read_info", +- "png_read_update_info", +- "png_set_interlace_handling", +- "png_set_read_fn", +- "png_set_text", +- "png_set_write_fn", +- "png_set_IHDR", +- "png_write_end", +- "png_write_info", +- "png_write_row", +- /* The following symbols are not crucial. All of them +- are checked at runtime. */ +- "png_set_expand", +- "png_set_filler", +- "png_set_strip_16", +- "png_get_sRGB", +- "png_set_sRGB", +- "png_get_gAMA", +- "png_set_gAMA", +- "png_set_gamma", +- "png_set_sRGB_gAMA_and_cHRM", +- "png_write_iTXt", /* Only used to check if libpng has iTXt support at runtime */ +- (char *) NULL +-}; +- + typedef struct cleanup_info { + Tcl_Interp *interp; +@@ -209,5 +125,5 @@ + png_const_charp error_msg; + { +- cleanup_info *info = (cleanup_info *) png.get_error_ptr(png_ptr); ++ cleanup_info *info = (cleanup_info *) png_get_error_ptr(png_ptr); + Tcl_AppendResult(info->interp, error_msg, (char *) NULL); + longjmp(info->jmpbuf,1); +@@ -228,7 +144,7 @@ + png_size_t length; + { +- if (ImgRead((MFile *) png.get_progressive_ptr(png_ptr), ++ if (ImgRead((MFile *) png_get_progressive_ptr(png_ptr), + (char *) data, (size_t) length) != (int) length) { +- png.error(png_ptr, "Read Error"); ++ png_error(png_ptr, "Read Error"); + } + } +@@ -240,7 +156,7 @@ + png_size_t length; + { +- if (ImgWrite((MFile *) png.get_progressive_ptr(png_ptr), ++ if (ImgWrite((MFile *) png_get_progressive_ptr(png_ptr), + (char *) data, (size_t) length) != (int) length) { +- png.error(png_ptr, "Write Error"); ++ png_error(png_ptr, "Write Error"); + } + } +@@ -303,15 +219,4 @@ + } + +-static int +-load_png_library(interp) +- Tcl_Interp *interp; +-{ +- if (ImgLoadLib(interp, PNG_LIB_NAME, &png.handle, symbols, 22) +- != TCL_OK) { +- return TCL_ERROR; +- } +- return TCL_OK; +-} +- + static int ChnReadPNG(interp, chan, fileName, format, imageHandle, + destX, destY, width, height, srcX, srcY) +@@ -329,8 +234,4 @@ + cleanup_info cleanup; + +- if (load_png_library(interp) != TCL_OK) { +- return TCL_ERROR; +- } +- + handle.data = (char *) chan; + handle.state = IMG_CHAN; +@@ -338,9 +239,9 @@ + cleanup.interp = interp; + +- png_ptr=png.create_read_struct(PNG_LIBPNG_VER_STRING, ++ png_ptr=png_create_read_struct(PNG_LIBPNG_VER_STRING, + (png_voidp) &cleanup,tk_png_error,tk_png_warning); + if (!png_ptr) return(0); + +- png.set_read_fn(png_ptr, (png_voidp) &handle, tk_png_read); ++ png_set_read_fn(png_ptr, (png_voidp) &handle, tk_png_read); + + return CommonReadPNG(png_ptr, format, imageHandle, destX, destY, +@@ -362,11 +263,7 @@ + cleanup_info cleanup; + +- if (load_png_library(interp) != TCL_OK) { +- return TCL_ERROR; +- } +- + cleanup.interp = interp; + +- png_ptr=png.create_read_struct(PNG_LIBPNG_VER_STRING, ++ png_ptr=png_create_read_struct(PNG_LIBPNG_VER_STRING, + (png_voidp) &cleanup,tk_png_error,tk_png_warning); + if (!png_ptr) return TCL_ERROR; +@@ -374,5 +271,5 @@ + ImgReadInit(dataObj,'\211',&handle); + +- png.set_read_fn(png_ptr,(png_voidp) &handle, tk_png_read); ++ png_set_read_fn(png_ptr,(png_voidp) &handle, tk_png_read); + + return CommonReadPNG(png_ptr, format, imageHandle, destX, destY, +@@ -406,27 +303,27 @@ + int intent; + +- info_ptr=png.create_info_struct(png_ptr); ++ info_ptr=png_create_info_struct(png_ptr); + if (!info_ptr) { +- png.destroy_read_struct(&png_ptr,NULL,NULL); ++ png_destroy_read_struct(&png_ptr,NULL,NULL); + return(TCL_ERROR); + } + +- end_info=png.create_info_struct(png_ptr); ++ end_info=png_create_info_struct(png_ptr); + if (!end_info) { +- png.destroy_read_struct(&png_ptr,&info_ptr,NULL); ++ png_destroy_read_struct(&png_ptr,&info_ptr,NULL); + return(TCL_ERROR); + } + +- if (setjmp((((cleanup_info *) png.get_error_ptr(png_ptr))->jmpbuf))) { ++ if (setjmp((((cleanup_info *) png_get_error_ptr(png_ptr))->jmpbuf))) { + if (png_data) { + ckfree((char *)png_data); + } +- png.destroy_read_struct(&png_ptr, &info_ptr, &end_info); ++ png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); + return TCL_ERROR; + } + +- png.read_info(png_ptr,info_ptr); ++ png_read_info(png_ptr,info_ptr); + +- png.get_IHDR(png_ptr, info_ptr, &info_width, &info_height, &bit_depth, ++ png_get_IHDR(png_ptr, info_ptr, &info_width, &info_height, &bit_depth, + &color_type, &interlace_type, (int *) NULL, (int *) NULL); + +@@ -447,6 +344,6 @@ + Tk_PhotoGetImage(imageHandle, &block); + +- if (png.set_strip_16 != NULL) { +- png.set_strip_16(png_ptr); ++ if (png_set_strip_16 != NULL) { ++ png_set_strip_16(png_ptr); + } else if (bit_depth == 16) { + block.offset[1] = 2; +@@ -454,11 +351,11 @@ + } + +- if (png.set_expand != NULL) { +- png.set_expand(png_ptr); ++ if (png_set_expand != NULL) { ++ png_set_expand(png_ptr); + } + +- png.read_update_info(png_ptr,info_ptr); +- block.pixelSize = png.get_channels(png_ptr, info_ptr); +- block.pitch = png.get_rowbytes(png_ptr, info_ptr); ++ png_read_update_info(png_ptr,info_ptr); ++ block.pixelSize = png_get_channels(png_ptr, info_ptr); ++ block.pitch = png_get_rowbytes(png_ptr, info_ptr); + + if ((color_type & PNG_COLOR_MASK_COLOR) == 0) { +@@ -471,5 +368,5 @@ + + if ((color_type & PNG_COLOR_MASK_ALPHA) +- || png.get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { ++ || png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { + /* with alpha channel */ + block.offset[3] = block.pixelSize - 1; +@@ -479,12 +376,13 @@ + } + +- if (png.get_sRGB && png.get_sRGB(png_ptr, info_ptr, &intent)) { +- png.set_sRGB(png_ptr, info_ptr, intent); +- } else if (png.get_gAMA) { ++ if (png_get_sRGB(png_ptr, info_ptr, &intent)) { ++ /* XXX does this get/set make sense? */ ++ png_set_sRGB(png_ptr, info_ptr, intent); ++ } else { + double gamma; +- if (!png.get_gAMA(png_ptr, info_ptr, &gamma)) { ++ if (!png_get_gAMA(png_ptr, info_ptr, &gamma)) { + gamma = 0.45455; + } +- png.set_gamma(png_ptr, 1.0, gamma); ++ png_set_gamma(png_ptr, 1.0, gamma); + } + +@@ -498,10 +396,10 @@ + block.pixelPtr=(unsigned char *) (png_data[srcY]+srcX*block.pixelSize); + +- png.read_image(png_ptr,(png_bytepp) png_data); ++ png_read_image(png_ptr,(png_bytepp) png_data); + + ImgPhotoPutBlock(imageHandle,&block,destX,destY,width,height); + + ckfree((char *) png_data); +- png.destroy_read_struct(&png_ptr,&info_ptr,&end_info); ++ png_destroy_read_struct(&png_ptr,&info_ptr,&end_info); + + return(TCL_OK); +@@ -529,12 +427,7 @@ + handle.state = IMG_CHAN; + +- if (load_png_library(interp) != TCL_OK) { +- Tcl_Close(NULL, chan); +- return TCL_ERROR; +- } +- + cleanup.interp = interp; + +- png_ptr=png.create_write_struct(PNG_LIBPNG_VER_STRING, ++ png_ptr=png_create_write_struct(PNG_LIBPNG_VER_STRING, + (png_voidp) &cleanup,tk_png_error,tk_png_warning); + if (!png_ptr) { +@@ -543,12 +436,12 @@ + } + +- info_ptr=png.create_info_struct(png_ptr); ++ info_ptr=png_create_info_struct(png_ptr); + if (!info_ptr) { +- png.destroy_write_struct(&png_ptr,NULL); ++ png_destroy_write_struct(&png_ptr,NULL); + Tcl_Close(NULL, chan); + return TCL_ERROR; + } + +- png.set_write_fn(png_ptr,(png_voidp) &handle, tk_png_write, tk_png_flush); ++ png_set_write_fn(png_ptr,(png_voidp) &handle, tk_png_write, tk_png_flush); + + result = CommonWritePNG(interp, png_ptr, info_ptr, format, blockPtr); +@@ -572,11 +465,7 @@ + ImgFixStringWriteProc(&data, &interp, &dataPtr, &format, &blockPtr); + +- if (load_png_library(interp) != TCL_OK) { +- return TCL_ERROR; +- } +- + cleanup.interp = interp; + +- png_ptr=png.create_write_struct(PNG_LIBPNG_VER_STRING, ++ png_ptr=png_create_write_struct(PNG_LIBPNG_VER_STRING, + (png_voidp) &cleanup, tk_png_error, tk_png_warning); + if (!png_ptr) { +@@ -584,11 +473,11 @@ + } + +- info_ptr = png.create_info_struct(png_ptr); ++ info_ptr = png_create_info_struct(png_ptr); + if (!info_ptr) { +- png.destroy_write_struct(&png_ptr,NULL); ++ png_destroy_write_struct(&png_ptr,NULL); + return TCL_ERROR; + } + +- png.set_write_fn(png_ptr, (png_voidp) &handle, tk_png_write, tk_png_flush); ++ png_set_write_fn(png_ptr, (png_voidp) &handle, tk_png_write, tk_png_flush); + + ImgWriteInit(dataPtr, &handle); +@@ -621,9 +510,9 @@ + tagcount = (tagcount > 1) ? (tagcount/2 - 1) : 0; + +- if (setjmp((((cleanup_info *) png.get_error_ptr(png_ptr))->jmpbuf))) { ++ if (setjmp((((cleanup_info *) png_get_error_ptr(png_ptr))->jmpbuf))) { + if (row_pointers) { + ckfree((char *) row_pointers); + } +- png.destroy_write_struct(&png_ptr,&info_ptr); ++ png_destroy_write_struct(&png_ptr,&info_ptr); + return TCL_ERROR; + } +@@ -652,5 +541,5 @@ + #if 0 /* The function png_set_filler doesn't seem to work; don't known why :-( */ + } else if ((blockPtr->pixelSize==4) && (newPixelSize == 3) +- && (png.set_filler != NULL)) { ++ && (png_set_filler != NULL)) { + /* + * The set_filler() function doesn't need to be called +@@ -660,16 +549,14 @@ + * possible with v0.95 and higher. + */ +- png.set_filler(png_ptr, 0, PNG_FILLER_AFTER); ++ png_set_filler(png_ptr, 0, PNG_FILLER_AFTER); + newPixelSize++; + #endif + } + +- png.set_IHDR(png_ptr, info_ptr, blockPtr->width, blockPtr->height, 8, ++ png_set_IHDR(png_ptr, info_ptr, blockPtr->width, blockPtr->height, 8, + color_type, PNG_INTERLACE_ADAM7, PNG_COMPRESSION_TYPE_BASE, + PNG_FILTER_TYPE_BASE); + +- if (png.set_gAMA) { +- png.set_gAMA(png_ptr, info_ptr, 1.0); +- } ++ png_set_gAMA(png_ptr, info_ptr, 1.0); + + if (tagcount > 0) { +@@ -686,10 +573,10 @@ + } + text.lang = NULL; +- png.set_text(png_ptr, info_ptr, (png_text *) &text, 1); ++ png_set_text(png_ptr, info_ptr, (png_text *) &text, 1); + } + } +- png.write_info(png_ptr,info_ptr); ++ png_write_info(png_ptr,info_ptr); + +- number_passes = png.set_interlace_handling(png_ptr); ++ number_passes = png_set_interlace_handling(png_ptr); + + if (blockPtr->pixelSize != newPixelSize) { +@@ -709,5 +596,5 @@ + dst += newPixelSize; + } +- png.write_row(png_ptr, row_pointers); ++ png_write_row(png_ptr, row_pointers); + } + } +@@ -717,11 +604,11 @@ + for (pass = 0; pass < number_passes; pass++) { + for(I=0;I<blockPtr->height;I++) { +- png.write_row(png_ptr, (png_bytep) blockPtr->pixelPtr ++ png_write_row(png_ptr, (png_bytep) blockPtr->pixelPtr + + I * blockPtr->pitch + blockPtr->offset[0]); + } + } + } +- png.write_end(png_ptr,NULL); +- png.destroy_write_struct(&png_ptr,&info_ptr); ++ png_write_end(png_ptr,NULL); ++ png_destroy_write_struct(&png_ptr,&info_ptr); + + return(TCL_OK); diff --git a/graphics/libimg/files/patch-tiff b/graphics/libimg/files/patch-tiff new file mode 100644 index 000000000000..5722f0ca1612 --- /dev/null +++ b/graphics/libimg/files/patch-tiff @@ -0,0 +1,592 @@ +--- imgTIFF.c Tue Jan 15 15:59:58 2002 ++++ imgTIFF.c Thu Jun 9 19:57:53 2005 +@@ -4,5 +4,5 @@ + * A photo image file handler for TIFF files. + * +- * Uses the libtiff.so library, which is dynamically ++ * Uses the libTIFFso library, which is dynamically + * loaded only when used. + * +@@ -40,9 +40,9 @@ + + #ifdef __WIN32__ +-#define TIFF_LIB_NAME "tiff.dll" ++#define TIFF_LIB_NAME "TIFFdll" + #endif + + #ifndef TIFF_LIB_NAME +-#define TIFF_LIB_NAME "libtiff.so" ++#define TIFF_LIB_NAME "libTIFFso" + #endif + +@@ -78,73 +78,4 @@ + }; + +-static struct TiffFunctions { +- VOID *handle; +- void (* Close) _ANSI_ARGS_((TIFF *)); +- int (* GetField) _ANSI_ARGS_(TCL_VARARGS(TIFF *, tif)); +- int (* GetFieldDefaulted) _ANSI_ARGS_(TCL_VARARGS(TIFF *,tif)); +- TIFF* (* Open) _ANSI_ARGS_((CONST char*, CONST char*)); +- int (* ReadEncodedStrip) _ANSI_ARGS_((TIFF*, tstrip_t, tdata_t, tsize_t)); +- int (* ReadRGBAImage) _ANSI_ARGS_((TIFF *, uint32, uint32, uint32*, int)); +- int (* ReadTile) _ANSI_ARGS_((TIFF *, uint32, uint32, uint32*, int)); +- int (* SetField) _ANSI_ARGS_(TCL_VARARGS(TIFF *, tif)); +- tsize_t (* TileSize) _ANSI_ARGS_((TIFF*)); +- int (* WriteEncodedStrip) _ANSI_ARGS_((TIFF*, tstrip_t, tdata_t, tsize_t)); +- void (* free) _ANSI_ARGS_((tdata_t)); +- tdata_t (* malloc) _ANSI_ARGS_((tsize_t)); +- tdata_t (* memcpy) _ANSI_ARGS_((tdata_t, tdata_t, tsize_t)); +- tdata_t (* realloc) _ANSI_ARGS_((tdata_t, tsize_t)); +- TIFFErrorHandler (* SetErrorHandler) _ANSI_ARGS_((TIFFErrorHandler)); +- TIFFErrorHandler (* SetWarningHandler) _ANSI_ARGS_((TIFFErrorHandler)); +- TIFF* (* ClientOpen) _ANSI_ARGS_((CONST char*, CONST char*, VOID *, +- TIFFReadWriteProc, TIFFReadWriteProc, TIFFSeekProc, +- TIFFCloseProc, TIFFSizeProc, TIFFMapFileProc, TIFFUnmapFileProc)); +- TIFFCodec* (*RegisterCODEC) _ANSI_ARGS_((uint16, CONST char*, VOID *)); +- void (* Error) _ANSI_ARGS_(TCL_VARARGS(CONST char *, arg1)); +- int (* PredictorInit) _ANSI_ARGS_((TIFF *)); +- void (* MergeFieldInfo) _ANSI_ARGS_((TIFF *, CONST VOID *, int)); +- int (* FlushData1) _ANSI_ARGS_((TIFF *)); +- void (* NoPostDecode) _ANSI_ARGS_((TIFF *, VOID*, tsize_t)); +- tsize_t (* TileRowSize) _ANSI_ARGS_((TIFF *)); +- tsize_t (* ScanlineSize) _ANSI_ARGS_((TIFF *)); +- void (* setByteArray) _ANSI_ARGS_((VOID **, VOID*, long)); +- int (* VSetField) _ANSI_ARGS_((TIFF *, ttag_t, va_list)); +- void (* SwabArrayOfShort) _ANSI_ARGS_((uint16*, unsigned long)); +-} tiff = {0}; +- +-static char *symbols[] = { +- "TIFFClose", +- "TIFFGetField", +- "TIFFGetFieldDefaulted", +- "TIFFOpen", +- "TIFFReadEncodedStrip", +- "TIFFReadRGBAImage", +- "TIFFReadTile", +- "TIFFSetField", +- "TIFFTileSize", +- "TIFFWriteEncodedStrip", +- /* The following symbols are not crucial. If they cannot be +- found, just don't use them. The ClientOpen function is +- more difficult to emulate, but even that is possible. */ +- "_TIFFfree", +- "_TIFFmalloc", +- "_TIFFmemcpy", +- "_TIFFrealloc", +- "TIFFSetErrorHandler", +- "TIFFSetWarningHandler", +- "TIFFClientOpen", +- "TIFFRegisterCODEC", /* not in libtiff.def */ +- "TIFFError", +- "TIFFPredictorInit", /* not in libtiff.def */ +- "_TIFFMergeFieldInfo", /* not in libtiff.def */ +- "TIFFFlushData1", /* not in libtiff.def */ +- "_TIFFNoPostDecode", /* not in libtiff.def */ +- "TIFFTileRowSize", +- "TIFFScanlineSize", +- "_TIFFsetByteArray", /* not in libtiff.def */ +- "TIFFVSetField", +- "TIFFSwabArrayOfShort", +- (char *) NULL +-}; +- + /* + * Prototypes for local procedures defined in this file: +@@ -162,166 +93,5 @@ + static int ParseWriteFormat _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *format, + int *comp, char **mode)); +-static int load_tiff_library _ANSI_ARGS_((Tcl_Interp *interp)); + static void _TIFFerr _ANSI_ARGS_((CONST char *, CONST char *, va_list)); +-static void _TIFFwarn _ANSI_ARGS_((CONST char *, CONST char *, va_list)); +-void ImgTIFFfree _ANSI_ARGS_((tdata_t data)); +-tdata_t ImgTIFFmalloc _ANSI_ARGS_((tsize_t size)); +-tdata_t ImgTIFFrealloc _ANSI_ARGS_((tdata_t data, tsize_t size)); +-tdata_t ImgTIFFmemcpy _ANSI_ARGS_((tdata_t, tdata_t, tsize_t)); +-void ImgTIFFError _ANSI_ARGS_(TCL_VARARGS(CONST char *, module)); +-int ImgTIFFPredictorInit _ANSI_ARGS_((TIFF *tif)); +-void ImgTIFFMergeFieldInfo _ANSI_ARGS_((TIFF* tif, CONST VOID *voidp, int i)); +-int ImgTIFFFlushData1 _ANSI_ARGS_((TIFF *tif)); +-void ImgTIFFNoPostDecode _ANSI_ARGS_((TIFF *, VOID *, tsize_t)); +-tsize_t ImgTIFFTileRowSize _ANSI_ARGS_((TIFF *)); +-tsize_t ImgTIFFScanlineSize _ANSI_ARGS_((TIFF *)); +-void ImgTIFFsetByteArray _ANSI_ARGS_((VOID **, VOID*, long)); +-int ImgTIFFSetField _ANSI_ARGS_(TCL_VARARGS(TIFF *, tif)); +-tsize_t ImgTIFFTileSize _ANSI_ARGS_((TIFF*)); +-void ImgTIFFSwabArrayOfShort _ANSI_ARGS_((uint16*, unsigned long)); +- +-/* +- * External hooks to functions, so they can be called from +- * imgTIFFzip.c and imgTIFFjpeg.c as well. +- */ +- +-void ImgTIFFfree (data) +- tdata_t data; +-{ +- if (tiff.free) { +- tiff.free(data); +- } else { +- ckfree((char *) data); +- } +-} +- +-tdata_t ImgTIFFmalloc(size) +- tsize_t size; +-{ +- if (tiff.malloc) { +- return tiff.malloc(size); +- } else { +- return ckalloc(size); +- } +-} +- +-tdata_t ImgTIFFrealloc(data, size) +- tdata_t data; +- tsize_t size; +-{ +- if (tiff.realloc) { +- return tiff.realloc(data, size); +- } else { +- return ckrealloc(data, size); +- } +-} +- +-tdata_t +-ImgTIFFmemcpy(a,b,c) +- tdata_t a; +- tdata_t b; +- tsize_t c; +-{ +- return tiff.memcpy(a,b,c); +-} +- +-void +-ImgTIFFError TCL_VARARGS_DEF(CONST char *, arg1) +-{ +- va_list ap; +- CONST char* module; +- CONST char* fmt; +- +- module = (CONST char*) TCL_VARARGS_START(CONST char *, arg1, ap); +- fmt = va_arg(ap, CONST char *); +- _TIFFerr(module, fmt, ap); +- va_end(ap); +-} +- +-int +-ImgTIFFPredictorInit(tif) +- TIFF *tif; +-{ +- return tiff.PredictorInit(tif); +-} +- +-void +-ImgTIFFMergeFieldInfo(tif, voidp, i) +- TIFF* tif; +- CONST VOID *voidp; +- int i; +-{ +- tiff.MergeFieldInfo(tif, voidp, i); +-} +- +-int +-ImgTIFFFlushData1(tif) +- TIFF *tif; +-{ +- return tiff.FlushData1(tif); +-} +- +-void +-ImgTIFFNoPostDecode(tif,a,b) +- TIFF * tif; +- VOID *a; +- tsize_t b; +-{ +- tiff.NoPostDecode(tif, a, b); +-} +- +-tsize_t +-ImgTIFFTileRowSize(tif) +- TIFF * tif; +-{ +- return tiff.TileRowSize(tif); +-} +- +-tsize_t +-ImgTIFFScanlineSize(tif) +- TIFF *tif; +-{ +- return tiff.ScanlineSize(tif); +-} +- +-void +-ImgTIFFsetByteArray(a,b,c) +- VOID **a; +- VOID *b; +- long c; +-{ +- tiff.setByteArray(a,b,c); +-} +- +-int +-ImgTIFFSetField TCL_VARARGS_DEF(TIFF*, arg1) +-{ +- va_list ap; +- TIFF* tif; +- ttag_t tag; +- int result; +- +- tif = (TIFF*) TCL_VARARGS_START(TIFF*, arg1, ap); +- tag = va_arg(ap, ttag_t); +- result = tiff.VSetField(tif, tag, ap); +- va_end(ap); +- return result; +-} +- +-tsize_t +-ImgTIFFTileSize(tif) +- TIFF* tif; +-{ +- return tiff.TileSize(tif); +-} +- +-void +-ImgTIFFSwabArrayOfShort(p, l) +- uint16* p; +- unsigned long l; +-{ +- tiff.SwabArrayOfShort(p,l); +- return; +-} + + /* +@@ -369,37 +139,15 @@ + } + +-static int +-load_tiff_library(interp) +- Tcl_Interp *interp; ++static void ++initialize(void) + { +- static int initialized = 0; +- if (errorMessage) { +- ckfree(errorMessage); +- errorMessage = NULL; +- } +- if (ImgLoadLib(interp, TIFF_LIB_NAME, &tiff.handle, symbols, 10) +- != TCL_OK) { +- return TCL_ERROR; +- } +- if (tiff.SetErrorHandler != NULL) { +- tiff.SetErrorHandler(_TIFFerr); +- } +- if (tiff.SetWarningHandler != NULL) { +- tiff.SetWarningHandler(_TIFFwarn); +- } ++ static int initialized; ++ + if (!initialized) { ++ TIFFSetErrorHandler(_TIFFerr); + initialized = 1; +- if (tiff.RegisterCODEC && tiff.Error && tiff.PredictorInit && +- tiff.MergeFieldInfo && tiff.FlushData1 && tiff.NoPostDecode && +- tiff.TileRowSize && tiff.ScanlineSize && tiff.setByteArray && +- tiff.VSetField && tiff.SwabArrayOfShort) { +- tiff.RegisterCODEC(COMPRESSION_DEFLATE, "Deflate", ImgInitTIFFzip); +- tiff.RegisterCODEC(COMPRESSION_JPEG, "JPEG", ImgInitTIFFjpeg); +- tiff.RegisterCODEC(COMPRESSION_PIXARLOG, "PixarLog", ImgInitTIFFpixar); +- } + } +- return TCL_OK; + } +- ++ + static void _TIFFerr(module, fmt, ap) + CONST char *module; +@@ -423,12 +171,4 @@ + } + +-/* warnings are not processed in Tcl */ +-static void _TIFFwarn(module, fmt, ap) +- CONST char *module; +- CONST char *fmt; +- va_list ap; +-{ +-} +- + static int + mapDummy(fd, base, size) +@@ -686,12 +426,9 @@ + TIFF *tif; + char tempFileName[256]; +- int count, result; ++ int result; + MFile handle; +- char buffer[1024]; + char *dataPtr = NULL; + +- if (load_tiff_library(interp) != TCL_OK) { +- return TCL_ERROR; +- } ++ initialize(); + + if (!ImgReadInit(data, '\115', &handle)) { +@@ -699,36 +436,14 @@ + } + +- if (tiff.ClientOpen) { +- tempFileName[0] = 0; +- if (handle.state != IMG_STRING) { +- dataPtr = ckalloc((handle.length*3)/4 + 2); +- handle.length = ImgRead(&handle, dataPtr, handle.length); +- handle.data = dataPtr; +- } +- handle.state = 0; +- tif = tiff.ClientOpen("inline data", "r", (thandle_t) &handle, +- readString, writeString, seekString, closeDummy, +- sizeString, mapDummy, unMapDummy); +- } else { +- Tcl_Channel outchan; +- tmpnam(tempFileName); +- outchan = ImgOpenFileChannel(interp, tempFileName, 0644); +- if (!outchan) { +- return TCL_ERROR; +- } +- +- count = ImgRead(&handle, buffer, 1024); +- while (count == 1024) { +- Tcl_Write(outchan, buffer, count); +- count = ImgRead(&handle, buffer, 1024); +- } +- if (count>0){ +- Tcl_Write(outchan, buffer, count); +- } +- if (Tcl_Close(interp, outchan) == TCL_ERROR) { +- return TCL_ERROR; +- } +- tif = tiff.Open(tempFileName, "r"); +- } ++ tempFileName[0] = 0; ++ if (handle.state != IMG_STRING) { ++ dataPtr = ckalloc((handle.length*3)/4 + 2); ++ handle.length = ImgRead(&handle, dataPtr, handle.length); ++ handle.data = dataPtr; ++ } ++ handle.state = 0; ++ tif = TIFFClientOpen("inline data", "r", (thandle_t) &handle, ++ readString, writeString, seekString, closeDummy, ++ sizeString, mapDummy, unMapDummy); + + if (tif != NULL) { +@@ -765,41 +480,16 @@ + TIFF *tif; + char tempFileName[256]; +- int count, result; +- char buffer[1024]; +- +- if (load_tiff_library(interp) != TCL_OK) { +- return TCL_ERROR; +- } ++ int result; ++ MFile handle; + +- if (tiff.ClientOpen) { +- MFile handle; +- tempFileName[0] = 0; +- handle.data = (char *) chan; +- handle.state = IMG_CHAN; +- tif = tiff.ClientOpen(fileName, "r", (thandle_t) &handle, +- readMFile, writeDummy, seekMFile, closeDummy, +- sizeMFile, mapDummy, unMapDummy); +- } else { +- Tcl_Channel outchan; +- tmpnam(tempFileName); +- outchan = ImgOpenFileChannel(interp, tempFileName, 0644); +- if (!outchan) { +- return TCL_ERROR; +- } ++ initialize(); + +- count = Tcl_Read(chan, buffer, 1024); +- while (count == 1024) { +- Tcl_Write(outchan, buffer, count); +- count = Tcl_Read(chan, buffer, 1024); +- } +- if (count>0){ +- Tcl_Write(outchan, buffer, count); +- } +- if (Tcl_Close(interp, outchan) == TCL_ERROR) { +- return TCL_ERROR; +- } ++ tempFileName[0] = 0; ++ handle.data = (char *) chan; ++ handle.state = IMG_CHAN; ++ tif = TIFFClientOpen(fileName, "r", (thandle_t) &handle, ++ readMFile, writeDummy, seekMFile, closeDummy, ++ sizeMFile, mapDummy, unMapDummy); + +- tif = tiff.Open(tempFileName, "r"); +- } + if (tif) { + result = CommonReadTIFF(interp, tif, format, imageHandle, +@@ -857,12 +547,8 @@ + block.pixelSize = sizeof (uint32); + +- tiff.GetField(tif, TIFFTAG_IMAGEWIDTH, &w); +- tiff.GetField(tif, TIFFTAG_IMAGELENGTH, &h); ++ TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w); ++ TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h); + npixels = w * h; +- if (tiff.malloc == NULL) { +- raster = (uint32 *) ckalloc(npixels * sizeof (uint32)); +- } else { +- raster = (uint32 *) tiff.malloc(npixels * sizeof (uint32)); +- } ++ raster = _TIFFmalloc(npixels * sizeof (uint32)); + block.width = w; + block.height = h; +@@ -874,10 +560,6 @@ + } + +- if (!tiff.ReadRGBAImage(tif, w, h, raster, 0) || errorMessage) { +- if (tiff.free == NULL) { +- ckfree((char *)raster); +- } else { +- tiff.free((char *)raster); +- } ++ if (!TIFFReadRGBAImage(tif, w, h, raster, 0) || errorMessage) { ++ _TIFFfree(raster); + if (errorMessage) { + Tcl_AppendResult(interp, errorMessage, (char *) NULL); +@@ -894,10 +576,6 @@ + destY, width, height); + +- if (tiff.free == NULL) { +- ckfree((char *)raster); +- } else { +- tiff.free((char *)raster); +- } +- tiff.Close(tif); ++ _TIFFfree(raster); ++ TIFFClose(tif); + return TCL_OK; + } +@@ -917,7 +595,5 @@ + Tcl_DString data; + +- if (load_tiff_library(interp) != TCL_OK) { +- return TCL_ERROR; +- } ++ initialize(); + + ImgFixStringWriteProc(&data, &interp, &dataPtr, &format, &blockPtr); +@@ -927,18 +603,13 @@ + } + +- if (tiff.ClientOpen) { +- tempFileName[0] = 0; +- Tcl_DStringInit(&dstring); +- ImgWriteInit(&dstring, &handle); +- tif = tiff.ClientOpen("inline data", mode, (thandle_t) &handle, +- readString, writeString, seekString, closeDummy, +- sizeString, mapDummy, unMapDummy); +- } else { +- tmpnam(tempFileName); +- tif = tiff.Open(tempFileName,mode); +- } ++ tempFileName[0] = 0; ++ Tcl_DStringInit(&dstring); ++ ImgWriteInit(&dstring, &handle); ++ tif = TIFFClientOpen("inline data", mode, (thandle_t) &handle, ++ readString, writeString, seekString, closeDummy, ++ sizeString, mapDummy, unMapDummy); + + result = CommonWriteTIFF(interp, tif, comp, blockPtr); +- tiff.Close(tif); ++ TIFFClose(tif); + + if (result != TCL_OK) { +@@ -999,8 +670,5 @@ + } + +- if (load_tiff_library(interp) != TCL_OK) { +- Tcl_DStringFree(&nameBuffer); +- return TCL_ERROR; +- } ++ initialize(); + + if (ParseWriteFormat(interp, format, &comp, &mode) != TCL_OK) { +@@ -1009,5 +677,5 @@ + } + +- if (!(tif = tiff.Open(fullname, mode))) { ++ if (!(tif = TIFFOpen(fullname, mode))) { + Tcl_AppendResult(interp, filename, ": ", Tcl_PosixError(interp), + (char *)NULL); +@@ -1019,5 +687,5 @@ + + result = CommonWriteTIFF(interp, tif, comp, blockPtr); +- tiff.Close(tif); ++ TIFFClose(tif); + return result; + } +@@ -1029,5 +697,5 @@ + char **mode; + { +- static char *tiffWriteOptions[] = {"-compression", "-byteorder"}; ++ static const char *tiffWriteOptions[] = {"-compression", "-byteorder"}; + int objc, length, c, i, index; + Tcl_Obj **objv; +@@ -1112,27 +780,27 @@ + unsigned char *data = NULL; + +- tiff.SetField(tif, TIFFTAG_IMAGEWIDTH, blockPtr->width); +- tiff.SetField(tif, TIFFTAG_IMAGELENGTH, blockPtr->height); +- tiff.SetField(tif, TIFFTAG_COMPRESSION, comp); +- +- tiff.SetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); +- tiff.SetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1); +- tiff.SetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); +- tiff.SetField(tif, TIFFTAG_ROWSPERSTRIP, blockPtr->height); +- +- tiff.SetField(tif, TIFFTAG_RESOLUTIONUNIT, (int)2); +- tiff.SetField(tif, TIFFTAG_XRESOLUTION, (float)1200.0); +- tiff.SetField(tif, TIFFTAG_YRESOLUTION, (float)1200.0); ++ TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, blockPtr->width); ++ TIFFSetField(tif, TIFFTAG_IMAGELENGTH, blockPtr->height); ++ TIFFSetField(tif, TIFFTAG_COMPRESSION, comp); ++ ++ TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); ++ TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1); ++ TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); ++ TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, blockPtr->height); ++ ++ TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, (int)2); ++ TIFFSetField(tif, TIFFTAG_XRESOLUTION, (float)1200.0); ++ TIFFSetField(tif, TIFFTAG_YRESOLUTION, (float)1200.0); + +- tiff.SetField(tif, TIFFTAG_BITSPERSAMPLE, 8); ++ TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8); + if ((blockPtr->offset[0] == blockPtr->offset[1]) + && (blockPtr->offset[0] == blockPtr->offset[2])) { + numsamples = 1; +- tiff.SetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1); +- tiff.SetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK); ++ TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1); ++ TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK); + } else { + numsamples = 3; +- tiff.SetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3); +- tiff.SetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB); ++ TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3); ++ TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB); + } + +@@ -1186,5 +854,5 @@ + } + +- tiff.WriteEncodedStrip(tif, 0, data, ++ TIFFWriteEncodedStrip(tif, 0, data, + numsamples * blockPtr->width * blockPtr->height); + if (data != blockPtr->pixelPtr) { diff --git a/graphics/libimg/files/patch-tk84_Tk_PhotoPutBlock b/graphics/libimg/files/patch-tk84_Tk_PhotoPutBlock index 7cdb0eb6d863..7b4be394f46c 100644 --- a/graphics/libimg/files/patch-tk84_Tk_PhotoPutBlock +++ b/graphics/libimg/files/patch-tk84_Tk_PhotoPutBlock @@ -87,8 +87,8 @@ } break; } ---- imgUtil.c.orig Sat Mar 20 23:09:14 1999 -+++ imgUtil.c Mon Dec 1 12:47:43 2003 +--- imgUtil.c Tue Jan 15 15:59:59 2002 ++++ imgUtil.c Thu Jun 9 20:51:49 2005 @@ -95,7 +95,7 @@ } if (end > X) { @@ -98,7 +98,7 @@ } X = end; } -@@ -103,7 +103,7 @@ +@@ -103,12 +103,12 @@ } blockPtr->pixelPtr = imagePtr; } else { @@ -107,13 +107,20 @@ } return TCL_OK; } -@@ -248,4 +248,4 @@ + +- ++#if 0 /* OS run-time linker is better suited for this job { */ + /* + *---------------------------------------------------------------------- + * +@@ -248,4 +248,5 @@ dlclose(*handlePtr); } *handlePtr = IMG_FAILED; -} \ No newline at end of file +} ++#endif /* } */ --- imgWindow.c.orig Sat Jan 15 13:25:37 2000 +++ imgWindow.c Mon Dec 1 12:52:11 2003 @@ -378,7 +378,7 @@ diff --git a/graphics/libimg/files/patch-warnings b/graphics/libimg/files/patch-warnings new file mode 100644 index 000000000000..91aaaf017842 --- /dev/null +++ b/graphics/libimg/files/patch-warnings @@ -0,0 +1,229 @@ +--- imgObj.c Tue Jan 15 16:00:08 2002 ++++ imgObj.c Thu Jun 9 05:28:23 2005 +@@ -33,5 +33,5 @@ + return (initialized = IMG_PERL|IMG_OBJS); + #else +- char *version; ++ const char *version; + initialized = IMG_TCL; + if (!Tcl_GetCommandInfo(interp,"image", &cmdInfo)) { +--- imgInit.c Tue Jan 15 15:59:58 2002 ++++ imgInit.c Thu Jun 9 05:27:40 2005 +@@ -94,5 +94,5 @@ + { + Tk_PhotoImageFormat **formatPtr = Formats; +- char *version; ++ const char *version; + + if ((version = Tcl_InitStubs(interp, "8.0", 0)) == NULL) { +--- imgPmap.h Tue Jan 15 15:59:58 2002 ++++ imgPmap.h Thu Jun 9 05:48:57 2005 +@@ -53,5 +53,5 @@ + int ncolors; /* number of colors */ + int cpp; /* characters per pixel */ +- char ** data; /* The data that defines this pixmap ++ const char ** data; /* The data that defines this pixmap + * image (array of strings). It is + * converted into an X Pixmap when this +--- imgPmap.c Tue Jan 15 15:59:58 2002 ++++ imgPmap.c Thu Jun 9 05:52:31 2005 +@@ -49,6 +53,5 @@ + Display *display)); + static void ImgXpmDelete _ANSI_ARGS_((ClientData clientData)); +-static int ImgXpmCmd _ANSI_ARGS_((ClientData clientData, +- Tcl_Interp *interp, int argc, char **argv)); ++static Tcl_CmdProc ImgXpmCmd; + static void ImgXpmCmdDeletedProc _ANSI_ARGS_(( + ClientData clientData)); +@@ -56,11 +59,11 @@ + PixmapInstance *instancePtr)); + static int ImgXpmConfigureMaster _ANSI_ARGS_(( +- PixmapMaster *masterPtr, int argc, char **argv, +- int flags)); ++ PixmapMaster *masterPtr, int argc, ++ const char **argv, int flags)); + static int ImgXpmGetData _ANSI_ARGS_((Tcl_Interp *interp, + PixmapMaster *masterPtr)); +-static char ** ImgXpmGetDataFromFile _ANSI_ARGS_((Tcl_Interp * interp, ++static const char ** ImgXpmGetDataFromFile _ANSI_ARGS_((Tcl_Interp * interp, + char * string, int * numLines_return)); +-static char ** ImgXpmGetDataFromString _ANSI_ARGS_((Tcl_Interp*interp, ++static const char ** ImgXpmGetDataFromString _ANSI_ARGS_((Tcl_Interp*interp, + char * string, int * numLines_return)); + static void ImgXpmGetPixmapFromData _ANSI_ARGS_(( +@@ -68,7 +71,7 @@ + PixmapMaster *masterPtr, + PixmapInstance *instancePtr)); +-static char * GetType _ANSI_ARGS_((char * colorDefn, ++static const char * GetType _ANSI_ARGS_((const char * colorDefn, + int * type_ret)); +-static char * GetColor _ANSI_ARGS_((char * colorDefn, ++static const char * GetColor _ANSI_ARGS_((const char * colorDefn, + char * colorName, int * type_ret)); + +@@ -131,6 +134,6 @@ + PixmapMaster *masterPtr; + int i; +- char *argvbuf[10]; +- char **args = argvbuf; ++ const char *argvbuf[10]; ++ const char **args = argvbuf; + + /* +@@ -138,5 +141,5 @@ + */ + if (argc > 10) { +- args = (char **) ckalloc(argc * sizeof(char *)); ++ args = (const char **)ckalloc(argc * sizeof(char *)); + } + for (i = 0; i < argc; i++) { +@@ -197,5 +200,5 @@ + * overall pixmap image to (reconfigure). */ + int argc; /* Number of entries in argv. */ +- char **argv; /* Pairs of configuration options for image. */ ++ const char **argv; /* Pairs of configuration options for image. */ + int flags; /* Flags to pass to Tk_ConfigureWidget, + * such as TK_CONFIG_ARGV_ONLY. */ +@@ -280,8 +283,8 @@ + PixmapMaster *masterPtr; + { +- char ** data = NULL; ++ const char ** data = NULL; + int isAllocated = 0; /* do we need to free "data"? */ + int listArgc; +- char ** listArgv = NULL; ++ const char ** listArgv = NULL; + int numLines; + int size[2]; +@@ -371,5 +374,6 @@ + } + +-static char ** ImgXpmGetDataFromString(interp, string, numLines_return) ++static const char ** ++ImgXpmGetDataFromString(interp, string, numLines_return) + Tcl_Interp * interp; + char * string; +@@ -379,5 +383,5 @@ + char * p, * list; + int numLines; +- char ** data; ++ const char ** data; + + /* skip the leading blanks (leading blanks are not defined in the +@@ -497,8 +501,9 @@ + error: + Tcl_AppendResult(interp, "File format error", NULL); +- return (char**) NULL; ++ return NULL; + } + +-static char ** ImgXpmGetDataFromFile(interp, fileName, numLines_return) ++static const char ** ++ImgXpmGetDataFromFile(interp, fileName, numLines_return) + Tcl_Interp * interp; + char * fileName; +@@ -507,10 +512,10 @@ + Tcl_Channel chan; + int size; +- char ** data = (char **) NULL; ++ const char ** data = NULL; + char *cmdBuffer = NULL; + + chan = ImgOpenFileChannel(interp, fileName, 0); + if (!chan) { +- return (char **) NULL; ++ return NULL; + } + +@@ -540,10 +545,10 @@ + + +-static char * ++static const char * + GetType(colorDefn, type_ret) +- char * colorDefn; ++ const char * colorDefn; + int * type_ret; + { +- char * p = colorDefn; ++ const char * p = colorDefn; + + /* skip white spaces */ +@@ -590,7 +595,7 @@ + * colorName is guaranteed to be big enough + */ +-static char * ++static const char * + GetColor(colorDefn, colorName, type_ret) +- char * colorDefn; ++ const char * colorDefn; + char * colorName; /* if found, name is copied to this array */ + int * type_ret; +@@ -699,5 +704,5 @@ + + for (i=0; i<masterPtr->ncolors; i++) { +- char * colorDefn; /* the color definition line */ ++ const char * colorDefn; /* the color definition line */ + char * colorName; /* temp place to hold the color name + * defined for one type of visual */ +@@ -790,5 +795,5 @@ + */ + for (i=0; i<masterPtr->size[1]; i++) { +- char * p = masterPtr->data[i+lOffset]; ++ const char * p = masterPtr->data[i+lOffset]; + + for (j=0; j<masterPtr->size[0]; j++) { +@@ -905,5 +910,5 @@ + Tcl_Interp *interp; /* Current interpreter. */ + int argc; /* Number of arguments. */ +- char **argv; /* Argument strings. */ ++ const char *argv[]; /* Argument strings. */ + { + PixmapMaster *masterPtr = (PixmapMaster *) clientData; +--- imgPS.c Tue Jan 15 16:00:10 2002 ++++ imgPS.c Thu Jun 9 05:58:04 2005 +@@ -269,5 +269,5 @@ + { + #ifndef MAC_TCL +- char *argv[10]; ++ const char *argv[10]; + int len, i, j, fileWidth, fileHeight, maxintensity, index; + char *p, type; +--- imgXPM.c Tue Jan 15 16:00:08 2002 ++++ imgXPM.c Thu Jun 9 20:33:32 2005 +@@ -287,6 +287,6 @@ + char buffer[MAX_BUFFER]; + int i, isMono; +- int color1; +- unsigned int data; ++ intptr_t color1; ++ uintptr_t data; + Tcl_HashEntry *hPtr; + +@@ -466,5 +466,5 @@ + + for (i = 0; i < width; ) { +- unsigned int col; ++ uintptr_t col; + + memcpy((char *) &color1, p, byteSize); +@@ -476,7 +476,7 @@ + */ + if (hPtr != (Tcl_HashEntry *)NULL) +- col = (int)Tcl_GetHashValue(hPtr); ++ col = (uintptr_t)Tcl_GetHashValue(hPtr); + else +- col = (int)0; ++ col = 0; + + /* +@@ -500,7 +500,7 @@ + hPtr = Tcl_FindHashEntry(&colorTable, (char *) color1); + if (hPtr != (Tcl_HashEntry *)NULL) +- col = (int)Tcl_GetHashValue(hPtr); ++ col = (uintptr_t)Tcl_GetHashValue(hPtr); + else +- col = (int)0; ++ col = 0; + } + } while ((i < width) && col); |