[gs-cvs] rev 8780 - trunk/gs/src

mvrhel at ghostscript.com mvrhel at ghostscript.com
Tue May 27 13:12:08 PDT 2008


Author: mvrhel
Date: 2008-05-27 13:12:08 -0700 (Tue, 27 May 2008)
New Revision: 8780

Modified:
   trunk/gs/src/gsicc.c
Log:
Addition of debug code to dump embedded ICC profiles for external analysis.  

Modified: trunk/gs/src/gsicc.c
===================================================================
--- trunk/gs/src/gsicc.c	2008-05-27 17:07:40 UTC (rev 8779)
+++ trunk/gs/src/gsicc.c	2008-05-27 20:12:08 UTC (rev 8780)
@@ -27,6 +27,7 @@
 #include "icc.h"		/* must precede icc.h */
 #include "gsicc.h"
 
+#define SAVEICCPROFILE 0
 
 typedef struct _icmFileGs icmFileGs;
 
@@ -432,6 +433,14 @@
     icc *           picc;
     icmLuBase * plu = NULL;
     icmFile *pfile = NULL;
+
+#if   SAVEICCPROFILE
+
+    unsigned int num_bytes;
+    unsigned char *iccbuffer;
+    FILE *fid;
+
+#endif
 	
     /* verify that the file is legitimate */
     if (picc_info->file_id != (instrp->read_id | instrp->write_id))
@@ -461,6 +470,20 @@
       
 	if ((picc->read(picc, pfile, 0)) != 0)
 	    goto return_rangecheck;
+
+#if SAVEICCPROFILE
+
+        num_bytes = picc->header->size;
+        iccbuffer = (unsigned char *) malloc(num_bytes);
+        pfile->seek(pfile,0);
+        pfile->read(pfile,iccbuffer,1,num_bytes);
+        fid = fopen("DumpedICC.icm","wb");
+        fwrite(iccbuffer,sizeof(unsigned char),num_bytes,fid);
+        fclose(fid);
+        free(iccbuffer);
+
+#endif
+        
             
 	/* verify the profile type */
 	profile_class = picc->header->deviceClass;



More information about the gs-cvs mailing list