[gs-code-review] Upgrading the clist file access with 64 bits file access.

Igor V. Melichev igor.melichev at artifex.com
Tue Sep 5 07:24:59 PDT 2006


This patvh to be applied after
http://ghostscript.com/pipermail/gs-code-review/2006-September/004840.html

[Log message beg]
Upgrading the clist file access with 64 bits file access.

DETAILS :

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

None.
[Log message end]
-------------- next part --------------
 
 
 
 
*** F:\SVN-GS\HEAD\gs\src\gxband.h	Wed Mar 15 15:04:17 2006
--- files\gs\src\gxband.h	Tue Sep  5 17:38:03 2006
***************
*** 63,67 ****
      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 */
      gx_band_params_t band_params;  /* parameters used when writing band list */
  				/* (actual values, no 0s) */
--- 63,67 ----
      clist_file_ptr bfile;	/* block file, normally 0 */
      uint tile_cache_size;	/* size of tile cache */
!     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) */
 
 
 
*** F:\SVN-GS\HEAD\gs\src\gxcldev.h	Wed Mar 15 15:04:44 2006
--- files\gs\src\gxcldev.h	Tue Sep  5 17:53:10 2006
***************
*** 216,220 ****
      int band_min, band_max;
  #define cmd_band_end (-1)	/* end of band file */
!     long pos;			/* starting position in cfile */
  } cmd_block;
  
--- 216,220 ----
      int band_min, band_max;
  #define cmd_band_end (-1)	/* end of band file */
!     int64_t pos;		/* starting position in cfile */
  } cmd_block;
  
 
 
 
*** F:\SVN-GS\HEAD\gs\src\gxclfile.c	Wed Mar 15 15:04:34 2006
--- files\gs\src\gxclfile.c	Tue Sep  5 17:32:12 2006
***************
*** 37,41 ****
  	    return_error(gs_error_invalidfileaccess);
  	*pcf =
! 	    (clist_file_ptr) gp_open_scratch_file(gp_scratch_file_name_prefix,
  						  fname, fmode);
      } else
--- 37,41 ----
  	    return_error(gs_error_invalidfileaccess);
  	*pcf =
! 	    (clist_file_ptr) gp_open_scratch_file_64(gp_scratch_file_name_prefix,
  						  fname, fmode);
      } else
***************
*** 124,131 ****
  }
  
! long
  clist_ftell(clist_file_ptr cf)
  {
!     return ftell((FILE *) cf);
  }
  
--- 124,131 ----
  }
  
! int64_t
  clist_ftell(clist_file_ptr cf)
  {
!     return gp_ftell_64((FILE *) cf);
  }
  
***************
*** 155,160 ****
  
  int
! clist_fseek(clist_file_ptr cf, long offset, int mode, const char *ignore_fname)
  {
!     return fseek((FILE *) cf, offset, mode);
  }
--- 155,160 ----
  
  int
! clist_fseek(clist_file_ptr cf, int64_t offset, int mode, const char *ignore_fname)
  {
!     return gp_fseek_64((FILE *) cf, offset, mode);
  }
 
 
 
*** F:\SVN-GS\HEAD\gs\src\gxclio.h	Wed Mar 15 15:05:09 2006
--- files\gs\src\gxclio.h	Tue Sep  5 17:34:09 2006
***************
*** 78,82 ****
  int clist_ferror_code(clist_file_ptr cf);
  
! long clist_ftell(clist_file_ptr cf);
  
  /*
--- 78,82 ----
  int clist_ferror_code(clist_file_ptr cf);
  
! int64_t clist_ftell(clist_file_ptr cf);
  
  /*
***************
*** 87,91 ****
  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);
  
  #endif /* gxclio_INCLUDED */
--- 87,91 ----
  void clist_rewind(clist_file_ptr cf, bool discard_data, const char *fname);
  
! int clist_fseek(clist_file_ptr cf, int64_t offset, int mode, const char *fname);
  
  #endif /* gxclio_INCLUDED */
 
 
 
*** F:\SVN-GS\HEAD\gs\src\gxclist.c	Wed Mar 15 15:04:38 2006
--- files\gs\src\gxclist.c	Tue Sep  5 17:54:16 2006
***************
*** 658,662 ****
      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);
  #endif
      return 0;
--- 658,662 ----
      if (gs_debug_c('l') | gs_debug_c(':'))
  	dlprintf2("[:]clist_end_page at cfile=%ld, bfile=%ld\n",
! 		  (long)cb.pos, (long)cldev->page_bfile_end_pos);
  #endif
      return 0;
 
 
 
*** F:\SVN-GS\HEAD\gs\src\gxclmem.c	Wed Mar 15 15:04:30 2006
--- files\gs\src\gxclmem.c	Tue Sep  5 17:43:46 2006
***************
*** 864,868 ****
  }
  
! long
  memfile_ftell(clist_file_ptr cf)
  {
--- 864,868 ----
  }
  
! int64_t
  memfile_ftell(clist_file_ptr cf)
  {
***************
*** 887,891 ****
  
  int
! memfile_fseek(clist_file_ptr cf, long offset, int mode, const char *ignore_fname)
  {
      MEMFILE *f = (MEMFILE *) cf;
--- 887,891 ----
  
  int
! memfile_fseek(clist_file_ptr cf, int64_t offset, int mode, const char *ignore_fname)
  {
      MEMFILE *f = (MEMFILE *) cf;
 
 
 
*** F:\SVN-GS\HEAD\gs\src\gxclmem.h	Wed Mar 15 15:04:30 2006
--- files\gs\src\gxclmem.h	Tue Sep  5 17:49:28 2006
***************
*** 89,98 ****
      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 */
      char *pdata;		/* raw data */
      char *pdata_end;
      /* physical file properties */
!     long total_space;		/* so we know when to start compress */
      PHYS_MEMFILE_BLK *phys_curr;	/* NULL if not compressing      */
      RAW_BUFFER *raw_head, *raw_tail;
--- 89,98 ----
      LOG_MEMFILE_BLK *log_head;
      LOG_MEMFILE_BLK *log_curr_blk;
!     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 */
!     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;
 
 
 
*** F:\SVN-GS\HEAD\gs\src\gxclread.c	Wed Mar 15 15:04:42 2006
--- files\gs\src\gxclread.c	Tue Sep  5 17:54:46 2006
***************
*** 107,111 ****
  	    int bmin = ss->b_this.band_min;
  	    int bmax = ss->b_this.band_max;
! 	    long pos = ss->b_this.pos;
  
  	    clist_fread_chars(&ss->b_this, sizeof(ss->b_this), bfile);
--- 107,111 ----
  	    int bmin = ss->b_this.band_min;
  	    int bmax = ss->b_this.band_max;
! 	    int64_t pos = ss->b_this.pos;
  
  	    clist_fread_chars(&ss->b_this, sizeof(ss->b_this), bfile);
***************
*** 116,121 ****
  	    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);
  	}
      }
--- 116,121 ----
  	    if_debug5('l', "[l]reading for bands (%d,%d) at bfile %ld, cfile %ld, length %u\n",
  		      bmin, bmax,
! 		      (long)(clist_ftell(bfile) - 2 * sizeof(ss->b_this)),
! 		      (long)pos, left);
  	}
      }
 
 
 
*** F:\SVN-GS\HEAD\gs\src\gxclutil.c	Wed Mar 15 15:04:32 2006
--- files\gs\src\gxclutil.c	Tue Sep  5 17:57:48 2006
***************
*** 146,150 ****
  	cb.pos = clist_ftell(cfile);
  	if_debug3('l', "[l]writing for bands (%d,%d) at %ld\n",
! 		  band_min, band_max, cb.pos);
  	clist_fwrite_chars(&cb, sizeof(cb), bfile);
  	if (cp != 0) {
--- 146,150 ----
  	cb.pos = clist_ftell(cfile);
  	if_debug3('l', "[l]writing for bands (%d,%d) at %ld\n",
! 		  band_min, band_max, (long)cb.pos);
  	clist_fwrite_chars(&cb, sizeof(cb), bfile);
  	if (cp != 0) {
 
 
 
 


More information about the gs-code-review mailing list