[PD-cvs] externals/zexy/src msgfile.c,1.16,1.17

IOhannes m zmölnig zmoelnig at users.sourceforge.net
Tue Mar 6 18:33:14 CET 2007


Update of /cvsroot/pure-data/externals/zexy/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20439

Modified Files:
	msgfile.c 
Log Message:
increased the headroom for converting the buffer from the text-format to a binbuf-readable one;
LATER see how this is done in [textfile]


Index: msgfile.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/msgfile.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** msgfile.c	6 Mar 2007 16:38:54 -0000	1.16
--- msgfile.c	6 Mar 2007 17:33:12 -0000	1.17
***************
*** 532,535 ****
--- 532,536 ----
    char buf[MAXPDSTRING], *bufptr, *readbuf;
    char *charbinbuf=NULL, *cbb;
+   int charbinbuflength=0;
    char*dirname=canvas_getdir(x->x_canvas)->s_name;
  
***************
*** 539,543 ****
    t_binbuf *bbuf = binbuf_new();
  
- 
  #ifdef __WIN32__
    rmode |= O_BINARY;
--- 540,543 ----
***************
*** 599,611 ****
  
  # define MSGFILE_HEADROOM 1024
  
!   charbinbuf=(char*)getbytes(length+MSGFILE_HEADROOM);
    cbb=charbinbuf;
!   for(pos=0; pos<length+MSGFILE_HEADROOM; pos++)charbinbuf[pos]=0;
  
    *cbb++=';';
    pos=1;
    while (readlength--) {
!     if(pos>=length+MSGFILE_HEADROOM){
        pd_error(x, "msgfile: read error (headroom %d too small!)", MSGFILE_HEADROOM);
        goto read_error;
--- 599,613 ----
  
  # define MSGFILE_HEADROOM 1024
+   charbinbuflength=2*length+MSGFILE_HEADROOM;
  
!   charbinbuf=(char*)getbytes(charbinbuflength);
!   
    cbb=charbinbuf;
!   for(pos=0; pos<charbinbuflength; pos++)charbinbuf[pos]=0;
  
    *cbb++=';';
    pos=1;
    while (readlength--) {
!     if(pos>=charbinbuflength){
        pd_error(x, "msgfile: read error (headroom %d too small!)", MSGFILE_HEADROOM);
        goto read_error;
***************
*** 627,631 ****
  
    /* convert to binbuf */
!   binbuf_text(bbuf, charbinbuf, length+MSGFILE_HEADROOM);
    msgfile_binbuf2listbuf(x, bbuf);
  
--- 629,633 ----
  
    /* convert to binbuf */
!   binbuf_text(bbuf, charbinbuf, charbinbuflength);
    msgfile_binbuf2listbuf(x, bbuf);
  
***************
*** 633,637 ****
    binbuf_free(bbuf);
    t_freebytes(readbuf, length);
!   t_freebytes(charbinbuf, length+MSGFILE_HEADROOM);
  }
  static void msgfile_read(t_msgfile *x, t_symbol *filename, t_symbol *format)
--- 635,639 ----
    binbuf_free(bbuf);
    t_freebytes(readbuf, length);
!   t_freebytes(charbinbuf, charbinbuflength);
  }
  static void msgfile_read(t_msgfile *x, t_symbol *filename, t_symbol *format)





More information about the Pd-cvs mailing list