.99.2 release Irix problems with dvipng

ezra peisach <[email protected]>
Newsgroups gmane.comp.tex.tetex.beta
Message-ID <[email protected]>
There are several issues with the use using a void * in arithmetic.
Essentially - the code assumes that a (void * ) + 1 is 
the same as a (char *) + 1. I am not sure that is totally legal as
when adding to a pointer - when moves by the size of what one is pointing to.

The Irix error is:
>>  The expression must be a pointer to a complete object type.

The following patches apply to the dvipng directory...
*** color.c	2004/11/07 23:36:50	1.1
--- color.c	2004/11/07 23:38:08
***************
*** 66,72 ****
    if ((colornames = malloc(fmmap.size*2))==NULL) 
      Fatal("cannot alloc space for color names");
    pos=fmmap.mmap;
!   max=fmmap.mmap+fmmap.size;
    tmp=colornames;
    buf=(char*)colornames+fmmap.size;
    while (pos<max && *pos!='\\') pos++;
--- 66,72 ----
    if ((colornames = malloc(fmmap.size*2))==NULL) 
      Fatal("cannot alloc space for color names");
    pos=fmmap.mmap;
!   max=(char *)fmmap.mmap+fmmap.size;
    tmp=colornames;
    buf=(char*)colornames+fmmap.size;
    while (pos<max && *pos!='\\') pos++;
*** enc.c	2004/11/07 23:43:02	1.1
--- enc.c	2004/11/07 23:44:27
***************
*** 57,63 ****
    encp->name=(char*)encp+sizeof(struct encoding);
    strcpy(encp->name,encoding);
    pos=fmmap.mmap;
!   max=fmmap.mmap+fmmap.size;
    buf=encp->name+strlen(encoding)+1;
  #define SKIPCOMMENT(x) if (*x=='%') while (x<max && *x!='\n') x++;
    while(pos<max && *pos!='/') {
--- 57,63 ----
    encp->name=(char*)encp+sizeof(struct encoding);
    strcpy(encp->name,encoding);
    pos=fmmap.mmap;
!   max=(char *)fmmap.mmap+fmmap.size;
    buf=encp->name+strlen(encoding)+1;
  #define SKIPCOMMENT(x) if (*x=='%') while (x<max && *x!='\n') x++;
    while(pos<max && *pos!='/') {
*** fontmap.c	2004/11/07 23:46:05	1.1
--- fontmap.c	2004/11/07 23:46:19
***************
*** 73,79 ****
      return;
    }
    pos = psfont_mmap.mmap;
!   end = psfont_mmap.mmap+psfont_mmap.size;
    while(pos<end) {
      while(pos < end && (*pos=='\n' || *pos==' ' || *pos=='\t' 
  			|| *pos=='%' || *pos=='*' || *pos==';' || *pos=='#')) {
--- 73,79 ----
      return;
    }
    pos = psfont_mmap.mmap;
!   end = (char *)psfont_mmap.mmap+psfont_mmap.size;
    while(pos<end) {
      while(pos < end && (*pos=='\n' || *pos==' ' || *pos=='\t' 
  			|| *pos=='%' || *pos=='*' || *pos==';' || *pos=='#')) {
*** pk.c	2004/11/07 23:39:24	1.1
--- pk.c	2004/11/07 23:41:25
***************
*** 201,207 ****
    ptr->w = shrunk_width;
    ptr->h = shrunk_height;
    pos+=n;
!   buffer = (char*)alloca(shrunk_width*shrunk_height*
  			 shrinkfactor*shrinkfactor*sizeof(char));
    (void)memset(buffer,0,shrunk_width*shrunk_height*
  	       shrinkfactor*shrinkfactor*sizeof(char));
--- 201,207 ----
    ptr->w = shrunk_width;
    ptr->h = shrunk_height;
    pos+=n;
!   buffer = (unsigned char*)alloca(shrunk_width*shrunk_height*
  			 shrinkfactor*shrinkfactor*sizeof(char));
    (void)memset(buffer,0,shrunk_width*shrunk_height*
  	       shrinkfactor*shrinkfactor*sizeof(char));
***************
*** 353,359 ****
    position = skip_specials(position);
    while (*position != PK_POST) {
      DEBUG_PRINT(DEBUG_PK,("\n  @%ld PK CHAR:\t%d",
! 		  (long)((void*)position - tfontp->fmmap.mmap), *position));
      if ((tcharptr = malloc(sizeof(struct char_entry))) == NULL)
        Fatal("can't malloc space for char_entry");
      tcharptr->flag_byte = *position;
--- 353,360 ----
    position = skip_specials(position);
    while (*position != PK_POST) {
      DEBUG_PRINT(DEBUG_PK,("\n  @%ld PK CHAR:\t%d",
! 		  (long)(position - (unsigned char *)tfontp->fmmap.mmap), 
! 			 *position));
      if ((tcharptr = malloc(sizeof(struct char_entry))) == NULL)
        Fatal("can't malloc space for char_entry");
      tcharptr->flag_byte = *position;
*** tfm.c	2004/11/07 23:47:36	1.1
--- tfm.c	2004/11/07 23:49:01
***************
*** 39,52 ****
    DEBUG_PRINT((DEBUG_DVI|DEBUG_FT|DEBUG_TFM),
  	      ("\n  OPEN METRICS:\t'%s'", tfmname));
    if (MmapFile(tfmname,&fmmap)) return(false);
!   lh = UNumRead(fmmap.mmap+2,2);
!   bc = UNumRead(fmmap.mmap+4,2);
!   ec = UNumRead(fmmap.mmap+6,2);
!   nw = UNumRead(fmmap.mmap+8,2);
    DEBUG_PRINT(DEBUG_TFM,(" %d %d %d %d",lh,bc,ec,nw));
    width=alloca(nw*sizeof(dviunits));  
    c=0;
!   position=fmmap.mmap+24+(lh+ec-bc+1)*4;
    while( c < nw ) {
      width[c] = SNumRead(position,4);
      c++;
--- 39,52 ----
    DEBUG_PRINT((DEBUG_DVI|DEBUG_FT|DEBUG_TFM),
  	      ("\n  OPEN METRICS:\t'%s'", tfmname));
    if (MmapFile(tfmname,&fmmap)) return(false);
!   lh = UNumRead((unsigned char *)fmmap.mmap+2,2);
!   bc = UNumRead((unsigned char *)fmmap.mmap+4,2);
!   ec = UNumRead((unsigned char *)fmmap.mmap+6,2);
!   nw = UNumRead((unsigned char *)fmmap.mmap+8,2);
    DEBUG_PRINT(DEBUG_TFM,(" %d %d %d %d",lh,bc,ec,nw));
    width=alloca(nw*sizeof(dviunits));  
    c=0;
!   position=(unsigned char *) fmmap.mmap+24+(lh+ec-bc+1)*4;
    while( c < nw ) {
      width[c] = SNumRead(position,4);
      c++;
***************
*** 55,64 ****
    
    /* Read char widths */
    c=bc;
!   position=fmmap.mmap+24+lh*4;
    while(c <= ec) {
      DEBUG_PRINT(DEBUG_TFM,("\n@%ld TFM METRICS:\t", 
! 		 (long)((void*)position - fmmap.mmap)));
      tcharptr=xmalloc(sizeof(struct char_entry));
      tcharptr->data=NULL;
      tcharptr->tfmw=width[*position];
--- 55,64 ----
    
    /* Read char widths */
    c=bc;
!   position=(unsigned char *)fmmap.mmap + 24 + lh * 4;
    while(c <= ec) {
      DEBUG_PRINT(DEBUG_TFM,("\n@%ld TFM METRICS:\t", 
! 		 (long)(position - (unsigned char *) fmmap.mmap)));
      tcharptr=xmalloc(sizeof(struct char_entry));
      tcharptr->data=NULL;
      tcharptr->tfmw=width[*position];
*** vf.c	2004/11/07 23:41:51	1.1
--- vf.c	2004/11/07 23:42:35
***************
*** 82,88 ****
    position += 8;
    while(*position >= FNT_DEF1 && *position <= FNT_DEF4) {
      DEBUG_PRINT(DEBUG_VF,("\n  @%ld VF:\t%s", 
! 		  (long)((void*)position - tfontp->fmmap.mmap), 
  		  dvi_commands[*position]));
      FontDef(position,tfontp);	
      length = dvi_commandlength[*position];
--- 82,88 ----
    position += 8;
    while(*position >= FNT_DEF1 && *position <= FNT_DEF4) {
      DEBUG_PRINT(DEBUG_VF,("\n  @%ld VF:\t%s", 
! 		  (long)(position - (unsigned char *) tfontp->fmmap.mmap), 
  		  dvi_commands[*position]));
      FontDef(position,tfontp);	
      length = dvi_commandlength[*position];
***************
*** 98,104 ****
    /* Read char definitions */
    while(*position < FNT_DEF1) {
      DEBUG_PRINT(DEBUG_VF,("\n@%ld VF CHAR:\t", 
! 		 (long)((void*)position - tfontp->fmmap.mmap)));
      tcharptr=xmalloc(sizeof(struct char_entry));
      switch (*position) {
      case LONG_CHAR:
--- 98,104 ----
    /* Read char definitions */
    while(*position < FNT_DEF1) {
      DEBUG_PRINT(DEBUG_VF,("\n@%ld VF CHAR:\t", 
! 		 (long)(position - (unsigned char *) tfontp->fmmap.mmap)));
      tcharptr=xmalloc(sizeof(struct char_entry));
      switch (*position) {
      case LONG_CHAR:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.