Changes: https://sourceforge.net/p/tkimg/code/HEAD/tree/tags/1.4.16/ANNOUNCE Prodded by: portscout
159 lines
4.7 KiB
Plaintext
159 lines
4.7 KiB
Plaintext
--- jpeg/jpeg.c 2023-04-19 09:19:56.206635300 -0400
|
|
+++ jpeg/jpeg.c 2024-01-08 11:50:37.142511000 -0500
|
|
@@ -64,5 +64,9 @@
|
|
#include "tkimg.h"
|
|
#ifdef USE_TCL_STUBS
|
|
-#include "jpegtcl.h"
|
|
+#ifdef EXTERN
|
|
+# undef EXTERN
|
|
+#endif
|
|
+#include <jpeglib.h>
|
|
+#include <jerror.h>
|
|
#else
|
|
#include "jpeglib.h"
|
|
@@ -70,9 +74,6 @@
|
|
#endif
|
|
|
|
-static int SetupJPegLibrary(Tcl_Interp *interp);
|
|
+#define MORE_INITIALIZATION {}
|
|
|
|
-#define MORE_INITIALIZATION \
|
|
- if (SetupJPegLibrary (interp) != TCL_OK) { return TCL_ERROR; }
|
|
-
|
|
#include "init.c"
|
|
|
|
@@ -149,92 +150,4 @@
|
|
|
|
|
|
-
|
|
-static int
|
|
-SetupJPegLibrary(
|
|
- Tcl_Interp *interp
|
|
-) {
|
|
- struct jpeg_compress_struct *cinfo; /* libjpeg's parameter structure */
|
|
- struct my_error_mgr jerror; /* for controlling libjpeg error handling */
|
|
- int i;
|
|
-
|
|
-#ifdef USE_TCL_STUBS
|
|
- if (Jpegtcl_InitStubs(interp, JPEGTCL_VERSION, 0) == NULL) {
|
|
- return TCL_ERROR;
|
|
- }
|
|
-#endif
|
|
-
|
|
- /* The followin code tries to determine if the JPEG library is
|
|
- valid at all. The library might be configured differently,
|
|
- which will produce core dumps. Also it might be that
|
|
- fields appear in different places in jpeg_compress_struct
|
|
- or jpeg_decompress_struct. This will make the library totally
|
|
- unusable. In stead of a core-dump, we better have a proper
|
|
- error message */
|
|
-
|
|
- /* overallocat size, so we don't get a core-dump if the library
|
|
- thinks that the structure is much larger */
|
|
-
|
|
- cinfo = (struct jpeg_compress_struct *) attemptckalloc(8*sizeof(struct jpeg_compress_struct));
|
|
- if (cinfo == NULL) {
|
|
- Tcl_AppendResult (interp, "Unable to allocate memory for image data.", (char *) NULL);
|
|
- return TCL_ERROR;
|
|
- }
|
|
- cinfo->err = jpeg_std_error(&jerror.pub);
|
|
- jerror.pub.error_exit = my_error_exit;
|
|
- jerror.pub.output_message = my_output_message;
|
|
- /* Establish the setjmp return context for my_error_exit to use. */
|
|
- if (SETJMP(jerror.setjmp_buffer)) {
|
|
- /* If we get here, the JPEG library is invalid. */
|
|
- jpeg_destroy_compress(cinfo);
|
|
- ckfree((char *)cinfo);
|
|
-
|
|
- if (interp) {
|
|
- Tcl_AppendResult(interp, "Could not use \"", "jpegtcl",
|
|
- "\": please upgrade to at least version 6a", (char *) NULL);
|
|
- }
|
|
- return TCL_ERROR;
|
|
- }
|
|
-
|
|
- /* Now we can initialize libjpeg. */
|
|
- ((char *) cinfo)[sizeof(struct jpeg_compress_struct)] = 53;
|
|
- jpeg_create_compress(cinfo);
|
|
- if (((char *) cinfo)[sizeof(struct jpeg_compress_struct)] != 53) {
|
|
- /* Oops. The library changed this value, which is outside the
|
|
- * structure. Definitely, the library is invalid!!!! */
|
|
- ERREXIT(cinfo, JMSG_NOMESSAGE);
|
|
- }
|
|
-
|
|
- /* Set up JPEG compression parameters. */
|
|
- cinfo->image_width = 16;
|
|
- cinfo->image_height = 16;
|
|
- cinfo->input_components = 3;
|
|
- cinfo->in_color_space = JCS_RGB;
|
|
- cinfo->data_precision = -1;
|
|
- cinfo->optimize_coding = TRUE;
|
|
- cinfo->dct_method = -1;
|
|
- cinfo->X_density = 0;
|
|
- cinfo->Y_density = 0;
|
|
- jpeg_set_defaults(cinfo);
|
|
-
|
|
- if ((cinfo->data_precision != BITS_IN_JSAMPLE) ||
|
|
- (cinfo->optimize_coding != FALSE) ||
|
|
- (cinfo->dct_method != JDCT_DEFAULT) ||
|
|
- (cinfo->X_density != 1) ||
|
|
- (cinfo->Y_density != 1)) {
|
|
- ERREXIT(cinfo, JMSG_NOMESSAGE);
|
|
- }
|
|
- for (i = 0; i < NUM_ARITH_TBLS; i++) {
|
|
- if ((cinfo->arith_dc_L[i] != 0) ||
|
|
- (cinfo->arith_dc_U[i] != 1) ||
|
|
- (cinfo->arith_ac_K[i] != 5)) {
|
|
- ERREXIT(cinfo, JMSG_NOMESSAGE);
|
|
- }
|
|
- }
|
|
- jpeg_destroy_compress(cinfo);
|
|
- ckfree((char *) cinfo);
|
|
- return TCL_OK;
|
|
-}
|
|
-
|
|
-
|
|
/*
|
|
*----------------------------------------------------------------------
|
|
@@ -873,8 +786,6 @@
|
|
case 2: {
|
|
#ifdef USE_JPEGTCL_STUBS
|
|
- if (jpeg_simple_progression != NULL) {
|
|
- /* Select simple progressive mode. */
|
|
- jpeg_simple_progression(cinfo);
|
|
- }
|
|
+ /* Select simple progressive mode. */
|
|
+ jpeg_simple_progression(cinfo);
|
|
#else
|
|
jpeg_simple_progression(cinfo);
|
|
--- tests/jpeg.test 2016-07-30 10:30:48.000000000 -0400
|
|
+++ tests/jpeg.test 2020-01-20 21:43:20.086115000 -0500
|
|
@@ -24,5 +24,5 @@
|
|
source $file2.base64
|
|
|
|
- test jpeg-1.1 {} -setup {
|
|
+ test jpeg-1.1 {} -constraints nonPortable -setup {
|
|
catch {image delete i}
|
|
} -body {
|
|
@@ -33,5 +33,5 @@
|
|
} -result $imgdata2
|
|
|
|
- test jpeg-1.2 {} -setup {
|
|
+ test jpeg-1.2 {} -constraints nonPortable -setup {
|
|
catch {image delete i}
|
|
} -body {
|
|
@@ -42,5 +42,5 @@
|
|
} -result $imgdata2
|
|
|
|
- test jpeg-1.3 {} -setup {
|
|
+ test jpeg-1.3 {} -constraints nonPortable -setup {
|
|
catch {image delete i}
|
|
} -body {
|
|
@@ -52,5 +52,5 @@
|
|
} -result $imgdata2
|
|
|
|
- test jpeg-1.4 {} -setup {
|
|
+ test jpeg-1.4 {} -constraints nonPortable -setup {
|
|
catch {image delete i}
|
|
} -body {
|