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

leonardo at ghostscript.com leonardo at ghostscript.com
Wed Sep 13 04:59:11 PDT 2006


Author: leonardo
Date: 2006-09-13 04:59:10 -0700 (Wed, 13 Sep 2006)
New Revision: 7041

Modified:
   trunk/gs/src/gxband.h
   trunk/gs/src/gxcldev.h
   trunk/gs/src/gxclfile.c
   trunk/gs/src/gxclio.h
   trunk/gs/src/gxclist.c
   trunk/gs/src/gxclmem.c
   trunk/gs/src/gxclmem.h
   trunk/gs/src/gxclread.c
   trunk/gs/src/gxclutil.c
Log:
Upgrading the clist file access with 64 bits file access.

DETAILS :

Bug 688394 "clist playback of large pdf image segfaults".

clist file position variable changed type to int64_t.
 
EXPECTED DIFFERENCES :

None.


Modified: trunk/gs/src/gxband.h
===================================================================
--- trunk/gs/src/gxband.h	2006-09-13 11:57:46 UTC (rev 7040)
+++ trunk/gs/src/gxband.h	2006-09-13 11:59:10 UTC (rev 7041)
@@ -62,7 +62,7 @@
     char bfname[gp_file_name_sizeof];	/* block file name */
     clist_file_ptr bfile;	/* block file, normally 0 */
     uint tile_cache_size;	/* size of tile cache */
-    long bfile_end_pos;		/* ftell at end of bfile */
+    int64_t bfile_end_pos;		/* ftell at end of bfile */
     gx_band_params_t band_params;  /* parameters used when writing band list */
 				/* (actual values, no 0s) */
     int scan_lines_per_colors_used; /* number of scan lines per colors_used */

Modified: trunk/gs/src/gxcldev.h
===================================================================
--- trunk/gs/src/gxcldev.h	2006-09-13 11:57:46 UTC (rev 7040)
+++ trunk/gs/src/gxcldev.h	2006-09-13 11:59:10 UTC (rev 7041)
@@ -215,7 +215,7 @@
 typedef struct cmd_block_s {
     int band_min, band_max;
 #define cmd_band_end (-1)	/* end of band file */
-    long pos;			/* starting position in cfile */
+    int64_t pos;		/* starting position in cfile */
 } cmd_block;
 
 /* ---------------- Band state ---------------- */

Modified: trunk/gs/src/gxclfile.c
===================================================================
--- trunk/gs/src/gxclfile.c	2006-09-13 11:57:46 UTC (rev 7040)
+++ trunk/gs/src/gxclfile.c	2006-09-13 11:59:10 UTC (rev 7041)
@@ -36,7 +36,7 @@
 	if (fmode[0] == 'r')
 	    return_error(gs_error_invalidfileaccess);
 	*pcf =
-	    (clist_file_ptr) gp_open_scratch_file(gp_scratch_file_name_prefix,
+	    (clist_file_ptr) gp_open_scratch_file_64(gp_scratch_file_name_prefix,
 						  fname, fmode);
     } else
 	*pcf = gp_fopen(fname, fmode);
@@ -123,10 +123,10 @@
     return (ferror((FILE *) cf) ? gs_error_ioerror : 0);
 }
 
-long
+int64_t
 clist_ftell(clist_file_ptr cf)
 {
-    return ftell((FILE *) cf);
+    return gp_ftell_64((FILE *) cf);
 }
 
 void
@@ -154,7 +154,7 @@
 }
 
 int
-clist_fseek(clist_file_ptr cf, long offset, int mode, const char *ignore_fname)
+clist_fseek(clist_file_ptr cf, int64_t offset, int mode, const char *ignore_fname)
 {
-    return fseek((FILE *) cf, offset, mode);
+    return gp_fseek_64((FILE *) cf, offset, mode);
 }

Modified: trunk/gs/src/gxclio.h
===================================================================
--- trunk/gs/src/gxclio.h	2006-09-13 11:57:46 UTC (rev 7040)
+++ trunk/gs/src/gxclio.h	2006-09-13 11:59:10 UTC (rev 7041)
@@ -77,7 +77,7 @@
  */
 int clist_ferror_code(clist_file_ptr cf);
 
-long clist_ftell(clist_file_ptr cf);
+int64_t clist_ftell(clist_file_ptr cf);
 
 /*
  * We pass the file name to clist_rewind and clist_fseek in case the
@@ -86,6 +86,6 @@
  */
 void clist_rewind(clist_file_ptr cf, bool discard_data, const char *fname);
 
-int clist_fseek(clist_file_ptr cf, long offset, int mode, const char *fname);
+int clist_fseek(clist_file_ptr cf, int64_t offset, int mode, const char *fname);
 
 #endif /* gxclio_INCLUDED */

Modified: trunk/gs/src/gxclist.c
===================================================================
--- trunk/gs/src/gxclist.c	2006-09-13 11:57:46 UTC (rev 7040)
+++ trunk/gs/src/gxclist.c	2006-09-13 11:59:10 UTC (rev 7041)
@@ -657,7 +657,7 @@
 #ifdef DEBUG
     if (gs_debug_c('l') | gs_debug_c(':'))
 	dlprintf2("[:]clist_end_page at cfile=%ld, bfile=%ld\n",
-		  cb.pos, cldev->page_bfile_end_pos);
+		  (long)cb.pos, (long)cldev->page_bfile_end_pos);
 #endif
     return 0;
 }

Modified: trunk/gs/src/gxclmem.c
===================================================================
--- trunk/gs/src/gxclmem.c	2006-09-13 11:57:46 UTC (rev 7040)
+++ trunk/gs/src/gxclmem.c	2006-09-13 11:59:10 UTC (rev 7041)
@@ -863,7 +863,7 @@
     return (((MEMFILE *) cf)->error_code);	/* errors stored here */
 }
 
-long
+int64_t
 memfile_ftell(clist_file_ptr cf)
 {
     return (((MEMFILE *) cf)->log_curr_pos);
@@ -886,7 +886,7 @@
 }
 
 int
-memfile_fseek(clist_file_ptr cf, long offset, int mode, const char *ignore_fname)
+memfile_fseek(clist_file_ptr cf, int64_t offset, int mode, const char *ignore_fname)
 {
     MEMFILE *f = (MEMFILE *) cf;
     long i, block_num, new_pos;

Modified: trunk/gs/src/gxclmem.h
===================================================================
--- trunk/gs/src/gxclmem.h	2006-09-13 11:57:46 UTC (rev 7040)
+++ trunk/gs/src/gxclmem.h	2006-09-13 11:59:10 UTC (rev 7041)
@@ -88,12 +88,12 @@
     /* logical file properties */
     LOG_MEMFILE_BLK *log_head;
     LOG_MEMFILE_BLK *log_curr_blk;
-    long log_length;		/* updated during write             */
-    long log_curr_pos;		/* updated during seek, close, read */
+    int64_t log_length;		/* updated during write             */
+    int64_t log_curr_pos;	/* updated during seek, close, read */
     char *pdata;		/* raw data */
     char *pdata_end;
     /* physical file properties */
-    long total_space;		/* so we know when to start compress */
+    int64_t total_space;	/* so we know when to start compress */
     PHYS_MEMFILE_BLK *phys_curr;	/* NULL if not compressing      */
     RAW_BUFFER *raw_head, *raw_tail;
     int error_code;		/* used by CLIST_ferror         */

Modified: trunk/gs/src/gxclread.c
===================================================================
--- trunk/gs/src/gxclread.c	2006-09-13 11:57:46 UTC (rev 7040)
+++ trunk/gs/src/gxclread.c	2006-09-13 11:59:10 UTC (rev 7041)
@@ -106,7 +106,7 @@
 	} {
 	    int bmin = ss->b_this.band_min;
 	    int bmax = ss->b_this.band_max;
-	    long pos = ss->b_this.pos;
+	    int64_t pos = ss->b_this.pos;
 
 	    clist_fread_chars(&ss->b_this, sizeof(ss->b_this), bfile);
 	    if (!(ss->band_last >= bmin && ss->band_first <= bmax))
@@ -115,8 +115,8 @@
 	    left = (uint) (ss->b_this.pos - pos);
 	    if_debug5('l', "[l]reading for bands (%d,%d) at bfile %ld, cfile %ld, length %u\n",
 		      bmin, bmax,
-		      clist_ftell(bfile) - 2 * sizeof(ss->b_this),
-		      pos, left);
+		      (long)(clist_ftell(bfile) - 2 * sizeof(ss->b_this)),
+		      (long)pos, left);
 	}
     }
     pw->ptr = q;

Modified: trunk/gs/src/gxclutil.c
===================================================================
--- trunk/gs/src/gxclutil.c	2006-09-13 11:57:46 UTC (rev 7040)
+++ trunk/gs/src/gxclutil.c	2006-09-13 11:59:10 UTC (rev 7041)
@@ -145,7 +145,7 @@
 	cb.band_max = band_max;
 	cb.pos = clist_ftell(cfile);
 	if_debug3('l', "[l]writing for bands (%d,%d) at %ld\n",
-		  band_min, band_max, cb.pos);
+		  band_min, band_max, (long)cb.pos);
 	clist_fwrite_chars(&cb, sizeof(cb), bfile);
 	if (cp != 0) {
 	    pcl->tail->next = 0;	/* terminate the list */



More information about the gs-cvs mailing list