Anonymous avatar Anonymous committed f5c6ed3

- sync to 1.8.1

Comments (0)

Files changed (3)

 #include <setjmp.h>
 #include <limits.h>
 #include <string.h>
-#include "jinclude.h"
+/* 1.8.1: remove dependency on jinclude.h */
 #include "jpeglib.h"
 #include "jerror.h"
 #include "gd.h"
 		quality);
     else
 	strcat(comment + strlen(comment), " default quality\n");
-    jpeg_write_marker(&cinfo, JPEG_COM, (JOCTET *)comment,
+    jpeg_write_marker(&cinfo, JPEG_COM, (unsigned char *)comment,
 		      (unsigned int)strlen(comment));
 
     for (i = 0; i < im->sy; i++) {
   struct jpeg_source_mgr pub;	/* public fields */
 
   gdIOCtx *infile;		/* source stream */
-  JOCTET * buffer;		/* start of buffer */
+  unsigned char * buffer;		/* start of buffer */
   safeboolean start_of_file;	/* have we gotten any data yet? */
 } my_source_mgr;
 
       ERREXIT(cinfo, JERR_INPUT_EMPTY);
     WARNMS(cinfo, JWRN_JPEG_EOF);
     /* Insert a fake EOI marker */
-    src->buffer[0] = (JOCTET) 0xFF;
-    src->buffer[1] = (JOCTET) JPEG_EOI;
+    src->buffer[0] = (unsigned char) 0xFF;
+    src->buffer[1] = (unsigned char) JPEG_EOI;
     nbytes = 2;
   }
 
   if (cinfo->src == NULL) {	/* first time for this JPEG object? */
     cinfo->src = (struct jpeg_source_mgr *)
       (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
-				  SIZEOF(my_source_mgr));
+				  sizeof(my_source_mgr));
     src = (my_src_ptr) cinfo->src;
-    src->buffer = (JOCTET *)
+    src->buffer = (unsigned char *)
       (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
-				  INPUT_BUF_SIZE * SIZEOF(JOCTET));
+				  INPUT_BUF_SIZE * sizeof(unsigned char));
   }
 
   src = (my_src_ptr) cinfo->src;
 typedef struct {
   struct jpeg_destination_mgr pub; /* public fields */
   gdIOCtx * outfile;		/* target stream */
-  JOCTET * buffer;		/* start of buffer */
+  unsigned char * buffer;		/* start of buffer */
 } my_destination_mgr;
 
 typedef my_destination_mgr * my_dest_ptr;
   my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
 
   /* Allocate the output buffer --- it will be released when done with image */
-  dest->buffer = (JOCTET *)
+  dest->buffer = (unsigned char *)
       (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
-				  OUTPUT_BUF_SIZE * SIZEOF(JOCTET));
+				  OUTPUT_BUF_SIZE * sizeof(unsigned char));
 
   dest->pub.next_output_byte = dest->buffer;
   dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
   if (cinfo->dest == NULL) {	/* first time for this JPEG object? */
     cinfo->dest = (struct jpeg_destination_mgr *)
       (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
-				  SIZEOF(my_destination_mgr));
+				  sizeof(my_destination_mgr));
   }
 
   dest = (my_dest_ptr) cinfo->dest;
 #include <stdio.h>
-#include <unistd.h> /* For unlink function */
+#ifdef _WIN32
+#include <process.h>
+int unlink(const char * filename) { 
+	return _unlink(filename);
+}
+#else 
+#include <unistd.h>   /* for getpid(), unlink() */
+#endif
 #include "gd.h"
 
 /* A short program which converts a .png file into a .gd file, for
 	gdImageDestroy(im2);
         gdImageDestroy(im3);
 
+#ifdef HAVE_JPEG
 	out = fopen("test/gdtest.jpg", "wb");
 	if (!out) {
 		fprintf(stderr, "Can't create file test/gdtest.jpg.\n");
 	printf("Created test/gdtest.jpg successfully. Compare this image\n"
 		"to the input image manually. Some difference must be\n"
 		"expected as JPEG is a lossy file format.\n");
+#endif /* HAVE_JPEG */
 	gdImageDestroy(im);
 	gdImageDestroy(ref);
 
 #include <stdio.h>
 #include <stdlib.h>   /* for atoi() */
 #include <string.h>
-#include <unistd.h>   /* for getpid(), unlink() */
 
+#ifdef _WIN32
+#include <process.h>
+int getpid() { 
+	return _getpid();
+}
+#else 
+#include <unistd.h>   /* for getpid(), unlink() */
+#endif
 int main(int argc, char **argv)
 {
 	FILE *in;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.